]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
HYDRO feature 10: Creation/edition of the calculation case (T 1.12).
authorouv <ouv@opencascade.com>
Thu, 26 Sep 2013 12:55:58 +0000 (12:55 +0000)
committerouv <ouv@opencascade.com>
Thu, 26 Sep 2013 12:55:58 +0000 (12:55 +0000)
22 files changed:
src/HYDROData/HYDROData_Domain.h
src/HYDROData/HYDROData_Polyline.cxx
src/HYDROData/HYDROData_Polyline.h
src/HYDROData/HYDROData_Region.cxx
src/HYDROData/HYDROData_Region.h
src/HYDROData/HYDROData_Zone.cxx
src/HYDROData/HYDROData_Zone.h
src/HYDROData/HYDROOperations_BSpline.cxx
src/HYDROData/HYDROOperations_BSpline.h
src/HYDROGUI/HYDROGUI_AISCurve.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_PrsZoneDriver.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_Shape.h
src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx
src/HYDROGUI/HYDROGUI_SplitZonesTool.h
src/HYDROGUI/HYDROGUI_ZoneOp.cxx
src/HYDROGUI/HYDROGUI_ZoneOp.h
src/Link/Link_OCC.cxx

index 00c24906ebf5dee1cf2fc53ef3f3838d0f811578..ac1a910194a7752aa1be4d3c871d813201da4252 100644 (file)
@@ -4,6 +4,8 @@
 
 #include <HYDROData_Object.h>
 
+#include <TopoDS_Face.hxx>
+
 #include <QPointF>
 #include <QList>
 
@@ -113,6 +115,11 @@ public:
    */
   //HYDRODATA_EXPORT virtual QVariant GetDataVariant();
 
