From a28e6f908ae524e5ef4b70dba487e88cc525d27c Mon Sep 17 00:00:00 2001 From: davila <> Date: Sun, 3 Jun 2012 11:38:10 +0000 Subject: [PATCH] v1.1.0 BUG 1400 - New version of file bbg bbs v1.2 -> 1.3 - New position of the graphical objects -900 - Reconfiguration of the camera BoxRenderRegion --- doc/UserDoxygen/DoxyMainPage.txt.in | 5 +- .../GConnectorModel.cxx | 1 + .../bbsKernelEditorGraphic/GObjectModel.cxx | 4 +- .../bbsKernelEditorGraphic/GPortModel.cxx | 22 +-- .../bbsKernelEditorGraphic/GlobalConstants.h | 2 + .../GConnectorController.cxx | 2 +- .../manualConnectorContourController.cxx | 22 +-- .../vtkGBlackBoxView.cxx | 6 +- .../bbsVtkGUIEditorGraphic/vtkGBoxView.cxx | 6 +- .../vtkGComplexBoxPortView.cxx | 6 +- .../bbsVtkGUIEditorGraphic/vtkGObjectView.cxx | 8 +- .../bbsVtkGUIEditorGraphic/vtkGPortView.cxx | 6 +- .../bbsWxGUIEditorGraphic/InterpreterBBS.cxx | 7 +- .../bbtkwxGUIEditorGraphicBBS.cxx | 6 +- .../wxGEditorTabPanel.cxx | 2 +- .../wxVtkSceneManager.cxx | 178 +++++++++--------- 16 files changed, 126 insertions(+), 157 deletions(-) diff --git a/doc/UserDoxygen/DoxyMainPage.txt.in b/doc/UserDoxygen/DoxyMainPage.txt.in index 94c4c71..87c7566 100644 --- a/doc/UserDoxygen/DoxyMainPage.txt.in +++ b/doc/UserDoxygen/DoxyMainPage.txt.in @@ -1,13 +1,10 @@ /** - * \mainpage bbtk documentation + * \mainpage bbtkGEditor documentation \htmlonly "A black box is any system in which only the input and output characteristics are of interest - without regard to its internal mechanism or structure" (from wikipedia ) -
  • - Coding Style -
  • \endhtmlonly diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx index 2956f0d..7be647f 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GConnectorModel.cxx @@ -136,6 +136,7 @@ namespace bbtk // Refresh the position of the contourModel last point with the data of the connector model point = _model->GetManualPoint(_model->GetSizeLstPoints()-1); point->SetPoint(xCenter,yport,zCenter); + } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx index 41148af..386663f 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx @@ -46,10 +46,10 @@ namespace bbtk _xInic = 0; _yInic = 0; - _zInic = 900; + _zInic = GPOSITION_Z; _xFin = 0; _yFin = 0; - _zFin = 900; + _zFin = GPOSITION_Z; } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index 5e30721..2ca30ba 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -46,12 +46,12 @@ namespace bbtk { //========================================================================= GPortModel::GPortModel( ) { - _parentBox = NULL ; - _portType = -1 ; - _posInBox = 0 ; - _isConnected = false ; - _value = "" ; - _isValueSet = false ; + _parentBox = NULL ; + _portType = -1 ; + _posInBox = 0 ; + _isConnected = false ; + _value = "" ; + _isValueSet = false ; } //========================================================================= @@ -61,12 +61,10 @@ namespace bbtk { //========================================================================= void GPortModel::registerInBox( GBoxModel *blackBox , int portType , int pos ) { - _parentBox = blackBox ; - _portType = portType ; - _posInBox = pos ; - + _parentBox = blackBox ; + _portType = portType ; + _posInBox = pos ; updatePortPosition( ) ; - } //========================================================================= @@ -127,7 +125,7 @@ namespace bbtk { //========================================================================= GBoxModel* GPortModel::getParentBox( ) { - return _parentBox ; + return _parentBox; } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index d9c3742..2cd1106 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -49,6 +49,8 @@ namespace bbtk { const int GCOMPLEXINPUTPORT = 6; const int GCOMPLEXOUTPUTPORT = 7; + const double GPOSITION_Z = -900; + // Object states // JGRR diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx index 40a1a34..924bd62 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx @@ -166,7 +166,7 @@ namespace bbtk { if ( _vtkInteractorStyleBaseView!=NULL ) { - int X,Y,Z=900; + int X, Y, Z=GPOSITION_Z; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx index bc02755..1fb59cf 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx @@ -57,9 +57,6 @@ namespace bbtk { int z=GetZ(); - - printf("EED MACHETE con int z=-GetZ(); en manualConnectorContourController::MouseMove z=%d\n", z ); - z=-z; GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); GetManualViewBaseContour()->SelectPosibleContour(x,y,z); @@ -102,27 +99,10 @@ namespace bbtk { bool ok = false; - int z = -GetZ(); + int z=GetZ(); int size= GetManualViewBaseContour()->GetNumberOfPoints(); - printf("\nEED manualConnectorContourController::MouseClickLeft z=%d estado=%d\n", z,GetState()); - if (IsEditable()) - { - printf(" Editable\n"); - } else { - printf(" NO Editable\n"); - } - - - if (GetManualViewBaseContour()->GetPosibleSelected()) - { - printf(" PosibleSelected\n"); - } else { - printf(" NO PosibleSelected\n"); - } - - // Insert a Control Point with shift+ClickLeft vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor(); if( IsEditable() ) diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx index 97c2605..954f681 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -98,7 +98,7 @@ namespace bbtk update_X_Fin(); _model->getFinalPoint(xFin, yFin,zFin); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z _pts->SetPoint(0, xInic, yInic, zInic ); _pts->SetPoint(1, xInic, yFin, zInic ); @@ -133,7 +133,7 @@ namespace bbtk _model->getInicPoint(xInic,yInic,zInic); _model->getFinalPoint(xFin, yFin,zFin); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z //EED _pts->SetPoint(0, xInic, yInic, zInic ); //EED _pts->SetPoint(1, xInic, yFin, zInic ); @@ -169,7 +169,7 @@ namespace bbtk _fillPolyMapper = vtkPolyDataMapper::New(); _fillObjectActor = vtkActor::New(); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z strip->InsertNextCell(5); strip->InsertCellPoint(0); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx index b95f204..4ea3285 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx @@ -59,7 +59,7 @@ namespace bbtk _model->getInicPoint(xInic,yInic,zInic); _model->getFinalPoint(xFin, yFin,zFin); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z _pts->SetPoint(0, xInic, yInic, zInic ); _pts->SetPoint(1, xInic, yFin, zInic ); @@ -94,7 +94,7 @@ namespace bbtk _model->getInicPoint(xInic,yInic,zInic); _model->getFinalPoint(xFin, yFin,zFin); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z //EED _pts->SetPoint(0, xInic, yInic, zInic ); //EED _pts->SetPoint(1, xInic, yFin, zInic ); @@ -130,7 +130,7 @@ namespace bbtk _fillPolyMapper = vtkPolyDataMapper::New(); _fillObjectActor = vtkActor::New(); - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z strip->InsertNextCell(5); strip->InsertCellPoint(0); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx index d9fd457..3761374 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx @@ -58,7 +58,7 @@ namespace bbtk { _model->getInicPoint( xInic , yInic , zInic ) ; _model->getFinalPoint( xFin , yFin , zFin ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z _pts->SetPoint( 0 , xInic , yInic , zInic ) ; _pts->SetPoint( 1 , xInic , yFin , zInic ) ; @@ -93,7 +93,7 @@ namespace bbtk { _model->getInicPoint( xInic , yInic , zInic ) ; _model->getFinalPoint( xFin , yFin , zFin ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z //EED _pts->SetPoint(0, xInic, yInic, zInic ); //EED _pts->SetPoint(1, xInic, yFin, zInic ); @@ -129,7 +129,7 @@ namespace bbtk { _fillPolyMapper = vtkPolyDataMapper::New( ) ; _fillObjectActor = vtkActor::New( ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z strip->InsertNextCell( 5 ) ; strip->InsertCellPoint( 0 ) ; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx index 2466e2c..405e5fe 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx @@ -118,8 +118,8 @@ namespace bbtk bool vtkGObjectView::isPointInside(int X,int Y) //virtual { - // RaC In the actual version, always z=900 - double xx=X,yy=Y,zz=900; + // RaC In the actual version, always z=GPOSITION_Z + double xx=X,yy=Y,zz=GPOSITION_Z; _baseView->TransCoordScreenToWorld(xx,yy,zz); return _model->isPointInside(xx,yy,zz); } @@ -128,8 +128,8 @@ namespace bbtk void vtkGObjectView::moveObject(int X,int Y) //virtual { - // RaC In the actual version, always z=900 - double xx=X,yy=Y,zz=900; + // RaC In the actual version, always z=GPOSITION_Z + double xx=X,yy=Y,zz=GPOSITION_Z; _baseView->TransCoordScreenToWorld(xx,yy,zz); if(_isStartDragging) diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index ba9a3d2..5cd33e0 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -60,7 +60,7 @@ namespace bbtk { _model->getInicPoint( xInic , yInic , zInic ) ; _model->getFinalPoint( xFin , yFin , zFin ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z double mid = ( xInic + xFin ) / 2 ; @@ -86,7 +86,7 @@ namespace bbtk { _model->getInicPoint( xInic , yInic , zInic ) ; _model->getFinalPoint( xFin , yFin , zFin ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z double mid = ( xInic + xFin ) / 2 ; @@ -106,7 +106,7 @@ namespace bbtk { _fillPolyMapper = vtkPolyDataMapper::New( ) ; _fillObjectActor = vtkActor::New( ) ; - // RaC In the actual version, zInic=zFin=900 + // RaC In the actual version, zInic=zFin=GPOSITION_Z strip->InsertNextCell( 3 ) ; strip->InsertCellPoint( 0 ) ; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx index 3bd1dcf..e68430f 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx @@ -61,8 +61,7 @@ namespace bbtk _xGeneral = -100; _yGeneral = 100; - _zGeneral = 900; // ????? -printf("EED InterpreterBBS::createGBlackBox 900-450\n"); + _zGeneral = GPOSITION_Z; // ????? _countBoxes = 0; _countInputs = 0; @@ -114,7 +113,7 @@ printf("EED InterpreterBBS::createGBlackBox 900-450\n"); { double xIn = -100+50+_countInputs*50; double yIn = 100; - double zIn = 900; + double zIn = GPOSITION_Z; _sceneManager->configGComBoxInputOutputPort(true,name,xIn,yIn,zIn); _sceneManager->configGConnetion( name,name,box,input); _countInputs++; @@ -129,7 +128,7 @@ printf("EED InterpreterBBS::createGBlackBox 900-450\n"); _yGeneral = _yGeneral - 30; double xIn = -100+_countOutputs*30; double yIn = _yGeneral; - double zIn = 900; + double zIn = GPOSITION_Z; _sceneManager->configGComBoxInputOutputPort(false,name,xIn,yIn,zIn); _sceneManager->configGConnetion( box,output,name,name); _countOutputs++; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index eeb3afc..73a0a9c 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -577,7 +577,7 @@ void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename) { std::string content = ""; // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.2 BBS BlackBox Script\n"; + content += "# - BBTKGEditor v 1.3 BBS BlackBox Script\n"; content += "# - "; content += filename; content += "\n"; @@ -637,7 +637,7 @@ void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) { // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.2 BBS BlackBox Script (Complex Box)\n"; + content += "# - BBTKGEditor v 1.3 BBS BlackBox Script (Complex Box)\n"; content += "# - "; content += filename; content += "\n"; @@ -672,7 +672,7 @@ void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) { // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file\n"; + content += "# - BBTKGEditor v 1.3 BBG BlackBox Diagram file\n"; content += "# - "; content += filename; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index b37e67d..0a7261b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -195,7 +195,7 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); std::string content = ""; // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file\n"; + content += "# - BBTKGEditor v 1.3 BBG BlackBox Diagram file\n"; content += "# - "; content += "temp"; content += "\n"; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index dc5545a..7d9da52 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -110,14 +110,16 @@ void wxVtkSceneManager::configureBaseView() { interactorstylebaseview->SetwxVtkBaseView(_baseView); _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn(); - _baseView->GetRenderer()->ResetCamera(-100, 100, -100, 100, 800, 1100); + _baseView->GetRenderer()->ResetCamera(-100, 100, -100, 100, -1000, 1000); + _baseView->GetRenderer()->GetActiveCamera()->Zoom(10); + _baseView->GetRenderer()->SetBackground(0.9, 0.9, 0.9); _baseView->GetRenderer()->GradientBackgroundOn(); // Actos Port_Text _textActor = vtkTextActor3D::New(); - _textActor->SetPosition(-9999, -9999, 900); + _textActor->SetPosition(-9999, -9999, GPOSITION_Z); _textActor->SetInput(""); _textActor->GetTextProperty()->SetFontSize(60); _textActor->GetTextProperty()->BoldOn(); @@ -131,7 +133,7 @@ void wxVtkSceneManager::configureBaseView() { //------------ double xInic = 0; double yInic = 0; - double zInic = 900; + double zInic = GPOSITION_Z; vtkPolygon *aPolygon = vtkPolygon::New(); _fillObjectActor = vtkActor::New(); @@ -262,7 +264,7 @@ int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, double yy = windowHeight - y; //z value is not important yet, because it is only used a parallel projection - double zz = 900; + double zz = GPOSITION_Z; _baseView->TransCoordScreenToWorld(xx, yy, zz); model->setInicPoint(xx, yy, zz); @@ -350,8 +352,7 @@ int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName) { double yy = windowHeight - 5; //z value is not important yet, because it is only used a parallel projection - double zz = 900; - printf("EED wxVtkSceneManager::createGComplexBoxInputPort 900-450\n"); + double zz = GPOSITION_Z; _baseView->TransCoordScreenToWorld(xx, yy, zz); model->setInicPoint(xx, yy, zz); @@ -409,9 +410,7 @@ int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) { double yy = windowHeight - 5; //z value is not important yet, because it is only used a parallel projection - double zz = 900; - - printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); + double zz = GPOSITION_Z; _baseView->TransCoordScreenToWorld(xx, yy, zz); model->setInicPoint(xx, yy, zz); @@ -510,15 +509,12 @@ GPortController* wxVtkSceneManager::createGPort(int portType, int wxVtkSceneManager::createGConnector(GPortModel* startPort) { int type = GCONNECTOR; - manualConnectorContourController* manContourControl = - new manualConnectorContourController(); - manualConnectorContourView* manContourView = - new manualConnectorContourView(); - manualContourModel* manContourModel = new manualContourModel(); - - GConnectorController* connectorcontroller = new GConnectorController(); - GConnectorModel* connectorModel = new GConnectorModel(); - vtkGConnectorView* connectorView = new vtkGConnectorView(); + manualConnectorContourController *manContourControl = new manualConnectorContourController(); + manualConnectorContourView *manContourView = new manualConnectorContourView(); + manualContourModel *manContourModel = new manualContourModel(); + GConnectorController *connectorcontroller = new GConnectorController(); + GConnectorModel *connectorModel = new GConnectorModel(); + vtkGConnectorView *connectorView = new vtkGConnectorView(); connectorModel->setGObjectType(type); manContourModel->SetCloseContour(false); @@ -527,7 +523,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { manContourView->SetModel(manContourModel); manContourView->SetWxVtkBaseView(_baseView); manContourView->SetRange(0.5); - manContourView->SetZ(900); + manContourView->SetZ(GPOSITION_Z); manContourView->SetColorNormalContour(0, 0, 1); manContourView->SetColorEditContour(0.5, 0.5, 0.5); @@ -535,7 +531,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { /** * JGRR AND CM - * Width increased from 2 to 5, it simplifies line handling and spline control :P + * Width increased from 2 to 3, it simplifies line handling and spline control :P * @param WidthLine */ manContourView->SetWidthLine( 3 ) ; @@ -548,7 +544,8 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { double x, y, z; connectorModel->getInicPoint(x, y, z); - + + manContourControl->SetState(1); manContourModel->SetCloseContour(false); @@ -576,7 +573,8 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) { connectorModel->addObserver(connectorView); connectorModel->addObserver(this); - manContourView->Refresh(); +// manContourView->Refresh(); + return newId; } @@ -629,26 +627,9 @@ void wxVtkSceneManager::update(int idController, int command) { if (command != NO_COMMAND) { if (command == ADD_TO_SELECTED) { - //EEDBorrame GObjectController* cont = _controllers[idController]; - if (GetIndexInSelected(idController) == -1) { _selectedObjects.push_back(idController); } - - //EEDBorrame - // bool foundID=false; - // for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++) - // { - // if(_selectedObjects[i]==idController) - // { - // foundID = true; - // } - // } - // if(!foundID) - // { - // _selectedObjects.push_back(idController); - // } - } else if (command == REMOVE_FROM_SELECTED) { int index = GetIndexInSelected(idController); if (index >= 0) { @@ -688,8 +669,8 @@ void wxVtkSceneManager::update(int idController, int command) { // EO JGRR & CM WH - _worldState = INIT_CREATION_CONTOUR; - GObjectController* cont = _controllers[idController]; + _worldState = INIT_CREATION_CONTOUR; + GObjectController* cont = _controllers[idController]; GPortModel* startOutputPort = (GPortModel*) cont->getModel(); // The last one is the controller of the connector @@ -714,13 +695,12 @@ void wxVtkSceneManager::update(int idController, int command) { } _selectedObjects.clear(); _idConnectionInCreation = createGConnector(startOutputPort); - } else if (command == FIN_CREATION_CONTOUR && _worldState - == INIT_CREATION_CONTOUR) { + } else if (command == FIN_CREATION_CONTOUR && _worldState == INIT_CREATION_CONTOUR) { _worldState = NOTHING_HAPPENS; //int id = _controllers.size()-1; - GObjectController *cont = _controllers[_idConnectionInCreation]; - GConnectorModel *modelContour = (GConnectorModel*) cont->getModel(); - GObjectController *finPort = _controllers[idController]; + GObjectController *cont = _controllers[_idConnectionInCreation]; + GConnectorModel *modelContour = (GConnectorModel*) cont->getModel(); + GObjectController *finPort = _controllers[idController]; if (finPort->getGObjectType() == GPORT) { GPortModel* modelPort = (GPortModel*) finPort->getModel(); @@ -752,12 +732,8 @@ void wxVtkSceneManager::update(int idController, int command) { _parent->saveTempandUpdate("create connection"); } - manualConnectorContourController - * manCont = - ((GConnectorController*) cont)->getManualContourController(); - manualConnectorContourView - * connView = - (manualConnectorContourView*) manCont->GetManualViewBaseContour(); + manualConnectorContourController *manCont = ((GConnectorController*) cont)->getManualContourController(); + manualConnectorContourView *connView = (manualConnectorContourView*) manCont->GetManualViewBaseContour(); std::map::iterator it2; @@ -769,7 +745,7 @@ void wxVtkSceneManager::update(int idController, int command) { } cont->SetActive(true); } - connView->Refresh(); + connView->Refresh(); } } @@ -780,11 +756,10 @@ void wxVtkSceneManager::update(int idController, int command) { bool wxVtkSceneManager::OnMouseMove() { int X, Y; - bool okStatusMessage = false; - bool okPortMessage = false; + bool okStatusMessage = false; + bool okPortMessage = false; wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren - = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); if (_worldState == DRAG_OBJECTS) { @@ -811,14 +786,13 @@ bool wxVtkSceneManager::OnMouseMove() { _startDragging = false; - } else if (_worldState == NOTHING_HAPPENS || _worldState - == INIT_CREATION_CONTOUR) { + } else if (_worldState == NOTHING_HAPPENS || _worldState == INIT_CREATION_CONTOUR) { std::map::iterator it; double px, py, pz; for (it = _controllers.begin(); it != _controllers.end(); ++it) { GObjectController *desc = it->second; - int type = desc->getGObjectType(); - int state = desc->getView()->getState(); + int type = desc->getGObjectType(); + int state = desc->getView()->getState(); desc->getModel()->getCenter(px, py, pz); // JGRR & CM @@ -897,14 +871,12 @@ bool wxVtkSceneManager::OnLeftButtonDown() { } else { //_worldState - _worldState = DRAG_OBJECTS; - _startDragging = true; + _worldState = DRAG_OBJECTS; + _startDragging = true; - int shiftkey = - _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey(); - int ctrlkey = - _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); - ctrlkey = ctrlkey + shiftkey; + int shiftkey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey(); + int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); + ctrlkey = ctrlkey + shiftkey; GObjectController *cont = GetGBlackBoxControlerPointedByMouse(); @@ -1180,17 +1152,13 @@ void wxVtkSceneManager::deleteObject(int id) { int type = cont->getGObjectType(); if (type == GCONNECTOR) { GConnectorModel *conMod = (GConnectorModel*) cont->getModel(); - if (conMod->getStartPort() != NULL - && conMod->getStartPort()->getParentBox()->getObjectId() - == bbmod->getObjectId()) { - AddControlerToBeRemove(&controllersToRemove, - conMod->getObjectId()); + if (conMod->getStartPort() != NULL && conMod->getStartPort()->getParentBox()->getObjectId() == bbmod->getObjectId()) + { + AddControlerToBeRemove(&controllersToRemove,conMod->getObjectId()); } - if (conMod->getEndPort() != NULL - && conMod->getEndPort()->getParentBox()->getObjectId() - == bbmod->getObjectId()) { - AddControlerToBeRemove(&controllersToRemove, - conMod->getObjectId()); + if (conMod->getEndPort() != NULL && conMod->getEndPort()->getParentBox()->getObjectId() == bbmod->getObjectId()) + { + AddControlerToBeRemove(&controllersToRemove,conMod->getObjectId()); } } } @@ -1771,6 +1739,9 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { if (line == "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file") { version = line.substr(18, 3); } + if (line == "# - BBTKGEditor v 1.3 BBG BlackBox Diagram file") { + version = line.substr(18, 3); + } } else if (line == "APP_START") { start = true; break; @@ -1869,6 +1840,11 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { std::istringstream zSt(zInic); zSt >> zIn; + if (version<="1.2") + { + if (zIn==900) zIn=GPOSITION_Z; + } + getline(inputStream, line);//FIN_COMPLEX_PORT configGComBoxInputOutputPort(true, inputPortName, xIn, yIn, zIn); @@ -1915,10 +1891,14 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { std::istringstream zSt(zInic); zSt >> zIn; + if (version<="1.2") + { + if (zIn==900) zIn=GPOSITION_Z; + } + getline(inputStream, line);//FIN_COMPLEX_PORT - configGComBoxInputOutputPort(false, outputPortName, xIn, yIn, - zIn); + configGComBoxInputOutputPort(false, outputPortName, xIn, yIn, zIn); } // for output complex box @@ -1974,6 +1954,13 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { std::istringstream zSt(zInic); zSt >> zIn; + + if (version<="1.2") + { + if (zIn==900) zIn=GPOSITION_Z; + } + + //---------- getline(inputStream, line);//xEnd:yEnd:zEnd strcpy(coord, line.c_str()); @@ -1992,14 +1979,19 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { std::istringstream zEt(zEnd); zEt >> zEn; + if (version<="1.2") + { + if (zEn==900) zEn=GPOSITION_Z; + } + + bool boxExecutable = false; if (isExec == "TRUE") { boxExecutable = true; } int idBox = createGBlackBox(xIn, yIn, package, type); - configGBlackBox(idBox, xIn, yIn, zIn, name, boxExecutable, xEn, - yEn, zEn); + configGBlackBox(idBox, xIn, yIn, zIn, name, boxExecutable, xEn, yEn, zEn); GObjectController *cont = _controllers[idBox]; GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel(); @@ -2053,17 +2045,13 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { result = strtok(NULL, delims); std::string nameEndPort(result); - int idCon = configGConnetion(nameStartBox, nameStartPort, - nameEndBox, nameEndPort); + int idCon = configGConnetion(nameStartBox, nameStartPort,nameEndBox, nameEndPort); if (version != "1.0") { //Readding control points of the manualContour - //ups1 - GConnectorController *tempp = - (GConnectorController*) _controllers[idCon]; - GConnectorModel *conMod = (GConnectorModel*) tempp->getModel(); - vtkGConnectorView *conView = - (vtkGConnectorView*) tempp->getView(); + GConnectorController *tempp = (GConnectorController*) _controllers[idCon]; + GConnectorModel *conMod = (GConnectorModel*) tempp->getModel(); + vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView(); getline(inputStream, line); //NumberOfControlPoints:## strcpy(conns, line.c_str()); result = strtok(conns, delims); @@ -2088,9 +2076,13 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) { result = strtok(NULL, delims); std::istringstream isPointZ(result); isPointZ >> pz; - - conMod->getManualContourModel()->InsertPoint_id(ii + 1, px, - py, pz); + + if (version<="1.2") + { + if (pz==900) pz=GPOSITION_Z; + } + + conMod->getManualContourModel()->InsertPoint_id(ii + 1, px, py, pz); conView->getManualContourView()->AddPoint(); } }// version !=1.0 -- 2.47.1