-#include <vtkActor.h>
+#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkCellArray.h>
// ----------------------------------------------------------------------------
-manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
+manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
{
manualContourModelCircle * clone = new manualContourModelCircle();
CopyAttributesTo(clone);
}
//----------------------------------------------------------------
-int manualContourModelCircle::GetTypeModel() //virtual
+int manualContourModelCircle::GetTypeModel() //virtual
{
return 3;
}
}
}
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//AD: 02-09
+
+manualContourModelLine::manualContourModelLine()
+: manualContourModel()
+{
+ SetNumberOfPointsSpline(20);
+ this->SetCloseContour(false);
+}
+
+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) // virtual
+{
+ 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();
+ }
+
+}
+*/
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
+manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
{
manualContourModelBullEye * clone = new manualContourModelBullEye();
CopyAttributesTo(clone);
}
//----------------------------------------------------------------
-int manualContourModelBullEye::GetTypeModel() //virtual
+int manualContourModelBullEye::GetTypeModel() //virtual
{
return 4;
}
}
//----------------------------------------------------------------
-void manualContourModelBullEye::GetSector(int id,
+void manualContourModelBullEye::GetSector(int id,
double *radioA,
double *radioB,
double *ang,
//----------------------------------------------------------------
void manualContourModelBullEye::Save(FILE *ff) // virtual
{
- manualContourModel::Save(ff);
+ manualContourModel::Save(ff);
int i,size = GetSizeOfSectorLst();
fprintf(ff,"numberOfSections %d \n",size);
for ( i=0 ; i<size ; i++ )
//----------------------------------------------------------------
void manualContourModelBullEye::Open(FILE *ff) // virtual
{
- manualContourModel::Open(ff);
+ manualContourModel::Open(ff);
ResetSectors();
fscanf(ff,"%s",tmp); // NumberOfSections
fscanf(ff,"%s",tmp); // ##
- numberOfSections = atoi(tmp);
+ numberOfSections = atoi(tmp);
for (i=0;i<numberOfSections;i++)
{
AddSector(0,1,90,0);
// ----------------------------------------------------------------------------
-manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
+manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
{
manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
CopyAttributesTo(clone);
}
//----------------------------------------------------------------
-int manualContourModelBullEyeSector::GetTypeModel() //virtual
+int manualContourModelBullEyeSector::GetTypeModel() //virtual
{
return 5;
}
}
//----------------------------------------------------------------
-void manualContourModelBullEyeSector::GetSector(
+void manualContourModelBullEyeSector::GetSector(
double *radioA,
double *radioB,
double *ang,
*x = _ww*radio*angcos + _cx;
*y = _hh*radio*angsin + _cy;
- *z= -900;
+ *z= 900;
}
//----------------------------------------------------------------
void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
{
- manualContourModel::Save(ff);
+ manualContourModel::Save(ff);
fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
}
fscanf(ff,"%s",tmp); // TypeModel
fscanf(ff,"%s",tmp); // ##
- manualContourModel::Open(ff);
+ manualContourModel::Open(ff);
fscanf(ff,"%s",tmp); // radioA=
fscanf(ff,"%s",tmp); // radioA
- _radioA = atof(tmp);
+ _radioA = atof(tmp);
fscanf(ff,"%s",tmp); // radioB=
fscanf(ff,"%s",tmp); // radioB
- _radioB = atof(tmp);
+ _radioB = atof(tmp);
fscanf(ff,"%s",tmp); // ang=
fscanf(ff,"%s",tmp); // ang
- _ang = atof(tmp);
+ _ang = atof(tmp);
fscanf(ff,"%s",tmp); // deltaAng=
fscanf(ff,"%s",tmp); // deltaAng
- _angDelta = atof(tmp);
+ _angDelta = atof(tmp);
}
// ----------------------------------------------------------------------------
-manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
+manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
{
manualContourModelRoi * clone = new manualContourModelRoi();
CopyAttributesTo(clone);
}
//----------------------------------------------------------------
-int manualContourModelRoi::GetTypeModel() //virtual
+int manualContourModelRoi::GetTypeModel() //virtual
{
return 2;
}
this->SetCloseContour(true);
- _cntSplineX->SetDefaultTension( 0 );
- _cntSplineX->SetDefaultBias( 0 );
- _cntSplineX->SetDefaultContinuity( 0 );
+ _cntSplineX->SetDefaultTension( 0 );
+ _cntSplineX->SetDefaultBias( 0 );
+ _cntSplineX->SetDefaultContinuity( 0 );
- _cntSplineY->SetDefaultTension( 0 );
- _cntSplineY->SetDefaultBias( 0 );
+ _cntSplineY->SetDefaultTension( 0 );
+ _cntSplineY->SetDefaultBias( 0 );
_cntSplineY->SetDefaultContinuity( 0 );
- _cntSplineZ->SetDefaultTension( 0 );
- _cntSplineZ->SetDefaultBias( 0 );
+ _cntSplineZ->SetDefaultTension( 0 );
+ _cntSplineZ->SetDefaultBias( 0 );
_cntSplineZ->SetDefaultContinuity( 0 );
//JSTG 25-02-08 -------------------------------------------------------------------------------------------------
}
_lstPoints.clear();
+ _cntSplineX->RemoveAllPoints();
+ _cntSplineY->RemoveAllPoints();
+ _cntSplineZ->RemoveAllPoints();
+
_cntSplineX->Delete();
_cntSplineY->Delete();
_cntSplineZ->Delete();
//manualPoint *mp = new manualPoint();
//mp->SetPoint(x,y,z);
//std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
- //_lstPoints.insert(itNum,mp);
+ //_lstPoints.insert(itNum,mp);
InsertPoint_id(ibak,x,y,z);
//----------------------------------------------------------------------------
// type=0 x,y
// type=1 y,z
// type=2 x,z
-int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
+int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
{
double range = i_range+1;
if (type==-1)
{
if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
- dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
+ dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
if (dd<ddmin){
ddmin=dd;
ibak=i;
if (type==0)
{
if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
- dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
+ dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
if (dd<ddmin){
ddmin=dd;
ibak=i;
if (type==1)
{
if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
- dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
+ dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
if (dd<ddmin){
ddmin=dd;
ibak=i;
if (type==2)
{
if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
- dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
+ dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
if (dd<ddmin){
ddmin=dd;
ibak=i;
_closeContour = closeContour;
if (_closeContour==true)
{
- _cntSplineX->ClosedOn();
+ _cntSplineX->ClosedOn();
_cntSplineY->ClosedOn();
_cntSplineZ->ClosedOn();
} else {
- _cntSplineX->ClosedOff();
+ _cntSplineX->ClosedOff();
_cntSplineY->ClosedOff();
_cntSplineZ->ClosedOff();
}
{
_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
}
//-----------------------------------------------------------------------------------------------------------
}
/*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
{
- double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
+ double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
double t = delta*(double)i;
GetSplinePoint(t, x, y, z);
}*/
}
if (_lstPoints.size()>=2)
{
- *x = _cntSplineX->Evaluate(t);
- *y = _cntSplineY->Evaluate(t);
- *z = _cntSplineZ->Evaluate(t);
+ *x = _cntSplineX->Evaluate(t);
+ *y = _cntSplineY->Evaluate(t);
+ *z = _cntSplineZ->Evaluate(t);
}
}
}
if (_lstPoints.size()>=2)
{
- x = _cntSplineX->Evaluate(t);
- y = _cntSplineY->Evaluate(t);
- z = _cntSplineZ->Evaluate(t);
+ x = _cntSplineX->Evaluate(t);
+ y = _cntSplineY->Evaluate(t);
+ z = _cntSplineZ->Evaluate(t);
}
}*/
// ----------------------------------------------------------------------------
if (_lstPoints.size()>2)
{
-// JSTG 25-02-08 ------------------------------------------
+// JSTG 25-02-08 ------------------------------------------
//np = _lstPoints.size( );
- //nps = 200;
+ //nps = 200;
//delta=( double ) ( np ) / ( double ) ( nps );
UpdateSpline();
//GetSplinePoint(0,x1,y1,z1);
x1=x2;
y1=y2;
z1=z2;
- }// for
+ }// for
}
return result;
double x2,y2,z2;
bool okArea=true;
int i, j;
-
+
// This uses Green's theorem:
// A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
// A < 0 -> A = |A| (a negative value could raise because points are
int nps = GetNumberOfPointsSpline();
//double delta=( double ) ( np ) / ( double ) ( nps );
UpdateSpline();
- for( i = 0, area = 0.0; i < nps; i++ )
+ for( i = 0, area = 0.0; i < nps; i++ )
{
j = ( i + 1 ) % nps;
//ti = delta * (double)i;
{
okArea=false;
}
- }// for
+ }// for
area /= 2.0;
area = fabs( area );
/*
- for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
+ for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
{
j = ( i + 1 ) % _lstPoints.size();
// Area
}
// ----------------------------------------------------------------------------
-// p[x,y,z] : data in
-// rp[x,y,z] : data out result point
+// p[x,y,z] : data in
+// rp[x,y,z] : data out result point
// rn[x,y,z] : data out result normal
void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
if (np>=2)
{
// JSTG 25-02-08 ------------------------------------------
- //nps = 200;
+ //nps = 200;
nps = GetNumberOfPointsSpline();
//delta = ( double ) ( np ) / ( double ) ( nps );
UpdateSpline();
//GetSplinePoint(0,x1,y1,z1);
GetSpline_i_Point(0,&x1,&y1,&z1);
- for( i = 0; i < nps; i++ )
+ for( i = 0; i < nps; i++ )
{
//t = delta * (double)i;
//GetSplinePoint(t,x1,y1,z1);
dy= y1-p[1];
dz= z1-p[2];
dist = sqrt( dx*dx + dy*dy + dz*dz );
- if (dist<distMin)
+ if (dist<distMin)
{
distMin = dist;
//JSTG tback = t;
x2=x1;
y2=y1;
z2=z1;
- }// for
+ }// for
// JSTG 25-02-08 ------------------------------------------
//if (tback==0)
rn[1]=rp[1]-y1;
rn[2]=rp[2]-z1;
}
- }
- else
+ }
+ else
{
rp[0] = 0;
rp[1] = 0;
fscanf(ff,"%s",tmp); // NumberOfControlPoints
fscanf(ff,"%s",tmp); // ##
- numberOfControlPoints = atoi(tmp);
+ numberOfControlPoints = atoi(tmp);
for (i=0;i<numberOfControlPoints;i++)
{
fscanf(ff,"%s",tmp); // X
- x = atof(tmp);
+ x = atof(tmp);
fscanf(ff,"%s",tmp); // Y
- y = atof(tmp);
+ y = atof(tmp);
fscanf(ff,"%s",tmp); // Z
- z = atof(tmp);
+ z = atof(tmp);
AddPoint(x,y,z);
}
}
// ----------------------------------------------------------------------------
-int manualContourModel::GetTypeModel() //virtual
+int manualContourModel::GetTypeModel() //virtual
{
// 0 spline
// 1 spline
// 3 circle
// 4 BullEye
// 5 BullEyeSector
+ // 6 Line
return 1;
}
{
cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
}
- cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
+ cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
cloneObject->SetCloseContour( _closeContour );
cloneObject->UpdateSpline();
}
}
// ----------------------------------------------------------------------------
void manualViewPoint::SetPosibleSelected(bool posibleSelected){
- _posibleSelected=posibleSelected;
+ _posibleSelected=posibleSelected;
}
// ----------------------------------------------------------------------------
bool manualViewPoint::GetSelected(){
_pts = vtkPoints::New();
_pts->SetNumberOfPoints(8);
+
_pts->SetPoint(0, -1000 , -1000 , 0 );
- _pts->SetPoint(1, 1000 , -1000 , 0 );
+ _pts->SetPoint(1, 1000 , -1000 , 0 );
_pts->SetPoint(2, 1000 , 1000 , 0 );
_pts->SetPoint(3, -1000 , 1000 , 0 );
_pts->SetPoint(4, -1000 , 1000 , 0 );
_pts->SetPoint(5, -1000 , 1000 , 0 );
_pts->SetPoint(6, -1000 , 1000 , 0 );
_pts->SetPoint(7, -1000 , 1000 , 0 );
-
+
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell(17);
lines->InsertCellPoint(0);
_pd = vtkPolyData::New();
_pd->SetPoints( _pts );
_pd->SetLines( lines );
- lines->Delete(); //do not delete lines ??
+// lines->Delete(); //do not delete lines ??
_pointVtkActor = vtkActor::New();
_bboxMapper = vtkPolyDataMapper::New();
_bboxMapper->SetInput(_pd);
- _bboxMapper->ImmediateModeRenderingOn();
+// _bboxMapper->ImmediateModeRenderingOn();
_pointVtkActor->SetMapper(_bboxMapper);
- _pointVtkActor->GetProperty()->BackfaceCullingOn();
+// _pointVtkActor->GetProperty()->BackfaceCullingOn();
UpdateColorActor();
- _pd->ComputeBounds();
+// _pd->ComputeBounds();
return _pointVtkActor;
}
{
// Call to Fathers object
manualViewBaseContour::CopyAttributesTo(cloneObject);
-
+
cloneObject->SetMesureScale(_mesureScale);
}
_manContModel->UpdateSpline();
np = GetNumberOfPoints( );
- //nps = GetNumberOfPointsSpline();
- nps = _manContModel->GetNumberOfPointsSpline();
+ //nps = GetNumberOfPointsSpline();
+ nps = _manContModel->GetNumberOfPointsSpline();
//delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
-//printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
if ( _pts!=NULL )
{
if (np>=2 )
{
- for( i = 0; i < nps; i++ )
+ for( i = 0; i < nps; i++ )
{
-//JSTG 25-02-08 ------------------------------------------------
+//JSTG 25-02-08 ------------------------------------------------
//t = delta * (double)i;
//_manContModel->GetSplinePoint(t,x,y,z);
_manContModel->GetSpline_i_Point(i,&x,&y,&z);
//--------------------------------------------------------------
// EED 27 sep 2006
- // _pts->SetPoint(i, x,y,z );
- _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
-//if (i%15==0)
-//{
-// printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
-//}
+ // _pts->SetPoint(i, x,y,z );
+ _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
- }// for
- }
- else
+ }// for
+ }
+ else
{
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
} // if
}
}
// ----------------------------------------------------------------------------
void manualViewContour::RefreshText() // virtual
{
-
if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
int size = GetNumberOfPoints();
char text[50];
}
}
- _textActor -> SetInput(resultText);
-
+ _textActor->SetInput(resultText);
+
if (size>=1){
int i;
yy = yy * _spc[1];
zz = zz * _spc[2];
-
unsigned int i, nps,nps_t;
- nps = _sizePointsContour;
- if (this->_manContModel->IfCloseContour()==true)
+ nps = _sizePointsContour;
+
+ if (this->_manContModel->IfCloseContour()==true)
{
- nps_t = nps;
+ nps_t = nps;
} else {
- nps_t = nps-1;
+ nps_t = nps-1;
}
- for( i = 0; i < nps_t; i++ ) {
+
+ 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) ) {
+
+
+ if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
+ {
result=true;
i=nps;
}
- }
+ }
+
return result;
}
// ----------------------------------------------------------------------------
-void manualViewContour::DeletePoint(int id) // virtual
+void manualViewContour::DeletePoint(int id) // virtual
{
if (_lstViewPoints.size()>2)
{
void manualViewContour::InitMove(int x, int y, int z)
{
_initialConoturModel->DeleteAllPoints();
-
+
manualPoint *mp = NULL;
double XX=x;
double YY=y;
double ZZ=z;
TransfromeCoordViewWorld(XX,YY,ZZ);
-
+
int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
for ( i=0; i<manualPointsSZ; i++ )
{
mp = _manContModel->GetManualPoint( i );
this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
- }
+ }
}
//-------------------------------------------------------------------
void manualViewContour::MoveContour(int x, int y, int z)
double XX=x;
double YY=y;
double ZZ=z;
-
+
TransfromeCoordViewWorld(XX,YY,ZZ);
int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
mpOrigin = _manContModel->GetManualPoint( i );
mpMoving = _initialConoturModel->GetManualPoint(i);
mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
- }
- UpdateViewPoints();
+ }
+ UpdateViewPoints();
}
void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
{
{
mpOrigin = _manContModel->GetManualPoint( i );
mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
- }
- UpdateViewPoints();
+ }
+ UpdateViewPoints();
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//int nps = GetNumberOfPointsSpline();
int nps = _manContModel->GetNumberOfPointsSpline();
//-------------------------------------------------------
- for( i = 0; i < nps; i++ )
+ for( i = 0; i < nps; i++ )
{
_pts->GetPoint( i, pp );
FilterCordinateXYZ(pp[0],pp[1],pp[2]);
//EED 27 sep 2006
- _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
+ _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
}
}
zz = zz * _spc[2];
unsigned int i, nps,nps_t;
- nps = _sizePointsContour;
- if (this->_manContModel->IfCloseContour()==true)
+ nps = _sizePointsContour;
+ if (this->_manContModel->IfCloseContour()==true)
{
- nps_t = nps;
+ nps_t = nps;
} else {
- nps_t = nps-1;
+ nps_t = nps-1;
}
FilterCordinateXYZ(xx,yy,zz);
result=true;
i=nps;
}
- }
+ }
return result;
}
// ----------------------------------------------------------------------------
double p[3],pA[3],pB[3];
double pickPoint[ 3 ], cameraPos[ 3 ];
- vtkPointPicker* picker = vtkPointPicker::New( );
+ vtkPointPicker* picker = vtkPointPicker::New( );
vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
picker->Pick( x, y, 0.0, pRenderer );
pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
- if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
+ if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
{
double dist,distMin=999999999;
int i,size=this->_manContModel->GetSizeLstPoints();
//----------------------------------
_manContModel->UpdateSpline();
- nps = _manContModel->GetNumberOfPointsSpline();
+ nps = _manContModel->GetNumberOfPointsSpline();
if ( _pts!=NULL )
{
- for( i = 0; i < nps; i++ )
+ for( i = 0; i < nps; i++ )
{
_manContModel->GetSpline_i_Point(i,&x,&y,&z);
- _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
- }// for
+ _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
+ }// for
}
}
// ----------------------------------------------------------------------------
void manualViewBullEye::RefreshContour() // virtual
-{
+{
// External Rectangle
manualViewRoi::RefreshContour();
{
unsigned int i,ii, np;
np = GetNumberOfPoints( );
+//EED01
if ( np > 0)
{
if (np>=2)
// wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
//EED 27 sep 2007
- // _pts->SetPoint(i, XX,YY,ZZ );
- _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
+ // _pts->SetPoint(i, XX,YY,ZZ );
+ _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
} // rof
} else {
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
} // if
}
}
void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
{
double pp[3];
- manualPoint *mp;
+ manualPoint *mp;
unsigned int i;
-
+
minX=99999;
minY=99999;
maxX=-99999;
unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
- for( i = 0; i < size; i++ )
+ for( i = 0; i < size; i++ )
{
mp=_manContModel->GetManualPoint(i);
pp[0]=mp->GetX();
pp[1]=mp->GetY();
-
+
// min X
- if (pp[0]<minX)
+ if (pp[0]<minX)
{
minX=pp[0];
}
//min Y
- if (pp[1]<minY)
+ if (pp[1]<minY)
{
minY=pp[1];
}
//max X
- if (pp[0]>maxX)
+ if (pp[0]>maxX)
{
maxX=pp[0];
}
// max Y
- if (pp[1]>maxY)
+ if (pp[1]>maxY)
{
maxY=pp[1];
}
minY=0;
maxY=0;
}
-}
+}
// ----------------------------------------------------------------------------
-bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
+
+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);
{
result=true;
}
-
+
return result;
}
-
// ----------------------------------------------------------------------------
void manualViewRoi::InitMove(int x, int y, int z) // virtual
// ----------------------------------------------------------------------------
-void manualViewRoi::MoveContour(int x, int y, int z) // virtual
+void manualViewRoi::MoveContour(int x, int y, int z) // virtual
{
manualPoint *mp;
double XX=x;
UpdateViewPoint(0);
UpdateViewPoint(1);
UpdateViewPoint(2);
- UpdateViewPoint(3);
+ UpdateViewPoint(3);
}
// XX = cos(angle)*radio+mpA->GetX();
// YY = sin(angle)*radio+mpA->GetY();
ZZ = mpA->GetZ();
- _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
+ _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
} // rof
} else {
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
} // if
}
}
minY=0;
maxY=0;
}
-}
+}
/*
// ----------------------------------------------------------------------------
-bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
+bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
{
bool result=false;
double px1=99999,py1=99999,px2=-9999,py2=-99999;
// ----------------------------------------------------------------------------
-void manualViewCircle::MoveContour(int x, int y, int z) // virtual
+void manualViewCircle::MoveContour(int x, int y, int z) // virtual
{
manualPoint *mp;
double XX=x;
UpdateViewPoint(0);
UpdateViewPoint(1);
// UpdateViewPoint(2);
-// UpdateViewPoint(3);
+// UpdateViewPoint(3);
}
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+manualViewLine::manualViewLine()
+{
+ _sizePointsContour=20;
+}
+// ----------------------------------------------------------------------------
+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);
+}
// ----------------------------------------------------------------------------
manualViewBaseContour::manualViewBaseContour()
{
- _show_text = true;
+ _show_text = true;
_textActor = NULL;
_manContModel = NULL;
_wxvtkbaseview = NULL;
_coulorEdit_g = 1;
_coulorEdit_b = 0;
- _coulorNormal_r = 1;
+ _coulorNormal_r = 1;
_coulorNormal_g = 0;
_coulorNormal_b = 1;
//int manualViewRoi::GetType() 2;
//int manualViewCircle::GetType() 3;
//int manualViewStar::GetType() 4;
+//int manualViewLine::GetType() 6;
return 0;
void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
{
_viewControlPoints = ifControlPoints;
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
//Adding the spline
AddSplineActor();
// ---------------------------------------------------------------------------
void manualViewBaseContour :: RemoveCompleteContourActor()
-{
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+{
+ /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
//Removing the spline
RemoveSplineActor();
RemoveTextActor();
-
+
//Removing each point
RemoveControlPoints();
RefreshContour();
{
// Fathers object
//XXXX::CopyAttributesTo(cloneObject);
-
+
cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
cloneObject-> SetSelected( this->GetSelected() );
cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
cloneObject-> SetSpacing( _spc );
cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
- cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
+ cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
- int i, size = _lstViewPoints.size();
+ int i, size = _lstViewPoints.size();
for ( i=0; i<size; i++ )
{
cloneObject->AddPoint( );
}
// ----------------------------------------------------------------------------
void manualViewBaseContour :: RemoveControlPoints()
-{
+{
if (_wxvtkbaseview!=NULL){
vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
int i,size=_lstViewPoints.size();
{
vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
theRenderer->RemoveActor( pointActor );
- } // for
+ } // for
} // if
- SetIfViewControlPoints( false );
+ SetIfViewControlPoints( false );
}
// ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddControlPoints()
+void manualViewBaseContour::AddControlPoints()
{
vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
- SetIfViewControlPoints( true );
+ SetIfViewControlPoints( true );
if( _viewControlPoints )
{
int i,size=_lstViewPoints.size();
{
vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
theRenderer->AddActor( pointActor );
- }
+ }
}
}
// ----------------------------------------------------------------------------
{
//JSTG 29-02-08 -----------------------------------------------
//int i , nps = _sizePointsContour;
- int i;
+ int i;
int nps = _manContModel->GetNumberOfPointsSpline();
//-------------------------------------------------------------
DeleteVtkObjects();
for (i=0 ; i<nps ; i++){
_pts->SetPoint(i, 0 , 0 , 0 );
- }
- // This is for the boundaring inicialisation
- _pts->SetPoint(0, -1000 , -1000 , -1000 );
- _pts->SetPoint(1, 1000 , 1000 , 1000 );
+ }
+ // 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 );
+
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell( nps /* +1 */ );
// Text
_textActor = vtkTextActor::New();
// _textActor->SetDisplayPosition(200, 200);
- _textActor->SetInput("");
+ _textActor->SetInput("00");
// Set coordinates to match the old vtkScaledTextActor default value
// _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
// _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
vtkTextProperty *tprop = _textActor->GetTextProperty();
tprop->SetFontSize(14);
tprop->SetFontFamilyToArial();
- tprop->SetColor(0, 0, 1);
+ tprop->SetColor(0, 0, 1);
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::CreateNewContour()
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::UpdateViewPoint(int id) // virtual
-{
+{
manualPoint *mp = _manContModel->GetManualPoint(id);
//EEDx6
}
// ----------------------------------------------------------------------------
-void manualViewBaseContour :: UpdateViewPoints()
+void manualViewBaseContour::UpdateViewPoints()
{
int id, size = _lstViewPoints.size();
for( id=0; id<size; id++)
manualViewPoint->SetSpacing(_spc);
vtkActor *actor = manualViewPoint->CreateVtkPointActor();
- _wxvtkbaseview->GetRenderer()->AddActor( actor );
+ _wxvtkbaseview->GetRenderer()->AddActor( actor );
}
// ----------------------------------------------------------------------------
Refresh();
}
// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeletePoint(int id) // virtual
-{
+void manualViewBaseContour::DeletePoint(int id) // virtual
+{
int size=_lstViewPoints.size();
if ( (id>=0) && (id<size) ){
manualViewPoint *mvp =_lstViewPoints[id];
// ----------------------------------------------------------------------------
void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
{
- _posibleSelected=posibleSelected;
+ _posibleSelected=posibleSelected;
}
// ----------------------------------------------------------------------------
bool manualViewBaseContour::GetEditable()
}
//-----------------------------------------------------------------------------
void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
-{
- _viewControlPoints = ifShow;
+{
+ _viewControlPoints = ifShow;
}
// ----------------------------------------------------------------------------
bool manualViewBaseContour:: GetIfViewControlPoints()
SetPosibleSelected(result);
}
}
-
+
}
return result;
for (i=0;i<size;i++){
_pts->GetPoint(i,pp);
vx[i]=pp[0];
- }
+ }
return vx;
}
// ----------------------------------------------------------------------------
for (i=0;i<size;i++){
_pts->GetPoint(i,pp);
vy[i]=pp[1];
- }
+ }
return vy;
}
// ----------------------------------------------------------------------------
for (i=0;i<size;i++){
_pts->GetPoint(i,pp);
vz[i]=pp[2];
- }
+ }
return vz;
}
// ----------------------------------------------------------------------------
}
UpdateColorActor();
- if (_show_text==true)
+ if (_show_text==true)
{
RefreshText();
}
void manualViewBaseContour::RefreshText() // virtual
{
if( _textActor!=NULL)
- _textActor -> SetInput(" ");
+ _textActor -> SetInput("00");
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
//EED 27 sep 2007
// //EEDx6
// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
-// wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
+// wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
-{
+{
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
{
double pp[3];
- manualPoint *mp;
+ manualPoint *mp;
int i;
int size=_manContModel->GetSizeLstPoints();
minX=99999;
minZ=99999;
maxZ=-99999;
}
- for( i = 0; i < size; i++ )
+ for( i = 0; i < size; i++ )
{
mp=_manContModel->GetManualPoint(i);
pp[0]=mp->GetX();
pp[1]=mp->GetY();
if ( ifFindZ )
pp[2]=mp->GetZ();
-
+
// min X
- if (pp[0]<minX)
+ if (pp[0]<minX)
{
minX=pp[0];
}
//min Y
- if (pp[1]<minY)
+ if (pp[1]<minY)
{
minY=pp[1];
}
//max X
- if (pp[0]>maxX)
+ if (pp[0]>maxX)
{
maxX=pp[0];
}
// max Y
- if (pp[1]>maxY)
+ if (pp[1]>maxY)
{
maxY=pp[1];
}
if ( ifFindZ )
{
// min Z
- if (pp[2]<minZ)
+ if (pp[2]<minZ)
{
minZ=pp[2];
}
// max Z
- if (pp[2]>maxZ)
+ if (pp[2]>maxZ)
{
maxZ=pp[2];
}
- }
+ }
}
if ( size<1 )
{
{
opacity=1;
} else {
- opacity=0;
+ opacity=0.5;
}
-
vtkActor *actor;
int i,size=_lstViewPoints.size();
for (i=0;i<size;i++){
}
_contourVtkActor->GetProperty()->SetOpacity( opacity );
_textActor->GetProperty()->SetOpacity( opacity );
- _textActor->SetInput(" ");
+ _textActor->SetInput("00");
}
// ----------------------------------------------------------------------------
_show_text = ok;
if (_show_text==false)
{
- _textActor->SetInput(" ");
+ _textActor->SetInput("00");
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-// _type = 0 Sagital
-// _type = 1 Coronal
-// _type = 2 Axial
+// _type = 0 Sagital
+// _type = 1 Coronal
+// _type = 2 Axial
// _type = -1 View 3D
manualContour3VControler::manualContour3VControler(int type)
}
// ----------------------------------------------------------------------------
-manualContour3VControler * manualContour3VControler :: Clone() // virtual
+manualContour3VControler * manualContour3VControler :: Clone() // virtual
{
manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
CopyAttributesTo(clone);
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
+ mvbc = _lstManualViewBaseContour[i];
mvbc->AddPoint();
}
// EEDhh
// if (_manViewBaseCont1!=NULL){
-// _manViewBaseCont1->AddPoint();
-// _manViewBaseCont2->AddPoint();
+// _manViewBaseCont1->AddPoint();
+// _manViewBaseCont2->AddPoint();
// _manViewBaseCont3->AddPoint();
// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
// }
}
- int id = GetManualContourModel()->AddPoint(xx,yy,zz);
- GetManualViewBaseContour()->AddPoint();
+ /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
+ GetManualViewBaseContour()->AddPoint();
AddPoint_Others();
}
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
+ mvbc = _lstManualViewBaseContour[i];
mvbc->InsertPoint(id);
}
/*EEDhh
if (_manViewBaseCont1!=NULL){
- _manViewBaseCont1->InsertPoint(id);
- _manViewBaseCont2->InsertPoint(id);
- _manViewBaseCont3->InsertPoint(id);
+ _manViewBaseCont1->InsertPoint(id);
+ _manViewBaseCont2->InsertPoint(id);
+ _manViewBaseCont3->InsertPoint(id);
this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
}
*/
if (_type==0)
{
xx=_vtkmprbasedata->GetX();
- }
+ }
if (_type==1)
{
id = GetManualContourModel()->InsertPoint(xx,yy,zz);
- GetManualViewBaseContour()->InsertPoint(id);
- InsertPoint_Others(0);
+ GetManualViewBaseContour()->InsertPoint(id);
+ InsertPoint_Others(0);
} else {
- AddPoint(x,y,z);
+ AddPoint(x,y,z);
}
}
}
// EEDhh
/*
-void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
- manualViewBaseContour *manViewBaseCont0,
- manualViewBaseContour *manViewBaseCont1,
+void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
+ manualViewBaseContour *manViewBaseCont0,
+ manualViewBaseContour *manViewBaseCont1,
manualViewBaseContour *manViewBaseCont2,
manualViewBaseContour *manViewBaseCont3)
{
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
- mvbc->DeletePoint(id);
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->DeletePoint(id);
mvbc->Refresh();
}
/*
if (_manViewBaseCont1!=NULL){
- _manViewBaseCont1->DeletePoint(id);
- _manViewBaseCont2->DeletePoint(id);
+ _manViewBaseCont1->DeletePoint(id);
+ _manViewBaseCont2->DeletePoint(id);
_manViewBaseCont3->DeletePoint(id);
-
+
_manViewBaseCont1->Refresh();
_manViewBaseCont2->Refresh();
_manViewBaseCont3->Refresh();
-
+
this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
}
*/
}
// ----------------------------------------------------------------------------
void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
-{
+{
int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
if (id!=-1){
manualContourBaseControler::DeleteActualMousePoint( x , y );
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
+ mvbc = _lstManualViewBaseContour[i];
mvbc->SelectAllPossibleSelected(false);
if (id!=-1)
- {
+ {
mvbc->SetPointPosibleSelected(id,true);
}
- mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
+ mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
mvbc->Refresh();
}
-
+
// EEDhh
-/*
+/*
if (_manViewBaseCont1!=NULL){
_manViewBaseCont1->SelectAllPossibleSelected(false);
_manViewBaseCont2->SelectAllPossibleSelected(false);
_manViewBaseCont3->SelectAllPossibleSelected(false);
- if (id!=-1){
+ if (id!=-1){
_manViewBaseCont1->SetPointPosibleSelected(id,true);
_manViewBaseCont2->SetPointPosibleSelected(id,true);
_manViewBaseCont3->SetPointPosibleSelected(id,true);
- }
- _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
- _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
- _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
+ }
+ _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
+ _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
+ _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
_manViewBaseCont1->Refresh();
_manViewBaseCont2->Refresh();
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
+ mvbc = _lstManualViewBaseContour[i];
mvbc->Refresh();
}
// EEDhh
int i,size=this->_lstManualViewBaseContour.size();
for ( i = 0 ; i < size ; i++ )
{
- mvbc = _lstManualViewBaseContour[i];
+ mvbc = _lstManualViewBaseContour[i];
mvbc->DeleteContour();
mvbc->CreateNewContour();
}
{
}
// ----------------------------------------------------------------------------
-manualContour3DControler * manualContour3DControler :: Clone() // virtual
+manualContour3DControler * manualContour3DControler :: Clone() // virtual
{
manualContour3DControler * clone = new manualContour3DControler();
CopyAttributesTo(clone);
manualContourControler::MouseClickLeft(x,y);
-}
+}
// ----------------------------------------------------------------------------
bool manualContour3DControler::OnChar()
{
}
// ----------------------------------------------------------------------------
-manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
+manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
{
manualContour3V3DControler * clone = new manualContour3V3DControler();
CopyAttributesTo(clone);
}
// ----------------------------------------------------------------------------
-void manualContour3V3DControler::ResetContour() // virtual
+void manualContour3V3DControler::ResetContour() // virtual
{
manualContourControler::ResetContour();
_manualcontour3Vcontroler->ResetContour_Others();
// _state = 0 // ..nothing..
// _state = 1 // move with add point
-// _state = 5 // move
+// _state = 5 // move
// _state = 6 // move with insert point
// _state = 7 // move with non selection
manualContourControler::manualContourControler()
{
_easyCreation = true;
-
+
}
// ----------------------------------------------------------------------------
manualContourControler::~manualContourControler()
{
}
// ----------------------------------------------------------------------------
-manualContourControler * manualContourControler :: Clone() // virtual
+manualContourControler * manualContourControler :: Clone() // virtual
{
manualContourControler * clone = new manualContourControler();
CopyAttributesTo(clone);
// ----------------------------------------------------------------------------
void manualContourControler::MouseClickLeft(int x, int y){
-
+
bool ok = false;
int z = GetZ();
int size= GetManualViewBaseContour()->GetNumberOfPoints();
// Insert a Control Point with shift+ClickLeft
- int tt = GetState();
+ // int tt = GetState(); // JPRx
vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
//EED3131
if( IsEditable() )
{
- if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
- {
+ if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
+ {
ok=true;
InsertPoint(x,y,z);
size++;
}
// Start to Insert Control Points with ClickLeft (Empty contour)
if ((GetState()==0) && (size==0) && (_easyCreation==true) )
- {
+ {
ok=true;
- SetState(1);
+ SetState(1);
AddPoint(x,y,z);
}
// Continuie to Insert Control Points with ClickLeft (After being empty the contour)
- if ((GetState()==1) && (_easyCreation==true) )
- {
+ if ((GetState()==1) && (_easyCreation==true) )
+ {
ok=true;
AddPoint(x,y,z);
_bakIdPoint=GetNumberOfPointsManualContour() - 1;
}
// Insert Control Points IF Contour si Selected
- if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
- {
+ if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
+ {
ok=true;
InsertPoint(x,y,z);
_bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
{
ok=true;
- _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
// If nothing selected _state=7
if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
{
//ok=true;
- _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(7);
}
- }
- else
- {
+ }else{
SetPosibleToMove( true );
GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
- }
+ } // IsEditable
+
if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
- {
+ {
SetMoving( true );
- ok=true;
+ ok=true;
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
- }
+ }
if (ok==true)
{
GetManualViewBaseContour()->Refresh();
{
int z=GetZ();
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
- {
+ {
GetManualViewBaseContour()->MoveContour(x,y,z);
}
if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
if (!IsEditable())
{
GetManualViewBaseContour()->RemoveControlPoints();
- GetManualViewBaseContour()->RemoveTextActor();
+// GetManualViewBaseContour()->RemoveTextActor();
GetManualViewBaseContour()->Refresh();
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
}
}
// ----------------------------------------------------------------------------
-void manualContourControler::MouseDLeft( int x, int y)//virtual
+void manualContourControler::MouseDLeft( int x, int y)//virtual
{
- manualContourBaseControler::MouseDLeft( x, y);
+ manualContourBaseControler::MouseDLeft( x, y);
if ( IsEditable() )
{
GetManualViewBaseContour()->AddControlPoints();
GetManualViewBaseContour()->AddTextActor();
GetManualViewBaseContour()->Refresh();
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
+ }
}
// ----------------------------------------------------------------------------
void manualContourControler::SetEasyCreation(bool easyCreation)
{
}
// ----------------------------------------------------------------------------
-manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
+manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
{
manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
CopyAttributesTo(clone);
return true;
}
// ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnMouseMove() // virtual
+bool manualContourPerpPlaneControler::OnMouseMove() // virtual
{
manualContourControler::OnMouseMove();
return _flagMouseMove;
}
// ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
+bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
{
manualContourControler::OnLeftDClick();
return _flagMouseDClick;
}
// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::ResetContour() // virtual
+void manualContourPerpPlaneControler::ResetContour() // virtual
{
manualContourControler::ResetContour();
_manualcontour3Vcontroler->ResetContour_Others();
}
// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
+void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
{
_flagMouseDClick=true;
manualContourControler::MouseDLeft(x,y);
// _vtkmprbasedata->SetZ( mp->GetZ() );
// ResetOrientationPlane();
// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-// }
+// }
}
{
}
// ----------------------------------------------------------------------------
-manualRoiControler * manualRoiControler :: Clone() // virtual
+manualRoiControler * manualRoiControler :: Clone() // virtual
{
manualRoiControler * clone = new manualRoiControler();
CopyAttributesTo(clone);
}
// ----------------------------------------------------------------------------
+
void manualRoiControler::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)) {
+
+ if( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ } // IsEditable
+
+ // Move contour
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
}
+
+ // if the firs time create 4 control points and move one point
int size=GetManualViewBaseContour()->GetNumberOfPoints();
- if (GetState()==0) {
+ if (GetState()==0) {
if (size==0){
- AddPoint(x,y,z);
- AddPoint(x,y,z);
- AddPoint(x,y,z);
- AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(1);
+ }
+ }
+
+/*EED 21 Avril 2009
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ 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);
+ 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);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
+
// ----------------------------------------------------------------------------
void manualRoiControler::MouseMove(int x, int y) // virtual
{
// this->_vtkInteractorStyleBaseView->
+
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- if (GetState()==5){
- SetPoint( bakIdPoint , x , y ,z);
+
+ if ( (GetState()==5) || (GetState()==1) ){
+ SetPoint( bakIdPoint , x , y ,z);
if (bakIdPoint==0)
{
- SetPointX( 1 , x );
- SetPointY( 3 , y );
+ SetPointX( 1 , x );
+ SetPointY( 3 , y );
}
if (bakIdPoint==1)
{
- SetPointX( 0 , x );
- SetPointY( 2 , y );
+ SetPointX( 0 , x );
+ SetPointY( 2 , y );
}
if (bakIdPoint==2)
{
- SetPointX( 3 , x );
- SetPointY( 1 , y );
+ SetPointX( 3 , x );
+ SetPointY( 1 , y );
}
if (bakIdPoint==3)
{
- SetPointX( 2 , x );
- SetPointY( 0 , y );
+ SetPointX( 2 , x );
+ SetPointY( 0 , y );
}
}
- if (GetState()==6){
+ if (GetState()==6){
GetManualViewBaseContour()->MoveContour(x,y,z);
}
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
-{
+{
}
// ----------------------------------------------------------------------------
void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
GetManualViewBaseContour() ->UpdateViewPoint(3);
SetState(0);
- GetManualViewBaseContour()->Refresh();
-}
+ GetManualViewBaseContour()->Refresh();
+}
// ----------------------------------------------------------------------------
void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
{
}
// ----------------------------------------------------------------------------
-manualCircleControler * manualCircleControler :: Clone() // virtual
+manualCircleControler * manualCircleControler :: Clone() // virtual
{
manualCircleControler * clone = new manualCircleControler();
CopyAttributesTo(clone);
// ----------------------------------------------------------------------------
void manualCircleControler::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)) {
+
+ if( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ }// IsEditable
+
+ // move contour
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
}
+
+ // firstime create 2 control points and move one control point
int size=GetManualViewBaseContour()->GetNumberOfPoints();
- if (GetState()==0) {
+ if (GetState()==0) {
if (size==0){
- AddPoint(x,y,z);
- AddPoint(x,y,z);
-// AddPoint(x,y,z);
-// AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(1);
+ }
+ }
+
+/*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);
+ SetPoint(0,x,y,z);
+ SetPoint(1,x,y,z);
}
- bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
void manualCircleControler::MouseMove(int x, int y) // virtual
{
int z=GetZ();
-
// this->_vtkInteractorStyleBaseView->
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- if (GetState()==5){
- SetPoint( bakIdPoint , x , y ,z);
-/*
- if (bakIdPoint==0)
- {
- SetPointX( 1 , x );
- SetPointY( 3 , y );
- }
- if (bakIdPoint==1)
- {
- SetPointX( 0 , x );
- SetPointY( 2 , y );
- }
-
- if (bakIdPoint==2)
- {
- SetPointX( 3 , x );
- SetPointY( 1 , y );
- }
- if (bakIdPoint==3)
- {
- SetPointX( 2 , x );
- SetPointY( 0 , y );
- }
-*/
- }
- if (GetState()==6){
+ if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
+ if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
+
+ if (GetState()==6){
GetManualViewBaseContour()->MoveContour(x,y,z);
}
GetManualViewBaseContour()->Refresh();
// ----------------------------------------------------------------------------
void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
-{
+{
}
// ----------------------------------------------------------------------------
// GetManualViewBaseContour() ->UpdateViewPoint(3);
SetState(0);
- GetManualViewBaseContour()->Refresh();
-}
+ GetManualViewBaseContour()->Refresh();
+}
// ----------------------------------------------------------------------------
/*
*/
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// 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( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ } //IsEditable
+
+ // move contour
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
+ GetManualViewBaseContour()->InitMove(x,y,z);
+ SetState(6);
+ }
+
+ // fist time create 2 control points and move a control point
+ 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(1);
+ }
+ }
+
+
+/*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);
+ }
+ 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()==1) { SetPoint( bakIdPoint , 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();
+}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
_manViewBaseCont = NULL;
_manContModel = NULL;
_state = 0;
- _z = -900;
+ _z = 900;
_editable = true;
- _posibleToMove = true;
+ _posibleToMove = true;
_moving = false;
_created = false;
_keyBoardMoving = false;
}
// ----------------------------------------------------------------------------
-manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
+manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
{
manualContourBaseControler * clone = new manualContourBaseControler();
CopyAttributesTo(clone);
int X,Y;
wxVTKRenderWindowInteractor *_wxVTKiren;
_wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- _wxVTKiren->GetEventPosition(X, Y);
- int Z = GetZ();
+ _wxVTKiren->GetEventPosition(X, Y);
+ //int Z = GetZ(); // JPRx
// Delete Point
if ((keyCode==8) || (keyCode==127))
{
}
GetManualViewBaseContour()->Refresh();
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
+ }
else
{
- // Magnet
+ // Magnet
if (keyCode==32)
{
Magnet(X,Y);
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
}
else if( !IsEditable() )
- {
+ {
if ( keyCode == 'L' )
- {
- GetManualViewBaseContour()->MoveContour( -1, 0 );
+ {
+ GetManualViewBaseContour()->MoveContour( -1, 0 );
SetKeyBoardMoving( true );
}
else if ( keyCode == 'R' )
- {
- GetManualViewBaseContour()->MoveContour( 1, 0 );
- SetKeyBoardMoving( true );
+ {
+ GetManualViewBaseContour()->MoveContour( 1, 0 );
+ SetKeyBoardMoving( true );
}
else if ( keyCode == 'U' )
{
- GetManualViewBaseContour()->MoveContour( 0, -1 );
+ GetManualViewBaseContour()->MoveContour( 0, -1 );
SetKeyBoardMoving( true );
}
else if ( keyCode == 'D' )
{
- GetManualViewBaseContour()->MoveContour( 0, 1 );
+ GetManualViewBaseContour()->MoveContour( 0, 1 );
SetKeyBoardMoving( true );
}
else if ( keyCode == 'W' )//Diagonal left down
{
- GetManualViewBaseContour()->MoveContour( -1, 1 );
+ GetManualViewBaseContour()->MoveContour( -1, 1 );
SetKeyBoardMoving( true );
}
else if ( keyCode == 'Q' )//Diagonal left up
{
- GetManualViewBaseContour()->MoveContour( -1, -1 );
+ GetManualViewBaseContour()->MoveContour( -1, -1 );
SetKeyBoardMoving( true );
}
else if( keyCode == 'P' )//Diagonal right up
{
- GetManualViewBaseContour()->MoveContour( 1, -1 );
+ GetManualViewBaseContour()->MoveContour( 1, -1 );
SetKeyBoardMoving( true );
}
else if( keyCode == 'M' )//Diagonal right down
{
- GetManualViewBaseContour()->MoveContour( 1, 1 );
+ GetManualViewBaseContour()->MoveContour( 1, 1 );
SetKeyBoardMoving( true );
}
if( GetKeyBoardMoving() )
{
GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
}
}
- }
+ }
}
return true;
}
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnMouseMove()
{
+
if ( _vtkInteractorStyleBaseView!=NULL)
{
int X,Y;
wxVTKRenderWindowInteractor *wxVTKiren;
wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
wxVTKiren->GetEventPosition(X,Y);
-
+
MouseClickLeft(X,Y);
}
return true;
return true;
}
// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnMiddleButtonDown()
+bool manualContourBaseControler::OnMiddleButtonDown()
{
// SetKeyBoardMoving( false );
if ( _vtkInteractorStyleBaseView!=NULL )
wxVTKRenderWindowInteractor *wxVTKiren;
wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
wxVTKiren->GetEventPosition(X, Y);
-
+
SetCompleteCreation( true );
SetKeyBoardMoving( false );
MouseClickRight(X,Y);
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
-{
-
+{
+
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseClickRight(int x, int y)
{
- if (_state==1)
- {
- _state=0;
- }
+// if (_state==1)
+// {
+// _state=0;
+// }
SetEditable( false );
SetPosibleToMove( false );
- //_state = 0;
- _state=7;
+ _state = 0;
+
+//EED 24Avril2009 _state=7;
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseReleaseLeft(int x, int y)
{
if (_state==5){ _state = 0; }
if (_state==6){ _state = 0; }
- if (_state==7){ _state = 0; }
+ if (_state==7){ _state = 0; }
SetMoving( false );
GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
{
SetEditable( false );
- SetPosibleToMove( false );
+ SetPosibleToMove( false );
}
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseDLeft(int x, int y )
{
- if (_state==0)
- {
+ if (_state==0)
+ {
int z=GetZ();
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
GetManualViewBaseContour()->RemoveControlPoints();
}
GetManualViewBaseContour()->SetSelected( condition );
- }
+ }
_editable = condition;
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::DeleteContour(){
_manViewBaseCont->DeleteContour();
- _manContModel->DeleteAllPoints();
+ _manContModel->DeleteAllPoints();
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
-{
+{
if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
{
int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
_manContModel->DeletePoint(id);
- _manViewBaseCont->DeletePoint(id);
+ _manViewBaseCont->DeletePoint(id);
}
}
_state = 0;
// ----------------------------------------------------------------------------
void manualContourBaseControler::Magnet(int x, int y)
-{
+{
if( IsEditable())
{
- int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
+ /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
if (GetManualContourModel()!=NULL){
double xx = x;
double yy = y;
double yy = y;
double zz = z;
GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- int id = GetManualContourModel()->AddPoint(xx,yy,zz);
- GetManualViewBaseContour()->AddPoint();
+ /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
+ GetManualViewBaseContour()->AddPoint();
// GetManualViewBaseContour()->UpdateViewPoint(id);
}
}
GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
if (GetManualContourModel()->GetSizeLstPoints()>1){
id = GetManualContourModel()->InsertPoint(xx,yy,zz);
- GetManualViewBaseContour()->InsertPoint(id);
+ GetManualViewBaseContour()->InsertPoint(id);
// GetManualViewBaseContour()->UpdateViewPoint(id);
} else {
GetManualContourModel()->AddPoint(xx,yy,zz);
- GetManualViewBaseContour()->AddPoint();
-// AddPoint(x,y,z);
+ GetManualViewBaseContour()->AddPoint();
+// AddPoint(x,y,z);
// GetManualViewBaseContour()->UpdateViewPoint(id);
}
}