+  /**
+   * Returns the shape of the the object.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Face Face() const = 0;
+
 protected:
 
   friend class HYDROData_Iterator;
index fb723700621300e61e47ae44f4acbaadfd280279..ae0330ed8fcd1a4aa56b5a7d50bae1d7c36af22f 100755 (executable)
@@ -1,8 +1,13 @@
 #include <HYDROData_Polyline.h>
 #include <HYDROData_Iterator.h>
 
+#include <HYDROOperations_BSpline.h>
+
 #include <ImageComposer_MetaTypes.h>
 
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <gp_Pnt.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_ByteArray.hxx>
 #include <TDataStd_ExtStringArray.hxx>
 #include <TDataStd_UAttribute.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
 
 #include <QStringList>
 
@@ -199,6 +209,8 @@ void HYDROData_Polyline::setPolylineData( const PolylineData& theSections )
       aPtr++;
     }
   }
+
+  UpdateWire( theSections );
 }
 
 /**
@@ -304,29 +316,122 @@ void HYDROData_Polyline::removeAll()
 }
 
 /**
- * Return polyline painter path. Current implementation
- * is ignored section type.
+ * Returns the painter path.
+ * Note: currently only the first section of the polyline data is taken into account.
  * \return polyline painter path.
  */
 QPainterPath HYDROData_Polyline::painterPath() const
 {
   QPainterPath aPath;
   int aDim = getDimension();
-  if( ( aDim != 2 ) && ( aDim != 3) )
-      return aPath;
+  if( aDim != 2 && aDim != 3 )
+    return aPath;
+
   PolylineData aSects = getPolylineData();
-  for( int i = 0 ; i < aSects.size() ; i++ ){
-    int aPntCnt = aSects[i].myCoords.size()/aDim;
-    if( aPntCnt ){
-      aPath.moveTo(aSects[i].myCoords[0], aSects[i].myCoords[1] );
-    }
-    for( int j = 1 ; j < aPntCnt ; j++ ){
-      int anIndx = j*aDim;
-      aPath.lineTo(aSects[i].myCoords[anIndx], aSects[i].myCoords[anIndx+1]);
+  if( aSects.isEmpty() )
+    return aPath;
+
+  PolylineSection aSection = aSects.first();
+  int aPntCount = aSection.myCoords.size() / aDim;
+  PolylineSection::SectionType aSectionType = aSection.myType;
+  bool anIsSectionClosed = aSection.myIsClosed;
+  if( aSectionType == PolylineSection::SECTION_POLYLINE )
+  {
+    if( aPntCount )
+      aPath.moveTo( aSection.myCoords[0], aSection.myCoords[1] );
+    for( int i = 1; i < aPntCount; i++ )
+    {
+      int anIndex = i * aDim;
+      aPath.lineTo( aSection.myCoords[ anIndex ], aSection.myCoords[ anIndex + 1 ] );
     }
-    if( aSects[i].myIsClosed ){
+    if( anIsSectionClosed )
       aPath.closeSubpath();
+  }
+  else //if( aSectionType == PolylineSection::SECTION_SPLINE )
+  {
+    QList<double> aPoints;
+    for( int i = 0; i < aPntCount; i++ )
+    {
+      int anIndex = i * aDim;
+      aPoints << aSection.myCoords[ anIndex ] << aSection.myCoords[ anIndex + 1 ];
     }
+    HYDROOperations_BSpline aBSpline( aPoints, anIsSectionClosed );
+    aPath = aBSpline.ComputePath();
   }
   return aPath;
 }
+
+void HYDROData_Polyline::SetWire( const TopoDS_Wire& theWire )
+{
+  TNaming_Builder aBuilder( myLab );
+  aBuilder.Generated( theWire );
+}
+
+TopoDS_Wire HYDROData_Polyline::Wire() const
+{
+  Handle(TNaming_NamedShape) aNamedShape;
+  if( myLab.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+    return TopoDS::Wire( aNamedShape->Get() );
+  return TopoDS_Wire();
+}
+
+void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
+{
+  BRepBuilderAPI_MakeWire aMakeWire;
+
+  int aDim = getDimension();
+
+  int aSectionCount = theSections.size();
+  for( int aSectionId = 0; aSectionId < aSectionCount; aSectionId++ )
+  {
+    const PolylineSection& aSection = theSections[ aSectionId ];
+    PolylineSection::SectionType aSectionType = aSection.myType;
+    bool anIsSectionClosed = aSection.myIsClosed;
+    int aPointCount = aSection.myCoords.size() / aDim;
+    if( aPointCount > 1 )
+    {
+      BRepBuilderAPI_MakeWire aMakeSectionWire;
+      if( aSectionType == PolylineSection::SECTION_POLYLINE )
+      {
+        for( int aPointId = 0; aPointId < aPointCount; aPointId++ )
+        {
+          int anId1 = aDim * aPointId;
+          int anId2 = aDim * ( aPointId + 1 );
+          if( aPointId == aPointCount - 1 )
+          {
+            if( anIsSectionClosed )
+              anId2 = 0;
+            else
+              break;
+          }
+
+          gp_Pnt aPnt1( aSection.myCoords[ anId1 ], aSection.myCoords[ anId1 + 1 ], 0 );
+          gp_Pnt aPnt2( aSection.myCoords[ anId2 ], aSection.myCoords[ anId2 + 1 ], 0 );
+
+          TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
+          aMakeSectionWire.Add( anEdge );
+        }
+      }
+      else //if( aSectionType == PolylineSection::SECTION_SPLINE )
+      {
+        QList<double> aPoints;
+        for( int aPointId = 0; aPointId < aPointCount; aPointId++ )
+        {
+          int anId = aPointId * aDim;
+          double x = aSection.myCoords[ anId ];
+          double y = aSection.myCoords[ anId+1 ];
+          aPoints << x << y;
+        }
+
+        HYDROOperations_BSpline aBSpline( aPoints, anIsSectionClosed );
+        TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
+        aMakeSectionWire.Add( anEdge );
+      }
+      TopoDS_Wire aSectionWire = aMakeSectionWire.Wire();
+      aMakeWire.Add( aSectionWire );
+    }
+  }
+
+  TopoDS_Wire aWire = aMakeWire.Wire();
+  SetWire( aWire );
+}
index 3906ac5321178f2b6b58676ff6162be212056750..4f9e4008fb1d5eb923a82a09d774c4394a8293bb 100755 (executable)
@@ -9,6 +9,8 @@
 #include <QPainterPath>
 #include <QList>
 
+class TopoDS_Wire;
+
 DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
 
 struct PolylineSection
@@ -45,7 +47,8 @@ protected:
     DataTag_SectionsName,
     DataTag_SectionsClosed,
     DataTag_SectionsSize,
-    DataTag_SectionsType
+    DataTag_SectionsType,
+    DataTag_Wire
   };
 
 public:
@@ -101,12 +104,27 @@ public:
    */
   HYDRODATA_EXPORT void removeAll();
 
-
   /**
-   * Returns the painter path. The painter path is construct by lines
+   * Returns the painter path.
+   * Note: currently only the first section of the polyline data is taken into account.
    */
   HYDRODATA_EXPORT QPainterPath painterPath() const;
 
+  /**
+   * Sets the wire contour of the object.
+   */
+  HYDRODATA_EXPORT void SetWire( const TopoDS_Wire& theWire );
+
+  /**
+   * Returns the wire contour of the object.
+   */
+  HYDRODATA_EXPORT TopoDS_Wire Wire() const;
+
+protected:
+  /**
+   * Update the wire contour on the basis of the polyline data.
+   */
+  void UpdateWire( const PolylineData& theSections );
 
 protected:
 
index 2550de1fc64a201805403504060d4227c42ee2a2..166806535995977ecdb0d576de304e449544c235 100644 (file)
@@ -1,6 +1,10 @@
 
 #include "HYDROData_Region.h"
 
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TopoDS.hxx>
+
 #include <QString>
 
 #define PYTHON_REGION_ID "KIND_REGION"
@@ -18,6 +22,20 @@ HYDROData_Region::~HYDROData_Region()
 {
 }
 
+void HYDROData_Region::SetFace( const TopoDS_Face& theFace )
+{
+  TNaming_Builder aBuilder( myLab );
+  aBuilder.Generated( theFace );
+}
+
+TopoDS_Face HYDROData_Region::Face() const
+{
+  Handle(TNaming_NamedShape) aNamedShape;
+  if( myLab.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+    return TopoDS::Face( aNamedShape->Get() );
+  return TopoDS_Face();
+}
+
 QString HYDROData_Region::getPythonKindId() const
 {
   return QString( PYTHON_REGION_ID );
index 2cc3f0e139c2b67b13f77bc59d59ac970a6e22c0..23cd0d6232fa9be8dc418b896def1d46ff685df4 100644 (file)
@@ -21,6 +21,7 @@ protected:
   enum DataTag
   {
     DataTag_First = HYDROData_Domain::DataTag_First + 100, ///< first tag, to reserve
+    DataTag_Face
   };
 
 public:
@@ -31,6 +32,16 @@ public:
    */
   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_REGION; }
 
+  /**
+   * Sets the shape of the object.
+   */
+  HYDRODATA_EXPORT void SetFace( const TopoDS_Face& theFace );
+
+  /**
+   * Returns the shape of the the object (redefined method).
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Face Face() const;
+
 protected:
 
   friend class HYDROData_Iterator;
index 15246161d2b3710adeebe6801dff6cd379787a02..3af90622deec733c285953a517d81db4c80b5332 100644 (file)
@@ -6,7 +6,9 @@
 #include "HYDROData_Polyline.h"
 #include "HYDROData_Iterator.h"
 
+#include <BRepBuilderAPI_MakeFace.hxx>
 #include <TDataStd_IntegerArray.hxx>
+#include <TopoDS_Wire.hxx>
 
 #include <QColor>
 #include <QStringList>
@@ -54,17 +56,21 @@ void HYDROData_Zone::RemovePolyline()
   ClearReferenceObjects( DataTag_Polyline );
 }
 
-QPainterPath HYDROData_Zone::GetPainterPath() const
+TopoDS_Face HYDROData_Zone::Face() const
 {
-  QPainterPath aPath;
-
   Handle(HYDROData_Polyline) aPolyline = GetPolyline();
-  if ( !aPolyline.IsNull() )
+  if( !aPolyline.IsNull() )
   {
-    aPath = aPolyline->painterPath();
+    TopoDS_Wire aWire = aPolyline->Wire();
+    if( !aWire.IsNull() )
+    {
+      BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
+      aMakeFace.Build();
+      if( aMakeFace.IsDone() )
+        return aMakeFace.Face();
+    }
   }
-
-  return aPath;
+  return TopoDS_Face();
 }
 
 QString HYDROData_Zone::getPythonKindId() const
index 4bbe43b5b173e9b8ab1d45cf905a04beacb8aff8..b9a86cbf7681ec49bfb297ebea9f681e9b3c75b8 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <HYDROData_Domain.h>
 
-#include <QPainterPath>
 class Handle(HYDROData_Polyline);
 
 DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
@@ -63,10 +62,9 @@ public:
   //HYDRODATA_EXPORT virtual QVariant GetDataVariant();
 
   /**
-   * Returns the painter path. The painter path is construct by polyline
+   * Returns the shape of the the object (redefined method).
    */
-  HYDRODATA_EXPORT QPainterPath GetPainterPath() const;
-
+  HYDRODATA_EXPORT TopoDS_Face Face() const;
 
 protected:
 
index 376490dab118ad163a27419413c094f64e92ad4e..d2dd0176c0070656c80937bb9c7cb46560aeaca6 100644 (file)
@@ -6,12 +6,13 @@
 #include<Geom_BezierCurve.hxx>
 
 HYDROOperations_BSpline::HYDROOperations_BSpline(
-  QList<double>& thePoints)
+  const QList<double>& thePoints,
+  const bool theIsClosed)
 {
   // fill array for algorithm by the received coordinates
   int aLen = thePoints.size() / 2;
   Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen);
-  QList<double>::iterator aListIter = thePoints.begin();
+  QList<double>::const_iterator aListIter = thePoints.begin();
   for (int ind = 1; ind <= aLen; ind++) {
     gp_Pnt aPnt(gp::Origin());
     aPnt.SetX(*aListIter);
@@ -21,7 +22,7 @@ HYDROOperations_BSpline::HYDROOperations_BSpline(
     aHCurvePoints->SetValue(ind, aPnt);
   }
   // compute BSpline
-  GeomAPI_Interpolate aGBC(aHCurvePoints, Standard_False, gp::Resolution());
+  GeomAPI_Interpolate aGBC(aHCurvePoints, theIsClosed, gp::Resolution());
   aGBC.Perform();
   if (aGBC.IsDone()) {
     myCurve = aGBC.Curve();
index 47c3f3051d38f110f4c54c9594af458e5d970afe..0021af19bbd77894aac0ce9349e581f2b365dce7 100644 (file)
@@ -20,7 +20,9 @@ public:
 
   //! Creates a spline by list of coordinates: pairs X and Y
   //! \param thePoints coordinates in format X1, Y1, X2, Y2, etc. must be even number of elements
-  HYDROOperations_BSpline(QList<double>& thePoints);
+  //! \param theIsClosed flag indicating that the result spline should be closed
+  HYDROOperations_BSpline(const QList<double>& thePoints,
+                          const bool theIsClosed);
   
   //! Returns the BSpline curve passing through the points
   //! \returns Null if Computation of BSpline was failed
index 8899eafdd42b97cc58d0cbf90e1fe94ae0a622eb..67265afd33932f8de89d669ed08c7b4799c01375 100755 (executable)
@@ -1,14 +1,20 @@
 #include "HYDROGUI_AISCurve.h"
 
-#include "CurveCreator_Curve.hxx"
+#include <HYDROOperations_BSpline.h>
+
+#include <CurveCreator_Curve.hxx>
 
 #include <AIS_Point.hxx>
 #include <AIS_Line.hxx>
-
+#include <AIS_Shape.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <Geom_CartesianPoint.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Lin.hxx>
-
-#include <Geom_CartesianPoint.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
 
 HYDROGUI_AISCurveSection::HYDROGUI_AISCurveSection( Handle_AIS_InteractiveContext theContext, 
                                                    CurveCreator_Curve* theCurve, int theSection) :
@@ -40,44 +46,74 @@ void  HYDROGUI_AISCurveSection::highlight( bool isHL )
   Quantity_Color aColor = getActiveColor();
   for( int i = 0 ; i < myObjects.size() ; i++ ){
     myObjects[i]->SetColor(aColor);
-    myContext->Display(myObjects[i]);
+    myContext->Display(myObjects[i], Standard_False);
   }
+  myContext->UpdateCurrentViewer();
 }
 
 void HYDROGUI_AISCurveSection::Display()
 {
   for( int i = 0 ; i < myObjects.size() ; i++ ){
-    myContext->Display(myObjects[i]);
+    myContext->Display(myObjects[i], Standard_False);
   }
+  myContext->UpdateCurrentViewer();
 }
 
 void HYDROGUI_AISCurveSection::Erase()
 {
   for( int i = 0 ; i < myObjects.size() ; i++ ){
-    myContext->Erase(myObjects[i]);
+    myContext->Erase(myObjects[i], Standard_False);
   }
+  myContext->UpdateCurrentViewer();
 }
 
 void HYDROGUI_AISCurveSection::buildSection()
 {
+  CurveCreator::Type aSectType = myCurve->getType( mySection );
   int aSectSize = myCurve->getNbPoints( mySection );
-  double anX;
-  double anY;
-  double aZ;
-  int i = 0; 
-  for( ; i < ( aSectSize - 1 ) ; i++ ){
-    Handle_AIS_Point anAISPnt = getAISPoint(i);
-    myObjects.push_back( anAISPnt );
-    Handle_AIS_Line aLine = getAISLine( i, i+1 );
-    myObjects.push_back( aLine );
-  }
-  if( aSectSize != 0 ){
-    Handle_AIS_Point anAISPnt = getAISPoint(i); 
-    myObjects.push_back( anAISPnt );
-    if( myCurve->isClosed(mySection) && ( aSectSize > 1 ) ){
-      Handle_AIS_Line aLine = getAISLine( i, 0 );
+  bool aSectIsClosed = myCurve->isClosed( mySection );
+
+  if( aSectType == CurveCreator::Polyline )
+  {
+    int i = 0; 
+    for( ; i < ( aSectSize - 1 ) ; i++ ){
+      Handle_AIS_Point anAISPnt = getAISPoint(i);
+      myObjects.push_back( anAISPnt );
+      Handle_AIS_Line aLine = getAISLine( i, i+1 );
       myObjects.push_back( aLine );
     }
+    if( aSectSize != 0 ){
+      Handle_AIS_Point anAISPnt = getAISPoint(i); 
+      myObjects.push_back( anAISPnt );
+      if( myCurve->isClosed(mySection) && ( aSectSize > 1 ) ){
+        Handle_AIS_Line aLine = getAISLine( i, 0 );
+        myObjects.push_back( aLine );
+      }
+    }
+  }
+  else if( aSectType == CurveCreator::BSpline )
+  {
+    QList<double> aPoints;
+    for( int i = 0; i < aSectSize; i++ )
+    {
+      Handle_AIS_Point anAISPnt = getAISPoint( i );
+      myObjects.push_back( anAISPnt );
+
+      double aX = 0, aY = 0, aZ = 0;
+      getPoint( i, aX, aY, aZ );
+      aPoints << aX << aY;
+    }
+
+    if( aSectSize > 1 )
+    {
+      HYDROOperations_BSpline aBSpline( aPoints, aSectIsClosed );
+      TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
+
+      TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire();
+
+      Handle(AIS_Shape) aShape = new AIS_Shape( aWire );
+      myObjects.push_back( aShape );
+    }
   }
 }
 
index 3e1a5dc83dfa21297172dbdade6877075455d123..6e8aa189d65e093eacbcb5bde5dfd3dababa5e08 100644 (file)
@@ -116,8 +116,7 @@ void HYDROGUI_CalculationOp::startOperation()
           continue;
 
         Region aRegion;
-        // aRegion.SplitData.Path = aSplitZone->GetPainterPath();
-        // aRegion.SplitData.ZoneNames ???
+        aRegion.SplitData.Shape = aDataRegion->Face();
 
         aRegion.FillingColor = aDataRegion->GetFillingColor();
         aRegion.BorderColor  = aDataRegion->GetBorderColor();
@@ -251,6 +250,8 @@ bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
       continue;
 
     // Fill the zone data
+    aDataRegion->SetFace( aRegion.SplitData.Face() );
+
     aDataRegion->SetName( aRegion.RegionName );
     aDataRegion->SetBorderColor( aRegion.BorderColor );
     aDataRegion->SetFillingColor( aRegion.FillingColor );
@@ -362,7 +363,7 @@ void HYDROGUI_CalculationOp::createPreview()
 
         aRegion.Shape->setFillingColor( aRegion.FillingColor, false );
         aRegion.Shape->setBorderColor( aRegion.BorderColor, false );
-        aRegion.Shape->setPath( aRegion.SplitData.Path, true );
+        aRegion.Shape->setFace( aRegion.SplitData.Face(), true );
       }
 
       //Process the draw events for viewer
index fde4689ca17800b10f6e423c097ad92693c91890..32e1162e3f05fcd2bb44f6c23bc3b0586a287acd 100644 (file)
@@ -125,8 +125,6 @@ protected slots:
 
   void                            onViewPortMouseEvent( QGraphicsSceneMouseEvent* );
 
-  void                            onTestSplit(); // ouv: tmp, to delete
-
 private:
   void                            updateGV( const bool theIsInit = false, 
                                             const bool theIsForced = false );
index 7bf1c89534d635a8440212c3db491ef8a603e935..706d9b75c56787c6f0b020ca62fee5c9606b023a 100644 (file)
@@ -137,10 +137,6 @@ void HYDROGUI_Module::createMenus()
   createMenu( FuseImagesId, aHydroId, -1, -1 );
   createMenu( CutImagesId, aHydroId, -1, -1 );
   createMenu( SplitImageId, aHydroId, -1, -1 );
-
-  //ouv: debug
-  //createMenu( separator(), aHydroId );
-  //createMenu( TestSplitId, aHydroId, -1, -1 );
 }
 
 void HYDROGUI_Module::createPopups()
@@ -174,10 +170,6 @@ void HYDROGUI_Module::createUndoRedoActions()
 
   connect( anEditUndo, SIGNAL( triggered( int ) ), this, SLOT( onUndo( int ) ) );
   connect( anEditRedo, SIGNAL( triggered( int ) ), this, SLOT( onRedo( int ) ) );
-
-  QAction* aTestSplit = new QAction( "Test split", application()->desktop() );
-  registerAction( TestSplitId, aTestSplit );
-  connect( aTestSplit, SIGNAL( triggered() ), this, SLOT( onTestSplit() ) );
 }
 
 void HYDROGUI_Module::updateUndoRedoControls()
@@ -322,100 +314,3 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
 
   return anOp;
 }
-
-//-----------------------------------------------------------------------------
-// Test splitting
-//-----------------------------------------------------------------------------
-#include <HYDROData_Iterator.h>
-#include <HYDROGUI_Tool.h>
-void HYDROGUI_Module::onTestSplit()
-{
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( getStudyId() );
-
-  aDocument->StartOperation();
-
-  HYDROData_SequenceOfObjects aZoneList;
-  HYDROData_Iterator anIterator( aDocument, KIND_ZONE );
-  for( ; anIterator.More(); anIterator.Next() )
-    aZoneList.Append( anIterator.Current() );
-
-  HYDROGUI_SplitZonesTool::SplitDataList aSplitDataList =
-    HYDROGUI_SplitZonesTool::SplitZones( aZoneList, NULL );
-
-  int anIndex = 0;
-  HYDROGUI_SplitZonesTool::SplitDataListIterator anIter( aSplitDataList );
-  while( anIter.hasNext() )
-  {
-    const HYDROGUI_SplitZonesTool::SplitData& aSplitData = anIter.next();
-    const QPainterPath& aPath = aSplitData.Path;
-    const QStringList& aZoneNames = aSplitData.ZoneNames;
-
-    Handle(HYDROData_Polyline) aPolyline =
-      Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) );
-    if( !aPolyline.IsNull() )
-    {
-      aPolyline->SetName( QString( "SplitPolyline_%1" ).arg( ++anIndex ) );
-      aPolyline->setDimension( 2 );
-
-      QList<PolylineSection> aPolylineData;
-      for( int i = 0, n = aPath.elementCount(); i < n; i++ )
-      {
-        const QPainterPath::Element anElement = aPath.elementAt( i );
-        switch( anElement.type )
-        {
-          case QPainterPath::MoveToElement:
-            aPolylineData.append( PolylineSection() );
-            break;
-          case QPainterPath::LineToElement:
-            if( !aPolylineData.isEmpty() )
-            {
-              PolylineSection& aSection = aPolylineData.last();
-              aSection.myCoords << anElement.x;
-              aSection.myCoords << anElement.y;
-            }
-            break;
-          case QPainterPath::CurveToElement: // currently not supported
-          default:
-            break;
-        }
-      }
-      aPolyline->setPolylineData( aPolylineData );
-    }
-
-    Handle(HYDROData_Zone) aZone =
-      Handle(HYDROData_Zone)::DownCast( aDocument->CreateObject( KIND_ZONE ) );
-    if( !aZone.IsNull() )
-    {
-      aZone->SetName( QString( "SplitZone_%1" ).arg( anIndex ) );
-      aZone->SetPolyline( aPolyline );
-
-      aZone->SetBorderColor( Qt::black );
-
-      int aCounter = 0;
-      int aR = 0, aG = 0, aB = 0;
-      QStringListIterator aZoneNameIter( aZoneNames );
-      while( aZoneNameIter.hasNext() )
-      {
-        const QString& aZoneName = aZoneNameIter.next();
-        Handle(HYDROData_Zone) aRefZone = Handle(HYDROData_Zone)::DownCast(
-          HYDROGUI_Tool::FindObjectByName( this, aZoneName, KIND_ZONE ) );
-        if( !aRefZone.IsNull() )
-        {
-          QColor aRefColor = aRefZone->GetFillingColor();
-          aR += aRefColor.red();
-          aG += aRefColor.green();
-          aB += aRefColor.blue();
-          aCounter++;
-        }
-      }
-      if( aCounter > 0 )
-      {
-        QColor aFillingColor( aR / aCounter, aG / aCounter, aB / aCounter );
-        aZone->SetFillingColor( aFillingColor );
-      }
-    }
-  }
-
-  aDocument->CommitOperation();
-  update( UF_Model );
-}
index e0cf2f3cf6374125c84ce220b3e73ac5409aedeb..c8b8309f6829fdebf6b271bec7ed3e700a81a044 100644 (file)
@@ -70,8 +70,6 @@ enum OperationId
   ShowAllId,
   HideId,
   HideAllId,
-
-  TestSplitId
 };
 
 #endif
index 5edfaa1d605e37385440a8d6cbc600003944e2c8..6d6aca2e52f0d9b370cb5e0ace122adc47363b0d 100644 (file)
@@ -57,7 +57,8 @@ bool HYDROGUI_PrsZoneDriver::Update( const Handle(HYDROData_Object)& theObj,
   aPrsZone->setFillingColor( aZone->GetFillingColor() );
   aPrsZone->setBorderColor( aZone->GetBorderColor() );
 
-  aPrsZone->setPath( aZone->GetPainterPath() );
+  // ouv: the method is no more
+  //aPrsZone->setPath( aZone->GetPainterPath() );
 
   aPrsZone->compute();
 
index be595d23a983300fce1a56781c8fcdb0560f93d6..b973cefd80d9a8f9d7f5d262653f75ff9810f3a0 100644 (file)
@@ -47,7 +47,6 @@
 HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext )
 : myContext( theContext ),
   myIsHighlight( false ),
-  myZIndex( 0.0 ),
   myFillingColor( Qt::green ),
   myBorderColor( Qt::black ),
   myHighlightColor( Qt::white )
@@ -62,20 +61,20 @@ HYDROGUI_Shape::~HYDROGUI_Shape()
     myShape.Nullify();
 }
 
