#include "CurveCreator_Utils.h"
#include <AIS_Shape.hxx>
+#include <AIS_InteractiveObject.hxx>
#include <Geom_CartesianPoint.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <stdio.h>
-//#define AIS_CURVE_DISPLAY
-
//=======================================================================
// function: Constructor
// purpose:
: myIsLocked (false),
myDimension (theDimension),
myDisplayer (NULL),
+ myAISShape (NULL),
myNbUndos (0),
myNbRedos (0),
myUndoDepth (-1),
myOpLevel(0)
{
-#ifdef AIS_CURVE_DISPLAY
- myAISCurve = new CurveCreator_AISCurve( this );
-#endif
}
//=======================================================================
void CurveCreator_Curve::setDisplayer( CurveCreator_Displayer* theDisplayer )
{
myDisplayer = theDisplayer;
-
-#ifdef AIS_CURVE_DISPLAY
- myDisplayer->displayAIS( myAISCurve, false );
-#endif
}
//=======================================================================
}
}
-//#define USE_COMPOUND
void CurveCreator_Curve::redisplayCurve()
{
if( myDisplayer ) {
-#ifdef AIS_CURVE_DISPLAY
- myDisplayer->redisplayAIS(myAISCurve, false);
-#else
- myDisplayer->erase( false );
-//#ifndef USE_COMPOUND
- myDisplayer->display( constructWire(), true );
-//#else
- /*std::vector<Handle_AIS_InteractiveObject> anAISObjects = constructWire();
- int aSelMode = AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)TopAbs_VERTEX );
- Handle(AIS_InteractiveContext) aContext = myDisplayer->getAISContext();
- for( int i = 0 ; i < anAISObjects.size() ; i++ ){
- Handle_AIS_InteractiveObject anAISObject = anAISObjects[i];
- //anAISObject->SetSelectionMode( aSelMode );
- aContext->Display( anAISObject, Standard_False );
- //aContext->Display( anAISObject, 0, aSelMode, Standard_False, Standard_True );
- }
- aContext->UpdateCurrentViewer();
- */
-//#endif
-#endif
+ myDisplayer->eraseAll( false );
+ myAISShape = NULL;
+
+ myDisplayer->display( getAISObject( true ), true );
}
}
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();
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