void GBlackBoxModel::move(double xx,double yy,double zz)
{
setInicPoint(xx,yy,zz);
- //std::cout<<"GBlackBoxModel::move xx:"<<xx<<" yy:"<<yy<<" zz:"<<zz<<std::endl;
//Refresh inputs position
int i;
//=========================================================================
- GPortModel* GBlackBoxModel::getStartInputPort()
+ GPortModel* GBlackBoxModel::getStartOutputPort()
{
GPortModel* temp = NULL;
for(int i=0; i<_inputs.size() && temp == NULL;i++)
{
- if(_inputs[i]->getState() == CREATING_CONTOUR)
+ if(_outputs[i]->getState() == CREATING_CONTOUR)
{
- temp = _inputs[i];
+ temp = _outputs[i];
}
}
int getNumInputPorts();
int getNumOutputPorts();
virtual void move(double xx,double yy,double zz);
- GPortModel* getStartInputPort();
+ GPortModel* getStartOutputPort();
private:
const int CREATING_CONTOUR=106;
// Object dimensions
- const double BOX_HEIGHT=0.15;
- const double BOX_WIDTH=1.0;
- const double PORT_HEIGHT=0.04;
- const double PORT_WIDTH=0.04;
+ const double BOX_HEIGHT=15;
+ const double BOX_WIDTH=100;
+ const double PORT_HEIGHT=3;
+ const double PORT_WIDTH=3;
// Commands
const int REPAINT = 201;
///// ******* TO ERASE *******
//JUST TO TEST
- //
-
-
-
+ //
+ /*
vtkConeSource *cone = vtkConeSource::New();
cone->SetResolution(10);
vtkPoints *_pts = vtkPoints::New();
_pts->SetNumberOfPoints(4);
- _pts->SetPoint(0, -1 , -1 , 0 );
- _pts->SetPoint(1, 1 , -1 , 0 );
- _pts->SetPoint(2, 1 , 1 , 0 );
- _pts->SetPoint(3, -1 , 1 , 0 );
+ _pts->SetPoint(0, -100 , -100 , 900 );
+ _pts->SetPoint(1, 100 , -100 , 900 );
+ _pts->SetPoint(2, 100 , 100 , 900 );
+ _pts->SetPoint(3, -100 , 100 , 900 );
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell(5);
getRenderer()->AddActor(_pointVtkActor);
- // Create a vector text
- vtkVectorText* vecText = vtkVectorText::New();
- vecText->SetText("vtkVectorText");
-
- vtkPolyDataMapper* txtMapper = vtkPolyDataMapper::New();
- txtMapper->SetInputConnection( vecText->GetOutputPort());
- vtkActor* txtActor = vtkActor::New();
- txtActor->SetMapper(txtMapper);
- //getRenderer()->AddActor(txtActor);
+
+
+ vtkPoints *_pts2 = vtkPoints::New();
+ _pts2->SetNumberOfPoints(4);
+
+ _pts2->SetPoint(0, -105 , -100 , -50 );
+ _pts2->SetPoint(1, 100 , -100 , -50 );
+ _pts2->SetPoint(2, 100 , 100 , -50 );
+ _pts2->SetPoint(3, -105 , 100 , -50 );
+
+ vtkCellArray *lines2 = vtkCellArray::New();
+ lines2->InsertNextCell(5);
+ lines2->InsertCellPoint(0);
+ lines2->InsertCellPoint(1);
+ lines2->InsertCellPoint(2);
+ lines2->InsertCellPoint(3);
+ lines2->InsertCellPoint(0);
+
+ vtkPolyData *_pd2 = vtkPolyData::New();
+ _pd2->SetPoints( _pts2 );
+ _pd2->SetLines( lines2 );
+
+ vtkActor *_pointVtkActor2 = vtkActor::New();
+ vtkPolyDataMapper* _bboxMapper2 = vtkPolyDataMapper::New();
+
+ _bboxMapper2->SetInput(_pd2);
+ _pointVtkActor2->SetMapper(_bboxMapper2);
+
+ getRenderer()->AddActor(_pointVtkActor2);
+
+ */
// ******* TO ERASE *******
/////////////////////
}
}
+
//=========================================================================
void wxVtkSceneManager::disconnectDrop()
{
iren->SetInteractorStyle(interactorstylebaseview);
interactorstylebaseview->SetwxVtkBaseView(_baseView);
+ double posCamera[3];
+ _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
+ _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0,0,1000);
+ _baseView->GetRenderer()->GetActiveCamera()->GetPosition(posCamera);
+ _baseView->GetRenderer()->ResetCamera();
+ _baseView->GetRenderer()->ResetCameraClippingRange();
+
+
_baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
_baseView->GetRenderer()->GradientBackgroundOff();
_baseView->Refresh();
-
}
//=========================================================================
double yy = windowHeight-y;
//z value is not important yet, because it is only used a parallel projection
- double zz = 0;
+ double zz = 900;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
int cantObjects = _objects.size();
cantObjects++;
std::stringstream stream;
- stream << "Object " << cantObjects;
+ stream << "Box " << cantObjects;
std::string arraystring = stream.str();
model->setBBTKName(arraystring);
void wxVtkSceneManager::createGConnector(GPortModel* startPort)
{
manualContourControler* manContourControl = new manualContourControler();
- manualViewContour* manViewerContour = new manualViewContour();
+ GConnectorView* manViewerContour = new GConnectorView();
manualContourModel* manContourModel = new manualContourModel();
manContourControl->SetModelView( manContourModel , manViewerContour );
manContourControl->Configure();
int i,sizeLstPoints = manContourModel->GetSizeLstPoints();
+ //std::cout<<"RaC wxVtkSceneManager::createGConnector "<<this<<" size:"<<sizeLstPoints<<std::endl;
for ( i=0; i<sizeLstPoints; i++ )
{
manViewerContour->AddPoint();
if(_objects[i]->getGObjectType() == GBLACKBOX)
{
- GPortModel* startInputPort=((GBlackBoxModel*)_objects[i])->getStartInputPort();
- createGConnector(startInputPort);
+ GPortModel* startOutputPort=((GBlackBoxModel*)_objects[i])->getStartOutputPort();
+ createGConnector(startOutputPort);
}
else
#include "GObjectsMVCFactory.h"
#include "Observer.h"
#include "GPortModel.h"
+#include "GConnectorView.h"
//Includes bbtk
#include <bbtkBlackBoxInputDescriptor.h>
#include <InteractorStyleMaracas.h>
#include <vtkInteractorStyleBaseView2D.h>
#include <manualContourControler.h>
-#include <manualViewContour.h>
#include <manualContourModel.h>
//Includes vtk
--- /dev/null
+/*=========================================================================
+Program: bbtk
+Module: $RCSfile$
+Language: C++
+Date: $Date$
+Version: $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+* This software is governed by the CeCILL-B license under French law and
+* abiding by the rules of distribution of free software. You can use,
+* modify and/ or redistribute the software under the terms of the CeCILL-B
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+* or in the file LICENSE.txt.
+*
+* As a counterpart to the access to the source code and rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty and the software's author, the holder of the
+* economic rights, and the successive licensors have only limited
+* liability.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */
+
+/**
+* \file
+* \brief Class bbtk::GConnectorView
+*/
+
+
+#include "GConnectorView.h"
+
+namespace bbtk
+{
+
+
+ //=========================================================================
+ GConnectorView::GConnectorView()
+ {
+ }
+
+ //=========================================================================
+ GConnectorView::~GConnectorView()
+ {
+ }
+ //=========================================================================
+
+ void GConnectorView::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type)
+ {
+ _wxvtkbaseview->TransCoordScreenToWorld(X,Y,Z,type);
+ }
+
+} // EO namespace bbtk
+
+// EOF
+
--- /dev/null
+/*=========================================================================
+Program: bbtk
+Module: $RCSfile$
+Language: C++
+Date: $Date$
+Version: $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+* This software is governed by the CeCILL-B license under French law and
+* abiding by the rules of distribution of free software. You can use,
+* modify and/ or redistribute the software under the terms of the CeCILL-B
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+* or in the file LICENSE.txt.
+*
+* As a counterpart to the access to the source code and rights to copy,
+* modify and redistribute granted by the license, users are provided only
+* with a limited warranty and the software's author, the holder of the
+* economic rights, and the successive licensors have only limited
+* liability.
+*
+* The fact that you are presently reading this means that you have had
+* knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */
+
+
+
+/**
+* \file
+* \brief Class bbtk::GConnectorView : abstract black-box interface.
+*/
+
+/**
+* \class bbtk::GConnectorView
+* \brief
+*/
+
+#ifndef __GConnectorView_h__
+#define __GConnectorView_h__
+
+//Includes same project
+
+//Includes creaMaracasVisu
+#include <manualViewContour.h>
+
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+ class GConnectorView : public manualViewContour
+ {
+
+ public:
+
+ //Constructors
+ GConnectorView();
+ ~GConnectorView();
+
+ //Public methods
+ virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
+
+ private:
+
+ //Attributes
+
+
+ //Private Methods
+
+ protected:
+ //Protected methods
+
+ };
+
+
+}
+// namespace bbtk
+#endif
+
int portType = ((GPortModel*)_model)->getPortType();
//Evaluate new state
- if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GINPUTPORT )
+ if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GOUTPUTPORT )
{
_model->setState(CREATING_CONTOUR);
_model->setChanged();
_model->getInicPoint(xInic,yInic,zInic);
_model->getFinalPoint(xFin, yFin,zFin);
- _pts->SetPoint(0, xInic, yInic, 0 );
- _pts->SetPoint(1, xInic, yFin, 0 );
- _pts->SetPoint(2, xFin, yFin, 0 );
- _pts->SetPoint(3, xFin, yInic, 0 );
+ // RaC In the actual version, zInic=zFin=900
+
+ _pts->SetPoint(0, xInic, yInic, zInic );
+ _pts->SetPoint(1, xInic, yFin, zInic );
+ _pts->SetPoint(2, xFin, yFin, zFin );
+ _pts->SetPoint(3, xFin, yInic, zFin );
//-----------
_model->getInicPoint(xInic,yInic,zInic);
_model->getFinalPoint(xFin, yFin,zFin);
- _pts->SetPoint(0, xInic, yInic, 0 );
- _pts->SetPoint(1, xInic, yFin, 0 );
- _pts->SetPoint(2, xFin, yFin, 0 );
- _pts->SetPoint(3, xFin, yInic, 0 );
+ // RaC In the actual version, zInic=zFin=900
+
+ _pts->SetPoint(0, xInic, yInic, zInic );
+ _pts->SetPoint(1, xInic, yFin, zInic );
+ _pts->SetPoint(2, xFin, yFin, zFin );
+ _pts->SetPoint(3, xFin, yInic, zFin );
lines->InsertNextCell(5);
lines->InsertCellPoint(0);
//------------
updatePositionTextActors( xInic, yInic, zInic);
+
_nameActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
_typeActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
void vtkGBlackBoxView::updatePositionTextActors(double xInic, double yInic, double zInic)
{
- _nameActor->SetPosition(xInic+0.04,yInic-0.05,zInic);
- _nameActor->SetScale(0.03,0.02,1);
+ _nameActor->SetPosition(xInic+4,yInic-5,zInic);
+ _nameActor->SetScale(3,2,1);
- _typeActor->SetPosition(xInic+0.04,yInic-0.1,zInic);
- _typeActor->SetScale(0.03,0.02,1);
+ _typeActor->SetPosition(xInic+4,yInic-10,zInic);
+ _typeActor->SetScale(3,2,1);
}
bool vtkGObjectView::isPointInside(int X,int Y) //virtual
{
- double xx=X,yy=Y,zz=0;
+ // RaC In the actual version, always z=900
+ double xx=X,yy=Y,zz=900;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
return _model->isPointInside(xx,yy,zz);
}
void vtkGObjectView::moveObject(int X,int Y) //virtual
{
- double xx=X,yy=Y,zz=0;
+ // RaC In the actual version, always z=900
+ double xx=X,yy=Y,zz=900;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
_model->getInicPoint(xInic,yInic,zInic);
_model->getFinalPoint(xFin, yFin,zFin);
- _pts->SetPoint(0, xInic, yInic, 0 );
- _pts->SetPoint(1, xInic, yFin, 0 );
- _pts->SetPoint(2, xFin, yFin, 0 );
- _pts->SetPoint(3, xFin, yInic, 0 );
+ // RaC In the actual version, zInic=zFin=900
+
+ _pts->SetPoint(0, xInic, yInic, zInic );
+ _pts->SetPoint(1, xInic, yFin, zInic );
+ _pts->SetPoint(2, xFin, yFin, zFin );
+ _pts->SetPoint(3, xFin, yInic, zFin );
_baseView->GetRenderer()->Render();
_baseView->GetRenWin()->Render();
_model->getInicPoint(xInic,yInic,zInic);
_model->getFinalPoint(xFin, yFin,zFin);
- _pts->SetPoint(0, xInic, yInic, 0 );
- _pts->SetPoint(1, xInic, yFin, 0 );
- _pts->SetPoint(2, xFin, yFin, 0 );
- _pts->SetPoint(3, xFin, yInic, 0 );
+ // RaC In the actual version, zInic=zFin=900
+ _pts->SetPoint(0, xInic, yInic, zInic );
+ _pts->SetPoint(1, xInic, yFin, zInic );
+ _pts->SetPoint(2, xFin, yFin, zFin );
+ _pts->SetPoint(3, xFin, yInic, zFin );
lines->InsertNextCell(5);
lines->InsertCellPoint(0);