wxVtkSceneManager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00038
00039
00040
00041
00042
00043
00044 #ifndef __wxVtkSceneManager_h__
00045 #define __wxVtkSceneManager_h__
00046
00047
00048 #include "GObjectsMVCFactory.h"
00049 #include "Observer.h"
00050 #include "GBoxModel.h"
00051 #include "GComplexBoxPortModel.h"
00052 #include "GPortModel.h"
00053 #include "vtkGConnectorView.h"
00054 #include "GConnectorModel.h"
00055 #include "GConnectorController.h"
00056 #include "vtkGPortView.h"
00057 #include "manualConnectorContourView.h"
00058 #include "manualConnectorContourController.h"
00059 #include "wxGEditorTabPanel.h"
00060
00061
00062 #include <bbtkBlackBoxInputDescriptor.h>
00063 #include <bbtkBlackBoxDescriptor.h>
00064
00065
00066 #include <wxVtk3DBaseView.h>
00067 #include <InteractorStyleMaracas.h>
00068 #include <vtkInteractorStyleBaseView2D.h>
00069 #include <manualContourControler.h>
00070 #include <manualContourModel.h>
00071
00072
00073 #include <vtkRenderWindow.h>
00074 #include <vtkRenderWindowInteractor.h>
00075 #include <vtkRenderer.h>
00076 #include <vtkInteractorStyleImage.h>
00077 #include <vtkActor.h>
00078 #include <vtkPoints.h>
00079 #include <vtkTextActor3D.h>
00080 #include <vtkDataSetMapper.h>
00081
00082
00083
00084 #include <iostream>
00085 #include <string>
00086 #include <sstream>
00087 #include <map>
00088
00089 namespace bbtk
00090 {
00091 class wxGEditorTabPanel;
00092
00093 class wxVtkSceneManager : public InteractorStyleMaracas , public Observer
00094 {
00095 public:
00096
00097 wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView, int idManager);
00098 ~wxVtkSceneManager();
00099 void disconnectDrop();
00100
00101
00102 void configureBaseView();
00103 void registerController(InteractorStyleMaracas *param);
00104 void unregisterController(InteractorStyleMaracas *param);
00105
00106 virtual bool OnChar();
00107 virtual bool OnMouseMove();
00108 virtual bool OnLeftButtonDown();
00109 virtual bool OnLeftButtonUp();
00110 virtual bool OnRightButtonUp();
00111 virtual bool OnLeftDClick();
00112 virtual bool OnMiddleButtonDown();
00113 virtual bool OnMiddleButtonUp();
00114
00115
00116 int createGBlackBox(int x, int y, std::string packageName, std::string boxType );
00117 int createGComplexBoxInputPort(std::string inputName);
00118 int createGComplexBoxOutputPort(std::string outputName);
00119 GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBoxModel *blackBox);
00120 int createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc);
00121 int createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
00122 int createGConnector(GPortModel* startPort);
00123
00124 void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn);
00125 int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string
00126 nameEndBox, std::string nameEndPort);
00127 void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn);
00128 GBoxModel* findGBox(std::string boxname);
00129
00130
00131
00132 vtkRenderWindow* getRenderWindow();
00133 vtkRenderer* getRenderer();
00134
00135 virtual void update(int idController,int command);
00136
00137 void refresh();
00138 void refreshScene();
00139 void displayBlackBoxInfo(std::string packageName, std::string boxName);
00140 void updateStatusBar(std::string textStatus);
00141
00142
00143
00144 std::vector<int> getBlackBoxes();
00145 std::vector<int> getConnections();
00146 std::vector<int> getComplexInputPorts();
00147 std::vector<int> getComplexOutputPorts();
00148
00149
00150 std::map<int,GObjectController*> getSelectedObjects();
00151
00152
00153 int getNumSelectedObjects();
00154
00155
00156 bool isComplexBox();
00157 void setComplexBox(bool val);
00158
00159
00160
00161 int addObjectController(GObjectController* objController);
00162
00163
00164 void addObjects(std::map<int,GObjectController*> objectsMap);
00165
00167 void DuplicateObjects(std::map<int,GObjectController*> objectsMap);
00168
00169
00170
00171 bool MakeBoxExecutable();
00172
00173
00174 std::string getDiagramBBS(bool wln=false);
00175
00176
00177 std::string saveComplexBoxBBS();
00178
00179
00180 void deleteObject(int id);
00181
00182 void AddControlerToBeRemove(std::vector<int> *controllersToRemove, int id);
00183
00184
00185 void deleteAllBoxes();
00186
00187
00188 void saveDiagram(std::string &content);
00189
00190
00191 void loadDiagram(std::stringstream &inputStream);
00192
00193
00194 void centerView();
00195
00196 bool boxExist(std::string boxname);
00197 std::string generateANewNameForABox();
00198 std::string findANewNameForABox();
00199
00200
00201 void SetCbName(std::string cbNane);
00202 void SetCbPackageName(std::string packagename);
00203 void SetAuthor(std::string author);
00204 void SetCategory(std::string category);
00205 void SetDescription(std::string description);
00206
00207 std::string GetCbName();
00208 std::string GetCbPackageName();
00209 std::string GetAuthor();
00210 std::string GetCategory();
00211 std::string GetDescription();
00212
00213
00214 void printAll( int com, int sta );
00215
00216 private:
00217
00218 std::string _cbName;
00219 std::string _cbPackageName;
00220 std::string _Author;
00221 std::string _Category;
00222 std::string _Description;
00223
00224
00225 wxGEditorTabPanel *_parent;
00226
00227
00228 int _idManager;
00229
00230
00231 int _numBoxes;
00232
00233
00234 bool _startDragging;
00235
00236
00237 wxVtk3DBaseView *_baseView;
00238
00239
00240 int _worldState;
00241
00242
00243 std::map<int,GObjectController*> _controllers;
00244
00245
00246 std::vector<int> _selectedObjects;
00247
00248
00249 bool _isComplexBox;
00250
00251 int _idConnectionInCreation;
00252
00253 int _contLastId;
00254
00255 vtkTextActor3D *_textActor;
00256 vtkPoints *_pts;
00257 vtkActor *_fillObjectActor;
00258 vtkDataSetMapper *_aPolygonMapper;
00259
00260 std::string LineNumber(bool withLineNumber, int &value);
00261 int GetIndexInSelected(int idControler);
00262 void UnSelectBlackBoxes();
00263 GObjectController *GetGBlackBoxControlerPointedByMouse();
00264 void CancelConnection();
00265
00266 protected:
00267
00268 };
00269
00270
00271 }
00272
00273 #endif
00274