change point marker aspect for 2D curve edition

This commit is contained in:
Paul RASCLE 2016-01-21 16:47:41 +01:00
parent 5488595c45
commit 9febe29948

View File

@ -37,6 +37,11 @@
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Handle_Prs3d_PointAspect.hxx>
#include <iostream>
#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
#include <stdio.h> #include <stdio.h>
//======================================================================= //=======================================================================
@ -247,6 +252,7 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double&
void CurveCreator_Curve::redisplayCurve() void CurveCreator_Curve::redisplayCurve()
{ {
//DEBTRACE("redisplayCurve");
if( myDisplayer ) { if( myDisplayer ) {
myDisplayer->eraseAll( false ); myDisplayer->eraseAll( false );
myAISShape = NULL; myAISShape = NULL;
@ -779,6 +785,7 @@ bool CurveCreator_Curve::addPoints( const CurveCreator::Coordinates& theCoords,
const int theISection, const int theISection,
const int theIPnt ) const int theIPnt )
{ {
//DEBTRACE("addPoints");
bool res = false; bool res = false;
CurveCreator::Coordinates aCoords = theCoords; CurveCreator::Coordinates aCoords = theCoords;
// Set the difference. // Set the difference.
@ -834,6 +841,7 @@ bool CurveCreator_Curve::setPoint( const int theISection,
const int theIPnt, const int theIPnt,
const CurveCreator::Coordinates& theNewCoords ) const CurveCreator::Coordinates& theNewCoords )
{ {
//DEBTRACE("setPoint");
bool res = false; bool res = false;
// Set the difference. // Set the difference.
startOperation(); startOperation();
@ -862,6 +870,7 @@ bool CurveCreator_Curve::setPoint( const int theISection,
bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords, bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
const bool theIsToSaveDiff ) const bool theIsToSaveDiff )
{ {
//DEBTRACE("setSeveralPoints");
bool res = false; bool res = false;
// Set the difference. // Set the difference.
startOperation(); startOperation();
@ -950,6 +959,7 @@ bool CurveCreator_Curve::removeSeveralPoints( const SectionToPointList &theSecti
CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection, CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
const int theIPnt) const const int theIPnt) const
{ {
//DEBTRACE("getPoint");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection ); CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
CurveCreator::Coordinates::const_iterator CurveCreator::Coordinates::const_iterator
anIter = aSection->myPoints.begin() + toICoord(theIPnt); anIter = aSection->myPoints.begin() + toICoord(theIPnt);
@ -964,20 +974,29 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
//======================================================================= //=======================================================================
CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
{ {
//DEBTRACE("getPoints");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection ); CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates(); return aSection ? aSection->myPoints : CurveCreator::Coordinates();
} }
void CurveCreator_Curve::constructAISObject() void CurveCreator_Curve::constructAISObject()
{ {
//DEBTRACE("constructAISObject");
TopoDS_Shape aShape; TopoDS_Shape aShape;
CurveCreator_Utils::constructShape( this, aShape ); CurveCreator_Utils::constructShape( this, aShape );
myAISShape = new AIS_Shape( aShape ); myAISShape = new AIS_Shape( aShape );
Handle(Prs3d_PointAspect) anAspect = myAISShape->Attributes()->PointAspect();
anAspect->SetScale( 3.0 );
anAspect->SetTypeOfMarker(Aspect_TOM_O_POINT);
anAspect->SetColor(Quantity_NOC_ROYALBLUE4);
myAISShape->Attributes()->SetPointAspect( anAspect );
} }
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
{ {
//DEBTRACE("getAISObject");
if ( !myAISShape && theNeedToBuild ) { if ( !myAISShape && theNeedToBuild ) {
CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this; CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
aCurve->constructAISObject(); aCurve->constructAISObject();