-void HYDROGUI_Shape::display()
+void HYDROGUI_Shape::display( const bool theIsUpdateViewer )
 {
   if ( !myContext || myShape.IsNull() )
     return;
 
-  myContext->Display( myShape );
+  myContext->Display( myShape, theIsUpdateViewer );
 }
 
-void HYDROGUI_Shape::erase()
+void HYDROGUI_Shape::erase( const bool theIsUpdateViewer )
 {
   if ( !myContext || myShape.IsNull() )
     return;
 
-  myContext->Erase( myShape );
+  myContext->Erase( myShape, theIsUpdateViewer );
 }
 
 void HYDROGUI_Shape::highlight( bool theIsHighlight )
@@ -97,32 +96,26 @@ bool HYDROGUI_Shape::isHighlighted() const
   return myIsHighlight;
 }
 
-void HYDROGUI_Shape::setPath( const QPainterPath& thePath,
-                              const bool          theToDisplay )
-{
-  myPath = thePath;
-  buildShape();
-  updateShape( theToDisplay );
-}
-
-QPainterPath HYDROGUI_Shape::getPath() const
+void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
+                              const bool         theToDisplay )
 {
-  return myPath;
+  BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True );
+  aFaceBuilder.Build();
+  if( aFaceBuilder.IsDone() )
+  {
+    TopoDS_Face aFace = aFaceBuilder.Face();
+    setFace( aFace, theToDisplay );
+  }
 }
 
-void HYDROGUI_Shape::setZIndex( const double theZIndex,
-                                const bool   theToDisplay )
+void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace,
+                              const bool         theToDisplay )
 {
-  myZIndex = theZIndex;
+  myFace = theFace;
   buildShape();
   updateShape( theToDisplay );
 }
 
-double HYDROGUI_Shape::getZIndex() const
-{
-  return myZIndex;
-}
-
 void HYDROGUI_Shape::setFillingColor( const QColor& theColor,
                                       const bool    theToDisplay )
 {
@@ -157,113 +150,15 @@ QColor HYDROGUI_Shape::getHighlightColor() const
   return myHighlightColor;
 }
 
-void HYDROGUI_Shape::makeEdge( BRepBuilderAPI_MakeWire& theWireBuilder,
-                               gp_Pnt&                  theFirstPoint,
-                               gp_Pnt&                  theLastPoint ) const
-{
-  BRepBuilderAPI_MakeEdge anEdgeBuilder( theFirstPoint, theLastPoint );
-  anEdgeBuilder.Build();
-  if ( anEdgeBuilder.IsDone() )
-  {
-    TopoDS_Edge anEdge = anEdgeBuilder;
-    theWireBuilder.Add( anEdge );
-  }
-}
-
-void HYDROGUI_Shape::makeWire( BRepBuilderAPI_MakeFace& theFaceBuilder,
-                               BRepBuilderAPI_MakeWire& theWireBuilder,
-                               bool&                    theIsComposed ) const
-{
-  theWireBuilder.Build();
-  if ( theWireBuilder.IsDone() )
-  {
-    TopoDS_Wire aBuildedWire = theWireBuilder;
-    if ( theIsComposed )
-    {
-      theFaceBuilder.Add( aBuildedWire );
-    }
-    else
-    {
-      theFaceBuilder = BRepBuilderAPI_MakeFace( aBuildedWire, true );
-
-      theFaceBuilder.Build();
-      theIsComposed = theFaceBuilder.IsDone();
-    }
-  }
-
-  theWireBuilder = BRepBuilderAPI_MakeWire();
-}
-
 void HYDROGUI_Shape::buildShape()
 {
   // Erase previously created shape
   erase();
 
-  if ( myPath.isEmpty() )
+  if( myFace.IsNull() )
     return;
 
-  BRepBuilderAPI_MakeFace aFaceBuilder;
-  BRepBuilderAPI_MakeWire aWireBuilder;
-
-  // Build new shape from path
-  bool anIsComposed = false;
-  bool anIsStarted = false;
-  gp_Pnt aStartPoint( 0, 0, myZIndex );
-  gp_Pnt aPrevPoint(  0, 0, myZIndex );
-
-  for ( int i = 0; i < myPath.elementCount(); ++i )
-  {
-    const QPainterPath::Element& aPathElem = myPath.elementAt( i );
-
-    gp_Pnt aCurPoint( aPathElem.x, aPathElem.y, myZIndex );
-    switch ( aPathElem.type )
-    {
-      case QPainterPath::LineToElement:
-      {
-        // Just build the edge
-        makeEdge( aWireBuilder, aPrevPoint, aCurPoint );
-        break;
-      }
-      case QPainterPath::CurveToElement:
-      {
-        // TODO
-        break;
-      }
-      case QPainterPath::MoveToElement:
-      {
-        if ( anIsStarted )
-        {
-          // Compose face
-          if ( !aStartPoint.IsEqual( aPrevPoint, Precision::Confusion() ) )
-          {
-            //Close wire
-            makeEdge( aWireBuilder, aPrevPoint, aStartPoint );
-          }
-
-          // Make face wiyth edge
-          makeWire( aFaceBuilder, aWireBuilder, anIsComposed );
-        }
-
-        anIsStarted = true;
-        aStartPoint = aCurPoint;
-        break;
-      }
-      default:
-        break;
-    }
-
-    aPrevPoint = aCurPoint;
-  }
-
-  makeWire( aFaceBuilder, aWireBuilder, anIsComposed );
-
-  TopoDS_Face aResShape;
-
-  aFaceBuilder.Build();
-  if ( aFaceBuilder.IsDone() )
-    aResShape = aFaceBuilder;
-
-  myShape = new AIS_Shape( aResShape );
+  myShape = new AIS_Shape( myFace );
 
   myShape->SetTransparency( 0 );
   myShape->SetDisplayMode( AIS_Shaded );
@@ -284,11 +179,11 @@ void HYDROGUI_Shape::buildShape()
     if ( !aShadingAspect.IsNull() )
     {
       Graphic3d_MaterialAspect aMatAspect;
-         aMatAspect.SetAmbient( 1 );
-         aMatAspect.SetDiffuse( 0 );
-       
-         aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
-         aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
+      aMatAspect.SetAmbient( 1 );
+      aMatAspect.SetDiffuse( 0 );
+
+      aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
+      aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
     }
   }
 }
