//=========================================================================
+
+ std::string GBlackBoxModel::getBBTKPackage()
+ {
+ return _bbtkPackage;
+ }
+
+ //=========================================================================
+
+ void GBlackBoxModel::setBBTKPackage(std::string obpackage)
+ {
+ _bbtkPackage = obpackage;
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
virtual void move(double xx,double yy,double zz);
GPortModel* getStartOutputPort();
+ std::string getBBTKPackage();
+ void setBBTKPackage(std::string obpackage);
private:
- //Attributes
+ //Private Attributes
std::vector<GPortModel*> _inputs;
std::vector<GPortModel*> _outputs;
//Private Methods
protected:
+ //Protected Attributes
+ std::string _bbtkPackage;
+
//Protected methods
};
manualPoint* point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
point->SetPoint(xCenter,yIport,zCenter);
- cout<<"RaC GConnectorModel::setEndPort size:"<<_model->GetSizeLstPoints()<<endl;
}
//=========================================================================
//=========================================================================
+ void GConnectorModel::updateStartEndPoints()
+ {
+ //Start Point
+ double xCenter,yCenter,zCenter;
+ _startPort->getCenter(xCenter,yCenter,zCenter);
+ double xIport,yIport,zIport;
+ _startPort->getInicPoint(xIport,yIport,zIport);
+
+ manualPoint* point = _model->GetManualPoint(0);
+ point->SetPoint(xCenter,yIport,zCenter);
+
+ //End Point
+ _endPort->getCenter(xCenter,yCenter,zCenter);
+ _endPort->getInicPoint(xIport,yIport,zIport);
+
+ point = _model->GetManualPoint(_model->GetSizeLstPoints()-1);
+ point->SetPoint(xCenter,yIport,zCenter);
+ }
+
} // EO namespace bbtk
// EOF
GPortModel* getStartPort();
GPortModel* getEndPort();
manualContourModel* getManualContourModel();
+ void updateStartEndPoints();
private:
//=========================================================================
+
} // EO namespace bbtk
// EOF
const double PORT_WIDTH = 2.5;
// Commands
- const int REPAINT = 201;
+ const int NO_COMMAND = 201;
const int INIT_CREATION_CONTOUR= 202;
const int FIN_CREATION_CONTOUR= 203;
+ const int ADD_TO_SELECTED = 204;
+ const int DRAG_OBJECTS = 205;
+
+ // World states
+ //const int NOTHING_HAPPENS = 101;
+
// Colors (object_state_(R|G|B))
const double BOXCONTOUR_NH_R=0.0;
//Public methods
void addObserver(Observer *observer);
- void notifyObservers(int idCaller,int command=REPAINT);
+ void notifyObservers(int idCaller,int command=NO_COMMAND);
private:
//=========================================================================
- wxVtkSceneManager::wxVtkSceneManager(wxDropTarget *parent, wxVtk3DBaseView *baseView,int idManager)
+ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView,int idManager)
{
+ _parent = parent;
_numBoxes=0;
_idManager=idManager;
_baseView=baseView;
_idLastController=0;
+ _startDragging=false;
if( _baseView!=NULL )
{
- _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(parent);
- registerController(this);
+ _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
configureBaseView();
_worldState=NOTHING_HAPPENS;
+ registerController(this);
}
-
}
-
//=========================================================================
void wxVtkSceneManager::disconnectDrop()
{
_baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
- }
+ }
//=========================================================================
model->setBBTKName(arraystring);
model->setBBTKType(boxName);
+ model->setBBTKPackage(packageName);
model->addObserver(view);
model->addObserver(this);
connectorcontroller->setManualContourController(manContourControl);
connectorModel->setManualContourModel(manContourModel);
connectorView->setManualContourView(manContourView);
+ connectorView->setModel(connectorModel);
connectorcontroller->setModelAndView(connectorModel,connectorView);
int newId = _controllers.size();
bool wxVtkSceneManager::OnMouseMove()
{
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+
+ if(_worldState == DRAG_OBJECTS)
+ {
+ for (int i=0; i<_selectedObjects.size(); i++)
+ {
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ if(_startDragging)
+ {
+ cont->getView()->setStartDragging(true);
+ }
+ cont->getView()->moveObject(X,Y);
+ cont->getView()->setState(DRAG);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+
+ std::map<int, GObjectController*>::iterator it;
+
+ for(it = _controllers.begin(); it != _controllers.end(); ++it)
+ {
+ GObjectController *desc = it->second;
+ if(desc->getGObjectType()==GCONNECTOR)
+ {
+ GConnectorView* vconn = (GConnectorView*)desc->getView();
+ vconn->updateStartEndPoints();
+ }
+ }
+
+ _startDragging=false;
+
+ }
+ else if(_worldState == NOTHING_HAPPENS)
+ {
+ std::map<int, GObjectController*>::iterator it;
+
+ for(it = _controllers.begin(); it != _controllers.end(); ++it)
+ {
+ GObjectController *desc = it->second;
+ if(desc->getGObjectType()==GBLACKBOX && desc->getView()->getState() == HIGHLIGHTED)
+ {
+ GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
+ _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType());
+ }
+ }
+ }
+
+
return true;
}
void wxVtkSceneManager::update(int idController,int command)
{
-
- if(command == INIT_CREATION_CONTOUR)
- {
- GObjectController* cont = _controllers[idController];
- GPortModel* startOutputPort = (GPortModel*)cont->getModel();
- createGConnector(startOutputPort);
-
- // The last one is the controller of the connector
- for(int i=0;i<_controllers.size()-1;i++)
+ if(command != NO_COMMAND)
+ {
+ if(command == ADD_TO_SELECTED)
{
- GObjectController* cont = _controllers[i];
- if(cont->getGObjectType() == GPORT )
+ GObjectController* cont = _controllers[idController];
+
+ bool foundID=false;
+ for (int i=0; i<_selectedObjects.size() && foundID==false; i++)
{
- GPortModel* port = (GPortModel*)cont->getModel();
- if(port->getPortType()==GINPUTPORT)
+ int id = _selectedObjects[i];
+ if(id==idController)
{
- cont->SetActive(true);
+ foundID = true;
+ }
+ }
+ if(!foundID)
+ {
+ int id = idController;
+ _selectedObjects.push_back(id);
+ }
+
+ }
+ else if(command == INIT_CREATION_CONTOUR)
+ {
+ _worldState = INIT_CREATION_CONTOUR;
+ GObjectController* cont = _controllers[idController];
+ GPortModel* startOutputPort = (GPortModel*)cont->getModel();
+
+
+ // The last one is the controller of the connector
+ for(int i=0;i<_controllers.size();i++)
+ {
+ GObjectController* cont = _controllers[i];
+ if(cont->getGObjectType() == GPORT )
+ {
+ GPortModel* port = (GPortModel*)cont->getModel();
+ if(port->getPortType()==GINPUTPORT)
+ {
+ cont->SetActive(true);
+ }
+ else
+ {
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ cont->SetActive(false);
+ }
}
else
{
cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
cont->SetActive(false);
- }
+ }
}
- else
+
+ _selectedObjects.clear();
+
+ createGConnector(startOutputPort);
+
+ }
+ else if(command == FIN_CREATION_CONTOUR && _worldState == INIT_CREATION_CONTOUR)
+ {
+ _worldState = NOTHING_HAPPENS;
+ int id = _controllers.size()-1;
+ GObjectController* cont = _controllers[id];
+ GConnectorModel* modelContour = (GConnectorModel*)cont->getModel();
+
+ GObjectController* finPort = _controllers[idController];
+ if(finPort->getGObjectType() == GPORT)
+ {
+ GPortModel* modelPort = (GPortModel*)finPort->getModel();
+ modelContour->setEndPort(modelPort);
+ }
+
+ manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController();
+ manualConnectorContourView* connView = (manualConnectorContourView*)manCont->GetManualViewBaseContour();
+ connView->Refresh();
+
+ for(int i=0;i<_controllers.size();i++)
{
- cont->getView()->setState(NOTHING_HAPPENS);
- cont->SetActive(false);
- }
+ GObjectController* cont = _controllers[i];
+ if(cont->getView()!=NULL)
+ {
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+ cont->SetActive(true);
+ }
}
- _worldState = CREATING_CONTOUR;
}
- else if(command == FIN_CREATION_CONTOUR && _worldState == CREATING_CONTOUR)
+ }
+
+ //=========================================================================
+
+
+ bool wxVtkSceneManager::OnLeftButtonDown()
+ {
+
+ if(_selectedObjects.size()!=0)
{
-
- _worldState = NOTHING_HAPPENS;
- int id = _controllers.size()-1;
- GObjectController* cont = _controllers[id];
- GConnectorModel* modelContour = (GConnectorModel*)cont->getModel();
+ _worldState = DRAG_OBJECTS;
+ _startDragging = true;
- GObjectController* finPort = _controllers[idController];
- if(finPort->getGObjectType() == GPORT)
+ for (int i = 0; i < _selectedObjects.size(); i++)
{
- GPortModel* modelPort = (GPortModel*)finPort->getModel();
- modelContour->setEndPort(modelPort);
- }
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ cont->getView()->setState(DRAG);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+ }
+
+
+
+ return true;
+ }
- manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController();
- manualConnectorContourView* connView = (manualConnectorContourView*)manCont->GetManualViewBaseContour();
- connView->Refresh();
+ //=========================================================================
+
+ bool wxVtkSceneManager::OnLeftButtonUp()
+ {
+ if(_worldState == DRAG_OBJECTS)
+ {
+ _worldState = NOTHING_HAPPENS;
- for(int i=0;i<_controllers.size();i++)
+ for (int i = 0; i < _selectedObjects.size(); i++)
{
- GObjectController* cont = _controllers[i];
- if(cont->getView()!=NULL)
- {
- cont->getView()->setState(NOTHING_HAPPENS);
- }
- cont->SetActive(true);
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ cont->getView()->setState(SELECTED);
+ cont->getModel()->notifyObservers(_idManager);
}
}
+ return true;
+ }
+
+ //=========================================================================
+
+ bool wxVtkSceneManager::OnRightButtonUp()
+ {
+ for (int i = 0; i < _selectedObjects.size(); i++)
+ {
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ cont->SetActive(true);
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+
+ _selectedObjects.clear();
+
+ return true;
}
//=========================================================================
+ void wxVtkSceneManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
+ {
+ _parent->displayBlackBoxInfo(packageName,boxName);
+ }
+
} // EO namespace bbtk
// EOF
#include "vtkGPortView.h"
#include "manualConnectorContourView.h"
#include "manualConnectorContourController.h"
+#include "wxGEditorTabPanel.h"
//Includes bbtk
#include <bbtkBlackBoxInputDescriptor.h>
namespace bbtk
{
+ class wxGEditorTabPanel;
class wxVtkSceneManager : public InteractorStyleMaracas , public Observer
{
public:
- wxVtkSceneManager(wxDropTarget *parent, wxVtk3DBaseView *baseView, int idManager);
+ wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager);
~wxVtkSceneManager();
void configureBaseView();
void disconnectDrop();
virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnRightButtonUp();
virtual void update(int idController,int command);
+
+ void displayBlackBoxInfo(std::string packageName, std::string boxName);
private:
+ wxGEditorTabPanel *_parent;
+
// Last controller created
int _idLastController;
// Boxes number in the scene
int _numBoxes;
+ // StartDragging
+ bool _startDragging;
+
wxVtk3DBaseView *_baseView;
int _worldState;
std::map<int,GObjectController*> _controllers;
+ //Saves the id's of the selected objects in the controllers map
+ std::vector<int> _selectedObjects;
+
protected:
};
int state = _view->getState();
//Evaluate new state
- if( state == DRAG)
- {
- moveObject(X,Y);
- }
-
+
if(state == NOTHING_HAPPENS)
{
if(_view->isPointInside(X,Y))
{
- _view->setState(HIGHLIGHTED);
+ _view->setState(HIGHLIGHTED);
}
}
if( state==HIGHLIGHTED)
bool GBlackBoxController::OnLeftButtonDown()
{
-
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int state = _view->getState();
-
- //Evaluate new state
- if( state==HIGHLIGHTED)
- {
- _view->isStartDragging(true);
- _view->setState(DRAG);
- }
-
- if( state == SELECTED)
- {
- if(_view->isPointInside(X,Y))
- {
- _view->isStartDragging(true);
- _view->setState(DRAG);
- }
- }
+ int state = _view->getState();
- _model->notifyObservers(_id);
+ //Evaluate new state
+ if(state == HIGHLIGHTED)
+ {
+ _isLeftClickDown=true;
+ _view->setState(SELECTED);
+ _model->notifyObservers(_id,ADD_TO_SELECTED);
}
return true;
+
}
//=========================================================================
bool GBlackBoxController::OnLeftButtonUp()
{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
- int state = _view->getState();
+ int state = _view->getState();
- //Evaluate new state
- if(state==CLICKED)
- {
- _view->setState(SELECTED);
- }
-
- if( state == DRAG)
+ //Evaluate new state
+ if(_isLeftClickDown)
+ {
+ _isLeftClickDown=false;
+ if(_view->isPointInside(X,Y))
{
+ // It is supposed that I'm always inside even if the box is in drag
_view->setState(SELECTED);
+ _model->notifyObservers(_id);
}
-
- _model->notifyObservers(_id);
-
}
return true;
+
}
//=========================================================================
bool GBlackBoxController::OnLeftDClick()
{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- _model->notifyObservers(_id);
- }
+
return true;
}
bool GBlackBoxController::OnRightButtonDown()
{
- if( _vtkInteractorStyleBaseView!= NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X, Y);
-
- int state = _view->getState();
-
- //Evaluate new state
- if( state == SELECTED)
- {
- _view->setState(NOTHING_HAPPENS);
- }
-
- _model->notifyObservers(_id);
- }
return true;
}
return manViewContour;
}
+ //=========================================================================
+
+ void GConnectorView::updateStartEndPoints()
+ {
+ GConnectorModel* mod=(GConnectorModel*)_model;
+ mod->updateStartEndPoints();
+ manViewContour->RefreshContour();
+ }
+
} // EO namespace bbtk
// EOF
//Includes same project
#include "vtkGObjectView.h"
+#include "GConnectorModel.h"
//Includes creaMaracasVisu
#include <manualViewContour.h>
//Public methods
void setManualContourView(manualViewContour* viewContour);
manualViewContour* getManualContourView();
+ void updateStartEndPoints();
private:
bool GObjectController::OnMouseMove()
{
+ int X,Y;
+ wxVTKRenderWindowInteractor *_wxVTKiren;
+ _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ _wxVTKiren->GetEventPosition( X , Y );
+ int state = _view->getState();
- /********************** VIRTUAL *************************/
-
- if ( _vtkInteractorStyleBaseView!=NULL)
+ //Evaluate new state
+ if( state == NOTHING_HAPPENS)
{
- int X,Y;
- wxVTKRenderWindowInteractor *_wxVTKiren;
- _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- _wxVTKiren->GetEventPosition( X , Y );
-
- int state = _view->getState();
-
- //Evaluate new state
- if( state == DRAG)
- {
- moveObject(X,Y);
- }
-
- if( state == NOTHING_HAPPENS)
- {
- if(_view->isPointInside(X,Y))
- {
- _view->setState(HIGHLIGHTED);
- }
- }
- if( state==HIGHLIGHTED)
+ if(_view->isPointInside(X,Y))
{
- if(!_view->isPointInside(X,Y))
- {
- _view->setState(NOTHING_HAPPENS);
- }
- }
-
- _model->notifyObservers(_id);
-
+ _view->setState(HIGHLIGHTED);
+ }
}
-
- /**/
-
- return true;
- }
-
- //=========================================================================
-
- bool GObjectController::OnLeftButtonDown()
- {
- /********************** VIRTUAL *************************
-
- if ( _vtkInteractorStyleBaseView!=NULL )
+ if( state==HIGHLIGHTED)
{
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int state = _model->getState();
-
- //Evaluate new state
- if(!_model->hasChanged() && state==HIGHLIGHTED)
+ if(!_view->isPointInside(X,Y))
{
- _view->isStartDragging(true);
- _model->setState(DRAG);
- }
-
- if( !_model->hasChanged() && state == SELECTED)
- {
- if(_view->isPointInside(X,Y))
- {
- _view->isStartDragging(true);
- _model->setState(DRAG);
- }
+ _view->setState(NOTHING_HAPPENS);
}
-
- _model->notifyObservers();
}
-
- */
+
+ _model->notifyObservers(_id);
+
return true;
}
//=========================================================================
- bool GObjectController::OnLeftButtonUp()
+ bool GObjectController::OnLeftButtonDown()//virtual
{
-
- /********************** VIRTUAL *************************
-
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int state = _model->getState();
+ int state = _view->getState();
- //Evaluate new state
- if(!_model->hasChanged() && state==CLICKED)
- {
- _model->setState(SELECTED);
- }
-
- if( !_model->hasChanged() && state == DRAG)
- {
- _model->setState(SELECTED);
- }
-
- _model->notifyObservers();
-
+ //Evaluate new state
+ if(state == HIGHLIGHTED)
+ {
+ _isLeftClickDown=true;
+ _view->setState(SELECTED);
+ //_model->notifyObservers(_id,
}
-
- */
return true;
}
//=========================================================================
- bool GObjectController::OnLeftDClick()
+ bool GObjectController::OnLeftButtonUp()//virtual
{
- /********************** VIRTUAL *************************
-
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
- _model->notifyObservers();
- }
-
- */
return true;
}
//=========================================================================
-
- bool GObjectController::OnRightButtonDown()
+
+ bool GObjectController::OnLeftDClick()//virtual
{
- /********************** VIRTUAL *************************/
-
- if( _vtkInteractorStyleBaseView!= NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X, Y);
-
- int state = _view->getState();
-
- //Evaluate new state
- if( state == SELECTED)
- {
- _view->setState(NOTHING_HAPPENS);
- }
-
- _model->notifyObservers(_id);
- }
-
- /**/
return true;
-
}
//=========================================================================
GObjectModel* _model;
vtkGObjectView* _view;
int _id;
+ bool _isLeftClickDown;
//Protected Methods
virtual bool OnMouseMove();
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
virtual bool OnLeftDClick();
- virtual bool OnRightButtonDown();
virtual void moveObject(int X,int Y);
bool GPortController::OnLeftButtonDown()
{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int state = _view->getState();
+ int state = _view->getState();
- //Evaluate new state
- if(state == HIGHLIGHTED)
- {
- _isLeftClickDown=true;
- }
-
+ //Evaluate new state
+ if(state == HIGHLIGHTED)
+ {
+ _isLeftClickDown=true;
}
return true;
}
private:
//Attributes
- bool _isLeftClickDown;
+
//Private Methods
//=========================================================================
void vtkGBlackBoxView::update(int idController,int command)
{
-
updateColors();
double xInic, yInic,zInic,xFin, yFin,zFin;
_pts->SetPoint(2, xFin, yFin, zFin );
_pts->SetPoint(3, xFin, yInic, zFin );
+
+ _ptsFill->SetPoint(0, xInic, yInic, zInic-0.01 );
+ _ptsFill->SetPoint(1, xInic, yFin, zInic-0.01 );
+ _ptsFill->SetPoint(2, xFin, yFin, zFin-0.01 );
+ _ptsFill->SetPoint(3, xFin, yInic, zFin-0.01 );
+
+
//-----------
updatePositionTextActors(xInic, yInic,zInic);
vtkCellArray *lines = vtkCellArray::New();
vtkPolyData *_pd = vtkPolyData::New();
vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New();
- _objectActor=vtkActor::New();
-
+ _objectBorderActor=vtkActor::New();
+
_pts->SetNumberOfPoints(4);
double xInic, yInic,zInic,xFin, yFin,zFin;
_pd->SetLines( lines );
_bboxMapper->SetInput(_pd);
- _objectActor->SetMapper(_bboxMapper);
+ _objectBorderActor->SetMapper(_bboxMapper);
+
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+
+
+ ///************************* FILL *************************
+
+ _ptsFill = vtkPoints::New();
+ vtkCellArray *strip = vtkCellArray::New();
+ vtkPolyData *pdFill = vtkPolyData::New();
+ vtkPolyDataMapper* bboxMapperFill=vtkPolyDataMapper::New();
+ _fillBorderActor=vtkActor::New();
+
+ _ptsFill->SetNumberOfPoints(4);
+
+ // RaC In the actual version, zInic=zFin=900
+
+ _ptsFill->SetPoint(0, xInic, yInic, zInic-0.01 );
+ _ptsFill->SetPoint(1, xInic, yFin, zInic-0.01 );
+ _ptsFill->SetPoint(2, xFin, yFin, zFin-0.01 );
+ _ptsFill->SetPoint(3, xFin, yInic, zFin-0.01 );
+
+ strip->InsertNextCell(5);
+ strip->InsertCellPoint(0);
+ strip->InsertCellPoint(1);
+ strip->InsertCellPoint(2);
+ strip->InsertCellPoint(0);
+ strip->InsertCellPoint(3);
+
+ pdFill->SetPoints( _pts );
+ pdFill->SetStrips( strip );
+
+ bboxMapperFill->SetInput(pdFill);
+ _fillBorderActor->SetMapper(bboxMapperFill);
+ _fillBorderActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+ ///************************* FILL *************************
//------------
void vtkGBlackBoxView::updateColors()
{
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
_nameActor->GetTextProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
_typeActor->GetTextProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+ _fillBorderActor->GetProperty()->SetColor(1,.5,.3);
if(_state==NOTHING_HAPPENS)
{
- _objectActor->GetProperty()->SetLineWidth(1);
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+ _objectBorderActor->GetProperty()->SetLineWidth(1);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
_nameActor->GetTextProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
_typeActor->GetTextProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
}
else if(_state==HIGHLIGHTED)
{
- _objectActor->GetProperty()->SetLineWidth(2);
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
+ _objectBorderActor->GetProperty()->SetLineWidth(2);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
_nameActor->GetTextProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
_typeActor->GetTextProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
}
else if(_state==DRAG)
{
- _objectActor->GetProperty()->SetLineWidth(1.2);
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
+ _objectBorderActor->GetProperty()->SetLineWidth(1.2);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
_nameActor->GetTextProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
_typeActor->GetTextProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
}
else if(_state==SELECTED)
{
- _objectActor->GetProperty()->SetLineWidth(2);
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
+ _objectBorderActor->GetProperty()->SetLineWidth(2);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
_nameActor->GetTextProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
_typeActor->GetTextProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
}
//Private Attributes
vtkPoints *_pts;
+ vtkPoints *_ptsFill;
vtkTextActor3D* _nameActor;
vtkTextActor3D* _typeActor;
vtkGObjectView::vtkGObjectView()
{
_baseView=NULL;
- _objectActor=NULL;
+ _objectBorderActor=NULL;
+ _fillBorderActor=NULL;
_isStartDragging=false;
_state = NOTHING_HAPPENS;
void vtkGObjectView::addVtkActors()//virtual
{
- _baseView->GetRenderer()->AddActor(_objectActor);
+ _baseView->GetRenderer()->AddActor(_objectBorderActor);
+ _baseView->GetRenderer()->AddActor(_fillBorderActor);
_baseView->GetRenderer()->Render();
}
double xx=X,yy=Y,zz=900;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
-
-
if(_isStartDragging)
{
_isStartDragging=false;
dragDifX=xx-xInic;
dragDifY=yy-yInic;
}
-
_model->move(xx-dragDifX,yy-dragDifY,zz);
}
//=========================================================================
- void vtkGObjectView::isStartDragging(bool param)
+ void vtkGObjectView::setStartDragging(bool param)
{
_isStartDragging=param;
dragDifX=0;
virtual void moveObject(int X, int Y);
virtual void update(int idController,int command);
- void isStartDragging(bool param);
+ void setStartDragging(bool param);
void setState(int state);
int getState();
//Protected Attributes
wxVtkBaseView *_baseView;
GObjectModel *_model;
- vtkActor *_objectActor;
+ vtkActor *_objectBorderActor;
+ vtkActor *_fillBorderActor;
int _state;
//Protected Methods
vtkCellArray *lines = vtkCellArray::New();
vtkPolyData *_pd = vtkPolyData::New();
vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New();
- _objectActor=vtkActor::New();
+ _objectBorderActor=vtkActor::New();
_pts->SetNumberOfPoints(3);
_pd->SetLines( lines );
_bboxMapper->SetInput(_pd);
- _objectActor->SetMapper(_bboxMapper);
+ _objectBorderActor->SetMapper(_bboxMapper);
updateColors();
void vtkGPortView::updateColors()
{
- _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+ _objectBorderActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
if(_state==HIGHLIGHTED)
{
- _objectActor->GetProperty()->SetColor(0.8,0.2,0.5);
+ _objectBorderActor->GetProperty()->SetColor(0.8,0.2,0.5);
}
else
{
- _objectActor->GetProperty()->SetColor(0.3,0.2,0.2);
+ _objectBorderActor->GetProperty()->SetColor(0.3,0.2,0.2);
}
}
CreateStatusBar();
_frameAUIMgr->Update();
+ _actualPkgBrowserBoxName="";
+ _actualPkgBrowserPkgName="";
}
//=========================================================================
void wxGUIEditorGraphicBBS::initTabPanelsManager()
{
- wxAuiNotebook *notebook = new wxAuiNotebook(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
- _tabsMgr = new wxTabPanelsManager(notebook);
- _frameAUIMgr->AddPane(notebook,wxAuiPaneInfo().CenterPane());
+ _notebook = new wxAuiNotebook(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
+ _tabsMgr = new wxTabPanelsManager(this);
+ _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane());
}
DoRegenerateBoxesLists();
}
- //================================================================
+ //================================================================
+
+ wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook()
+ {
+ return _notebook;
+ }
+
+ //================================================================
+
+ void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::string boxName)
+ {
+ if(_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName != boxName )
+ {
+ _actualPkgBrowserPkgName = packageName;
+ _actualPkgBrowserBoxName = boxName;
+
+ BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
+ _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
+ }
+ }
+
+ //=========================================================================
/*****************************************************
/* HANDLERS
//Includes same project
#include "wxTabPanelsManager.h"
#include "wxPropertiesPanel.h"
-#include "wxart_new.xpm"
+#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm"
//Includes creaMaracasVisu
namespace bbtk
{
+ class wxTabPanelsManager;
class wxGUIEditorGraphicBBS : public wxFrame
{
void initHelpHTMLBrowser();
void initPropertiesPanel();
+ wxAuiNotebook* getAuiNotebook();
+ void displayBlackBoxInfo(std::string packageName, std::string boxName);
+
void RegenerateAll();
void DoRegeneratePackageDoc(const std::string& pack);
void DoRegenerateBoxesLists();
std::string _dataDir;
+ std::string _actualPkgBrowserBoxName;
+
+ std::string _actualPkgBrowserPkgName;
+
protected:
//=========================================================================
+ void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
+ {
+ _panelsManager = panelsManager;
+ }
+
+ //=========================================================================
+
+ void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
+ {
+ _panelsManager->displayBlackBoxInfo(packageName,boxName);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF
//Includes same project
#include "wxVtkSceneManager.h"
+#include "wxTabPanelsManager.h"
//Includes wxWidgets
#include <wx/panel.h>
namespace bbtk
{
+ class wxVtkSceneManager;
+
+ class wxTabPanelsManager;
+
class wxGEditorTabPanel : public wxTextDropTarget, public wxPanel
{
public:
void initWxVtkCanvas();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
+ void setPanelsManager(wxTabPanelsManager* panelsManager);
+
+ void displayBlackBoxInfo(std::string packageName, std::string boxName);
private:
int _id;
wxAuiManager *_panelAUIMgr;
wxVtkSceneManager *_sceneManager;
+ wxTabPanelsManager* _panelsManager;
protected:
//=========================================================================
- wxTabPanelsManager::wxTabPanelsManager(wxAuiNotebook *notebook)
+ wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
{
+ _parent = parent;
_lastId = 0;
- _notebook = notebook;
+ _notebook = _parent->getAuiNotebook();
addNewTab();
}
_lastId++;
wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
+ newPanel->setPanelsManager(this);
_panels[_lastId]=newPanel;
_actual = newPanel;
return _actual;
}
+ //=========================================================================
+
+ void wxTabPanelsManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
+ {
+ _parent->displayBlackBoxInfo(packageName,boxName);
+ }
+
+ //=========================================================================
+
/*****************************************************
/* HANDLERS
/*****************************************************/
#include <iostream>
#include "wxGEditorTabPanel.h"
+#include "wxVtkSceneManager.h"
+#include "bbtkwxGUIEditorGraphicBBS.h"
using namespace std;
namespace bbtk
{
+ class wxVtkSceneManager;
+ class wxGEditorTabPanel;
+ class wxGUIEditorGraphicBBS;
+
class wxTabPanelsManager
{
public:
- wxTabPanelsManager(wxAuiNotebook *notebook);
+ wxTabPanelsManager(wxGUIEditorGraphicBBS *parent);
~wxTabPanelsManager();
virtual void addNewTab();
wxAuiNotebook* getAuiNotebook();
wxGEditorTabPanel* getActualTabPanel();
+ void displayBlackBoxInfo(std::string packageName, std::string boxName);
+
+
private:
/**
** The map
*/
+ wxGUIEditorGraphicBBS *_parent;
map<int, wxPanel*> _panels;
wxGEditorTabPanel* _actual;
wxAuiNotebook *_notebook;