X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_AISCurve.cxx;h=16364e6f8c2da028bc89eba840d4271d59555924;hb=5cae7e874afd2fc1b6f61023e8ebd33a933db3c7;hp=8899eafdd42b97cc58d0cbf90e1fe94ae0a622eb;hpb=01088db9a5bdbd5b54e202ee2743ccea76e8dc98;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_AISCurve.cxx b/src/HYDROGUI/HYDROGUI_AISCurve.cxx index 8899eafd..16364e6f 100755 --- a/src/HYDROGUI/HYDROGUI_AISCurve.cxx +++ b/src/HYDROGUI/HYDROGUI_AISCurve.cxx @@ -1,14 +1,20 @@ #include "HYDROGUI_AISCurve.h" -#include "CurveCreator_Curve.hxx" +#include + +#include #include #include - +#include +#include +#include +#include #include #include - -#include +#include +#include +#include HYDROGUI_AISCurveSection::HYDROGUI_AISCurveSection( Handle_AIS_InteractiveContext theContext, CurveCreator_Curve* theCurve, int theSection) : @@ -40,44 +46,74 @@ void HYDROGUI_AISCurveSection::highlight( bool isHL ) Quantity_Color aColor = getActiveColor(); for( int i = 0 ; i < myObjects.size() ; i++ ){ myObjects[i]->SetColor(aColor); - myContext->Display(myObjects[i]); + myContext->Display(myObjects[i], Standard_False); } + myContext->UpdateCurrentViewer(); } void HYDROGUI_AISCurveSection::Display() { for( int i = 0 ; i < myObjects.size() ; i++ ){ - myContext->Display(myObjects[i]); + myContext->Display(myObjects[i], Standard_False); } + myContext->UpdateCurrentViewer(); } void HYDROGUI_AISCurveSection::Erase() { for( int i = 0 ; i < myObjects.size() ; i++ ){ - myContext->Erase(myObjects[i]); + myContext->Erase(myObjects[i], Standard_False); } + myContext->UpdateCurrentViewer(); } void HYDROGUI_AISCurveSection::buildSection() { + CurveCreator::Type aSectType = myCurve->getType( mySection ); int aSectSize = myCurve->getNbPoints( mySection ); - double anX; - double anY; - double aZ; - int i = 0; - for( ; i < ( aSectSize - 1 ) ; i++ ){ - Handle_AIS_Point anAISPnt = getAISPoint(i); - myObjects.push_back( anAISPnt ); - Handle_AIS_Line aLine = getAISLine( i, i+1 ); - myObjects.push_back( aLine ); - } - if( aSectSize != 0 ){ - Handle_AIS_Point anAISPnt = getAISPoint(i); - myObjects.push_back( anAISPnt ); - if( myCurve->isClosed(mySection) && ( aSectSize > 1 ) ){ - Handle_AIS_Line aLine = getAISLine( i, 0 ); + bool aSectIsClosed = myCurve->isClosed( mySection ); + + if( aSectType == CurveCreator::Polyline ) + { + int i = 0; + for( ; i < ( aSectSize - 1 ) ; i++ ){ + Handle_AIS_Point anAISPnt = getAISPoint(i); + myObjects.push_back( anAISPnt ); + Handle_AIS_Line aLine = getAISLine( i, i+1 ); myObjects.push_back( aLine ); } + if( aSectSize != 0 ){ + Handle_AIS_Point anAISPnt = getAISPoint(i); + myObjects.push_back( anAISPnt ); + if( myCurve->isClosed(mySection) && ( aSectSize > 1 ) ){ + Handle_AIS_Line aLine = getAISLine( i, 0 ); + myObjects.push_back( aLine ); + } + } + } + else if( aSectType == CurveCreator::BSpline ) + { + QList aPoints; + for( int i = 0; i < aSectSize; i++ ) + { + Handle_AIS_Point anAISPnt = getAISPoint( i ); + myObjects.push_back( anAISPnt ); + + double aX = 0, aY = 0, aZ = 0; + getPoint( i, aX, aY, aZ ); + aPoints << aX << aY; + } + + if( aSectSize > 1 ) + { + HYDROData_BSplineOperation aBSpline( aPoints, 0, aSectIsClosed ); + TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge(); + + TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire(); + + Handle(AIS_Shape) aShape = new AIS_Shape( aWire ); + myObjects.push_back( aShape ); + } } } @@ -138,6 +174,7 @@ HYDROGUI_AISCurve::HYDROGUI_AISCurve( CurveCreator_Curve* theCurve, Handle_AIS_I HYDROGUI_AISCurve::~HYDROGUI_AISCurve(void) { + myCurve->removeListener(); } void HYDROGUI_AISCurve::setCurve( CurveCreator_Curve* theCurve ) @@ -153,6 +190,13 @@ void HYDROGUI_AISCurve::Display() } } +void HYDROGUI_AISCurve::Erase() +{ + for( int i = 0 ; i < myCurveRepresentation.size() ; i++ ){ + myCurveRepresentation[i]->Erase(); + } +} + void HYDROGUI_AISCurve::buildCurve() { for( int i = 0 ; i < myCurveRepresentation.size() ; i++ ){