[vtkusers] How to Add multiple AddObserver in C++/Windows ?

Ketan Mehta ketan.mehta at wipro.com
Thu Sep 18 05:43:05 EDT 2003


Hi Mathieu,

Thanks for input.

I have pasted previous question inline again.

'joystick' and 'trackball' stuff worked fine. How come it is not
documented in any example or somewhere..!!
BTW, why 'joystick' is default and can how we change it ?

Mathieu Malaterre wrote:
> 
> > 1) Data conversion - strict type checking does not allow C++ code to compile.
> >       ( Posted twice )
> 
> Sorry I don't understand ? Could you give us an example ?

I am pasting inline again !!
-------------------------------------------------------------
Hi All,

I am trying to convert all tcl examples to C++ windows examples, 
To understand better on windows platform.

While converting the example from tcl to C++ on windows, I am getting following
compile error. Same error has been posted earlier.

ERROR::
IsoSurface.cpp(40) : error C2664: 'SetInput' : cannot convert parameter 1 from 'class
vtkStructuredGrid *' to 'class vtkDataSet *'
--------------------------------------------

Platform - VTK 4.2 ( Windowsed installer ) on WinXP

I am using following example and both relevant code are pasted for reference -

C:\Program Files\vtk42\Examples\VisualizationAlgorithms\Tcl\ColorIsosurface.tcl
--------- TCL example ---------------------------
# This example shows how to color an isosurface with other data. Basically
vtkPLOT3DReader pl3d
    pl3d SetXYZFileName "$VTK_DATA_ROOT/Data/combxyz.bin"
    pl3d SetQFileName "$VTK_DATA_ROOT/Data/combq.bin"
    pl3d SetScalarFunctionNumber 100
    pl3d SetVectorFunctionNumber 202
    pl3d AddFunction 153
    pl3d Update
    pl3d DebugOn
    
# The contoru filter uses the labeled scalar (function number 100
# above to generate the contour surface; all other data is interpolated
# during the contouring process.
#
vtkContourFilter iso
    iso SetInput [pl3d GetOutput]
    iso SetValue 0 .24

------------------ VC++ code for Windows platform ----------------
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkPolyDataMapper.h"
#include "vtkPLOT3DReader.h"
#include "vtkContourFilter.h"
#include "vtkLODActor.h"
#include "vtkStructuredGridOutlineFilter.h"
#include "vtkContourFilter.h"
#include "vtkPolyDataNormals.h"


main()
{
// Read some data. The important thing here is to read a function as a data
// array as well as the scalar and vector.  (here function 153 is named
// "Velocity Magnitude").Later this data array will be used to color the
// isosurface.  

        vtkPLOT3DReader *pl3d = vtkPLOT3DReader::New();
        pl3d->SetXYZFileName("E:/VTKData/Data/combxyz.bin");  // Just for timebeing
        pl3d->SetQFileName("E:/VTKData/Data/combq.bin");
        pl3d->SetScalarFunctionNumber(100);
        pl3d->SetVectorFunctionNumber(202);
        pl3d->AddFunction(153);
        pl3d->Update();
        pl3d->DebugOn();
    
// The contour filter uses the labeled scalar (function number 100
// above to generate the contour surface; all other data is interpolated
// during the contouring process.

        vtkContourFilter *iso = vtkContourFilter::New();
    iso->SetInput( pl3d->GetOutput() );
    iso->SetValue(0, 0.24);

        vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
    normals->SetInput( iso->GetOutput() );
    normals->SetFeatureAngle(45);


----------------------------------------------------------|

> > 3) I have one observation, while we create default window interactor in Window/OpenGL
> >       then Zoom, Image movement and rotation events are little abrupt. There seems
> >       to be no proper control by user. Either you end up making it too big or move
> >       out of scence.
> >       What is problem here ??
> >
> 
> Press 't' for trackball ... (default mode is 'j' joystick)

Thanks. Why we have joystick as default ?

**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************



More information about the vtkusers mailing list