1 #include "manualView3VContour.h"
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6 // ----------------------------------------------------------------------------
8 manualView3VContour::manualView3VContour(int type)
11 // JSTG 25-02-08 ------------------------------
12 //_manContModel= new manualContourModel();
13 //---------------------------------------------
15 // ----------------------------------------------------------------------------
16 manualView3VContour::~manualView3VContour()
22 // ----------------------------------------------------------------------------
23 manualView3VContour * manualView3VContour :: Clone()
25 manualView3VContour * clone = new manualView3VContour( GetType() );
26 CopyAttributesTo(clone);
30 // ---------------------------------------------------------------------------
32 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
35 manualViewContour::CopyAttributesTo(cloneObject);
38 int manualView3VContour::GetType()
43 // ----------------------------------------------------------------------------
44 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
59 // ----------------------------------------------------------------------------
61 void manualView3VContour::RefreshContour() // virtula
63 manualViewContour::RefreshContour();
66 // JSTG 25-02-08 ----------------------------------------
67 //int nps = GetNumberOfPointsSpline();
68 int nps = _manContModel->GetNumberOfPointsSpline();
69 //-------------------------------------------------------
70 for( i = 0; i < nps; i++ )
72 _pts->GetPoint( i, pp );
73 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
76 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
81 // ----------------------------------------------------------------------------
83 void manualView3VContour::UpdateViewPoint(int id){ // virtual
85 manualPoint *mp = _manContModel->GetManualPoint(id);
90 FilterCordinateXYZ(x,y,z);
91 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
94 // ----------------------------------------------------------------------------
96 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
99 if (_manContModel!=NULL){
103 TransfromCoordViewWorld(xx,yy,zz,-1);
104 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
109 // ----------------------------------------------------------------------------
110 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
118 TransfromCoordViewWorld(xx,yy,zz,-1);
125 unsigned int i, nps,nps_t;
126 nps = _sizePointsContour;
127 if (this->_manContModel->IfCloseContour()==true)
133 FilterCordinateXYZ(xx,yy,zz);
135 for( i = 0; i < nps_t; i++ ) {
136 _pts->GetPoint(i%nps, ppA);
137 _pts->GetPoint((i+1)%nps, ppB);
138 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
139 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
140 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
141 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
142 d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2]));
143 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {