#include "HYDROGUI_LandCoverDlg.h"
#include "HYDROGUI_Module.h"
+#include "HYDROGUI_OCCDisplayer.h"
#include "HYDROGUI_Shape.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
if ( !aStricklerTableObj.IsNull() )
{
// Get Strickler table data from the data model
- TColStd_SequenceOfExtendedString aTypes = aStricklerTableObj->GetTypes();
- for ( int i = 1; i <= aTypes.Length(); i++ )
+ QStringList aTypes = aStricklerTableObj->GetTypes();
+ for ( QStringList::iterator it = aTypes.begin(); it != aTypes.end(); ++it )
{
- QString aType = HYDROGUI_Tool::ToQString( aTypes.Value( i ) );
- if ( !aType.isEmpty() && !aStricklerTypes.contains( aType ))
+ QString aType = *it;
+ if ( !aType.isEmpty() && !aStricklerTypes.contains( aType ) )
aStricklerTypes.append( aType );
}
}
}
+
aStricklerTypes.sort();
aPanel->setAdditionalParams( aStricklerTypes );
}
module()->setIsToUpdate( aZoneObj );
+ module()->getOCCDisplayer()->SetToUpdateColorScale();
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
QApplication::setOverrideCursor( Qt::WaitCursor );
- QList<Handle(HYDROData_PolylineXY)> aZonePolylines;
+ HYDROData_SequenceOfObjects aZonePolylines;
QStringList::const_iterator anIt = thePolylineNames.begin(), aLast = thePolylineNames.end();
for( ; anIt!=aLast; anIt++ )
{
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() )
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();
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()
}
module()->update( UF_OCCViewer );
- aPanel->excludePolylines( aSelectedPolylines );
+
+ if ( aPanel->excludePolylines( aSelectedPolylines ) )
+ {
+ closePreview();
+ onCreatePreview( aPanel->getPolylineNames() );
+ }
}
void HYDROGUI_LandCoverOp::closePreview()
return true;
// Check if the land cover object is already modified or not
- bool isConfirmed = myEditedObject->IsMustBeUpdated();
+ bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
if ( !isConfirmed )
{
// If not modified check if the land cover has already defined polylines