$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \
$(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%)
- cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
- -I @GUI_ROOT_DIR@/adm_local/unix/config_files
+ cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
+ -I @GUI_ROOT_DIR@/adm_local/unix/config_files
PACKAGE=salome
AC_SUBST(PACKAGE)
-VERSION=3.2.2
-XVERSION=0x030202
+VERSION=4.0.0
+XVERSION=0x040000
AC_SUBST(VERSION)
AC_SUBST(XVERSION)
/*! Forces use of Editor's data model and destroy of Executor
*/
void Editing();
-
+
+ /*! Returns the default name of container for C component
+ */
+ string DefaultCContainerName();
+
+ /*! Returns the default name of container for Python component
+ */
+ string DefaultPythonContainerName();
+
+ /*! Returns the last container name associated with the ComponentName component
+ */
+ string ContainerNameForComponent( in string ComponentName );
+
} ;
char *NULLSTRING = "" ;
char *FACTORYSERVER = "localhost/FactoryServer" ;
+char *FACTORYSERVERPY = "localhost/FactoryServerPy" ;
GraphBase::Base::Base() {
_prof_debug = NULL ;
extern char *NULLSTRING ;
extern char *FACTORYSERVER ;
+extern char *FACTORYSERVERPY ;
inline char * my_strdup( const char * s ) {
if (s == NULL) return NULL;
bool GraphBase::ComputingNode::EditorRelease(const char * c){
if ( _EditorRelease && _EditorRelease != NULLSTRING )
- delete _EditorRelease;
+ delete [] _EditorRelease;
_EditorRelease = my_strdup(c);
return true ;
}
cdebug_out << "RemoveLink(AddLink) toPort->GetOutPort()->NodeName() RemoveLink Error." << endl ;
return false ;
}
+ if ( fromNode->IsGOTONode() && fromPort->IsGate() ) { // mkr : PAL12575
+ ((GraphBase::GOTONode * ) fromNode)->CoupledNode( (GraphBase::InLineNode * ) toNode ) ;
+ }
}
if ( !fromNode->IsDataFlowNode() && !fromNode->IsDataStreamNode() &&
}
else {
fromNode->RemoveLinkedNode( toNode ) ;
+ // mkr : PAL12575 -->
+ if ( fromNode->IsGOTONode() ) {
+ GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) fromNode ;
+ if ( aGOTONode->CoupledNode() && strcmp( aGOTONode->CoupledNode()->Name(), toNode->Name() ) == 0 ) {
+ aGOTONode->CoupledNode(NULL);
+ aGOTONode->CoupledNodeName("");
+
+ // set ExternConnected status for output data port of GoTo node
+ for ( int aPortId = 0 ; aPortId < fromNode->GetNodeOutPortsSize() ; aPortId++ ) {
+ GraphBase::OutPort * anOutPort = fromNode->GetChangeNodeOutPort(aPortId) ;
+ if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() )
+ anOutPort->PortStatus( ExternConnected ) ;
+ }
+ }
+ }
+ // mkr : PAL12575 <--
}
}
//JR PAL7990 : a SwitchPort is an OutPort of a SwitchNode connected to a InGate Port
else {
cdebug << "ERROR Node and/or Port not found : " << aNodeName << " " << aPortName << endl ;
}
- delete aNodeName ;
- delete aPortName ;
+ delete [] aNodeName ;
+ delete [] aPortName ;
cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl;
return RetVal ;
return true ;
}
+// mkr : PAL12575
+bool GraphBase::Graph::ValidGOTO() {
+ cdebug_in << "GraphBase::Graph::ValidGOTO" << endl;
+ bool RetVal = true ;
+ int i, j ;
+ GraphBase::ComputingNode * aNode ;
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ aNode = GraphNodes( i ) ;
+ if ( aNode->IsGOTONode() ) {
+ GraphBase::GOTONode * aGoToNode = (GraphBase::GOTONode * ) aNode ;
+ GraphBase::InLineNode * aCoupledNode ;
+ aCoupledNode = (GraphBase::InLineNode * ) aGoToNode->CoupledNode() ;
+ if ( aCoupledNode ) {
+ ostringstream ErrorMessage ;
+ // 1. Check the number of ports (the number of OutPorts of a GOTONode and of InPorts of its linked
+ // InLine node must be the same)
+ if ( aNode->GetNodeOutPortsSize() != aCoupledNode->GetNodeInPortsSize() ) {
+ cdebug << "GraphBase::Graph::ValidGOTO : Different ports number!" << endl ;
+ ReSetMessages() ;
+ ErrorMessage << "Different ports number : the number of OutPorts of a " << aNode->Name()
+ << " node (GoTo node) and of InPorts of its linked " << aCoupledNode->Name()
+ << " node (InLine node) must be the same!\n" ;
+ SetMessages( ErrorMessage.str() ) ;
+ RetVal = false ;
+ }
+ // 2. Check ports names (the names of OutPorts of a GOTONode and of InPorts of its linked
+ // InLine node must be the same)
+ else {
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * aBusParamOutPort = aNode->GetChangeNodeOutPort( j ) ;
+ if ( !aBusParamOutPort->IsGate() ) {
+ GraphBase::InPort * aBusParamChangeInPort = NULL ;
+ aBusParamChangeInPort = aCoupledNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
+ if ( !aBusParamChangeInPort ) {
+ cdebug << "GraphBase::Graph::ValidGOTO : Different names of ports!" << endl ;
+ ReSetMessages() ;
+ ErrorMessage << "Different names of ports : there is no input port of " << aCoupledNode->Name()
+ << " node (InLine node) coupled to " << aBusParamOutPort->PortName()
+ << " output port of a " << aNode->Name()
+ << " node (GoTo node)\n" ;
+ SetMessages( ErrorMessage.str() ) ;
+ RetVal = false ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ cdebug_out << "GraphBase::Graph::ValidGOTO RetVal " << RetVal << endl;
+ return RetVal ;
+}
+
bool GraphBase::Graph::ValidLoops() const {
cdebug_in << "GraphBase::Graph::ValidLoops" << endl;
bool RetVal = true ;
const GraphBase::OutPort * anOutPort = aNode->GetNodeOutPort(j) ;
//JR Debug 06.06.2005 : if it is not a Gate !
// if ( anOutPort->IsNotConnected() ) {
- if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() ) {
+ if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() && !aNode->IsGOTONode() ) { // mkr : PAL12575
cdebug << "Graph::DataServerNodes Add[Stream]LinkedNode for OutPort "
<< aNode->Name() << "( " << anOutPort->PortName() << " , "
<< anOutPort->PortStatus() << " )" << endl ;
cdebug << "GraphBase::Graph::PortInData " << ToNodeName << " "
<< ToServiceParameterName << " ERROR no Node" << endl ;
}
- delete theNode ;
- delete aPort ;
+ delete [] theNode ;
+ delete [] aPort ;
#if TracePortInOutData
cdebug_out << "GraphBase::Graph::PortInData " << endl ;
#endif
cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " "
<< FromServiceParameterName << " ERROR no Node" << endl ;
}
- delete theNode ;
- delete aPort ;
+ delete [] theNode ;
+ delete [] aPort ;
#if TracePortInOutData
cdebug_out << "GraphBase::Graph::PortOutData " << endl ;
#endif
// int _SubStreamGraphsSize ;
// vector<vector<ComputingNode *> > _SubStreamGraphs ;
- string _Messages ;
+ string _Messages ;
- bool AddLink( GraphBase::ComputingNode *fromNode ,
- GraphBase::OutPort *fromPort ,
- GraphBase::ComputingNode *toNode ,
- GraphBase::InPort *toPort ) ;
+ map< string, string > _MapOfComponentNameContainer ; // mkr : PAL13947
+
+ bool AddLink( GraphBase::ComputingNode *fromNode ,
+ GraphBase::OutPort *fromPort ,
+ GraphBase::ComputingNode *toNode ,
+ GraphBase::InPort *toPort ) ;
public:
bool InLineServices() ;
bool Sort( int & SubStreamGraphsNumber ) ;
+ bool ValidGOTO() ; // mkr : PAL12575
bool ValidLoops() const ;
bool ValidSwitchs() const ;
bool ComputingNodes() const ;
Engines::Container_var & myContainer ,
Engines::Component_var & objComponent ) ;
+ // mkr : PAL13947
+ void InsertToMapOfComponentNameContainer( const char * theComponentName,
+ const char * theContainer) {
+ _MapOfComponentNameContainer[ theComponentName ] = theContainer ;
+ }
+
+ // mkr : PAL13947
+ const char * RetrieveFromMapOfComponentNameContainer( const char * theComponentName ) {
+ if ( _MapOfComponentNameContainer.empty()
+ ||
+ _MapOfComponentNameContainer.find(theComponentName) == _MapOfComponentNameContainer.end() )
+ return NULL ;
+
+ return _MapOfComponentNameContainer[ theComponentName ].c_str() ;
+ }
+
+ // mkr : PAL13947
+ void ClearMapOfComponentNameContainer() {
+ if ( !_MapOfComponentNameContainer.empty() )
+ _MapOfComponentNameContainer.clear();
+ }
+
};
};
long SubStreamGraphsNumber() ;
void Executor(GraphExecutor::DataFlow * DataFlowExecutor ) ;
- GraphExecutor::DataFlow * GraphEditor::DataFlow::Executor() const ;
+ GraphExecutor::DataFlow * Executor() const ;
};
aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
aNode.theComment.c_str() ,
aNode.theCoords.theX , aNode.theCoords.theY ) ;
+
+ // insert container into < ComponentName, Container > map for corresponding component
+ Graph()->InsertToMapOfComponentNameContainer( aNode.theComponentName.c_str(), aNode.theContainer.c_str() ) ; // mkr : PAL13947
+
string * aNodetheName = new string( aNode.theName ) ;
aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ;
if ( anInNode->IsOneOfInLineNodes() || anInNode->IsMacroNode() ) {
Graph()->ComputingNodes() ;
#endif
+ if ( !Graph()->ValidGOTO() ) { // mkr : PAL12575
+ cdebug << "Editor::OutNode::Valid This DataFlow have not valid GOTO(ValidGOTO)." << endl ;
+ RetVal = false ;
+ }
+
if ( RetVal ) {
_Valid = true ;
}
StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
Graph()->InLineServices() ;
-
+
// if ( kLoopSwitch ) {
if ( !Graph()->ValidLoops() ) {
cdebug << "Editor::OutNode::Executable This DataFlow have not valid Loops(ValidLoops)." << endl ;
const GraphBase::ListOfSLinks &aDatas ) ;
// bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs ,
- bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
+ bool LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
GraphBase::SLink aLink ,
bool wdata ) const ;
// bool SaveXML(ostream &f ) ;QDomDocument & Graph
bool SaveXML( ostream & f , QDomDocument & Graph ,
bool aSuperGraph , QDomElement & supergraph ) ;
- bool GraphEditor::OutNode::LinkSavePY( ostream &f ,
+ bool LinkSavePY( ostream &f ,
const char *aGraphName ,
GraphBase::SLink aLink ,
bool fromparam ,
}
}
+int GraphExecutor::FiniteStateMachine::ThreadsNumber() {
+ if( _ThreadList.begin() == _ThreadList.end() )
+ return 0;
+ else
+ return _ThreadList.size();
+}
+
ostream & operator<< (ostream &f ,const GraphExecutor::AutomatonState & aState ) {
switch (aState) {
case GraphExecutor::UnKnownState :
void JoinThread() ;
void JoinThread( pthread_t aThread ) ;
+ int ThreadsNumber() ; // mkr : IPAL14711
+
const char * ControlStateName( const SUPERV::ControlState & aState ) const {
return _ControlStateName[ aState ] ; } ;
const char * StateName( const GraphExecutor::AutomatonState & aState ) const {
_OldState = State() ;
_NextState = Automaton()->NextState( _OldState , anEvent ) ;
if ( _NextState == _OldState ) {
+ string anErrorMessage = string( "Automaton error for node " ) +
+ string( Name() ) + " (SuperVision executor error)." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
<< " GraphExecutor::InNodeThreads::SendEvent SameStates ERROR _OldState/_NextState "
<< _OldState << " Event " << Automaton()->EventName( anEvent ) << endl ;
char * msg = "Cannot pthread_create " ;
perror( msg ) ;
cdebug << ThreadNo() << " " << msg << " --> sleep(5)" << endl ;
- cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
- << PTHREAD_THREADS_MAX << " pthread_create status : " ;
+ // cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
+ // << PTHREAD_THREADS_MAX << " pthread_create status : " ;
if ( pthread_sts == EAGAIN ) {
cdebug << "EAGAIN(" << pthread_sts << ")" << endl ;
cdebug << _OutNode->CreatedThreads() << " was created (and exited)" << endl ;
delete [] msg ;
pthread_exit( msg ) ;
}
+ _OutNode->setRunFuncThread( T ) ; // mkr : IPAL14711
#if ActionsTrace
cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
<< " executeAction has created thread " << T << endl ;
int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
#if SomeDataReadyActionTrace
cdebug_in << pthread_self() << "/" << ThreadNo() << " " << Name()
- << " DataWaiting_SomeDataReadyAction from " << DataFromNode() << endl;
+ << " DataWaiting_SomeDataReadyAction from " << DataFromNode()
+ << " " << GetNodeInPortsSize() << " Inport(s)" << endl;
#endif
unsigned int k;
int InReady = 0 ;
anOutPort = anInPort->GetOutPort() ;
if ( anOutPort ) {
#if SomeDataReadyActionTrace
- cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+ << k << " "
<< anInPort->PortName() << " already setted to OutPort " << anOutPort->NodeName()
<< "( " << anOutPort->PortName() << " )" << endl ;
#endif
anOutPort = CoupledNode()->GetChangeOutPort( anInPort->PortName() ) ;
if ( anOutPort ) {
#if SomeDataReadyActionTrace
- cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+ << k << " "
<< anInPort->PortName() << " change of OutPort from "
<< anInPort->GetOutPort()->NodeName() << "( " << anInPort->GetOutPort()->PortName()
<< " ) to " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )"
#endif
}
else {
- cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+ << k << " "
<< anInPort->PortName() << " have NO OutPort ERROR " << endl ;
return 0 ;
}
anOutPort = anInPort->GetOutPort() ;
}
#if SomeDataReadyActionTrace
- cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort"
+ << k << " "
<< anInPort->PortName() << " " << anInPort->PortState() << " "
<< anInPort->PortStatus() << " " << anInPort->Kind() ;
if ( anOutPort ) {
#endif
cdebug << endl ;
#endif
+//JR 30.01.2007 : wrong debug for PAL12455
+#if 0
// mkr : PAL12455 -->
// MacroNode : give immediately the value to the corresponding graph
if ( IsMacroNode() ) {
aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ;
}
// mkr : PAL12455 <--
+#endif
}
else if ( IsLoopNode() && anInPort->IsDataConnected() ) {
anInPort->PortState( SUPERV::ReadyState ) ;
cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasAllDataReady"
<< endl ;
#endif
+//JR 30.01.2007 Right Debug PAL12455 --->
+//That must be done only for DataConnected ports and only once
+ if ( IsMacroNode() ) {
+ GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
+ for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) {
+ GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ;
+ GraphBase::OutPort * anOutPort ;
+ anOutPort = anInPort->GetOutPort() ;
+ if ( anInPort->IsDataConnected() ) {
+ cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Name()
+ << " --> InputOfAny " << InReady << "/" << GetNodeInPortsSize()
+ << " InPorts are Ready ( " << anInPort->PortName()
+ << " ) ===> InputOfAny" << endl ;
+ aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ;
+ }
+ }
+ }
+// <--- JR 30.01.2007 Right Debug PAL12455
HasAllDataReady( true ) ; // ==> Ready to execute
res = 1 ;
}
else { // At least one Flag == 0 :
+#if SomeDataReadyActionTrace
+ cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasNOTAllDataReady "
+ << InReady << "/" << GetNodeInPortsSize() << " DoAllDataReadyIf " << DoAllDataReadyIf << endl ;
+#endif
HasAllDataReady( false ) ;
res = SendEvent( GraphExecutor::NotAllDataReadyEvent );
}
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
_PyInitialized = false ;
+ _run_func_thread = 0;
pthread_mutex_init( &_MutexWait , NULL ) ;
pthread_mutex_init( &_PyMutexWait , NULL ) ;
if ( pthread_cond_init( &_EventWait , NULL ) ) {
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
_PyInitialized = false ;
+ _run_func_thread = 0;
_Orb = CORBA::ORB::_duplicate( ORB ) ;
pthread_mutex_init( &_MutexWait , NULL ) ;
pthread_mutex_init( &_PyMutexWait , NULL ) ;
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
_PyInitialized = false ;
+ _run_func_thread = 0;
_Orb = CORBA::ORB::_duplicate( ORB ) ;
pthread_mutex_init( &_MutexWait , NULL ) ;
pthread_mutex_init( &_PyMutexWait , NULL ) ;
MESSAGE("================================================================================") ;
cdebug << "================================================================================" << endl ;
cdebug << Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize "
- << EventQSize() << endl ;
+ << EventQSize() << endl ;
cdebug << "================================================================================" << endl ;
//PAL8520
cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads
<< " running threads " << _SuspendedThreads << " suspended threads IsDone() "
<< IsDone() ;
+ _run_func_thread = 0 ; // mkr : IPAL14711
if ( IsDone() ) {
cdebug << " ==> theAutomaton->Executed() " << endl ;
theAutomaton->Executed() ;
perror("pthread_mutex_lock _DoneWait") ;
exit( 0 ) ;
}
+ while ( _run_func_thread || theAutomaton->ThreadsNumber() ) {
+ // mkr : IPAL14711
+ // waiting for pthread_join in FiniteStateMachine
+ }
+ if ( Done() || IsKilled() ) Graph()->GraphEditor()->Editing(); // mkr : IPAL14572 : calling Editing() to indicate stop of execution
cdebug_out << pthread_self() << " GraphExecutor::DoneWait " << this << " " << Name()
<< " " << State() << " : " << aret << endl ;
return aret ;
list< GraphExecutor::NodeEvent > _Events ;
list< GraphExecutor::AutomatonState > _States ;
+ pthread_t _run_func_thread ;
+
bool Valid() ;
void UnValid() ;
bool Executable() ;
const char *FromParameterName ) ;
const long CpuUsed() ;
const long CpuUsed( const char *aNodeName ) ;
+
+ void setRunFuncThread( pthread_t theThread ) { _run_func_thread = theThread; } ; // mkr : IPAL14711
};
};
case CORBA::tk_long : {
CORBA::Long l ;
data >>= l ;
- PyObject * ArgValue = Py_BuildValue( "l" , l ) ;
+// epa - Porting to 64-bit Linux:CORBA::Long is incorrectly treated as unsigned
+// integer by Py_BuildValue("l", val) in Python 2.4.1. Using Py_BuildValue("i",val)
+// seemsto help
+ PyObject * ArgValue = NULL;
+ if ( SIZEOF_LONG == 4 )
+ ArgValue = Py_BuildValue( "l" , l ) ;
+ else
+ ArgValue = Py_BuildValue( "i" , l ) ;
#if PyDynInvokeTrace
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l
<< " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
// QToolTip for title and label for SUPERVGUI_CanvasCellNode
SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this);
- QPoint aPoint1 = inverseWorldMatrix().map(theEvent->pos());
- aTT->maybeTip(aPoint1);
+ aTT->maybeTip(theEvent->pos());
}
void SUPERVGUI_ArrayView::contentsMouseReleaseEvent(QMouseEvent* theEvent) {
}
}
-void SUPERVGUI_ToolTip::maybeTip(const QPoint& theP) {
- // compute collision rectangle
- QRect aSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN);
+void SUPERVGUI_ToolTip::maybeTip(const QPoint& thePos) {
+ // mkr : 23.11.2006 - PAL13957 - modifications for correct tooltips displaying after scroll or zoom
+ QPoint theP = ((QCanvasView*)parentWidget())->inverseWorldMatrix().map(thePos);
+
+ int avX, avY;
+ ((QCanvasView*)parentWidget())->contentsToViewport(theP.x(), theP.y(), avX, avY);
+ QPoint avP(avX, avY);
- QCanvasItemList l = ((QCanvasView*)parentWidget())->canvas()->collisions(aSel);
- for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QWMatrix aWM = ((QCanvasView*)parentWidget())->worldMatrix();
+
+ // compute collision rectangle for nodes, ports
+ QRect aNodeSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN);
+
+ QCanvasItemList lN = ((QCanvasView*)parentWidget())->canvas()->collisions(aNodeSel);
+ for (QCanvasItemList::Iterator it = lN.begin(); it != lN.end(); ++it)
+ {
// tooltip for node
- if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node) {
+ if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node)
+ {
SUPERVGUI_CanvasNodePrs* aNodePrs = (SUPERVGUI_CanvasNodePrs*) (*it);
QObject* anObj = aNodePrs->getObject(theP);
- if (anObj->inherits("SUPERVGUI_CanvasNode")) {
-
+ if (anObj->inherits("SUPERVGUI_CanvasNode"))
+ {
QRect aTitleRect = aNodePrs->getTitleRect();
QRect aLabelRect = aNodePrs->getLabelRect();
QRect aStatusRect = aNodePrs->getStatusRect();
if (aTitleRect.bottom()+1 == aLabelRect.top() &&
- aLabelRect.bottom()+1 == aStatusRect.top()) {
- QRect aTipRect(aTitleRect.left(), aTitleRect.top(), aTitleRect.width(),
- aTitleRect.height() + aLabelRect.height() + aStatusRect.height());
- tip(aTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ aLabelRect.bottom()+1 == aStatusRect.top())
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aTitleRect.left()*aWM.m11()),
+ (int)(aTitleRect.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aTitleRect.width()*aWM.m11()),
+ (int)((aTitleRect.height() + aLabelRect.height() + aStatusRect.height())*aWM.m22()));
+ tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
- if (aTitleRect.contains(theP, true)) {
- tip(aTitleRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ if (aTitleRect.contains(theP, true))
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aTitleRect.left()*aWM.m11()),
+ (int)(aTitleRect.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aTitleRect.width()*aWM.m11()), (int)(aTitleRect.height()*aWM.m22()));
+ tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
- if (aLabelRect.contains(theP, true)) {
- tip(aLabelRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ if (aLabelRect.contains(theP, true))
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLabelRect.left()*aWM.m11()),
+ (int)(aLabelRect.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aLabelRect.width()*aWM.m11()), (int)(aLabelRect.height()*aWM.m22()));
+ tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
- if (aStatusRect.contains(theP, true)) {
- tip(aStatusRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ if (aStatusRect.contains(theP, true))
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aStatusRect.left()*aWM.m11()),
+ (int)(aStatusRect.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aStatusRect.width()*aWM.m11()), (int)(aStatusRect.height()*aWM.m22()));
+ tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
}
// tooltip for nodes' port
- if (anObj->inherits("SUPERVGUI_CanvasPort")) {
+ if (anObj->inherits("SUPERVGUI_CanvasPort"))
+ {
SUPERVGUI_CanvasPort* aPort = (SUPERVGUI_CanvasPort*)anObj;
- tip(aPort->getPrs()->getPortRect(),
- aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText());
+ QRect aPortRect = aPort->getPrs()->getPortRect();
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aPortRect.left()*aWM.m11()),
+ (int)(aPortRect.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aPortRect.width()*aWM.m11()), (int)(aPortRect.height()*aWM.m22()));
+ tip(avTipRect, aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText());
return;
}
}
+ }
+
+ // compute collision rectangle for links
+ QRect aLinkSel((int)( theP.x() + (theP.x()-avP.x())/aWM.m11() ) - MARGIN,
+ (int)( theP.y() + (theP.y()-avP.y())/aWM.m22() ) - MARGIN,
+ 1+2*MARGIN, 1+2*MARGIN);
+
+ QCanvasItemList lL = ((QCanvasView*)parentWidget())->canvas()->collisions(aLinkSel);
+ for (QCanvasItemList::Iterator it = lL.begin(); it != lL.end(); ++it)
+ {
// tootip for links' point
- if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) {
- SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it);
- if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
- tip(aSel, aPrs->getLink()->getToolTipText());
- return;
+ if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint)
+ {
+ SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it);
+ if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLinkSel.left()*aWM.m11()),
+ (int)(aLinkSel.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aLinkSel.width()*aWM.m11()), (int)(aLinkSel.height()*aWM.m22()));
+ tip(avTipRect, aPrs->getLink()->getToolTipText());
+ }
+ return;
}
// tooltip for links' edge
- if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge) {
- SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it);
- if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
- tip(aSel, aPrs->getLink()->getToolTipText());
- return;
+ if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge)
+ {
+ SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it);
+ if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
+ {
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLinkSel.left()*aWM.m11()),
+ (int)(aLinkSel.top()*aWM.m22()),
+ avX, avY);
+ QRect avTipRect(avX, avY,
+ (int)(aLinkSel.width()*aWM.m11()), (int)(aLinkSel.height()*aWM.m22()));
+ tip(avTipRect, aPrs->getLink()->getToolTipText());
+ }
+ return;
}
- }
+ }
}
myActiveField = (aField->isEditable())? aField : 0;
}
+namespace {
+
+ QString getIORfromIO (const Handle(SALOME_InteractiveObject)& theIO,
+ SUPERVGUI * theModule)
+ {
+ QString ior ("");
+ if (!theIO->hasEntry()) return ior;
+
+ SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(theModule->getActiveStudy());
+ _PTR(SObject) aSObj (anAppStudy->studyDS()->FindObjectID(theIO->getEntry()));
+
+ _PTR(GenericAttribute) anAttr;
+ if (aSObj->FindAttribute(anAttr, "AttributeIOR")) {
+ _PTR(AttributeIOR) anIOR (anAttr);
+ ior = anIOR->Value().c_str();
+ return ior;
+ }
+ // old code, it is useless, because <aSSObj->GetObject()> here will be NULL
+ // (because it is retrieved from <aSSObj> by stored IOR)
+ /*
+ SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aSObj->GetStudy().get() );
+ SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aSObj.get() );
+ if ( aSStudy && aSSObj )
+ ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
+ //*/
+
+ // new code
+
+ // default value: null IOR (IOR:01000000010000000000...)
+ SalomeApp_Application* anApp = theModule->getApp();
+ CORBA::Object_var aNullObj;
+ ior = anApp->orb()->object_to_string(aNullObj);
+
+ // try to load a component data from an opened (presumably) study
+ _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
+ std::string aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) {
+ std::string aCompDataType = aSComp->ComponentDataType();
+
+ // obtain a driver by a component data type
+ // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+ SALOME_LifeCycleCORBA * LCC = anApp->lcc();
+ try {
+ CORBA::Object_var
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str());
+ if (CORBA::is_nil(anEngineObj))
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str());
+
+ if (!CORBA::is_nil(anEngineObj))
+ anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+ }
+ catch (...) {
+ }
+
+ if (!CORBA::is_nil(anEngine)) {
+ // try to load
+ _PTR(StudyBuilder) aStudyBuilder = aSObj->GetStudy()->NewBuilder();
+ bool isOk = true;
+ try {
+ CORBA::String_var aDriverIOR = anApp->orb()->object_to_string(anEngine);
+ aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
+ }
+ catch (...) {
+ isOk = false;
+ }
+
+ if (isOk) {
+ // now try to obtain the IOR once again (after successfull component data loading)
+ if (aSObj->FindAttribute( anAttr, "AttributeIOR" )) {
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ ior = anIOR->Value().c_str();
+ }
+ }
+ } // if (!CORBA::is_nil(anEngine))
+ } // if (!aSComp->ComponentIOR(aCompIOR))
+
+ return ior;
+ }
+
+} // no name namespace
/**
* Slot, called when selection is changed
void SUPERVGUI_BrowseNodeDlg::onSelectionChanged()
{
if ( myActiveField ) {
-
+
SALOME_ListIO aList;
aList.Clear();
return;
}
- (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))
- ->selectionMgr()->selectedObjects( aList );
-
- if( aList.Extent() == 1 ) {
+ SalomeApp_Application* anApp = aSupMod->getApp();
+ anApp->selectionMgr()->selectedObjects( aList );
+
+ if ( aList.Extent() == 1 ) {
Handle( SALOME_InteractiveObject ) anIO = aList.First();
if ( anIO->hasEntry() ) {
- _PTR(SObject) aObj ( dynamic_cast<SalomeApp_Study*>( aSupMod->getActiveStudy() )->
- studyDS()->FindObjectID( anIO->getEntry() ) );
-
- _PTR(GenericAttribute) anAttr;
- QString ior("");
-
- if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) {
- _PTR(AttributeIOR) anIOR ( anAttr );
- ior = anIOR->Value().c_str();
- }
- else {
- SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aObj->GetStudy().get() );
- SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aObj.get() );
- if ( aSStudy && aSSObj )
- ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
- }
+ QString ior = ::getIORfromIO(anIO, aSupMod);
myActiveField->setData( ior );
}
}
{
SALOME_ListIO aList;
aList.Clear();
-
+
SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
if ( !aSupMod ) {
MESSAGE("NULL Supervision module!");
return;
}
-
- (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))
- ->selectionMgr()->selectedObjects( aList );
-
- if( aList.Extent() == 1 ) {
+
+ SalomeApp_Application* anApp = aSupMod->getApp();
+ anApp->selectionMgr()->selectedObjects( aList );
+
+ if ( aList.Extent() == 1 ) {
Handle( SALOME_InteractiveObject ) anIO = aList.First();
if ( anIO->hasEntry() ) {
- _PTR(SObject) aObj ( dynamic_cast<SalomeApp_Study*>( aSupMod->getActiveStudy() )->
- studyDS()->FindObjectID( anIO->getEntry() ) );
-
- _PTR(GenericAttribute) anAttr;
- QString ior("");
-
- if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) {
- _PTR(AttributeIOR) anIOR ( anAttr );
- ior = anIOR->Value().c_str();
- }
- else {
- SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aObj->GetStudy().get() );
- SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aObj.get() );
- if ( aSStudy && aSSObj )
- ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
- }
+ QString ior = ::getIORfromIO(anIO, aSupMod);
myField->setData( ior );
}
}
#include "SUPERVGUI_CanvasControlNode.h"
#include "SUPERVGUI_CanvasControlNodePrs.h"
#include "SUPERVGUI_CanvasCellNodePrs.h"
+#include "SUPERVGUI_CanvasLink.h"
#include "SUPERVGUI_Clipboard.h"
#include "SUPERVGUI_Main.h"
#include "SUPERVGUI.h"
if (aDlg->exec()) {
QString aNodeName = aDlg->getName();
if (!aNodeName.isEmpty()) { //implement additional check from GUI side for bug PAL7007
+ // mkr : here we should re/create (if it is not yet exists) a presentation for new
+ // Goto(OutGate)->CoupledNode(InGate) link, which will be created in SetCoupled method
+
+ // check if GoTo node have coupled node
+ SUPERV_INode aCoupledNode = getGotoNode()->Coupled();
+ if ( !SUPERV_isNull(aCoupledNode) )
+ { // we got old coupled node
+ SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate");
+ SUPERV_Link anOldLinkEngine = anInGatePort->Link();
+ if ( !SUPERV_isNull(anOldLinkEngine) )
+ { // we got old link engine
+ SUPERVGUI_CanvasLink* anOldLinkPrs = getMain()->getCanvas()->getLink(anOldLinkEngine);
+ if ( anOldLinkPrs )
+ { // delete old link presentation
+ delete anOldLinkPrs;
+ anOldLinkPrs = 0;
+ }
+ }
+ }
+
getGotoNode()->SetCoupled(aNodeName.latin1());
+
+ aCoupledNode = SUPERV::INode::_narrow(getMain()->getDataflow()->Node(aNodeName.latin1()));
+ if ( !SUPERV_isNull(aCoupledNode) )
+ { // we got new coupled node
+ SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate");
+ SUPERV_Link aLinkEngine = anInGatePort->Link();
+ if ( !SUPERV_isNull(aLinkEngine) )
+ { // we got new link engine
+ if ( !getMain()->getCanvas()->getLink(aLinkEngine) )
+ { // there is no presentation for such link engine => create it
+ SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(getMain()->getCanvas(), getMain(), aLinkEngine);
+ aLink->show();
+ }
+ }
+ }
+
getMain()->getCanvas()->sync();
}
}
// QToolTip for title and label for SUPERVGUI_CanvasNode
SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this);
- aTT->maybeTip(p);
+ aTT->maybeTip(theEvent->pos());
busy = false;
}
aBaseLayoutV->setSpacing(10);
QHBoxLayout* aBaseLayout = new QHBoxLayout(aCorbaPane); //!!
+ aBaseLayout->setMargin(5);
+ aBaseLayout->setSpacing(10);
components = new QListView(aCorbaPane);
components->addColumn(tr("COL_COMPONENTS"));
components->setColumnAlignment(3, AlignLeft);
components->setSelectionMode(QListView::Extended);
components->setRootIsDecorated(true);
+
// aBaseLayout->addWidget(components);
aBaseLayoutV->addWidget(components); //!!
//NRI connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!!
//NRI aComputeCBtn->setDefault(false);
- QPushButton* aComputeBtn = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane);
- connect(aComputeBtn, SIGNAL(clicked()), this, SLOT(addFactoryNode()));
- aComputeBtn->setDefault(true);
+ QPushButton* aComputeBtnDef = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane);
+ connect(aComputeBtnDef, SIGNAL(clicked()), this, SLOT(addFactoryNodeDef()));
+ aComputeBtnDef->setDefault(true);
+
+ QPushButton* aComputeBtnCust = new QPushButton(tr("TIT_ADDFNODE_CUST"), aCorbaPane);
+ connect(aComputeBtnCust, SIGNAL(clicked()), this, SLOT(addFactoryNodeCust()));
+ aComputeBtnCust->setDefault(true);
- aBaseLayout->addWidget(aComputeBtn);
+ aBaseLayout->addWidget(aComputeBtnDef);
+ aBaseLayout->addWidget(aComputeBtnCust);
//NRI aBaseLayout->addWidget(aComputeCBtn); //!!
aBaseLayoutV->insertLayout(-1, aBaseLayout);
}
}
-void SUPERVGUI_Service::addFactoryNode() {
+void SUPERVGUI_Service::addFactoryNodeDef() {
SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication());
if ( !anApp ) return;
}
}
+void SUPERVGUI_Service::addFactoryNodeCust() {
+ SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
+ CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication());
+ if ( !anApp ) return;
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
+ if (aMain==0) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ } else if (!aMain->isEditable()) {
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ } else {
+ CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
+ SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
+ *aModuleCatalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
+ if (CORBA::is_nil(*aModuleCatalog)) {
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
+ } else {
+ QListViewItem* item;
+ bool b = false;
+
+ QListViewItemIterator iSel(components);
+ int count = 0;
+ for (; iSel.current(); ++iSel) { // check : how many objects are selected (single or multi)
+ item = iSel.current();
+ if (item->isSelected()) count++;
+ if ( count > 1) break;
+ }
+
+ QListViewItemIterator i(components);
+ QString anAuthor, aContainer, aComment;
+ bool DoneSetting = false;
+ int aRes = 0;
+ for (; i.current(); ++i) {
+ item = i.current();
+ if (item->isSelected()) {
+ const char* service = item->text(0).latin1();
+ const char* interface = item->parent()->text(0).latin1();
+ //const char* component = anApp->moduleName(item->parent()->parent()->text(0).latin1());
+ // mkr : PAL13135 -->
+ if ( aSupMod->getInterfaceNameMap().contains(item->parent()->parent()->text(0)) ) {
+ const char* component = aSupMod->getInterfaceNameMap().find(item->parent()->parent()->text(0)).data();
+ // mkr : PAL13135 <--
+
+ SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
+ if (myComponent==NULL) {
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
+ }
+ else {
+ const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service);
+ SUPERV_CNode aNode;
+ if ( myService->TypeOfNode == 0 ) { // ComputeNode
+ aNode = aMain->getDataflow()->CNode(*myService);
+ if (CORBA::is_nil( aNode ) ) {
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ return;
+ }
+ }
+ else { // Factory Node
+
+ SUPERVGUI_CustomSettings* aCSDialog = 0;
+ if ( count > 1 && !DoneSetting) { // multi selection
+ DoneSetting = true;
+ aCSDialog = new SUPERVGUI_CustomSettings(item, true, myComponent->implementation_type());
+ }
+ else if ( count == 1 ) // single selection
+ aCSDialog = new SUPERVGUI_CustomSettings(item, false, myComponent->implementation_type());
+
+ if ( aCSDialog ) {
+ aRes = aCSDialog->exec();
+ if (aRes) {
+ anAuthor = aCSDialog->Author();
+ aContainer = aCSDialog->Container();
+ aComment = aCSDialog->Comment();
+ }
+ delete aCSDialog;
+ }
+
+ aNode = aMain->getDataflow()->FNode(component, interface, *myService, myComponent->implementation_type()); // mkr : PAL11273
+ if ( CORBA::is_nil( aNode ) ) {
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ return;
+ }
+
+ if (aRes) {
+ aNode->SetAuthor(anAuthor.latin1());
+ SUPERV::FNode::_narrow(aNode)->SetContainer(aContainer.latin1());
+ aNode->SetComment(aComment.latin1());
+ }
+
+ }
+ SUPERV::INode_var aDummyEndNode;
+ addNode( aNode, aDummyEndNode, myX, myY );
+ b = true;
+ }
+ }
+ }
+ }
+ if ( !b ) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD"));
+ }
+ }
+ }
+}
void SUPERVGUI_Service::addInlineNode() {
SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
}
}
+/*!
+ Constructor
+*/
+SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings(QListViewItem* theItem,
+ bool isMultiSel,
+ bool isCimpl)
+ : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ Trace("SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings");
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
+
+ setSizeGripEnabled( true );
+
+ QGridLayout* TopLayout = new QGridLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
+ TopGroup->setColumnLayout(0, Qt::Vertical );
+ TopGroup->layout()->setSpacing( 0 );
+ TopGroup->layout()->setMargin( 0 );
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+ TopGroupLayout->setAlignment( Qt::AlignTop );
+ TopGroupLayout->setSpacing( 6 );
+ TopGroupLayout->setMargin( 11 );
+
+ QLabel* authL = new QLabel( tr( "AUTHOR_LBL" ), TopGroup);
+ authV = new QLineEdit( TopGroup );
+ authV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ authV->setMinimumSize( 200, 0 );
+ authV->setText( "" );
+
+ contL = new QLabel( tr( "CONTAINER_LBL" ), TopGroup );
+ contV = new QLineEdit( TopGroup );
+ contV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ contV->setMinimumSize( 200, 0 );
+
+ QLabel* commL = new QLabel( tr( "COMMENT_LBL" ), TopGroup);
+ commV = new QMultiLineEdit( TopGroup );
+ commV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+ commV->setMinimumSize( 200, 100 );
+
+ if ( !aSupMod->getInterfaceNameMap().contains(theItem->parent()->parent()->text(0)) ) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD"));
+ return;
+ }
+ const char* component = aSupMod->getInterfaceNameMap().find(theItem->parent()->parent()->text(0)).data();
+
+ QString aNodeDefComment;
+ if ( !isMultiSel ) {
+ // 1) set caption
+ const char* service = theItem->text(0).latin1();
+ aNodeDefComment = QString(service) + QString(tr("COMMENT_FROM")) + QString(component);
+ setCaption( tr( "TLT_CUSTOMPARAMETERS_SINGLE" ) + aNodeDefComment );
+ }
+ else {
+ // 1) set caption
+ aNodeDefComment = QString("Factory Node");
+ setCaption( tr( "TLT_CUSTOMPARAMETERS_MULTI" ) );
+ }
+
+ // 2) set Container
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
+ if (aMain==0) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ return;
+ }
+ const char* aContainer = aMain->getDataflow()->ContainerNameForComponent(component);
+ if ( aContainer && strlen(aContainer) > 0 )
+ contV->setText( QString(aContainer) );
+ else if ( isCimpl ) // C++ implementation
+ contV->setText( QString(aMain->getDataflow()->DefaultCContainerName()) );
+ else // Python implementation
+ contV->setText( QString(aMain->getDataflow()->DefaultPythonContainerName()) );
+
+ // 3) set comment
+ commV->setText( aNodeDefComment );
+
+ TopGroupLayout->addWidget( authL, 1, 0 );
+ TopGroupLayout->addWidget( authV, 1, 1 );
+ TopGroupLayout->addWidget( contL, 2, 0 );
+ TopGroupLayout->addWidget( contV, 2, 1 );
+ TopGroupLayout->addWidget( commL, 7, 0 );
+ TopGroupLayout->addMultiCellWidget( commV, 7, 8, 1, 1 );
+ TopGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 8, 0 );
+ TopGroupLayout->setColStretch( 1, 5 );
+
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+ connect( okB, SIGNAL( clicked() ), this, SLOT( okButton() ) );
+ QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+ connect( cancelB, SIGNAL( clicked() ), this, SLOT( koButton() ) );
+
+ GroupButtonsLayout->addWidget( okB, 0, 0 );
+ GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+
+ TopLayout->addWidget( TopGroup, 0, 0 );
+ TopLayout->addWidget( GroupButtons, 1, 0 );
+ TopLayout->setRowStretch( 0, 1 );
+ TopLayout->setRowStretch( 1, 0 );
+
+ resize(370,200);
+}
+
+/*!
+ Destructor
+*/
+SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings() {
+ Trace("SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings");
+}
+
+/*!
+ Get author
+*/
+QString SUPERVGUI_CustomSettings::Author() {
+ return authV->text();
+}
+
+/*!
+ Get container
+*/
+QString SUPERVGUI_CustomSettings::Container() {
+ return contV->text();
+}
+
+/*!
+ Get comment
+*/
+QString SUPERVGUI_CustomSettings::Comment() {
+ return commV->text();
+}
+
+/*!
+ <OK> button slot
+*/
+void SUPERVGUI_CustomSettings::okButton() {
+ Trace("SUPERVGUI_CustomSettings::okButton");
+ accept();
+}
+
+/*!
+ <Cancel> button slot
+*/
+void SUPERVGUI_CustomSettings::koButton() {
+ Trace("SUPERVGUI_CustomSettings::koButton");
+ reject();
+}
private slots:
void tabChanged(QWidget *);
void addComputeNode();
- void addFactoryNode();
+ void addFactoryNodeDef();
+ void addFactoryNodeCust();
void addInlineNode();
void addMacroNode();
void typeNodeSelected(int theRow);
SUPERVGUI_PythonEditPane* myNextPane;
};
+class SUPERVGUI_CustomSettings: public QDialog {
+ Q_OBJECT
+
+ public:
+ SUPERVGUI_CustomSettings(QListViewItem* theItem, bool isMultiSel, bool isCimpl);
+ virtual ~SUPERVGUI_CustomSettings();
+
+ QString Author();
+ QString Container();
+ QString Comment();
+
+ private slots:
+ void okButton();
+ void koButton();
+
+ private:
+
+ QLineEdit* authV;
+ QLineEdit* contV;
+ QLabel* contL;
+
+ QMultiLineEdit* commV;
+};
+
#endif
msgid "TLT_INFORMATIONS"
msgstr "Informations"
+msgid "TLT_CUSTOMPARAMETERS_SINGLE"
+msgstr "Set Custom Parameters for "
+
+msgid "TLT_CUSTOMPARAMETERS_MULTI"
+msgstr "Set Custom Parameters for a selected nodes"
+
msgid "TLT_DSGRAPHPARAMS"
msgstr "Data Stream Graph Parameters"
msgid "TIT_ADDFNODE"
msgstr "Add Node"
+msgid "TIT_ADDFNODE_CUST"
+msgstr "Add Node and Customize Parameters"
+
msgid "BTN_FACTORYNODE"
msgstr "Factory"
#include "StreamPort_Impl.hxx"
-char *FACTORYSERVERPY = "localhost/FactoryServerPy" ;
-
CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
PortableServer::ObjectId * contId ,
// NodeKindOfNode ) ) ;
DataFlowNode()->ComponentName( NodeComponentName ) ;
DataFlowNode()->InterfaceName( NodeInterfaceName ) ;
+
+ // mkr : PAL13947 -->
+ const char * aContainer = DataFlowEditor()->Graph()->RetrieveFromMapOfComponentNameContainer(NodeComponentName);
+ if ( aContainer ) // container for NodeComponentName component was found in the map
+ SetContainer( aContainer );
+ // mkr : PAL13947 <--
+
endService( "FNode_Impl::FNode_Impl" );
// cout << "<-- FNode_Impl::FNode_Impl" << endl ;
}
// GraphExecutor::DataFlow * _DataFlowExecutor = DataFlowEditor()->Executor() ;
// if ( DataFlowEditor()->IsEditing() ) {
RetVal = DataFlowNode()->Computer( aDataFlowContainer ) ;
+
+ // insert modified container into < ComponentName, Container > map
+ DataFlowEditor()->Graph()->InsertToMapOfComponentNameContainer( GetComponentName(), aDataFlowContainer ) ; // mkr : PAL13947
+
// }
// else if ( _DataFlowExecutor && ( _DataFlowExecutor->IsSuspended() ||
// _DataFlowExecutor->IsSuspended( DataFlowNode()->Name() ) ) ) {
( !IsGOTO() && ( IsLoop() || IsSwitch() || IsEndLoop() || IsEndSwitch() ) ) ) {
DataFlowNode()->CoupledNode( CoupledINode ) ;
if ( CoupledINode && IsSwitch() ) {
- DataFlowEditor()->AddLink( Name() , "Default" ,CoupledINode->Name() , "Default" ) ;
+//JR NPAL14793 05.02.2007 : do not add that link
+// DataFlowEditor()->AddLink( Name() , "Default" ,CoupledINode->Name() , "Default" ) ;
}
else if ( CoupledINode && ( IsLoop() || IsEndLoop() ) ) {
DataFlowEditor()->AddLink( Name() , "DoLoop" , CoupledINode->Name() , "DoLoop" ) ;
myEndNode->SetObjRef( SUPERV::ESNode::_duplicate( iendobject ) ) ;
myNode->SetCoupled( myEndNode->BaseNode()->Name() ) ;
myEndNode->SetCoupled( myNode->BaseNode()->Name() ) ;
- if ( !Link( myNode->Port( "Default" ) , myEndNode->Port( "Default" ) ) ) {
- iobject = SUPERV::SNode::_nil() ;
- iendobject = SUPERV::ESNode::_nil() ;
- }
+//JR NPAL14793 05.02.2007 : do not add that link
+// if ( !Link( myNode->Port( "Default" ) , myEndNode->Port( "Default" ) ) ) {
+// iobject = SUPERV::SNode::_nil() ;
+// iendobject = SUPERV::ESNode::_nil() ;
+// }
}
}
anEndOfSwitch = SUPERV::ESNode::_duplicate( iendobject ) ;
}
}
+/**
+ * Returns the default name of container for C component
+ */
+char* Graph_Impl::DefaultCContainerName() {
+ return ( CORBA::string_dup( FACTORYSERVER ) );
+}
+
+/**
+ * Returns the default name of container for Python component
+ */
+char* Graph_Impl::DefaultPythonContainerName() {
+ return ( CORBA::string_dup( FACTORYSERVERPY ) );
+}
+
+/*!
+ * Returns the last container name associated with theComponentName component
+ */
+char* Graph_Impl::ContainerNameForComponent( const char * theComponentName ) {
+ const char* aContainer = DataFlowEditor()->Graph()->RetrieveFromMapOfComponentNameContainer(theComponentName);
+ if ( aContainer )
+ return my_strdup(aContainer);
+ else
+ return "";
+}
virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort ,
SUPERV::Port_ptr InPort ) ;
- virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
+ virtual SUPERV::ListOfNodes_var SetNode( SUPERV::ListOfNodes_var RetVal ,
GraphBase::ComputingNode * aNode ) ;
virtual SUPERV::ListOfNodes * Nodes() ;
virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ;
virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
virtual void Editing(); // Destroy Executor and use only Editor and its data model
+
+ virtual char* DefaultCContainerName() ;
+ virtual char* DefaultPythonContainerName() ;
+ virtual char* ContainerNameForComponent( const char * theComponentName) ;
private:
bool run( const bool andSuspend = false ); // Run() calls run( false ), Start() calls run( true );
# see salome_shared_modules.py
# (avoids incomplete import at run time)
-print "============== import SUPERV ======================="
+from launchConfigureParser import verbose
+
+if verbose(): print "============== import SUPERV ======================="
import SUPERV
myGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ;
}
myGraph->ReadOnly() ;
+ myGraph->DataFlowEditor()->Graph()->ClearMapOfComponentNameContainer() ; // mkr : PAL13947
endService( "SuperV_Impl::GraphE" );
return SUPERV::Graph::_duplicate(iobject) ;
}
myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( iobject ) ) ;
}
myStreamGraph->ReadOnly() ;
+ myStreamGraph->DataFlowEditor()->Graph()->ClearMapOfComponentNameContainer() ; // mkr : PAL13947
endService( "SuperV_Impl::StreamGraphE" );
return SUPERV::StreamGraph::_duplicate(iobject) ;
}
}
ostringstream astr ;
const char * retstr ;
+ string RetStr;
int startstr = 0 ;
switch (anAny.type()->kind()) {
case CORBA::tk_string: {
anAny >>= retstr;
+ RetStr = string(retstr);
// MESSAGE( "ToString( string ) '" << retstr << "'" );
break ;
}
CORBA::Long l;
anAny >>= l;
astr << l << ends ;
- retstr = astr.str().c_str() ;
+ RetStr = astr.str() ;
// MESSAGE( "ToString( CORBA::Long ) '" << l << " " << retstr << "'" );
break ;
}
double d;
anAny >>= d;
astr << setw(25) << setprecision(18) << d << ends ;
- retstr = astr.str().c_str() ;
+ RetStr = astr.str();
int i = 0 ;
- while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) {
+ while ( i < (int ) RetStr.length() && RetStr.at(i++) == ' ' ) {
startstr = i ;
}
+ RetStr = RetStr.substr(startstr) ;
// MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
break ;
}
#else
anAny >>= obj ;
#endif
- retstr = _Orb->object_to_string( obj );
+ RetStr = _Orb->object_to_string( obj );
// MESSAGE( "ToString( object ) '" << retstr << "'" );
}
catch ( ... ) {
- retstr = "object_to_string catched " ;
+ RetStr = "object_to_string catched " ;
}
break ;
}
default: {
- retstr = "Unknown CORBA::Any Type" ;
+ RetStr = "Unknown CORBA::Any Type" ;
// MESSAGE( retstr );
break ;
}
}
// endService( "Value_Impl::ToString" );
- return CORBA::string_dup( &retstr[ startstr ] ) ;
+ return CORBA::string_dup( RetStr.c_str() ) ;
}
bool Value_Impl::IsIOR() {