]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
refs #1331: disabling automatic sorting of points in the GUI table
authorasl <asl@opencascade.com>
Fri, 22 Sep 2017 06:19:37 +0000 (09:19 +0300)
committerasl <asl@opencascade.com>
Fri, 22 Sep 2017 06:19:37 +0000 (09:19 +0300)
src/CurveCreator/CurveCreator_Curve.cxx
src/CurveCreator/CurveCreator_Curve.hxx
src/CurveCreator/CurveCreator_Diff.cxx
src/CurveCreator/CurveCreator_ICurve.hxx
src/CurveCreator/CurveCreator_Section.cxx
src/CurveCreator/CurveCreator_Section.hxx
src/CurveCreator/CurveCreator_Utils.cxx
src/EntityGUI/EntityGUI_PolylineDlg.cxx

index e307e81606b14a7c727d9e08613b6e9e2a38f27f..fb85db9d86b1594a961b19ca3f6bea5294481bd1 100644 (file)
@@ -971,13 +971,19 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
 // function: getPoints
 // purpose:
 //=======================================================================
-CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
+CurveCreator::Coordinates CurveCreator_Curve::getCoords( int theISection ) const
 {
-  //DEBTRACE("getPoints");
   CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
   return aSection ? aSection->myPoints : CurveCreator::Coordinates();
 }
 
