for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
- if ( !anObject.IsNull() && !anObject->IsRemoved() )
+
+ if ( !anObject.IsNull() && !anObject->IsRemoved() ) {
anObject->Remove();
+ module()->setObjectRemoved( anObject );
+ }
}
commitDocOperation();
theMenu->addAction( action( DuplicateStricklerTableId ) );
theMenu->addSeparator();
- if ( !isLandCoversScalarMapModeOn( anActiveViewId ) &&
- !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
+ Handle(HYDROData_StricklerTable) aTable =
+ Handle(HYDROData_StricklerTable)::DownCast( aSeq.First() );
+ QString aCurrentTable =
+ HYDROGUI_DataObject::dataObjectEntry( getLandCoverColoringTable( anActiveViewId ) );
+ bool isUsed = aCurrentTable == HYDROGUI_DataObject::dataObjectEntry( aTable );
+
+ if ( !isUsed && !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
theMenu->addAction( action( LandCoverScalarMapModeOnId ) );
theMenu->addSeparator();
}
{
return myLandCoverColoringMap.contains( theViewId );
}
+
+void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObject )
+{
+ if ( theObject.IsNull() || !theObject->IsRemoved() ) {
+ return;
+ }
+
+ if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) {
+ Handle(HYDROData_StricklerTable) aTable =
+ Handle(HYDROData_StricklerTable)::DownCast( theObject );
+ QList<int> aViewIds;
+ QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+ while ( anIter.hasNext() ) {
+ if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) ==
+ HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
+ anIter.remove();
+ }
+ }
+ }
+}
\ No newline at end of file
*/
bool isLandCoversScalarMapModeOn( const int theViewId ) const;
+ /**
+ * Set object as removed.
+ * @param theObject the removed object
+ */
+ void setObjectRemoved( const Handle(HYDROData_Entity)& theObject );
+
protected:
CAM_DataModel* createDataModel();
OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( theViewer->getViewManager()->getActiveView() );
Handle(V3d_View) aView = aWnd->getViewPort()->getView();
-
+
int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
bool isLandCoverColoringOn = module()->isLandCoversScalarMapModeOn( aViewerId );
if ( isLandCoverColoringOn ) {
aTable = module()->getLandCoverColoringTable( aViewerId );
if ( !aTable.IsNull() ) {
- aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
+ // TODO: non-empty title leads to buggy behaviour
+ // aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
aTable->GetCoefficientRange( aColorScaleMin, aColorScaleMax );
aTableTypes = aTable->GetTypes();
}
aLandCoverShape->setFillingColor( aColor, true, true );
aLandCoverShape->setScalarMapModeEnabled( isLandCoverColoringOn );
theViewer->getAISContext()->Redisplay( aLandCoverShape->getAISObject() );
- //theViewer->getAISContext()->UpdateCurrentViewer(); //@MZN
- //theViewer->getAISContext()->UpdateCurrent();
- //theViewer->getAISContext()->UpdateSelected( true );
}
myToUpdateColorScale = false;