{
}
+bool HYDROGUI_DataModel::create( CAM_Study* theStudy )
+{
+ bool status = LightApp_DataModel::create( theStudy );
+ if ( status )
+ updateDocument();
+ return status;
+}
+
bool HYDROGUI_DataModel::open( const QString& theURL,
CAM_Study* theStudy,
QStringList theFileList )
{
res = DocError_UnknownProblem;
}
- if( res != DocError_OK )
+
+ if ( res != DocError_OK )
{
module()->application()->putInfo( tr( "LOAD_ERROR" ) );
return false;
}
- if( !aStatesFullPath.isEmpty() )
+ if ( !aStatesFullPath.isEmpty() )
{
QFile aFile( aStatesFullPath );
if( aFile.open( QFile::ReadOnly ) )
aFile.close();
}
}
+
+ updateDocument();
}
// if the document open was successful, the data model update happens
// in the set mode of the module
- if( res == DocError_OK )
+ if ( res == DocError_OK )
update( aStudyId );
return true;
QString aTmpDir;
SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
bool isMultiFile = false;
- if( resMgr )
+ if ( resMgr )
isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
// save module data to temporary files
bool HYDROGUI_DataModel::close()
{
+ HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
+ if ( aModule )
+ aModule->clearCache();
return true;
}
Handle(HYDROData_Entity) aClone = getDocument()->CreateObject( aKind );
if( !aClone.IsNull() )
{
- anObject->CopyTo( aClone );
+ anObject->CopyTo( aClone, true );
anIsChanged = true;
// remove Z layer
{
SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
QString defTablePath = resMgr->path( "resources", module()->name(), tr( "DEFAULT_STRICKLER_TABLE_FILE" ) );
- aStricklerTableObj->Import( HYDROGUI_Tool::ToAsciiString( defTablePath ) );
+ aStricklerTableObj->Import( defTablePath );
// Set name
QString aStricklerTableName;
if ( aStricklerTableObj->GetName().isEmpty() )
createObject( aGuiObj, aBottomPolyline, aGuiObj->entry(), false );
}
}
+ else if ( anObjectKind == KIND_LAND_COVER )
+ {
+ Handle(HYDROData_LandCover) aLandCoverObj =
+ Handle(HYDROData_LandCover)::DownCast( aDataObj );
+
+ HYDROData_SequenceOfObjects aPolylines = aLandCoverObj->GetPolylines();
+ buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );
+ }
+
}
void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase,
return true;
}
+void HYDROGUI_DataModel::updateDocument()
+{
+ // Sets the default strickler coefficient from preferences to document.
+ Handle(HYDROData_Document) aDoc = getDocument();
+ SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
+ if ( resMgr && !aDoc.IsNull() )
+ aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( "preferences", "default_strickler_coefficient", 0 ) );
+}
+
void HYDROGUI_DataModel::setObjectVisibilityState( Handle(HYDROData_Entity) theModelObject,
HYDROGUI_DataObject* theObject )
{