src/interface/wxWindows/Contour
src/interface/wxWindows/widgets
src/interface/wxWindows/widgets/pPlotter
+ src/interface/wxWindows/widgets/manualContour
../../../
)
#message(jhcl\n\n ${crea_LIBRARIES})
FILE(GLOB ${LIBRARY_NAME}_HEADERS_PPLOTTER "src/interface/wxWindows/widgets/pPlotter/*.h")
FILE(GLOB ${LIBRARY_NAME}_SOURCES_PPLOTTER src/interface/wxWindows/widgets/pPlotter/*.cxx src/interface/wxWindows/widgets/pPlotter/*.cpp src/interface/wxWindows/widgets/pPlotter/*.cc)
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_MANUAL_CONTOUR "src/interface/wxWindows/widgets/manualContour/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_MANUAL_CONTOUR src/interface/wxWindows/widgets/manualContour/*.cpp )
+
FILE(GLOB ${LIBRARY_NAME}_HEADERS_KERNEL "src/kernel/*.h")
FILE(GLOB ${LIBRARY_NAME}_SOURCES_KERNEL src/kernel/*.cxx src/kernel/*.cpp src/kernel/*.cc)
#src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h
#src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h
${${LIBRARY_NAME}_HEADERS_PPLOTTER}
+ ${${LIBRARY_NAME}_HEADERS_MANUAL_CONTOUR}
include/matrix.h
#src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx
#src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
${${LIBRARY_NAME}_SOURCES_PPLOTTER}
+ ${${LIBRARY_NAME}_SOURCES_MANUAL_CONTOUR}
###
#src/kernel/marImageData.cpp
lib/maracasVisuLib/src/interface/wxWindows/Contour
lib/maracasVisuLib/src/interface/wxWindows/widgets
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter
+ lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour
lib/maracasVisuLib/../../../
)
IF ( ${PROJECT_BINARY_DIR} STREQUAL ${EXECUTABLE_OUTPUT_PATH} )
#ifndef __AutoControlPoints_h_INCLUDED__
#define __AutoControlPoints_h_INCLUDED__
-#include "manualContour.h"
+#include "manualContourModel.h"
#include "Propagation.h"
#include "vectorFunctions.h"
#define __ContourExtractData_h_INCLUDED_H__
-#include <manualContour.h>
+#include <manualContourModel.h>
#include "marTypes.h"
*/
#include "marTypes.h"
-#include "manualContour.h"
+#include "manualContourModel.h"
#include "time.h"
#include <wx/wx.h>
Program: wxMaracas
Module: $RCSfile: manualContourContainer.h,v $
Language: C++
- Date: $Date: 2009/05/14 13:54:54 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/15 12:59:23 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
#include <vector>
-#include "manualContour.h"
+//#include "manualContour.h"
+#include "manualContourControler.h"
+#include "manualContourModel.h"
+#include "manualViewContour.h"
class manualContourContainer
{
+++ /dev/null
-
-#include <vtkActor.h>
-#include <vtkProperty.h>
-
-#include <vtkCellArray.h>
-#include <vtkRenderer.h>
-#include <vtkCoordinate.h>
-#include <vtkTextProperty.h>
-#include <vtkTextActor.h>
-#include <vtkProperty2D.h>
-#include <vtkPointPicker.h>
-#include "widgets/UtilVtk3DGeometriSelection.h"
-
-
-#include "manualContour.h"
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualPoint::manualPoint(){
-}
-// ----------------------------------------------------------------------------
-manualPoint::~manualPoint(){
-}
-// ----------------------------------------------------------------------------
-void manualPoint::SetPoint(double x,double y,double z){
- _x=x;
- _y=y;
- _z=z;
-}
-// ----------------------------------------------------------------------------
-void manualPoint::SetPointX(double x){
- _x=x;
-}
-// ----------------------------------------------------------------------------
-void manualPoint::SetPointY(double y){
- _y=y;
-}
-// ----------------------------------------------------------------------------
-void manualPoint::SetPointZ(double z){
- _z=z;
-}
-// ----------------------------------------------------------------------------
-double manualPoint::GetX(){
- return _x;
-}
-// ----------------------------------------------------------------------------
-double manualPoint::GetY(){
- return _y;
-}
-// ----------------------------------------------------------------------------
-double manualPoint::GetZ(){
- return _z;
-}
-// ----------------------------------------------------------------------------
-manualPoint * manualPoint :: Clone()
-{
- manualPoint * clone = new manualPoint();
- clone->SetPoint( GetX(), GetY(), GetZ());
- return clone;
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualContourModelCircle::manualContourModelCircle()
-: manualContourModel()
-{
-}
-
-manualContourModelCircle::~manualContourModelCircle()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
-{
- manualContourModelCircle * clone = new manualContourModelCircle();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
-{
- // Fathers object
- manualContourModel::CopyAttributesTo(cloneObject);
-}
-
-//----------------------------------------------------------------
-int manualContourModelCircle::GetTypeModel() //virtual
-{
- return 3;
-}
-
-//----------------------------------------------------------------
-void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
-{
- double angle = _deltaAngle*i;
- *x = _radio*cos(angle) + _centerX;
- *y = _radio*sin(angle) + _centerY;
- *z = _centerZ;
-}
-
-//
-// ---------------------------------------------------------------------------
-void manualContourModelCircle::UpdateSpline() // virtal
-{
- manualPoint *mpA,*mpB;
- double difX,difY;
- int np = GetSizeLstPoints( );
- int nps = GetNumberOfPointsSpline();
- _deltaAngle=(3.14159265*2)/(nps-1);
-
- if (np==2){
- mpA = GetManualPoint(0);
- mpB = GetManualPoint(1);
- difX = mpA->GetX() - mpB->GetX();
- difY = mpA->GetY() - mpB->GetY();
- _radio = sqrt( difX*difX + difY*difY );
- _centerX = mpA->GetX();
- _centerY = mpA->GetY();
- _centerZ = mpA->GetZ();
- } else {
- _radio = -1;
- _centerX = -1;
- _centerY = -1;
- _centerZ = -1;
- }
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-//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()
-: manualContourModel()
-{
- _numberPointsSlineBySector=101; // impaire
-}
-
-manualContourModelBullEye::~manualContourModelBullEye()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
-{
- manualContourModelBullEye * clone = new manualContourModelBullEye();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
-{
- // Fathers object
- manualContourModel::CopyAttributesTo(cloneObject);
-}
-
-//----------------------------------------------------------------
-int manualContourModelBullEye::GetTypeModel() //virtual
-{
- return 4;
-}
-
-//----------------------------------------------------------------
-int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
-{
- return _numberPointsSlineBySector;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
-{
- this->_numberPointsSlineBySector = numpoints;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::AddSector( double radioA,
- double radioB,
- double ang,
- double angDelta)
-{
- manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
- modelSector->SetSector(radioA,radioB,ang,angDelta);
- modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
- _lstModelBullEyeSector.push_back(modelSector);
-}
-
-//----------------------------------------------------------------
-manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
-{
- return _lstModelBullEyeSector[id];
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::GetSector(int id,
- double *radioA,
- double *radioB,
- double *ang,
- double *angDelta)
-{
- _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
-}
-
-void manualContourModelBullEye::UpdateSpline() // virtual
-{
- manualContourModel::UpdateSpline();
-
- if (this->GetSizeLstPoints()>2){
- double cx,cy;
- double ww,hh;
- manualPoint *mpA = GetManualPoint(0);
- manualPoint *mpB = GetManualPoint(2);
- cx = (mpA->GetX() + mpB->GetX()) / 2.0;
- cy = (mpA->GetY() + mpB->GetY()) / 2.0;
- ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
- hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
- int i,size = _lstModelBullEyeSector.size();
- for (i=0;i<size;i++)
- {
- _lstModelBullEyeSector[i]->SetCenter(cx,cy);
- _lstModelBullEyeSector[i]->SetSize(ww,hh);
- } // for
- }
-}
-
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::ResetSectors()
-{
- int i,size=_lstModelBullEyeSector.size();
- for (i=0;i<size;i++)
- {
- delete _lstModelBullEyeSector[i];
- }
- _lstModelBullEyeSector.clear();
-}
-
-//----------------------------------------------------------------
-int manualContourModelBullEye::GetSizeOfSectorLst()
-{
- return _lstModelBullEyeSector.size();
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::Save(FILE *ff) // virtual
-{
- manualContourModel::Save(ff);
- int i,size = GetSizeOfSectorLst();
- fprintf(ff,"numberOfSections %d \n",size);
- for ( i=0 ; i<size ; i++ )
- {
- _lstModelBullEyeSector[i]->Save(ff);
- }
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEye::Open(FILE *ff) // virtual
-{
- manualContourModel::Open(ff);
-
- ResetSectors();
-
- char tmp[255];
- int i;
- int numberOfSections;
-// double radioA,radioB,ang,deltaAng;
-
- fscanf(ff,"%s",tmp); // NumberOfSections
- fscanf(ff,"%s",tmp); // ##
- numberOfSections = atoi(tmp);
- for (i=0;i<numberOfSections;i++)
- {
- AddSector(0,1,90,0);
- _lstModelBullEyeSector[i]->Open(ff);
- }
-
-}
-
-// ----------------------------------------------------------------------------
-std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
-{
-//EED004
- std::vector<manualContourModel*> lstTmp;
- int i,iSize=_lstModelBullEyeSector.size();
- for (i=0;i<iSize;i++)
- {
- lstTmp.push_back( _lstModelBullEyeSector[i] );
- }
- return lstTmp;
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualContourModelBullEyeSector::manualContourModelBullEyeSector()
-: manualContourModel()
-{
-}
-
-manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
-{
- manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
-{
- // Fathers object
- manualContourModel::CopyAttributesTo(cloneObject);
-}
-
-//----------------------------------------------------------------
-int manualContourModelBullEyeSector::GetTypeModel() //virtual
-{
- return 5;
-}
-
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::SetSector( double radioA,
- double radioB,
- double ang,
- double angDelta)
-{
- _radioA = radioA;
- _radioB = radioB;
- _ang = ang*3.14159265/180.0;
- _angDelta = angDelta*3.14159265/180.0;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::GetSector(
- double *radioA,
- double *radioB,
- double *ang,
- double *angDelta)
-{
- *radioA = _radioA;
- *radioB = _radioB;
- *ang = _ang;
- *angDelta = _angDelta;
-}
-
-// ----------------------------------------------------------------------------
-void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
-{
- _cx = cx;
- _cy = cy;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::SetSize(double ww,double hh)
-{
- _ww = ww;
- _hh = hh;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
-{
-//EED004
-
- int ii,nps;
-// double x,y,z;
- double ang,angcos, angsin;
- double radio;
-
- nps = GetNumberOfPointsSpline() - 3;
-
- if (i==GetNumberOfPointsSpline()-1)
- {
- i=0;
- }
-
- if (i<=nps/2)
- {
- ii=i;
- radio=_radioA;
- } else {
- ii=nps-i+1;
- radio=_radioB;
- }
- ang = ((double)ii/(nps/2))*_angDelta + _ang;
- angcos = cos(ang);
- angsin = sin(ang);
-
- *x = _ww*radio*angcos + _cx;
- *y = _hh*radio*angsin + _cy;
- *z= 900;
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
-{
- manualContourModel::Save(ff);
- fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
-}
-
-//----------------------------------------------------------------
-void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
-{
- char tmp[255];
- fscanf(ff,"%s",tmp); // TypeModel
- fscanf(ff,"%s",tmp); // ##
-
- manualContourModel::Open(ff);
-
-
- fscanf(ff,"%s",tmp); // radioA=
- fscanf(ff,"%s",tmp); // radioA
- _radioA = atof(tmp);
-
- fscanf(ff,"%s",tmp); // radioB=
- fscanf(ff,"%s",tmp); // radioB
- _radioB = atof(tmp);
-
- fscanf(ff,"%s",tmp); // ang=
- fscanf(ff,"%s",tmp); // ang
- _ang = atof(tmp);
-
- fscanf(ff,"%s",tmp); // deltaAng=
- fscanf(ff,"%s",tmp); // deltaAng
- _angDelta = atof(tmp);
-}
-
-
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-
-//JSTG 25-02-08 --------------------------------------------------
-manualContourModelRoi::manualContourModelRoi()
-: manualContourModel()
-{
- SetNumberOfPointsSpline(5);
-}
-
-manualContourModelRoi::~manualContourModelRoi()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
-{
- manualContourModelRoi * clone = new manualContourModelRoi();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
-{
- // Fathers object
- manualContourModel::CopyAttributesTo(cloneObject);
-}
-
-//----------------------------------------------------------------
-int manualContourModelRoi::GetTypeModel() //virtual
-{
- return 2;
-}
-
-//----------------------------------------------------------------
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualContourModel::manualContourModel()
-{
- _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;
-//---------------------------------------------------------------------------------------------------------------
-}
-
-// ----------------------------------------------------------------------------
-manualContourModel::~manualContourModel()
-{
- int i,size=_lstPoints.size();
- for (i=0;i<size; i++){
- 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)
-{
- manualPoint *mp = new manualPoint();
- mp->SetPoint(x,y,z);
- AddManualPoint(mp);
- //UpdateSpline();
-
- return _lstPoints.size()-1;
-}
-// ----------------------------------------------------------------------------
-int manualContourModel::InsertPoint(double x,double y,double z)
-{
- double dd,ddmin=9999999;
- int ibak=0;
- double xx,x1,x2;
- double yy,y1,y2;
- double zz,z1,z2;
- int i,ii,iii,size=_lstPoints.size();
- double j,MaxDivisions=20,porcentage;
- int sizeB=size;
-
- if (_closeContour==false)
- {
- size=size-1;
- }
-
- double jbak;
-
- for ( i=0 ; i<size ; i++ )
- {
- ii=i % sizeB ;
- iii=(i+1) % sizeB;
- x1=_lstPoints[ii]->GetX();
- y1=_lstPoints[ii]->GetY();
- z1=_lstPoints[ii]->GetZ();
- x2=_lstPoints[iii]->GetX();
- y2=_lstPoints[iii]->GetY();
- z2=_lstPoints[iii]->GetZ();
- for (j=0; j<=MaxDivisions; j++)
- {
- porcentage=(j/MaxDivisions);
- xx=(x2-x1)*porcentage+x1;
- yy=(y2-y1)*porcentage+y1;
- zz=(z2-z1)*porcentage+z1;
- dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
- if ( dd<ddmin )
- {
- ddmin=dd;
- ibak=iii;
- jbak=j;
- }
- }
- }
-
- if (_closeContour==false)
- {
- if ( (ibak==1) && (jbak==0) )
- {
- ibak=0;
- }
- if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
- {
- ibak=sizeB;
- }
- }
-
-
-//JSTG - 25-04-08 ----------------------------------------------------------
- //manualPoint *mp = new manualPoint();
- //mp->SetPoint(x,y,z);
- //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
- //_lstPoints.insert(itNum,mp);
- InsertPoint_id(ibak,x,y,z);
-//----------------------------------------------------------------------------
-
- return ibak;
-}
-// ----------------------------------------------------------------------------
-void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
-{
- manualPoint *mp = new manualPoint();
- mp->SetPoint(x,y,z);
- std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
- _lstPoints.insert(itNum,mp);
-}
-// ----------------------------------------------------------------------------
-
-void manualContourModel::DeletePoint(int i)
-{
- std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
- _lstPoints.erase(itNum);
-}
-// ----------------------------------------------------------------------------
-void manualContourModel::DeleteAllPoints()
-{
- int i,size=_lstPoints.size();
- for (i=0;i<size;i++){
- _lstPoints.erase( _lstPoints.begin() );
- }
- this->UpdateSpline();
-}
-// ----------------------------------------------------------------------------
-
-void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
-{
- manualPoint *mp=_lstPoints[i];
- double x=mp->GetX()+dx;
- double y=mp->GetY()+dy;
- double z=mp->GetZ()+dz;
- mp->SetPoint(x,y,z);
-}
-// ----------------------------------------------------------------------------
-void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
-{
- // ToDo
-}
-// ----------------------------------------------------------------------------
-void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
-{
- int i,size=_lstPoints.size();
- for (i=0;i<size;i++){
- MovePoint(i,dx,dy,dz);
- }
-}
-
-
-// ----------------------------------------------------------------------------
-
-// type=-1 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)
-{
- double range = i_range+1;
-
- double xx,yy,zz,dd,ddmin=9999999;
- int ibak=-1;
- int i,size=_lstPoints.size();
- for (i=0;i<size;i++){
- manualPoint *mp=_lstPoints[i];
- xx=mp->GetX();
- yy=mp->GetY();
- zz=mp->GetZ();
-
- 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) );
- 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) );
- 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) );
- 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) );
- if (dd<ddmin){
- ddmin=dd;
- ibak=i;
- }
- }
- }
- }
- return ibak;
-}
-// ----------------------------------------------------------------------------
-manualPoint* manualContourModel::GetManualPoint(int id)
-{
- return _lstPoints[id];
-}
-// ----------------------------------------------------------------------------
-int manualContourModel::GetSizeLstPoints()
-{
- return _lstPoints.size();
-}
-//----------------------------------------------------------------------------
-int manualContourModel::GetNumberOfPointsSpline()
-{
- return _sizePointsContour;
-}
-//----------------------------------------------------------------------------
-void manualContourModel::SetNumberOfPointsSpline(int size)
-{
- _sizePointsContour = size;
-}
-
-
-// ----------------------------------------------------------------------------
-
-void manualContourModel::SetCloseContour(bool closeContour)
-{
- _closeContour = closeContour;
- if (_closeContour==true)
- {
- _cntSplineX->ClosedOn();
- _cntSplineY->ClosedOn();
- _cntSplineZ->ClosedOn();
- } else {
- _cntSplineX->ClosedOff();
- _cntSplineY->ClosedOff();
- _cntSplineZ->ClosedOff();
- }
-}
-
-// ----------------------------------------------------------------------------
-bool manualContourModel::IfCloseContour()
-{
- return _closeContour;
-}
-
-// ----------------------------------------------------------------------------
-
-void manualContourModel::UpdateSpline() // virtual
-{
- int i, np;
- np = _lstPoints.size();
- manualPoint *mp;
- _cntSplineX->RemoveAllPoints();
- _cntSplineY->RemoveAllPoints();
- _cntSplineZ->RemoveAllPoints();
- for( i = 0; i < np; i++ ) {
- mp = GetManualPoint(i);
- _cntSplineX->AddPoint( i, mp->GetX() );
- _cntSplineY->AddPoint( i, mp->GetY() );
- _cntSplineZ->AddPoint( i, mp->GetZ() );
- } // rof
-
-//JSTG 25-02-08 ---------------------------------------------------------------------------------------------
- if (this->_closeContour==true)
- {
- _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) / 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 t = delta*(double)i;
- GetSplinePoint(t, x, y, z);
-}*/
-
-//-----------------------------------------------------------------------------
-
-//JSTG 25-02-08 ---------------------------------------------------------------
-void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
-{
- GetSpline_t_Point(i*_delta_JSTG,x,y,z);
-}
-
-// ----------------------------------------------------------------------------
-
-//JSTG 25-02-08 ---------------------------------------------------------------
-void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
-{
- if (_lstPoints.size()==0)
- {
- *x = 0;
- *y = 0;
- *z = 0;
- }
- if (_lstPoints.size()==1)
- {
- manualPoint *mp;
- mp = GetManualPoint(0);
- *x = mp->GetX();
- *y = mp->GetY();
- *z = mp->GetZ();
- }
- if (_lstPoints.size()>=2)
- {
- *x = _cntSplineX->Evaluate(t);
- *y = _cntSplineY->Evaluate(t);
- *z = _cntSplineZ->Evaluate(t);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-
-/*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
-{
- if (_lstPoints.size()==0)
- {
- x = 0;
- y = 0;
- z = 0;
- }
- if (_lstPoints.size()==1)
- {
- manualPoint *mp;
- mp = GetManualPoint(0);
- x = mp->GetX();
- y = mp->GetY();
- z = mp->GetZ();
- }
- if (_lstPoints.size()>=2)
- {
- x = _cntSplineX->Evaluate(t);
- y = _cntSplineY->Evaluate(t);
- z = _cntSplineZ->Evaluate(t);
- }
-}*/
-// ----------------------------------------------------------------------------
-double manualContourModel::GetPathSize()
-{
- 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=_lstPoints[0]->GetX();
- y1=_lstPoints[0]->GetY();
- z1=_lstPoints[0]->GetZ();
- x2=_lstPoints[1]->GetX();
- y2=_lstPoints[1]->GetY();
- z2=_lstPoints[1]->GetZ();
- result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
- }
- if (_lstPoints.size()>2)
- {
-
-// JSTG 25-02-08 ------------------------------------------
- //np = _lstPoints.size( );
- //nps = 200;
- //delta=( double ) ( np ) / ( double ) ( nps );
- UpdateSpline();
- //GetSplinePoint(0,x1,y1,z1);
- GetSpline_i_Point(0,&x1,&y1,&z1);
-
- //for( i = 1; i < nps; i++ )
- for( i = 1; i < GetNumberOfPointsSpline(); i++ )
- {
- //t = delta * (double)i;
- //GetSplinePoint(t,x2,y2,z2);
- GetSpline_i_Point(i,&x2,&y2,&z2);
-//---------------------------------------------------------
- result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
- x1=x2;
- y1=y2;
- z1=z2;
- }// for
- }
-
- return result;
-}
-// ----------------------------------------------------------------------------
-double manualContourModel::GetPathArea()
-{
- double result = 555;
- if ((_lstPoints.size()>=3) && IfCloseContour()==true )
- {
- double area;
-//JSTG 25-02-08 ---------------------------------------------
- //double ti,tj;
-//-----------------------------------------------------------
- double x1,y1,z1;
- 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
- // given in clockwise order).
-
-//JSTG 25-02-08 -------------------------------------------------
- //int np = _lstPoints.size( );
- //int nps = 200;
- int nps = GetNumberOfPointsSpline();
- //double delta=( double ) ( np ) / ( double ) ( nps );
- UpdateSpline();
- for( i = 0, area = 0.0; i < nps; i++ )
- {
- j = ( i + 1 ) % nps;
- //ti = delta * (double)i;
- //tj = delta * (double)j;
- //GetSplinePoint(ti,x1,y1,z1);
- //GetSplinePoint(tj,x2,y2,z2);
- GetSpline_i_Point(i,&x1,&y1,&z1);
- GetSpline_i_Point(j,&x2,&y2,&z2);
-//----------------------------------------------------------------
- area +=
- (x1 * y2 ) -
- ( x2 * y1 );
- if (z1!=z2)
- {
- okArea=false;
- }
- }// for
- area /= 2.0;
- area = fabs( area );
-
-/*
- for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
- {
- j = ( i + 1 ) % _lstPoints.size();
- // Area
- area +=
- (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
- ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
- if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
- {
- okArea=false;
- }
- } // rof
- area /= 2.0;
- area = fabs( area );
-*/
-
- if (okArea==true)
- {
- result = area;
- } else {
- result = -1;
- }
-
- } else {
- result = 0;
- }
- return result;
-}
-
-// ----------------------------------------------------------------------------
-// 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;
- double dist,dx,dy,dz;
- double x1,y1,z1;
- double x2,y2,z2;
- int i,np,nps;
-
-//JSTG 25-02-08 -------------------
- //double tback;
- int iback;
- //double t,delta;
-//---------------------------------
-
- np = _lstPoints.size( );
- if (np>=2)
- {
-// JSTG 25-02-08 ------------------------------------------
- //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++ )
- {
- //t = delta * (double)i;
- //GetSplinePoint(t,x1,y1,z1);
- GetSpline_i_Point(i,&x1,&y1,&z1);
-//----------------------------------------------------------
- dx= x1-p[0];
- dy= y1-p[1];
- dz= z1-p[2];
- dist = sqrt( dx*dx + dy*dy + dz*dz );
- if (dist<distMin)
- {
- distMin = dist;
-//JSTG tback = t;
- iback = i;
- rp[0] = x1;
- rp[1] = y1;
- rp[2] = z1;
- rn[0] = x2-x1;
- rn[1] = y2-y1;
- rn[2] = z2-z1;
- }
- x2=x1;
- y2=y1;
- z2=z1;
- }// for
-
-// JSTG 25-02-08 ------------------------------------------
- //if (tback==0)
- if (iback==0)
- {
- //t = delta * (double)1.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;
- }
- }
- else
- {
- rp[0] = 0;
- rp[1] = 0;
- rp[2] = 0;
- rn[0] = -1;
- rn[1] = 0;
- rn[2] = 0;
- }
-}
-
-// ----------------------------------------------------------------------------
-manualContourModel * manualContourModel :: Clone() // virtual
-{
- manualContourModel * clone = new manualContourModel();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ----------------------------------------------------------------------------
-void manualContourModel::Open(FILE *ff) // virtual
-{
- char tmp[255];
- int i;
- int numberOfControlPoints;
- double x,y,z;
-
- fscanf(ff,"%s",tmp); // NumberOfControlPoints
- fscanf(ff,"%s",tmp); // ##
- numberOfControlPoints = atoi(tmp);
- for (i=0;i<numberOfControlPoints;i++)
- {
- fscanf(ff,"%s",tmp); // X
- x = atof(tmp);
- fscanf(ff,"%s",tmp); // Y
- y = atof(tmp);
- fscanf(ff,"%s",tmp); // Z
- z = atof(tmp);
- AddPoint(x,y,z);
- }
-}
-
-
-// ----------------------------------------------------------------------------
-int manualContourModel::GetTypeModel() //virtual
-{
- // 0 spline
- // 1 spline
- // 2 rectangle
- // 3 circle
- // 4 BullEye
- // 5 BullEyeSector
- // 6 Line
- return 1;
-}
-
-// ----------------------------------------------------------------------------
-void manualContourModel::Save(FILE *ff) // virtual
-{
- int i,size=_lstPoints.size();
- fprintf(ff,"TypeModel %d\n", GetTypeModel() );
- fprintf(ff,"NumberOfControlPoints %d\n",size);
- for (i=0;i<size;i++)
- {
- manualPoint *mp=_lstPoints[i];
- fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
- }
-}
-
-
-// ---------------------------------------------------------------------------
-
-void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
-{
- // Fathers object
- //XXXX::CopyAttributesTo(cloneObject);
-
- cloneObject->SetCloseContour( this->IfCloseContour() );
- int i, size = GetSizeLstPoints();
- for( i=0; i<size; i++ )
- {
- cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
- }
- cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
- cloneObject->SetCloseContour( _closeContour );
- cloneObject->UpdateSpline();
-}
-
-
-// ---------------------------------------------------------------------------
-void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
-{
- _lstPoints.push_back( theManualPoint );
-}
-
-std::vector<manualContourModel*> manualContourModel::ExploseModel( )
-{
- std::vector<manualContourModel*> lstTmp;
- lstTmp.push_back(this);
- return lstTmp;
-}
-
-
-// ---------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-//int manualViewPoint::range=1;
-
-
-manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
- _selected = false;
- _posibleSelected = false;
- _pts = NULL;
- _pd = NULL;
- _pointVtkActor = NULL;
- _bboxMapper = NULL;
- _wxvtkbaseview = wxvtkbaseview;
- _spc[0] = 1;
- _spc[1] = 1;
- _spc[2] = 1;
-
- _widthline = 1;
-
-}
-// ----------------------------------------------------------------------------
-manualViewPoint::~manualViewPoint(){
- DeleteVtkObjects();
-}
-
-// ----------------------------------------------------------------------------
-void manualViewPoint::SetWidthLine( double width)
-{
- _widthline = width;
-}
-
-// ----------------------------------------------------------------------------
-void manualViewPoint::SetSelected(bool selected){
- _selected=selected;
-}
-// ----------------------------------------------------------------------------
-void manualViewPoint::SetPosibleSelected(bool posibleSelected){
- _posibleSelected=posibleSelected;
-}
-// ----------------------------------------------------------------------------
-bool manualViewPoint::GetSelected(){
- return _selected;
-}
-// ----------------------------------------------------------------------------
-bool manualViewPoint::GetPosibleSelected(){
- return _posibleSelected;
-}
-// ----------------------------------------------------------------------------
-void manualViewPoint::DeleteVtkObjects(){
- if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
- if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
- if (_pts !=NULL) { _pts ->Delete(); }
- if (_pd !=NULL) { _pd ->Delete(); }
- _pointVtkActor = NULL;
- _bboxMapper = NULL;
- _pts = NULL;
- _pd = NULL;
-}
-
-
-
-// ----------------------------------------------------------------------------
-vtkActor* manualViewPoint::CreateVtkPointActor()
-{
- DeleteVtkObjects();
-
- _pts = vtkPoints::New();
- _pts->SetNumberOfPoints(8);
-
- _pts->SetPoint(0, -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);
- lines->InsertCellPoint(1);
- lines->InsertCellPoint(2);
- lines->InsertCellPoint(3);
- lines->InsertCellPoint(0);
- lines->InsertCellPoint(4);
- lines->InsertCellPoint(5);
- lines->InsertCellPoint(6);
- lines->InsertCellPoint(7);
- lines->InsertCellPoint(4);
- lines->InsertCellPoint(0);
- lines->InsertCellPoint(3);
- lines->InsertCellPoint(7);
- lines->InsertCellPoint(6);
- lines->InsertCellPoint(2);
- lines->InsertCellPoint(1);
- lines->InsertCellPoint(5);
-
- _pd = vtkPolyData::New();
- _pd->SetPoints( _pts );
- _pd->SetLines( lines );
-// lines->Delete(); //do not delete lines ??
-
- _pointVtkActor = vtkActor::New();
- _bboxMapper = vtkPolyDataMapper::New();
-
- _bboxMapper->SetInput(_pd);
-// _bboxMapper->ImmediateModeRenderingOn();
- _pointVtkActor->SetMapper(_bboxMapper);
-// _pointVtkActor->GetProperty()->BackfaceCullingOn();
- UpdateColorActor();
-// _pd->ComputeBounds();
-
- return _pointVtkActor;
-}
-// ----------------------------------------------------------------------------
-vtkActor* manualViewPoint::GetVtkActor(){
- return _pointVtkActor;
-}
-// ----------------------------------------------------------------------------
-void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
-{
-// double range=0.2; // i_range;
-// double range=(double)manualViewPoint::range;
-
- double range=i_range;
-
-//EED 27 sep 2006
- x = x * _spc[0];
- y = y * _spc[1];
- posZ = posZ * _spc[2];
-
- if (_pts!=NULL){
- _pts->SetPoint(0, x-range, y+range, posZ-range);
- _pts->SetPoint(1, x+range, y+range, posZ-range);
- _pts->SetPoint(2, x+range, y-range, posZ-range);
- _pts->SetPoint(3, x-range, y-range, posZ-range);
- _pts->SetPoint(4, x-range, y+range, posZ+range);
- _pts->SetPoint(5, x+range, y+range, posZ+range);
- _pts->SetPoint(6, x+range, y-range, posZ+range);
- _pts->SetPoint(7, x-range, y-range, posZ+range);
- }
-}
-
-
-// ----------------------------------------------------------------------------
-void manualViewPoint::UpdateColorActor()
-{
- if (_pointVtkActor!=NULL){
-//EED03
- _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
- _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
- if (_posibleSelected==true){
- _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
- }
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewPoint::GetSpacing(double spc[3])
-{
- spc[0] = _spc[0];
- spc[1] = _spc[1];
- spc[2] = _spc[2];
-}
-// ----------------------------------------------------------------------------
-void manualViewPoint::SetSpacing(double spc[3])
-{
- _spc[0] = spc[0];
- _spc[1] = spc[1];
- _spc[2] = spc[2];
-}
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualViewContour::manualViewContour()
-{
- _id_viewPoint_for_text = 0;
- _mesureScale = 1;
- _initialConoturModel = new manualContourModel();
-}
-// ----------------------------------------------------------------------------
-manualViewContour::~manualViewContour()
-{
- delete _initialConoturModel;
-}
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-manualViewContour * manualViewContour :: Clone()
-{
- manualViewContour * clone = new manualViewContour();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
-{
- // Call to Fathers object
- manualViewBaseContour::CopyAttributesTo(cloneObject);
-
- cloneObject->SetMesureScale(_mesureScale);
-}
-
-// ---------------------------------------------------------------------------
-
-int manualViewContour::GetType() // virtual
-{
- return 1;
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewContour::Save(FILE *pFile)
-{
- manualViewBaseContour::Save(pFile);
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewContour::Open(FILE *pFile)
-{
-}
-
-
-
-// ----------------------------------------------------------------------------
-void manualViewContour::RefreshContour() // virtual
-{
-
- int i,np,nps;
-
-//JSTG 25-02-08 --------------------
- //double t,delta, x,y,z;
- double x,y,z;
-//----------------------------------
-
- _manContModel->UpdateSpline();
- np = GetNumberOfPoints( );
- //nps = GetNumberOfPointsSpline();
- nps = _manContModel->GetNumberOfPointsSpline();
- //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
-
-
- if ( _pts!=NULL )
- {
- if (np>=2 )
- {
- for( i = 0; i < nps; i++ )
- {
-//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] );
-
-
- }// for
- }
- else
- {
- _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];
- char resultText[50];
- strcpy(resultText," ");
- if (size==2)
- {
- strcpy(resultText,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
- strcat(resultText,text);
- }
- if (size>2)
- {
- if (_manContModel->IfCloseContour()==true)
- {
- strcpy(resultText,"P= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
- strcat(resultText,text);
- gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
- strcat(resultText," A= ");
- strcat(resultText,text);
- } else {
- strcpy(resultText,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
- strcat(resultText,text);
- }
- }
-
- _textActor->SetInput(resultText);
-
- if (size>=1){
-
- int i;
- for (i=0; i<size; i++)
- {
- if (_lstViewPoints[i]->GetPosibleSelected()==true)
- {
- _id_viewPoint_for_text = i;
- }
- }
-
- int id = _id_viewPoint_for_text;
- double px = _manContModel->GetManualPoint(id)->GetX();
- double py = _manContModel->GetManualPoint(id)->GetY();
-
- //EED 27 sep 2006
- px=px*_spc[0];
- py=py*_spc[1];
-
- _textActor->SetPosition(px+GetRange()+1,py);
- }
-
- }
-}
-
-// ----------------------------------------------------------------------------
-bool manualViewContour::ifTouchContour(int x,int y,int z){
- bool result=false;
- double xx=x;
- double yy=y;
- double zz=z;
- double ppA[3];
- double ppB[3];
- double d1,d2,d3;
- TransfromeCoordViewWorld(xx,yy,zz);
-
-//EED 27 sep 2006
- xx = xx * _spc[0];
- yy = yy * _spc[1];
- zz = zz * _spc[2];
-
- unsigned int i, nps,nps_t;
- nps = _sizePointsContour;
-
- if (this->_manContModel->IfCloseContour()==true)
- {
- nps_t = nps;
- } else {
- nps_t = nps-1;
- }
-
-
- 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) )
- {
- result=true;
- i=nps;
- }
- }
-
- return result;
-}
-
-// ----------------------------------------------------------------------------
-void manualViewContour::DeletePoint(int id) // virtual
-{
- if (_lstViewPoints.size()>2)
- {
- manualViewBaseContour::DeletePoint( id );
- }
-}
-// ----------------------------------------------------------------------------
-
-void manualViewContour::ClearPoint(int id)
-{
- manualViewBaseContour::DeletePoint( id );
-}
-
-//-------------------------------------------------------------------
-void manualViewContour::SetMesureScale(double mesureScale)
-{
- _mesureScale = mesureScale;
-}
-//-------------------------------------------------------------------
-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)
-{
- manualPoint *mpOrigin = NULL;
- manualPoint *mpMoving = 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++ )
- {
- mpOrigin = _manContModel->GetManualPoint( i );
- mpMoving = _initialConoturModel->GetManualPoint(i);
- mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
- }
- UpdateViewPoints();
-}
-void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
-{
- manualPoint *mpOrigin = NULL;
-
- int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
- for ( i=0; i<manualPointsSZ; i++ )
- {
- mpOrigin = _manContModel->GetManualPoint( i );
- mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
- }
- UpdateViewPoints();
-}
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-manualView3VContour::manualView3VContour(int type)
-{
- _type=type;
-// JSTG 25-02-08 ------------------------------
- //_manContModel= new manualContourModel();
-//---------------------------------------------
-}
-// ----------------------------------------------------------------------------
-manualView3VContour::~manualView3VContour()
-{
-}
-
-
-
-// ----------------------------------------------------------------------------
-manualView3VContour * manualView3VContour :: Clone()
-{
- manualView3VContour * clone = new manualView3VContour( GetType() );
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
-{
- // Fathers object
- manualViewContour::CopyAttributesTo(cloneObject);
-}
-
-int manualView3VContour::GetType()
-{
- return _type;
-}
-
-// ----------------------------------------------------------------------------
-void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
-{
- if (_type==0)
- {
- x=-1000;
- }
- if (_type==1)
- {
- y=500;
- }
- if (_type==2)
- {
- z=-1000;
- }
-}
-// ----------------------------------------------------------------------------
-
-void manualView3VContour::RefreshContour() // virtula
-{
- manualViewContour::RefreshContour();
- int i;
- double pp[3];
-// JSTG 25-02-08 ----------------------------------------
- //int nps = GetNumberOfPointsSpline();
- int nps = _manContModel->GetNumberOfPointsSpline();
-//-------------------------------------------------------
- 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] );
- }
-
-}
-
-// ----------------------------------------------------------------------------
-
-void manualView3VContour::UpdateViewPoint(int id){ // virtual
- double x,y,z;
- manualPoint *mp = _manContModel->GetManualPoint(id);
- x=mp->GetX();
- y=mp->GetY();
- z=mp->GetZ();
-
- FilterCordinateXYZ(x,y,z);
- _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
-}
-
-// ----------------------------------------------------------------------------
-
-int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
-{
- int ii=-1;
- if (_manContModel!=NULL){
- double xx=x;
- double yy=y;
- double zz=z;
- TransfromeCoordViewWorld(xx,yy,zz,-1);
- ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
- }
- return ii;
-}
-
-// ----------------------------------------------------------------------------
-bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
- bool result=false;
- double xx=x;
- double yy=y;
- double zz=z;
- double ppA[3];
- double ppB[3];
- double d1,d2,d3;
- TransfromeCoordViewWorld(xx,yy,zz,-1);
-
-//EED 27 sep 2006
- xx = xx * _spc[0];
- yy = yy * _spc[1];
- zz = zz * _spc[2];
-
- unsigned int i, nps,nps_t;
- nps = _sizePointsContour;
- if (this->_manContModel->IfCloseContour()==true)
- {
- nps_t = nps;
- } else {
- nps_t = nps-1;
- }
- FilterCordinateXYZ(xx,yy,zz);
-
- for( i = 0; i < nps_t; i++ ) {
- _pts->GetPoint(i%nps, ppA);
- _pts->GetPoint((i+1)%nps, ppB);
- FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
- FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
- 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) ) {
- result=true;
- i=nps;
- }
- }
- return result;
-}
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualView3DContour::manualView3DContour()
-{
-}
-// ----------------------------------------------------------------------------
-manualView3DContour::~manualView3DContour()
-{
-}
-
-// ----------------------------------------------------------------------------
-manualView3DContour * manualView3DContour :: Clone()
-{
- manualView3DContour * clone = new manualView3DContour();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
-{
- // Fathers object
- manualViewContour::CopyAttributesTo(cloneObject);
-
- cloneObject->SetDimensions ( _w , _h , _d );
-}
-// ----------------------------------------------------------------------------
-void manualView3DContour::SetDimensions(int w, int h, int d)
-{
- _w = w;
- _h = h;
- _d = d;
-}
-// ----------------------------------------------------------------------------
-void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
-{
- X = _vtkmprbasedata->GetX();
- Y = _vtkmprbasedata->GetY();
- Z = _vtkmprbasedata->GetZ();
-}
-// ----------------------------------------------------------------------------
-void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
-{
- _vtkmprbasedata = vtkmprbasedata;
-}
-// ----------------------------------------------------------------------------
-int manualView3DContour::GetIdPoint2(int x, int y)
-{
- int id = -1;
- double p[3],pA[3],pB[3];
-
- double pickPoint[ 3 ], cameraPos[ 3 ];
- vtkPointPicker* picker = vtkPointPicker::New( );
- vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
- picker->Pick( x, y, 0.0, pRenderer );
- pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
- picker->GetPickPosition( pickPoint );
- picker->Delete( );
-
- UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
- utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
-
- if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
- {
- double dist,distMin=999999999;
- int i,size=this->_manContModel->GetSizeLstPoints();
- for (i=0;i<size;i++)
- {
- manualPoint *mp = this->_manContModel->GetManualPoint(i);
- p[0] = mp->GetX();
- p[1] = mp->GetY();
- p[2] = mp->GetZ();
- dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
- if ( (dist<=2*GetRange()) && (dist<distMin) )
- {
- distMin = dist;
- id = i;
- }
- }
- }
- return id;
-}
-// ----------------------------------------------------------------------------
-int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
-{
- SelectAllPossibleSelected(false);
- int id=GetIdPoint2(x,y);
- if (id!=-1)
- {
- SetPointPosibleSelected(id,true);
- }
- return id;
-}
-
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualViewBullEyeSector::manualViewBullEyeSector()
-{
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBullEyeSector::RefreshContour()
-{
-//EED004
- int i,nps;
- double x,y,z;
-//----------------------------------
-
- _manContModel->UpdateSpline();
- nps = _manContModel->GetNumberOfPointsSpline();
-
- if ( _pts!=NULL )
- {
- 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
- }
-
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-manualViewBullEye::manualViewBullEye()
-{
-}
-
-// ----------------------------------------------------------------------------
-manualViewBullEye::~manualViewBullEye()
-{
- // BullEye(s)
- int i,size=lstSectorBullEye.size();
- for (i=0;i<size;i++)
- {
- delete lstSectorBullEye[i];
- }
- lstSectorBullEye.clear();
-}
-
-
-// ----------------------------------------------------------------------------
-manualViewBullEye * manualViewBullEye :: Clone()
-{
- manualViewBullEye * clone = new manualViewBullEye();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
-{
- // Fathers object
- manualViewBaseContour::CopyAttributesTo(cloneObject);
-}
-
-
-// ----------------------------------------------------------------------------
-int manualViewBullEye::GetType() // virtual
-{
- return 4;
-}
-
-
-// ----------------------------------------------------------------------------
-void manualViewBullEye::RefreshContour() // virtual
-{
- // External Rectangle
- manualViewRoi::RefreshContour();
-
- _manContModel->UpdateSpline();
- int np = GetNumberOfPoints( );
- // Refres sectors of BullEye(s)
-
- if (np>=2 )
- {
- int i,size = lstSectorBullEye.size();
- for (i=0;i<size;i++)
- {
- lstSectorBullEye[i]->RefreshContour();
- } // for
- } // if
-
-
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBullEye::ConstructVTKObjects() // virtual
-{
- manualViewRoi::ConstructVTKObjects();
-
- double spc[3];
- this->GetSpacing(spc);
- manualViewBullEyeSector *mvbc;
- manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
- int i,size = mcmbe->GetSizeOfSectorLst();
- for ( i=0 ; i<size ; i++ )
- {
- mvbc = new manualViewBullEyeSector();
- mvbc->SetModel( mcmbe->GetModelSector(i) );
- mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
- mvbc->SetRange( 2 );
- mvbc->SetZ( 1000 );
- mvbc->SetSpacing(spc);
- mvbc->SetColorNormalContour(1, 0, 0);
-// mvbc->SetColorEditContour(0.5, 0.5, 0.5);
-// mvbc->SetColorSelectContour(1, 0.8, 0);
- mvbc->SetWidthLine( this->GetWidthLine() );
-//EED004
- mvbc->ConstructVTKObjects();
- lstSectorBullEye.push_back( mvbc );
- }
-
-
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBullEye::AddSplineActor() // virtual
-{
- manualViewRoi::AddSplineActor();
- int i,size=lstSectorBullEye.size();
- for (i=0;i<size;i++)
- {
- lstSectorBullEye[i]->AddSplineActor();
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBullEye::RemoveSplineActor() // virtual
-{
- manualViewRoi::RemoveSplineActor();
- int i,size=lstSectorBullEye.size();
- for (i=0;i<size;i++)
- {
- lstSectorBullEye[i]->RemoveSplineActor();
- }
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualViewRoi::manualViewRoi()
-{
- _sizePointsContour=5;
-}
-// ----------------------------------------------------------------------------
-manualViewRoi::~manualViewRoi()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualViewRoi * manualViewRoi :: Clone()
-{
- manualViewRoi * clone = new manualViewRoi();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
-{
- // Fathers object
- manualViewBaseContour::CopyAttributesTo(cloneObject);
-}
-
-// ----------------------------------------------------------------------------
-void manualViewRoi::RefreshContour() // virtual
-{
- unsigned int i,ii, np;
- np = GetNumberOfPoints( );
-//EED01
- if ( np > 0)
- {
- if (np>=2)
- {
- manualPoint *mp;
- for( i = 0; i < np+1; i++ ) {
- ii=i%np;
- mp = _manContModel->GetManualPoint(ii);
-
- //EEDx6
- double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
- // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
- // 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] );
- } // rof
-
- } else {
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
- } // if
- }
-}
-
-// ----------------------------------------------------------------------------
-int manualViewRoi::GetType() // virtual
-{
- return 2;
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
-{
- double pp[3];
- manualPoint *mp;
- unsigned int i;
-
- minX=99999;
- minY=99999;
- maxX=-99999;
- maxY=-99999;
-
- unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
-
- for( i = 0; i < size; i++ )
- {
-
- mp=_manContModel->GetManualPoint(i);
- pp[0]=mp->GetX();
- pp[1]=mp->GetY();
-
- // min X
- if (pp[0]<minX)
- {
- minX=pp[0];
- }
- //min Y
- if (pp[1]<minY)
- {
- minY=pp[1];
- }
- //max X
- if (pp[0]>maxX)
- {
- maxX=pp[0];
- }
- // max Y
- if (pp[1]>maxY)
- {
- maxY=pp[1];
- }
- }
-
- if ( size<1 )
- {
- minX=0;
- maxX=0;
- minY=0;
- maxY=0;
- }
-}
-
-// ----------------------------------------------------------------------------
-
-
-bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
-{
- bool result=false;
- double px1=99999,py1=99999,px2=-99999,py2=-99999;
-
- GetMinMax(px1,py1, px2, py2);
-
- double xx=x;
- double yy=y;
- double zz=z;
- TransfromeCoordViewWorld(xx,yy,zz);
-
- bool ok1=false;
- bool ok2=false;
- double ddx=GetRange();
- double ddy=GetRange();
-
- if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
- {
- ok1=true;
- }
-
- if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
- {
- ok2=true;
- }
-
- if ((ok1==true) && (ok2==false))
- {
- result=true;
- }
-
- return result;
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewRoi::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()==4){
- 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();
-
- 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();
- }
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewRoi::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]);
-
- 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);
-
-}
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// EED08
-
-manualViewCircle::manualViewCircle()
-{
-// _sizePointsContour=5; // default 100
-}
-// ----------------------------------------------------------------------------
-manualViewCircle::~manualViewCircle()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualViewCircle * manualViewCircle :: Clone()
-{
- manualViewCircle * clone = new manualViewCircle();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
-{
- // Fathers object
- manualViewBaseContour::CopyAttributesTo(cloneObject);
-}
-
-
-// ----------------------------------------------------------------------------
-/*
-void manualViewCircle::RefreshContour(){ // virtual
-
- manualPoint *mpA,*mpB;
- unsigned int i, np,nps;
- double angle,radio;
- double difX,difY;
- double XX,YY,ZZ;
- np = GetNumberOfPoints( );
- nps = _manContModel->GetNumberOfPointsSpline();
- double deltaAngle=(3.14159265*2)/(nps-1);
- if ( np > 0)
- {
- if (np==2)
- {
- mpA = _manContModel->GetManualPoint(0);
- mpB = _manContModel->GetManualPoint(1);
- difX = mpA->GetX() - mpB->GetX();
- difY = mpA->GetY() - mpB->GetY();
- radio = sqrt( difX*difX + difY*difY );
- manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
- manContModelCir->SetRadio(radio);
-
- for( i = 0; i < nps; i++ ) {
- manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
-// angle = deltaAngle*i;
-// 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] );
- } // rof
- } else {
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
- } // if
- }
-}
-*/
-
-// ----------------------------------------------------------------------------
-int manualViewCircle::GetType() // virtual
-{
- return 3;
-}
-
-// ----------------------------------------------------------------------------
-
-void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
-{
- manualPoint *mpA,*mpB;
- unsigned int np;
- double radio;
- double difX,difY;
- np = GetNumberOfPoints( );
- if (np==2)
- {
- mpA = _manContModel->GetManualPoint(0);
- mpB = _manContModel->GetManualPoint(1);
- difX = mpA->GetX() - mpB->GetX();
- difY = mpA->GetY() - mpB->GetY();
- radio = sqrt( difX*difX + difY*difY );
- minX=mpA->GetX()-radio;
- minY=mpA->GetY()-radio;
- maxX=mpA->GetX()+radio;
- maxY=mpA->GetY()+radio;
- } else {
- minX=0;
- maxX=0;
- minY=0;
- maxY=0;
- }
-}
-
-/*
-// ----------------------------------------------------------------------------
-bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
-{
- bool result=false;
- double px1=99999,py1=99999,px2=-9999,py2=-99999;
-
- GetMinMax(px1,py1, px2, py2);
-
- double xx=x;
- double yy=y;
- double zz=z;
- TransfromeCoordViewWorld(xx,yy,zz);
-
- bool ok1=false;
- bool ok2=false;
- double ddx=GetRange();
- double ddy=GetRange();
-
- if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
- {
- ok1=true;
- }
-
- if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
- {
- ok2=true;
- }
-
- if ((ok1==true) && (ok2==false))
- {
- result=true;
- }
-
- return result;
-}
-*/
-
-// ----------------------------------------------------------------------------
-
-void manualViewCircle::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();
-/*
- 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();
-*/
- }
-}
-
-
-// ----------------------------------------------------------------------------
-void manualViewCircle::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]);
-
-// 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);
-
-}
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// 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;
- _textActor = NULL;
- _manContModel = NULL;
- _wxvtkbaseview = NULL;
- _selected = false;
- _posibleSelected = false;
- _viewControlPoints = false;
- _pts = NULL;
- _pd = NULL;
- _contourVtkActor = NULL;
- _bboxMapper = NULL;
- _range = 1;
- _sizePointsContour = 100;
- _spc[0] = 1;
- _spc[1] = 1;
- _spc[2] = 1;
-
- _coulorEdit_r = 1;
- _coulorEdit_g = 1;
- _coulorEdit_b = 0;
-
- _coulorNormal_r = 1;
- _coulorNormal_g = 0;
- _coulorNormal_b = 1;
-
- _coulorSelection_r = 0;
- _coulorSelection_g = 1;
- _coulorSelection_b = 0;
-
- _widthline = 1;
-
-}
-// ----------------------------------------------------------------------------
-manualViewBaseContour::~manualViewBaseContour()
-{
- int i,size=_lstViewPoints.size();
- for (i=0;i<size; i++){
- delete _lstViewPoints[i];
- }
- _lstViewPoints.clear();
-}
-// ----------------------------------------------------------------------------
-
-
-int manualViewBaseContour::GetType() // virtual
-{
-// Information...
-//int manualViewBaseContour::GetType() 0;
-//int manualViewContour::GetType() 1;
-//int manualViewRoi::GetType() 2;
-//int manualViewCircle::GetType() 3;
-//int manualViewStar::GetType() 4;
-//int manualViewLine::GetType() 6;
-
-
- return 0;
-}
-// ----------------------------------------------------------------------------
-
-void manualViewBaseContour::Save(FILE *pFile)
-{
- fprintf(pFile,"TypeView %d\n", GetType() );
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::Open(FILE *pFile)
-{
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
-{
- _viewControlPoints = ifControlPoints;
- /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
- //Adding the spline
- AddSplineActor();
-
- AddTextActor();
- //Adding each control point
- if( ifControlPoints )
- AddControlPoints();
- RefreshContour();
- Refresh();
-}
-// ---------------------------------------------------------------------------
-
-void manualViewBaseContour :: RemoveCompleteContourActor()
-{
- /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
- //Removing the spline
- RemoveSplineActor();
- RemoveTextActor();
-
- //Removing each point
- RemoveControlPoints();
- RefreshContour();
- Refresh();
-}
-// ---------------------------------------------------------------------------
-manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
-{
- manualViewBaseContour * clone = new manualViewBaseContour();
- CopyAttributesTo(clone);
- return clone;
-
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
-{
- // Fathers object
- //XXXX::CopyAttributesTo(cloneObject);
-
- cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
- cloneObject-> SetSelected( this->GetSelected() );
- cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
- cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
- cloneObject-> SetRange( this->GetRange() );
- cloneObject-> SetZ( this->GetZ() );
- 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 );
-
- int i, size = _lstViewPoints.size();
- for ( i=0; i<size; i++ )
- {
- cloneObject->AddPoint( );
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddSplineActor()
-{
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
- if (_contourVtkActor!=NULL)
- theRenderer->AddActor( _contourVtkActor );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour :: RemoveSplineActor() // virtual
-{
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
- if (_contourVtkActor!=NULL)
- theRenderer->RemoveActor( _contourVtkActor );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour :: RemoveControlPoints()
-{
- if (_wxvtkbaseview!=NULL){
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
- int i,size=_lstViewPoints.size();
- for (i=0;i<size; i++)
- {
- vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
- theRenderer->RemoveActor( pointActor );
- } // for
- } // if
- SetIfViewControlPoints( false );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::AddControlPoints()
-{
- vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
- SetIfViewControlPoints( true );
- if( _viewControlPoints )
- {
- int i,size=_lstViewPoints.size();
- for (i=0;i<size; i++)
- {
- vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
- theRenderer->AddActor( pointActor );
- }
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::AddTextActor()
-{
- _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::RemoveTextActor()
-{
- _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeleteVtkObjects()
-{
- if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
- if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
- if ( _pts != NULL ) { _pts -> Delete(); }
- if ( _pd != NULL ) { _pd -> Delete(); }
- _contourVtkActor = NULL;
- _bboxMapper = NULL;
- _pts = NULL;
- _pd = NULL;
-}
-
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetWidthLine(double width)
-{
- _widthline = width;
- this->UpdateColorActor();
-
- // for the control points
- int id, size = _lstViewPoints.size();
- for( id=0; id<size; id++)
- {
- this->_lstViewPoints[id]->SetWidthLine(_widthline);
- }
-
-}
-
-// ----------------------------------------------------------------------------
-double manualViewBaseContour::GetWidthLine()
-{
- return _widthline;
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::ConstructVTKObjects()
-{
-//JSTG 29-02-08 -----------------------------------------------
- //int i , nps = _sizePointsContour;
- int i;
- int nps = _manContModel->GetNumberOfPointsSpline();
-//-------------------------------------------------------------
- DeleteVtkObjects();
- _pts = vtkPoints::New();
- _pts->SetNumberOfPoints(nps);
-
- for (i=0 ; i<nps ; i++){
- _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 );
-
-
- vtkCellArray *lines = vtkCellArray::New();
- lines->InsertNextCell( nps /* +1 */ );
- for ( i=0 ; i<nps+1 ; i++ ){
- lines->InsertCellPoint(i % nps );
- }
-
- _pd = vtkPolyData::New();
- _pd->SetPoints( _pts );
- _pd->SetLines( lines );
- lines->Delete(); //do not delete lines ??
-
- _contourVtkActor = vtkActor::New();
- _bboxMapper = vtkPolyDataMapper::New();
- _bboxMapper->ScalarVisibilityOff( );
-
- _bboxMapper->SetInput(_pd);
- _bboxMapper->ImmediateModeRenderingOn();
- _contourVtkActor->SetMapper(_bboxMapper);
- _contourVtkActor->GetProperty()->BackfaceCullingOff();
-
- UpdateColorActor();
-
- _pd->ComputeBounds();
-
- // Text
- _textActor = vtkTextActor::New();
-// _textActor->SetDisplayPosition(200, 200);
- _textActor->SetInput("00");
- // Set coordinates to match the old vtkScaledTextActor default value
-// _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
-// _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
- _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
-// _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
-
- vtkTextProperty *tprop = _textActor->GetTextProperty();
- tprop->SetFontSize(14);
- tprop->SetFontFamilyToArial();
- tprop->SetColor(0, 0, 1);
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::CreateNewContour()
-{
- ConstructVTKObjects();
- /*
- _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
- _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
- AddCompleteContourActor();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UpdateViewPoint(int id) // virtual
-{
- manualPoint *mp = _manContModel->GetManualPoint(id);
-
-//EEDx6
- double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
-// wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
-// wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
-
- _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UpdateViewPoints()
-{
- int id, size = _lstViewPoints.size();
- for( id=0; id<size; id++)
- {
- UpdateViewPoint( id );
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::AddPoint()
-{
- manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
- AddPoint( mvp );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
-{
- _lstViewPoints.push_back( manualViewPoint );
-
- // EED 3 oct 2006
- manualViewPoint->SetSpacing(_spc);
-
- vtkActor *actor = manualViewPoint->CreateVtkPointActor();
- _wxvtkbaseview->GetRenderer()->AddActor( actor );
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::InsertPoint(int id)
-{
- manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
-
-// EED 3 oct 2006
- mvp->SetSpacing(_spc);
-
- std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
- _lstViewPoints.insert(itNum,mvp);
- _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeleteContour()
-{
- RemoveCompleteContourActor();
- /*if (_contourVtkActor!=NULL){
- _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
- }*/
- DeleteVtkObjects();
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- manualViewBaseContour::DeletePoint(0);
- }
- Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeletePoint(int id) // virtual
-{
- int size=_lstViewPoints.size();
- if ( (id>=0) && (id<size) ){
- manualViewPoint *mvp =_lstViewPoints[id];
-//EED ups1
-// _handlePicker->DeletePickList(mvp->GetVtkActor());
- _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
- std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
- _lstViewPoints.erase(itNum);
- delete mvp;
- Refresh();
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeletePoint(int x, int y, int z)
-{
- int id=GetIdPoint(x,y,z);
- if (id!=-1){
- DeletePoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetSelected(bool selected)
-{
- _selected=selected;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
-{
- _posibleSelected=posibleSelected;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour::GetEditable()
-{
- return *_editable;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetEditable( bool * condition )
-{
- _editable = condition;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour::GetSelected()
-{
- return _selected;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour::GetPosibleSelected()
-{
- return _posibleSelected;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::DeleteSelectedPoints()
-{
- int i,size=_lstViewPoints.size();
- for (i=size-1;i>=0;i--){
- if (_lstViewPoints[i]->GetSelected()==true){
- DeletePoint(i);
- }
- }
- Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SelectPoint(int i, bool select)
-{
- _lstViewPoints[i]->SetSelected(select);
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SelectLstPoints()
-{
- // ToDo
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SelectAllPoints(bool select)
-{
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- SelectPoint(i,select);
- }
-}
-//-----------------------------------------------------------------------------
-void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
-{
- _viewControlPoints = ifShow;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour:: GetIfViewControlPoints()
-{
- return _viewControlPoints;
-}
-
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
-{
- _lstViewPoints[id]->SetPosibleSelected(select);
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetPointSelected(int id,bool select)
-{
- _lstViewPoints[id]->SetSelected(select);
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SelectAllPossibleSelected(bool select)
-{
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- SetPointPosibleSelected(i,select);
- }
-}
-// ----------------------------------------------------------------------------
-int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
-{
- SelectAllPossibleSelected(false);
-
- int id = GetIdPoint(x,y,z);
- if (id!=-1)
- {
- SetPointPosibleSelected(id,true);
- }
- return id;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
-{
- bool result=false;
- SetPosibleSelected(result);
- int id = GetIdPoint(x,y,z);
- if( !GetEditable() && !_selected && id!= -1)
- {
- result=true;
- SetPosibleSelected(result);
- }
- else
- {
- if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
- {
- if (ifTouchContour(x,y,z)==true)
- {
- result=true;
- SetPosibleSelected(result);
- }
- }
-
- if (GetEditable()==false)
- {
- if (ifTouchContour(x,y,z)==true)
- {
- result=true;
- SetPosibleSelected(result);
- }
- }
-
-
- }
- return result;
-}
-// ----------------------------------------------------------------------------
-bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
-{
- return false;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UnSelectPoint(int i){
- _lstViewPoints[i]->SetSelected(false);
- Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UnSelectLstPoints(){
- // ToDo
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UnSelectAllPoints(){
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- UnSelectPoint(i);
- }
- Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetModel(manualContourModel *manContModel){
- _manContModel=manContModel;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
- _wxvtkbaseview = wxvtkbaseview;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::RefreshContour() // Virtual
-{
-}
-// ----------------------------------------------------------------------------
-double* manualViewBaseContour::GetVectorPointsXManualContour(){
- double pp[3];
- int i,size = _sizePointsContour;
- double *vx = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
- _pts->GetPoint(i,pp);
- vx[i]=pp[0];
- }
- return vx;
-}
-// ----------------------------------------------------------------------------
-double* manualViewBaseContour::GetVectorPointsYManualContour()
-{
- double pp[3];
- int i,size = _sizePointsContour;
- double *vy = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
- _pts->GetPoint(i,pp);
- vy[i]=pp[1];
- }
- return vy;
-}
-// ----------------------------------------------------------------------------
-double* manualViewBaseContour::GetVectorPointsZManualContour()
-{
- double pp[3];
- int i,size = _sizePointsContour;
- double *vz = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
- _pts->GetPoint(i,pp);
- vz[i]=pp[2];
- }
- return vz;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::Refresh() // virtual
-{
- if (_contourVtkActor!=NULL){
- RefreshContour();
- }
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- UpdateViewPoint(i);
- _lstViewPoints[i]->UpdateColorActor();
- }
- UpdateColorActor();
-
- if (_show_text==true)
- {
- RefreshText();
- }
-
- vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
- if (vri==NULL)
- {
- _wxvtkbaseview->GetRenWin()->Render();
- }
-
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::RefreshText() // virtual
-{
- if( _textActor!=NULL)
- _textActor -> SetInput("00");
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
-{
- _coulorNormal_r = r;
- _coulorNormal_g = g;
- _coulorNormal_b = b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
-{
- r = _coulorNormal_r;
- g = _coulorNormal_g;
- b = _coulorNormal_b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
-{
- _coulorEdit_r = r;
- _coulorEdit_g = g;
- _coulorEdit_b = b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
-{
- r = _coulorEdit_r;
- g = _coulorEdit_g;
- b = _coulorEdit_b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
-{
- _coulorSelection_r = r;
- _coulorSelection_g = g;
- _coulorSelection_b = b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
-{
- r = _coulorSelection_r;
- g = _coulorSelection_g;
- b = _coulorSelection_b;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::UpdateColorActor()
-{
- if (_contourVtkActor!=NULL)
- {
- _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
- _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
- if (_posibleSelected || (_posibleSelected && GetEditable() ) )
- {
- _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
- }
- if( _selected )
- {
- _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
- }
- }
-}
-// ----------------------------------------------------------------------------
-int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
-{
- int ii = -1;
- if (_manContModel!=NULL){
- double xx = x;
- double yy = y;
- double zz = z;
- TransfromeCoordViewWorld(xx,yy,zz);
- ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
- }
- return ii;
-}
-
-// ----------------------------------------------------------------------------
-
-
-int manualViewBaseContour::GetNumberOfPoints()
-{
- return _lstViewPoints.size();
-}
-
-// ----------------------------------------------------------------------------
-
-//JSTG 25-02-08 ---------------------------------------------------------------
-/*int manualViewBaseContour::GetNumberOfPointsSpline()
-{
- return _sizePointsContour;
-}*/
-//----------------------------------------------------------------------------
-
-//JSTG 25-02-08 ---------------------------------------------------------------
-/*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
-{
- _sizePointsContour = size;
-}*/
-//----------------------------------------------------------------------------
-// virtual
-void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
-{
- _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
-
-
-//EED 27 sep 2007
-// //EEDx6
-// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
-// wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
-
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetRange(int range)
-{
- _range=range;
-}
-// ----------------------------------------------------------------------------
-int manualViewBaseContour::GetRange()
-{
- return _range;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetZ(int z)
-{
-// _Z=z;
-}
-// ----------------------------------------------------------------------------
-int manualViewBaseContour::GetZ()
-{
-// return _Z;
- return 0;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
-{
-
-}
-// ----------------------------------------------------------------------------
-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;
- int i;
- int size=_manContModel->GetSizeLstPoints();
- minX=99999;
- minY=99999;
- maxX=-99999;
- maxY=-99999;
- bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
- if ( ifFindZ )
- {
- minZ=99999;
- maxZ=-99999;
- }
- 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)
- {
- minX=pp[0];
- }
- //min Y
- if (pp[1]<minY)
- {
- minY=pp[1];
- }
- //max X
- if (pp[0]>maxX)
- {
- maxX=pp[0];
- }
- // max Y
- if (pp[1]>maxY)
- {
- maxY=pp[1];
- }
- if ( ifFindZ )
- {
- // min Z
- if (pp[2]<minZ)
- {
- minZ=pp[2];
- }
- // max Z
- if (pp[2]>maxZ)
- {
- maxZ=pp[2];
- }
- }
- }
- if ( size<1 )
- {
- minX = 0;
- maxX = 0;
-
- minY = 0;
- maxY = 0;
-
- minZ = 0;
- maxZ = 0;
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::ClearContour()
-{
- if (_contourVtkActor!=NULL){
- _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
- }
- DeleteVtkObjects();
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- ClearPoint(0);
- }
- Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::ClearPoint(int id)
-{
- DeletePoint(id);
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetVisible(bool ok)
-{
- double opacity;
- if (ok==true)
- {
- opacity=1;
- } else {
- opacity=0.5;
- }
- vtkActor *actor;
- int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
- actor = _lstViewPoints[i]->GetVtkActor();
- actor->GetProperty()->SetOpacity( opacity );
- }
- _contourVtkActor->GetProperty()->SetOpacity( opacity );
- _textActor->GetProperty()->SetOpacity( opacity );
- _textActor->SetInput("00");
-
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetShowText(bool ok)
-{
- _show_text = ok;
- if (_show_text==false)
- {
- _textActor->SetInput("00");
- }
-}
-// ----------------------------------------------------------------------------
-wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
-{
- return this->_wxvtkbaseview;
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::GetSpacing(double spc[3])
-{
- spc[0] = _spc[0];
- spc[1] = _spc[1];
- spc[2] = _spc[2];
-}
-// ----------------------------------------------------------------------------
-void manualViewBaseContour::SetSpacing(double spc[3])
-{
- _spc[0] = spc[0];
- _spc[1] = spc[1];
- _spc[2] = spc[2];
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// _type = 0 Sagital
-// _type = 1 Coronal
-// _type = 2 Axial
-// _type = -1 View 3D
-
-manualContour3VControler::manualContour3VControler(int type)
-{
- _type=type;
-
-//EEDhh
-// _manViewBaseCont1 = NULL;
-// _manViewBaseCont2 = NULL;
-// _manViewBaseCont3 = NULL;
-}
-//----------------------------------------------------------------------------
-manualContour3VControler::~manualContour3VControler()
-{
-}
-
-// ----------------------------------------------------------------------------
-manualContour3VControler * manualContour3VControler :: Clone() // virtual
-{
- manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
-{
- // Fathers object
- manualContourControler::CopyAttributesTo(cloneObject);
-
- cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
-
- // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
-
-}
-// ----------------------------------------------------------------------------
-int manualContour3VControler::GetType()
-{
- return _type;
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::AddPoint_Others()
-{
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->AddPoint();
- }
-
-// EEDhh
-// if (_manViewBaseCont1!=NULL){
-// _manViewBaseCont1->AddPoint();
-// _manViewBaseCont2->AddPoint();
-// _manViewBaseCont3->AddPoint();
-// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-// }
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
-{
-
- z=(int)_vtkmprbasedata->GetZ();
- if (GetManualContourModel()!=NULL){
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
-
- if (_type==0)
- {
- xx=_vtkmprbasedata->GetX();
- }
-
- if (_type==1)
- {
- yy=_vtkmprbasedata->GetY();
- }
-
-
- /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
- GetManualViewBaseContour()->AddPoint();
- AddPoint_Others();
-
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::InsertPoint_Others(int id)
-{
-
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->InsertPoint(id);
- }
-
-/*EEDhh
- if (_manViewBaseCont1!=NULL){
- _manViewBaseCont1->InsertPoint(id);
- _manViewBaseCont2->InsertPoint(id);
- _manViewBaseCont3->InsertPoint(id);
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-*/
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::InsertPoint(int x, int y, int z)
-{
- int id=-1;
- if (GetManualContourModel()!=NULL){
- if (GetManualContourModel()->GetSizeLstPoints()>1){
- z=(int)_vtkmprbasedata->GetZ();
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
- if (_type==0)
- {
- xx=_vtkmprbasedata->GetX();
- }
-
- if (_type==1)
- {
- yy=_vtkmprbasedata->GetY();
- }
-
- id = GetManualContourModel()->InsertPoint(xx,yy,zz);
-
- GetManualViewBaseContour()->InsertPoint(id);
- InsertPoint_Others(0);
-
- } else {
- AddPoint(x,y,z);
- }
- }
-}
-// ----------------------------------------------------------------------------
-
-// EEDhh
-/*
-void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
- manualViewBaseContour *manViewBaseCont0,
- manualViewBaseContour *manViewBaseCont1,
- manualViewBaseContour *manViewBaseCont2,
- manualViewBaseContour *manViewBaseCont3)
-{
- manualContourControler::SetModelView(manContModel,manViewBaseCont0);
- _manViewBaseCont1 = manViewBaseCont1;
- _manViewBaseCont2 = manViewBaseCont2;
- _manViewBaseCont3 = manViewBaseCont3;
-}
-*/
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
-{
- _lstManualViewBaseContour.push_back( manViewBaseCont );
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
-{
- _vtkmprbasedata=vtkmprbasedata;
-}
-// ----------------------------------------------------------------------------
-vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
-{
- return _vtkmprbasedata;
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
-{
- z=(int)_vtkmprbasedata->GetZ();
- if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
-
- if (_type==0)
- {
- xx=_vtkmprbasedata->GetX();
- }
- if (_type==1)
- {
- yy=_vtkmprbasedata->GetY();
- }
-
- manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
- mp->SetPoint(xx,yy,zz);
-
- }
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::DeleteActualMousePoint_Others(int id)
-{
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->DeletePoint(id);
- mvbc->Refresh();
- }
-
-/*
- if (_manViewBaseCont1!=NULL){
- _manViewBaseCont1->DeletePoint(id);
- _manViewBaseCont2->DeletePoint(id);
- _manViewBaseCont3->DeletePoint(id);
-
- _manViewBaseCont1->Refresh();
- _manViewBaseCont2->Refresh();
- _manViewBaseCont3->Refresh();
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-*/
- 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 );
- DeleteActualMousePoint_Others( id );
- }
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::MouseMove_Others(int id) // virtual
-{
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->SelectAllPossibleSelected(false);
- if (id!=-1)
- {
- mvbc->SetPointPosibleSelected(id,true);
- }
- mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
- mvbc->Refresh();
- }
-
-// EEDhh
-/*
- if (_manViewBaseCont1!=NULL){
- _manViewBaseCont1->SelectAllPossibleSelected(false);
- _manViewBaseCont2->SelectAllPossibleSelected(false);
- _manViewBaseCont3->SelectAllPossibleSelected(false);
- 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->Refresh();
- _manViewBaseCont2->Refresh();
- _manViewBaseCont3->Refresh();
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-*/
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::MouseMove(int x, int y) // virtual
-{
- manualContourControler::MouseMove( x , y );
- int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
- MouseMove_Others( id );
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::OnChar_Others()
-{
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->Refresh();
- }
-// EEDhh
-/*
- _manViewBaseCont1->Refresh();
- _manViewBaseCont2->Refresh();
- _manViewBaseCont3->Refresh();
-*/
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-}
-// ----------------------------------------------------------------------------
-bool manualContour3VControler::OnChar()
-{
- manualContourControler::OnChar();
- OnChar_Others();
- return true;
-}
-// ----------------------------------------------------------------------------
-void manualContour3VControler::ResetContour() // virtual
-{
- manualContourControler::ResetContour();
- ResetContour_Others();
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3VControler::ResetContour_Others()
-{
- manualViewBaseContour *mvbc;
- int i,size=this->_lstManualViewBaseContour.size();
- for ( i = 0 ; i < size ; i++ )
- {
- mvbc = _lstManualViewBaseContour[i];
- mvbc->DeleteContour();
- mvbc->CreateNewContour();
- }
-
-// EEDhh
-/*
- _manViewBaseCont1->DeleteContour();
- _manViewBaseCont2->DeleteContour();
- _manViewBaseCont3->DeleteContour();
- _manViewBaseCont1->CreateNewContour();
- _manViewBaseCont2->CreateNewContour();
- _manViewBaseCont3->CreateNewContour();
-*/
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualContour3DControler::manualContour3DControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualContour3DControler::~manualContour3DControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualContour3DControler * manualContour3DControler :: Clone() // virtual
-{
- manualContour3DControler * clone = new manualContour3DControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
-{
- // Fathers object
- manualContourControler::CopyAttributesTo(cloneObject);
-
- cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
-}
-
-// ----------------------------------------------------------------------------
-bool manualContour3DControler::OnLeftButtonDown()
-{
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
- MouseClickLeft(X,Y);
- return true;
-}
-// ----------------------------------------------------------------------------
-void manualContour3DControler::ResetOrientationPlane()
-{
- double p[3],rp[3],rn[3];
- p[0] = this->GetVtkMPRBaseData()->GetX( );
- p[1] = this->GetVtkMPRBaseData()->GetY( );
- p[2] = this->GetVtkMPRBaseData()->GetZ( );
- this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
- this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
-}
-// ----------------------------------------------------------------------------
-void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
-{
- manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
- int id=manualview3Dcontour->GetIdPoint2(x,y);
- if ( (GetState()==0) && (id!=-1) )
- {
- manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
-
- this->GetVtkMPRBaseData()->SetX( mp->GetX() );
- this->GetVtkMPRBaseData()->SetY( mp->GetY() );
- this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
- ResetOrientationPlane();
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-
-
- manualContourControler::MouseClickLeft(x,y);
-
-}
-// ----------------------------------------------------------------------------
-bool manualContour3DControler::OnChar()
-{
- bool ok=true;
- manualContourControler::OnChar();
- char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
- if (keyCode==32){
- ok=false;
- ResetOrientationPlane();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
- return ok;
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
-{
- _vtkmprbasedata=vtkmprbasedata;
-}
-// ----------------------------------------------------------------------------
-vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
-{
- return _vtkmprbasedata;
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
-{
- manualContourControler::InsertPoint( x, y, z );
- ResetOrientationPlane();
-}
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-manualContour3V3DControler::manualContour3V3DControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualContour3V3DControler::~manualContour3V3DControler()
-{
-}
-
-// ----------------------------------------------------------------------------
-manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
-{
- manualContour3V3DControler * clone = new manualContour3V3DControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
-{
- // Fathers object
- manualContour3DControler::CopyAttributesTo(cloneObject);
-
- cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
-}
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
-{
- manualContour3DControler::InsertPoint( x, y, z );
- _manualcontour3Vcontroler->InsertPoint_Others(0);
-}
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::AddPoint( int x, int y, int z )
-{
- manualContour3DControler::AddPoint( x, y, z );
- _manualcontour3Vcontroler->AddPoint_Others();
-}
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
-{
- int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
- manualContour3DControler::DeleteActualMousePoint( x , y );
- _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
-}
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::MouseMove( int x, int y )
-{
- int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
- if ((this->GetState()!=7) && (ss!=1)){
- manualContour3DControler::MouseMove( x , y );
- int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
- _manualcontour3Vcontroler->MouseMove_Others(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
-{
- _manualcontour3Vcontroler = manualcontour3Vcontroler;
-}
-// ----------------------------------------------------------------------------
-manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
-{
- return _manualcontour3Vcontroler;
-}
-// ----------------------------------------------------------------------------
-bool manualContour3V3DControler::OnChar() // virtual
-{
- if (manualContour3DControler::OnChar()==false )
- {
- _manualcontour3Vcontroler->OnChar_Others();
- }
- return true;
-}
-
-// ----------------------------------------------------------------------------
-void manualContour3V3DControler::ResetContour() // virtual
-{
- manualContourControler::ResetContour();
- _manualcontour3Vcontroler->ResetContour_Others();
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// _state = 0 // ..nothing..
-// _state = 1 // move with add point
-// _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 * clone = new manualContourControler();
- CopyAttributesTo(clone);
- return clone;
-}
-// ---------------------------------------------------------------------------
-void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
-{
- // Fathers object
- manualContourBaseControler::CopyAttributesTo(cloneObject);
- cloneObject->SetEasyCreation( this->GetEasyCreation() );
-}
-
-// ----------------------------------------------------------------------------
-void manualContourControler::Configure() //virtual
-{
- // this->_manContModel->SetNumberOfPointsSpline(100);
-}
-
-// ----------------------------------------------------------------------------
-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(); // JPRx
- vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
-//EED3131
- if( IsEditable() )
- {
- 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);
- AddPoint(x,y,z);
- }
- // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
- 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() )
- {
- ok=true;
- InsertPoint(x,y,z);
- _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
- SetState(6);
- }
- // Chose id of Control Point to be move
- if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
- {
- ok=true;
- _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);
- SetState(7);
- }
- }else{
- SetPosibleToMove( true );
- GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
- } // IsEditable
-
- if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
- {
- SetMoving( true );
- ok=true;
- GetManualViewBaseContour()->InitMove(x,y,z);
- SetState(6);
- }
- if (ok==true)
- {
- GetManualViewBaseContour()->Refresh();
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourControler::MouseMove(int x, int y) // virtual
-{
- int z=GetZ();
- GetManualViewBaseContour()->SelectPosiblePoint(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() ){
- GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
- if (!IsEditable())
- {
- GetManualViewBaseContour()->RemoveControlPoints();
-// GetManualViewBaseContour()->RemoveTextActor();
- GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
-
-}
-
-// ----------------------------------------------------------------------------
-void manualContourControler::MouseDLeft( int x, int y)//virtual
-{
- manualContourBaseControler::MouseDLeft( x, y);
- if ( IsEditable() )
- {
- GetManualViewBaseContour()->AddControlPoints();
- GetManualViewBaseContour()->AddTextActor();
- GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourControler::SetEasyCreation(bool easyCreation)
-{
- _easyCreation=easyCreation;
-}
-// ----------------------------------------------------------------------------
-bool manualContourControler::GetEasyCreation()
-{
- return _easyCreation;
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualContourPerpPlaneControler::manualContourPerpPlaneControler()
-{
- _flagMouseMove = true;
-}
-// ----------------------------------------------------------------------------
-manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
-{
- manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
-{
- // Fathers object
- manualContourControler::CopyAttributesTo(cloneObject);
-
- cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
- cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
- cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
-}
-
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
-{
- _vtkmprbasedata = vtkmprbasedata;
-}
-
-// ----------------------------------------------------------------------------
-vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
-{
- return _vtkmprbasedata;
-}
-
-
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
-{
- manualContourControler::InsertPoint( x, y, z );
- _manualcontour3Vcontroler->InsertPoint_Others(0);
-}
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
-{
- manualContourControler::AddPoint( x, y, z );
- _manualcontour3Vcontroler->AddPoint_Others();
-}
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
-{
- int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
- manualContourControler::DeleteActualMousePoint( x , y );
- _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
-}
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::MouseMove( int x, int y )
-{
- _flagMouseMove = true;
- int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
- if ((this->GetState()!=7) && (ss!=1)){
- manualContourControler::MouseMove( x , y );
- int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
- if (id!=-1)
- {
- _manualcontour3Vcontroler->MouseMove_Others(id);
- _flagMouseMove = false;
- }
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
-{
- _manualcontour3Vcontroler = manualcontour3Vcontroler;
-}
-// ----------------------------------------------------------------------------
-manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
-{
- return _manualcontour3Vcontroler;
-}
-// ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnChar() // virtual
-{
- if (manualContourControler::OnChar()==false )
- {
- _manualcontour3Vcontroler->OnChar_Others();
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnMouseMove() // virtual
-{
- manualContourControler::OnMouseMove();
- return _flagMouseMove;
-}
-// ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
-{
- manualContourControler::OnLeftDClick();
- return _flagMouseDClick;
-}
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::ResetContour() // virtual
-{
- manualContourControler::ResetContour();
- _manualcontour3Vcontroler->ResetContour_Others();
-}
-
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
-{
- _flagMouseDClick=true;
- manualContourControler::MouseDLeft(x,y);
-
- if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
- {
- _flagMouseDClick = false;
- _vtkinteractorstyleplane2D->OnLeftDClick();
- ResetOrientationPlane();
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-
-// int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
-// if ( (GetState()==0) && (id!=-1) )
-// {
-// manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
-// _vtkmprbasedata->SetX( mp->GetX() );
-// _vtkmprbasedata->SetY( mp->GetY() );
-// _vtkmprbasedata->SetZ( mp->GetZ() );
-// ResetOrientationPlane();
-// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-// }
-}
-
-
-
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::ResetOrientationPlane()
-{
- double p[3],rp[3],rn[3];
- p[0] = _vtkmprbasedata->GetX( );
- p[1] = _vtkmprbasedata->GetY( );
- p[2] = _vtkmprbasedata->GetZ( );
- this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
-
- _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
-}
-
-// ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
-{
- _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
-}
-// ----------------------------------------------------------------------------
-InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
-{
- return _vtkinteractorstyleplane2D;
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// _state = 0 // ..nothing..
-// _state = 5 // move point
-// _state = 6 // move all
-// _state = 7 // Empty mouse drag
-
-manualRoiControler::manualRoiControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualRoiControler::~manualRoiControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualRoiControler * manualRoiControler :: Clone() // virtual
-{
- manualRoiControler * clone = new manualRoiControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
-{
- // Fathers object
- manualContourBaseControler::CopyAttributesTo(cloneObject);
-}
-
-// ----------------------------------------------------------------------------
-void manualRoiControler::Configure() //virtual
-{
- this->GetManualContourModel()->SetNumberOfPointsSpline(5);
-}
-
-// ----------------------------------------------------------------------------
-
-void manualRoiControler::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);
- }
-
- // if the firs time create 4 control points and move one point
- 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(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);
- }
- bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
- SetState(5);
- }
-*/
-
- GetManualViewBaseContour()->Refresh();
-}
-
-// ----------------------------------------------------------------------------
-void manualRoiControler::MouseMove(int x, int y) // virtual
-{
- int z=GetZ();
-
-// this->_vtkInteractorStyleBaseView->
-
-
- GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
- GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
-
-
- if ( (GetState()==5) || (GetState()==1) ){
- 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){
- GetManualViewBaseContour()->MoveContour(x,y,z);
- }
- GetManualViewBaseContour()->Refresh();
-}
-// ----------------------------------------------------------------------------
-void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
-{
-}
-// ----------------------------------------------------------------------------
-void manualRoiControler::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);
- AddPoint(0,0,zz);
- AddPoint(0,0,zz);
- }
-
- double pp1=porcentage;
- double pp2=1-porcentage;
-
- mp = GetManualContourModel()->GetManualPoint(2);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp1,hh*pp1,zz);
-
- mp = GetManualContourModel()->GetManualPoint(1);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp2,hh*pp1,zz);
-
- mp = GetManualContourModel()->GetManualPoint(0);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp2,hh*pp2,zz);
-
- mp = GetManualContourModel()->GetManualPoint(3);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp1,hh*pp2,zz);
-
- GetManualViewBaseContour() ->UpdateViewPoint(0);
- GetManualViewBaseContour() ->UpdateViewPoint(1);
- GetManualViewBaseContour() ->UpdateViewPoint(2);
- GetManualViewBaseContour() ->UpdateViewPoint(3);
-
- SetState(0);
- GetManualViewBaseContour()->Refresh();
-}
-
-// ----------------------------------------------------------------------------
-void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
-{
- manualPoint *mp;
- InitRoi( 0 , 0 , 0.2 );
- mp = GetManualContourModel()->GetManualPoint(2);
- mp->SetPointX(x1);
- mp->SetPointY(y1);
-
- mp = GetManualContourModel()->GetManualPoint(1);
- mp->SetPointX(x2);
- mp->SetPointY(y1);
-
- mp = GetManualContourModel()->GetManualPoint(0);
- mp->SetPointX(x2);
- mp->SetPointY(y2);
-
- mp = GetManualContourModel()->GetManualPoint(3);
- mp->SetPointX(x1);
- mp->SetPointY(y2);
-
- GetManualViewBaseContour() ->UpdateViewPoint(0);
- GetManualViewBaseContour() ->UpdateViewPoint(1);
- GetManualViewBaseContour() ->UpdateViewPoint(2);
- GetManualViewBaseContour() ->UpdateViewPoint(3);
-}
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// EED08
-
-// _state = 0 // ..nothing..
-// _state = 5 // move point
-// _state = 6 // move all
-// _state = 7 // Empty mouse drag
-
-manualCircleControler::manualCircleControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualCircleControler::~manualCircleControler()
-{
-}
-// ----------------------------------------------------------------------------
-manualCircleControler * manualCircleControler :: Clone() // virtual
-{
- manualCircleControler * clone = new manualCircleControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
-{
- // Fathers object
- manualContourBaseControler::CopyAttributesTo(cloneObject);
-}
-
-// ----------------------------------------------------------------------------
-void manualCircleControler::Configure() //virtual
-{
-// this->GetManualContourModel()->SetNumberOfPointsSpline(5);
-}
-
-// ----------------------------------------------------------------------------
-void manualCircleControler::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);
- }
-
- // firstime create 2 control points and move one 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 manualCircleControler::MouseMove(int x, int y) // virtual
-{
- int z=GetZ();
-// this->_vtkInteractorStyleBaseView->
-
- 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 manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
-{
-}
-// ----------------------------------------------------------------------------
-
-void manualCircleControler::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);
-// AddPoint(0,0,zz);
-// AddPoint(0,0,zz);
- }
-
- double pp1=porcentage;
- double pp2=1-porcentage;
-
-// mp = GetManualContourModel()->GetManualPoint(2);
-// zz=(int)mp->GetZ();
-// mp->SetPoint(ww*pp1,hh*pp1,zz);
-
- mp = GetManualContourModel()->GetManualPoint(1);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp2,hh*pp1,zz);
-
- mp = GetManualContourModel()->GetManualPoint(0);
- zz=(int)mp->GetZ();
- mp->SetPoint(ww*pp2,hh*pp2,zz);
-
-// mp = GetManualContourModel()->GetManualPoint(3);
-// zz=(int)mp->GetZ();
-// mp->SetPoint(ww*pp1,hh*pp2,zz);
-
- GetManualViewBaseContour() ->UpdateViewPoint(0);
- GetManualViewBaseContour() ->UpdateViewPoint(1);
-// GetManualViewBaseContour() ->UpdateViewPoint(2);
-// GetManualViewBaseContour() ->UpdateViewPoint(3);
-
- SetState(0);
- GetManualViewBaseContour()->Refresh();
-}
-
-// ----------------------------------------------------------------------------
-/*
-void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
-{
- manualPoint *mp;
- InitRoi( 0 , 0 , 0.2 );
- mp = GetManualContourModel()->GetManualPoint(2);
- mp->SetPointX(x1);
- mp->SetPointY(y1);
-
- mp = GetManualContourModel()->GetManualPoint(1);
- mp->SetPointX(x2);
- mp->SetPointY(y1);
-
- mp = GetManualContourModel()->GetManualPoint(0);
- mp->SetPointX(x2);
- mp->SetPointY(y2);
-
- mp = GetManualContourModel()->GetManualPoint(3);
- mp->SetPointX(x1);
- mp->SetPointY(y2);
-
- GetManualViewBaseContour() ->UpdateViewPoint(0);
- GetManualViewBaseContour() ->UpdateViewPoint(1);
- GetManualViewBaseContour() ->UpdateViewPoint(2);
- GetManualViewBaseContour() ->UpdateViewPoint(3);
-}
-*/
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// 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();
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-manualContourBaseControler::manualContourBaseControler()
-{
- _manViewBaseCont = NULL;
- _manContModel = NULL;
- _state = 0;
- _z = 900;
- _editable = true;
- _posibleToMove = true;
- _moving = false;
- _created = false;
- _keyBoardMoving = false;
-}
-// ----------------------------------------------------------------------------
-manualContourBaseControler::~manualContourBaseControler()
-{
-}
-
-// ----------------------------------------------------------------------------
-manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
-{
- manualContourBaseControler * clone = new manualContourBaseControler();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
-{
- // Fathers object
- InteractorStyleMaracas::CopyAttributesTo(cloneObject);
- cloneObject->SetZ( this->GetZ() );
- cloneObject->SetState( this->GetState() );
- cloneObject->SetEditable( this->IsEditable() );
- cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
- cloneObject->SetMoving( this->IsMoving() );
- cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
- cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
-}
-
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::Configure() //virtual
-{
-}
-
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnChar()
-{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
-
- int X,Y;
- wxVTKRenderWindowInteractor *_wxVTKiren;
- _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- _wxVTKiren->GetEventPosition(X, Y);
- //int Z = GetZ(); // JPRx
- // Delete Point
- if ((keyCode==8) || (keyCode==127))
- {
-
- if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
- {
- DeleteActualMousePoint(X,Y);
- }
- GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
- else
- {
- // Magnet
- if (keyCode==32)
- {
- Magnet(X,Y);
- GetManualViewBaseContour()->Refresh();
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
- else if( !IsEditable() )
- {
- if ( keyCode == 'L' )
- {
- GetManualViewBaseContour()->MoveContour( -1, 0 );
- SetKeyBoardMoving( true );
- }
- else if ( keyCode == 'R' )
- {
- GetManualViewBaseContour()->MoveContour( 1, 0 );
- SetKeyBoardMoving( true );
- }
- else if ( keyCode == 'U' )
- {
- GetManualViewBaseContour()->MoveContour( 0, -1 );
- SetKeyBoardMoving( true );
- }
- else if ( keyCode == 'D' )
- {
- GetManualViewBaseContour()->MoveContour( 0, 1 );
- SetKeyBoardMoving( true );
- }
- else if ( keyCode == 'W' )//Diagonal left down
- {
- GetManualViewBaseContour()->MoveContour( -1, 1 );
- SetKeyBoardMoving( true );
- }
- else if ( keyCode == 'Q' )//Diagonal left up
- {
- GetManualViewBaseContour()->MoveContour( -1, -1 );
- SetKeyBoardMoving( true );
- }
- else if( keyCode == 'P' )//Diagonal right up
- {
- GetManualViewBaseContour()->MoveContour( 1, -1 );
- SetKeyBoardMoving( true );
- }
- else if( keyCode == 'M' )//Diagonal right down
- {
- GetManualViewBaseContour()->MoveContour( 1, 1 );
- SetKeyBoardMoving( true );
- }
- if( GetKeyBoardMoving() )
- {
- GetManualViewBaseContour()->Refresh();
- 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 );
-
-
- if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
- (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
- MouseMove(X,Y);
- }
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnLeftButtonDown()
-{
- SetKeyBoardMoving( false );
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- MouseClickLeft(X,Y);
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnLeftButtonUp()
-{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
- MouseReleaseLeft(X,Y);
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnLeftDClick()
-{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- this->MouseDLeft(X,Y);
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnMiddleButtonDown()
-{
-// SetKeyBoardMoving( false );
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
- GetManualViewBaseContour()->InitMove( X, Y,GetZ());
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnMiddleButtonUp()
-{
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnRightButtonDown()
-{
- if( _vtkInteractorStyleBaseView!= NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X, Y);
-
- SetCompleteCreation( true );
- SetKeyBoardMoving( false );
- MouseClickRight(X,Y);
- }
- return true;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnRightButtonUp()
-{
- return true;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
- _manContModel = manContModel;
- _manViewBaseCont = manViewBaseCont;
- _manViewBaseCont->SetEditable( &_editable );
-}
-// ----------------------------------------------------------------------------
-manualContourModel* manualContourBaseControler::GetManualContourModel()
-{
- return _manContModel;
-}
-// ----------------------------------------------------------------------------
-manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
-{
- return _manViewBaseCont;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
-{
-
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::MouseClickRight(int x, int y)
-{
-// if (_state==1)
-// {
-// _state=0;
-// }
- SetEditable( false );
- SetPosibleToMove( false );
- _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; }
- SetMoving( false );
- GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
- if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
- {
- SetEditable( false );
- SetPosibleToMove( false );
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::MouseDLeft(int x, int y )
-{
- if (_state==0)
- {
- int z=GetZ();
- GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
- GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- if ( GetManualViewBaseContour()->GetPosibleSelected() )
- {
- _editable = true;
- }
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::MouseMove(int x, int y) // virtual
-{
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetState(int state)
-{
- _state=state;
-}
-// ----------------------------------------------------------------------------
-int manualContourBaseControler::GetState()
-{
- return _state;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::IsEditable( )
-{
- return _editable;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetEditable( bool condition )
-{
- if (GetManualViewBaseContour()!=NULL) {
- if( !condition )
- {
- GetManualViewBaseContour()->RemoveControlPoints();
- }
- GetManualViewBaseContour()->SetSelected( condition );
- }
- _editable = condition;
-}
-
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::GetPosibleToMove()
-{
- return _posibleToMove;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetPosibleToMove( bool condition )
-{
- _posibleToMove = condition;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::IsMoving()
-{
- return _moving;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetMoving( bool condition )
-{
- _moving = condition;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetCompleteCreation( bool condition )
-{
- _created = condition;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::GetIfCompleteCreation ( )
-{
- return _created;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetKeyBoardMoving( bool condition )
-{
- _keyBoardMoving = condition;
-}
-// ----------------------------------------------------------------------------
-bool manualContourBaseControler::GetKeyBoardMoving( )
-{
- return _keyBoardMoving;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::CreateNewManualContour(){
- _manViewBaseCont->CreateNewContour();
-}
-// ----------------------------------------------------------------------------
-int manualContourBaseControler::GetNumberOfPointsManualContour(){
- return _manViewBaseCont->GetNumberOfPoints();
-}
-// ----------------------------------------------------------------------------
-
-//JSTG - 25-02-08 -------------------------------------------------------------
-int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
- //return _manViewBaseCont->GetNumberOfPointsSpline();
- return _manContModel->GetNumberOfPointsSpline();
-}
-// ----------------------------------------------------------------------------
-
-double* manualContourBaseControler::GetVectorPointsXManualContour(){
- return _manViewBaseCont->GetVectorPointsXManualContour();
-}
-// ----------------------------------------------------------------------------
-double* manualContourBaseControler::GetVectorPointsYManualContour(){
- return _manViewBaseCont->GetVectorPointsYManualContour();
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::DeleteContour(){
- _manViewBaseCont->DeleteContour();
- _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);
- }
- }
- _state = 0;
-}
-
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::Magnet(int x, int y)
-{
- if( IsEditable())
- {
- /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
- if (GetManualContourModel()!=NULL){
- double xx = x;
- double yy = y;
- double zz = GetZ();
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
- if (id!=-1)
- {
- manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
- mp->SetPoint(xx,yy,zz);
- }
- // GetManualViewBaseContour()->UpdateViewPoint(id);
- }
- _state = 0;
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetZ(int z)
-{
- _z=z;
-}
-// ----------------------------------------------------------------------------
-int manualContourBaseControler::GetZ()
-{
- return _z;
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
-{
- if (GetManualContourModel()!=NULL){
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
- GetManualViewBaseContour()->AddPoint();
-// GetManualViewBaseContour()->UpdateViewPoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
-{
-//EEDzz
- int id=-1;
- if (GetManualContourModel()!=NULL){
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- if (GetManualContourModel()->GetSizeLstPoints()>1){
- id = GetManualContourModel()->InsertPoint(xx,yy,zz);
- GetManualViewBaseContour()->InsertPoint(id);
-// GetManualViewBaseContour()->UpdateViewPoint(id);
- } else {
- GetManualContourModel()->AddPoint(xx,yy,zz);
- GetManualViewBaseContour()->AddPoint();
-// AddPoint(x,y,z);
-// GetManualViewBaseContour()->UpdateViewPoint(id);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
- if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
- double xx = x;
- double yy = y;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- manualPoint *mp = _manContModel->GetManualPoint(id);
- mp->SetPoint(xx,yy,zz);
- GetManualViewBaseContour()->UpdateViewPoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetPointX( int id ,int x ){
- if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
- double xx = x;
- double yy = 0;
- double zz = 0;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- manualPoint *mp = _manContModel->GetManualPoint(id);
- mp->SetPointX(xx);
- GetManualViewBaseContour()->UpdateViewPoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetPointY( int id ,int y ){
- if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
- double xx = 0;
- double yy = y;
- double zz = 0;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- manualPoint *mp = _manContModel->GetManualPoint(id);
- mp->SetPointY(yy);
- GetManualViewBaseContour()->UpdateViewPoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::SetPointZ( int id ,int z ){
- if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
- double xx = 0;
- double yy = 0;
- double zz = z;
- GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
- manualPoint *mp = _manContModel->GetManualPoint(id);
- mp->SetPointZ(zz);
- GetManualViewBaseContour()->UpdateViewPoint(id);
- }
-}
-// ----------------------------------------------------------------------------
-void manualContourBaseControler::ResetContour() // virtual
-{
- this->DeleteContour();
- GetManualViewBaseContour()->CreateNewContour();
- this->SetState(0);
-}
-
+++ /dev/null
-
-#ifndef MANUAL_CONTOUR_H
-#define MANUAL_CONTOUR_H
-
-
-//--
-/* // EEDxx include
-#include <vtkProperty.h>
-#include "vtkActor.h"
-#include "vtkPoints.h"
-#include "vtkImageViewer2.h"
-#include "vtkImageData.h"
-*/
-
-#include "vtkRenderWindow.h"
-
-#include "vtkRenderer.h"
-#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
-#include "vtkCommand.h"
-#include "vtkPolyData.h"
-#include "vtkCellArray.h"
-#include "vtkPolyDataMapper.h"
-#include "vtkInteractorObserver.h"
-#include "vtkInteractorStyleImage.h"
-#include <vtkKochanekSpline.h>
-
-#include <vtkCellPicker.h>
-
-
-#include <vtkCamera.h>
-#include <vtkPolyLine.h>
-#include <vtkDataSetMapper.h>
-#include <vtkUnstructuredGrid.h>
-
-#include "wxVTKRenderWindowInteractor.h"
-
-#include "InteractorStyleMaracas.h"
-//--
-
-#include <vector>
-
-
-#include "wxVtkBaseView.h"
-#include "marTypes.h"
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-
-class manualPoint{
-public:
- manualPoint();
- virtual ~manualPoint();
- void SetPoint(double x,double y,double z);
- void SetPointX(double x);
- void SetPointY(double y);
- void SetPointZ(double z);
- double GetX();
- double GetY();
- double GetZ();
- virtual manualPoint * Clone();
-private:
- double _x;
- double _y;
- double _z;
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualContourModel{
-public:
- manualContourModel();
- virtual ~manualContourModel();
-
- virtual manualContourModel * Clone();
- void CopyAttributesTo( manualContourModel *cloneObject );
- virtual void Open(FILE *ff); // virtual
- virtual void Save(FILE *ff); // virtual
- virtual int GetTypeModel(); // virtual
-
- int AddPoint(double x,double y,double z);
- int InsertPoint(double x,double y,double z);
-//JSTG 25-04-08 -------------------------------------------------------
- void InsertPoint_id(int id, double x,double y,double z);
-//---------------------------------------------------------------------
- void AddManualPoint( manualPoint* theManualPoint );
-
- void DeletePoint(int i);
- void DeleteAllPoints();
-
- void MovePoint(int i,double dx,double dy,double dz);
- void MoveLstPoints(double dx,double dy,double dz);
- void MoveAllPoints(double dx,double dy,double dz);
-
- int GetIdPoint(double x, double y, double z, int i_range,int type);
- manualPoint* GetManualPoint(int id);
- int GetSizeLstPoints();
- int GetNumberOfPointsSpline();
- void SetNumberOfPointsSpline(int size);
-
- virtual void UpdateSpline();
- void SetCloseContour(bool closeContour);
- bool IfCloseContour();
-//JSTG 25-02-08 -----------------------------------------------------------------
- //void GetSplinePoint(double t, double &x, double &y, double &z); //Method Original
- //void GetSplineiPoint(int i, double &x, double &y, double &z); //Method Original
-//-------------------------------------------------------------------------------
- double GetPathSize();
- double GetPathArea();
-
- void GetNearestPointAndNormal(double *p, double *rp, double *rn);
-
-// JSTG 25-02-08 -----------------------------------------------------------------
- virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
- void GetSpline_t_Point(double t, double *x, double *y, double *z);
-//--------------------------------------------------------------------------------
-
- virtual std::vector<manualContourModel*> ExploseModel( );
-
-
-private:
- int _sizePointsContour;
- std::vector<manualPoint*> _lstPoints;
- bool _closeContour;
- vtkKochanekSpline *_cntSplineX;
- vtkKochanekSpline *_cntSplineY;
- vtkKochanekSpline *_cntSplineZ;
-
-//JSTG 25-02-08 ----------------------------------------
- double _delta_JSTG;
-//------------------------------------------------------
-
-};
-
-
-//--------------------------------------------------------
-
-class creaMaracasVisu_EXPORT manualContourModelCircle : public manualContourModel
-{
-public:
- manualContourModelCircle();
- virtual ~manualContourModelCircle();
- virtual manualContourModelCircle *Clone();
- void CopyAttributesTo( manualContourModelCircle *cloneObject);
- virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
-private:
- double _deltaAngle;
- double _radio;
- double _centerX;
- double _centerY;
- double _centerZ;
-
- virtual int GetTypeModel();
- 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:
- manualContourModelBullEyeSector();
- virtual ~manualContourModelBullEyeSector();
- virtual manualContourModelBullEyeSector *Clone();
- void CopyAttributesTo( manualContourModelBullEyeSector *cloneObject);
- void SetSector( double radioA,
- double radioB,
- double ang,
- double angDelta);
- void GetSector( double *radioA,
- double *radioB,
- double *ang,
- double *angDelta);
- void SetSize(double ww,double hh);
- void SetCenter(double cx,double cy);
- virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
- virtual void Save(FILE *ff);
- virtual void Open(FILE *ff);
-
-private:
- double _radioA;
- double _radioB;
- double _ang;
- double _angDelta;
- double _ww;
- double _hh;
- double _cx;
- double _cy;
-
- virtual int GetTypeModel();
-};
-
-
-//--------------------------------------------------------
-//eed004
-class creaMaracasVisu_EXPORT manualContourModelBullEye : public manualContourModel
-{
-public:
- manualContourModelBullEye();
- virtual ~manualContourModelBullEye();
- virtual manualContourModelBullEye *Clone();
- void CopyAttributesTo( manualContourModelBullEye *cloneObject);
- virtual void Save(FILE *ff);
- virtual void Open(FILE *ff);
-
- int GetNumberOfPointsSplineSectorBulleEje();
- void SetNumberOfPointsSplineSectorBulleEje(int);
- void AddSector( double radioA,
- double radioB,
- double ang,
- double angDelta);
- void GetSector( int id,
- double *radioA,
- double *radioB,
- double *ang,
- double *angDelta);
- manualContourModelBullEyeSector * GetModelSector(int id);
-
- void ResetSectors();
- int GetSizeOfSectorLst();
- virtual void UpdateSpline(); // virtual
- virtual std::vector<manualContourModel*> ExploseModel( );
-
-
-
-private:
- int _numberPointsSlineBySector;
- std::vector<manualContourModelBullEyeSector *> _lstModelBullEyeSector;
-
-/* Borrame Eduardo
- std::vector<double> _lstRadioA;
- std::vector<double> _lstRadioB;
- std::vector<double> _lstAng;
- std::vector<double> _lstAngDelta;
-*/
-
- virtual int GetTypeModel();
-};
-
-
-
-//--------------------------------------------------------
-
-//JSTG 25-02-08 ------------------------------------------
-class creaMaracasVisu_EXPORT manualContourModelRoi : public manualContourModel
-{
- public:
- manualContourModelRoi();
- virtual ~manualContourModelRoi();
- virtual manualContourModelRoi *Clone();
- void CopyAttributesTo( manualContourModelRoi *cloneObject);
-private:
- virtual int GetTypeModel();
-};
-//--------------------------------------------------------
-
-
-class manualViewPoint{
-public:
-
-// static int range;
-
- manualViewPoint(wxVtkBaseView *wxvtkbaseview);
- ~manualViewPoint();
- void SetSelected(bool selected);
- void SetPosibleSelected(bool posibleSelected);
- bool GetSelected();
- bool GetPosibleSelected();
- void DeleteVtkObjects();
- vtkActor* CreateVtkPointActor();
- void SetPositionXY(double x, double y, double range, double posZ);
- vtkActor* GetVtkActor();
- void UpdateColorActor();
- void GetSpacing(double spc[3]);
- void SetSpacing(double spc[3]);
- void SetWidthLine( double width);
-
-
-private:
- bool _selected;
- bool _posibleSelected;
- vtkPoints *_pts;
- vtkPolyData *_pd;
- vtkActor *_pointVtkActor;
- vtkPolyDataMapper *_bboxMapper;
- wxVtkBaseView *_wxvtkbaseview;
- double _widthline;
-protected:
- double _spc[3];
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualViewBaseContour{
-public:
- manualViewBaseContour();
- virtual ~manualViewBaseContour();
-
- virtual int GetType();
- virtual void Save(FILE *pFile);
- virtual void Open(FILE *pFile);
-
- void AddPoint();
- void AddPoint( manualViewPoint * manualViewPoint );
- void InsertPoint(int id);
- void DeleteContour();
- void DeletePoint(int x, int y,int z);
- virtual void DeletePoint(int id);
-
- virtual void UpdateViewPoint(int id);
- virtual void UpdateViewPoints();
-
- void SetSelected(bool selected);
- void SetPosibleSelected(bool posibleSelected);
- bool GetSelected();
- bool GetPosibleSelected();
- void DeleteSelectedPoints();
- bool GetEditable();
- void SetEditable( bool * condition );
-
-
-
- virtual int GetIdPoint(int x, int y, int z);
-
- void SelectPoint(int i,bool select);
- void SelectLstPoints();
- void SelectAllPoints(bool select);
- virtual int SelectPosiblePoint(int x, int y ,int z);
- bool SelectPosibleContour(int x, int y ,int z);
- void SelectAllPossibleSelected(bool select);
- void SetPointSelected(int id,bool select);
- void SetPointPosibleSelected(int id,bool select);
- void SetIfViewControlPoints(bool ifShow);
- bool GetIfViewControlPoints();
-
- void UnSelectPoint(int i);
- void UnSelectLstPoints();
- void UnSelectAllPoints();
-
- void SetModel(manualContourModel *manContModel);
- void SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
-
- virtual void Refresh();
- int GetNumberOfPoints(); // ???
- //int GetNumberOfPointsSpline(); //JSTG 25-02-08 In ContourModel is the same method
- //void SetNumberOfPointsSpline(int size); //JSTG 25-02-08 In ContourModel is the same method
-
- void CreateNewContour();
- double* GetVectorPointsXManualContour();
- double* GetVectorPointsYManualContour();
- double* GetVectorPointsZManualContour();
-
- virtual bool ifTouchContour(int x,int y, int z);
- void UpdateColorActor();
-
- void SetRange(int range);
- int GetRange();
- void SetZ(int z);
- int GetZ();
-
- wxVtkBaseView *GetWxVtkBaseView();
-
- virtual void InitMove(int x, int y, int z);
- virtual void MoveContour(int x, int y, int z);
- virtual void MoveContour(int horizontalUnits, int verticalUnits );
- virtual void GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ );
- virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type=2);
-
- void ClearContour();
- virtual void ClearPoint(int id);
-
- void SetVisible(bool ok);
- void SetShowText(bool ok);
-
- void GetSpacing(double spc[3]);
- void SetSpacing(double spc[3]);
-
- void SetColorNormalContour(double r, double g, double b);
- void GetColorNormalContour(double &r, double &g, double &b);
- void SetColorEditContour(double r, double g, double b);
- void GetColorEditContour(double &r, double &g, double &b);
- void SetColorSelectContour(double r, double g, double b);
- void GetColorSelectContour(double &r, double &g, double &b);
-
- //Addinging and removing from visualization specific actors included in the viewer contour
- void AddCompleteContourActor( bool ifControlPoints = false);
- void RemoveCompleteContourActor();
- virtual void AddSplineActor();
- virtual void RemoveSplineActor();
- void AddControlPoints();
- void RemoveControlPoints();
- void AddTextActor();
- void RemoveTextActor();
-
- virtual manualViewBaseContour * Clone();
- void CopyAttributesTo( manualViewBaseContour *cloneObject );
- virtual void RefreshContour();
- void SetWidthLine(double width);
- double GetWidthLine();
-
- virtual void ConstructVTKObjects();
-
-private:
- int _range;
-
- wxVtkBaseView *_wxvtkbaseview;
- bool _selected;
- bool *_editable;
- bool _posibleSelected;
- bool _viewControlPoints;
-
-
- vtkPolyData *_pd;
- vtkActor *_contourVtkActor;
- vtkPolyDataMapper *_bboxMapper;
-
- double _coulorEdit_r;
- double _coulorEdit_g;
- double _coulorEdit_b;
- double _coulorNormal_r;
- double _coulorNormal_g;
- double _coulorNormal_b;
- double _coulorSelection_r;
- double _coulorSelection_g;
- double _coulorSelection_b;
- double _widthline;
-
- void DeleteVtkObjects();
- virtual void RefreshText();
-
-
-protected:
-
- // text
- bool _show_text;
- int _id_viewPoint_for_text;
- vtkTextActor *_textActor;
- manualContourModel *_manContModel;
- vtkPoints *_pts;
-// JSTG 25-02-08 --------------------------------------------
- int _sizePointsContour;
-//-----------------------------------------------------------
- std::vector<manualViewPoint*> _lstViewPoints;
- double _spc[3];
-
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualViewContour: public manualViewBaseContour
-{
-public:
- manualViewContour();
- virtual ~manualViewContour();
- virtual manualViewContour * Clone();
- void CopyAttributesTo( manualViewContour *cloneObject );
-
- virtual int GetType();
- virtual void Save(FILE *pFile);
- virtual void Open(FILE *pFile);
-
-
- virtual 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);
- virtual void MoveContour(int horizontalUnits, int verticalUnits );
- virtual void DeletePoint(int id);
- virtual void ClearPoint(int id);
- void SetMesureScale(double mesureScale);
-private:
- double _mesureScale;
- std::vector< std::vector<double> > _initialMovingPoints;
- manualContourModel * _initialConoturModel;
-
- virtual void RefreshText();
-protected:
-
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-class manualView3VContour: public manualViewContour
-{
-public:
- manualView3VContour(int type);
- virtual ~manualView3VContour();
- virtual manualView3VContour * Clone();
- void CopyAttributesTo( manualView3VContour *cloneObject );
-
- virtual void RefreshContour();
- virtual int GetIdPoint(int x, int y, int z);
- virtual void UpdateViewPoint(int id);
- virtual bool ifTouchContour(int x,int y,int z);
- int GetType();
-
-protected:
-private:
- int _type;
- void FilterCordinateXYZ(double &x,double &y,double &z);
-
-// JSTG 25-02-08 -------------------------------------
- //manualContourModel *_manContModel;
-//----------------------------------------------------
-
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-class manualView3DContour: public manualViewContour
-{
-public:
- manualView3DContour();
- virtual ~manualView3DContour();
- virtual manualView3DContour * Clone();
- void CopyAttributesTo( manualView3DContour *cloneObject );
-
- virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type);
- void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
-
- virtual int SelectPosiblePoint ( int x, int y, int z );
- void SetDimensions(int w, int h, int d);
-
- int GetIdPoint2(int x, int y);
-
-protected:
- vtkMPRBaseData *_vtkmprbasedata;
-private:
- int _w;
- int _h;
- int _d;
-
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualViewRoi: public manualViewContour
-{
-public:
- manualViewRoi();
- virtual ~manualViewRoi();
-
- virtual int GetType();
- virtual manualViewRoi * Clone();
- void CopyAttributesTo( manualViewRoi *cloneObject );
-
- virtual 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);
- void GetMinMax(double &minX,double &minY, double &maxX, double &maxY);
-
-private:
- double _dp0[3];
- double _dp1[3];
- double _dp2[3];
- double _dp3[3];
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-class creaMaracasVisu_EXPORT manualViewBullEyeSector: public manualViewContour
-{
-public:
- manualViewBullEyeSector();
- virtual void RefreshContour();
-};
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-//EED004
-class creaMaracasVisu_EXPORT manualViewBullEye: public manualViewRoi
-{
-public:
- manualViewBullEye();
- virtual ~manualViewBullEye();
-
- virtual int GetType();
- virtual manualViewBullEye * Clone();
- void CopyAttributesTo( manualViewBullEye *cloneObject );
-
-// void UpdateColorActorBullEye();
-// void DeleteVtkObjectsBullEye();
- virtual void RemoveSplineActor();
- virtual void AddSplineActor();
- virtual void ConstructVTKObjects();
- virtual void RefreshContour();
-
-private:
-
-/*EED Borrame
- std::vector<sectorBullEye* > lstSectorBullEye;
-*/
-
- std::vector<manualViewBaseContour* > lstSectorBullEye;
-
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// EED08
-class creaMaracasVisu_EXPORT manualViewCircle: public manualViewContour
-{
-public:
- manualViewCircle();
- virtual ~manualViewCircle();
-
- virtual int GetType();
- virtual manualViewCircle * Clone();
- void CopyAttributesTo( manualViewCircle *cloneObject );
-
- 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);
-
-private:
- double _dp0[3];
- double _dp1[3];
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// AD:02-09
-class creaMaracasVisu_EXPORT manualViewLine: public manualViewContour
-{
-public:
- manualViewLine();
- virtual ~manualViewLine();
-
- virtual int GetType();
- virtual manualViewLine * Clone();
- void CopyAttributesTo( manualViewLine *cloneObject );
-
- 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];
-};
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-
-class creaMaracasVisu_EXPORT manualContourBaseControler: public InteractorStyleMaracas
-{
-public:
- manualContourBaseControler();
- virtual ~manualContourBaseControler();
-
- virtual manualContourBaseControler * Clone();
- void CopyAttributesTo( manualContourBaseControler *cloneObject );
-
- virtual bool OnChar();
- virtual bool OnMouseMove();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnLeftDClick();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
- void SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont);
- manualContourModel * GetManualContourModel();
- manualViewBaseContour * GetManualViewBaseContour();
-
-
- virtual void MouseClickLeft(int x, int y);
- virtual void MouseClickRight(int x, int y);
- virtual void MouseDLeft(int x, int y);
-
- virtual void MouseMove(int x, int y);
- virtual void MouseReleaseLeft(int x, int y);
-
- void SetState(int state);
- int GetState();
- bool IsEditable();
- void SetEditable( bool condition );
- bool GetPosibleToMove();
- void SetPosibleToMove( bool condition );
- bool IsMoving();
- void SetMoving( bool condition );
- void SetCompleteCreation( bool condition );
- bool GetIfCompleteCreation ( );
- void SetKeyBoardMoving( bool condition );
- bool GetKeyBoardMoving( );
-
- void CreateNewManualContour();
- int GetNumberOfPointsManualContour();
- int GetNumberOfPointsSplineManualContour();
- void DeleteContour();
- virtual void DeleteActualMousePoint(int x, int y );
- double* GetVectorPointsXManualContour();
- double* GetVectorPointsYManualContour();
-
-
- void SetZ(int z);
- virtual int GetZ();
-
- virtual void AddPoint(int x, int y, int z);
- virtual void InsertPoint(int x, int y, int z);
-
- virtual void SetPoint( int id ,int x ,int y ,int z);
- void SetPointX( int id ,int x );
- void SetPointY( int id ,int y );
- void SetPointZ( int id ,int z );
-
- void Magnet(int x, int y);
- virtual void ResetContour();
-
- virtual void Configure();
-
-
-//EED Borrame
-// virtual manualContourBaseControler * Clone( manualViewBaseContour * cloneView = NULL, manualContourModel * cloneModel = NULL );
-
-
-private:
- manualViewBaseContour *_manViewBaseCont;
- manualContourModel *_manContModel;
-
- int _z;
- int _state;
- bool _editable;
- bool _posibleToMove;
- bool _moving;
- bool _created;
- bool _keyBoardMoving;
-
-};
-
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualContourControler: public manualContourBaseControler
-{
-public:
- manualContourControler();
- virtual ~manualContourControler();
- virtual manualContourControler * Clone();
- void CopyAttributesTo( manualContourControler *cloneObject );
-
- virtual void MouseClickLeft(int x, int y);
- virtual void MouseMove(int x, int y);
- virtual void MouseDLeft( int x, int y);
- void SetEasyCreation(bool easyCreation);
- bool GetEasyCreation();
-
- virtual void Configure();
-
-protected:
- int _bakIdPoint;
-private:
- bool _easyCreation;
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-
-
-class creaMaracasVisu_EXPORT manualContour3VControler: public manualContourControler
-{
-public:
- manualContour3VControler(int type);
- virtual ~manualContour3VControler();
- virtual manualContour3VControler * Clone();
- void CopyAttributesTo( manualContour3VControler *cloneObject );
-
- virtual bool OnChar();
- virtual void AddPoint(int x, int y, int z);
- virtual void InsertPoint(int x, int y, int z);
- virtual void MouseMove(int x, int y);
- virtual void ResetContour();
-
- void AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont );
-
- vtkMPRBaseData *GetVtkMPRBaseData();
- void SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata );
- virtual void SetPoint( int id ,int x ,int y ,int z );
-
- virtual void DeleteActualMousePoint(int x, int y);
-
- void AddPoint_Others();
- void DeleteActualMousePoint_Others(int id);
- void MouseMove_Others(int id);
- void InsertPoint_Others(int id);
- void OnChar_Others();
- void ResetContour_Others();
- int GetType();
-
-private:
- int _type;
-
- vtkMPRBaseData *_vtkmprbasedata;
-
- std::vector< manualViewBaseContour* > _lstManualViewBaseContour;
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualContour3DControler: public manualContourControler
-{
-public:
- manualContour3DControler();
- virtual ~manualContour3DControler();
- virtual manualContour3DControler * Clone();
- void CopyAttributesTo( manualContour3DControler *cloneObject );
-
- virtual bool OnLeftButtonDown();
- virtual bool OnChar();
- virtual void InsertPoint(int x, int y, int z);
- virtual void MouseClickLeft(int x, int y);
- void ResetOrientationPlane();
-
- vtkMPRBaseData *GetVtkMPRBaseData();
- void SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata );
-
-
-protected:
-private:
- vtkMPRBaseData *_vtkmprbasedata;
-
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT manualContour3V3DControler: public manualContour3DControler
-{
-public:
- manualContour3V3DControler();
- virtual ~manualContour3V3DControler();
- virtual manualContour3V3DControler * Clone();
- void CopyAttributesTo( manualContour3V3DControler *cloneObject );
-
- void SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler);
- manualContour3VControler *GetManualContour3VControler();
-
- virtual bool OnChar();
- virtual void AddPoint( int x, int y, int z );
- virtual void DeleteActualMousePoint(int x, int y);
- virtual void MouseMove(int x, int y);
- virtual void InsertPoint(int x, int y, int z);
- virtual void ResetContour();
-
-
-protected:
-private:
- manualContour3VControler *_manualcontour3Vcontroler;
-
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT manualContourPerpPlaneControler: public manualContourControler
-{
-public:
- manualContourPerpPlaneControler();
- virtual ~manualContourPerpPlaneControler();
- virtual manualContourPerpPlaneControler * Clone();
- void CopyAttributesTo( manualContourPerpPlaneControler *cloneObject );
-
- void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
- vtkMPRBaseData *GetVtkMPRBaseData();
-
- virtual bool OnChar();
- virtual bool OnMouseMove();
- virtual bool OnLeftDClick();
- virtual void AddPoint( int x, int y, int z );
- virtual void DeleteActualMousePoint(int x, int y);
- virtual void MouseMove(int x, int y);
- virtual void InsertPoint(int x, int y, int z);
- virtual void ResetContour();
-
- void SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler);
- manualContour3VControler *GetManualContour3VControler();
-
- virtual void MouseDLeft( int x, int y);
- void ResetOrientationPlane();
- void SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D);
- InteractorStyleMaracas * GetVtkInteractorStylePlane2D();
-
-private:
- bool _flagMouseMove;
- bool _flagMouseDClick;
- InteractorStyleMaracas *_vtkinteractorstyleplane2D;
-
-protected:
- vtkMPRBaseData *_vtkmprbasedata;
- manualContour3VControler *_manualcontour3Vcontroler;
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT manualRoiControler: public manualContourControler
-{
-public:
- manualRoiControler();
- virtual ~manualRoiControler();
- virtual manualRoiControler * Clone();
- void CopyAttributesTo( manualRoiControler *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);
- void SetRoi(int x1, int y1,int x2, int y2);
- virtual void Configure();
-
-
-private:
- int bakIdPoint;
-};
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// EED08
-class creaMaracasVisu_EXPORT manualCircleControler: public manualContourControler
-{
-public:
- manualCircleControler();
- virtual ~manualCircleControler();
- virtual manualCircleControler * Clone();
- void CopyAttributesTo( manualCircleControler *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);
-// void SetRoi(int x1, int y1,int x2, int y2);
- virtual void Configure();
-
-
-private:
- int bakIdPoint;
-};
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-// 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;
-};
-
-
-
-
-#endif // MANUAL_CONTOUR_H
-
--- /dev/null
+#include "manualCircleControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// EED08
+
+// _state = 0 // ..nothing..
+// _state = 5 // move point
+// _state = 6 // move all
+// _state = 7 // Empty mouse drag
+
+manualCircleControler::manualCircleControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualCircleControler::~manualCircleControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualCircleControler * manualCircleControler :: Clone() // virtual
+{
+ manualCircleControler * clone = new manualCircleControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualCircleControler::Configure() //virtual
+{
+// this->GetManualContourModel()->SetNumberOfPointsSpline(5);
+}
+
+// ----------------------------------------------------------------------------
+void manualCircleControler::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);
+ }
+
+ // firstime create 2 control points and move one 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 manualCircleControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+// this->_vtkInteractorStyleBaseView->
+
+ 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 manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+
+void manualCircleControler::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);
+// AddPoint(0,0,zz);
+// AddPoint(0,0,zz);
+ }
+
+ double pp1=porcentage;
+ double pp2=1-porcentage;
+
+// mp = GetManualContourModel()->GetManualPoint(2);
+// zz=(int)mp->GetZ();
+// mp->SetPoint(ww*pp1,hh*pp1,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+// mp = GetManualContourModel()->GetManualPoint(3);
+// zz=(int)mp->GetZ();
+// mp->SetPoint(ww*pp1,hh*pp2,zz);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+// GetManualViewBaseContour() ->UpdateViewPoint(2);
+// GetManualViewBaseContour() ->UpdateViewPoint(3);
+
+ SetState(0);
+ GetManualViewBaseContour()->Refresh();
+}
+
+// ----------------------------------------------------------------------------
+/*
+void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
+{
+ manualPoint *mp;
+ InitRoi( 0 , 0 , 0.2 );
+ mp = GetManualContourModel()->GetManualPoint(2);
+ mp->SetPointX(x1);
+ mp->SetPointY(y1);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ mp->SetPointX(x2);
+ mp->SetPointY(y1);
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ mp->SetPointX(x2);
+ mp->SetPointY(y2);
+
+ mp = GetManualContourModel()->GetManualPoint(3);
+ mp->SetPointX(x1);
+ mp->SetPointY(y2);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+ GetManualViewBaseContour() ->UpdateViewPoint(2);
+ GetManualViewBaseContour() ->UpdateViewPoint(3);
+}
+*/
--- /dev/null
+#ifndef manualCircleControler_h
+#define manualCircleControler_h
+
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// EED08
+class creaMaracasVisu_EXPORT manualCircleControler: public manualContourControler
+{
+public:
+ manualCircleControler();
+ virtual ~manualCircleControler();
+ virtual manualCircleControler * Clone();
+ void CopyAttributesTo( manualCircleControler *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);
+// void SetRoi(int x1, int y1,int x2, int y2);
+ virtual void Configure();
+
+
+private:
+ int bakIdPoint;
+};
+
+#endif // manualCircleControler_h
--- /dev/null
+#include "manualContour3DControler.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContour3DControler::manualContour3DControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualContour3DControler::~manualContour3DControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualContour3DControler * manualContour3DControler :: Clone() // virtual
+{
+ manualContour3DControler * clone = new manualContour3DControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
+{
+ // Fathers object
+ manualContourControler::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
+}
+
+// ----------------------------------------------------------------------------
+bool manualContour3DControler::OnLeftButtonDown()
+{
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+ MouseClickLeft(X,Y);
+ return true;
+}
+// ----------------------------------------------------------------------------
+void manualContour3DControler::ResetOrientationPlane()
+{
+ double p[3],rp[3],rn[3];
+ p[0] = this->GetVtkMPRBaseData()->GetX( );
+ p[1] = this->GetVtkMPRBaseData()->GetY( );
+ p[2] = this->GetVtkMPRBaseData()->GetZ( );
+ this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
+ this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
+}
+// ----------------------------------------------------------------------------
+void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
+{
+ manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
+ int id=manualview3Dcontour->GetIdPoint2(x,y);
+ if ( (GetState()==0) && (id!=-1) )
+ {
+ manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
+
+ this->GetVtkMPRBaseData()->SetX( mp->GetX() );
+ this->GetVtkMPRBaseData()->SetY( mp->GetY() );
+ this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
+ ResetOrientationPlane();
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+
+
+ manualContourControler::MouseClickLeft(x,y);
+
+}
+// ----------------------------------------------------------------------------
+bool manualContour3DControler::OnChar()
+{
+ bool ok=true;
+ manualContourControler::OnChar();
+ char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+ if (keyCode==32){
+ ok=false;
+ ResetOrientationPlane();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+ return ok;
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
+{
+ _vtkmprbasedata=vtkmprbasedata;
+}
+// ----------------------------------------------------------------------------
+vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
+{
+ return _vtkmprbasedata;
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
+{
+ manualContourControler::InsertPoint( x, y, z );
+ ResetOrientationPlane();
+}
+
--- /dev/null
+#ifndef manualContour3DControler_h
+#define manualContour3DControler_h
+
+#include "manualContourControler.h"
+#include "manualView3DContour.h"
+
+/// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContour3DControler: public manualContourControler
+{
+public:
+ manualContour3DControler();
+ virtual ~manualContour3DControler();
+ virtual manualContour3DControler * Clone();
+ void CopyAttributesTo( manualContour3DControler *cloneObject );
+
+ virtual bool OnLeftButtonDown();
+ virtual bool OnChar();
+ virtual void InsertPoint(int x, int y, int z);
+ virtual void MouseClickLeft(int x, int y);
+ void ResetOrientationPlane();
+
+ vtkMPRBaseData *GetVtkMPRBaseData();
+ void SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata );
+
+
+protected:
+private:
+ vtkMPRBaseData *_vtkmprbasedata;
+
+};
+
+
+#endif // manualContour3DControler_h
--- /dev/null
+#include "manualContour3V3DControler.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContour3V3DControler::manualContour3V3DControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualContour3V3DControler::~manualContour3V3DControler()
+{
+}
+
+// ----------------------------------------------------------------------------
+manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
+{
+ manualContour3V3DControler * clone = new manualContour3V3DControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
+{
+ // Fathers object
+ manualContour3DControler::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
+}
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
+{
+ manualContour3DControler::InsertPoint( x, y, z );
+ _manualcontour3Vcontroler->InsertPoint_Others(0);
+}
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::AddPoint( int x, int y, int z )
+{
+ manualContour3DControler::AddPoint( x, y, z );
+ _manualcontour3Vcontroler->AddPoint_Others();
+}
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
+{
+ int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
+ manualContour3DControler::DeleteActualMousePoint( x , y );
+ _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
+}
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::MouseMove( int x, int y )
+{
+ int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
+ if ((this->GetState()!=7) && (ss!=1)){
+ manualContour3DControler::MouseMove( x , y );
+ int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
+ _manualcontour3Vcontroler->MouseMove_Others(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
+{
+ _manualcontour3Vcontroler = manualcontour3Vcontroler;
+}
+// ----------------------------------------------------------------------------
+manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
+{
+ return _manualcontour3Vcontroler;
+}
+// ----------------------------------------------------------------------------
+bool manualContour3V3DControler::OnChar() // virtual
+{
+ if (manualContour3DControler::OnChar()==false )
+ {
+ _manualcontour3Vcontroler->OnChar_Others();
+ }
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3V3DControler::ResetContour() // virtual
+{
+ manualContourControler::ResetContour();
+ _manualcontour3Vcontroler->ResetContour_Others();
+}
+
--- /dev/null
+#ifndef manualContour3V3DControler_h
+#define manualContour3V3DControler_h
+
+#include "manualContour3DControler.h"
+#include "manualContour3VControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContour3V3DControler: public manualContour3DControler
+{
+public:
+ manualContour3V3DControler();
+ virtual ~manualContour3V3DControler();
+ virtual manualContour3V3DControler * Clone();
+ void CopyAttributesTo( manualContour3V3DControler *cloneObject );
+
+ void SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler);
+ manualContour3VControler *GetManualContour3VControler();
+
+ virtual bool OnChar();
+ virtual void AddPoint( int x, int y, int z );
+ virtual void DeleteActualMousePoint(int x, int y);
+ virtual void MouseMove(int x, int y);
+ virtual void InsertPoint(int x, int y, int z);
+ virtual void ResetContour();
+
+
+protected:
+private:
+ manualContour3VControler *_manualcontour3Vcontroler;
+
+};
+
+
+#endif // manualContour3V3DControler_h
--- /dev/null
+#include "manualContour3VControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// _type = 0 Sagital
+// _type = 1 Coronal
+// _type = 2 Axial
+// _type = -1 View 3D
+
+manualContour3VControler::manualContour3VControler(int type)
+{
+ _type=type;
+
+//EEDhh
+// _manViewBaseCont1 = NULL;
+// _manViewBaseCont2 = NULL;
+// _manViewBaseCont3 = NULL;
+}
+//----------------------------------------------------------------------------
+manualContour3VControler::~manualContour3VControler()
+{
+}
+
+// ----------------------------------------------------------------------------
+manualContour3VControler * manualContour3VControler :: Clone() // virtual
+{
+ manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
+{
+ // Fathers object
+ manualContourControler::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
+
+ // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
+
+}
+// ----------------------------------------------------------------------------
+int manualContour3VControler::GetType()
+{
+ return _type;
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::AddPoint_Others()
+{
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->AddPoint();
+ }
+
+// EEDhh
+// if (_manViewBaseCont1!=NULL){
+// _manViewBaseCont1->AddPoint();
+// _manViewBaseCont2->AddPoint();
+// _manViewBaseCont3->AddPoint();
+// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+// }
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
+{
+
+ z=(int)_vtkmprbasedata->GetZ();
+ if (GetManualContourModel()!=NULL){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
+
+ if (_type==0)
+ {
+ xx=_vtkmprbasedata->GetX();
+ }
+
+ if (_type==1)
+ {
+ yy=_vtkmprbasedata->GetY();
+ }
+
+
+ /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
+ GetManualViewBaseContour()->AddPoint();
+ AddPoint_Others();
+
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::InsertPoint_Others(int id)
+{
+
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->InsertPoint(id);
+ }
+
+/*EEDhh
+ if (_manViewBaseCont1!=NULL){
+ _manViewBaseCont1->InsertPoint(id);
+ _manViewBaseCont2->InsertPoint(id);
+ _manViewBaseCont3->InsertPoint(id);
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+*/
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::InsertPoint(int x, int y, int z)
+{
+ int id=-1;
+ if (GetManualContourModel()!=NULL){
+ if (GetManualContourModel()->GetSizeLstPoints()>1){
+ z=(int)_vtkmprbasedata->GetZ();
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
+ if (_type==0)
+ {
+ xx=_vtkmprbasedata->GetX();
+ }
+
+ if (_type==1)
+ {
+ yy=_vtkmprbasedata->GetY();
+ }
+
+ id = GetManualContourModel()->InsertPoint(xx,yy,zz);
+
+ GetManualViewBaseContour()->InsertPoint(id);
+ InsertPoint_Others(0);
+
+ } else {
+ AddPoint(x,y,z);
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+
+// EEDhh
+/*
+void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
+ manualViewBaseContour *manViewBaseCont0,
+ manualViewBaseContour *manViewBaseCont1,
+ manualViewBaseContour *manViewBaseCont2,
+ manualViewBaseContour *manViewBaseCont3)
+{
+ manualContourControler::SetModelView(manContModel,manViewBaseCont0);
+ _manViewBaseCont1 = manViewBaseCont1;
+ _manViewBaseCont2 = manViewBaseCont2;
+ _manViewBaseCont3 = manViewBaseCont3;
+}
+*/
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
+{
+ _lstManualViewBaseContour.push_back( manViewBaseCont );
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
+{
+ _vtkmprbasedata=vtkmprbasedata;
+}
+// ----------------------------------------------------------------------------
+vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
+{
+ return _vtkmprbasedata;
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
+{
+ z=(int)_vtkmprbasedata->GetZ();
+ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
+
+ if (_type==0)
+ {
+ xx=_vtkmprbasedata->GetX();
+ }
+ if (_type==1)
+ {
+ yy=_vtkmprbasedata->GetY();
+ }
+
+ manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
+ mp->SetPoint(xx,yy,zz);
+
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::DeleteActualMousePoint_Others(int id)
+{
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->DeletePoint(id);
+ mvbc->Refresh();
+ }
+
+/*
+ if (_manViewBaseCont1!=NULL){
+ _manViewBaseCont1->DeletePoint(id);
+ _manViewBaseCont2->DeletePoint(id);
+ _manViewBaseCont3->DeletePoint(id);
+
+ _manViewBaseCont1->Refresh();
+ _manViewBaseCont2->Refresh();
+ _manViewBaseCont3->Refresh();
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+*/
+ 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 );
+ DeleteActualMousePoint_Others( id );
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::MouseMove_Others(int id) // virtual
+{
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->SelectAllPossibleSelected(false);
+ if (id!=-1)
+ {
+ mvbc->SetPointPosibleSelected(id,true);
+ }
+ mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
+ mvbc->Refresh();
+ }
+
+// EEDhh
+/*
+ if (_manViewBaseCont1!=NULL){
+ _manViewBaseCont1->SelectAllPossibleSelected(false);
+ _manViewBaseCont2->SelectAllPossibleSelected(false);
+ _manViewBaseCont3->SelectAllPossibleSelected(false);
+ 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->Refresh();
+ _manViewBaseCont2->Refresh();
+ _manViewBaseCont3->Refresh();
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+*/
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::MouseMove(int x, int y) // virtual
+{
+ manualContourControler::MouseMove( x , y );
+ int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
+ MouseMove_Others( id );
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::OnChar_Others()
+{
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->Refresh();
+ }
+// EEDhh
+/*
+ _manViewBaseCont1->Refresh();
+ _manViewBaseCont2->Refresh();
+ _manViewBaseCont3->Refresh();
+*/
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+}
+// ----------------------------------------------------------------------------
+bool manualContour3VControler::OnChar()
+{
+ manualContourControler::OnChar();
+ OnChar_Others();
+ return true;
+}
+// ----------------------------------------------------------------------------
+void manualContour3VControler::ResetContour() // virtual
+{
+ manualContourControler::ResetContour();
+ ResetContour_Others();
+}
+
+// ----------------------------------------------------------------------------
+void manualContour3VControler::ResetContour_Others()
+{
+ manualViewBaseContour *mvbc;
+ int i,size=this->_lstManualViewBaseContour.size();
+ for ( i = 0 ; i < size ; i++ )
+ {
+ mvbc = _lstManualViewBaseContour[i];
+ mvbc->DeleteContour();
+ mvbc->CreateNewContour();
+ }
+
+// EEDhh
+/*
+ _manViewBaseCont1->DeleteContour();
+ _manViewBaseCont2->DeleteContour();
+ _manViewBaseCont3->DeleteContour();
+ _manViewBaseCont1->CreateNewContour();
+ _manViewBaseCont2->CreateNewContour();
+ _manViewBaseCont3->CreateNewContour();
+*/
+}
+
--- /dev/null
+#ifndef manualContour3VControler_h
+#define manualContour3VControler_h
+
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContour3VControler: public manualContourControler
+{
+public:
+ manualContour3VControler(int type);
+ virtual ~manualContour3VControler();
+ virtual manualContour3VControler * Clone();
+ void CopyAttributesTo( manualContour3VControler *cloneObject );
+
+ virtual bool OnChar();
+ virtual void AddPoint(int x, int y, int z);
+ virtual void InsertPoint(int x, int y, int z);
+ virtual void MouseMove(int x, int y);
+ virtual void ResetContour();
+
+ void AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont );
+
+ vtkMPRBaseData *GetVtkMPRBaseData();
+ void SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata );
+ virtual void SetPoint( int id ,int x ,int y ,int z );
+
+ virtual void DeleteActualMousePoint(int x, int y);
+
+ void AddPoint_Others();
+ void DeleteActualMousePoint_Others(int id);
+ void MouseMove_Others(int id);
+ void InsertPoint_Others(int id);
+ void OnChar_Others();
+ void ResetContour_Others();
+ int GetType();
+
+private:
+ int _type;
+
+ vtkMPRBaseData *_vtkmprbasedata;
+
+ std::vector< manualViewBaseContour* > _lstManualViewBaseContour;
+};
+
+
+#endif // manualContour3VControler_h
--- /dev/null
+#include "manualContourBaseControler.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourBaseControler::manualContourBaseControler()
+{
+ _manViewBaseCont = NULL;
+ _manContModel = NULL;
+ _state = 0;
+ _z = 900;
+ _editable = true;
+ _posibleToMove = true;
+ _moving = false;
+ _created = false;
+ _keyBoardMoving = false;
+}
+// ----------------------------------------------------------------------------
+manualContourBaseControler::~manualContourBaseControler()
+{
+}
+
+// ----------------------------------------------------------------------------
+manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
+{
+ manualContourBaseControler * clone = new manualContourBaseControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
+{
+ // Fathers object
+ InteractorStyleMaracas::CopyAttributesTo(cloneObject);
+ cloneObject->SetZ( this->GetZ() );
+ cloneObject->SetState( this->GetState() );
+ cloneObject->SetEditable( this->IsEditable() );
+ cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
+ cloneObject->SetMoving( this->IsMoving() );
+ cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
+ cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
+}
+
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::Configure() //virtual
+{
+}
+
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnChar()
+{
+ if ( _vtkInteractorStyleBaseView!=NULL )
+ {
+ char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+
+ int X,Y;
+ wxVTKRenderWindowInteractor *_wxVTKiren;
+ _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ _wxVTKiren->GetEventPosition(X, Y);
+ //int Z = GetZ(); // JPRx
+ // Delete Point
+ if ((keyCode==8) || (keyCode==127))
+ {
+
+ if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
+ {
+ DeleteActualMousePoint(X,Y);
+ }
+ GetManualViewBaseContour()->Refresh();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+ else
+ {
+ // Magnet
+ if (keyCode==32)
+ {
+ Magnet(X,Y);
+ GetManualViewBaseContour()->Refresh();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+ else if( !IsEditable() )
+ {
+ if ( keyCode == 'L' )
+ {
+ GetManualViewBaseContour()->MoveContour( -1, 0 );
+ SetKeyBoardMoving( true );
+ }
+ else if ( keyCode == 'R' )
+ {
+ GetManualViewBaseContour()->MoveContour( 1, 0 );
+ SetKeyBoardMoving( true );
+ }
+ else if ( keyCode == 'U' )
+ {
+ GetManualViewBaseContour()->MoveContour( 0, -1 );
+ SetKeyBoardMoving( true );
+ }
+ else if ( keyCode == 'D' )
+ {
+ GetManualViewBaseContour()->MoveContour( 0, 1 );
+ SetKeyBoardMoving( true );
+ }
+ else if ( keyCode == 'W' )//Diagonal left down
+ {
+ GetManualViewBaseContour()->MoveContour( -1, 1 );
+ SetKeyBoardMoving( true );
+ }
+ else if ( keyCode == 'Q' )//Diagonal left up
+ {
+ GetManualViewBaseContour()->MoveContour( -1, -1 );
+ SetKeyBoardMoving( true );
+ }
+ else if( keyCode == 'P' )//Diagonal right up
+ {
+ GetManualViewBaseContour()->MoveContour( 1, -1 );
+ SetKeyBoardMoving( true );
+ }
+ else if( keyCode == 'M' )//Diagonal right down
+ {
+ GetManualViewBaseContour()->MoveContour( 1, 1 );
+ SetKeyBoardMoving( true );
+ }
+ if( GetKeyBoardMoving() )
+ {
+ GetManualViewBaseContour()->Refresh();
+ 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 );
+
+
+ if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
+ (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
+ MouseMove(X,Y);
+ }
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnLeftButtonDown()
+{
+ SetKeyBoardMoving( false );
+ if ( _vtkInteractorStyleBaseView!=NULL )
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+ MouseClickLeft(X,Y);
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnLeftButtonUp()
+{
+ if ( _vtkInteractorStyleBaseView!=NULL )
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+ MouseReleaseLeft(X,Y);
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnLeftDClick()
+{
+ if ( _vtkInteractorStyleBaseView!=NULL )
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+ this->MouseDLeft(X,Y);
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnMiddleButtonDown()
+{
+// SetKeyBoardMoving( false );
+ if ( _vtkInteractorStyleBaseView!=NULL )
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+ GetManualViewBaseContour()->InitMove( X, Y,GetZ());
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnMiddleButtonUp()
+{
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnRightButtonDown()
+{
+ if( _vtkInteractorStyleBaseView!= NULL )
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X, Y);
+
+ SetCompleteCreation( true );
+ SetKeyBoardMoving( false );
+ MouseClickRight(X,Y);
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::OnRightButtonUp()
+{
+ return true;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
+ _manContModel = manContModel;
+ _manViewBaseCont = manViewBaseCont;
+ _manViewBaseCont->SetEditable( &_editable );
+}
+// ----------------------------------------------------------------------------
+manualContourModel* manualContourBaseControler::GetManualContourModel()
+{
+ return _manContModel;
+}
+// ----------------------------------------------------------------------------
+manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
+{
+ return _manViewBaseCont;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
+{
+
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::MouseClickRight(int x, int y)
+{
+// if (_state==1)
+// {
+// _state=0;
+// }
+ SetEditable( false );
+ SetPosibleToMove( false );
+ _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; }
+ SetMoving( false );
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
+ if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
+ {
+ SetEditable( false );
+ SetPosibleToMove( false );
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::MouseDLeft(int x, int y )
+{
+ if (_state==0)
+ {
+ int z=GetZ();
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+ if ( GetManualViewBaseContour()->GetPosibleSelected() )
+ {
+ _editable = true;
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::MouseMove(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetState(int state)
+{
+ _state=state;
+}
+// ----------------------------------------------------------------------------
+int manualContourBaseControler::GetState()
+{
+ return _state;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::IsEditable( )
+{
+ return _editable;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetEditable( bool condition )
+{
+ if (GetManualViewBaseContour()!=NULL) {
+ if( !condition )
+ {
+ GetManualViewBaseContour()->RemoveControlPoints();
+ }
+ GetManualViewBaseContour()->SetSelected( condition );
+ }
+ _editable = condition;
+}
+
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::GetPosibleToMove()
+{
+ return _posibleToMove;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetPosibleToMove( bool condition )
+{
+ _posibleToMove = condition;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::IsMoving()
+{
+ return _moving;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetMoving( bool condition )
+{
+ _moving = condition;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetCompleteCreation( bool condition )
+{
+ _created = condition;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::GetIfCompleteCreation ( )
+{
+ return _created;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetKeyBoardMoving( bool condition )
+{
+ _keyBoardMoving = condition;
+}
+// ----------------------------------------------------------------------------
+bool manualContourBaseControler::GetKeyBoardMoving( )
+{
+ return _keyBoardMoving;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::CreateNewManualContour(){
+ _manViewBaseCont->CreateNewContour();
+}
+// ----------------------------------------------------------------------------
+int manualContourBaseControler::GetNumberOfPointsManualContour(){
+ return _manViewBaseCont->GetNumberOfPoints();
+}
+// ----------------------------------------------------------------------------
+
+//JSTG - 25-02-08 -------------------------------------------------------------
+int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
+ //return _manViewBaseCont->GetNumberOfPointsSpline();
+ return _manContModel->GetNumberOfPointsSpline();
+}
+// ----------------------------------------------------------------------------
+
+double* manualContourBaseControler::GetVectorPointsXManualContour(){
+ return _manViewBaseCont->GetVectorPointsXManualContour();
+}
+// ----------------------------------------------------------------------------
+double* manualContourBaseControler::GetVectorPointsYManualContour(){
+ return _manViewBaseCont->GetVectorPointsYManualContour();
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::DeleteContour(){
+ _manViewBaseCont->DeleteContour();
+ _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);
+ }
+ }
+ _state = 0;
+}
+
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::Magnet(int x, int y)
+{
+ if( IsEditable())
+ {
+ /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
+ if (GetManualContourModel()!=NULL){
+ double xx = x;
+ double yy = y;
+ double zz = GetZ();
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
+ if (id!=-1)
+ {
+ manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
+ mp->SetPoint(xx,yy,zz);
+ }
+ // GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+ _state = 0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetZ(int z)
+{
+ _z=z;
+}
+// ----------------------------------------------------------------------------
+int manualContourBaseControler::GetZ()
+{
+ return _z;
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
+{
+ if (GetManualContourModel()!=NULL){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
+ GetManualViewBaseContour()->AddPoint();
+// GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
+{
+//EEDzz
+ int id=-1;
+ if (GetManualContourModel()!=NULL){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ if (GetManualContourModel()->GetSizeLstPoints()>1){
+ id = GetManualContourModel()->InsertPoint(xx,yy,zz);
+ GetManualViewBaseContour()->InsertPoint(id);
+// GetManualViewBaseContour()->UpdateViewPoint(id);
+ } else {
+ GetManualContourModel()->AddPoint(xx,yy,zz);
+ GetManualViewBaseContour()->AddPoint();
+// AddPoint(x,y,z);
+// GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
+ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ mp->SetPoint(xx,yy,zz);
+ GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetPointX( int id ,int x ){
+ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
+ double xx = x;
+ double yy = 0;
+ double zz = 0;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ mp->SetPointX(xx);
+ GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetPointY( int id ,int y ){
+ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
+ double xx = 0;
+ double yy = y;
+ double zz = 0;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ mp->SetPointY(yy);
+ GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::SetPointZ( int id ,int z ){
+ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
+ double xx = 0;
+ double yy = 0;
+ double zz = z;
+ GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ mp->SetPointZ(zz);
+ GetManualViewBaseContour()->UpdateViewPoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::ResetContour() // virtual
+{
+ this->DeleteContour();
+ GetManualViewBaseContour()->CreateNewContour();
+ this->SetState(0);
+}
+
--- /dev/null
+#ifndef manualContourBaseControler_h
+#define manualContourBaseControler_h
+
+#include "vtkRenderWindow.h"
+
+#include "vtkRenderer.h"
+#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
+#include "vtkCommand.h"
+#include "vtkPolyData.h"
+#include "vtkCellArray.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkInteractorObserver.h"
+#include "vtkInteractorStyleImage.h"
+#include <vtkKochanekSpline.h>
+
+#include <vtkCellPicker.h>
+
+
+#include <vtkCamera.h>
+#include <vtkPolyLine.h>
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include <vtkActor.h>
+#include <vtkProperty.h>
+
+#include <vtkCellArray.h>
+#include <vtkRenderer.h>
+#include <vtkCoordinate.h>
+#include <vtkTextProperty.h>
+#include <vtkTextActor.h>
+#include <vtkProperty2D.h>
+#include <vtkPointPicker.h>
+#include "widgets/UtilVtk3DGeometriSelection.h"
+#include "widgets/InteractorStyleMaracas.h"
+
+
+#include "wxVTKRenderWindowInteractor.h"
+
+
+//--
+
+#include <vector>
+#include "wxVtkBaseView.h"
+#include "marTypes.h"
+
+#include "manualContourModel.h"
+#include "manualViewBaseContour.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContourBaseControler: public InteractorStyleMaracas
+{
+public:
+ manualContourBaseControler();
+ virtual ~manualContourBaseControler();
+
+ virtual manualContourBaseControler * Clone();
+ void CopyAttributesTo( manualContourBaseControler *cloneObject );
+
+ virtual bool OnChar();
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnLeftDClick();
+ virtual bool OnMiddleButtonDown();
+ virtual bool OnMiddleButtonUp();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+
+ void SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont);
+ manualContourModel * GetManualContourModel();
+ manualViewBaseContour * GetManualViewBaseContour();
+
+
+ virtual void MouseClickLeft(int x, int y);
+ virtual void MouseClickRight(int x, int y);
+ virtual void MouseDLeft(int x, int y);
+
+ virtual void MouseMove(int x, int y);
+ virtual void MouseReleaseLeft(int x, int y);
+
+ void SetState(int state);
+ int GetState();
+ bool IsEditable();
+ void SetEditable( bool condition );
+ bool GetPosibleToMove();
+ void SetPosibleToMove( bool condition );
+ bool IsMoving();
+ void SetMoving( bool condition );
+ void SetCompleteCreation( bool condition );
+ bool GetIfCompleteCreation ( );
+ void SetKeyBoardMoving( bool condition );
+ bool GetKeyBoardMoving( );
+
+ void CreateNewManualContour();
+ int GetNumberOfPointsManualContour();
+ int GetNumberOfPointsSplineManualContour();
+ void DeleteContour();
+ virtual void DeleteActualMousePoint(int x, int y );
+ double* GetVectorPointsXManualContour();
+ double* GetVectorPointsYManualContour();
+
+
+ void SetZ(int z);
+ virtual int GetZ();
+
+ virtual void AddPoint(int x, int y, int z);
+ virtual void InsertPoint(int x, int y, int z);
+
+ virtual void SetPoint( int id ,int x ,int y ,int z);
+ void SetPointX( int id ,int x );
+ void SetPointY( int id ,int y );
+ void SetPointZ( int id ,int z );
+
+ void Magnet(int x, int y);
+ virtual void ResetContour();
+
+ virtual void Configure();
+
+
+//EED Borrame
+// virtual manualContourBaseControler * Clone( manualViewBaseContour * cloneView = NULL, manualContourModel * cloneModel = NULL );
+
+
+private:
+ manualViewBaseContour *_manViewBaseCont;
+ manualContourModel *_manContModel;
+
+ int _z;
+ int _state;
+ bool _editable;
+ bool _posibleToMove;
+ bool _moving;
+ bool _created;
+ bool _keyBoardMoving;
+
+};
+
+
+#endif // manualContourBaseControler_h
--- /dev/null
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// _state = 0 // ..nothing..
+// _state = 1 // move with add point
+// _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 * clone = new manualContourControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+// ---------------------------------------------------------------------------
+void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+ cloneObject->SetEasyCreation( this->GetEasyCreation() );
+}
+
+// ----------------------------------------------------------------------------
+void manualContourControler::Configure() //virtual
+{
+ // this->_manContModel->SetNumberOfPointsSpline(100);
+}
+
+// ----------------------------------------------------------------------------
+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(); // JPRx
+ vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
+//EED3131
+ if( IsEditable() )
+ {
+ 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);
+ AddPoint(x,y,z);
+ }
+ // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
+ 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() )
+ {
+ ok=true;
+ InsertPoint(x,y,z);
+ _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(6);
+ }
+ // Chose id of Control Point to be move
+ if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
+ {
+ ok=true;
+ _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);
+ SetState(7);
+ }
+ }else{
+ SetPosibleToMove( true );
+ GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
+ } // IsEditable
+
+ if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
+ {
+ SetMoving( true );
+ ok=true;
+ GetManualViewBaseContour()->InitMove(x,y,z);
+ SetState(6);
+ }
+ if (ok==true)
+ {
+ GetManualViewBaseContour()->Refresh();
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+ GetManualViewBaseContour()->SelectPosiblePoint(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() ){
+ GetManualViewBaseContour()->Refresh();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+ if (!IsEditable())
+ {
+ GetManualViewBaseContour()->RemoveControlPoints();
+// GetManualViewBaseContour()->RemoveTextActor();
+ GetManualViewBaseContour()->Refresh();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+void manualContourControler::MouseDLeft( int x, int y)//virtual
+{
+ manualContourBaseControler::MouseDLeft( x, y);
+ if ( IsEditable() )
+ {
+ GetManualViewBaseContour()->AddControlPoints();
+ GetManualViewBaseContour()->AddTextActor();
+ GetManualViewBaseContour()->Refresh();
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourControler::SetEasyCreation(bool easyCreation)
+{
+ _easyCreation=easyCreation;
+}
+// ----------------------------------------------------------------------------
+bool manualContourControler::GetEasyCreation()
+{
+ return _easyCreation;
+}
+
--- /dev/null
+#ifndef manualContourControler_h
+#define manualContourControler_h
+
+#include "manualContourBaseControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT manualContourControler: public manualContourBaseControler
+{
+public:
+ manualContourControler();
+ virtual ~manualContourControler();
+ virtual manualContourControler * Clone();
+ void CopyAttributesTo( manualContourControler *cloneObject );
+
+ virtual void MouseClickLeft(int x, int y);
+ virtual void MouseMove(int x, int y);
+ virtual void MouseDLeft( int x, int y);
+ void SetEasyCreation(bool easyCreation);
+ bool GetEasyCreation();
+
+ virtual void Configure();
+
+protected:
+ int _bakIdPoint;
+private:
+ bool _easyCreation;
+};
+
+#endif // manualContourControler_h
--- /dev/null
+#include "manualContourModel.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModel::manualContourModel()
+{
+ _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;
+//---------------------------------------------------------------------------------------------------------------
+}
+
+// ----------------------------------------------------------------------------
+manualContourModel::~manualContourModel()
+{
+ int i,size=_lstPoints.size();
+ for (i=0;i<size; i++){
+ 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)
+{
+ manualPoint *mp = new manualPoint();
+ mp->SetPoint(x,y,z);
+ AddManualPoint(mp);
+ //UpdateSpline();
+
+ return _lstPoints.size()-1;
+}
+// ----------------------------------------------------------------------------
+int manualContourModel::InsertPoint(double x,double y,double z)
+{
+ double dd,ddmin=9999999;
+ int ibak=0;
+ double xx,x1,x2;
+ double yy,y1,y2;
+ double zz,z1,z2;
+ int i,ii,iii,size=_lstPoints.size();
+ double j,MaxDivisions=20,porcentage;
+ int sizeB=size;
+
+ if (_closeContour==false)
+ {
+ size=size-1;
+ }
+
+ double jbak;
+
+ for ( i=0 ; i<size ; i++ )
+ {
+ ii=i % sizeB ;
+ iii=(i+1) % sizeB;
+ x1=_lstPoints[ii]->GetX();
+ y1=_lstPoints[ii]->GetY();
+ z1=_lstPoints[ii]->GetZ();
+ x2=_lstPoints[iii]->GetX();
+ y2=_lstPoints[iii]->GetY();
+ z2=_lstPoints[iii]->GetZ();
+ for (j=0; j<=MaxDivisions; j++)
+ {
+ porcentage=(j/MaxDivisions);
+ xx=(x2-x1)*porcentage+x1;
+ yy=(y2-y1)*porcentage+y1;
+ zz=(z2-z1)*porcentage+z1;
+ dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
+ if ( dd<ddmin )
+ {
+ ddmin=dd;
+ ibak=iii;
+ jbak=j;
+ }
+ }
+ }
+
+ if (_closeContour==false)
+ {
+ if ( (ibak==1) && (jbak==0) )
+ {
+ ibak=0;
+ }
+ if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
+ {
+ ibak=sizeB;
+ }
+ }
+
+
+//JSTG - 25-04-08 ----------------------------------------------------------
+ //manualPoint *mp = new manualPoint();
+ //mp->SetPoint(x,y,z);
+ //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
+ //_lstPoints.insert(itNum,mp);
+ InsertPoint_id(ibak,x,y,z);
+//----------------------------------------------------------------------------
+
+ return ibak;
+}
+// ----------------------------------------------------------------------------
+void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
+{
+ manualPoint *mp = new manualPoint();
+ mp->SetPoint(x,y,z);
+ std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
+ _lstPoints.insert(itNum,mp);
+}
+// ----------------------------------------------------------------------------
+
+void manualContourModel::DeletePoint(int i)
+{
+ std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
+ _lstPoints.erase(itNum);
+}
+// ----------------------------------------------------------------------------
+void manualContourModel::DeleteAllPoints()
+{
+ int i,size=_lstPoints.size();
+ for (i=0;i<size;i++){
+ _lstPoints.erase( _lstPoints.begin() );
+ }
+ this->UpdateSpline();
+}
+// ----------------------------------------------------------------------------
+
+void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
+{
+ manualPoint *mp=_lstPoints[i];
+ double x=mp->GetX()+dx;
+ double y=mp->GetY()+dy;
+ double z=mp->GetZ()+dz;
+ mp->SetPoint(x,y,z);
+}
+// ----------------------------------------------------------------------------
+void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
+{
+ // ToDo
+}
+// ----------------------------------------------------------------------------
+void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
+{
+ int i,size=_lstPoints.size();
+ for (i=0;i<size;i++){
+ MovePoint(i,dx,dy,dz);
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+
+// type=-1 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)
+{
+ double range = i_range+1;
+
+ double xx,yy,zz,dd,ddmin=9999999;
+ int ibak=-1;
+ int i,size=_lstPoints.size();
+ for (i=0;i<size;i++){
+ manualPoint *mp=_lstPoints[i];
+ xx=mp->GetX();
+ yy=mp->GetY();
+ zz=mp->GetZ();
+
+ 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) );
+ 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) );
+ 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) );
+ 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) );
+ if (dd<ddmin){
+ ddmin=dd;
+ ibak=i;
+ }
+ }
+ }
+ }
+ return ibak;
+}
+// ----------------------------------------------------------------------------
+manualPoint* manualContourModel::GetManualPoint(int id)
+{
+ return _lstPoints[id];
+}
+// ----------------------------------------------------------------------------
+int manualContourModel::GetSizeLstPoints()
+{
+ return _lstPoints.size();
+}
+//----------------------------------------------------------------------------
+int manualContourModel::GetNumberOfPointsSpline()
+{
+ return _sizePointsContour;
+}
+//----------------------------------------------------------------------------
+void manualContourModel::SetNumberOfPointsSpline(int size)
+{
+ _sizePointsContour = size;
+}
+
+
+// ----------------------------------------------------------------------------
+
+void manualContourModel::SetCloseContour(bool closeContour)
+{
+ _closeContour = closeContour;
+ if (_closeContour==true)
+ {
+ _cntSplineX->ClosedOn();
+ _cntSplineY->ClosedOn();
+ _cntSplineZ->ClosedOn();
+ } else {
+ _cntSplineX->ClosedOff();
+ _cntSplineY->ClosedOff();
+ _cntSplineZ->ClosedOff();
+ }
+}
+
+// ----------------------------------------------------------------------------
+bool manualContourModel::IfCloseContour()
+{
+ return _closeContour;
+}
+
+// ----------------------------------------------------------------------------
+
+void manualContourModel::UpdateSpline() // virtual
+{
+ int i, np;
+ np = _lstPoints.size();
+ manualPoint *mp;
+ _cntSplineX->RemoveAllPoints();
+ _cntSplineY->RemoveAllPoints();
+ _cntSplineZ->RemoveAllPoints();
+ for( i = 0; i < np; i++ ) {
+ mp = GetManualPoint(i);
+ _cntSplineX->AddPoint( i, mp->GetX() );
+ _cntSplineY->AddPoint( i, mp->GetY() );
+ _cntSplineZ->AddPoint( i, mp->GetZ() );
+ } // rof
+
+//JSTG 25-02-08 ---------------------------------------------------------------------------------------------
+ if (this->_closeContour==true)
+ {
+ _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) / 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 t = delta*(double)i;
+ GetSplinePoint(t, x, y, z);
+}*/
+
+//-----------------------------------------------------------------------------
+
+//JSTG 25-02-08 ---------------------------------------------------------------
+void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+{
+ GetSpline_t_Point(i*_delta_JSTG,x,y,z);
+}
+
+// ----------------------------------------------------------------------------
+
+//JSTG 25-02-08 ---------------------------------------------------------------
+void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
+{
+ if (_lstPoints.size()==0)
+ {
+ *x = 0;
+ *y = 0;
+ *z = 0;
+ }
+ if (_lstPoints.size()==1)
+ {
+ manualPoint *mp;
+ mp = GetManualPoint(0);
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+ }
+ if (_lstPoints.size()>=2)
+ {
+ *x = _cntSplineX->Evaluate(t);
+ *y = _cntSplineY->Evaluate(t);
+ *z = _cntSplineZ->Evaluate(t);
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+
+/*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
+{
+ if (_lstPoints.size()==0)
+ {
+ x = 0;
+ y = 0;
+ z = 0;
+ }
+ if (_lstPoints.size()==1)
+ {
+ manualPoint *mp;
+ mp = GetManualPoint(0);
+ x = mp->GetX();
+ y = mp->GetY();
+ z = mp->GetZ();
+ }
+ if (_lstPoints.size()>=2)
+ {
+ x = _cntSplineX->Evaluate(t);
+ y = _cntSplineY->Evaluate(t);
+ z = _cntSplineZ->Evaluate(t);
+ }
+}*/
+// ----------------------------------------------------------------------------
+double manualContourModel::GetPathSize()
+{
+ 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=_lstPoints[0]->GetX();
+ y1=_lstPoints[0]->GetY();
+ z1=_lstPoints[0]->GetZ();
+ x2=_lstPoints[1]->GetX();
+ y2=_lstPoints[1]->GetY();
+ z2=_lstPoints[1]->GetZ();
+ result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
+ }
+ if (_lstPoints.size()>2)
+ {
+
+// JSTG 25-02-08 ------------------------------------------
+ //np = _lstPoints.size( );
+ //nps = 200;
+ //delta=( double ) ( np ) / ( double ) ( nps );
+ UpdateSpline();
+ //GetSplinePoint(0,x1,y1,z1);
+ GetSpline_i_Point(0,&x1,&y1,&z1);
+
+ //for( i = 1; i < nps; i++ )
+ for( i = 1; i < GetNumberOfPointsSpline(); i++ )
+ {
+ //t = delta * (double)i;
+ //GetSplinePoint(t,x2,y2,z2);
+ GetSpline_i_Point(i,&x2,&y2,&z2);
+//---------------------------------------------------------
+ result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
+ x1=x2;
+ y1=y2;
+ z1=z2;
+ }// for
+ }
+
+ return result;
+}
+// ----------------------------------------------------------------------------
+double manualContourModel::GetPathArea()
+{
+ double result = 555;
+ if ((_lstPoints.size()>=3) && IfCloseContour()==true )
+ {
+ double area;
+//JSTG 25-02-08 ---------------------------------------------
+ //double ti,tj;
+//-----------------------------------------------------------
+ double x1,y1,z1;
+ 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
+ // given in clockwise order).
+
+//JSTG 25-02-08 -------------------------------------------------
+ //int np = _lstPoints.size( );
+ //int nps = 200;
+ int nps = GetNumberOfPointsSpline();
+ //double delta=( double ) ( np ) / ( double ) ( nps );
+ UpdateSpline();
+ for( i = 0, area = 0.0; i < nps; i++ )
+ {
+ j = ( i + 1 ) % nps;
+ //ti = delta * (double)i;
+ //tj = delta * (double)j;
+ //GetSplinePoint(ti,x1,y1,z1);
+ //GetSplinePoint(tj,x2,y2,z2);
+ GetSpline_i_Point(i,&x1,&y1,&z1);
+ GetSpline_i_Point(j,&x2,&y2,&z2);
+//----------------------------------------------------------------
+ area +=
+ (x1 * y2 ) -
+ ( x2 * y1 );
+ if (z1!=z2)
+ {
+ okArea=false;
+ }
+ }// for
+ area /= 2.0;
+ area = fabs( area );
+
+/*
+ for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
+ {
+ j = ( i + 1 ) % _lstPoints.size();
+ // Area
+ area +=
+ (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
+ ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
+ if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
+ {
+ okArea=false;
+ }
+ } // rof
+ area /= 2.0;
+ area = fabs( area );
+*/
+
+ if (okArea==true)
+ {
+ result = area;
+ } else {
+ result = -1;
+ }
+
+ } else {
+ result = 0;
+ }
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+// 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;
+ double dist,dx,dy,dz;
+ double x1,y1,z1;
+ double x2,y2,z2;
+ int i,np,nps;
+
+//JSTG 25-02-08 -------------------
+ //double tback;
+ int iback;
+ //double t,delta;
+//---------------------------------
+
+ np = _lstPoints.size( );
+ if (np>=2)
+ {
+// JSTG 25-02-08 ------------------------------------------
+ //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++ )
+ {
+ //t = delta * (double)i;
+ //GetSplinePoint(t,x1,y1,z1);
+ GetSpline_i_Point(i,&x1,&y1,&z1);
+//----------------------------------------------------------
+ dx= x1-p[0];
+ dy= y1-p[1];
+ dz= z1-p[2];
+ dist = sqrt( dx*dx + dy*dy + dz*dz );
+ if (dist<distMin)
+ {
+ distMin = dist;
+//JSTG tback = t;
+ iback = i;
+ rp[0] = x1;
+ rp[1] = y1;
+ rp[2] = z1;
+ rn[0] = x2-x1;
+ rn[1] = y2-y1;
+ rn[2] = z2-z1;
+ }
+ x2=x1;
+ y2=y1;
+ z2=z1;
+ }// for
+
+// JSTG 25-02-08 ------------------------------------------
+ //if (tback==0)
+ if (iback==0)
+ {
+ //t = delta * (double)1.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;
+ }
+ }
+ else
+ {
+ rp[0] = 0;
+ rp[1] = 0;
+ rp[2] = 0;
+ rn[0] = -1;
+ rn[1] = 0;
+ rn[2] = 0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+manualContourModel * manualContourModel :: Clone() // virtual
+{
+ manualContourModel * clone = new manualContourModel();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ----------------------------------------------------------------------------
+void manualContourModel::Open(FILE *ff) // virtual
+{
+ char tmp[255];
+ int i;
+ int numberOfControlPoints;
+ double x,y,z;
+
+ fscanf(ff,"%s",tmp); // NumberOfControlPoints
+ fscanf(ff,"%s",tmp); // ##
+ numberOfControlPoints = atoi(tmp);
+ for (i=0;i<numberOfControlPoints;i++)
+ {
+ fscanf(ff,"%s",tmp); // X
+ x = atof(tmp);
+ fscanf(ff,"%s",tmp); // Y
+ y = atof(tmp);
+ fscanf(ff,"%s",tmp); // Z
+ z = atof(tmp);
+ AddPoint(x,y,z);
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+int manualContourModel::GetTypeModel() //virtual
+{
+ // 0 spline
+ // 1 spline
+ // 2 rectangle
+ // 3 circle
+ // 4 BullEye
+ // 5 BullEyeSector
+ // 6 Line
+ return 1;
+}
+
+// ----------------------------------------------------------------------------
+void manualContourModel::Save(FILE *ff) // virtual
+{
+ int i,size=_lstPoints.size();
+ fprintf(ff,"TypeModel %d\n", GetTypeModel() );
+ fprintf(ff,"NumberOfControlPoints %d\n",size);
+ for (i=0;i<size;i++)
+ {
+ manualPoint *mp=_lstPoints[i];
+ fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+
+void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
+{
+ // Fathers object
+ //XXXX::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetCloseContour( this->IfCloseContour() );
+ int i, size = GetSizeLstPoints();
+ for( i=0; i<size; i++ )
+ {
+ cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
+ }
+ cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
+ cloneObject->SetCloseContour( _closeContour );
+ cloneObject->UpdateSpline();
+}
+
+
+// ---------------------------------------------------------------------------
+void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
+{
+ _lstPoints.push_back( theManualPoint );
+}
+
+std::vector<manualContourModel*> manualContourModel::ExploseModel( )
+{
+ std::vector<manualContourModel*> lstTmp;
+ lstTmp.push_back(this);
+ return lstTmp;
+}
--- /dev/null
+#ifndef manualContourModel_h
+#define manualContourModel_h
+
+#include "vtkRenderWindow.h"
+
+#include "vtkRenderer.h"
+#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
+#include "vtkCommand.h"
+#include "vtkPolyData.h"
+#include "vtkCellArray.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkInteractorObserver.h"
+#include "vtkInteractorStyleImage.h"
+#include <vtkKochanekSpline.h>
+
+#include <vtkCellPicker.h>
+
+
+#include <vtkCamera.h>
+#include <vtkPolyLine.h>
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "wxVTKRenderWindowInteractor.h"
+
+
+//--
+
+#include <vector>
+#include "wxVtkBaseView.h"
+#include "marTypes.h"
+#include "manualPoint.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT manualContourModel
+{
+public:
+ manualContourModel();
+ virtual ~manualContourModel();
+
+ virtual manualContourModel * Clone();
+ void CopyAttributesTo( manualContourModel *cloneObject );
+ virtual void Open(FILE *ff); // virtual
+ virtual void Save(FILE *ff); // virtual
+ virtual int GetTypeModel(); // virtual
+
+ int AddPoint(double x,double y,double z);
+ int InsertPoint(double x,double y,double z);
+//JSTG 25-04-08 -------------------------------------------------------
+ void InsertPoint_id(int id, double x,double y,double z);
+//---------------------------------------------------------------------
+ void AddManualPoint( manualPoint* theManualPoint );
+
+ void DeletePoint(int i);
+ void DeleteAllPoints();
+
+ void MovePoint(int i,double dx,double dy,double dz);
+ void MoveLstPoints(double dx,double dy,double dz);
+ void MoveAllPoints(double dx,double dy,double dz);
+
+ int GetIdPoint(double x, double y, double z, int i_range,int type);
+ manualPoint* GetManualPoint(int id);
+ int GetSizeLstPoints();
+ int GetNumberOfPointsSpline();
+ void SetNumberOfPointsSpline(int size);
+
+ virtual void UpdateSpline();
+ void SetCloseContour(bool closeContour);
+ bool IfCloseContour();
+//JSTG 25-02-08 -----------------------------------------------------------------
+ //void GetSplinePoint(double t, double &x, double &y, double &z); //Method Original
+ //void GetSplineiPoint(int i, double &x, double &y, double &z); //Method Original
+//-------------------------------------------------------------------------------
+ double GetPathSize();
+ double GetPathArea();
+
+ void GetNearestPointAndNormal(double *p, double *rp, double *rn);
+
+// JSTG 25-02-08 -----------------------------------------------------------------
+ virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+ void GetSpline_t_Point(double t, double *x, double *y, double *z);
+//--------------------------------------------------------------------------------
+
+ virtual std::vector<manualContourModel*> ExploseModel( );
+
+private:
+ int _sizePointsContour;
+ std::vector<manualPoint*> _lstPoints;
+ bool _closeContour;
+ vtkKochanekSpline *_cntSplineX;
+ vtkKochanekSpline *_cntSplineY;
+ vtkKochanekSpline *_cntSplineZ;
+
+//JSTG 25-02-08 ----------------------------------------
+ double _delta_JSTG;
+//------------------------------------------------------
+
+};
+
+
+#endif // manualContourModel_h
--- /dev/null
+#include "manualContourModelBullEye.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelBullEye::manualContourModelBullEye()
+: manualContourModel()
+{
+ _numberPointsSlineBySector=101; // impaire
+}
+
+manualContourModelBullEye::~manualContourModelBullEye()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
+{
+ manualContourModelBullEye * clone = new manualContourModelBullEye();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
+{
+ // Fathers object
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelBullEye::GetTypeModel() //virtual
+{
+ return 4;
+}
+
+//----------------------------------------------------------------
+int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
+{
+ return _numberPointsSlineBySector;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
+{
+ this->_numberPointsSlineBySector = numpoints;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::AddSector( double radioA,
+ double radioB,
+ double ang,
+ double angDelta)
+{
+ manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
+ modelSector->SetSector(radioA,radioB,ang,angDelta);
+ modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
+ _lstModelBullEyeSector.push_back(modelSector);
+}
+
+//----------------------------------------------------------------
+manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
+{
+ return _lstModelBullEyeSector[id];
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::GetSector(int id,
+ double *radioA,
+ double *radioB,
+ double *ang,
+ double *angDelta)
+{
+ _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
+}
+
+void manualContourModelBullEye::UpdateSpline() // virtual
+{
+ manualContourModel::UpdateSpline();
+
+ if (this->GetSizeLstPoints()>2){
+ double cx,cy;
+ double ww,hh;
+ manualPoint *mpA = GetManualPoint(0);
+ manualPoint *mpB = GetManualPoint(2);
+ cx = (mpA->GetX() + mpB->GetX()) / 2.0;
+ cy = (mpA->GetY() + mpB->GetY()) / 2.0;
+ ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
+ hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
+ int i,size = _lstModelBullEyeSector.size();
+ for (i=0;i<size;i++)
+ {
+ _lstModelBullEyeSector[i]->SetCenter(cx,cy);
+ _lstModelBullEyeSector[i]->SetSize(ww,hh);
+ } // for
+ }
+}
+
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::ResetSectors()
+{
+ int i,size=_lstModelBullEyeSector.size();
+ for (i=0;i<size;i++)
+ {
+ delete _lstModelBullEyeSector[i];
+ }
+ _lstModelBullEyeSector.clear();
+}
+
+//----------------------------------------------------------------
+int manualContourModelBullEye::GetSizeOfSectorLst()
+{
+ return _lstModelBullEyeSector.size();
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::Save(FILE *ff) // virtual
+{
+ manualContourModel::Save(ff);
+ int i,size = GetSizeOfSectorLst();
+ fprintf(ff,"numberOfSections %d \n",size);
+ for ( i=0 ; i<size ; i++ )
+ {
+ _lstModelBullEyeSector[i]->Save(ff);
+ }
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEye::Open(FILE *ff) // virtual
+{
+ manualContourModel::Open(ff);
+
+ ResetSectors();
+
+ char tmp[255];
+ int i;
+ int numberOfSections;
+// double radioA,radioB,ang,deltaAng;
+
+ fscanf(ff,"%s",tmp); // NumberOfSections
+ fscanf(ff,"%s",tmp); // ##
+ numberOfSections = atoi(tmp);
+ for (i=0;i<numberOfSections;i++)
+ {
+ AddSector(0,1,90,0);
+ _lstModelBullEyeSector[i]->Open(ff);
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
+{
+//EED004
+ std::vector<manualContourModel*> lstTmp;
+ int i,iSize=_lstModelBullEyeSector.size();
+ for (i=0;i<iSize;i++)
+ {
+ lstTmp.push_back( _lstModelBullEyeSector[i] );
+ }
+ return lstTmp;
+}
+
--- /dev/null
+#ifndef manualContourModelBullEye_h
+#define manualContourModelBullEye_h
+
+#include "manualContourModel.h"
+#include "manualContourModelBullEyeSector.h"
+
+//--------------------------------------------------------
+//eed004
+class creaMaracasVisu_EXPORT manualContourModelBullEye : public manualContourModel
+{
+public:
+ manualContourModelBullEye();
+ virtual ~manualContourModelBullEye();
+ virtual manualContourModelBullEye *Clone();
+ void CopyAttributesTo( manualContourModelBullEye *cloneObject);
+ virtual void Save(FILE *ff);
+ virtual void Open(FILE *ff);
+
+ int GetNumberOfPointsSplineSectorBulleEje();
+ void SetNumberOfPointsSplineSectorBulleEje(int);
+ void AddSector( double radioA,
+ double radioB,
+ double ang,
+ double angDelta);
+ void GetSector( int id,
+ double *radioA,
+ double *radioB,
+ double *ang,
+ double *angDelta);
+ manualContourModelBullEyeSector * GetModelSector(int id);
+
+ void ResetSectors();
+ int GetSizeOfSectorLst();
+ virtual void UpdateSpline(); // virtual
+ virtual std::vector<manualContourModel*> ExploseModel( );
+
+
+
+private:
+ int _numberPointsSlineBySector;
+ std::vector<manualContourModelBullEyeSector *> _lstModelBullEyeSector;
+
+/* Borrame Eduardo
+ std::vector<double> _lstRadioA;
+ std::vector<double> _lstRadioB;
+ std::vector<double> _lstAng;
+ std::vector<double> _lstAngDelta;
+*/
+
+ virtual int GetTypeModel();
+};
+
+#endif // manualContourModelBullEye_h
--- /dev/null
+#include "manualContourModelBullEyeSector.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelBullEyeSector::manualContourModelBullEyeSector()
+: manualContourModel()
+{
+}
+
+manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
+{
+ manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
+{
+ // Fathers object
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelBullEyeSector::GetTypeModel() //virtual
+{
+ return 5;
+}
+
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::SetSector( double radioA,
+ double radioB,
+ double ang,
+ double angDelta)
+{
+ _radioA = radioA;
+ _radioB = radioB;
+ _ang = ang*3.14159265/180.0;
+ _angDelta = angDelta*3.14159265/180.0;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::GetSector(
+ double *radioA,
+ double *radioB,
+ double *ang,
+ double *angDelta)
+{
+ *radioA = _radioA;
+ *radioB = _radioB;
+ *ang = _ang;
+ *angDelta = _angDelta;
+}
+
+// ----------------------------------------------------------------------------
+void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
+{
+ _cx = cx;
+ _cy = cy;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::SetSize(double ww,double hh)
+{
+ _ww = ww;
+ _hh = hh;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
+{
+//EED004
+
+ int ii,nps;
+// double x,y,z;
+ double ang,angcos, angsin;
+ double radio;
+
+ nps = GetNumberOfPointsSpline() - 3;
+
+ if (i==GetNumberOfPointsSpline()-1)
+ {
+ i=0;
+ }
+
+ if (i<=nps/2)
+ {
+ ii=i;
+ radio=_radioA;
+ } else {
+ ii=nps-i+1;
+ radio=_radioB;
+ }
+ ang = ((double)ii/(nps/2))*_angDelta + _ang;
+ angcos = cos(ang);
+ angsin = sin(ang);
+
+ *x = _ww*radio*angcos + _cx;
+ *y = _hh*radio*angsin + _cy;
+ *z= 900;
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
+{
+ manualContourModel::Save(ff);
+ fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
+}
+
+//----------------------------------------------------------------
+void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
+{
+ char tmp[255];
+ fscanf(ff,"%s",tmp); // TypeModel
+ fscanf(ff,"%s",tmp); // ##
+
+ manualContourModel::Open(ff);
+
+
+ fscanf(ff,"%s",tmp); // radioA=
+ fscanf(ff,"%s",tmp); // radioA
+ _radioA = atof(tmp);
+
+ fscanf(ff,"%s",tmp); // radioB=
+ fscanf(ff,"%s",tmp); // radioB
+ _radioB = atof(tmp);
+
+ fscanf(ff,"%s",tmp); // ang=
+ fscanf(ff,"%s",tmp); // ang
+ _ang = atof(tmp);
+
+ fscanf(ff,"%s",tmp); // deltaAng=
+ fscanf(ff,"%s",tmp); // deltaAng
+ _angDelta = atof(tmp);
+}
+
+
--- /dev/null
+#ifndef manualContourModelBullEyeSector_h
+#define manualContourModelBullEyeSector_h
+
+#include "manualContourModel.h"
+
+
+//--------------------------------------------------------
+
+class manualContourModelBullEyeSector : public manualContourModel
+{
+public:
+ manualContourModelBullEyeSector();
+ virtual ~manualContourModelBullEyeSector();
+ virtual manualContourModelBullEyeSector *Clone();
+ void CopyAttributesTo( manualContourModelBullEyeSector *cloneObject);
+ void SetSector( double radioA,
+ double radioB,
+ double ang,
+ double angDelta);
+ void GetSector( double *radioA,
+ double *radioB,
+ double *ang,
+ double *angDelta);
+ void SetSize(double ww,double hh);
+ void SetCenter(double cx,double cy);
+ virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+ virtual void Save(FILE *ff);
+ virtual void Open(FILE *ff);
+
+private:
+ double _radioA;
+ double _radioB;
+ double _ang;
+ double _angDelta;
+ double _ww;
+ double _hh;
+ double _cx;
+ double _cy;
+
+ virtual int GetTypeModel();
+};
+
+
+#endif // manualContourModelBullEyeSector_h
--- /dev/null
+#include "manualContourModelCircle.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelCircle::manualContourModelCircle()
+: manualContourModel()
+{
+}
+
+manualContourModelCircle::~manualContourModelCircle()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
+{
+ manualContourModelCircle * clone = new manualContourModelCircle();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
+{
+ // Fathers object
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelCircle::GetTypeModel() //virtual
+{
+ return 3;
+}
+
+//----------------------------------------------------------------
+void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+{
+ double angle = _deltaAngle*i;
+ *x = _radio*cos(angle) + _centerX;
+ *y = _radio*sin(angle) + _centerY;
+ *z = _centerZ;
+}
+
+//
+// ---------------------------------------------------------------------------
+void manualContourModelCircle::UpdateSpline() // virtal
+{
+ manualPoint *mpA,*mpB;
+ double difX,difY;
+ int np = GetSizeLstPoints( );
+ int nps = GetNumberOfPointsSpline();
+ _deltaAngle=(3.14159265*2)/(nps-1);
+
+ if (np==2){
+ mpA = GetManualPoint(0);
+ mpB = GetManualPoint(1);
+ difX = mpA->GetX() - mpB->GetX();
+ difY = mpA->GetY() - mpB->GetY();
+ _radio = sqrt( difX*difX + difY*difY );
+ _centerX = mpA->GetX();
+ _centerY = mpA->GetY();
+ _centerZ = mpA->GetZ();
+ } else {
+ _radio = -1;
+ _centerX = -1;
+ _centerY = -1;
+ _centerZ = -1;
+ }
+}
--- /dev/null
+#ifndef manualContourModelCircle_h
+#define manualContourModelCircle_h
+
+#include "manualContourModel.h"
+
+class creaMaracasVisu_EXPORT manualContourModelCircle : public manualContourModel
+{
+public:
+ manualContourModelCircle();
+ virtual ~manualContourModelCircle();
+ virtual manualContourModelCircle *Clone();
+ void CopyAttributesTo( manualContourModelCircle *cloneObject);
+ virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+private:
+ double _deltaAngle;
+ double _radio;
+ double _centerX;
+ double _centerY;
+ double _centerZ;
+
+ virtual int GetTypeModel();
+ virtual void UpdateSpline();
+};
+
+#endif // manualContourModelCircle_h
--- /dev/null
+#include "manualContourModelLine.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//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();
+ }
+
+}
+*/
+
--- /dev/null
+#ifndef manualContourModelLine_h
+#define manualContourModelLine_h
+
+#include "manualContourModel.h"
+
+//--------------------------------------------------------
+
+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();
+};
+
+#endif // manualContourModelLine_h
--- /dev/null
+#include "manualContourModelRoi.h"
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+
+//JSTG 25-02-08 --------------------------------------------------
+manualContourModelRoi::manualContourModelRoi()
+: manualContourModel()
+{
+ SetNumberOfPointsSpline(5);
+}
+
+manualContourModelRoi::~manualContourModelRoi()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
+{
+ manualContourModelRoi * clone = new manualContourModelRoi();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
+{
+ // Fathers object
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelRoi::GetTypeModel() //virtual
+{
+ return 2;
+}
+
+//----------------------------------------------------------------
\ No newline at end of file
--- /dev/null
+#ifndef manualContourModelRoi_h
+#define manualContourModelRoi_h
+
+#include "manualContourModel.h"
+
+//--------------------------------------------------------
+//JSTG 25-02-08 ------------------------------------------
+class creaMaracasVisu_EXPORT manualContourModelRoi : public manualContourModel
+{
+ public:
+ manualContourModelRoi();
+ virtual ~manualContourModelRoi();
+ virtual manualContourModelRoi *Clone();
+ void CopyAttributesTo( manualContourModelRoi *cloneObject);
+private:
+ virtual int GetTypeModel();
+};
+
+#endif // manualContourModelRoi_h
--- /dev/null
+#include "manualContourPerpPlaneControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+manualContourPerpPlaneControler::manualContourPerpPlaneControler()
+{
+ _flagMouseMove = true;
+}
+// ----------------------------------------------------------------------------
+manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
+{
+ manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
+{
+ // Fathers object
+ manualContourControler::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
+ cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
+ cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
+}
+
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
+{
+ _vtkmprbasedata = vtkmprbasedata;
+}
+
+// ----------------------------------------------------------------------------
+vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
+{
+ return _vtkmprbasedata;
+}
+
+
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
+{
+ manualContourControler::InsertPoint( x, y, z );
+ _manualcontour3Vcontroler->InsertPoint_Others(0);
+}
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
+{
+ manualContourControler::AddPoint( x, y, z );
+ _manualcontour3Vcontroler->AddPoint_Others();
+}
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
+{
+ int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
+ manualContourControler::DeleteActualMousePoint( x , y );
+ _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
+}
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::MouseMove( int x, int y )
+{
+ _flagMouseMove = true;
+ int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
+ if ((this->GetState()!=7) && (ss!=1)){
+ manualContourControler::MouseMove( x , y );
+ int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
+ if (id!=-1)
+ {
+ _manualcontour3Vcontroler->MouseMove_Others(id);
+ _flagMouseMove = false;
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
+{
+ _manualcontour3Vcontroler = manualcontour3Vcontroler;
+}
+// ----------------------------------------------------------------------------
+manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
+{
+ return _manualcontour3Vcontroler;
+}
+// ----------------------------------------------------------------------------
+bool manualContourPerpPlaneControler::OnChar() // virtual
+{
+ if (manualContourControler::OnChar()==false )
+ {
+ _manualcontour3Vcontroler->OnChar_Others();
+ }
+ return true;
+}
+// ----------------------------------------------------------------------------
+bool manualContourPerpPlaneControler::OnMouseMove() // virtual
+{
+ manualContourControler::OnMouseMove();
+ return _flagMouseMove;
+}
+// ----------------------------------------------------------------------------
+bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
+{
+ manualContourControler::OnLeftDClick();
+ return _flagMouseDClick;
+}
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::ResetContour() // virtual
+{
+ manualContourControler::ResetContour();
+ _manualcontour3Vcontroler->ResetContour_Others();
+}
+
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
+{
+ _flagMouseDClick=true;
+ manualContourControler::MouseDLeft(x,y);
+
+ if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
+ {
+ _flagMouseDClick = false;
+ _vtkinteractorstyleplane2D->OnLeftDClick();
+ ResetOrientationPlane();
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+
+// int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
+// if ( (GetState()==0) && (id!=-1) )
+// {
+// manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
+// _vtkmprbasedata->SetX( mp->GetX() );
+// _vtkmprbasedata->SetY( mp->GetY() );
+// _vtkmprbasedata->SetZ( mp->GetZ() );
+// ResetOrientationPlane();
+// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+// }
+}
+
+
+
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::ResetOrientationPlane()
+{
+ double p[3],rp[3],rn[3];
+ p[0] = _vtkmprbasedata->GetX( );
+ p[1] = _vtkmprbasedata->GetY( );
+ p[2] = _vtkmprbasedata->GetZ( );
+ this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
+
+ _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
+}
+
+// ----------------------------------------------------------------------------
+void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
+{
+ _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
+}
+// ----------------------------------------------------------------------------
+InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
+{
+ return _vtkinteractorstyleplane2D;
+}
+
--- /dev/null
+#ifndef manualContourPerpPlaneControler_h
+#define manualContourPerpPlaneControler_h
+
+#include "manualContourControler.h"
+#include "manualContour3VControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContourPerpPlaneControler: public manualContourControler
+{
+public:
+ manualContourPerpPlaneControler();
+ virtual ~manualContourPerpPlaneControler();
+ virtual manualContourPerpPlaneControler * Clone();
+ void CopyAttributesTo( manualContourPerpPlaneControler *cloneObject );
+
+ void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
+ vtkMPRBaseData *GetVtkMPRBaseData();
+
+ virtual bool OnChar();
+ virtual bool OnMouseMove();
+ virtual bool OnLeftDClick();
+ virtual void AddPoint( int x, int y, int z );
+ virtual void DeleteActualMousePoint(int x, int y);
+ virtual void MouseMove(int x, int y);
+ virtual void InsertPoint(int x, int y, int z);
+ virtual void ResetContour();
+
+ void SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler);
+ manualContour3VControler *GetManualContour3VControler();
+
+ virtual void MouseDLeft( int x, int y);
+ void ResetOrientationPlane();
+ void SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D);
+ InteractorStyleMaracas * GetVtkInteractorStylePlane2D();
+
+private:
+ bool _flagMouseMove;
+ bool _flagMouseDClick;
+ InteractorStyleMaracas *_vtkinteractorstyleplane2D;
+
+protected:
+ vtkMPRBaseData *_vtkmprbasedata;
+ manualContour3VControler *_manualcontour3Vcontroler;
+};
+
+
+#endif // manualContourPerpPlaneControler_h
--- /dev/null
+#include "manualLineControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// 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();
+}
--- /dev/null
+#ifndef manualLineControler_h
+#define manualLineControler_h
+
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// 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;
+};
+
+#endif // manualLineControler_h
--- /dev/null
+#include "manualPoint.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualPoint::manualPoint()
+{
+}
+// ----------------------------------------------------------------------------
+manualPoint::~manualPoint()
+{
+}
+// ----------------------------------------------------------------------------
+void manualPoint::SetPoint(double x,double y,double z){
+ _x=x;
+ _y=y;
+ _z=z;
+}
+// ----------------------------------------------------------------------------
+void manualPoint::SetPointX(double x){
+ _x=x;
+}
+// ----------------------------------------------------------------------------
+void manualPoint::SetPointY(double y){
+ _y=y;
+}
+// ----------------------------------------------------------------------------
+void manualPoint::SetPointZ(double z){
+ _z=z;
+}
+// ----------------------------------------------------------------------------
+double manualPoint::GetX(){
+ return _x;
+}
+// ----------------------------------------------------------------------------
+double manualPoint::GetY(){
+ return _y;
+}
+// ----------------------------------------------------------------------------
+double manualPoint::GetZ(){
+ return _z;
+}
+// ----------------------------------------------------------------------------
+manualPoint * manualPoint :: Clone()
+{
+ manualPoint * clone = new manualPoint();
+ clone->SetPoint( GetX(), GetY(), GetZ());
+ return clone;
+}
--- /dev/null
+#ifndef manualPoint_h
+#define manualPoint_h
+
+class manualPoint
+{
+public:
+ manualPoint();
+ virtual ~manualPoint();
+ void SetPoint(double x,double y,double z);
+ void SetPointX(double x);
+ void SetPointY(double y);
+ void SetPointZ(double z);
+ double GetX();
+ double GetY();
+ double GetZ();
+ virtual manualPoint * Clone();
+
+private:
+ double _x;
+ double _y;
+ double _z;
+};
+
+#endif // manualPoint_h
--- /dev/null
+#include "manualRoiControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// _state = 0 // ..nothing..
+// _state = 5 // move point
+// _state = 6 // move all
+// _state = 7 // Empty mouse drag
+
+manualRoiControler::manualRoiControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualRoiControler::~manualRoiControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualRoiControler * manualRoiControler :: Clone() // virtual
+{
+ manualRoiControler * clone = new manualRoiControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualRoiControler::Configure() //virtual
+{
+ this->GetManualContourModel()->SetNumberOfPointsSpline(5);
+}
+
+// ----------------------------------------------------------------------------
+
+void manualRoiControler::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);
+ }
+
+ // if the firs time create 4 control points and move one point
+ 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(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);
+ }
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+*/
+
+ GetManualViewBaseContour()->Refresh();
+}
+
+// ----------------------------------------------------------------------------
+void manualRoiControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+
+// this->_vtkInteractorStyleBaseView->
+
+
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+
+
+ if ( (GetState()==5) || (GetState()==1) ){
+ 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){
+ GetManualViewBaseContour()->MoveContour(x,y,z);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+void manualRoiControler::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);
+ AddPoint(0,0,zz);
+ AddPoint(0,0,zz);
+ }
+
+ double pp1=porcentage;
+ double pp2=1-porcentage;
+
+ mp = GetManualContourModel()->GetManualPoint(2);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp1,hh*pp1,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(3);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp1,hh*pp2,zz);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+ GetManualViewBaseContour() ->UpdateViewPoint(2);
+ GetManualViewBaseContour() ->UpdateViewPoint(3);
+
+ SetState(0);
+ GetManualViewBaseContour()->Refresh();
+}
+
+// ----------------------------------------------------------------------------
+void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
+{
+ manualPoint *mp;
+ InitRoi( 0 , 0 , 0.2 );
+ mp = GetManualContourModel()->GetManualPoint(2);
+ mp->SetPointX(x1);
+ mp->SetPointY(y1);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ mp->SetPointX(x2);
+ mp->SetPointY(y1);
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ mp->SetPointX(x2);
+ mp->SetPointY(y2);
+
+ mp = GetManualContourModel()->GetManualPoint(3);
+ mp->SetPointX(x1);
+ mp->SetPointY(y2);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+ GetManualViewBaseContour() ->UpdateViewPoint(2);
+ GetManualViewBaseContour() ->UpdateViewPoint(3);
+}
+
--- /dev/null
+#ifndef manualRoiControler_h
+#define manualRoiControler_h
+
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualRoiControler: public manualContourControler
+{
+public:
+ manualRoiControler();
+ virtual ~manualRoiControler();
+ virtual manualRoiControler * Clone();
+ void CopyAttributesTo( manualRoiControler *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);
+ void SetRoi(int x1, int y1,int x2, int y2);
+ virtual void Configure();
+
+
+private:
+ int bakIdPoint;
+};
+
+
+#endif // manualRoiControler_h
--- /dev/null
+#include "manualView3DContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+manualView3DContour::manualView3DContour()
+{
+}
+// ----------------------------------------------------------------------------
+manualView3DContour::~manualView3DContour()
+{
+}
+
+// ----------------------------------------------------------------------------
+manualView3DContour * manualView3DContour :: Clone()
+{
+ manualView3DContour * clone = new manualView3DContour();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
+{
+ // Fathers object
+ manualViewContour::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetDimensions ( _w , _h , _d );
+}
+// ----------------------------------------------------------------------------
+void manualView3DContour::SetDimensions(int w, int h, int d)
+{
+ _w = w;
+ _h = h;
+ _d = d;
+}
+// ----------------------------------------------------------------------------
+void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
+{
+ X = _vtkmprbasedata->GetX();
+ Y = _vtkmprbasedata->GetY();
+ Z = _vtkmprbasedata->GetZ();
+}
+// ----------------------------------------------------------------------------
+void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
+{
+ _vtkmprbasedata = vtkmprbasedata;
+}
+// ----------------------------------------------------------------------------
+int manualView3DContour::GetIdPoint2(int x, int y)
+{
+ int id = -1;
+ double p[3],pA[3],pB[3];
+
+ double pickPoint[ 3 ], cameraPos[ 3 ];
+ vtkPointPicker* picker = vtkPointPicker::New( );
+ vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
+ picker->Pick( x, y, 0.0, pRenderer );
+ pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
+ picker->GetPickPosition( pickPoint );
+ picker->Delete( );
+
+ UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
+ utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
+
+ if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
+ {
+ double dist,distMin=999999999;
+ int i,size=this->_manContModel->GetSizeLstPoints();
+ for (i=0;i<size;i++)
+ {
+ manualPoint *mp = this->_manContModel->GetManualPoint(i);
+ p[0] = mp->GetX();
+ p[1] = mp->GetY();
+ p[2] = mp->GetZ();
+ dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
+ if ( (dist<=2*GetRange()) && (dist<distMin) )
+ {
+ distMin = dist;
+ id = i;
+ }
+ }
+ }
+ return id;
+}
+// ----------------------------------------------------------------------------
+int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
+{
+ SelectAllPossibleSelected(false);
+ int id=GetIdPoint2(x,y);
+ if (id!=-1)
+ {
+ SetPointPosibleSelected(id,true);
+ }
+ return id;
+}
+
--- /dev/null
+#ifndef manualView3DContour_h
+#define manualView3DContour_h
+
+#include "manualViewContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class manualView3DContour: public manualViewContour
+{
+public:
+ manualView3DContour();
+ virtual ~manualView3DContour();
+ virtual manualView3DContour * Clone();
+ void CopyAttributesTo( manualView3DContour *cloneObject );
+
+ virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type);
+ void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
+
+ virtual int SelectPosiblePoint ( int x, int y, int z );
+ void SetDimensions(int w, int h, int d);
+
+ int GetIdPoint2(int x, int y);
+
+protected:
+ vtkMPRBaseData *_vtkmprbasedata;
+private:
+ int _w;
+ int _h;
+ int _d;
+
+};
+
+
+#endif // manualView3DContour_h
--- /dev/null
+#include "manualView3VContour.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualView3VContour::manualView3VContour(int type)
+{
+ _type=type;
+// JSTG 25-02-08 ------------------------------
+ //_manContModel= new manualContourModel();
+//---------------------------------------------
+}
+// ----------------------------------------------------------------------------
+manualView3VContour::~manualView3VContour()
+{
+}
+
+
+
+// ----------------------------------------------------------------------------
+manualView3VContour * manualView3VContour :: Clone()
+{
+ manualView3VContour * clone = new manualView3VContour( GetType() );
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
+{
+ // Fathers object
+ manualViewContour::CopyAttributesTo(cloneObject);
+}
+
+int manualView3VContour::GetType()
+{
+ return _type;
+}
+
+// ----------------------------------------------------------------------------
+void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
+{
+ if (_type==0)
+ {
+ x=-1000;
+ }
+ if (_type==1)
+ {
+ y=500;
+ }
+ if (_type==2)
+ {
+ z=-1000;
+ }
+}
+// ----------------------------------------------------------------------------
+
+void manualView3VContour::RefreshContour() // virtula
+{
+ manualViewContour::RefreshContour();
+ int i;
+ double pp[3];
+// JSTG 25-02-08 ----------------------------------------
+ //int nps = GetNumberOfPointsSpline();
+ int nps = _manContModel->GetNumberOfPointsSpline();
+//-------------------------------------------------------
+ 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] );
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+
+void manualView3VContour::UpdateViewPoint(int id){ // virtual
+ double x,y,z;
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ x=mp->GetX();
+ y=mp->GetY();
+ z=mp->GetZ();
+
+ FilterCordinateXYZ(x,y,z);
+ _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
+}
+
+// ----------------------------------------------------------------------------
+
+int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
+{
+ int ii=-1;
+ if (_manContModel!=NULL){
+ double xx=x;
+ double yy=y;
+ double zz=z;
+ TransfromeCoordViewWorld(xx,yy,zz,-1);
+ ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
+ }
+ return ii;
+}
+
+// ----------------------------------------------------------------------------
+bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
+ bool result=false;
+ double xx=x;
+ double yy=y;
+ double zz=z;
+ double ppA[3];
+ double ppB[3];
+ double d1,d2,d3;
+ TransfromeCoordViewWorld(xx,yy,zz,-1);
+
+//EED 27 sep 2006
+ xx = xx * _spc[0];
+ yy = yy * _spc[1];
+ zz = zz * _spc[2];
+
+ unsigned int i, nps,nps_t;
+ nps = _sizePointsContour;
+ if (this->_manContModel->IfCloseContour()==true)
+ {
+ nps_t = nps;
+ } else {
+ nps_t = nps-1;
+ }
+ FilterCordinateXYZ(xx,yy,zz);
+
+ for( i = 0; i < nps_t; i++ ) {
+ _pts->GetPoint(i%nps, ppA);
+ _pts->GetPoint((i+1)%nps, ppB);
+ FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
+ FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
+ 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) ) {
+ result=true;
+ i=nps;
+ }
+ }
+ return result;
+}
--- /dev/null
+#ifndef manualView3VContour_h
+#define manualView3VContour_h
+
+#include "manualViewContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class manualView3VContour: public manualViewContour
+{
+public:
+ manualView3VContour(int type);
+ virtual ~manualView3VContour();
+ virtual manualView3VContour * Clone();
+ void CopyAttributesTo( manualView3VContour *cloneObject );
+
+ virtual void RefreshContour();
+ virtual int GetIdPoint(int x, int y, int z);
+ virtual void UpdateViewPoint(int id);
+ virtual bool ifTouchContour(int x,int y,int z);
+ int GetType();
+
+protected:
+private:
+ int _type;
+ void FilterCordinateXYZ(double &x,double &y,double &z);
+
+// JSTG 25-02-08 -------------------------------------
+ //manualContourModel *_manContModel;
+//----------------------------------------------------
+
+};
+
+#endif // manualView3VContour_h
--- /dev/null
+#include "manualViewBaseContour.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualViewBaseContour::manualViewBaseContour()
+{
+ _show_text = true;
+ _textActor = NULL;
+ _manContModel = NULL;
+ _wxvtkbaseview = NULL;
+ _selected = false;
+ _posibleSelected = false;
+ _viewControlPoints = false;
+ _pts = NULL;
+ _pd = NULL;
+ _contourVtkActor = NULL;
+ _bboxMapper = NULL;
+ _range = 1;
+ _sizePointsContour = 100;
+ _spc[0] = 1;
+ _spc[1] = 1;
+ _spc[2] = 1;
+
+ _coulorEdit_r = 1;
+ _coulorEdit_g = 1;
+ _coulorEdit_b = 0;
+
+ _coulorNormal_r = 1;
+ _coulorNormal_g = 0;
+ _coulorNormal_b = 1;
+
+ _coulorSelection_r = 0;
+ _coulorSelection_g = 1;
+ _coulorSelection_b = 0;
+
+ _widthline = 1;
+
+}
+// ----------------------------------------------------------------------------
+manualViewBaseContour::~manualViewBaseContour()
+{
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size; i++){
+ delete _lstViewPoints[i];
+ }
+ _lstViewPoints.clear();
+}
+// ----------------------------------------------------------------------------
+
+
+int manualViewBaseContour::GetType() // virtual
+{
+// Information...
+//int manualViewBaseContour::GetType() 0;
+//int manualViewContour::GetType() 1;
+//int manualViewRoi::GetType() 2;
+//int manualViewCircle::GetType() 3;
+//int manualViewStar::GetType() 4;
+//int manualViewLine::GetType() 6;
+
+
+ return 0;
+}
+// ----------------------------------------------------------------------------
+
+void manualViewBaseContour::Save(FILE *pFile)
+{
+ fprintf(pFile,"TypeView %d\n", GetType() );
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::Open(FILE *pFile)
+{
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
+{
+ _viewControlPoints = ifControlPoints;
+ /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
+ //Adding the spline
+ AddSplineActor();
+
+ AddTextActor();
+ //Adding each control point
+ if( ifControlPoints )
+ AddControlPoints();
+ RefreshContour();
+ Refresh();
+}
+// ---------------------------------------------------------------------------
+
+void manualViewBaseContour :: RemoveCompleteContourActor()
+{
+ /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
+ //Removing the spline
+ RemoveSplineActor();
+ RemoveTextActor();
+
+ //Removing each point
+ RemoveControlPoints();
+ RefreshContour();
+ Refresh();
+}
+// ---------------------------------------------------------------------------
+manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
+{
+ manualViewBaseContour * clone = new manualViewBaseContour();
+ CopyAttributesTo(clone);
+ return clone;
+
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
+{
+ // Fathers object
+ //XXXX::CopyAttributesTo(cloneObject);
+
+ cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
+ cloneObject-> SetSelected( this->GetSelected() );
+ cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
+ cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
+ cloneObject-> SetRange( this->GetRange() );
+ cloneObject-> SetZ( this->GetZ() );
+ 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 );
+
+ int i, size = _lstViewPoints.size();
+ for ( i=0; i<size; i++ )
+ {
+ cloneObject->AddPoint( );
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour :: AddSplineActor()
+{
+ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ if (_contourVtkActor!=NULL)
+ theRenderer->AddActor( _contourVtkActor );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour :: RemoveSplineActor() // virtual
+{
+ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ if (_contourVtkActor!=NULL)
+ theRenderer->RemoveActor( _contourVtkActor );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour :: RemoveControlPoints()
+{
+ if (_wxvtkbaseview!=NULL){
+ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size; i++)
+ {
+ vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
+ theRenderer->RemoveActor( pointActor );
+ } // for
+ } // if
+ SetIfViewControlPoints( false );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::AddControlPoints()
+{
+ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ SetIfViewControlPoints( true );
+ if( _viewControlPoints )
+ {
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size; i++)
+ {
+ vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
+ theRenderer->AddActor( pointActor );
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::AddTextActor()
+{
+ _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::RemoveTextActor()
+{
+ _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::DeleteVtkObjects()
+{
+ if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
+ if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
+ if ( _pts != NULL ) { _pts -> Delete(); }
+ if ( _pd != NULL ) { _pd -> Delete(); }
+ _contourVtkActor = NULL;
+ _bboxMapper = NULL;
+ _pts = NULL;
+ _pd = NULL;
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetWidthLine(double width)
+{
+ _widthline = width;
+ this->UpdateColorActor();
+
+ // for the control points
+ int id, size = _lstViewPoints.size();
+ for( id=0; id<size; id++)
+ {
+ this->_lstViewPoints[id]->SetWidthLine(_widthline);
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+double manualViewBaseContour::GetWidthLine()
+{
+ return _widthline;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::ConstructVTKObjects()
+{
+//JSTG 29-02-08 -----------------------------------------------
+ //int i , nps = _sizePointsContour;
+ int i;
+ int nps = _manContModel->GetNumberOfPointsSpline();
+//-------------------------------------------------------------
+ DeleteVtkObjects();
+ _pts = vtkPoints::New();
+ _pts->SetNumberOfPoints(nps);
+
+ for (i=0 ; i<nps ; i++){
+ _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 );
+
+
+ vtkCellArray *lines = vtkCellArray::New();
+ lines->InsertNextCell( nps /* +1 */ );
+ for ( i=0 ; i<nps+1 ; i++ ){
+ lines->InsertCellPoint(i % nps );
+ }
+
+ _pd = vtkPolyData::New();
+ _pd->SetPoints( _pts );
+ _pd->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+
+ _contourVtkActor = vtkActor::New();
+ _bboxMapper = vtkPolyDataMapper::New();
+ _bboxMapper->ScalarVisibilityOff( );
+
+ _bboxMapper->SetInput(_pd);
+ _bboxMapper->ImmediateModeRenderingOn();
+ _contourVtkActor->SetMapper(_bboxMapper);
+ _contourVtkActor->GetProperty()->BackfaceCullingOff();
+
+ UpdateColorActor();
+
+ _pd->ComputeBounds();
+
+ // Text
+ _textActor = vtkTextActor::New();
+// _textActor->SetDisplayPosition(200, 200);
+ _textActor->SetInput("00");
+ // Set coordinates to match the old vtkScaledTextActor default value
+// _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
+// _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
+ _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
+// _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
+
+ vtkTextProperty *tprop = _textActor->GetTextProperty();
+ tprop->SetFontSize(14);
+ tprop->SetFontFamilyToArial();
+ tprop->SetColor(0, 0, 1);
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::CreateNewContour()
+{
+ ConstructVTKObjects();
+ /*
+ _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
+ _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
+ AddCompleteContourActor();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UpdateViewPoint(int id) // virtual
+{
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+
+//EEDx6
+ double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
+// wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
+// wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
+
+ _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UpdateViewPoints()
+{
+ int id, size = _lstViewPoints.size();
+ for( id=0; id<size; id++)
+ {
+ UpdateViewPoint( id );
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::AddPoint()
+{
+ manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
+ AddPoint( mvp );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
+{
+ _lstViewPoints.push_back( manualViewPoint );
+
+ // EED 3 oct 2006
+ manualViewPoint->SetSpacing(_spc);
+
+ vtkActor *actor = manualViewPoint->CreateVtkPointActor();
+ _wxvtkbaseview->GetRenderer()->AddActor( actor );
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::InsertPoint(int id)
+{
+ manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
+
+// EED 3 oct 2006
+ mvp->SetSpacing(_spc);
+
+ std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
+ _lstViewPoints.insert(itNum,mvp);
+ _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::DeleteContour()
+{
+ RemoveCompleteContourActor();
+ /*if (_contourVtkActor!=NULL){
+ _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
+ }*/
+ DeleteVtkObjects();
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ manualViewBaseContour::DeletePoint(0);
+ }
+ Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::DeletePoint(int id) // virtual
+{
+ int size=_lstViewPoints.size();
+ if ( (id>=0) && (id<size) ){
+ manualViewPoint *mvp =_lstViewPoints[id];
+//EED ups1
+// _handlePicker->DeletePickList(mvp->GetVtkActor());
+ _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
+ std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
+ _lstViewPoints.erase(itNum);
+ delete mvp;
+ Refresh();
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::DeletePoint(int x, int y, int z)
+{
+ int id=GetIdPoint(x,y,z);
+ if (id!=-1){
+ DeletePoint(id);
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetSelected(bool selected)
+{
+ _selected=selected;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
+{
+ _posibleSelected=posibleSelected;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::GetEditable()
+{
+ return *_editable;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetEditable( bool * condition )
+{
+ _editable = condition;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::GetSelected()
+{
+ return _selected;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::GetPosibleSelected()
+{
+ return _posibleSelected;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::DeleteSelectedPoints()
+{
+ int i,size=_lstViewPoints.size();
+ for (i=size-1;i>=0;i--){
+ if (_lstViewPoints[i]->GetSelected()==true){
+ DeletePoint(i);
+ }
+ }
+ Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SelectPoint(int i, bool select)
+{
+ _lstViewPoints[i]->SetSelected(select);
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SelectLstPoints()
+{
+ // ToDo
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SelectAllPoints(bool select)
+{
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ SelectPoint(i,select);
+ }
+}
+//-----------------------------------------------------------------------------
+void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
+{
+ _viewControlPoints = ifShow;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour:: GetIfViewControlPoints()
+{
+ return _viewControlPoints;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
+{
+ _lstViewPoints[id]->SetPosibleSelected(select);
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetPointSelected(int id,bool select)
+{
+ _lstViewPoints[id]->SetSelected(select);
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SelectAllPossibleSelected(bool select)
+{
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ SetPointPosibleSelected(i,select);
+ }
+}
+// ----------------------------------------------------------------------------
+int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
+{
+ SelectAllPossibleSelected(false);
+
+ int id = GetIdPoint(x,y,z);
+ if (id!=-1)
+ {
+ SetPointPosibleSelected(id,true);
+ }
+ return id;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
+{
+ bool result=false;
+ SetPosibleSelected(result);
+ int id = GetIdPoint(x,y,z);
+ if( !GetEditable() && !_selected && id!= -1)
+ {
+ result=true;
+ SetPosibleSelected(result);
+ }
+ else
+ {
+ if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
+ {
+ if (ifTouchContour(x,y,z)==true)
+ {
+ result=true;
+ SetPosibleSelected(result);
+ }
+ }
+
+ if (GetEditable()==false)
+ {
+ if (ifTouchContour(x,y,z)==true)
+ {
+ result=true;
+ SetPosibleSelected(result);
+ }
+ }
+
+
+ }
+ return result;
+}
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
+{
+ return false;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UnSelectPoint(int i){
+ _lstViewPoints[i]->SetSelected(false);
+ Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UnSelectLstPoints(){
+ // ToDo
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UnSelectAllPoints(){
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ UnSelectPoint(i);
+ }
+ Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetModel(manualContourModel *manContModel){
+ _manContModel=manContModel;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
+ _wxvtkbaseview = wxvtkbaseview;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::RefreshContour() // Virtual
+{
+}
+// ----------------------------------------------------------------------------
+double* manualViewBaseContour::GetVectorPointsXManualContour(){
+ double pp[3];
+ int i,size = _sizePointsContour;
+ double *vx = (double*)malloc(sizeof(double)*size);
+ for (i=0;i<size;i++){
+ _pts->GetPoint(i,pp);
+ vx[i]=pp[0];
+ }
+ return vx;
+}
+// ----------------------------------------------------------------------------
+double* manualViewBaseContour::GetVectorPointsYManualContour()
+{
+ double pp[3];
+ int i,size = _sizePointsContour;
+ double *vy = (double*)malloc(sizeof(double)*size);
+ for (i=0;i<size;i++){
+ _pts->GetPoint(i,pp);
+ vy[i]=pp[1];
+ }
+ return vy;
+}
+// ----------------------------------------------------------------------------
+double* manualViewBaseContour::GetVectorPointsZManualContour()
+{
+ double pp[3];
+ int i,size = _sizePointsContour;
+ double *vz = (double*)malloc(sizeof(double)*size);
+ for (i=0;i<size;i++){
+ _pts->GetPoint(i,pp);
+ vz[i]=pp[2];
+ }
+ return vz;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::Refresh() // virtual
+{
+ if (_contourVtkActor!=NULL){
+ RefreshContour();
+ }
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ UpdateViewPoint(i);
+ _lstViewPoints[i]->UpdateColorActor();
+ }
+ UpdateColorActor();
+
+ if (_show_text==true)
+ {
+ RefreshText();
+ }
+
+ vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
+ if (vri==NULL)
+ {
+ _wxvtkbaseview->GetRenWin()->Render();
+ }
+
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::RefreshText() // virtual
+{
+ if( _textActor!=NULL)
+ _textActor -> SetInput("00");
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
+{
+ _coulorNormal_r = r;
+ _coulorNormal_g = g;
+ _coulorNormal_b = b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
+{
+ r = _coulorNormal_r;
+ g = _coulorNormal_g;
+ b = _coulorNormal_b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
+{
+ _coulorEdit_r = r;
+ _coulorEdit_g = g;
+ _coulorEdit_b = b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
+{
+ r = _coulorEdit_r;
+ g = _coulorEdit_g;
+ b = _coulorEdit_b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
+{
+ _coulorSelection_r = r;
+ _coulorSelection_g = g;
+ _coulorSelection_b = b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
+{
+ r = _coulorSelection_r;
+ g = _coulorSelection_g;
+ b = _coulorSelection_b;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::UpdateColorActor()
+{
+ if (_contourVtkActor!=NULL)
+ {
+ _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
+ _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
+ if (_posibleSelected || (_posibleSelected && GetEditable() ) )
+ {
+ _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
+ }
+ if( _selected )
+ {
+ _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
+{
+ int ii = -1;
+ if (_manContModel!=NULL){
+ double xx = x;
+ double yy = y;
+ double zz = z;
+ TransfromeCoordViewWorld(xx,yy,zz);
+ ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
+ }
+ return ii;
+}
+
+// ----------------------------------------------------------------------------
+
+
+int manualViewBaseContour::GetNumberOfPoints()
+{
+ return _lstViewPoints.size();
+}
+
+// ----------------------------------------------------------------------------
+
+//JSTG 25-02-08 ---------------------------------------------------------------
+/*int manualViewBaseContour::GetNumberOfPointsSpline()
+{
+ return _sizePointsContour;
+}*/
+//----------------------------------------------------------------------------
+
+//JSTG 25-02-08 ---------------------------------------------------------------
+/*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
+{
+ _sizePointsContour = size;
+}*/
+//----------------------------------------------------------------------------
+// virtual
+void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
+{
+ _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
+
+
+//EED 27 sep 2007
+// //EEDx6
+// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
+// wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
+
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetRange(int range)
+{
+ _range=range;
+}
+// ----------------------------------------------------------------------------
+int manualViewBaseContour::GetRange()
+{
+ return _range;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetZ(int z)
+{
+// _Z=z;
+}
+// ----------------------------------------------------------------------------
+int manualViewBaseContour::GetZ()
+{
+// return _Z;
+ return 0;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
+{
+
+}
+// ----------------------------------------------------------------------------
+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;
+ int i;
+ int size=_manContModel->GetSizeLstPoints();
+ minX=99999;
+ minY=99999;
+ maxX=-99999;
+ maxY=-99999;
+ bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
+ if ( ifFindZ )
+ {
+ minZ=99999;
+ maxZ=-99999;
+ }
+ 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)
+ {
+ minX=pp[0];
+ }
+ //min Y
+ if (pp[1]<minY)
+ {
+ minY=pp[1];
+ }
+ //max X
+ if (pp[0]>maxX)
+ {
+ maxX=pp[0];
+ }
+ // max Y
+ if (pp[1]>maxY)
+ {
+ maxY=pp[1];
+ }
+ if ( ifFindZ )
+ {
+ // min Z
+ if (pp[2]<minZ)
+ {
+ minZ=pp[2];
+ }
+ // max Z
+ if (pp[2]>maxZ)
+ {
+ maxZ=pp[2];
+ }
+ }
+ }
+ if ( size<1 )
+ {
+ minX = 0;
+ maxX = 0;
+
+ minY = 0;
+ maxY = 0;
+
+ minZ = 0;
+ maxZ = 0;
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::ClearContour()
+{
+ if (_contourVtkActor!=NULL){
+ _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
+ }
+ DeleteVtkObjects();
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ ClearPoint(0);
+ }
+ Refresh();
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::ClearPoint(int id)
+{
+ DeletePoint(id);
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetVisible(bool ok)
+{
+ double opacity;
+ if (ok==true)
+ {
+ opacity=1;
+ } else {
+ opacity=0.5;
+ }
+ vtkActor *actor;
+ int i,size=_lstViewPoints.size();
+ for (i=0;i<size;i++){
+ actor = _lstViewPoints[i]->GetVtkActor();
+ actor->GetProperty()->SetOpacity( opacity );
+ }
+ _contourVtkActor->GetProperty()->SetOpacity( opacity );
+ _textActor->GetProperty()->SetOpacity( opacity );
+ _textActor->SetInput("00");
+
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetShowText(bool ok)
+{
+ _show_text = ok;
+ if (_show_text==false)
+ {
+ _textActor->SetInput("00");
+ }
+}
+// ----------------------------------------------------------------------------
+wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
+{
+ return this->_wxvtkbaseview;
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::GetSpacing(double spc[3])
+{
+ spc[0] = _spc[0];
+ spc[1] = _spc[1];
+ spc[2] = _spc[2];
+}
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetSpacing(double spc[3])
+{
+ _spc[0] = spc[0];
+ _spc[1] = spc[1];
+ _spc[2] = spc[2];
+}
--- /dev/null
+#ifndef manualViewBaseContour_h
+#define manualViewBaseContour_h
+
+#include "vtkRenderWindow.h"
+
+#include "vtkRenderer.h"
+#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
+#include "vtkCommand.h"
+#include "vtkPolyData.h"
+#include "vtkCellArray.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkInteractorObserver.h"
+#include "vtkInteractorStyleImage.h"
+#include <vtkKochanekSpline.h>
+
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkCellArray.h>
+#include <vtkRenderer.h>
+#include <vtkCoordinate.h>
+#include <vtkTextProperty.h>
+#include <vtkTextActor.h>
+#include <vtkProperty2D.h>
+#include <vtkPointPicker.h>
+#include "widgets/UtilVtk3DGeometriSelection.h"
+
+#include <vtkCellPicker.h>
+
+
+#include <vtkCamera.h>
+#include <vtkPolyLine.h>
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "wxVTKRenderWindowInteractor.h"
+
+
+//--
+
+#include <vector>
+#include "wxVtkBaseView.h"
+#include "marTypes.h"
+
+#include "manualViewPoint.h"
+#include "manualContourModel.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT manualViewBaseContour{
+public:
+ manualViewBaseContour();
+ virtual ~manualViewBaseContour();
+
+ virtual int GetType();
+ virtual void Save(FILE *pFile);
+ virtual void Open(FILE *pFile);
+
+ void AddPoint();
+ void AddPoint( manualViewPoint * manualViewPoint );
+ void InsertPoint(int id);
+ void DeleteContour();
+ void DeletePoint(int x, int y,int z);
+ virtual void DeletePoint(int id);
+
+ virtual void UpdateViewPoint(int id);
+ virtual void UpdateViewPoints();
+
+ void SetSelected(bool selected);
+ void SetPosibleSelected(bool posibleSelected);
+ bool GetSelected();
+ bool GetPosibleSelected();
+ void DeleteSelectedPoints();
+ bool GetEditable();
+ void SetEditable( bool * condition );
+
+
+
+ virtual int GetIdPoint(int x, int y, int z);
+
+ void SelectPoint(int i,bool select);
+ void SelectLstPoints();
+ void SelectAllPoints(bool select);
+ virtual int SelectPosiblePoint(int x, int y ,int z);
+ bool SelectPosibleContour(int x, int y ,int z);
+ void SelectAllPossibleSelected(bool select);
+ void SetPointSelected(int id,bool select);
+ void SetPointPosibleSelected(int id,bool select);
+ void SetIfViewControlPoints(bool ifShow);
+ bool GetIfViewControlPoints();
+
+ void UnSelectPoint(int i);
+ void UnSelectLstPoints();
+ void UnSelectAllPoints();
+
+ void SetModel(manualContourModel *manContModel);
+ void SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
+
+ virtual void Refresh();
+ int GetNumberOfPoints(); // ???
+ //int GetNumberOfPointsSpline(); //JSTG 25-02-08 In ContourModel is the same method
+ //void SetNumberOfPointsSpline(int size); //JSTG 25-02-08 In ContourModel is the same method
+
+ void CreateNewContour();
+ double* GetVectorPointsXManualContour();
+ double* GetVectorPointsYManualContour();
+ double* GetVectorPointsZManualContour();
+
+ virtual bool ifTouchContour(int x,int y, int z);
+ void UpdateColorActor();
+
+ void SetRange(int range);
+ int GetRange();
+ void SetZ(int z);
+ int GetZ();
+
+ wxVtkBaseView *GetWxVtkBaseView();
+
+ virtual void InitMove(int x, int y, int z);
+ virtual void MoveContour(int x, int y, int z);
+ virtual void MoveContour(int horizontalUnits, int verticalUnits );
+ virtual void GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ );
+ virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type=2);
+
+ void ClearContour();
+ virtual void ClearPoint(int id);
+
+ void SetVisible(bool ok);
+ void SetShowText(bool ok);
+
+ void GetSpacing(double spc[3]);
+ void SetSpacing(double spc[3]);
+
+ void SetColorNormalContour(double r, double g, double b);
+ void GetColorNormalContour(double &r, double &g, double &b);
+ void SetColorEditContour(double r, double g, double b);
+ void GetColorEditContour(double &r, double &g, double &b);
+ void SetColorSelectContour(double r, double g, double b);
+ void GetColorSelectContour(double &r, double &g, double &b);
+
+ //Addinging and removing from visualization specific actors included in the viewer contour
+ void AddCompleteContourActor( bool ifControlPoints = false);
+ void RemoveCompleteContourActor();
+ virtual void AddSplineActor();
+ virtual void RemoveSplineActor();
+ void AddControlPoints();
+ void RemoveControlPoints();
+ void AddTextActor();
+ void RemoveTextActor();
+
+ virtual manualViewBaseContour * Clone();
+ void CopyAttributesTo( manualViewBaseContour *cloneObject );
+ virtual void RefreshContour();
+ void SetWidthLine(double width);
+ double GetWidthLine();
+
+ virtual void ConstructVTKObjects();
+
+private:
+ int _range;
+
+ wxVtkBaseView *_wxvtkbaseview;
+ bool _selected;
+ bool *_editable;
+ bool _posibleSelected;
+ bool _viewControlPoints;
+
+
+ vtkPolyData *_pd;
+ vtkActor *_contourVtkActor;
+ vtkPolyDataMapper *_bboxMapper;
+
+ double _coulorEdit_r;
+ double _coulorEdit_g;
+ double _coulorEdit_b;
+ double _coulorNormal_r;
+ double _coulorNormal_g;
+ double _coulorNormal_b;
+ double _coulorSelection_r;
+ double _coulorSelection_g;
+ double _coulorSelection_b;
+ double _widthline;
+
+ void DeleteVtkObjects();
+ virtual void RefreshText();
+
+
+protected:
+
+ // text
+ bool _show_text;
+ int _id_viewPoint_for_text;
+ vtkTextActor *_textActor;
+ manualContourModel *_manContModel;
+ vtkPoints *_pts;
+// JSTG 25-02-08 --------------------------------------------
+ int _sizePointsContour;
+//-----------------------------------------------------------
+ std::vector<manualViewPoint*> _lstViewPoints;
+ double _spc[3];
+
+};
+
+
+#endif // manualViewBaseContour_h
--- /dev/null
+#include "manualViewBullEye.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualViewBullEye::manualViewBullEye()
+{
+}
+
+// ----------------------------------------------------------------------------
+manualViewBullEye::~manualViewBullEye()
+{
+ // BullEye(s)
+ int i,size=lstSectorBullEye.size();
+ for (i=0;i<size;i++)
+ {
+ delete lstSectorBullEye[i];
+ }
+ lstSectorBullEye.clear();
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewBullEye * manualViewBullEye :: Clone()
+{
+ manualViewBullEye * clone = new manualViewBullEye();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
+{
+ // Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+
+// ----------------------------------------------------------------------------
+int manualViewBullEye::GetType() // virtual
+{
+ return 4;
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewBullEye::RefreshContour() // virtual
+{
+ // External Rectangle
+ manualViewRoi::RefreshContour();
+
+ _manContModel->UpdateSpline();
+ int np = GetNumberOfPoints( );
+ // Refres sectors of BullEye(s)
+
+ if (np>=2 )
+ {
+ int i,size = lstSectorBullEye.size();
+ for (i=0;i<size;i++)
+ {
+ lstSectorBullEye[i]->RefreshContour();
+ } // for
+ } // if
+
+
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBullEye::ConstructVTKObjects() // virtual
+{
+ manualViewRoi::ConstructVTKObjects();
+
+ double spc[3];
+ this->GetSpacing(spc);
+ manualViewBullEyeSector *mvbc;
+ manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
+ int i,size = mcmbe->GetSizeOfSectorLst();
+ for ( i=0 ; i<size ; i++ )
+ {
+ mvbc = new manualViewBullEyeSector();
+ mvbc->SetModel( mcmbe->GetModelSector(i) );
+ mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
+ mvbc->SetRange( 2 );
+ mvbc->SetZ( 1000 );
+ mvbc->SetSpacing(spc);
+ mvbc->SetColorNormalContour(1, 0, 0);
+// mvbc->SetColorEditContour(0.5, 0.5, 0.5);
+// mvbc->SetColorSelectContour(1, 0.8, 0);
+ mvbc->SetWidthLine( this->GetWidthLine() );
+//EED004
+ mvbc->ConstructVTKObjects();
+ lstSectorBullEye.push_back( mvbc );
+ }
+
+
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBullEye::AddSplineActor() // virtual
+{
+ manualViewRoi::AddSplineActor();
+ int i,size=lstSectorBullEye.size();
+ for (i=0;i<size;i++)
+ {
+ lstSectorBullEye[i]->AddSplineActor();
+ }
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBullEye::RemoveSplineActor() // virtual
+{
+ manualViewRoi::RemoveSplineActor();
+ int i,size=lstSectorBullEye.size();
+ for (i=0;i<size;i++)
+ {
+ lstSectorBullEye[i]->RemoveSplineActor();
+ }
+}
--- /dev/null
+#ifndef manualViewBullEye_h
+#define manualViewBullEye_h
+
+#include "manualViewRoi.h"
+#include "manualViewBullEyeSector.h"
+#include "manualContourModelBullEye.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+//EED004
+class creaMaracasVisu_EXPORT manualViewBullEye: public manualViewRoi
+{
+public:
+ manualViewBullEye();
+ virtual ~manualViewBullEye();
+
+ virtual int GetType();
+ virtual manualViewBullEye * Clone();
+ void CopyAttributesTo( manualViewBullEye *cloneObject );
+
+// void UpdateColorActorBullEye();
+// void DeleteVtkObjectsBullEye();
+ virtual void RemoveSplineActor();
+ virtual void AddSplineActor();
+ virtual void ConstructVTKObjects();
+ virtual void RefreshContour();
+
+private:
+
+/*EED Borrame
+ std::vector<sectorBullEye* > lstSectorBullEye;
+*/
+
+ std::vector<manualViewBaseContour* > lstSectorBullEye;
+
+};
+
+
+#endif // manualViewBullEye_h
--- /dev/null
+#include "manualViewBullEyeSector.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+manualViewBullEyeSector::manualViewBullEyeSector()
+{
+}
+
+// ----------------------------------------------------------------------------
+void manualViewBullEyeSector::RefreshContour()
+{
+//EED004
+ int i,nps;
+ double x,y,z;
+//----------------------------------
+
+ _manContModel->UpdateSpline();
+ nps = _manContModel->GetNumberOfPointsSpline();
+
+ if ( _pts!=NULL )
+ {
+ 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
+ }
+
+}
--- /dev/null
+#ifndef manualViewBullEyeSector_h
+#define manualViewBullEyeSector_h
+
+#include "manualViewContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+class creaMaracasVisu_EXPORT manualViewBullEyeSector: public manualViewContour
+{
+public:
+ manualViewBullEyeSector();
+ virtual void RefreshContour();
+};
+
+#endif // manualViewBullEyeSector_h
--- /dev/null
+#include "manualViewCircle.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// EED08
+
+manualViewCircle::manualViewCircle()
+{
+// _sizePointsContour=5; // default 100
+}
+// ----------------------------------------------------------------------------
+manualViewCircle::~manualViewCircle()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewCircle * manualViewCircle :: Clone()
+{
+ manualViewCircle * clone = new manualViewCircle();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
+{
+ // Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+
+// ----------------------------------------------------------------------------
+/*
+void manualViewCircle::RefreshContour(){ // virtual
+
+ manualPoint *mpA,*mpB;
+ unsigned int i, np,nps;
+ double angle,radio;
+ double difX,difY;
+ double XX,YY,ZZ;
+ np = GetNumberOfPoints( );
+ nps = _manContModel->GetNumberOfPointsSpline();
+ double deltaAngle=(3.14159265*2)/(nps-1);
+ if ( np > 0)
+ {
+ if (np==2)
+ {
+ mpA = _manContModel->GetManualPoint(0);
+ mpB = _manContModel->GetManualPoint(1);
+ difX = mpA->GetX() - mpB->GetX();
+ difY = mpA->GetY() - mpB->GetY();
+ radio = sqrt( difX*difX + difY*difY );
+ manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
+ manContModelCir->SetRadio(radio);
+
+ for( i = 0; i < nps; i++ ) {
+ manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
+// angle = deltaAngle*i;
+// 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] );
+ } // rof
+ } else {
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
+ } // if
+ }
+}
+*/
+
+// ----------------------------------------------------------------------------
+int manualViewCircle::GetType() // virtual
+{
+ return 3;
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
+{
+ manualPoint *mpA,*mpB;
+ unsigned int np;
+ double radio;
+ double difX,difY;
+ np = GetNumberOfPoints( );
+ if (np==2)
+ {
+ mpA = _manContModel->GetManualPoint(0);
+ mpB = _manContModel->GetManualPoint(1);
+ difX = mpA->GetX() - mpB->GetX();
+ difY = mpA->GetY() - mpB->GetY();
+ radio = sqrt( difX*difX + difY*difY );
+ minX=mpA->GetX()-radio;
+ minY=mpA->GetY()-radio;
+ maxX=mpA->GetX()+radio;
+ maxY=mpA->GetY()+radio;
+ } else {
+ minX=0;
+ maxX=0;
+ minY=0;
+ maxY=0;
+ }
+}
+
+/*
+// ----------------------------------------------------------------------------
+bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
+{
+ bool result=false;
+ double px1=99999,py1=99999,px2=-9999,py2=-99999;
+
+ GetMinMax(px1,py1, px2, py2);
+
+ double xx=x;
+ double yy=y;
+ double zz=z;
+ TransfromeCoordViewWorld(xx,yy,zz);
+
+ bool ok1=false;
+ bool ok2=false;
+ double ddx=GetRange();
+ double ddy=GetRange();
+
+ if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
+ {
+ ok1=true;
+ }
+
+ if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
+ {
+ ok2=true;
+ }
+
+ if ((ok1==true) && (ok2==false))
+ {
+ result=true;
+ }
+
+ return result;
+}
+*/
+
+// ----------------------------------------------------------------------------
+
+void manualViewCircle::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();
+/*
+ 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();
+*/
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewCircle::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]);
+
+// 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);
+
+}
--- /dev/null
+#ifndef manualViewCircle_h
+#define manualViewCircle_h
+
+#include "manualViewContour.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// EED08
+class creaMaracasVisu_EXPORT manualViewCircle: public manualViewContour
+{
+public:
+ manualViewCircle();
+ virtual ~manualViewCircle();
+
+ virtual int GetType();
+ virtual manualViewCircle * Clone();
+ void CopyAttributesTo( manualViewCircle *cloneObject );
+
+ 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);
+
+private:
+ double _dp0[3];
+ double _dp1[3];
+};
+
+
+#endif // manualViewCircle_h
--- /dev/null
+#include "manualViewContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualViewContour::manualViewContour()
+{
+ _id_viewPoint_for_text = 0;
+ _mesureScale = 1;
+ _initialConoturModel = new manualContourModel();
+}
+// ----------------------------------------------------------------------------
+manualViewContour::~manualViewContour()
+{
+ delete _initialConoturModel;
+}
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+manualViewContour * manualViewContour :: Clone()
+{
+ manualViewContour * clone = new manualViewContour();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
+{
+ // Call to Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetMesureScale(_mesureScale);
+}
+
+// ---------------------------------------------------------------------------
+
+int manualViewContour::GetType() // virtual
+{
+ return 1;
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewContour::Save(FILE *pFile)
+{
+ manualViewBaseContour::Save(pFile);
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewContour::Open(FILE *pFile)
+{
+}
+
+
+
+// ----------------------------------------------------------------------------
+void manualViewContour::RefreshContour() // virtual
+{
+
+ int i,np,nps;
+
+//JSTG 25-02-08 --------------------
+ //double t,delta, x,y,z;
+ double x,y,z;
+//----------------------------------
+
+ _manContModel->UpdateSpline();
+ np = GetNumberOfPoints( );
+ //nps = GetNumberOfPointsSpline();
+ nps = _manContModel->GetNumberOfPointsSpline();
+ //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
+
+
+ if ( _pts!=NULL )
+ {
+ if (np>=2 )
+ {
+ for( i = 0; i < nps; i++ )
+ {
+//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] );
+
+
+ }// for
+ }
+ else
+ {
+ _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];
+ char resultText[50];
+ strcpy(resultText," ");
+ if (size==2)
+ {
+ strcpy(resultText,"L= ");
+ gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
+ strcat(resultText,text);
+ }
+ if (size>2)
+ {
+ if (_manContModel->IfCloseContour()==true)
+ {
+ strcpy(resultText,"P= ");
+ gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
+ strcat(resultText,text);
+ gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
+ strcat(resultText," A= ");
+ strcat(resultText,text);
+ } else {
+ strcpy(resultText,"L= ");
+ gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
+ strcat(resultText,text);
+ }
+ }
+
+ _textActor->SetInput(resultText);
+
+ if (size>=1){
+
+ int i;
+ for (i=0; i<size; i++)
+ {
+ if (_lstViewPoints[i]->GetPosibleSelected()==true)
+ {
+ _id_viewPoint_for_text = i;
+ }
+ }
+
+ int id = _id_viewPoint_for_text;
+ double px = _manContModel->GetManualPoint(id)->GetX();
+ double py = _manContModel->GetManualPoint(id)->GetY();
+
+ //EED 27 sep 2006
+ px=px*_spc[0];
+ py=py*_spc[1];
+
+ _textActor->SetPosition(px+GetRange()+1,py);
+ }
+
+ }
+}
+
+// ----------------------------------------------------------------------------
+bool manualViewContour::ifTouchContour(int x,int y,int z){
+ bool result=false;
+ double xx=x;
+ double yy=y;
+ double zz=z;
+ double ppA[3];
+ double ppB[3];
+ double d1,d2,d3;
+ TransfromeCoordViewWorld(xx,yy,zz);
+
+//EED 27 sep 2006
+ xx = xx * _spc[0];
+ yy = yy * _spc[1];
+ zz = zz * _spc[2];
+
+ unsigned int i, nps,nps_t;
+ nps = _sizePointsContour;
+
+ if (this->_manContModel->IfCloseContour()==true)
+ {
+ nps_t = nps;
+ } else {
+ nps_t = nps-1;
+ }
+
+
+ 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) )
+ {
+ result=true;
+ i=nps;
+ }
+ }
+
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewContour::DeletePoint(int id) // virtual
+{
+ if (_lstViewPoints.size()>2)
+ {
+ manualViewBaseContour::DeletePoint( id );
+ }
+}
+// ----------------------------------------------------------------------------
+
+void manualViewContour::ClearPoint(int id)
+{
+ manualViewBaseContour::DeletePoint( id );
+}
+
+//-------------------------------------------------------------------
+void manualViewContour::SetMesureScale(double mesureScale)
+{
+ _mesureScale = mesureScale;
+}
+//-------------------------------------------------------------------
+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)
+{
+ manualPoint *mpOrigin = NULL;
+ manualPoint *mpMoving = 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++ )
+ {
+ mpOrigin = _manContModel->GetManualPoint( i );
+ mpMoving = _initialConoturModel->GetManualPoint(i);
+ mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
+ }
+ UpdateViewPoints();
+}
+void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
+{
+ manualPoint *mpOrigin = NULL;
+
+ int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
+ for ( i=0; i<manualPointsSZ; i++ )
+ {
+ mpOrigin = _manContModel->GetManualPoint( i );
+ mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
+ }
+ UpdateViewPoints();
+}
--- /dev/null
+#ifndef manualViewContour_h
+#define manualViewContour_h
+
+#include "manualContourModel.h"
+#include "manualViewBaseContour.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualViewContour: public manualViewBaseContour
+{
+public:
+ manualViewContour();
+ virtual ~manualViewContour();
+ virtual manualViewContour * Clone();
+ void CopyAttributesTo( manualViewContour *cloneObject );
+
+ virtual int GetType();
+ virtual void Save(FILE *pFile);
+ virtual void Open(FILE *pFile);
+
+
+ virtual 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);
+ virtual void MoveContour(int horizontalUnits, int verticalUnits );
+ virtual void DeletePoint(int id);
+ virtual void ClearPoint(int id);
+ void SetMesureScale(double mesureScale);
+private:
+ double _mesureScale;
+ std::vector< std::vector<double> > _initialMovingPoints;
+ manualContourModel * _initialConoturModel;
+
+ virtual void RefreshText();
+protected:
+
+};
+
+#endif // manualViewContour_h
--- /dev/null
+#include "manualViewLine.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// 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);
+}
+
--- /dev/null
+#ifndef manualViewLine_h
+#define manualViewLine_h
+
+#include "manualViewContour.h"
+
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+class creaMaracasVisu_EXPORT manualViewLine: public manualViewContour
+{
+public:
+ manualViewLine();
+ virtual ~manualViewLine();
+
+ virtual int GetType();
+ virtual manualViewLine * Clone();
+ void CopyAttributesTo( manualViewLine *cloneObject );
+
+ 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];
+};
+
+#endif // manualViewLine_h
--- /dev/null
+#include "manualViewPoint.h"
+
+
+// ---------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//int manualViewPoint::range=1;
+
+
+manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
+ _selected = false;
+ _posibleSelected = false;
+ _pts = NULL;
+ _pd = NULL;
+ _pointVtkActor = NULL;
+ _bboxMapper = NULL;
+ _wxvtkbaseview = wxvtkbaseview;
+ _spc[0] = 1;
+ _spc[1] = 1;
+ _spc[2] = 1;
+
+ _widthline = 1;
+
+}
+// ----------------------------------------------------------------------------
+manualViewPoint::~manualViewPoint(){
+ DeleteVtkObjects();
+}
+
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetWidthLine( double width)
+{
+ _widthline = width;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetSelected(bool selected){
+ _selected=selected;
+}
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetPosibleSelected(bool posibleSelected){
+ _posibleSelected=posibleSelected;
+}
+// ----------------------------------------------------------------------------
+bool manualViewPoint::GetSelected(){
+ return _selected;
+}
+// ----------------------------------------------------------------------------
+bool manualViewPoint::GetPosibleSelected(){
+ return _posibleSelected;
+}
+// ----------------------------------------------------------------------------
+void manualViewPoint::DeleteVtkObjects(){
+ if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
+ if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
+ if (_pts !=NULL) { _pts ->Delete(); }
+ if (_pd !=NULL) { _pd ->Delete(); }
+ _pointVtkActor = NULL;
+ _bboxMapper = NULL;
+ _pts = NULL;
+ _pd = NULL;
+}
+
+
+
+// ----------------------------------------------------------------------------
+vtkActor* manualViewPoint::CreateVtkPointActor()
+{
+ DeleteVtkObjects();
+
+ _pts = vtkPoints::New();
+ _pts->SetNumberOfPoints(8);
+
+ _pts->SetPoint(0, -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);
+ lines->InsertCellPoint(1);
+ lines->InsertCellPoint(2);
+ lines->InsertCellPoint(3);
+ lines->InsertCellPoint(0);
+ lines->InsertCellPoint(4);
+ lines->InsertCellPoint(5);
+ lines->InsertCellPoint(6);
+ lines->InsertCellPoint(7);
+ lines->InsertCellPoint(4);
+ lines->InsertCellPoint(0);
+ lines->InsertCellPoint(3);
+ lines->InsertCellPoint(7);
+ lines->InsertCellPoint(6);
+ lines->InsertCellPoint(2);
+ lines->InsertCellPoint(1);
+ lines->InsertCellPoint(5);
+
+ _pd = vtkPolyData::New();
+ _pd->SetPoints( _pts );
+ _pd->SetLines( lines );
+// lines->Delete(); //do not delete lines ??
+
+ _pointVtkActor = vtkActor::New();
+ _bboxMapper = vtkPolyDataMapper::New();
+
+ _bboxMapper->SetInput(_pd);
+// _bboxMapper->ImmediateModeRenderingOn();
+ _pointVtkActor->SetMapper(_bboxMapper);
+// _pointVtkActor->GetProperty()->BackfaceCullingOn();
+ UpdateColorActor();
+// _pd->ComputeBounds();
+
+ return _pointVtkActor;
+}
+// ----------------------------------------------------------------------------
+vtkActor* manualViewPoint::GetVtkActor(){
+ return _pointVtkActor;
+}
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
+{
+// double range=0.2; // i_range;
+// double range=(double)manualViewPoint::range;
+
+ double range=i_range;
+
+//EED 27 sep 2006
+ x = x * _spc[0];
+ y = y * _spc[1];
+ posZ = posZ * _spc[2];
+
+ if (_pts!=NULL){
+ _pts->SetPoint(0, x-range, y+range, posZ-range);
+ _pts->SetPoint(1, x+range, y+range, posZ-range);
+ _pts->SetPoint(2, x+range, y-range, posZ-range);
+ _pts->SetPoint(3, x-range, y-range, posZ-range);
+ _pts->SetPoint(4, x-range, y+range, posZ+range);
+ _pts->SetPoint(5, x+range, y+range, posZ+range);
+ _pts->SetPoint(6, x+range, y-range, posZ+range);
+ _pts->SetPoint(7, x-range, y-range, posZ+range);
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewPoint::UpdateColorActor()
+{
+ if (_pointVtkActor!=NULL){
+//EED03
+ _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
+ _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
+ if (_posibleSelected==true){
+ _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
+ }
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewPoint::GetSpacing(double spc[3])
+{
+ spc[0] = _spc[0];
+ spc[1] = _spc[1];
+ spc[2] = _spc[2];
+}
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetSpacing(double spc[3])
+{
+ _spc[0] = spc[0];
+ _spc[1] = spc[1];
+ _spc[2] = spc[2];
+}
+
--- /dev/null
+#ifndef manualViewPoint_h
+#define manualViewPoint_h
+
+#include "vtkRenderWindow.h"
+
+#include "vtkRenderer.h"
+#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
+#include "vtkCommand.h"
+#include "vtkPolyData.h"
+#include "vtkCellArray.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkInteractorObserver.h"
+#include "vtkInteractorStyleImage.h"
+#include <vtkKochanekSpline.h>
+
+#include <vtkCellPicker.h>
+
+
+#include <vtkCamera.h>
+#include <vtkPolyLine.h>
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "wxVTKRenderWindowInteractor.h"
+
+
+//--
+
+#include <vector>
+#include "wxVtkBaseView.h"
+#include "marTypes.h"
+
+//--------------------------------------------------------
+
+class manualViewPoint{
+public:
+
+// static int range;
+
+ manualViewPoint(wxVtkBaseView *wxvtkbaseview);
+ ~manualViewPoint();
+ void SetSelected(bool selected);
+ void SetPosibleSelected(bool posibleSelected);
+ bool GetSelected();
+ bool GetPosibleSelected();
+ void DeleteVtkObjects();
+ vtkActor* CreateVtkPointActor();
+ void SetPositionXY(double x, double y, double range, double posZ);
+ vtkActor* GetVtkActor();
+ void UpdateColorActor();
+ void GetSpacing(double spc[3]);
+ void SetSpacing(double spc[3]);
+ void SetWidthLine( double width);
+
+
+private:
+ bool _selected;
+ bool _posibleSelected;
+ vtkPoints *_pts;
+ vtkPolyData *_pd;
+ vtkActor *_pointVtkActor;
+ vtkPolyDataMapper *_bboxMapper;
+ wxVtkBaseView *_wxvtkbaseview;
+ double _widthline;
+protected:
+ double _spc[3];
+};
+
+#endif // manualViewPoint_h
--- /dev/null
+#include "manualViewRoi.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualViewRoi::manualViewRoi()
+{
+ _sizePointsContour=5;
+}
+// ----------------------------------------------------------------------------
+manualViewRoi::~manualViewRoi()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewRoi * manualViewRoi :: Clone()
+{
+ manualViewRoi * clone = new manualViewRoi();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
+{
+ // Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualViewRoi::RefreshContour() // virtual
+{
+ unsigned int i,ii, np;
+ np = GetNumberOfPoints( );
+//EED01
+ if ( np > 0)
+ {
+ if (np>=2)
+ {
+ manualPoint *mp;
+ for( i = 0; i < np+1; i++ ) {
+ ii=i%np;
+ mp = _manContModel->GetManualPoint(ii);
+
+ //EEDx6
+ double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
+ // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
+ // 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] );
+ } // rof
+
+ } else {
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
+ } // if
+ }
+}
+
+// ----------------------------------------------------------------------------
+int manualViewRoi::GetType() // virtual
+{
+ return 2;
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
+{
+ double pp[3];
+ manualPoint *mp;
+ unsigned int i;
+
+ minX=99999;
+ minY=99999;
+ maxX=-99999;
+ maxY=-99999;
+
+ unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
+
+ for( i = 0; i < size; i++ )
+ {
+
+ mp=_manContModel->GetManualPoint(i);
+ pp[0]=mp->GetX();
+ pp[1]=mp->GetY();
+
+ // min X
+ if (pp[0]<minX)
+ {
+ minX=pp[0];
+ }
+ //min Y
+ if (pp[1]<minY)
+ {
+ minY=pp[1];
+ }
+ //max X
+ if (pp[0]>maxX)
+ {
+ maxX=pp[0];
+ }
+ // max Y
+ if (pp[1]>maxY)
+ {
+ maxY=pp[1];
+ }
+ }
+
+ if ( size<1 )
+ {
+ minX=0;
+ maxX=0;
+ minY=0;
+ maxY=0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+
+bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
+{
+ bool result=false;
+ double px1=99999,py1=99999,px2=-99999,py2=-99999;
+
+ GetMinMax(px1,py1, px2, py2);
+
+ double xx=x;
+ double yy=y;
+ double zz=z;
+ TransfromeCoordViewWorld(xx,yy,zz);
+
+ bool ok1=false;
+ bool ok2=false;
+ double ddx=GetRange();
+ double ddy=GetRange();
+
+ if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
+ {
+ ok1=true;
+ }
+
+ if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
+ {
+ ok2=true;
+ }
+
+ if ((ok1==true) && (ok2==false))
+ {
+ result=true;
+ }
+
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewRoi::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()==4){
+ 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();
+
+ 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();
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewRoi::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]);
+
+ 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);
+
+}
--- /dev/null
+#ifndef manualViewRoi_h
+#define manualViewRoi_h
+
+#include "manualViewContour.h"
+#include "manualPoint.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualViewRoi: public manualViewContour
+{
+public:
+ manualViewRoi();
+ virtual ~manualViewRoi();
+
+ virtual int GetType();
+ virtual manualViewRoi * Clone();
+ void CopyAttributesTo( manualViewRoi *cloneObject );
+
+ virtual 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);
+ void GetMinMax(double &minX,double &minY, double &maxX, double &maxY);
+
+private:
+ double _dp0[3];
+ double _dp1[3];
+ double _dp2[3];
+ double _dp3[3];
+};
+
+#endif // manualViewRoi_h
#ifndef MANUALVIEWPERPPLANECONTOUR_H_
#define MANUALVIEWPERPPLANECONTOUR_H_
-#include "manualContour.h"
+#include "manualViewPerpPlaneContour.h"
+#include "manualViewContour.h"
class manualViewPerpPlaneContour : public manualViewContour
{
Program: wxMaracas
Module: $RCSfile: wxMPRWidget.h,v $
Language: C++
- Date: $Date: 2009/05/14 13:54:35 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2009/05/15 12:59:25 $
+ Version: $Revision: 1.11 $
Copyright: (c) 2002, 2003
License:
//#include "kernel/marInterface.h"
-#include "manualContour.h"
+//#include "manualContour.h"
#include "wxMPRBaseData.h"
#include "wxVtkBaseView.h"
Program: wxMaracas
Module: $RCSfile: wxManualTree_MPRWidget.h,v $
Language: C++
- Date: $Date: 2009/05/14 13:54:35 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/15 12:59:25 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
#include "wxMPRWidget.h"
#include "wxMPRWidget2.h"
#include "manualViewPerpPlaneContour.h"
-#include "../manualContour.h"
+#include "manualContourModel.h"
+#include "manualContour3VControler.h"
+#include "manualView3VContour.h"
+#include "manualContour3V3DControler.h"
+#include "manualView3DContour.h"
+#include "manualContourPerpPlaneControler.h"
+#include "manualViewPerpPlaneContour.h"
#include <wx/notebook.h>
#include <wx/splitter.h>
#include <wx/checkbox.h>
-#include "manualContour.h"
+#include "manualContourControler.h"
+#include "manualContourModel.h"
+#include "manualViewContour.h"
#include "wxVtk2DBaseView.h"
class wxWidgetMesure2D : public wxSplitterWindow
#define WXWIDGETMESURE2D_PLANE_H_
#include "wxWidgetMesure2D.h"
+#include "wxVtk2DBaseView.h"
class wxWidgetMesure2D_Plane : public wxWidgetMesure2D
{