<DIV>Hi,</DIV>
<DIV>Read this</DIV>
<DIV><A href="http://aurelien_regat-barrel.blogspot.com/2004_08_01_aurelien_regat-barrel_archive.html#109231591357369677">http://aurelien_regat-barrel.blogspot.com/2004_08_01_aurelien_regat-barrel_archive.html#109231591357369677</A></DIV>
<DIV>(and help me to correct my english :-)</DIV>
<DIV><BR><BR><B><I>"Johannes Käfer" <jak4.scr@gmx.net></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi,<BR><BR>I've encountered something within the current CVS vtk which I consider a<BR>bug.<BR><BR>If you are going to compile the code below (it's actually the unaltered<BR>cone6.cxx file from the vtk examples) in Visual Studio 6.0 with: UNICODE,<BR>_UNICODE added to (Project -> Settings > Tab C++ Preprocessor definitions )<BR>and delete _MBCS, than the linker will output the following error:<BR><BR>Cone6.obj : error LNK2001: unresolved external symbol "public: virtual char<BR>const * __thiscall vtkObjectBase::GetClassNameW(void)const "<BR>(?GetClassNameW@vtkObjectBase@@UBEPBDXZ)<BR>Release/test.exe : fatal error LNK1120: 1 unresolved externals<BR><BR>It has to be noted that without the UNICODE options it works fine. The same<BR>example works perfectly with vtk 4.2 and the UNICODE options ON.<BR><BR>If found a bug-report about UNICODE at the bugtracker
at:<BR>http://www.vtk.org/Bug/bug.php?op=show&bugid=602&pos=20. However this<BR>bug-report seems not to be related to my "bug".<BR><BR>So, what do you think?<BR><BR>Greetings<BR>Johannes<BR><BR>---Code<BR>#include "vtkConeSource.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include "vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR>#include "vtkCamera.h"<BR>#include "vtkActor.h"<BR>#include "vtkRenderer.h"<BR>#include "vtkCommand.h"<BR>#include "vtkBoxWidget.h"<BR>#include "vtkTransform.h"<BR>#include "vtkInteractorStyleTrackballCamera.h"<BR><BR>//<BR>// Similar to Cone2.cxx, we define a callback for interaction.<BR>// <BR>class vtkMyCallback : public vtkCommand<BR>{<BR>public:<BR>static vtkMyCallback *New() <BR>{ return new vtkMyCallback; }<BR>virtual void Execute(vtkObject *caller, unsigned long, void*)<BR>{<BR>vtkTransform *t = vtkTransform::New();<BR>vtkBoxWidget *widget =
reinterpret_cast<VTKBOXWIDGET*>(caller);<BR>widget->GetTransform(t);<BR>widget->GetProp3D()->SetUserTransform(t);<BR>t->Delete();<BR>}<BR>};<BR><BR>class vtkMyCallback1 : public vtkCommand{<BR>public:<BR>static vtkMyCallback1* New()<BR>{ return new vtkMyCallback1; }<BR><BR>//TODO: dirty hack, but otherwise I got a linker error and the function is<BR>of no use here<BR>//virtual const char *GetClassName() const {return "vtkObjectBase";};<BR><BR>virtual void Execute(vtkObject *caller, unsigned long, void* ){<BR>// thoughts: since we are determining here the actor we picked it would be<BR>nice<BR>// to check how the pick was made (which key)<BR><BR>//modification<BR>//kaeferj, 09/11/04<BR>//adding multiple pick functionality to the program<BR>vtkCellPicker *picker = (vtkCellPicker *)caller;<BR>unsigned int k;<BR><BR>double coord[3];<BR>// picker->GetPickPosition( coord );<BR><BR>/* // we found an actor<BR>if( picker->GetActor()!=NULL ){<BR>vtkActor *pickedActor =
picker->GetActor();<BR>bool foundCandidateActor = false;<BR><BR>pickedSurfaceTreeRemovableActorsIndex = -1;<BR>//TODO: this if is always true (the variable is set above)<BR>if( !foundCandidateActor )<BR>for(k=0;k<SURFACETREEREMOVABLEACTORS.SIZE();K++)<BR> if(pickedActor==surfaceTreeRemovableActors[k].actor){<BR>cout << "Picking on tree component " << k << endl;<BR><BR>pickedSurfaceTreeRemovableActorsIndex = k;<BR><BR>//modification<BR>//kaeferj, 09/11/04<BR>//adding multiple pick functionality to the program<BR>//we need to check if the component has already been picked<BR>std::vector<INT>::iterator theIterator;<BR>bool add_actor = true;<BR><BR>for( theIterator = pickedActors.begin(); theIterator !=<BR>pickedActors.end(); theIterator++){<BR>if( k == *theIterator ){<BR>add_actor = false;<BR>break;<BR>}<BR>}<BR><BR>if( add_actor )<BR>pickedActors.push_back(k);<BR>else<BR>pickedActors.erase( theIterator );<BR>//end<BR><BR>foundCandidateActor = true;<BR>// update
slice<BR>dlgUpdateSlice(coord);<BR>break;<BR>}<BR>}<BR>//modification<BR>//kaeferj, 09/11/04<BR>//adding multiple pick functionality to the program<BR>else{<BR>// we picked no object --> this means we have to delete every selection<BR>thus far<BR>// the red boxes are deleted within vtk, we just clear our list.<BR>pickedActors.erase( pickedActors.begin(), pickedActors.end() );<BR>}<BR><BR>//TODO: what is this for?<BR>if(picker->GetVolume()!=NULL)<BR>{<BR>vtkVolume* pickedVolume = picker->GetVolume();<BR>bool foundCandidateVolume = false;<BR>if( !foundCandidateVolume )<BR>for(k=0;k<SURFACETREEREMOVABLEACTORS.SIZE();K++)<BR> if(pickedVolume==surfaceTreeRemovableActors[k].volume){<BR>cout << "Picking on tree component " << k << endl;<BR><BR>pickedSurfaceTreeRemovableActorsIndex = k;<BR><BR>foundCandidateVolume = true;<BR>break;<BR>}<BR>}*/<BR>}<BR>};<BR><BR>int main( int argc, char *argv[] )<BR>{<BR>// <BR>// Next we create an instance of vtkConeSource and set
some of its<BR>// properties. The instance of vtkConeSource "cone" is part of a<BR>// visualization pipeline (it is a source process object); it produces<BR>data<BR>// (output type is vtkPolyData) which other filters may process.<BR>//<BR>vtkConeSource *cone = vtkConeSource::New();<BR>cone->SetHeight( 3.0 );<BR>cone->SetRadius( 1.0 );<BR>cone->SetResolution( 10 );<BR><BR>// <BR>// In this example we terminate the pipeline with a mapper process object.<BR>// (Intermediate filters such as vtkShrinkPolyData could be inserted in<BR>// between the source and the mapper.) We create an instance of<BR>// vtkPolyDataMapper to map the polygonal data into graphics primitives.<BR>We<BR>// connect the output of the cone souece to the input of this mapper.<BR>//<BR>vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();<BR>coneMapper->SetInput( cone->GetOutput() );<BR><BR>// <BR>// Create an actor to represent the cone. The actor orchestrates rendering<BR>// of the mapper's
graphics primitives. An actor also refers to properties<BR>// via a vtkProperty instance, and includes an internal transformation<BR>// matrix. We set this actor's mapper to be coneMapper which we created<BR>// above.<BR>//<BR>vtkActor *coneActor = vtkActor::New();<BR>coneActor->SetMapper( coneMapper );<BR><BR>//<BR>// Create the Renderer and assign actors to it. A renderer is like a<BR>// viewport. It is part or all of a window on the screen and it is<BR>// responsible for drawing the actors it has. We also set the background<BR>// color here.<BR>//<BR>vtkRenderer *ren1= vtkRenderer::New();<BR>ren1->AddActor( coneActor );<BR>ren1->SetBackground( 0.1, 0.2, 0.4 );<BR><BR>//<BR>// Finally we create the render window which will show up on the screen.<BR>// We put our renderer into the render window using AddRenderer. We also<BR>// set the size to be 300 pixels by 300.<BR>//<BR>vtkRenderWindow *renWin = vtkRenderWindow::New();<BR>renWin->AddRenderer( ren1
);<BR>renWin->SetSize( 300, 300 );<BR><BR>// <BR>// The vtkRenderWindowInteractor class watches for events (e.g., keypress,<BR>// mouse) in the vtkRenderWindow. These events are translated into<BR>// event invocations that VTK understands (see VTK/Common/vtkCommand.h<BR>// for all events that VTK processes). Then observers of these VTK<BR>// events can process them as appropriate.<BR>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<BR>iren->SetRenderWindow(renWin);<BR><BR>//<BR>// By default the vtkRenderWindowInteractor instantiates an instance<BR>// of vtkInteractorStyle. vtkInteractorStyle translates a set of events<BR>// it observes into operations on the camera, actors, and/or properties<BR>// in the vtkRenderWindow associated with the vtkRenderWinodwInteractor. <BR>// Here we specify a particular interactor style.<BR>vtkInteractorStyleTrackballCamera *style =
<BR>vtkInteractorStyleTrackballCamera::New();<BR>iren->SetInteractorStyle(style);<BR><BR>//<BR>// Here we use a vtkBoxWidget to transform the underlying coneActor (by<BR>// manipulating its transformation matrix). Many other types of widgets<BR>// are available for use, see the documentation for more details.<BR>//<BR>// The SetInteractor method is how 3D widgets are associated with the<BR>render<BR>// window interactor. Internally, SetInteractor sets up a bunch of<BR>callbacks<BR>// using the Command/Observer mechanism (AddObserver()). The place factor <BR>// controls the initial size of the widget with respect to the bounding<BR>box<BR>// of the input to the widget.<BR>vtkBoxWidget *boxWidget = vtkBoxWidget::New();<BR>boxWidget->SetInteractor(iren);<BR>boxWidget->SetPlaceFactor(1.25);<BR><BR>//<BR>// Place the interactor initially. The input to a 3D widget is used to <BR>// initially position and scale the widget. The EndInteractionEvent is<BR>// observed which invokes
the SelectPolygons callback.<BR>//<BR>boxWidget->SetProp3D(coneActor);<BR>boxWidget->PlaceWidget();<BR>vtkMyCallback *callback = vtkMyCallback::New();<BR>boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);<BR><BR>//<BR>// Normally the user presses the "i" key to bring a 3D widget to life.<BR>Here<BR>// we will manually enable it so it appears with the cone. <BR>//<BR>boxWidget->On();<BR><BR>//<BR>// Start the event loop.<BR>//<BR>iren->Initialize();<BR>iren->Start();<BR><BR>//<BR>// Free up any objects we created. All instances in VTK are deleted by<BR>// using the Delete() method.<BR>//<BR>cone->Delete();<BR>coneMapper->Delete();<BR>coneActor->Delete();<BR>callback->Delete();<BR>boxWidget->Delete();<BR>ren1->Delete();<BR>renWin->Delete();<BR>iren->Delete();<BR>style->Delete();<BR><BR>return 0;<BR>}<BR><BR>-- <BR>GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail<BR>+++ Empfehlung der Redaktion +++ Internet
Professionell 10/04 +++<BR><BR>_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: <HTTP: vtkfaq cgi-bin public.kitware.com><BR>Follow this link to subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE><BR><BR><DIV>
<DIV>Aurélien REGAT-BARREL <BR>My VTK blog : <A href="http://aurelien_regat-barrel.blogspot.com/">http://aurelien_regat-barrel.blogspot.com</A></DIV></DIV><p>
                <hr size=1>
Créez gratuitement votre Yahoo! Mail avec <font color="red"><b>100 Mo de stockage !</b></font>
<br><a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http://fr.rd.yahoo.com/mail/mail_taglines_100/default/*http://fr.benefits.yahoo.com/">Créez votre Yahoo! Mail</a><br><br>
<font color="red"><b>Le nouveau Yahoo! Messenger est arrivé !</b></font> Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis.
<a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=26111/*http://fr.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez GRATUITEMENT ici !</a>