}
//=========================================================================
-
+
+ void GBlackBoxModel::setValueToInputPort(int pos,std::string value)
+ {
+ _inputs[pos]->setValue(value);
+ }
+
+ //=========================================================================
} // EO namespace bbtk
std::vector<GPortModel*> getInputPorts();
std::vector<GPortModel*> getOutputPorts();
+ void setValueToInputPort(int pos,std::string value);
+
private:
//Private Attributes
_portType=-1;
_posInBox=0;
_isConnected=false;
+ _value="";
+ _isValueSet=false;
}
//=========================================================================
temp+=" Type:";
temp+=_bbtkType;
temp+=" Box:";
- temp+=_parentBox->getBBTKType();
+ temp+=_parentBox->getBBTKType();
if(_portType==GOUTPUTPORT)
{
temp+=" [Output Port]";
}
else if(_portType==GINPUTPORT)
{
+ if(isValueSet())
+ {
+ temp+=" Value:";
+ temp+=_value;
+ }
temp+=" [Input Port]";
}
_isConnected=value;
}
+ //=========================================================================
+
+ void GPortModel::setValue(std::string value)
+ {
+ _value = value;
+ if(_value=="")
+ {
+ _isValueSet=false;
+ }
+ else
+ {
+ _isValueSet=true;
+ }
+ notifyObservers(_objectId);
+ }
+
+ //=========================================================================
+
+ std::string GPortModel::getValue()
+ {
+ return _value;
+ }
+
+ //=========================================================================
+
+ bool GPortModel::isValueSet()
+ {
+ return _isValueSet;
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF
virtual std::string getStatusText();
bool isConnected();
void setConnected(bool value);
+ bool isValueSet();
+ void setValue(std::string value);
+ std::string getValue();
private:
int _portType;
int _posInBox;
bool _isConnected;
+ std::string _value;
+ bool _isValueSet;
//Private Methods
const int FIN_CREATION_CONTOUR= 203;
const int ADD_TO_SELECTED = 204;
const int DRAG_OBJECTS = 205;
+ const int EDIT_BLACKBOX = 206;
//// COLORS (object_state_(R|G|B))
void wxVtkSceneManager::createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc)
{
- createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+ GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+ blackBox->addInputPort((GPortModel*)portController->getModel());
}
//=========================================================================
void wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
{
- createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+ GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+ blackBox->addOutputPort((GPortModel*)portController->getModel());
}
//=========================================================================
- void wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBlackBoxModel *blackBox)
+ GPortController* wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBlackBoxModel *blackBox)
{
int type = GPORT;
int newId = _controllers.size();
controller->setId(newId);
_controllers[newId] = controller;
+
+ return (GPortController*)controller;
}
//=========================================================================
cont->SetActive(true);
}
}
+ else if(command == EDIT_BLACKBOX)
+ {
+ GObjectController* cont = _controllers[idController];
+
+ for (int i=0; i<_selectedObjects.size(); i++)
+ {
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ cont->getView()->setState(NOTHING_HAPPENS);
+ }
+ _selectedObjects.clear();
+
+ GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
+ _parent->editBlackBox(bbmodel);
+
+ }
}
}
script+="\n";
}
+ script+="load std\n";
+
for(i = 0; i<boxes.size();i++)
{
script+="new ";
script+=" ";
script+=model->getBBTKName();
script+="\n";
+
+ std::vector<GPortModel*> inputs = model->getInputPorts();
+ for(int j = 0; j<inputs.size();j++)
+ {
+ GPortModel* inputPort = inputs[j];
+ if(inputPort->isValueSet())
+ {
+ script+="set ";
+ script+=model->getBBTKName();
+ script+=".";
+ script+=inputPort->getBBTKName();
+ script+=" ";
+ script+=inputPort->getValue();
+ script+="\n";
+ }
+ }
+
}
for(i = 0; i<connections.size();i++)
void configureBaseView();
void createGBlackBox(int x, int y,std::string packageName, std::string boxType);
- void createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBlackBoxModel *blackBox);
+ GPortController* createGPort(int portType, std::string bbtkName, std::string bbtkType, int posinBox,GBlackBoxModel *blackBox);
void createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc);
void createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc);
void createGConnector(GPortModel* startPort);
bool GBlackBoxController::OnLeftDClick()
{
-
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+ int state = _view->getState();
+
+ //Evaluate new state
+ if(_view->isPointInside(X,Y))
+ {
+ _model->notifyObservers(getId(),EDIT_BLACKBOX);
+ }
return true;
}
{
_fillObjectActor->GetProperty()->SetColor(0.2,0.2,0.2);
}
- else
+ else if(portm->isValueSet())
+ {
+ _fillObjectActor->GetProperty()->SetColor(0.5,0.2,0.2);
+ }
+ else
{
_fillObjectActor->GetProperty()->SetColor(0.6,0.6,0.6);
}
//=========================================================================
+ void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel)
+ {
+ wxEditionDialog* dialog = new wxEditionDialog(this,bbmodel);
+ dialog->Show();
+ }
+
+ //=========================================================================
+
void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
{
SetStatusText(_T(textStatus));
//Includes same project
#include "wxTabPanelsManager.h"
#include "wxPropertiesPanel.h"
+#include "wxEditionDialog.h"
#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm"
//Includes creaMaracasVisu
void updateStatusBar(std::string textStatus);
void executeActualDiagram();
+ void editBlackBox(GBlackBoxModel *bbmodel);
+
void RegenerateAll();
void DoRegeneratePackageDoc(const std::string& pack);
void DoRegenerateBoxesLists();
//=========================================================================
+ void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
+ {
+ _panelsManager->editBlackBox(bbmodel);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF
void displayBlackBoxInfo(std::string packageName, std::string boxName);
void updateStatusBar(std::string textStatus);
std::string getDiagramScript();
+ void editBlackBox(GBlackBoxModel *bbmodel);
private:
//=========================================================================
+ void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
+ {
+ _parent->editBlackBox(bbmodel);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
void displayBlackBoxInfo(std::string packageName, std::string boxName);
void updateStatusBar(std::string textStatus);
std::string getActualDiagramScript();
+ void editBlackBox(GBlackBoxModel *bbmodel);
private: