mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
HYDRO / refs #1334
This commit is contained in:
parent
19d83677d4
commit
ed9a2d484b
@ -56,7 +56,10 @@ CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimensi
|
||||
myNbRedos (0),
|
||||
myUndoDepth (-1),
|
||||
myOpLevel(0),
|
||||
mySkipSorting(false)
|
||||
mySkipSorting(false),
|
||||
myPointAspectColor (Quantity_NOC_ROYALBLUE4),
|
||||
myCurveColor (Quantity_NOC_RED),
|
||||
myLineWidth(1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -249,13 +252,16 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double&
|
||||
}
|
||||
}
|
||||
|
||||
void CurveCreator_Curve::redisplayCurve()
|
||||
void CurveCreator_Curve::redisplayCurve(bool preEraseAllObjects)
|
||||
{
|
||||
//DEBTRACE("redisplayCurve");
|
||||
if( myDisplayer ) {
|
||||
myDisplayer->eraseAll( false );
|
||||
if( myDisplayer )
|
||||
{
|
||||
if (preEraseAllObjects)
|
||||
myDisplayer->eraseAll( false );
|
||||
else
|
||||
myDisplayer->erase( myAISShape, false);
|
||||
myAISShape = NULL;
|
||||
|
||||
myDisplayer->display( getAISObject( true ), true );
|
||||
}
|
||||
}
|
||||
@ -422,7 +428,7 @@ bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
|
||||
break;
|
||||
}
|
||||
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -465,7 +471,7 @@ int CurveCreator_Curve::addSectionInternal
|
||||
aSection->myIsClosed = theIsClosed;
|
||||
aSection->myPoints = thePoints;
|
||||
mySections.push_back(aSection);
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return mySections.size()-1;
|
||||
}
|
||||
|
||||
@ -525,7 +531,7 @@ bool CurveCreator_Curve::removeSectionInternal( const int theISection )
|
||||
delete *anIterRm;
|
||||
mySections.erase(anIterRm);
|
||||
}
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -616,14 +622,14 @@ bool CurveCreator_Curve::setClosedInternal( const int theISection,
|
||||
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;
|
||||
@ -706,12 +712,12 @@ bool CurveCreator_Curve::setSectionTypeInternal( const int theISection,
|
||||
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;
|
||||
@ -772,7 +778,7 @@ bool CurveCreator_Curve::addPointsInternal( const CurveCreator::SectionsMap &the
|
||||
}
|
||||
}
|
||||
if(res)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -830,7 +836,7 @@ bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theS
|
||||
}
|
||||
}
|
||||
if(res)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -914,7 +920,7 @@ bool CurveCreator_Curve::removePointsInternal( const SectionToPointList &thePoin
|
||||
aRes = removeSectionPoints(aSectionId, anIt->second);
|
||||
}
|
||||
if( aRes)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
|
||||
return aRes;
|
||||
}
|
||||
@ -989,20 +995,21 @@ 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(Quantity_NOC_ROYALBLUE4);
|
||||
anAspect->SetColor(myPointAspectColor);
|
||||
myAISShape->Attributes()->SetPointAspect( anAspect );
|
||||
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
|
||||
{
|
||||
//DEBTRACE("getAISObject");
|
||||
if ( !myAISShape && theNeedToBuild ) {
|
||||
if ( !myAISShape && theNeedToBuild )
|
||||
{
|
||||
CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
|
||||
aCurve->constructAISObject();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ struct CurveCreator_Section;
|
||||
class CurveCreator_Displayer;
|
||||
class AIS_Shape;
|
||||
class AIS_InteractiveObject;
|
||||
class Quantity_Color;
|
||||
|
||||
/**
|
||||
* The CurveCreator_Curve object is represented as one or more sets of
|
||||
@ -108,7 +109,7 @@ protected:
|
||||
public: // TODO: remove public
|
||||
void getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const;
|
||||
protected: // TODO: remove public
|
||||
void redisplayCurve();
|
||||
void redisplayCurve(bool preEraseAllObjects = true);
|
||||
|
||||
public:
|
||||
/************ Implementation of INTERFACE methods ************/
|
||||
@ -294,7 +295,7 @@ public:
|
||||
/**
|
||||
* Get the curve AIS object
|
||||
*/
|
||||
virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false ) const;
|
||||
virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -324,6 +325,9 @@ public:
|
||||
CurveCreator::Sections mySections; //!< curve data
|
||||
CurveCreator::Dimension myDimension; //!< curve dimension
|
||||
CurveCreator_Displayer* myDisplayer; //!< curve displayer
|
||||
Quantity_Color myPointAspectColor;
|
||||
Quantity_Color myCurveColor;
|
||||
double myLineWidth;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -54,14 +54,22 @@ void CurveCreator_Displayer::eraseAll( bool isUpdate )
|
||||
{
|
||||
if(myObjects.empty())
|
||||
return;
|
||||
for( int i = 0 ; i < myObjects.size() ; i++ ){
|
||||
for( int i = 0 ; i < myObjects.size() ; i++ )
|
||||
myContext->Erase(myObjects[i], Standard_False);
|
||||
}
|
||||
myObjects.clear();
|
||||
if( isUpdate )
|
||||
myContext->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
void CurveCreator_Displayer::erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate )
|
||||
{
|
||||
if(theObject.IsNull())
|
||||
return;
|
||||
myContext->Erase(theObject, Standard_False);
|
||||
if( isUpdate )
|
||||
myContext->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
|
||||
{
|
||||
if( isHL ){
|
||||
@ -70,6 +78,13 @@ Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
|
||||
return Quantity_Color( 0., 1., 0., Quantity_TOC_RGB );
|
||||
}
|
||||
|
||||
void CurveCreator_Displayer::Update()
|
||||
{
|
||||
for( int i = 0 ; i < myObjects.size() ; i++ )
|
||||
myContext->Update(myObjects[i], Standard_True);
|
||||
myContext->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
/*void CurveCreator_Displayer::highlight( const AISObjectsList& theObjects, bool isHL )
|
||||
{
|
||||
return;
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
|
||||
void display( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
|
||||
void eraseAll( bool isUpdate );
|
||||
void erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
|
||||
void Update();
|
||||
//void highlight( const AISObjectsList& theObjects, bool isHL );
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user