Salome HOME
Merge from OCC_development_generic_2006
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasNodePrs.cxx
index d82abd2a81bec413dc67b51a4faebf7120ff500c..6f03a189458a5976921bb8d9cd096999c77a616f 100644 (file)
@@ -6,12 +6,12 @@
 //  Author : Natalia KOPNOVA
 //  Module : SUPERV
 
-using namespace std;
 #include "SUPERVGUI_CanvasNodePrs.h"
 #include "SUPERVGUI_CanvasNode.h"
 #include "SUPERVGUI_CanvasPort.h"
 #include "SUPERVGUI_Canvas.h"
 #include "SUPERVGUI_CanvasCellNodePrs.h"
+#include "SUPERVGUI_Main.h"
 
 #include "SUIT_ResourceMgr.h"
 
@@ -21,7 +21,7 @@ using namespace std;
 #include <sys/timeb.h>
 #endif
 
-#define PORT_MARGIN 2
+//#define PORT_MARGIN 2
 #undef PORT_HEIGHT // to avoid warning message
 #define PORT_HEIGHT LABEL_HEIGHT
 #define TEXT_MARGIN 5
@@ -561,7 +561,8 @@ void SUPERVGUI_CanvasNodePrs::draw(QPainter& thePainter)
 {
   thePainter.setPen(pen());
   thePainter.setBrush(nodeColor());
-  drawShape(thePainter);
+  if ( !CORBA::is_nil( myNode->getMain()->getDataflow()->Node( myNode->name() ) ) ) // mkr : IPAL11360
+    drawShape(thePainter);
 }
 
 void SUPERVGUI_CanvasNodePrs::drawShape(QPainter& thePainter) 
@@ -671,7 +672,12 @@ void SUPERVGUI_CanvasNodePrs::drawPort(QPainter& thePainter)
       ++it;
       if (obj->inherits("SUPERVGUI_CanvasPort")) {
        aPort = (SUPERVGUI_CanvasPort*) obj;
-       if (!aPort->getEngine()->IsGate()) {
+
+       SUPERV_Port aPortEng = aPort->getEngine();
+       //      if ( CORBA::is_nil( aPortEng ) )
+       //        printf ( "---\n port engine IS NIL ---\n\n" );
+
+       if ( !CORBA::is_nil( aPortEng ) && !aPortEng->IsGate() ) {
          aPort->getPrs()->draw(thePainter);
        }
       }
@@ -878,9 +884,13 @@ bool SUPERVGUI_CanvasPortPrs::isAlert() const
 QString SUPERVGUI_CanvasPortPrs::getText() const
 {
   SUPERV_Port aPort = myPort->getEngine();
-  QString aText = aPort->Name();
-  if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream())
-    aText = aText + "=" + aPort->ToString();
+  QString aText;
+  if ( !CORBA::is_nil( aPort ) ) {
+    aText = aPort->Name();
+    if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream())
+      aText = aText + "=" + aPort->ToString();
+  }
+  //  printf( "--- return text of port : %s ---\n", aText.latin1() );
   return aText;
 }