#include "HYDROGUI_ImportLandCoverMapOp.h"
#include "HYDROGUI_BathymetrySelectionOp.h"
#include "HYDROGUI_BathymetryOp.h"
+#include "HYDROGUI_RegenerateRegionColorsOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" );
createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
+
+ createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" );
+
}
void HYDROGUI_Module::createMenus()
case LandCoverScalarMapModeOffId:
anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId );
break;
+ case RegenerateRegionColorsId:
+ anOp = new HYDROGUI_RegenerateRegionColorsOp( aModule );
}
if( !anOp )
return 0;
}
-
+static bool GetCalCaseSubT(const QString& aHydroPref,
+ const QString& anEntry,
+ const QString& SubTPostFix,
+ HYDROGUI_DataModel* aModel,
+ Handle(HYDROData_CalculationCase)& theOutCalCase)
+{
+ int aFiB = anEntry.lastIndexOf(SubTPostFix, -1, Qt::CaseInsensitive);
+ if (aFiB != -1)
+ {
+ QString RightTruncEntry = anEntry.left(anEntry.length() - SubTPostFix.length());
+ Handle(HYDROData_CalculationCase) CalCase =
+ Handle(HYDROData_CalculationCase)::DownCast (aModel->objectByEntry( RightTruncEntry, KIND_CALCULATION ));
+ if (CalCase)
+ {
+ theOutCalCase = CalCase;
+ return true;
+ }
+ else
+ return false;
+ }
+ return false;
+}
void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
SUIT_ViewManager* theViewManager )
return KIND_UNKNOWN;
}
+bool HYDROGUI_Tool::IsSelectedPartOfCalcCase( HYDROGUI_Module* theModule, Handle(HYDROData_CalculationCase)& theOutCalCase,
+ QString& theOutPart)
+{
+ HYDROGUI_DataModel* aModel = theModule->getDataModel();
+ SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
+ SUIT_DataOwnerPtrList anOwners;
+ aSelectionMgr->selected( anOwners );
+ if( anOwners.size() != 1 )
+ return false;
+
+ LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( anOwners.first().operator->() );
+ if( anOwner )
+ {
+ QString anEntry = anOwner->entry();
+ QString aHydroPref = "_" + HYDROGUI_DataObject::entryPrefix();
+ //
+ QString aPostFixBoundary = aHydroPref + HYDROGUI_DataModel::tr("CASE_BOUNDARY");
+ if (GetCalCaseSubT(anEntry, anEntry, aPostFixBoundary, aModel, theOutCalCase ))
+ {
+ theOutPart = HYDROGUI_DataModel::tr("CASE_BOUNDARY");
+ theOutPart.toUpper();
+ return true;
+ }
+ //
+ QString aPostFixAO = aHydroPref +
+ HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1().constData());
+ if (GetCalCaseSubT(anEntry, anEntry, aPostFixAO, aModel, theOutCalCase ))
+ {
+ aPostFixAO.remove(0, aHydroPref.length());
+ theOutPart = aPostFixAO;
+ return true;
+ }
+ //
+ QString aPostFixNO = aHydroPref +
+ HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_NATURAL_OBJECT ).toLatin1().constData());
+ if (GetCalCaseSubT(anEntry, anEntry, aPostFixNO, aModel, theOutCalCase ))
+ {
+ aPostFixNO.remove(0, aHydroPref.length());
+ theOutPart = aPostFixNO;
+ return true;
+ }
+ //
+ QString aPostFixLCM = aHydroPref +
+ HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_LAND_COVER_MAP ).toLatin1().constData());
+ if (GetCalCaseSubT(anEntry, anEntry, aPostFixLCM, aModel, theOutCalCase ))
+ {
+ aPostFixLCM.remove(0, aHydroPref.length());
+ theOutPart = aPostFixLCM;
+ return true;
+ }
+ //
+ QString aPostFixReg = aHydroPref +
+ HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_REGION ).toLatin1().constData());
+ if (GetCalCaseSubT(anEntry, anEntry, aPostFixReg, aModel, theOutCalCase ))
+ {
+ aPostFixReg.remove(0, aHydroPref.length());
+ theOutPart = aPostFixReg;
+ return true;
+ }
+ //
+ }
+ return false;
+}
QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule,
QList<GEOM::shape_type> theTypes )