X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_DataModel.h;h=2b7d92176c7bd94a8f5b232b6fcd805d6d783f3f;hb=80b3ef265c1b8564a52097094156256956017ae1;hp=3576a1a029bfad8e88c83e916855ad059802e347;hpb=a735d3579cae0b95c56436cae00b09473a2b85db;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_DataModel.h b/src/HYDROGUI/HYDROGUI_DataModel.h index 3576a1a0..2b7d9217 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@ -1,12 +1,8 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,13 +16,18 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef HYDROGUI_DATAMODEL_H #define HYDROGUI_DATAMODEL_H #include -#include +#include +#include +#include +#include #include +#include #include #include @@ -34,6 +35,7 @@ class CAM_DataObject; class SUIT_DataObject; class HYDROGUI_DataObject; +class HYDROGUI_Zone; /** * \class HYDROGUI_DataModel @@ -49,6 +51,11 @@ public: HYDROGUI_DataModel( CAM_Module* theModule ); virtual ~HYDROGUI_DataModel(); + /** + * Creates the document into the data model. Reimplemented. + */ + virtual bool create( CAM_Study* ); + /** * Open the document into the data model. Reimplemented. * \param theURL opened study path @@ -111,7 +118,7 @@ public: * \param the data model object * \return the only one object referenced to the given data model object, or null if not found */ - virtual HYDROGUI_DataObject* getDataObject( const Handle(HYDROData_Object)& theModelObject ); + virtual HYDROGUI_DataObject* getDataObject( const Handle(HYDROData_Entity)& theModelObject ); /** * Returns a data object referenced to the given data object. @@ -139,6 +146,12 @@ public: */ CAM_DataObject* createRootModuleObject( SUIT_DataObject* theParent ); + /** + * Create a new region in the given calculation case containing given zones. + */ + bool createNewRegion( Handle(HYDROData_CalculationCase) theCase, + const QList& theZonesList ); + /** * Correct an internal model object according to the current document mode */ @@ -147,7 +160,7 @@ public: /** * Find a data object by the specified entry and kind */ - Handle(HYDROData_Object) objectByEntry( const QString& theEntry, + Handle(HYDROData_Entity) objectByEntry( const QString& theEntry, const ObjectKind theObjectKind = KIND_UNKNOWN ); /** @@ -210,6 +223,26 @@ public: */ bool paste(); + /** + * Rename the object + */ + bool rename( Handle(HYDROData_Entity) theEntity, const QString& theName ); + + /** + * Creates the Calculation Case subtree for usage within an operation dialog. + * \param theParent a created object will be appended as a child of this GUI object + * \param theCase the calculation case model object + * \param theLandCover if true - land cover regions will be represented in the tree + */ + void buildCaseTree( SUIT_DataObject* theParent, + Handle(HYDROData_CalculationCase) theCase ); + + /** + * Updates the object subtree. + * \param theObj the data model entity + */ + void updateObjectTree( Handle(HYDROData_Entity)& theObj ); + /** * Update the sequence of the objects to be copied */ @@ -222,6 +255,14 @@ public: */ static QString partitionName( const ObjectKind theObjectKind ); + /** + * Creates the default Strickler table object: both GUI data object and corresponding model object + * \param theDocument a document into which created object will be added + * \param theParent a created object will be appended as a child of this GUI object + */ + void createDefaultStricklerTable( const Handle(HYDROData_Document)& theDocument, + LightApp_DataObject* theParent ); + protected: /** * Returns the document for the current study @@ -231,19 +272,89 @@ protected: /** * Creates the GUI data object according to the model object. * \param theParent a created object will be appended as a child of this object - * \param theObject model object + * \param theModelObject model object + * \param theParentEntry entry of parent object */ - LightApp_DataObject* createObject( SUIT_DataObject* theParent, - Handle(HYDROData_Object) theModelObject, - const QString& theParentEntry = QString() ); + LightApp_DataObject* createObject( SUIT_DataObject* theParent, + Handle(HYDROData_Entity) theModelObject, + const QString& theParentEntry = QString(), + const bool theIsBuildTree = true ); /** * Creates the GUI data object without corresponding model object: just by name * \param theParent a created object will be appended as a child of this object * \param theName name of this object + * \param theParentEntry entry of parent object */ LightApp_DataObject* createObject( SUIT_DataObject* theParent, - const QString& theName ); + const QString& theName, + const QString& theParentEntry = QString() ); + + /** + * Build object tree if the flag theIsBuildTree is true. + * This is a conditional wrapper for buildObjectTree method. + * \param theParent a created object will be appended as a child of this object + * \param theObject the GUI object + * \param theParentEntry the entry of parent object + * \param theIsBuildTree if true then build the subtree of the GUI object + * \param theIsInOperation if true then the tree is used for a browser within an operation, it is false by default + */ + LightApp_DataObject* buildObject( SUIT_DataObject* theParent, + HYDROGUI_DataObject* theObject, + const QString& theParentEntry, + const bool theIsBuildTree, + const bool theIsInOperation = false ); + + /** + * Build object tree if the flag theIsBuildTree is true. + * \param theParent a created object will be appended as a child of this GUI object + * \param theModelObject the data model zone object + * \param theParentEntry the entry of parent object + * \param theIsBuildTree if true then build the subtree of the GUI object + * \param theIsInOperation if true then the tree is used for a browser within an operation, it is false by default + */ + LightApp_DataObject* createZone( SUIT_DataObject* theParent, + Handle(HYDROData_Zone) theModelObject, + const QString& theParentEntry, + const bool theIsBuildTree , + const bool theIsInOperation = false ); + + /** + * Build object tree if the flag theIsBuildTree is true. + * \param theParent a created object will be appended as a child of this GUI object + * \param theModelObject the data model region object + * \param theParentEntry the entry of parent object + * \param theIsBuildTree if true then build the subtree of the GUI object + * \param theIsInOperation if true then the tree is used for a browser within an operation, it is false by default + */ + LightApp_DataObject* createRegion( SUIT_DataObject* theParent, + Handle(HYDROData_Region) theModelObject, + const QString& theParentEntry, + const bool theIsBuildTree , + const bool theIsInOperation = false ); + /** + * Build partition for object. + * \param theObject gui object for which the partition will be build + * \param theObjects sequence of builded objects + * \param thePartName name of created partition + * \param theIsCreateEmpty if true then partition will be created in any case + */ + void buildObjectPartition( SUIT_DataObject* theObject, + const HYDROData_SequenceOfObjects& theObjects, + const QString& thePartName, + const bool theIsCreateEmpty ); + + /** + * Build tree of a model object. + * \param theParent a created object will be appended as a child of this object + * \param theObject gui object for which the tree will be build + * \param theParentEntry entry of parent object + * \param theIsInOperation if true then the tree is used for a browser within an operation, it is false by default + */ + void buildObjectTree( SUIT_DataObject* theParent, + SUIT_DataObject* theObject, + const QString& theParentEntry = QString(), + const bool theIsInOperation = false ); /** * Removes data object from the tree. @@ -262,8 +373,20 @@ protected: static SUIT_DataObject* findChildByName( const SUIT_DataObject* theFather, const QString& theName ); + void updateDocument(); + + /** + * Set object visibility state. + * \param theModelObject the data model object + * \param theDataObject the GUI object + */ + void setObjectVisibilityState( Handle(HYDROData_Entity) theModelObject, + HYDROGUI_DataObject* theObject ); + + protected: QString myStudyURL; ///< the saved/opened document URL + QByteArray myStates; }; #endif