<div class="gmail_quote">On Fri, Mar 26, 2010 at 6:24 AM, <span dir="ltr"><<a href="mailto:edoardo.belletti@alice.it">edoardo.belletti@alice.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<p><font size="2">Hi<br>
I have a problem with this exaple:<br>
<br>
/*=========================================================================<br>
<br>
Program: Visualization Toolkit<br>
Module: $RCSfile: Cylinder.cxx,v $<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
All rights reserved.<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
=========================================================================*/<br>
//This example demonstrates the use of vtkXYPlotActor to display three<br>
//probe lines using three different techniques. In this example, we are<br>
//loading data using the vtkPLOT3DReader. We are using the vtkProbeFilter<br>
//to extract the underlying point data along three probe lines.<br>
<br>
//<br>
//First we include the VTK Tcl packages which will make available<br>
//all of the vtk commands to Tcl.<br>
//<br>
#include "vtkPLOT3DReader.h"<br>
#include "vtkLineSource.h"<br>
#include "vtkTransform.h"<br>
#include "vtkTransformPolyDataFilter.h"<br>
#include "vtkProbeFilter.h"<br>
#include "vtkProperty2D.h"<br>
<br>
#include "vtkAppendPolyData.h"<br>
#include "vtkTubeFilter.h"<br>
<br>
#include "vtkPolyDataMapper.h"<br>
#include "vtkActor.h"<br>
#include "vtkXYPlotActor.h"<br>
#include "vtkTextProperty.h"<br>
#include "vtkStructuredGridOutlineFilter.h"<br>
<br>
#include "vtkRenderer.h"<br>
#include "vtkRenderWindow.h"<br>
#include "vtkRenderWindowInteractor.h"<br>
#include "vtkProperty.h"<br>
#include "vtkCamera.h"<br>
<br>
int main()<br>
{<br>
//Create a PLOT3D reader and load the data.<br>
//<br>
vtkPLOT3DReader *pl3d=vtkPLOT3DReader::New();<br>
pl3d->SetXYZFileName("combxyz.bin");<br>
pl3d->SetQFileName("combq.bin");<br>
pl3d->SetScalarFunctionNumber(100);<br>
pl3d->SetVectorFunctionNumber(202);<br>
pl3d->Update();<br>
<br>
//Create three the line source to use for the probe lines.<br>
vtkLineSource *line=vtkLineSource::New();<br>
line->SetResolution(30);<br>
<br>
<br>
//Move the line into place and create the probe filter. For vtkProbeFilter,<br>
//the probe line is the input, and the underlying data set is the source.<br>
vtkTransform *transL1=vtkTransform::New();<br>
transL1->Translate(3.7,0.0,28.37);<br>
transL1->Scale(5,5,5);<br>
transL1->RotateY(90);<br>
vtkTransformPolyDataFilter *tf=vtkTransformPolyDataFilter::New();<br>
tf->SetInputConnection(line->GetOutputPort());<br>
tf->SetTransform(transL1);<br>
vtkProbeFilter *probe=vtkProbeFilter::New();<br>
probe->SetInputConnection(tf->GetOutputPort());<br>
probe->SetSource(pl3d->GetOutput());<br>
<br>
//Move the line again and create another probe filter.<br>
vtkTransform *transL2=vtkTransform::New();<br>
transL2->Translate(9.2,0.0,31.20);<br>
transL2->Scale (5, 5, 5);<br>
transL2-> RotateY (90);<br>
vtkTransformPolyDataFilter *tf2=vtkTransformPolyDataFilter::New();<br>
tf2-> SetInputConnection (line-> GetOutputPort());<br>
tf2 ->SetTransform (transL2);<br>
vtkProbeFilter *probe2=vtkProbeFilter::New();<br>
probe2-> SetInputConnection (tf2 ->GetOutputPort());<br>
probe2-> SetSource (pl3d-> GetOutput());<br>
<br>
//Move the line again and create a third probe filter.<br>
vtkTransform *transL3=vtkTransform::New();<br>
transL3-> Translate( 13.27, 0.0, 33.40);<br>
transL3->Scale( 4.5, 4.5, 4.5);<br>
transL3-> RotateY( 90);<br>
vtkTransformPolyDataFilter *tf3=vtkTransformPolyDataFilter::New();<br>
tf3-> SetInputConnection(line->GetOutputPort());<br>
tf3-> SetTransform (transL3);<br>
vtkProbeFilter *probe3=vtkProbeFilter::New();<br>
probe3-> SetInputConnection (tf3 ->GetOutputPort());<br>
probe3-> SetSource(pl3d-> GetOutput());<br>
<br>
//Create a vtkAppendPolyData to merge the output of the three probe filters<br>
//into one data set.<br>
vtkAppendPolyData *appendF=vtkAppendPolyData::New();<br>
appendF-> AddInput (probe-> GetPolyDataOutput());<br>
appendF-> AddInput (probe2-> GetPolyDataOutput());<br>
appendF-> AddInput (probe3-> GetPolyDataOutput());<br>
<br>
//Create a tube filter to represent the lines as tubes. Set up the associated<br>
//mapper and actor.<br>
vtkTubeFilter *tuber=vtkTubeFilter::New();<br>
tuber-> SetInputConnection (appendF->GetOutputPort());<br>
tuber-> SetRadius (0.1);<br>
vtkPolyDataMapper *lineMapper=vtkPolyDataMapper::New();<br>
lineMapper-> SetInputConnection (tuber-> GetOutputPort());<br>
vtkActor *lineActor=vtkActor::New();<br>
lineActor-> SetMapper( lineMapper);<br>
<br>
// Create an xy-plot using the output of the 3 probe filters as input.<br>
//The x-values we are plotting are arc length.<br>
vtkXYPlotActor *xyplot=vtkXYPlotActor::New();<br>
xyplot-> AddInput (probe-> GetOutput());<br>
xyplot-> AddInput (probe2-> GetOutput());<br>
xyplot->AddInput (probe3-> GetOutput());<br>
xyplot->GetPositionCoordinate()-> SetValue (0.0, 0.67, 0);<br>
xyplot-> GetPosition2Coordinate()-> SetValue (1.0, 0.33, 0); //relative to<br>
Position<br>
xyplot-> SetXValuesToArcLength();<br>
xyplot-> SetNumberOfXLabels( 6);<br>
xyplot ->SetTitle ("Pressure vs. Arc Length (Zoomed View)");<br>
xyplot-> SetXTitle( "");<br>
xyplot-> SetYTitle ("P");<br>
xyplot-> SetXRange( .1 ,.35);<br>
xyplot-> SetYRange( .2, .4);<br>
xyplot-> GetProperty()-> SetColor (0, 0, 0);<br>
xyplot-> GetProperty()-> SetLineWidth( 2);<br>
//Set text prop color (same color for backward compat with test)<br>
//Assign same object to all text props<br>
vtkTextProperty *tprop;<br>
tprop =xyplot-> GetTitleTextProperty();<br>
tprop ->SetColor(xyplot-> GetProperty()-> GetColor());<br>
xyplot ->SetAxisTitleTextProperty (tprop);<br>
xyplot-> SetAxisLabelTextProperty (tprop);<br>
<br>
//Create an xy-plot using the output of the 3 probe filters as input.<br>
//The x-values we are plotting are normalized arc length.<br>
vtkXYPlotActor *xyplot2=vtkXYPlotActor::New();<br>
xyplot2-> AddInput (probe-> GetOutput());<br>
xyplot2 ->AddInput (probe2 ->GetOutput());<br>
xyplot2-> AddInput (probe3 ->GetOutput());<br>
xyplot2-> GetPositionCoordinate()-> SetValue (0.00 ,0.33, 0);<br>
xyplot2-> GetPosition2Coordinate()-> SetValue( 1.0, 0.33, 0); //<br>
relative to Position<br>
xyplot2-> SetXValuesToNormalizedArcLength();<br>
xyplot2-> SetNumberOfXLabels (6);<br>
xyplot2-> SetTitle ("Pressure vs. Normalized Arc Length");<br>
xyplot2-> SetXTitle ("");<br>
xyplot2 ->SetYTitle ("P");<br>
xyplot2-> PlotPointsOn();<br>
xyplot2 ->PlotLinesOff();<br>
xyplot2-> GetProperty()-> SetColor (1 ,0, 0);<br>
xyplot2-> GetProperty()-> SetPointSize (2);<br>
//Set text prop color (same color for backward compat with test)<br>
//Assign same object to all text props<br>
//vtkTextProperty *tprop;<br>
tprop =xyplot2-> GetTitleTextProperty();<br>
tprop ->SetColor(xyplot-> GetProperty()-> GetColor());<br>
xyplot2 ->SetAxisTitleTextProperty (tprop);<br>
xyplot2-> SetAxisLabelTextProperty (tprop);<br>
<br>
//Create an xy-plot using the output of the 3 probe filters as input.<br>
//The x-values we are plotting are the underlying point data values.<br>
vtkXYPlotActor *xyplot3=vtkXYPlotActor::New();<br>
xyplot3-> AddInput (probe-> GetOutput());<br>
xyplot3-> AddInput (probe2-> GetOutput());<br>
xyplot3 ->AddInput (probe3 ->GetOutput());<br>
xyplot3-> GetPositionCoordinate()-> SetValue (0.0, 0.0 ,0);<br>
xyplot3-> GetPosition2Coordinate()-> SetValue (1.0, 0.33, 0); <br>
//relative to Position<br>
xyplot3 ->SetXValuesToIndex();<br>
xyplot3-> SetNumberOfXLabels (6);<br>
xyplot3 ->SetTitle ("Pressure vs. Point Id");<br>
xyplot3-> SetXTitle ("Probe Length");<br>
xyplot3 ->SetYTitle ("P");<br>
xyplot3 ->PlotPointsOn();<br>
xyplot3->GetProperty()-> SetColor (0 ,0, 1);<br>
xyplot3-> GetProperty()-> SetPointSize (3);<br>
// Set text prop color (same color for backward compat with test)<br>
//sign same object to all text props<br>
//vtkTextProperty *tprop;<br>
tprop =xyplot3-> GetTitleTextProperty();<br>
tprop ->SetColor(xyplot-> GetProperty()-> GetColor());<br>
xyplot3 ->SetAxisTitleTextProperty (tprop);<br>
xyplot3-> SetAxisLabelTextProperty (tprop);<br>
<br>
//aw an outline of the PLOT3D data set.<br>
vtkStructuredGridOutlineFilter *outline=vtkStructuredGridOutlineFilter::New();<br>
outline ->SetInputConnection (pl3d-> GetOutputPort());<br>
vtkPolyDataMapper *outlineMapper=vtkPolyDataMapper::New();<br>
outlineMapper-> SetInputConnection (outline ->GetOutputPort());<br>
vtkActor *outlineActor=vtkActor::New();<br>
outlineActor-> SetMapper (outlineMapper);<br>
outlineActor-> GetProperty()-> SetColor( 0, 0, 0);<br>
<br>
//Create the Renderers, RenderWindow, and RenderWindowInteractor.<br>
vtkRenderer *ren1 = vtkRenderer::New();<br>
vtkRenderer *ren2 = vtkRenderer::New();<br>
<br>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(ren1);<br>
renWin->AddRenderer(ren2);<br>
<br>
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
//Set the background, viewport (necessary because we want to have the<br>
//renderers draw to different parts of the render window) of the first<br>
// renderer. Add the outline and line actors to the renderer. <br>
ren1-> SetBackground (0.6784 ,0.8471, 0.9020);<br>
ren1 ->SetViewport (0, 0, .5, 1);<br>
ren1-> AddActor (outlineActor);<br>
ren1 ->AddActor (lineActor);<br>
// Set the background and viewport of the second renderer. Add the xy-plot<br>
//actors to the renderer. Set the size of the render window.<br>
ren2 ->SetBackground (1, 1, 1);<br>
ren2 ->SetViewport (0.5 ,0.0 ,1.0, 1.0);<br>
ren2 ->AddActor2D (xyplot);<br>
ren2->AddActor2D (xyplot2);<br>
ren2-> AddActor2D (xyplot3);<br>
renWin-> SetSize (500, 250);<br>
// We'll zoom in a little by accessing the camera and invoking a "Zoom"<br>
// method on it.<br>
ren1->ResetCamera();<br>
ren1->GetActiveCamera()->Zoom(1.5);<br>
renWin->Render();<br>
<br>
<br>
// Set up the camera parameters.<br>
vtkCamera *cam1;<br>
cam1= ren1 ->GetActiveCamera();<br>
cam1-> SetClippingRange (3.95297, 100);<br>
cam1-> SetFocalPoint (8.88908, 0.595038 ,29.3342);<br>
cam1-> SetPosition (-12.3332, 31.7479, 41.2387);<br>
cam1-> SetViewUp (0.060772, -0.319905, 0.945498);<br>
iren ->Initialize();<br>
<br>
<br>
<br>
// This starts the event loop and as a side effect causes an initial render.<br>
// iren->Start();<br>
<br>
// Exiting from here, we have to delete all the instances that<br>
// have been created.<br>
pl3d->Delete();<br>
line->Delete();<br>
transL1->Delete();<br>
tf->Delete();<br>
probe->Delete();<br>
transL2->Delete();<br>
tf2->Delete();<br>
probe2->Delete();<br>
transL3->Delete();<br>
tf3->Delete();<br>
probe3->Delete();<br>
appendF->Delete();<br>
tuber->Delete();<br>
lineMapper->Delete();<br>
lineActor->Delete();<br>
xyplot->Delete();<br>
xyplot2->Delete();<br>
xyplot3->Delete();<br>
outline->Delete();<br>
outlineMapper->Delete();<br>
outlineActor->Delete();<br>
ren1->Delete();<br>
ren2->Delete();<br>
renWin->Delete();<br>
iren->Delete();<br>
<br>
return 0;<br>
}<br>
<br>
<br>
why my output is that?:<br>
<br>
~$ make<br>
[100%] Building CXX object CMakeFiles/xyPlot.dir/xyPlot.o<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx: In function ‘int main()’:<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:73: error: no matching function for call to ‘vtkProbeFilter::SetSource(vtkStructuredGrid*)’<br>
/usr/local/include/vtk-5.4/vtkProbeFilter.h:55: note: candidates are: void vtkProbeFilter::SetSource(vtkDataObject*)<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:85: error: no matching function for call to ‘vtkProbeFilter::SetSource(vtkStructuredGrid*)’<br>
/usr/local/include/vtk-5.4/vtkProbeFilter.h:55: note: candidates are: void vtkProbeFilter::SetSource(vtkDataObject*)<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:97: error: no matching function for call to ‘vtkProbeFilter::SetSource(vtkStructuredGrid*)’<br>
/usr/local/include/vtk-5.4/vtkProbeFilter.h:55: note: candidates are: void vtkProbeFilter::SetSource(vtkDataObject*)<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:124: error: ‘Position’ was not declared in this scope<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:125: error: expected ‘;’ before ‘xyplot’<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:150: error: ‘relative’ was not declared in this scope<br>
/home/edoardo/VTK/plot/src/xyPlot.cxx:150: error: expected ‘;’ before ‘to’<br>
make[2]: *** [CMakeFiles/xyPlot.dir/xyPlot.o] Errore 1<br>
make[1]: *** [CMakeFiles/xyPlot.dir/all] Errore 2<br>
make: *** [all] Errore 2<br>
<br>
Thank you very much for the interest<br>
Best regards<br>
</font></p><p><font size="2"><br></font></p></div></blockquote><div>Where did you get this code? In the actual VTK cvs or release? I got the same error when compiling it. You can fix it by adding:</div><div><br></div>#include "vtkStructuredGrid.h"</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">If you got this from an official source, we need to update it there, too.</div><div class="gmail_quote"><br clear="all">Thanks,<br><br><div>David</div></div>