printf(
"RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n",
this);
-#ifdef __APPLE__
+//#ifdef __APPLE__
_baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
-#endif
+//#endif
configureBaseView();
_worldState = NOTHING_HAPPENS;
wxVtkSceneManager::~wxVtkSceneManager() {
//FCY memory leaks
- printf("EED %p ~wxVtkSceneManager()\n", this);
+ printf("EED %p ~wxVtkSceneManager() START\n", this);
disconnectDrop();
delete _baseView;
+ printf("EED %p ~wxVtkSceneManager() END\n", this);
}
//=========================================================================
_baseView->GetRenderer()->SetBackground(0.9, 0.9, 0.9);
_baseView->GetRenderer()->GradientBackgroundOn();
- _baseView->Refresh();
// Actos Port_Text
_textActor = vtkTextActor3D::New();
BlackBoxDescriptor::Pointer descriptor =
GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
packageName, boxType);
-
+ if (descriptor == NULL){
+ printf("SCP: ERROR in wxVtkSceneManager::createGBlackBox, box %s probably does not exist.\n", boxType.c_str());
+ }
//Prepares the initial model
//The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
manContourView->SetColorNormalContour(0, 0, 1);
manContourView->SetColorEditContour(0.5, 0.5, 0.5);
manContourView->SetColorSelectContour(1, 0.8, 0);
- manContourView->SetWidthLine(1);
+
+ /**
+ * JGRR AND CM
+ * Width increased from 2 to 5, it simplifies line handling and spline control :P
+ * @param WidthLine
+ */
+ manContourView->SetWidthLine( 3 ) ;
manContourView->SetShowText(false);
manContourControl->SetModelView(manContourModel, manContourView);
manContourControl->CreateNewManualContour();
- manContourView->RefreshContour();
double x, y, z;
connectorModel->getInicPoint(x, y, z);
int bak = manContourControl->GetNumberOfPointsManualContour() - 1;
manContourControl->_bakIdPoint = bak;
- manContourView->Refresh();
-
+
manContourControl->SetMoving(false);
connectorcontroller->setModelAndView(connectorModel, connectorView);
connectorModel->addObserver(connectorView);
connectorModel->addObserver(this);
+ manContourView->Refresh();
return newId;
}
_selectedObjects.erase(_selectedObjects.begin() + index);
}
} else if (command == INIT_CREATION_CONTOUR) {
- _worldState = INIT_CREATION_CONTOUR;
+
+ // JGRR & CM WH
+ typedef std::map<int , GObjectController*>::iterator TIterator ;
+ TIterator iter ;
+ TIterator iter_end ;
+ // Find current item in the controller
+ iter = _controllers.find( idController ) ;
+ iter_end = _controllers.end( ) ;
+ // If item exist
+ if ( iter != iter_end ) {
+ GObjectController* gobjc = iter->second ;
+
+ std::string bbtkType = gobjc->getModel( )->getBBTKType( ) ;
+ // And if the item is a port
+ if ( gobjc->getModel( )->getGObjectType( ) == GPORT ) {
+ TIterator c_it = _controllers.begin( ) ;
+ // Go through all componets
+ for ( c_it ; c_it != iter_end ; c_it++ ) {
+ GObjectController* obc = c_it->second ;
+ int obc_type = obc->getModel( )->getGObjectType( ) ;
+ std::string obc_bbtkType = obc->getModel( )->getBBTKType( ) ;
+ // if the component is a port and the type is the same of that selected
+ if ( ( obc_type == GPORT ) && ( obc_bbtkType == bbtkType ) ) {
+ // Highliht element
+ obc->getView( )->setState( POSSIBLE_CONNECTION ) ;
+ //obc->getView( )->setState( HIGHLIGHTED ) ;
+ }
+ }
+ }
+ }
+
+ // EO JGRR & CM WH
+
+ _worldState = INIT_CREATION_CONTOUR;
GObjectController* cont = _controllers[idController];
GPortModel* startOutputPort = (GPortModel*) cont->getModel();
if (finPort->getGObjectType() == GPORT) {
GPortModel* modelPort = (GPortModel*) finPort->getModel();
modelContour->setEndPort(modelPort);
- _parent->saveTempDiagram();
+
+ // JGRR CM
+ typedef std::map<int, GObjectController*>::iterator TIterator;
+ TIterator c_it = _controllers.begin();
+ TIterator iter_end = _controllers.end();
+ // Go through all componets
+ for (c_it; c_it != iter_end; c_it++) {
+ GObjectController* obc = c_it->second;
+ int obc_type = obc->getModel()->getGObjectType();
+ int obc_state = obc->getView()->getState();
+ // if the component is a port and the type is the same of that selected
+ if ((obc_type == GPORT) && (obc_state == POSSIBLE_CONNECTION)) {
+ // Return element to neutral state if not selected
+ obc->getView()->setState(NOTHING_HAPPENS);
+ }
+ if ((obc_type == GPORT) && (obc_state == SELECTED_POSSIBLE_CONNECTION)) {
+ // Change element to connected state
+ obc->getView()->setState(HIGHLIGHTED);
+
+ }
+
+ }
+ // EO JGRR CM
+
+ _parent->saveTempandUpdate("create connection");
}
manualConnectorContourController
manualConnectorContourView
* connView =
(manualConnectorContourView*) manCont->GetManualViewBaseContour();
- connView->Refresh();
-
+
std::map<int, GObjectController*>::iterator it2;
for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
}
cont->SetActive(true);
}
+ connView->Refresh();
}
}
-
+
}
//=========================================================================
int state = desc->getView()->getState();
desc->getModel()->getCenter(px, py, pz);
- if (state == HIGHLIGHTED) {
+ // JGRR & CM
+ if ((state == HIGHLIGHTED) || (state == SELECTED_POSSIBLE_CONNECTION )) {
+ // EO JGRR & CM
okStatusMessage = true;
updateStatusBar(desc->getStatusText());
if (type == GBLACKBOX) {
if (portmod->getPortType() == GINPUTPORT
&& portView->getState() == HIGHLIGHTED) {
isOverPort = true;
- } // if
- } // if
+ } // if
+ // JGRR & CM
+ if ( portmod->getPortType( ) == GINPUTPORT && portView->getState( ) == SELECTED_POSSIBLE_CONNECTION ) {
+ isOverPort = true ;
+ portView->setState( HIGHLIGHTED);
+ }
+ // EO JGRR & CM
+
+ } // if
} // for
if (isOverPort == false) {
int id = _selectedObjects[i];
GObjectController* control = _controllers[id];
control->getView()->setState(NOTHING_HAPPENS);
+ control->getModel()->notifyObservers(_idManager);
}// for _selectedObjects
_selectedObjects.clear();
}
_selectedObjects.clear();
}
}
-
+ ctrlkey+=keyCode;
/// Duplicate
if(ctrlkey==5){
if(_selectedObjects.size()){
_controllers.erase(it);
}//if
}// for
- _parent->saveTempDiagram();
+ _parent->saveTempandUpdate("delete object");
}
//=========================================================================
}
_selectedObjects.clear();
_controllers.clear();
- refreshScene();
}
//=========================================================================
_baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, temp[2]);
_baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
_baseView->GetRenderer()->GetActiveCamera()->SetPosition(0, 0, temp[2]);
- _baseView->RefreshView();
-
}
//=========================================================================
} // start
- refresh();
}
//=========================================================================
boxModel = findGBox(nameStartBox);
if (boxModel != NULL) {
startP = boxModel->getOutputPort(nameStartPort);
+ if(startP == NULL){
+ printf("SCP: ERROR in wxVtkSceneManager::configGConnetion start port %s is null. Port name is probably wrong.\n", nameStartPort.c_str());
+ }
}
boxModel = findGBox(nameEndBox);
if (boxModel != NULL) {
endP = boxModel->getInputPort(nameEndPort);
+ if(endP == NULL){
+ printf("SCP: ERROR in wxVtkSceneManager::configGConnetion end port %s is null. Port name is probably wrong\n", nameStartPort.c_str(), nameEndPort.c_str());
+ }
}
//ups2
int newId = _contLastId;//_controllers.size();
objController->setId(newId);
_controllers[newId] = objController;
- std::cout
- << "DFCH: int wxVtkSceneManager::addObjectController(GObjectController* objController) ---- _contLastId = "
- << _contLastId << std::endl;
+ //std::cout << "DFCH: int wxVtkSceneManager::addObjectController(GObjectController* objController) ---- _contLastId = " << _contLastId << std::endl;
_contLastId++;
return newId;
}
cont->getModel()->notifyObservers(_idManager);
}
- refreshScene();
}
//=========================================================================
+void wxVtkSceneManager::printAll(int com , int sta ){
+
+ int tmpState = sta ;
+ if ( tmpState == NOTHING_HAPPENS ) {
+ std::cout << "CONTROLER STATE---->NOTHING_HAPPENS\n" ;
+ }
+ if ( tmpState == HIGHLIGHTED ) {
+ std::cout << "CONTROLER STATE---->HIGHLIGHTED\n" ;
+ }
+ if ( tmpState == POSSIBLE_CONNECTION ) {
+ std::cout << "CONTROLER STATE---->POSSIBLE_CONNECTION\n" ;
+ }
+ if ( tmpState == SELECTED_POSSIBLE_CONNECTION ) {
+ std::cout << "CONTROLER STATE---->SELECTED_POSSIBLE_CONNECTION\n" ;
+ }
+ if ( tmpState == CLICKED ) {
+ std::cout << "CONTROLER STATE---->CLICKED\n" ;
+ }
+ if ( tmpState == DRAG ) {
+ std::cout << "CONTROLER STATE---->DRAG\n" ;
+ }
+ if ( tmpState == SELECTED ) {
+ std::cout << "CONTROLER STATE---->SELECTED\n" ;
+ }
+ if ( tmpState == CREATING_CONTOUR ) {
+ std::cout << "CONTROLER STATE---->CREATING_CONTOUR\n" ;
+ }
+
+ // :P
+
+ int command = com ;
+ if ( command == INIT_CREATION_CONTOUR ) {
+ std::cout << "COMMAND ----> INIT_CREATION_CONTOUR \n" ;
+ }
+ if ( command == FIN_CREATION_CONTOUR ) {
+ std::cout << "COMMAND ----> FIN_CREATION_CONTOUR \n" ;
+ }
+ if ( command == ADD_TO_SELECTED ) {
+ std::cout << "COMMAND ----> ADD_TO_SELECTED \n" ;
+ }
+ if ( command == DRAG_OBJECTS ) {
+ std::cout << "COMMAND ----> DRAG_OBJECTS \n" ;
+ }
+ if ( command == EDIT_BLACKBOX ) {
+ std::cout << "COMMAND ----> EDIT_BLACKBOX \n" ;
+ }
+ if ( command == REMOVE_FROM_SELECTED ) {
+ std::cout << "COMMAND ----> REMOVE_FROM_SELECTED \n" ;
+ }
+
+ }
+
+
} // EO namespace bbtk
// EOF