}
}
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//AD: 02-09
+
+manualContourModelLine::manualContourModelLine()
+: manualContourModel()
+{
+ SetNumberOfPointsSpline(2);
+}
+
+manualContourModelLine::~manualContourModelLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelLine * manualContourModelLine :: Clone() // virtual
+{
+ manualContourModelLine * clone = new manualContourModelLine();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
+{
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelLine::GetTypeModel() //virtual
+{
+ return 6;
+}
+
+//----------------------------------------------------------------
+void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+{
+ int np = GetSizeLstPoints();
+ if (np==0)
+ {
+ *x = 0;
+ *y = 0;
+ *z = 0;
+ }
+ if (np==1)
+ {
+ manualPoint *mp;
+ mp = GetManualPoint(0);
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+ }
+ if (np==2)
+ {
+ manualPoint *mp;
+
+ if (i==0)
+ {
+ mp = GetManualPoint(0);
+ }
+ else if (i==1)
+ {
+ mp = GetManualPoint(1);
+ }
+
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+ }
+
+/*
+ manualPoint *mp;
+ double difX,difY;
+ int np = GetSizeLstPoints( );
+ int nps = GetNumberOfPointsSpline();
+// _deltaAngle=(3.14159265*2)/(nps-1);
+ _deltaAngle = 100/nps;
+
+ if (np==2){
+
+ if (i==0){
+ mp = GetManualPoint(0);
+ } else {
+ mp = GetManualPoint(1);
+ }
+
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+
+ }else {
+ *x=-1;
+ *y=-1;
+ *z=-1;
+ }
+*/
+}
+
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 3 circle
// 4 BullEye
// 5 BullEyeSector
+ // 6 Line
return 1;
}
yy = yy * _spc[1];
zz = zz * _spc[2];
-
unsigned int i, nps,nps_t;
nps = _sizePointsContour;
if (this->_manContModel->IfCloseContour()==true)
nps_t = nps-1;
}
- for( i = 0; i < nps_t; i++ ) {
+ //ED
+ printf("\n>%d ",nps_t);
+
+ for( i = 0; i < nps_t; i++ )
+ {
_pts->GetPoint(i%nps, ppA);
_pts->GetPoint((i+1)%nps, ppB);
d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
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]));
- if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
+
+ //ED
+ printf("%d %f %f %f - ", i,d1,d2,d3);
+
+ if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
+ {
result=true;
i=nps;
}
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+manualViewLine::manualViewLine()
+{
+}
+// ----------------------------------------------------------------------------
+manualViewLine::~manualViewLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewLine * manualViewLine :: Clone()
+{
+ manualViewLine * clone = new manualViewLine();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
+{
+ // Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+int manualViewLine::GetType() // virtual
+{
+ return 6;
+}
+
+
+// ----------------------------------------------------------------------------
+
+void manualViewLine::InitMove(int x, int y, int z) // virtual
+{
+ manualPoint *mp;
+ double XX=x;
+ double YY=y;
+ double ZZ=z;
+ TransfromeCoordViewWorld(XX,YY,ZZ);
+
+ if (_manContModel->GetSizeLstPoints()==2)
+ {
+ mp = _manContModel->GetManualPoint(0);
+ _dp0[0]= mp->GetX() - XX;
+ _dp0[1]= mp->GetY() - YY;
+ _dp0[2]= mp->GetZ();
+
+ mp = _manContModel->GetManualPoint(1);
+ _dp1[0]= mp->GetX() - XX;
+ _dp1[1]= mp->GetY() - YY;
+ _dp1[2]= mp->GetZ();
+
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewLine::MoveContour(int x, int y, int z) // virtual
+{
+ manualPoint *mp;
+ double XX=x;
+ double YY=y;
+ double ZZ=z;
+ TransfromeCoordViewWorld(XX,YY,ZZ);
+
+ mp = _manContModel->GetManualPoint(0);
+ mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
+ mp = _manContModel->GetManualPoint(1);
+ mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
+
+
+ UpdateViewPoint(0);
+ UpdateViewPoint(1);
+}
// ----------------------------------------------------------------------------
//int manualViewRoi::GetType() 2;
//int manualViewCircle::GetType() 3;
//int manualViewStar::GetType() 4;
+//int manualViewLine::GetType() 6;
return 0;
*/
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+// _state = 0 // ..nothing..
+// _state = 5 // move point
+// _state = 6 // move all
+// _state = 7 // Empty mouse drag
+
+manualLineControler::manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler::~manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler * manualLineControler :: Clone() // virtual
+{
+ manualLineControler * clone = new manualLineControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualLineControler::MouseClickLeft(int x, int y){
+ int z = GetZ();
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
+ GetManualViewBaseContour()->InitMove(x,y,z);
+ SetState(6);
+ }
+ int size=GetManualViewBaseContour()->GetNumberOfPoints();
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ } else {
+ SetPoint(0,x,y,z);
+ SetPoint(1,x,y,z);
+ }
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+
+ if (GetState()==5)
+ {
+ SetPoint( bakIdPoint , x , y ,z);
+ }
+ if (GetState()==6)
+ {
+ GetManualViewBaseContour()->MoveContour(x,y,z);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::InitRoi(int ww, int hh, double porcentage)
+{
+ int zz;
+ manualPoint *mp;
+
+ if (GetManualContourModel()->GetSizeLstPoints() ==0)
+ {
+ zz = GetZ();
+ AddPoint(0,0,zz);
+ AddPoint(0,0,zz);
+ }
+
+ double pp1=porcentage;
+ double pp2=1-porcentage;
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+
+ SetState(0);
+ GetManualViewBaseContour()->Refresh();
+}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
virtual void UpdateSpline();
};
+//--------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContourModelLine : public manualContourModel
+{
+public:
+ manualContourModelLine();
+ virtual ~manualContourModelLine();
+ virtual manualContourModelLine *Clone();
+ void CopyAttributesTo( manualContourModelLine *cloneObject);
+ virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+private:
+ virtual int GetTypeModel();
+};
+
+//--------------------------------------------------------
+
class manualContourModelBullEyeSector : public manualContourModel
{
public:
};
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+class creaMaracasVisu_EXPORT manualViewLine: public manualViewContour
+{
+public:
+ manualViewLine();
+ virtual ~manualViewLine();
+
+ virtual int GetType();
+ virtual manualViewLine * Clone();
+ void CopyAttributesTo( manualViewLine *cloneObject );
+
+// void RefreshContour();
+// virtual bool ifTouchContour(int x,int y, int z);
+ virtual void InitMove(int x, int y, int z);
+ virtual void MoveContour(int x, int y, int z);
+
+private:
+ double _dp0[3];
+ double _dp1[3];
+// double _dp2[3];
+// double _dp3[3];
+};
+
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
+
class creaMaracasVisu_EXPORT manualContourBaseControler: public InteractorStyleMaracas
{
public:
};
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+class creaMaracasVisu_EXPORT manualLineControler: public manualContourControler
+{
+public:
+ manualLineControler();
+ virtual ~manualLineControler();
+ virtual manualLineControler * Clone();
+ void CopyAttributesTo( manualLineControler *cloneObject );
+
+ virtual void MouseClickLeft(int x, int y);
+ virtual void MouseMove(int x, int y );
+ virtual void DeleteActualMousePoint(int x, int y);
+ void InitRoi(int ww, int hh, double porcentage);
+
+
+
+private:
+ int bakIdPoint;
+};
+