Salome HOME
lot 3 - coloring of section in OCC view see also refs #1838
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineXY.cxx
index cd7a710078d56bd9978b6eef4b1ff46dbdc19d05..54c418ac975ccdaab3a25de9d4e12d983f2d7304 100644 (file)
@@ -149,8 +149,17 @@ QStringList HYDROData_PolylineXY::DumpToPython( const QString&       thePyScript
   // Set the wire color
   QStringList aWireColorDef;
 
-  QColor aWireColor = GetWireColor();
-  setPythonObjectColor( aWireColorDef, aWireColor, DefaultWireColor(), "SetWireColor" );
+  //QColor aWireColor = GetWireColor();
+  //setPythonObjectColor( aWireColorDef, aWireColor, DefaultWireColor(), "SetWireColor" );
+
+  int nbSec = NbSections();
+  for (int i = 0; i < nbSec; i++)
+  {
+    QColor aColor;
+    GetSectionColor(i, aColor);
+    setPythonPolylineSectionColor(aWireColorDef, i, aColor );
+    //aWireColorDef << "";
+  }
   
   if ( !aWireColorDef.isEmpty() )
   {
@@ -829,42 +838,59 @@ void HYDROData_PolylineXY::Update()
     }
   }
 // all input wires in the <aSectionWiresList>
-  Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;
-  Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
-  TopTools_ListIteratorOfListOfShape it(aSectionWiresList);
-  for(;it.More();it.Next())
-  {
-    TopExp_Explorer it2(it.Value(), TopAbs_EDGE);
-    for(;it2.More();it2.Next()) 
-      aSeqEdges->Append(it2.Current());
-  }
 
+  TopoDS_Shape aResult;
   BRep_Builder aBB;
   TopoDS_Compound aCmp;
-  TopoDS_Shape aResult;
   aBB.MakeCompound(aCmp);
-  if(aSeqEdges->Length() >1)
+  if (aSectionWiresList.Size() == 1)
+    aResult = aSectionWiresList.First();
+  else if (aSectionWiresList.Size() > 1)
   {
-    ShapeAnalysis_FreeBounds::ConnectEdgesToWires( aSeqEdges, 1E-5, Standard_True, aSeqWires );
-
-    if( aSeqWires->Length()==1 )
-      aResult = aSeqWires->Value( 1 );
-    else
+    TopTools_ListIteratorOfListOfShape it(aSectionWiresList);
+    for(;it.More();it.Next())
     {
-      for (Standard_Integer i = 1; i <= aSeqWires->Length();i++)
-      {
-        const TopoDS_Shape& aS1 = aSeqWires->Value(i);
-        aBB.Add(aCmp, aS1);
-      }
-      aResult = aCmp;
+      aBB.Add(aCmp, it.Value());
     }
+    aResult = aCmp;
   }
-  else if (aSeqEdges->Length() == 1)
-  {
-    BRepBuilderAPI_MakeWire mkWire (TopoDS::Edge(aSeqEdges->Value(1)));
-    if (mkWire.IsDone())
-      aResult = mkWire.Wire();
-  }
+
+  //Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;
+  //Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
+  //TopTools_ListIteratorOfListOfShape it(aSectionWiresList);
+  //for(;it.More();it.Next())
+  //{
+  //  TopExp_Explorer it2(it.Value(), TopAbs_EDGE);
+  //  for(;it2.More();it2.Next()) 
+  //    aSeqEdges->Append(it2.Current());
+  //}
+  //
+  //BRep_Builder aBB;
+  //TopoDS_Compound aCmp;
+  //TopoDS_Shape aResult;
+  //aBB.MakeCompound(aCmp);
+  //if(aSeqEdges->Length() >1)
+  //{
+  //  ShapeAnalysis_FreeBounds::ConnectEdgesToWires( aSeqEdges, 1E-5, Standard_True, aSeqWires );
+  //
+  //  if( aSeqWires->Length()==1 )
+  //    aResult = aSeqWires->Value( 1 );
+  //  else
+  //  {
+  //    for (Standard_Integer i = 1; i <= aSeqWires->Length();i++)
+  //    {
+  //      const TopoDS_Shape& aS1 = aSeqWires->Value(i);
+  //      aBB.Add(aCmp, aS1);
+  //    }
+  //    aResult = aCmp;
+  //  }
+  //}
+  //else if (aSeqEdges->Length() == 1)
+  //{
+  //  BRepBuilderAPI_MakeWire mkWire (TopoDS::Edge(aSeqEdges->Value(1)));
+  //  if (mkWire.IsDone())
+  //    aResult = mkWire.Wire();
+  //}
 
   SetShape( aResult );
 }