]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Additional fix for PAL8060 (restore ports values if ports' name
authormkr <mkr@opencascade.com>
Mon, 23 Jan 2006 08:55:06 +0000 (08:55 +0000)
committermkr <mkr@opencascade.com>
Mon, 23 Jan 2006 08:55:06 +0000 (08:55 +0000)
and ports' type were not changed).

src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx

index 10eafd71ba44d4de5a0fcd7049e066e16150a65c..cd8166455d82c718596810c4d942ef474d8418c9 100644 (file)
@@ -340,6 +340,8 @@ void SUPERVGUI_ManagePortsDlg::accept() {
     // oldPorts list should be filtered to include only Input Ports.
     // But I'll filter Gate-s as well..
     bool isAnyLinked = false; // check if any port from old ports is linked
+    // map PortName <-> (PortType, PortInputValue) for non linked input ports, which have input
+    QMap< QString, QPair< QString,QString > > InNameInput;
     QObjectList portsToRemove;
     while ( (obj = it.current()) != 0 ) {
       ++it;
@@ -350,6 +352,10 @@ void SUPERVGUI_ManagePortsDlg::accept() {
       // check if port has a link (output porst of Loop node are also checked)
       if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked)
        isAnyLinked = true;
+      // check if input port has an input value
+      if ( !aPort->IsGate() && aPort->IsInput() && aPort->HasInput() )
+       InNameInput.insert( QString(aPort->Name()), 
+                           QPair<QString, QString>(QString(aPort->Type()),QString(aPort->ToString())) );
     }
     delete oldPorts; // delete the list, not the objects
 
@@ -404,12 +410,23 @@ void SUPERVGUI_ManagePortsDlg::accept() {
     for ( i = 0; i < myInList->count(); i++ ) {
       item = (PortListItem*)myInList->item( i );
       aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() );
-      myNode->createPort( aPort.in() );
-      
-      // mkr : PAL8060
-      if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
-       // create links for those input ports, which had links earlier
-       createLinkEngine( aPort, InPortsL, OutPortsL );
+      if ( InNameInput.contains( item->PortName ) 
+          && 
+          item->PortType.compare(InNameInput[item->PortName].first) == 0 ) {
+       // i.e. aPort is input and had a value (not linked!)
+       // if ports' name and type didn't change and ports had an input value => set this value again
+       SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+       if ( aSupMod )
+         aPort->Input( aSupMod->getEngine()->StringValue( InNameInput[item->PortName].second ) );
+       myNode->createPort( aPort.in() );
+      }
+      else {
+       myNode->createPort( aPort.in() );
+       // mkr : PAL8060
+       if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
+         // create links for those input ports, which had links earlier
+         createLinkEngine( aPort, InPortsL, OutPortsL );
+      }
     }
     
     if ( isLoop ) {