@@ -321,7 +216,7 @@ void HYDROGUI_Shape::updateShape( const bool theIsForce )
   if ( !theIsForce || !myContext )
     return;
   
-  myContext->Display( myShape );
+  myContext->Display( myShape, theIsForce );
 }
 
 QColor HYDROGUI_Shape::getActiveColor() const
index 3adfec17df49b01a888de7a93587132c78d68461..885e23d04896953cc44768e7e6ec6527c9694b17 100644 (file)
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_Shape.hxx>
 
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+
 #include <QColor>
-#include <QPainterPath>
 
 class BRepBuilderAPI_MakeFace;
 class BRepBuilderAPI_MakeWire;
@@ -40,19 +42,17 @@ public:
   ~HYDROGUI_Shape();
 
 public:
-  virtual void               display();
-  virtual void               erase();
+  virtual void               display( const bool theIsUpdateViewer = true );
+  virtual void               erase( const bool theIsUpdateViewer = true );
 
   virtual void               highlight( bool theIsHighlight );
   virtual bool               isHighlighted() const;
 
-  virtual void               setPath( const QPainterPath& thePath,
-                                      const bool          theToDisplay = true );
-  virtual QPainterPath       getPath() const;
+  virtual void               setWire( const TopoDS_Wire& theWire,
+                                      const bool         theToDisplay = true );
 
-  virtual void               setZIndex( const double theZIndex,
-                                        const bool   theToDisplay = true );
-  virtual double             getZIndex() const;
+  virtual void               setFace( const TopoDS_Face& theFace,
+                                      const bool         theToDisplay = true );
 
   virtual void               setFillingColor( const QColor& theColor,
                                               const bool    theToDisplay = true );
@@ -74,22 +74,13 @@ private:
   static double              getQuantityColorVal( const int theColorVal );
   void                       colorShapeBorder( const QColor& theColor );
 
-  void                       makeEdge( BRepBuilderAPI_MakeWire& theWireBuilder,
-                                       gp_Pnt&                  theFirstPoint,
-                                       gp_Pnt&                  theLastPoint ) const;
-
-  void                       makeWire( BRepBuilderAPI_MakeFace& theFaceBuilder,
-                                       BRepBuilderAPI_MakeWire& theWireBuilder,
-                                       bool&                    theIsComposed ) const;
-
 private:
   Handle(AIS_InteractiveContext) myContext;
   Handle(AIS_Shape)              myShape;
 
   bool                           myIsHighlight;
-  QPainterPath                   myPath;
+  TopoDS_Face                    myFace;
   
-  double                         myZIndex;
   QColor                         myFillingColor;
   QColor                         myBorderColor;
   QColor                         myHighlightColor;
index f8a19c983789351192fe604526391f370e28ed77..1a20f39d8858fb4e377f3518bda803c25695f685 100644 (file)
 #include <HYDROData_Polyline.h>
 #include <HYDROData_Zone.h>
 