+Handle(TColgp_HArray1OfPnt) CurveCreator_Curve::GetDifferentPoints( int theISection ) const
+{
+  //DEBTRACE("getPoints");
+  CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
+  return aSection ? aSection->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)();
+}
+
 void CurveCreator_Curve::constructAISObject()
 {
   //DEBTRACE("constructAISObject");
index 74667f4f0753483013f4f6306d258ba1423dcedf..5763d1fff57e7520af938da14d6995aef934d3be 100644 (file)
@@ -261,7 +261,9 @@ public:
   /**
    * Get points of a section (the total points in Curve if theISection is equal to -1)..
    */
-  virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const;
+  virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const;
+
+  CurveCreator::Coordinates getCoords( int theISection = -1 ) const;
 
 
   /**
index a9f08d3023f9ce22861d061ed296a2052729a144..c4e1f921233c93d867e4b25816f4dad601e18b2f 100644 (file)
@@ -336,7 +336,7 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
               aSectionId = anIt->first;
               aPointId = anIt->second;
               const CurveCreator::Coordinates &aPoints =
-                      theCurve->getPoints(aSectionId);
+                      theCurve->getCoords(aSectionId);
               CurveCreator::Coordinates::const_iterator anIterBegin =
                   aPoints.begin() + (aDim*aPointId);
               CurveCreator::Coordinates::const_iterator anIterEnd = 
@@ -526,7 +526,7 @@ bool CurveCreator_Diff::addSectionToUndo
                        CurveCreator_Operation &theOperation) const
 {
   const std::string aName = theCurve->getSectionName(theIndex);
-  const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex);
+  const CurveCreator::Coordinates &aPnts = theCurve->getCoords(theIndex);
   const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
   const bool isClosed = theCurve->isClosed(theIndex);
 
index 150e37d2e363328ec9fbb2e5e30a67d80125ee03..d1a2e48bccc6d6bb0160076dd1385256c67335ce 100644 (file)
@@ -59,8 +59,7 @@ struct CURVECREATOR_EXPORT CurveCreator_ISection
   virtual ~CurveCreator_ISection() {}
 
   //! Calculates the different points of the section.
-  virtual void GetDifferentPoints(
-    const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
+  virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
 };
 
 /**
@@ -192,7 +191,7 @@ public:
   /**
    * Get points of a section (the total points in Curve if theISection is equal to -1)..
    */
-  virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0;
+  virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const = 0;
 
   /**
    *  Get number of points in specified section or (the total number of points
index e2298c092acbcb95fb860e13ec9018fb9451482c..2b9beda578e425f79c1af0f5c09ace3732531b2f 100644 (file)
@@ -30,9 +30,10 @@ const double POINT_CONFUSION = 1e-4;
 // function: GetDifferentPoints
 // purpose:
 //=======================================================================
-void CurveCreator_Section::GetDifferentPoints(
-  const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
+Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
 {
+  Handle(TColgp_HArray1OfPnt) points;
+
   std::vector<gp_Pnt> aTmpPoints;
   CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
   CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
@@ -62,9 +63,11 @@ void CurveCreator_Section::GetDifferentPoints(
     }
   }
 
-  thePoints = new TColgp_HArray1OfPnt(1, aPointCount);
+  points = new TColgp_HArray1OfPnt(1, aPointCount);
   for (int aPI = 0; aPI < aPointCount; ++aPI)
   {
-    thePoints->SetValue(aPI + 1, aTmpPoints[aPI]);
+    points->SetValue(aPI + 1, aTmpPoints[aPI]);
   }
+
+  return points;
 }
index 9ad98048a55af66eff13c46625335763580099ad..07b1bc9731309da0fbe70a75f42c008b1ea81d98 100644 (file)
@@ -36,13 +36,13 @@ struct CURVECREATOR_EXPORT CurveCreator_Section :
   CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false)
   { }
 
-  std::string               myName; //!< section name
+  std::string               myName;     //!< section name
   CurveCreator::Coordinates myPoints;   //!< points coordinates
   CurveCreator::SectionType myType;     //!< type of the section
   bool                      myIsClosed; //!< closed or not
 
   //! A virtual method.
-  void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const;
+  Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
 };
 
 #endif
index 5f53caea4b9b76b1c622ec05d4b18bc85669d24f..20b16f4c455befdf6d7fc645f21eb15cda741b05 100644 (file)
@@ -311,9 +311,7 @@ void CurveCreator_Utils::constructShape(
     }
 
     // Get the different points.
-    const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI);
-    Handle(TColgp_HArray1OfPnt) aPoints;
-    aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
+    Handle(TColgp_HArray1OfPnt) aPoints = theCurve->GetDifferentPoints( aSectionI );
     const int aPointCount = aPoints->Length();
     const bool isClosed = theCurve->isClosed(aSectionI);
 
@@ -619,28 +617,28 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
   theContext->SetAutomaticHilight( Standard_False );
 
   Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
-  for( aSelection->Init(); aSelection->More(); aSelection->Next() )
-  {    
+
+  CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
+                                                          aLast = thePoints.end();
+  bool isFound = false;
+  for( int i=0; i<aSize; i++ )
+  {
+    for( aSelection->Init(); aSelection->More(); aSelection->Next() )
+    {    
 #if OCC_VERSION_LARGE > 0x06080100
-    const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
-    if( aHSenEntity.IsNull() )
-      continue;
-    Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
+      const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
+      if( aHSenEntity.IsNull() )
+        continue;
+      Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
 #else
-    Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive();
+      Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive();
 #endif
 
-    Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity );
-
-    gp_Pnt anOwnerPnt = aSenPnt->Point();
-    Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
+      Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity );
+  
+      gp_Pnt anOwnerPnt = aSenPnt->Point();
+      Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
 
-
-    CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
-                                                                   aLast = thePoints.end();
-    bool isFound = false;
-    for( int i=0; i<aSize; i++ )
-    {
       bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE &&
                          fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
       if( isIntersect )
index 1c6c9bda5cb44a81ab9bd11563f308cc9e361f26..e79e0aa6d29e361bae442ab9afab9fd74cc3854e 100644 (file)
@@ -252,7 +252,7 @@ void EntityGUI_PolylineDlg::GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
 
   for (i = 0; i < aNbSec; ++i) {
     // Set coordinates
-    CurveCreator::Coordinates aCoords   = myCurve->getPoints(i);
+    CurveCreator::Coordinates aCoords   = myCurve->getCoords(i);
     const int                 aNbPoints = aCoords.size();
 
     theCoords[i].length(aNbPoints);