-// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <iostream>
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+
#include <stdio.h>
//=======================================================================
myNbRedos (0),
myUndoDepth (-1),
myOpLevel(0),
- mySkipSorting(false)
+ mySkipSorting(false),
+ myPointAspectColor (Quantity_NOC_ROYALBLUE4),
+ myCurveColor (Quantity_NOC_RED),
+ myEraseAll(true),
+ myLineWidth(1)
{
}
}
}
-void CurveCreator_Curve::redisplayCurve()
+void CurveCreator_Curve::redisplayCurve(bool preEraseAllObjects)
{
- if( myDisplayer ) {
- myDisplayer->eraseAll( false );
+ //DEBTRACE("redisplayCurve");
+ if( myDisplayer )
+ {
+ if (preEraseAllObjects)
+ myDisplayer->eraseAll( false );
+ else
+ myDisplayer->erase( myAISShape, false);
myAISShape = NULL;
-
myDisplayer->display( getAISObject( true ), true );
}
}
bool CurveCreator_Curve::clearInternal()
{
// erase curve from the viewer
- if( myDisplayer ) {
- myDisplayer->eraseAll( true );
+ if( myDisplayer )
+ {
+ if (myEraseAll)
+ myDisplayer->eraseAll( true );
+ else
+ myDisplayer->erase(myAISShape, false);
myAISShape = NULL;
}
// Delete all allocated data.
return res;
}
+//=======================================================================
+// function: clear
+// purpose:
+//=======================================================================
+void CurveCreator_Curve::SetEraseAllState(bool toEraseAll)
+{
+ myEraseAll = toEraseAll;
+}
+//=======================================================================
+// function: clear
+// purpose:
+//=======================================================================
+bool CurveCreator_Curve::GetEraseAllState() const
+{
+ return myEraseAll;
+}
+
//! For internal use only! Undo/Redo are not used here.
bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
{
break;
}
- redisplayCurve();
+ redisplayCurve(false);
return res;
}
aSection->myIsClosed = theIsClosed;
aSection->myPoints = thePoints;
mySections.push_back(aSection);
- redisplayCurve();
+ redisplayCurve(false);
return mySections.size()-1;
}
delete *anIterRm;
mySections.erase(anIterRm);
}
- redisplayCurve();
+ redisplayCurve(false);
return true;
}
aSection = (CurveCreator_Section*)getSection( i );
if( aSection ) {
aSection->myIsClosed = theIsClosed;
- redisplayCurve();
+ redisplayCurve(false);
}
}
} else {
aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection ) {
aSection->myIsClosed = theIsClosed;
- redisplayCurve();
+ redisplayCurve(false);
}
}
return true;
if ( aSection )
aSection->myType = theType;
}
- redisplayCurve();
+ redisplayCurve(false);
} else {
aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection && aSection->myType != theType ){
aSection->myType = theType;
- redisplayCurve();
+ redisplayCurve(false);
}
}
return true;
}
}
if(res)
- redisplayCurve();
+ redisplayCurve(false);
return res;
}
const int theISection,
const int theIPnt )
{
+ //DEBTRACE("addPoints");
bool res = false;
CurveCreator::Coordinates aCoords = theCoords;
// Set the difference.
}
}
if(res)
- redisplayCurve();
+ redisplayCurve(false);
return res;
}
const int theIPnt,
const CurveCreator::Coordinates& theNewCoords )
{
+ //DEBTRACE("setPoint");
bool res = false;
// Set the difference.
startOperation();
bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
const bool theIsToSaveDiff )
{
+ //DEBTRACE("setSeveralPoints");
bool res = false;
// Set the difference.
startOperation();
aRes = removeSectionPoints(aSectionId, anIt->second);
}
if( aRes)
- redisplayCurve();
+ redisplayCurve(false);
return aRes;
}
CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
const int theIPnt) const
{
+ //DEBTRACE("getPoint");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
CurveCreator::Coordinates::const_iterator
anIter = aSection->myPoints.begin() + toICoord(theIPnt);
// function: getPoints
// purpose:
//=======================================================================
-CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
+CurveCreator::Coordinates CurveCreator_Curve::getCoords( int theISection ) const
{
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");
TopoDS_Shape aShape;
CurveCreator_Utils::constructShape( this, aShape );
-
- myAISShape = new AIS_Shape( aShape );
+ myAISShape = new AIS_Shape( aShape );
+ myAISShape->SetColor( myCurveColor );
+ myAISShape->SetWidth( myLineWidth );
+ Handle(Prs3d_PointAspect) anAspect = myAISShape->Attributes()->PointAspect();
+ anAspect->SetScale( 3.0 );
+ anAspect->SetTypeOfMarker(Aspect_TOM_O_POINT);
+ anAspect->SetColor(myPointAspectColor);
+ myAISShape->Attributes()->SetPointAspect( anAspect );
}
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
{
- if ( !myAISShape && theNeedToBuild ) {
+ //DEBTRACE("getAISObject");
+ if ( !myAISShape && theNeedToBuild )
+ {
CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
aCurve->constructAISObject();
}