Salome HOME
patch for correct compilation on Linux
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Curve.cxx
index 7e814ade601bf9866a61b389c28608b0f9014461..3f88a8b2bddda6622673f0070e50d193fa438794 100644 (file)
@@ -29,6 +29,7 @@
 #include "CurveCreator_Utils.h"
 
 #include <AIS_Shape.hxx>
+#include <AIS_InteractiveObject.hxx>
 #include <Geom_CartesianPoint.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Lin.hxx>
@@ -46,6 +47,7 @@ CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimensi
 : myIsLocked  (false),
   myDimension (theDimension),
   myDisplayer (NULL),
+  myAISShape  (NULL),
   myNbUndos   (0),
   myNbRedos   (0),
   myUndoDepth (-1),
@@ -243,8 +245,10 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double&
 void CurveCreator_Curve::redisplayCurve()
 {
   if( myDisplayer ) {
-    myDisplayer->erase( false );
-    myDisplayer->display( constructWire(), true );
+    myDisplayer->eraseAll( false );
+    myAISShape = NULL;
+
+    myDisplayer->display( getAISObject( true ), true );
   }
 }
 
@@ -362,8 +366,10 @@ bool CurveCreator_Curve::redo()
 bool CurveCreator_Curve::clearInternal()
 {
   // erase curve from the viewer
-  if( myDisplayer )
-    myDisplayer->erase( true );
+  if( myDisplayer ) {
+    myDisplayer->eraseAll( true );
+    myAISShape = NULL;
+  }
   // Delete all allocated data.
   int i = 0;
   const int aNbSections = getNbSections();
@@ -935,18 +941,19 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection )
   return aCoords;
 }
 
-
-/***********************************************/
-/***       Presentation methods              ***/
-/***********************************************/
-std::vector<Handle_AIS_InteractiveObject> CurveCreator_Curve::constructWire() const
+void CurveCreator_Curve::constructAISObject()
 {
-  std::vector<Handle_AIS_InteractiveObject> aCurveRepresentation;
-
   TopoDS_Shape aShape;
   CurveCreator_Utils::constructShape( this, aShape );
 
-  AIS_Shape* anAISShape = new AIS_Shape( aShape );
-  aCurveRepresentation.push_back( anAISShape );
-  return aCurveRepresentation;
+  myAISShape = new AIS_Shape( aShape );
 }
+
+Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
+{
+  if ( !myAISShape && theNeedToBuild ) {
+    CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
+    aCurve->constructAISObject();
+  }
+  return myAISShape;
+}
\ No newline at end of file