-void printPath( const QString& thePathName,
-                const QPainterPath& thePath,
-                const QStringList& theZonesList = QStringList() )
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Wire.hxx>
+
+TopoDS_Face HYDROGUI_SplitZonesTool::SplitData::Face() const
 {
-  printf( "%s ", qPrintable( thePathName ) );
-  if( !theZonesList.isEmpty() )
-  {
-    printf( "[ " );
-    QStringListIterator anIter( theZonesList );
-    while( anIter.hasNext() )
-      printf( "%s ", qPrintable( anIter.next() ) );
-    printf( "] " );
-  }
-  printf( "(n=%d) :", thePath.elementCount() );
-  for( int i = 0, n = thePath.elementCount(); i < n; i++ )
-  {
-    const QPainterPath::Element anElement = thePath.elementAt( i );
-    switch( anElement.type )
-    {
-      case QPainterPath::MoveToElement:
-        printf( " M(%.0f,%.0f)", anElement.x, anElement.y );
-        break;
-      case QPainterPath::LineToElement:
-        printf( " L(%.0f,%.0f)", anElement.x, anElement.y );
-        break;
-      default:
-        break;
-    }
-  }
-  printf( "\n" );
+  if( !Shape.IsNull() && Shape.ShapeType() == TopAbs_FACE )
+    return TopoDS::Face( Shape );
+  return TopoDS_Face();
 }
 
 HYDROGUI_SplitZonesTool::SplitDataList
@@ -70,13 +53,12 @@ HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneL
     Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( theZoneList.Value( anIndex ) );
     if( !aZone.IsNull() )
     {
-      SplitData aSplitData( aZone->GetPainterPath(), aZone->GetName() );
+      SplitData aSplitData( aZone->Face(), aZone->GetName() );
       anInputSplitDataList.append( aSplitData );
     }
   }
 
   // Step 1. Split the paths.
-  //printf( "Step 1\n" );
   SplitDataListIterator anInputIter( anInputSplitDataList );
   while( anInputIter.hasNext() )
   {
@@ -114,28 +96,34 @@ HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneL
   }
 
   // Step 2. Take into account the boundary polyline.
-  //printf( "Step 2\n" );
   if( !thePolyline.IsNull() )
   {
-    const QPainterPath& aBoundaryPath = thePolyline->painterPath();
-    SplitData aBoundarySplitData( aBoundaryPath, "" );
-
-    SplitDataList aCutSplitDataList;
-    SplitDataListIterator anOutputIter( anOutputSplitDataList );
-    while( anOutputIter.hasNext() )
+    const TopoDS_Wire& aWire = thePolyline->Wire();
+    if( !aWire.IsNull() )
     {
-      const SplitData& anOutputSplitData = anOutputIter.next();
+      BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
+      aMakeFace.Build();
+      if( aMakeFace.IsDone() )
+      {
+        SplitData aBoundarySplitData( aMakeFace.Face(), "" );
+
+        SplitDataList aCutSplitDataList;
+        SplitDataListIterator anOutputIter( anOutputSplitDataList );
+        while( anOutputIter.hasNext() )
+        {
+          const SplitData& anOutputSplitData = anOutputIter.next();
 
-      SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
-      if( SplitTwoData( anOutputSplitData, aBoundarySplitData,
-                        aData1Subtracted, aData2Subtracted, aDataIntersected ) )
-        aCutSplitDataList.append( aDataIntersected );
+          SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
+          if( SplitTwoData( anOutputSplitData, aBoundarySplitData,
+                            aData1Subtracted, aData2Subtracted, aDataIntersected ) )
+            aCutSplitDataList.append( aDataIntersected );
+        }
+        anOutputSplitDataList = aCutSplitDataList;
+      }
     }
-    anOutputSplitDataList = aCutSplitDataList;
   }
 
   // Step 3. Extract the separate regions.
-  //printf( "Step 3\n" );
   SplitDataList anExtractedSplitDataList;
   SplitDataListIterator anOutputIter( anOutputSplitDataList );
   while( anOutputIter.hasNext() )
@@ -152,34 +140,30 @@ bool HYDROGUI_SplitZonesTool::SplitTwoData( const SplitData& theData1,
                                             SplitData& theData2Subtracted,
                                             SplitData& theDataIntersected )
 {
-  const QPainterPath& aPath1 = theData1.Path;
-  const QPainterPath& aPath2 = theData2.Path;
+  const TopoDS_Shape& aShape1 = theData1.Shape;
+  const TopoDS_Shape& aShape2 = theData2.Shape;
 
   const QStringList& aZoneNames1 = theData1.ZoneNames;
   const QStringList& aZoneNames2 = theData2.ZoneNames;
 
-  //printPath( "aPath1", aPath1, aZoneNames1 );
-  //printPath( "aPath2", aPath2, aZoneNames2 );
-
-  QPainterPath aPathIntersected = aPath1.intersected( aPath2 );
-  aPathIntersected.closeSubpath();
-  //printPath( "aPathIntersected", aPathIntersected );
-  if( aPathIntersected.isEmpty() )
+  BRepAlgoAPI_Common aCommon( aShape1, aShape2 );
+  TopoDS_Shape aCommonShape = aCommon.Shape();
+  if( aCommonShape.IsNull() )
   {
     theData1Subtracted = theData1;
     theData2Subtracted = theData2;
     return false;
   }
 
-  QPainterPath aPath1Subtracted = aPath1.subtracted( aPath2 );
-  //printPath( "aPath1Subtracted", aPath1Subtracted );
-  theData1Subtracted = SplitData( aPath1Subtracted, aZoneNames1 );
+  BRepAlgoAPI_Cut aCut1( aShape1, aShape2 );
+  TopoDS_Shape aCut1Shape = aCut1.Shape();
 
-  QPainterPath aPath2Subtracted = aPath2.subtracted( aPath1 );
-  //printPath( "aPath2Subtracted", aPath2Subtracted );
-  theData2Subtracted = SplitData( aPath2Subtracted, aZoneNames2 );
+  BRepAlgoAPI_Cut aCut2( aShape2, aShape1 );
+  TopoDS_Shape aCut2Shape = aCut2.Shape();
 
-  theDataIntersected = SplitData( aPathIntersected, aZoneNames1 + aZoneNames2 );
+  theData1Subtracted = SplitData( aCut1Shape, aZoneNames1 );
+  theData2Subtracted = SplitData( aCut2Shape, aZoneNames2 );
+  theDataIntersected = SplitData( aCommonShape, aZoneNames1 + aZoneNames2 );
 
   return true;
 }
