namespace bbtk
{
//=========================================================================
-
GBoxModel::GBoxModel()
{
}
//=========================================================================
-
GBoxModel::~GBoxModel()
{
}
//=========================================================================
-
void GBoxModel::setInicPoint(double& x, double& y, double& z)
{
GObjectModel::setInicPoint(x,y,z);
}
//=========================================================================
-
void GBoxModel::addInputPort(GPortModel *inputport)
{
_inputs.push_back(inputport);
}
//=========================================================================
-
void GBoxModel::addOutputPort(GPortModel *outputport)
{
_outputs.push_back(outputport);
}
//=========================================================================
-
int GBoxModel::getNumInputPorts()
{
return _inputs.size();
}
//=========================================================================
-
int GBoxModel::getNumOutputPorts()
{
return _outputs.size();
}
//=========================================================================
-
void GBoxModel::move(double xx,double yy,double zz)
{
setInicPoint(xx,yy,zz);
-
//Refresh inputs position
int i;
for(i=0;i<(int)_inputs.size();i++)
{
_inputs[i]->updatePortPosition();
}
-
//Refresh outputs position
for(i=0;i<(int)_outputs.size();i++)
{
_outputs[i]->updatePortPosition();
}
-
}
//=========================================================================
-
std::string GBoxModel::getStatusText()
{
std::string temp = "";
}
//=========================================================================
-
std::vector<GPortModel*> GBoxModel::getInputPorts()
{
return _inputs;
}
//=========================================================================
-
std::vector<GPortModel*> GBoxModel::getOutputPorts()
{
return _outputs;
}
//=========================================================================
-
void GBoxModel::save(std::string &content)
{
content+="\n";
//=========================================================================
-
GPortModel* GBoxModel::getInputPort(std::string name)
{
for(int i = 0; i<(int)_inputs.size();i++)
}
//=========================================================================
-
GPortModel* GBoxModel::getOutputPort(std::string name)
{
for(int i = 0; i<(int)_outputs.size();i++)
}
//=========================================================================
-
GPortModel* GBoxModel::getInputPort(int pos)
{
return _inputs[pos];
}
-
//=========================================================================
GPortModel* GBoxModel::getOutputPort(int pos)
// Updates the position and finally the view of inputs and outputs
void updatePorts();
-
void addColons(std::string &text);
void removeColons(std::string &text);
-
private:
-
//Private Attributes
-
-
//Private Methods
-
protected:
//Protected Attributes
-
std::vector<GPortModel*> _inputs;
std::vector<GPortModel*> _outputs;
-
//Protected methods
-
};
virtual std::string getStatusText();
virtual void save(std::string &content);
-
private:
-
//Private Attributes
-
GBoxModel *_parentBox;
-
// Port type (INPUT/OUTPUT)
int _portType;
-
// The position of the port in the box
int _posInBox;
-
bool _isConnected;
-
std::string _value;
bool _isValueSet;
-
//Private Methods
-
protected:
//Protected methods
-
};
-
-
}
// namespace bbtk
#endif
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class GBoxController : public GObjectController
{
-
public:
-
//Constructors
GBoxController();
- ~GBoxController();
-
+ ~GBoxController();
//Public methods
-
-
-
private:
-
//Attributes
-
//Private Methods
-
protected:
-
// Methods from InteractorStyleMaracas
virtual bool OnMouseMove();
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
virtual bool OnMiddleButtonDown();
virtual bool OnRightButtonUp();
-
-
};
-
-
}
// namespace bbtk
#endif
//Includes std
#include <iostream>
-
-
namespace bbtk
{
-
class GConnectorController : public GObjectController
{
-
public:
-
//Constructors
GConnectorController();
~GConnectorController();
-
//Public methods
-
// Methods from InteractorStyleMaracas
virtual bool OnMouseMove();
virtual bool OnLeftButtonDown();
virtual bool OnRightButtonUp();
virtual bool OnMiddleButtonDown();
virtual bool OnMiddleButtonUp();
-
// Implementation of the creaMaracasVisu controller
manualConnectorContourController* getManualContourController();
void setManualContourController(manualConnectorContourController* controller);
-
virtual void removeFromScene();
-
// Reports the end in the contour creation
void endContourCreation();
-
private:
-
//Attributes
-
// Implementation of the creaMaracasVisu contour (manualContourControler) controller
manualConnectorContourController* _controller;
-
//Private Methods
-
protected:
//Protected methods
-
};
-
-
}
// namespace bbtk
#endif
#include <iostream>
namespace bbtk {
-
class GObjectController : public InteractorStyleMaracas {
public:
-
//Constructors
GObjectController( );
~ GObjectController( );
-
//Public methods
-
void setModelAndView( GObjectModel* model, vtkGObjectView* view );
-
// Same type of the saved in the model of the graphical objects
int getGObjectType( );
-
- GObjectModel* getModel( );
+ GObjectModel* getModel( );
vtkGObjectView* getView( );
-
std::string getStatusText( );
-
// Same ObjectID from the model
int getId( );
void setId( int id );
-
virtual void removeFromScene( );
-
private:
-
//Attributes
-
-
-
//Private Methods
-
protected:
-
//Protected Attributes
-
- GObjectModel *_model;
- vtkGObjectView *_view;
-
+ GObjectModel *_model;
+ vtkGObjectView *_view;
bool _isLeftClickDown;
-
//Protected Methods
-
// Methods from InteractorStyleMaracas
virtual bool OnMouseMove( );
virtual bool OnLeftButtonDown( );
virtual bool OnLeftButtonUp( );
virtual bool OnLeftDClick( );
virtual bool OnMiddleButtonDown( );
-
virtual void moveObject( int X, int Y );
-
};
-
-
}
// namespace bbtk
#endif
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class GPortController : public GObjectController
{
-
public:
-
//Constructors
GPortController();
~GPortController();
-
//Public methods
-
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
-
private:
-
//Attributes
-
-
//Private Methods
-
protected:
-
};
-
-
}
// namespace bbtk
#endif
_fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B);
_boxTextActor->GetTextProperty()->SetColor(BOXTEXT_SELECTED_R,BOXTEXT_SELECTED_G,BOXTEXT_SELECTED_B);
}
+
+ updateColorsPorts();
+
}
//=========================================================================
#include "vtkTextActor3D.h"
#include "vtkTextProperty.h"
-
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class vtkGBlackBoxView : public vtkGBoxView
{
-
public:
-
//Constructors
vtkGBlackBoxView();
~vtkGBlackBoxView();
-
//Public methods
-
private:
-
//Private Attributes
vtkTextActor3D *_boxTextActor;
-
//Private Methods
void updatePositionTextActor(double xInic, double yInic, double zInic);
-
protected:
-
//Protected Attributes
-
//Protected Methods
virtual void addVtkActors();
virtual void removeVtkActors();
virtual void createVtkObjects();
-
virtual void update(int idController,int command);
virtual void updateColors();
virtual void update_X_Fin();
-
+ protected:
};
-
-
}
// namespace bbtk
#endif
_TrianglesInputsPts = vtkPoints::New();
_TrianglesInputsPts->SetNumberOfPoints( 3*numberOfTriangles );
-//EED 2017-03-02
-// if (numberOfTriangles>0)
-// {
-// _TrianglesInputsPts->SetPoint(0, -1000, -1000, -1000 );
-// _TrianglesInputsPts->SetPoint(1, 1000, 1000, 1000 );
-// }
-
vtkCellArray *stripTrianglesInputs = vtkCellArray::New();
vtkPolyData *pdTrianglesInputs = vtkPolyData::New();
_TrianglesInputsPolyMapper = vtkPolyDataMapper::New();
}
// Create cell data
- vtkUnsignedCharArray *cellDataInputTriangles = vtkUnsignedCharArray::New();
- cellDataInputTriangles->SetNumberOfComponents(3);
- cellDataInputTriangles->SetNumberOfTuples(numberOfTriangles);
+ _cellDataInputTriangles = vtkUnsignedCharArray::New();
+ _cellDataInputTriangles->SetNumberOfComponents(3);
+ _cellDataInputTriangles->SetNumberOfTuples(numberOfTriangles);
for (int i = 0; i < numberOfTriangles; i++)
{
rgb[0] = 100;
rgb[1] = 100;
rgb[2] = 100;
- cellDataInputTriangles->SetTuple(i, rgb);
+ _cellDataInputTriangles->SetTuple(i, rgb);
} // for colors
- pdTrianglesInputs->GetCellData()->SetScalars(cellDataInputTriangles);
+ pdTrianglesInputs->GetCellData()->SetScalars( _cellDataInputTriangles );
pdTrianglesInputs->SetPoints( _TrianglesInputsPts );
pdTrianglesInputs->SetStrips( stripTrianglesInputs );
_TrianglesInputsPolyMapper->Modified();
-
///************************* Inputs Fill (triangles) *************************
///************************* Outputs Fill (triangles) *************************
_TrianglesOutputsPts = vtkPoints::New();
_TrianglesOutputsPts->SetNumberOfPoints( 3*numberOfTriangles );
-//EED 2017-03-02
-// if (numberOfTriangles>0)
-// {
-// _TrianglesOutputsPts->SetPoint(0, -1000, -1000, -1000 );
-// _TrianglesOutputsPts->SetPoint(1, 1000, 1000, 1000 );
-// }
-
vtkCellArray *stripTrianglesOutputs = vtkCellArray::New();
vtkPolyData *pdTrianglesOutputs = vtkPolyData::New();
_TrianglesOutputsPolyMapper = vtkPolyDataMapper::New();
stripTrianglesOutputs->InsertCellPoint(i*3+2);
} // for
// Create cell data
- vtkUnsignedCharArray *cellDataOutputTriangle = vtkUnsignedCharArray::New();
- cellDataOutputTriangle->SetNumberOfComponents(3);
- cellDataOutputTriangle->SetNumberOfTuples(numberOfTriangles);
+ _cellDataOutputTriangles = vtkUnsignedCharArray::New();
+ _cellDataOutputTriangles->SetNumberOfComponents(3);
+ _cellDataOutputTriangles->SetNumberOfTuples(numberOfTriangles);
for (int i = 0; i < numberOfTriangles; i++)
{
rgb[0] = 000;
rgb[1] = 255;
rgb[2] = 255;
- cellDataOutputTriangle->SetTuple(i, rgb);
+ _cellDataOutputTriangles->SetTuple(i, rgb);
} // for colors
- pdTrianglesOutputs->GetCellData()->SetScalars(cellDataOutputTriangle);
+ pdTrianglesOutputs->GetCellData()->SetScalars( _cellDataOutputTriangles );
pdTrianglesOutputs->SetPoints( _TrianglesOutputsPts );
pdTrianglesOutputs->SetStrips( stripTrianglesOutputs );
_TrianglesOutputsPolyMapper->SetInput( pdTrianglesOutputs );
void vtkGBoxView::updateColors()
{
+ printf("EED vtkGBoxView::updateColors\n");
_fillObjectActor->GetProperty()->SetAmbient(0.6);
if(_state==NOTHING_HAPPENS)
// _borderObjectActor->GetProperty()->SetLineWidth(2);
// _borderObjectActor->GetProperty()->SetColor(BOXBORDER_SELECTED_R,BOXBORDER_SELECTED_G,BOXBORDER_SELECTED_B);
_fillObjectActor->GetProperty()->SetColor(BOXFILL_SELECTED_R,BOXFILL_SELECTED_G,BOXFILL_SELECTED_B);
- }
+ } // if state box
+
+ updateColorsPorts();
}
+
//=========================================================================
+ void vtkGBoxView::updateColorsPorts()
+ {
+ // Input ports
+ float rgb[3];
+ vtkGPortView *portView;
+ GBoxModel *boxModel = (GBoxModel*)_model;
+ int numberOfTriangles = boxModel->getNumInputPorts();
+ for (int i=0 ; i<numberOfTriangles; i++)
+ {
+ portView = _inputsG[i];
+ portView->getColors(rgb);
+ rgb[0]=rgb[0]*255;
+ rgb[1]=rgb[1]*255;
+ rgb[2]=rgb[2]*255;
+ _cellDataInputTriangles->SetTuple(i, rgb);
+ } // for
+ numberOfTriangles = boxModel->getNumOutputPorts();
+ for (int i=0 ; i<numberOfTriangles; i++)
+ {
+ portView = _outputsG[i];
+ portView->getColors(rgb);
+ rgb[0]=rgb[0]*255;
+ rgb[1]=rgb[1]*255;
+ rgb[2]=rgb[2]*255;
+ _cellDataOutputTriangles->SetTuple(i, rgb);
+ } // for
+ }
+
+
+ //=========================================================================
void vtkGBoxView::updatePorts()
{
double xInic, yInic,zInic,xFin, yFin,zFin;
- GBoxModel* boxModel =(GBoxModel*)_model;
+ GBoxModel* boxModel = (GBoxModel*)_model;
boxModel->updatePorts();
// update position for one Actor that represents all InputPorts
- GPortModel *portModel;
+ GPortModel *portModel;
int numberOfTriangles = boxModel->getNumInputPorts();
for (int i=0;i<numberOfTriangles;i++)
{
- portModel= boxModel->getInputPort(i);
+ portModel = boxModel->getInputPort(i);
portModel->getInicPoint( xInic , yInic , zInic ) ;
portModel->getFinalPoint( xFin , yFin , zFin ) ;
// RaC In the actual version, zInic=zFin=GPOSITION_Z
}
//=========================================================================
+ void vtkGBoxView::addInputPort(vtkGPortView *inputport)
+ {
+ _inputsG.push_back(inputport);
+ }
+
+ //=========================================================================
+ void vtkGBoxView::addOutputPort(vtkGPortView *outputport)
+ {
+ _outputsG.push_back(outputport);
+ }
+
} // EO namespace bbtk
//Includes same project
#include "GlobalConstants.h"
#include "vtkGObjectView.h"
+#include "vtkGPortView.h"
#include "GBoxModel.h"
//Includes creaMaracasVisu
#include "vtkTextActor3D.h"
#include "vtkTextProperty.h"
-
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class vtkGBoxView : public vtkGObjectView
{
-
public:
-
//Constructors
vtkGBoxView();
~vtkGBoxView();
-
//Public methods
-
+ void addInputPort(vtkGPortView *inputport);
+ void addOutputPort(vtkGPortView *outputport);
private:
-
//Private Attributes
-
// Input Triangles
- vtkPoints *_TrianglesInputsPts;
- vtkPolyDataMapper *_TrianglesInputsPolyMapper;
- vtkActor *_TrianglesInputsActor;
+ vtkPoints *_TrianglesInputsPts;
+ vtkPolyDataMapper *_TrianglesInputsPolyMapper;
+ vtkActor *_TrianglesInputsActor;
+ vtkUnsignedCharArray *_cellDataInputTriangles; // input output port colors Color
// Output Triangles
- vtkPoints *_TrianglesOutputsPts;
- vtkPolyDataMapper *_TrianglesOutputsPolyMapper;
- vtkActor *_TrianglesOutputsActor;
-
+ vtkPoints *_TrianglesOutputsPts;
+ vtkPolyDataMapper *_TrianglesOutputsPolyMapper;
+ vtkActor *_TrianglesOutputsActor;
+ vtkUnsignedCharArray *_cellDataOutputTriangles; // input output port colors Color
//Private Methods
-
protected:
-
//Protected Attributes
-
+ //Protected Attributes
+ std::vector<vtkGPortView*> _inputsG;
+ std::vector<vtkGPortView*> _outputsG;
//Protected Methods
virtual void addVtkActors();
virtual void removeVtkActors();
virtual void createVtkObjects();
- void createVtkInputOutputPorts();
-
+ void createVtkInputOutputPorts();
virtual void update(int idController,int command);
virtual void updateColors();
+ void updateColorsPorts();
void updatePorts();
};
-
-
}
// namespace bbtk
#endif
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class vtkGConnectorView : public vtkGObjectView
{
-
public:
-
//Constructors
vtkGConnectorView();
~vtkGConnectorView();
-
//Public methods
void setManualContourView(manualViewContour* viewContour);
manualViewContour* getManualContourView();
void updateStartEndPoints();
-
private:
-
//Attributes
manualViewContour* manViewContour;
-
//Private Methods
-
protected:
//Protected methods
-
};
-
-
}
// namespace bbtk
#endif
namespace bbtk
{
-
//=========================================================================
vtkGObjectView::vtkGObjectView()
{
{
}
//=========================================================================
-
void vtkGObjectView::update(int idController,int command)//virtual
{
//virtual
}
//=========================================================================
-
void vtkGObjectView::setModel(GObjectModel *model)
{
_model = model;
}
//=========================================================================
-
void vtkGObjectView::setBaseView(wxVtkBaseView* baseView)
{
_baseView = baseView;
}
//=========================================================================
-
void vtkGObjectView::initVtkObjects()
{
createVtkObjects();
}
//=========================================================================
-
void vtkGObjectView::createVtkObjects() //virtual
{
//virtual
}
//=========================================================================
-
void vtkGObjectView::updateColors() //virtual
{
//virtual
}
//=========================================================================
-
void vtkGObjectView::addVtkActors()//virtual
{
_baseView->GetRenderer()->AddActor(_fillObjectActor);
}
//=========================================================================
-
void vtkGObjectView::removeVtkActors()//virtual
{
_baseView->GetRenderer()->RemoveActor(_fillObjectActor);
}
//=========================================================================
-
bool vtkGObjectView::isPointInside(int X,int Y) //virtual
{
// RaC In the actual version, always z=GPOSITION_Z
}
//=========================================================================
-
void vtkGObjectView::moveObject(int X,int Y) //virtual
{
-
// RaC In the actual version, always z=GPOSITION_Z
double xx=X,yy=Y,zz=GPOSITION_Z;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
dragDifY=yy-yInic;
}
_model->move(xx-dragDifX,yy-dragDifY,zz);
-
}
//=========================================================================
-
void vtkGObjectView::setStartDragging(bool param)
{
_isStartDragging=param;
}
//=========================================================================
-
void vtkGObjectView::setState(int state)
{
_state = state;
}
//=========================================================================
-
int vtkGObjectView::getState()
{
return _state;
}
//=========================================================================
-
void vtkGObjectView::setRefreshWaiting()
{
((vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView())->SetRefresh_waiting();
}
//=========================================================================
-
void vtkGObjectView::removeFromScene()
{
removeVtkActors();
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
-
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class vtkGObjectView : public Observer
{
-
public:
-
//Constructors
vtkGObjectView();
~vtkGObjectView();
-
//Public methods
-
void setModel(GObjectModel *model);
void setBaseView(wxVtkBaseView* baseView);
void initVtkObjects();
-
void setStartDragging(bool param);
-
void setState(int state);
int getState();
-
// Method to force a vtk refresh to the list of controllers of the wxVtkBaseView
void setRefreshWaiting();
-
virtual bool isPointInside(int X,int Y);
virtual void moveObject(int X, int Y);
-
virtual void removeFromScene();
-
virtual void update(int idController,int command);
-
//protected
virtual void createVtkObjects();
virtual void addVtkActors();
-
-
private:
-
//Private Attributes
- bool _isStartDragging;
-
+ bool _isStartDragging;
//Makes a difference between the first point clicked and the new position, in order to move the selected objects
- double dragDifX;
- double dragDifY;
-
-
+ double dragDifX;
+ double dragDifY;
//Private Methods
-
protected:
-
//Protected Attributes
-
wxVtkBaseView * _baseView;
GObjectModel * _model;
// vtkActor * _borderObjectActor;
vtkActor * _fillObjectActor;
vtkPolyDataMapper * _fillPolyMapper;
// vtkPolyDataMapper * _borderPolyMapper;
-
vtkPoints *_pts;
-
// State of the object (See GlobalConstants.h)
- int _state;
-
+ int _state;
//Protected Methods
virtual void removeVtkActors();
virtual void updateColors();
};
-
-
}
// namespace bbtk
#endif
///************************* FILL *************************
- vtkCellArray *strip = vtkCellArray::New( ) ;
- vtkPolyData *pdFill = vtkPolyData::New( ) ;
- _fillPolyMapper = vtkPolyDataMapper::New( ) ;
- _fillObjectActor = vtkActor::New( ) ;
+ vtkCellArray *strip = vtkCellArray::New( ) ;
+ vtkPolyData *pdFill = vtkPolyData::New( ) ;
+ _fillPolyMapper = vtkPolyDataMapper::New( ) ;
+ _fillObjectActor = vtkActor::New( ) ;
// RaC In the actual version, zInic=zFin=GPOSITION_Z
//=========================================================================
- void vtkGPortView::updateColors( ) {
- _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
+ void vtkGPortView::updateColors( )
+ {
+//EED2017-04-08
+ float rgb[3];
+ getColors(rgb);
+ _fillObjectActor->GetProperty( )->SetColor( rgb[0] , rgb[1] , rgb[2] ) ;
+ }
+
+ //=========================================================================
+//EED2017-04-08
+ void vtkGPortView::getColors(float* rgb)
+ {
+ rgb[0]=0.45; rgb[1]=0.45; rgb[2]=0.45;
if ( _state == POSSIBLE_CONNECTION ) {
- _fillObjectActor->GetProperty( )->SetColor( 1 , 1 , 0 ) ;
+ rgb[0]=1; rgb[1]=1; rgb[2]=0;
} else if ( _state == SELECTED_POSSIBLE_CONNECTION ) {
- _fillObjectActor->GetProperty( )->SetColor( 0 , 1 , 0 ) ;
+ rgb[0]=0; rgb[1]=1; rgb[2]=0;
} else if ( _state == HIGHLIGHTED ) {
- _fillObjectActor->GetProperty( )->SetColor( 0 , 0 , 1 ) ;
+ rgb[0]=0; rgb[1]=0; rgb[2]=1;
} else {
GPortModel* portm = ( GPortModel* ) _model ;
if ( portm->isConnected( ) ) {
- _fillObjectActor->GetProperty( )->SetColor( 0.15 , 0.15 , 0.15 ) ;
+ rgb[0]=0.15; rgb[1]=0.15; rgb[2]=0.15;
} else if ( portm->isValueSet( ) ) {
- _fillObjectActor->GetProperty( )->SetColor( 0.55 , 0.25 , 0.25 ) ;
+ rgb[0]=0.55; rgb[1]=0.25; rgb[2]=0.25;
} else {
- _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
- }
- }
- }
-
- //=========================================================================
-
+ rgb[0]=0.45; rgb[1]=0.45; rgb[2]=0.45;
+ } // if portm
+ } // if _state
+ }
} // EO namespace bbtk
#include "vtkRenderer.h"
#include "vtkCellArray.h"
-
//Includes std
#include <iostream>
-
namespace bbtk
{
-
class vtkGPortView : public vtkGObjectView
{
-
public:
//Constructors
vtkGPortView();
- ~vtkGPortView();
-
+ ~vtkGPortView();
//Public methods
virtual void update(int idController,int command);
+ void getColors(float* rgb);
+
private:
//Private Attributes
-
//Private Methods
-
protected:
//Protected Attributes
//Protected Methods
virtual void createVtkObjects();
virtual void updateColors();
};
-
-
}
// namespace bbtk
#endif
}
//=========================================================================
-wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() {
-
- printf("EED %p ~wxGUIEditorGraphicBBS()\n", this);
-
+wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS()
+{
//EED02JUIN2010 delete _tabsMgr;
-
_frameAUIMgr->UnInit();
// FCY memory leaks
delete _frameAUIMgr;
delete _notebook;
delete _tabsMgr;
-
}
//=========================================================================
//=========================================================================
-void wxGUIEditorGraphicBBS::refreshGUIControls() {
+void wxGUIEditorGraphicBBS::refreshGUIControls()
+{
std::string stundo;
std::string stredo;
//RaC2012 2ndHackFest Next line seems weird ... To keep in mind for other devels
wxToolBar* toolbar = GetToolBar();
- if (_tabsMgr->isActualDiagramComplexBox()) {
+ if (_tabsMgr->isActualDiagramComplexBox())
+ {
toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
//toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, true); RaC2012 2nd HackFest
toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, true);
void SetAuthor(std::string author);
void SetCategory(std::string category);
void SetDescription(std::string description);
- void SetMessageKind(std::string kind);
+ void SetMessageKind(std::string kind);
void SetMessageLevel(std::string level);
//Getters
std::string GetFullPath( );
std::string GetFileName( );
-
std::string GetCbName();
std::string GetCbPackageName();
std::string GetAuthor();
std::string GetDescription();
std::string GetCategory();
- std::string GetMessageKind();
+ std::string GetMessageKind();
std::string GetMessageLevel();
//=========================================================================
std::vector<std::string>::iterator _actualdo; // actual position on modifications vector
std::vector<std::string> sstates; // represents string of each modification of the tab. Maxixum size 100!!
std::vector<std::string>::iterator _sactualdo; // actual position onstring modifications vector
-
int _id;
wxAuiManager *_panelAUIMgr;
wxVtkSceneManager *_sceneManager;
wxTabPanelsManager *_panelsManager;
std::string _fullPath;
std::string _fileName;
-
protected:
Factory::Pointer _bbtkfactory;
void wxTabPanelsManager::VerifyLastTabPanel()
{
-printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
if (this->_notebook->GetPageCount()==0)
{
this->_actual=NULL;
void wxVtkSceneManager::disconnectDrop()
{
- printf("EED %p ~wxVtkSceneManager::disconnectDrop()\n", this);
//EED02JUIN2010 _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
// _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget( new tmpClasswxTextDropTarget() );
}
wxVtkSceneManager::~wxVtkSceneManager()
{
//FCY memory leaks
- printf("EED %p ~wxVtkSceneManager() START\n", this);
disconnectDrop();
delete _baseView;
- printf("EED %p ~wxVtkSceneManager() END\n", this);
}
//=========================================================================
model->addObserver(view);
model->addObserver(this);
+
+//EED2017 change order
+ //Associates the view with the correspondent renderer and the model.
+ //(NOTE: Refresh is only made by the view)
+ view->setModel(model);
+ view->setBaseView(_baseView);
+
+ //Associates the controller with the correspondent model and view
+ controller->setModelAndView(model, view);
+
+
//Iterate and create the input ports
std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap =
descriptor->GetInputDescriptorMap();
std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
int i = 0;
- for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) {
+ for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput)
+ {
BlackBoxInputDescriptor *desc = itInput->second;
- createGInputPort(GINPUTPORT, i, model, desc);
+//EED2017-04-07
+// createGInputPort(GINPUTPORT, i, model, desc);
+ createGInputPort(GINPUTPORT, i, controller, desc);
i++;
}
descriptor->GetOutputDescriptorMap();
std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
i = 0;
- for (itOutput = descriptorOutMap.begin(); itOutput
- != descriptorOutMap.end(); ++itOutput) {
+ for (itOutput = descriptorOutMap.begin(); itOutput!= descriptorOutMap.end(); ++itOutput)
+ {
BlackBoxOutputDescriptor *desc = itOutput->second;
- createGOutputPort(GOUTPUTPORT, i, model, desc);
+//EED2017-04-07
+// createGOutputPort(GOUTPUTPORT, i, model, desc);
+ createGOutputPort(GOUTPUTPORT, i, controller, desc);
i++;
}
- //Associates the view with the correspondent renderer and the model.
- //(NOTE: Refresh is only made by the view)
- view->setModel(model);
- view->setBaseView(_baseView);
-
+//EED2017 change order
view->initVtkObjects();
- //Associates the controller with the correspondent model and view
- controller->setModelAndView(model, view);
-
//Resgiter change to the observers of the actual model
model->notifyObservers(_idManager);
-
int newId = addObjectController(controller);
return newId;
//=========================================================================
-int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GBoxModel *blackBox, BlackBoxInputDescriptor *desc)
+//EED2017-04-08
+//int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GBoxModel *blackBox, BlackBoxInputDescriptor *desc)
+int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GObjectController *gBoxControler, BlackBoxInputDescriptor *desc)
{
+ GBoxModel *blackBox=(GBoxModel*)gBoxControler->getModel();
GPortController* portController = createGPort(portType, desc->GetName(),
desc->GetTypeName(), desc->GetDescription(), posinBox, blackBox);
- blackBox->addInputPort((GPortModel*) portController->getModel());
+ blackBox->addInputPort( (GPortModel*)portController->getModel() );
+
+ vtkGBoxView *vtkgboxView=(vtkGBoxView*)gBoxControler->getView();
+ vtkgboxView->addInputPort( (vtkGPortView*)portController->getView() );
+
return portController->getId();
}
//=========================================================================
-int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
+//EED2017-04-08
+//int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
+int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxOutputDescriptor *desc)
{
+ GBoxModel *blackBox=(GBoxModel*)gBoxControler->getModel();
GPortController* portController = createGPort(portType, desc->GetName(),
desc->GetTypeName(),desc->GetDescription(), posinBox, blackBox);
blackBox->addOutputPort((GPortModel*) portController->getModel());
+
+ vtkGBoxView *vtkgboxView=(vtkGBoxView*)gBoxControler->getView();
+ vtkgboxView->addOutputPort( (vtkGPortView*)portController->getView() );
+
return portController->getId();
}
int type = GPORT;
//Create the MVC Objects
- GPortModel
- *model =
- (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
- type);
- vtkGObjectView *view =
- GObjectsMVCFactory::getInstance()->createGObjectView(type);
- GObjectController* controller =
- GObjectsMVCFactory::getInstance()->createGObjectController(type);
-
+ GPortModel *model = (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+ vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+ GObjectController *controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
model->registerInBox(blackBox, portType, posInBox);
-
model->setBBTKType(bbtkType);
model->setBBTKName(bbtkName);
model->setBBTKDescription(bbtkDescription);
-
model->addObserver(view);
model->addObserver(this);
-
//Associates the view with the correspondent renderer and the model.
//(NOTE: Refresh is only made by the view)
view->setModel(model);
view->setBaseView(_baseView);
-
//EED017 view->initVtkObjects();
view->createVtkObjects();
// view->addVtkActors();
-
//Associates the controller with the correspondent model and view
controller->setModelAndView(model, view);
-
model->notifyObservers(_idManager);
-
addObjectController(controller);
-
return (GPortController*) controller;
-
}
//=========================================================================
// Highliht element
obc->getView( )->setState( POSSIBLE_CONNECTION ) ;
//obc->getView( )->setState( HIGHLIGHTED ) ;
- }
- }
- }
- }
+ } // if obc_type
+ } // for c_it
+ } // if
+ } // if iter
// EO JGRR & CM WH
if ((obc_type == GPORT) && (obc_state == SELECTED_POSSIBLE_CONNECTION)) {
// Change element to connected state
obc->getView()->setState(HIGHLIGHTED);
-
}
}
int createGComplexBoxInputPort(std::string inputName);
int createGComplexBoxOutputPort(std::string outputName);
GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, std::string bbtkDescription, int posinBox,GBoxModel *blackBox);
- int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc);
- int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
+
+//EED2017-04-07
+// int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc);
+// int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
+ int createGInputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxInputDescriptor *desc);
+ int createGOutputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxOutputDescriptor *desc);
+
int createGConnector(GPortModel* startPort);
void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn);
void SetAuthor(std::string author);
void SetCategory(std::string category);
void SetDescription(std::string description);
- void SetMessageKind(std::string kind);
- void SetMessageLevel(std::string Level);
-
+ void SetMessageKind(std::string kind);
+ void SetMessageLevel(std::string Level);
std::string GetCbName();
std::string GetCbPackageName();
std::string GetAuthor();
std::string GetCategory();
std::string GetDescription();
- std::string GetMessageKind();
+ std::string GetMessageKind();
std::string GetMessageLevel();
// RaC2012 2nd HackFest
// Get names of all external inputs
std::vector< std::string> GetExternalInputsNames();
void getCleanLine(std::stringstream &inputStream, std::string &line);
-
// JGRR & CM
void printAll( int com, int sta );
-
-
std::vector<std::string> boxesDiagram;//CFT
-
private:
-
std::string _cbName;
std::string _cbPackageName;
std::string _Author;
std::string _Description;
std::string _MessageKind;
std::string _MessageLevel;
-
//wxPanel that uses the manager
wxGEditorTabPanel *_parent;
-
// Id of the manager, the same of the panel
int _idManager;
-
// Boxes number in the scene
int _numBoxes;
-
// StartDragging
bool _startDragging;
-
// creaMaracasVisu viewer
wxVtk3DBaseView *_baseView;
-
// State of the 3D Scene or the virtual world
int _worldState;
-
//Map of id - objectController
std::map<int,GObjectController*> _controllers;
-
//Saves the id's of the selected objects in the controllers map
std::vector<int> _selectedObjects;
-
//Is the diagram in state complex box
bool _isComplexBox;
-
int _idConnectionInCreation;
-
int _contLastId;
-
vtkTextActor3D *_textActor;
std::string _bugTextActor_text;
int _bugTextActor_status;
-
vtkPoints *_pts;
vtkActor *_fillObjectActor;
vtkDataSetMapper *_aPolygonMapper;
-
Factory::Pointer _bbtkfactory;
-
-
std::string LineNumber(bool withLineNumber, int &value);
int GetIndexInSelected(int idControler);
void UnSelectBlackBoxes();
GObjectController *GetGBlackBoxControlerPointedByMouse();
void CancelConnection();
-
-
protected:
-
};