X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_LandCoverOp.cxx;h=2d2c5705a6459435b331599cbfb85420bc72c427;hb=40075335fb504d596f21e9459488a56c1277dbde;hp=00b32548846d5db87d1f9a82b87997da5af6e189;hpb=7db42f76ecf6f5409a591f2b64882e8f0d9dcdd5;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_LandCoverOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverOp.cxx index 00b32548..2d2c5705 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverOp.cxx @@ -20,6 +20,7 @@ #include "HYDROGUI_LandCoverDlg.h" #include "HYDROGUI_Module.h" +#include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Shape.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_UpdateFlags.h" @@ -233,6 +234,7 @@ bool HYDROGUI_LandCoverOp::processApply( int& theUpdateFlags, } module()->setIsToUpdate( aZoneObj ); + module()->getOCCDisplayer()->SetToUpdateColorScale(); theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; @@ -247,7 +249,7 @@ void HYDROGUI_LandCoverOp::onCreatePreview( const QStringList& thePolylineNames QApplication::setOverrideCursor( Qt::WaitCursor ); - QList aZonePolylines; + HYDROData_SequenceOfObjects aZonePolylines; QStringList::const_iterator anIt = thePolylineNames.begin(), aLast = thePolylineNames.end(); for( ; anIt!=aLast; anIt++ ) { @@ -255,14 +257,11 @@ void HYDROGUI_LandCoverOp::onCreatePreview( const QStringList& thePolylineNames Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINEXY ) ); if ( !aPolyline.IsNull() ) - aZonePolylines.append( aPolyline ); + aZonePolylines.Append( aPolyline ); } - - // TODO: Generate TopoDS_Shape based on the set of polylines, implement generateTopShape data model method - TopoDS_Shape aZoneShape;/* = HYDROData_LandCover::generateTopShape( aZonePolylines ); - if( aZoneShape.IsNull() ) - printErrorMessage( tr( "ZONE_OBJECT_CANNOT_BE_CREATED" ) ); - */ + + TCollection_AsciiString anError; + TopoDS_Shape aZoneShape = HYDROData_LandCover::buildShape( aZonePolylines, anError ); LightApp_Application* anApp = module()->getApp(); if ( !getPreviewManager() ) @@ -291,10 +290,8 @@ void HYDROGUI_LandCoverOp::onCreatePreview( const QStringList& thePolylineNames myPreviewPrs->setFillingColor( aFillingColor, false, false ); myPreviewPrs->setBorderColor( aBorderColor, false, false ); - TopoDS_Face aFace; if( !aZoneShape.IsNull() ) - aFace = TopoDS::Face( aZoneShape ); - myPreviewPrs->setFace( aFace, true, true, "" ); + myPreviewPrs->setShape( aZoneShape ); } QApplication::restoreOverrideCursor(); @@ -321,8 +318,11 @@ void HYDROGUI_LandCoverOp::onAddPolylines() aSelectedPolylines.append( HYDROGUI_ListModel::Object2Visible( aPolyXY, true ) ); } - aPanel->includePolylines( aSelectedPolylines ); - // TODO: create preview of included polylines + if ( aPanel->includePolylines( aSelectedPolylines ) ) + { + closePreview(); + onCreatePreview( aPanel->getPolylineNames() ); + } } void HYDROGUI_LandCoverOp::onRemovePolylines() @@ -348,7 +348,12 @@ void HYDROGUI_LandCoverOp::onRemovePolylines() } module()->update( UF_OCCViewer ); - aPanel->excludePolylines( aSelectedPolylines ); + + if ( aPanel->excludePolylines( aSelectedPolylines ) ) + { + closePreview(); + onCreatePreview( aPanel->getPolylineNames() ); + } } void HYDROGUI_LandCoverOp::closePreview()