@@ -188,51 +172,19 @@ HYDROGUI_SplitZonesTool::SplitDataList
 HYDROGUI_SplitZonesTool::ExtractSeparateData( const SplitData& theData )
 {
   SplitDataList aSplitDataList;
-
-  const QPainterPath& aBasePath = theData.Path;
-  const QStringList& aBaseZoneNames = theData.ZoneNames;
-
-  QList<QPainterPath> aPathList;
-  for( int i = 0, n = aBasePath.elementCount(); i < n; i++ )
+  TopExp_Explorer anExp( theData.Shape, TopAbs_FACE );
+  for( ; anExp.More(); anExp.Next() )
   {
-    const QPainterPath::Element anElement = aBasePath.elementAt( i );
-    switch( anElement.type )
+    TopoDS_Shape aShape = anExp.Current();
+    if( aShape.ShapeType() == TopAbs_FACE )
     {
-      case QPainterPath::MoveToElement:
-        aPathList.append( QPainterPath( QPointF( anElement.x, anElement.y ) ) );
-        break;
-      case QPainterPath::LineToElement:
-        if( !aPathList.isEmpty() )
-        {
-          QPainterPath& aPath = aPathList.last();
-          aPath.lineTo( anElement.x, anElement.y );
-        }
-        break;
-      case QPainterPath::CurveToElement: // currently not supported
-      default:
-        break;
-    }
-  }
-
-  // check the hole case
-  if( aPathList.size() == 2 )
-  {
-    const QPainterPath& aPath1 = aPathList.first();
-    const QPainterPath& aPath2 = aPathList.last();
-    if( aPath1.contains( aPath2 ) || aPath2.contains( aPath1 ) )
-    {
-      aSplitDataList.append( theData );
-      return aSplitDataList;
+      TopoDS_Face aFace = TopoDS::Face( aShape );
+      if( !aFace.IsNull() )
+      {
+        SplitData aSplitData( aFace, theData.ZoneNames );
+        aSplitDataList.append( aSplitData );
+      }
     }
   }
-
-  QListIterator<QPainterPath> anIter( aPathList );
-  while( anIter.hasNext() )
-  {
-    QPainterPath aPath = anIter.next();
-    aPath.closeSubpath();
-    //printPath( "aPath", aPath );
-    aSplitDataList.append( SplitData( aPath, aBaseZoneNames ) );
-  }
   return aSplitDataList;
 }
index 0f68d15f455b96620bbd824e210f449cc50cce64..ca74d3c53bb453ab5b9fd1a4b6d0711fd938a8ee 100644 (file)
@@ -25,7 +25,8 @@
 
 #include <HYDROData_Object.h>
 
-#include <QPainterPath>
+#include <TopoDS_Face.hxx>
+
 #include <QStringList>
 
 class Handle(HYDROData_Polyline);
@@ -40,18 +41,20 @@ class HYDROGUI_SplitZonesTool
 public:
   struct SplitData
   {
-    QPainterPath Path;
+    TopoDS_Shape Shape;
     QStringList  ZoneNames;
 
     SplitData() {}
     
-    SplitData( const QPainterPath& thePath,
+    SplitData( const TopoDS_Shape& theShape,
                const QStringList& theZoneNames ) :
-      Path( thePath ), ZoneNames( theZoneNames ) {}
+      Shape( theShape ), ZoneNames( theZoneNames ) {}
 
-    SplitData( const QPainterPath& thePath,
+    SplitData( const TopoDS_Shape& theShape,
                const QString& theZoneName ) :
-      Path( thePath ), ZoneNames( theZoneName ) {}
+      Shape( theShape ), ZoneNames( theZoneName ) {}
+
+    TopoDS_Face Face() const;
   };
 
   typedef QList        <SplitData> SplitDataList;
index e2c95ab1bedc99abe686135e2a647d037f31889b..25cefb603a8fd27cf416baf1c0a48842740e61b4 100644 (file)
@@ -39,6 +39,8 @@
 #include <LightApp_Application.h>
 #include <LightApp_UpdateFlags.h>
 
+#include <TopoDS_Wire.hxx>
+
 HYDROGUI_ZoneOp::HYDROGUI_ZoneOp( HYDROGUI_Module* theModule,
                                   const bool theIsEdit )
 : HYDROGUI_Operation( theModule ),
@@ -256,13 +258,13 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName )
   if ( !aPanel )
     return;
 
-  QPainterPath aPath;
+  TopoDS_Wire aWire;
 
   Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
     HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
   if ( !aPolyline.IsNull() )
   {
-    aPath = aPolyline->painterPath();
+    aWire = aPolyline->Wire();
   }
 
   LightApp_Application* anApp = module()->getApp();
@@ -300,7 +302,7 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName )
 
   myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false );
   myPreviewPrs->setBorderColor( aPanel->getBorderColor(), false );
-  myPreviewPrs->setPath( aPath, true );
+  myPreviewPrs->setWire( aWire, true );
 }
 
 void HYDROGUI_ZoneOp::onLastViewClosed( SUIT_ViewManager* theViewManager )
index 4677e5d6af98a232cded00485c34cafc53799d88..f14194813bef2080cd5a7875302ade0843079d8a 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <HYDROData_Zone.h>
 
-#include <QPainterPath>
-
 class OCCViewer_ViewManager;
 
 class SUIT_ViewManager;
@@ -68,8 +66,6 @@ private:
 
   OCCViewer_ViewManager*     myPreviewViewManager;
   HYDROGUI_Shape*            myPreviewPrs;
-
-  QPainterPath               myZonePath;
 };
 
 #endif
index ebbcdb3f0e6d0349fbabe4e846a6709fb094a219..54e51a7df0280599c92fb1c00224c949b9d6b727 100644 (file)
 #pragma comment (lib , "TKMath.lib") 
 
 // Application Framework
+#pragma comment (lib , "TKBO.lib") 
+#pragma comment (lib , "TKBRep.lib") 
+#pragma comment (lib , "TKCAF.lib") 
 #pragma comment (lib , "TKCDF.lib") 
 #pragma comment (lib , "TKG3d.lib")
 #pragma comment (lib , "TKGeomAlgo.lib")
 #pragma comment (lib , "TKGeomBase.lib")
 #pragma comment (lib , "TKLCAF.lib") 
-#pragma comment (lib , "TKV3d.lib") 
-#pragma comment (lib , "TKBrep.lib") 
 #pragma comment (lib , "TKTopAlgo.lib") 
+#pragma comment (lib , "TKV3d.lib")