1 #include "manualView3DContour.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6 manualView3DContour::manualView3DContour()
9 // ----------------------------------------------------------------------------
10 manualView3DContour::~manualView3DContour()
14 // ----------------------------------------------------------------------------
15 manualView3DContour * manualView3DContour :: Clone()
17 manualView3DContour * clone = new manualView3DContour();
18 CopyAttributesTo(clone);
22 // ---------------------------------------------------------------------------
23 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
26 manualViewContour::CopyAttributesTo(cloneObject);
28 cloneObject->SetDimensions ( _w , _h , _d );
30 // ----------------------------------------------------------------------------
31 void manualView3DContour::SetDimensions(int w, int h, int d)
37 // ----------------------------------------------------------------------------
38 void manualView3DContour::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type)
40 X = _vtkmprbasedata->GetX();
41 Y = _vtkmprbasedata->GetY();
42 Z = _vtkmprbasedata->GetZ();
44 // ----------------------------------------------------------------------------
45 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
47 _vtkmprbasedata = vtkmprbasedata;
49 // ----------------------------------------------------------------------------
50 int manualView3DContour::GetIdPoint2(int x, int y)
53 double p[3],pA[3],pB[3];
55 double pickPoint[ 3 ], cameraPos[ 3 ];
56 vtkPointPicker* picker = vtkPointPicker::New( );
57 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
58 picker->Pick( x, y, 0.0, pRenderer );
59 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
60 picker->GetPickPosition( pickPoint );
63 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
64 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
66 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
68 double dist,distMin=999999999;
69 int i,size=this->_manContModel->GetSizeLstPoints();
72 manualPoint *mp = this->_manContModel->GetManualPoint(i);
76 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
77 if ( (dist<=2*GetRange()) && (dist<distMin) )
86 // ----------------------------------------------------------------------------
87 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
89 SelectAllPossibleSelected(false);
90 int id=GetIdPoint2(x,y);
93 SetPointPosibleSelected(id,true);