virtual bool OnRightButtonUp();
void SetModelView(manualBaseModel *manContModel, manualViewBaseContour *manViewBaseCont);
- manualBaseModel * GetManualContourModel();
+ manualBaseModel * GetManualContourModel();
manualViewBaseContour * GetManualViewBaseContour();
_cntSplineX = vtkKochanekSpline::New( );
_cntSplineY = vtkKochanekSpline::New( );
_cntSplineZ = vtkKochanekSpline::New( );
-
this->SetCloseContour(true);
-
_cntSplineX->SetDefaultTension( 0 );
_cntSplineX->SetDefaultBias( 0 );
_cntSplineX->SetDefaultContinuity( 0 );
-
_cntSplineY->SetDefaultTension( 0 );
_cntSplineY->SetDefaultBias( 0 );
_cntSplineY->SetDefaultContinuity( 0 );
-
_cntSplineZ->SetDefaultTension( 0 );
_cntSplineZ->SetDefaultBias( 0 );
_cntSplineZ->SetDefaultContinuity( 0 );
-
//JSTG 25-02-08 -------------------------------------------------------------------------------------------------
-
// this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
_sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
-
_delta_JSTG = 0.0;
//---------------------------------------------------------------------------------------------------------------
-
//CMRU 17-08-09 -------------------------------------------------------------------------------------------------
_realSize = 0.0;
_label = "";
//---------------------------------------------------------------------------------------------------------------
-
}
// ----------------------------------------------------------------------------
delete _lstPoints[i];
}
_lstPoints.clear();
-
_cntSplineX->RemoveAllPoints();
_cntSplineY->RemoveAllPoints();
_cntSplineZ->RemoveAllPoints();
-
_cntSplineX->Delete();
_cntSplineY->Delete();
_cntSplineZ->Delete();
}
+
// ----------------------------------------------------------------------------
int manualContourModel::AddPoint(double x,double y,double z)
{
mp->SetPoint(x,y,z);
AddManualPoint(mp);
//UpdateSpline();
-
return _lstPoints.size()-1;
}
// ----------------------------------------------------------------------------
void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
{
+printf("EED manualContourModel::MovePoint %p \n", this);
manualPoint *mp=_lstPoints[i];
double x=mp->GetX()+dx;
double y=mp->GetY()+dy;
}
// ----------------------------------------------------------------------------
-
-
/*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
{
if (_lstPoints.size()==0)
z = _cntSplineZ->Evaluate(t);
}
}*/
+
// ----------------------------------------------------------------------------
double manualContourModel::GetPathSize(double *spc)
{
double result = 0;
double x1,y1,z1;
double x2,y2,z2;
-
// JSTG 25-02-08 -----------------------------
//double t,delta;
//int i,np,nps;
int i;
//--------------------------------------------
-
if (_lstPoints.size()==2)
{
x1 = spc[0] * _lstPoints[0]->GetX();
}
if (_lstPoints.size()>2)
{
-
// JSTG 25-02-08 ------------------------------------------
//np = _lstPoints.size( );
//nps = 200;
UpdateSpline();
//GetSplinePoint(0,x1,y1,z1);
GetSpline_i_Point(0,&x1,&y1,&z1);
-
x1 = spc[0] * x1;
y1 = spc[1] * y1;
z1 = spc[2] * z1;
z1=z2;
}// for
}
-
return result;
}
-
// ----------------------------------------------------------------------------
double manualContourModel::GetPathArea(double *spc)
{
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
x2=spc[0]*x2;
y2=spc[1]*y2;
z2=spc[2]*z2;
- area +=
- (x1 * y2 ) -
- ( x2 * y1 );
+ area += (x1 * y2 ) - ( x2 * y1 );
if (z1!=z2)
{
okArea=false;
// 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)
{
double distMin=999999999;
rn[0] = x2-x1;
rn[1] = y2-y1;
rn[2] = z2-z1;
- }
- x2=x1;
- y2=y1;
- z2=z1;
+ } // if
+ x2 = x1;
+ y2 = y1;
+ z2 = z1;
}// for
-
// JSTG 25-02-08 ------------------------------------------
//if (tback==0)
if (iback==0)
//GetSplinePoint(t,x1,y1,z1);
GetSpline_i_Point(i,&x1,&y1,&z1);
//----------------------------------------------------------
- rn[0]=rp[0]-x1;
- rn[1]=rp[1]-y1;
- rn[2]=rp[2]-z1;
- }
+ rn[0] = rp[0]-x1;
+ rn[1] = rp[1]-y1;
+ rn[2] = rp[2]-z1;
+ } // if iback
} else {
rp[0] = 0;
rp[1] = 0;
rn[0] = -1;
rn[1] = 0;
rn[2] = 0;
- }
+ } // if np
}
// ----------------------------------------------------------------------------
-manualContourModel * manualContourModel :: Clone() // virtual
+manualContourModel * manualContourModel::Clone() // virtual
{
manualContourModel * clone = new manualContourModel();
CopyAttributesTo(clone);
int nps = GetNumberOfPointsSpline();
_deltaAngle=(3.14159265*2)/(nps-1);
- if (np==2){
+ if (np==2)
+ {
mpA = GetManualPoint(0);
mpB = GetManualPoint(1);
difX = mpA->GetX() - mpB->GetX();
double _centerX;
double _centerY;
double _centerZ;
-
virtual int GetTypeModel();
virtual void UpdateSpline();
};
void manualViewBullEyeSector::RefreshContour()
{
//EED004
- int i,nps;
- double x,y,z;
- double xx,yy,zz;
+ int i,nps;
+ double x,y,z;
+ double xx,yy,zz;
//----------------------------------
//EED 27 Juin 2012
//Boundaring box
- _minX=99999;
- _minY=99999;
- _minZ=99999;
- _maxX=-99999;
- _maxY=-99999;
- _maxZ=-99999;
+ _minX = 99999;
+ _minY = 99999;
+ _minZ = 99999;
+ _maxX = -99999;
+ _maxY = -99999;
+ _maxZ = -99999;
_manContModel->UpdateSpline();
nps = _manContModel->GetNumberOfPointsSpline();
if ( _pts!=NULL )
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-// EED08
-
manualViewCircle::manualViewCircle()
{
// _sizePointsContour=5; // default 100
{
}
-
// ----------------------------------------------------------------------------
manualViewCircle * manualViewCircle :: Clone()
{
}
// ---------------------------------------------------------------------------
-
void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
{
// Fathers object
manualViewBaseContour::CopyAttributesTo(cloneObject);
}
-
// ----------------------------------------------------------------------------
int manualViewCircle::GetType() // virtual
{
maxX=mpA->GetX()+radio;
maxY=mpA->GetY()+radio;
} else {
- minX=0;
- maxX=0;
- minY=0;
- maxY=0;
- }
+ minX = 0;
+ maxX = 0;
+ minY = 0;
+ maxY = 0;
+ } // if np
}
void manualViewCircle::InitMove(int x, int y, int z) // virtual
{
manualPoint *mp;
- double XX=x;
- double YY=y;
- double ZZ=z;
+ double XX = x;
+ double YY = y;
+ double ZZ = z;
TransfromCoordViewWorld(XX,YY,ZZ);
-
- if (_manContModel->GetSizeLstPoints()==2){
+ 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();
+ _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();
/*
mp = _manContModel->GetManualPoint(2);
_dp2[0]= mp->GetX() - XX;
_dp2[1]= mp->GetY() - YY;
_dp2[2]= mp->GetZ();
-
mp = _manContModel->GetManualPoint(3);
_dp3[0]= mp->GetX() - XX;
_dp3[1]= mp->GetY() - YY;
_dp3[2]= mp->GetZ();
*/
- }
+ } // if
}
-
// ----------------------------------------------------------------------------
void manualViewCircle::MoveContour(int x, int y, int z) // virtual
{
+printf("EED manualViewCircle::MoveContour %p \n", this);
manualPoint *mp;
double XX=x;
double YY=y;
double ZZ=z;
TransfromCoordViewWorld(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]);
-
// mp = _manContModel->GetManualPoint(2);
// mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
-
// mp = _manContModel->GetManualPoint(3);
// mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
-
UpdateViewPoint(0);
UpdateViewPoint(1);
// UpdateViewPoint(2);
// UpdateViewPoint(3);
+}
+// ----------------------------------------------------------------------------
+bool manualViewCircle::ShowLineVersion()
+{
+ return false;
}
+
+
virtual void InitMove(int x, int y, int z);
virtual void MoveContour(int x, int y, int z);
void GetMinMax(double &minX,double &minY, double &maxX, double &maxY);
+ virtual bool ShowLineVersion();
private:
double _dp0[3];
manualViewContour::manualViewContour()
{
_id_viewPoint_for_text = 0;
- _initialConoturModel = new manualContourModel();
-
+ _initialConoturModel = new manualContourModel();
_minX = 99999;
_minY = 99999;
_maxX = -99999;
}
// ----------------------------------------------------------------------------
-
void manualViewContour::Open(FILE *pFile)
{
}
+// ----------------------------------------------------------------------------
+bool manualViewContour::ShowLineVersion() // virtual
+{
+ bool result = false;
+ int np = GetNumberOfPoints( );
+ if (np==2)
+ {
+ result=true;
+ }
+ return result;
+}
+
// ----------------------------------------------------------------------------
void manualViewContour::RefreshContour() // virtual
{
- int i,np,nps;
+ int i,nps;
//JSTG 25-02-08 --------------------
//double t,delta, x,y,z;
double x,y,z;
double xx,yy,zz;
//----------------------------------
-
- np = GetNumberOfPoints( );
-
- if (np==2)
+ if ( ShowLineVersion()==true )
{
SetCellArray(false);
manualPoint *mpA = _manContModel->GetManualPoint(0);
manualPoint *mpB = _manContModel->GetManualPoint(1);
if ( _pts!=NULL )
{
- xx=mpA->GetX() * _spc[0];
- yy=mpA->GetY() * _spc[1];
- zz=mpA->GetZ() * _spc[2];
- _minX=xx;
- _minY=yy;
- _maxX=xx;
- _maxY=yy;
+ xx = mpA->GetX() * _spc[0];
+ yy = mpA->GetY() * _spc[1];
+ zz = mpA->GetZ() * _spc[2];
+ _minX = xx;
+ _minY = yy;
+ _maxX = xx;
+ _maxY = yy;
_pts->SetPoint(0 , xx , yy , zz );
xx=mpB->GetX() * _spc[0];
yy=mpB->GetY() * _spc[1];
//EED 27 Juin 2012
//Boundaring box
- _minX=99999;
- _minY=99999;
- _maxX=-99999;
- _maxY=-99999;
+ _minX = 99999;
+ _minY = 99999;
+ _maxX = -99999;
+ _maxY = -99999;
if ( _pts!=NULL )
{
+ int np = GetNumberOfPoints( );
if (np>=2 )
{
for( i = 0; i < nps; i++ )
} // if
} // _pts!=NULL
} //np==2
-
- _minX=_minX-1.0;
- _minY=_minY-1.0;
- _maxX=_maxX+1.0;
- _maxY=_maxY+1.0;
+ _minX = _minX-1.0;
+ _minY = _minY-1.0;
+ _maxX = _maxX+1.0;
+ _maxY = _maxY+1.0;
//EED 2017-03-02
if (_pts!=NULL)
// ----------------------------------------------------------------------------
bool manualViewContour::ifTouchContour(int x,int y,int z)
{
- bool result=false;
-
- double xx=x;
- double yy=y;
- double zz=z;
+ bool result = false;
+ double xx = x;
+ double yy = y;
+ double zz = z;
double ppA[3];
double ppB[3];
double d1,d2,d3;
TransfromCoordViewWorld(xx,yy,zz);
-
//EED 27 sep 2006
xx = xx * _spc[0];
yy = yy * _spc[1];
zz = zz * _spc[2];
-
- if ( (xx>=_minX) && (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY)) { // inside the boundaring box
-
-
- if (_manContModel->GetSizeLstPoints()==2)
+ if ( (xx>=_minX) && (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY))
+ { // inside the boundaring box
+ if ( ShowLineVersion()==true )
{
manualPoint *mpA = _manContModel->GetManualPoint(0);
manualPoint *mpB = _manContModel->GetManualPoint(1);
_pts->GetPoint(0, ppA);
double dirVec[3];
-
// direction of the segment
dirVec[0] = mpB->GetX() - mpA->GetX();
dirVec[1] = mpB->GetY() - mpA->GetY();
dirVec[2] = mpB->GetZ() - mpA->GetZ();
-
-
// proj = mpA + k*dirVec
double num;
double den = 0.0 ;
- num = dirVec[0]*( xx-mpA->GetX() );
- num = num + dirVec[1]*( yy-mpA->GetY() );
- num = num + dirVec[2]*( zz-mpA->GetZ() );
+ num = dirVec[0]*( xx-mpA->GetX() );
+ num = num + dirVec[1]*( yy-mpA->GetY() );
+ num = num + dirVec[2]*( zz-mpA->GetZ() );
den=dirVec[0]*dirVec[0] + dirVec[1]*dirVec[1] + dirVec[2]*dirVec[2];
double k;
if (den!=0)
{
- k=num/den;
+ k = num/den;
} else {
- k=99999999;
+ k = 99999999;
}
// projection of th point xx,yy,zz in segment mpA,mpB
double projX = mpA->GetX() + k*dirVec[0];
{
result=true;
} // if d1
- } else{
+ } else {
unsigned int i, nps,nps_t;
nps = _sizePointsContour;
if (this->_manContModel->IfCloseContour()==true)
{
nps_t = nps;
} else {
- nps_t = nps-1;
+ nps_t = nps-1;
} // if close
for( i = 0; i < nps_t; i++ )
{
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) )
{
- result=true;
- i=nps;
+ result = true;
+ i = nps;
} // if
} // for i
} // if GetSizeLstPoints()==2
} // if min max
-
return result;
}
virtual ~manualViewContour();
virtual manualViewContour * Clone();
void CopyAttributesTo( manualViewContour *cloneObject );
- virtual int GetType();
+ virtual int GetType();
virtual void Save(FILE *pFile);
virtual void Open(FILE *pFile);
+ virtual bool ShowLineVersion();
virtual void RefreshContour();
virtual bool ifTouchContour(int x,int y, int z);
virtual void InitMove(int x, int y, int z);
{
}
-
// ----------------------------------------------------------------------------
manualViewLine * manualViewLine :: Clone()
{
}
// ---------------------------------------------------------------------------
-
void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
{
// Fathers object
return 6;
}
-
// ----------------------------------------------------------------------------
-
void manualViewLine::InitMove(int x, int y, int z) // virtual
{
manualPoint *mp;
double YY=y;
double ZZ=z;
TransfromCoordViewWorld(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();
-
+ _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();
-
- }
+ _dp1[0] = mp->GetX() - XX;
+ _dp1[1] = mp->GetY() - YY;
+ _dp1[2] = mp->GetZ();
+ } // if
}
-
// ----------------------------------------------------------------------------
void manualViewLine::MoveContour(int x, int y, int z) // virtual
{
manualPoint *mp;
- double XX=x;
- double YY=y;
- double ZZ=z;
+ double XX = x;
+ double YY = y;
+ double ZZ = z;
TransfromCoordViewWorld(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);
}
{
ii=i%np;
mp = _manContModel->GetManualPoint(ii);
-
//EEDx6
double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
// wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
//EED 27 sep 2007
// _pts->SetPoint(i, XX,YY,ZZ );
_pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
- } // rof
-
+ } // for
} else {
_pts->SetPoint(0, 0 , 0 , 0);
_pts->SetPoint(1, 0 , 0 , 0);