manualContourModelLine::manualContourModelLine()
: manualContourModel()
{
- SetNumberOfPointsSpline(2);
+ SetNumberOfPointsSpline(20);
+ this->SetCloseContour(false);
}
manualContourModelLine::~manualContourModelLine()
return 6;
}
+
//----------------------------------------------------------------
-void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+/*
+void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
{
int np = GetSizeLstPoints();
if (np==0)
*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;
- }
-*/
}
-
+*/
// ----------------------------------------------------------------------------
*x = _ww*radio*angcos + _cx;
*y = _hh*radio*angsin + _cy;
- *z= -900;
+ *z= 900;
}
//----------------------------------------------------------------
{
_delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
} else {
- _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
+// _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
+ _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close
}
//-----------------------------------------------------------------------------------------------------------
}
unsigned int i, nps,nps_t;
nps = _sizePointsContour;
+
if (this->_manContModel->IfCloseContour()==true)
{
nps_t = nps;
nps_t = nps-1;
}
- //ED
- printf("\n>%d ",nps_t);
-
+
for( i = 0; i < nps_t; i++ )
{
_pts->GetPoint(i%nps, ppA);
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]));
- //ED
- printf("%d %f %f %f - ", i,d1,d2,d3);
if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
{
i=nps;
}
}
+
return result;
}
// ----------------------------------------------------------------------------
+
bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
{
bool result=false;
- double px1=99999,py1=99999,px2=-9999,py2=-99999;
+ double px1=99999,py1=99999,px2=-99999,py2=-99999;
GetMinMax(px1,py1, px2, py2);
return result;
}
-
// ----------------------------------------------------------------------------
void manualViewRoi::InitMove(int x, int y, int z) // virtual
manualViewLine::manualViewLine()
{
+ _sizePointsContour=20;
}
// ----------------------------------------------------------------------------
manualViewLine::~manualViewLine()
_pts->SetPoint(i, 0 , 0 , 0 );
}
// This is for the boundaring inicialisation
+
//EED 29Mars2009
_pts->SetPoint(0, 0 , 0 , -1000 );
_pts->SetPoint(1, 0 , 0 , 1000 );
-// _pts->SetPoint(0, -1000 , -1000 , -1000 );
-// _pts->SetPoint(1, 1000 , 1000 , 1000 );
+// _pts->SetPoint(0, -1000 , -1000 , -1000 );
+// _pts->SetPoint(1, 1000 , 1000 , 1000 );
+
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell( nps /* +1 */ );
}
// ----------------------------------------------------------------------------
+
void manualRoiControler::MouseClickLeft(int x, int y){
int z = GetZ();
if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
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);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ }
+
+/*EED 21 Avril 2009
if (GetState()==0) {
if (size==0){
AddPoint(x,y,z);
bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
+
// ----------------------------------------------------------------------------
void manualRoiControler::MouseMove(int x, int y) // virtual
{
if (size==0){
AddPoint(x,y,z);
AddPoint(x,y,z);
-// AddPoint(x,y,z);
-// AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ }
+
+/*EED 21 Avril 2009
+ 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);
-// SetPoint(2,x,y,z);
-// SetPoint(3,x,y,z);
}
bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
manualContourBaseControler::CopyAttributesTo(cloneObject);
}
+
// ----------------------------------------------------------------------------
void manualLineControler::MouseClickLeft(int x, int y){
int z = GetZ();
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);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ }
+
+
+/*EED 21 Avril 2009
if (GetState()==0) {
if (size==0){
AddPoint(x,y,z);
bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
_manViewBaseCont = NULL;
_manContModel = NULL;
_state = 0;
- _z = -900;
+ _z = 900;
_editable = true;
_posibleToMove = true;
_moving = false;