Salome HOME
Lot 2: change bathy associated to natural object propagated to all cases without...
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index 94c4921a78dc8e04e42db0b1440bd7abba083a6e..370c7167137752c146f860961c360ae553bc4d78 100644 (file)
@@ -148,8 +148,10 @@ QString HYDROData_Entity::Type( ObjectKind theKind )
     return "Land_cover_map";
   case KIND_DTM:
     return "DTM";
+  case KIND_LISM:
+    return "LISM";
   case KIND_BC_POLYGON:
-    return "Boundary Polygon";
+    return "Boundary_Polygon";
   }
   return "";
 }
@@ -230,7 +232,7 @@ void HYDROData_Entity::Show()
   if ( !IsHas2dPrs() )
     return;
 
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() )
     return;
 
@@ -261,7 +263,7 @@ int HYDROData_Entity::GetGeomChangeFlag() const
 
 void HYDROData_Entity::Changed( Geometry theChangedGeometry )
 {
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if( aDocument.IsNull() )
     return;
 
@@ -333,7 +335,7 @@ HYDROData_Entity::~HYDROData_Entity()
 void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination,
                                bool isGenerateNewName ) const
 {
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() ) {
     return;
   }
@@ -719,11 +721,30 @@ QColor HYDROData_Entity::GetColor( const QColor& theDefColor,
   return aResColor;
 }
 
+bool HYDROData_Entity::GetColor( QColor& theOutColor,
+                                 const int     theTag ) const
+{
+  TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
+
+  Handle(TDataStd_IntegerArray) aColorArray;
+  if ( aLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
+  {
+    theOutColor.setRed(   aColorArray->Value( 1 ) );
+    theOutColor.setGreen( aColorArray->Value( 2 ) );
+    theOutColor.setBlue(  aColorArray->Value( 3 ) );
+    theOutColor.setAlpha( aColorArray->Value( 4 ) );
+    return true;
+  }
+
+  return false;
+}
+
+
 QStringList HYDROData_Entity::dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList;
 
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() )
     return aResList;
 
@@ -855,7 +876,7 @@ void HYDROData_Entity::setPythonObjectColor( QStringList&         theScript,
 void HYDROData_Entity::findPythonReferenceObject( QStringList& theScript,
                                                   QString      defName) const
 {
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() )
     return;
 
@@ -872,7 +893,7 @@ void HYDROData_Entity::findPythonReferenceObject( QStringList& theScript,
 void HYDROData_Entity::SetNameInDumpPython(QStringList&  theScript,
                                            QString       theName) const
 {
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() )
     return;
 
@@ -944,7 +965,7 @@ int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const
   Handle(TDataStd_Integer) anAttr;
   TDF_Label aLabel = myLab.FindChild( theTag );
   if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
-    return 0;
+    return theDefValue;
 
   return anAttr->Get();
 }