case KIND_SPLITTED_GROUP: return "KIND_SPLITTED_GROUP";
case KIND_STREAM_ALTITUDE: return "KIND_STREAM_ALTITUDE";
case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE";
+ case KIND_STRICKLER_TABLE: return "KIND_STRICKLER_TABLE";
default: return "KIND_UNKNOWN"; ///! Unrecognized object
}
}
const ObjectKind KIND_STREAM_ALTITUDE = 24;
const ObjectKind KIND_OBSTACLE_ALTITUDE = 25;
const ObjectKind KIND_STRICKLER_TABLE = 26;
-const ObjectKind KIND_LAST = KIND_OBSTACLE_ALTITUDE;
+const ObjectKind KIND_LAST = KIND_STRICKLER_TABLE;
DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
#include "HYDROData_Stream.h"
#include "HYDROData_StreamAltitude.h"
#include "HYDROData_Zone.h"
+#include "HYDROData_StricklerTable.h"
#include <TDataStd_Name.hxx>
#include <TDataStd_NamedData.hxx>
case KIND_SPLITTED_GROUP: aResult = new HYDROData_SplittedShapesGroup(); break;
case KIND_STREAM_ALTITUDE: aResult = new HYDROData_StreamAltitude(); break;
case KIND_OBSTACLE_ALTITUDE: aResult = new HYDROData_ObstacleAltitude(); break;
+ case KIND_STRICKLER_TABLE: aResult = new HYDROData_StricklerTable(); break;
default: break;
}
class HYDROData_StricklerTable : public HYDROData_Entity
{
protected:
+ friend class HYDROData_Iterator;
+
enum DataTag
{
DataTag_Table = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
HYDRODATA_EXPORT virtual const ObjectKind GetKind() const;
- bool Import( const TCollection_AsciiString& theFileName );
- bool Export( const TCollection_AsciiString& theFileName );
+ HYDRODATA_EXPORT bool Import( const TCollection_AsciiString& theFileName );
+ HYDRODATA_EXPORT bool Export( const TCollection_AsciiString& theFileName );
double Get( const TCollection_ExtendedString& theType, double theDefault ) const;
void Set( const TCollection_ExtendedString& theType, double theCoefficient );
HYDROGUI_ShowHideOp.h
HYDROGUI_StreamDlg.h
HYDROGUI_StreamOp.h
+ HYDROGUI_StricklerTableDlg.h
+ HYDROGUI_StricklerTableOp.h
HYDROGUI_SubmersibleOp.h
HYDROGUI_Tool.h
HYDROGUI_TwoImagesDlg.h
HYDROGUI_ShowHideOp.cxx
HYDROGUI_StreamDlg.cxx
HYDROGUI_StreamOp.cxx
+ HYDROGUI_StricklerTableDlg.cxx
+ HYDROGUI_StricklerTableOp.cxx
HYDROGUI_SubmersibleOp.cxx
HYDROGUI_Tool.cxx
HYDROGUI_TwoImagesDlg.cxx
FILE(GLOB GUIPNG_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.png")
FILE(GLOB GUIXML_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.xml")
+FILE(GLOB GUIXML_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.txt")
SET(GUI_DATA ${GUIPNG_DATA} ${GUIXML_DATA})
INSTALL(FILES ${GUI_DATA} DESTINATION ${SALOME_HYDRO_INSTALL_RES_DATA})
#include <HYDROData_Digue.h>
#include <HYDROData_River.h>
#include <HYDROData_Stream.h>
+#include <HYDROData_StricklerTable.h>
#include <CAM_Module.h>
#include <CAM_Study.h>
// OBSTACLES
LightApp_DataObject* anObstaclesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_OBSTACLE ).toAscii() ) );
+ // STRICKLER TABLES
+ LightApp_DataObject* aStricklerTablesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_STRICKLER_TABLE ).toAscii() ) );
+
// CALCULATION CASES
LightApp_DataObject* aCalculRootObj = createObject( aNewRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) );
// VISUAL STATES
LightApp_DataObject* aVisualStateRootObj = createObject( aNewRootObj, tr( partitionName( KIND_VISUAL_STATE ).toAscii() ) );
+ int aNoStricklerTableObj = 0;
HYDROData_Iterator anIterator( aDocument, KIND_UNKNOWN );
for( ; anIterator.More(); anIterator.Next() ) {
LightApp_DataObject* obj = 0;
obj = createObject( anObstaclesRootObj, anObstacleObj );
}
+ break;
+ }
+ case KIND_STRICKLER_TABLE:
+ {
+ Handle(HYDROData_StricklerTable) anStricklerTableObj =
+ Handle(HYDROData_StricklerTable)::DownCast( anObj );
+ if( !anStricklerTableObj.IsNull() ) {
+ obj = createObject( aStricklerTablesRootObj, anStricklerTableObj );
+ }
+ aNoStricklerTableObj++;
+
break;
}
case KIND_CALCULATION:
}
}
+ // Create default Strickler table object
+ if ( aNoStricklerTableObj == 0 )
+ createDefaultStricklerTable( aDocument, aStricklerTablesRootObj );
+
//if( SUIT_DataBrowser* anObjectBrowser = anApp->objectBrowser() )
//{
// anObjectBrowser->setAutoOpenLevel( 3 );
case KIND_OBSTACLE: return "OBSTACLES";
case KIND_ARTIFICIAL_OBJECT: return "ARTIFICIAL_OBJECTS";
case KIND_NATURAL_OBJECT: return "NATURAL_OBJECTS";
+ case KIND_STRICKLER_TABLE: return "STRICKLER_TABLES";
default: break;
}
return QString();
theParentEntry, theIsBuildTree, theIsInOperation );
}
+void HYDROGUI_DataModel::createDefaultStricklerTable( const Handle(HYDROData_Document)& theDocument,
+ LightApp_DataObject* theParent )
+{
+ // Create default Strickler table object
+ Handle(HYDROData_StricklerTable) anStricklerTableObj =
+ Handle(HYDROData_StricklerTable)::DownCast( theDocument->CreateObject(KIND_STRICKLER_TABLE) );
+ if ( !anStricklerTableObj.IsNull() )
+ {
+ anStricklerTableObj->Import( HYDROGUI_Tool::ToAsciiString( tr( "DEFAULT_STRICKLER_TABLE_FILE" ) ) );
+ // Set name
+ QString aStricklerTableName;
+ if ( anStricklerTableObj->GetName().isEmpty() )
+ {
+ HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
+ if ( aModule )
+ aStricklerTableName = HYDROGUI_Tool::GenerateObjectName( aModule, tr( "DEFAULT_STRICKLER_TABLE_NAME" ) );
+ }
+ if ( anStricklerTableObj->GetName() != aStricklerTableName )
+ anStricklerTableObj->SetName( aStricklerTableName );
+
+ anStricklerTableObj->Update();
+
+ LightApp_DataObject* obj = createObject( theParent, anStricklerTableObj );
+ }
+}
+
LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent,
const QString& theName,
const QString& theParentEntry )
const QString& theParentEntry,
const bool theIsBuildTree ,
const bool theIsInOperation = false );
+ /**
+ * 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 );
/**
* Build partition for object.
* \param theObject gui object for which the partition will be build
bool anIsRegion = false;
bool anIsZone = false;
bool anIsObstacle = false;
+ bool anIsStricklerTable = false;
bool anIsStream = false;
bool anIsChannel = false;
bool anIsDigue = false;
anIsBathymetry = true;
else if( anObjectKind == KIND_OBSTACLE )
anIsObstacle = true;
+ else if( anObjectKind == KIND_STRICKLER_TABLE )
+ anIsStricklerTable = true;
else if( anObjectKind == KIND_STREAM )
{
anIsStream = true;
theMenu->addAction( action( CreateBoxId ) );
theMenu->addAction( action( CreateCylinderId ) );
break;
+ case KIND_STRICKLER_TABLE:
+ theMenu->addAction( action( ImportStricklerTableFromFileId ) );
+ break;
case KIND_CALCULATION:
theMenu->addAction( action( CreateCalculationId ) );
break;
theMenu->addAction( action( TranslateObstacleId ) );
theMenu->addSeparator();
}
+ else if( anIsStricklerTable )
+ {
+ theMenu->addAction( action( EditStricklerTableId ) );
+ theMenu->addAction( action( ExportStricklerTableFromFileId ) );
+ theMenu->addSeparator();
+ }
else if( anIsVisualState && anIsObjectBrowser )
{
theMenu->addAction( action( SaveVisualStateId ) );
#include "HYDROGUI_RiverBottomOp.h"
#include "HYDROGUI_ProfileInterpolateOp.h"
#include "HYDROGUI_SubmersibleOp.h"
+#include "HYDROGUI_StricklerTableOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
createAction( CreateDigueId, "CREATE_DIGUE", "CREATE_DIGUE_ICO" );
createAction( EditDigueId, "EDIT_DIGUE", "EDIT_DIGUE_ICO" );
+ createAction( ImportStricklerTableFromFileId, "IMPORT_STRICKLER_TABLE", "IMPORT_STRICKLER_TABLE_ICO" );
+ createAction( ExportStricklerTableFromFileId, "EXPORT_STRICKLER_TABLE", "EXPORT_STRICKLER_TABLE_ICO" );
+ createAction( EditStricklerTableId, "EDIT_STRICKLER_TABLE", "EDIT_STRICKLER_TABLE_ICO" );
+
createAction( ImportObstacleFromFileId, "IMPORT_OBSTACLE_FROM_FILE", "IMPORT_OBSTACLE_FROM_FILE_ICO" );
createAction( ImportGeomObjectAsObstacleId, "IMPORT_GEOM_OBJECT_AS_OBSTACLE", "IMPORT_GEOM_OBJECT_ICO" );
createAction( ImportGeomObjectAsPolylineId, "IMPORT_GEOM_OBJECT_AS_POLYLINE", "IMPORT_GEOM_OBJECT_ICO" );
createMenu( ImportImageId, aHydroId, -1, -1 );
createMenu( ImportPolylineId, aHydroId, -1, -1 );
createMenu( ImportBathymetryId, aHydroId, -1, -1 );
+ createMenu( ImportStricklerTableFromFileId, aHydroId, -1, -1 );
createMenu( CreatePolylineId, aHydroId, -1, -1 );
createMenu( CreatePolyline3DId, aHydroId, -1, -1 );
createMenu( CreateImmersibleZoneId, aHydroId, -1, -1 );
createMenu( CreateChannelId, aHydroId, -1, -1 );
- createMenu( CreateDigueId, aHydroId, -1, -1 );
+ createMenu( CreateDigueId, aHydroId, -1, -1 );
int aNewProfileId = createMenu( tr( "MEN_DESK_PROFILE" ), aHydroId, -1 );
createMenu( CreateProfileId, aNewProfileId, -1, -1 );
createTool( CreateBoxId, aToolBar );
createTool( CreateCylinderId, aToolBar );
+ createTool( separator(), aToolBar );
+ createTool( ImportStricklerTableFromFileId, aToolBar );
+
createTool( separator(), aToolBar );
createTool( CreateCalculationId, aToolBar );
case EditDigueId:
anOp = new HYDROGUI_DigueOp( aModule, theId == EditDigueId );
break;
+ case EditStricklerTableId:
+ anOp = new HYDROGUI_StricklerTableOp( aModule, theId == EditStricklerTableId );
+ break;
case CreateCalculationId:
case EditCalculationId:
anOp = new HYDROGUI_CalculationOp( aModule, theId == EditCalculationId );
SubmersibleId,
ImportPolylineId,
- ExportPolylineId
+ ExportPolylineId,
+
+ ImportStricklerTableFromFileId,
+ ExportStricklerTableFromFileId,
+ EditStricklerTableId
};
--- /dev/null
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_StricklerTableDlg.h"
+
+#include <QLineEdit>
+
+HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle ), myName(NULL)
+{
+}
+
+HYDROGUI_StricklerTableDlg::~HYDROGUI_StricklerTableDlg()
+{
+}
+
+void HYDROGUI_StricklerTableDlg::setStricklerTableName( const QString& theName )
+{
+ myName->setText(theName);
+}
+
+QString HYDROGUI_StricklerTableDlg::getStricklerTableName() const
+{
+ return myName->text();
+}
--- /dev/null
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_STRICKLERTABLEDLG_H
+#define HYDROGUI_STRICKLERTABLEDLG_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QLineEdit;
+
+class HYDROGUI_StricklerTableDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+ virtual ~HYDROGUI_StricklerTableDlg();
+
+ void setStricklerTableName( const QString& theName );
+ QString getStricklerTableName() const;
+
+private:
+ QLineEdit* myName;
+};
+
+#endif
--- /dev/null
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_StricklerTableOp.h"
+
+#include "HYDROGUI_StricklerTableDlg.h"
+
+HYDROGUI_StricklerTableOp::HYDROGUI_StricklerTableOp( HYDROGUI_Module* theModule, bool theIsEdit )
+: HYDROGUI_Operation( theModule ),
+ myIsEdit( theIsEdit )
+{
+ setName( theIsEdit ? tr( "EDIT_STRICKLER_TABLE" ) : tr( "IMPORT_STRICKLER_TABLE" ) );
+}
+
+
+HYDROGUI_StricklerTableOp::~HYDROGUI_StricklerTableOp()
+{
+}
+
+void HYDROGUI_StricklerTableOp::startOperation()
+{
+}
+
+void HYDROGUI_StricklerTableOp::abortOperation()
+{
+}
+
+void HYDROGUI_StricklerTableOp::commitOperation()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_StricklerTableOp::createInputPanel() const
+{
+ HYDROGUI_StricklerTableDlg* aDlg = new HYDROGUI_StricklerTableDlg( module(), getName() );
+ return aDlg;
+}
+
+bool HYDROGUI_StricklerTableOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ return true;
+}
--- /dev/null
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_STRICKLERTABLEOP_H
+#define HYDROGUI_STRICKLERTABLEOP_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_StricklerTable.h>
+
+class HYDROGUI_StricklerTableOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_StricklerTableOp( HYDROGUI_Module* theModule, bool isEdit );
+ virtual ~HYDROGUI_StricklerTableOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+ virtual void commitOperation();
+
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries );
+
+private:
+ bool myIsEdit;
+ Handle(HYDROData_StricklerTable) myEditedObject;
+};
+
+#endif
<source>HYDRO_TYPE20_ICO</source>
<translation>icon_hydro_obj.png</translation>
</message>
+ <message>
+ <source>HYDRO_TYPE26_ICO</source>
+ <translation>icon_strickler_table.png</translation>
+ </message>
<!-- Icons for need to update objects -->
<message>
<translation>icon_edit_digue.png</translation>
</message>
+ <message>
+ <source>DEFAULT_STRICKLER_TABLE_FILE</source>
+ <translation>def_strickler_table.txt</translation>
+ </message>
+ <message>
+ <source>IMPORT_STRICKLER_TABLE_ICO</source>
+ <translation>icon_import_strickler_table.png</translation>
+ </message>
+ <message>
+ <source>EXPORT_STRICKLER_TABLE_ICO</source>
+ <translation>icon_export_strickler_table.png</translation>
+ </message>
+ <message>
+ <source>EDIT_STRICKLER_TABLE_ICO</source>
+ <translation>icon_edit_strickler_table.png</translation>
+ </message>
+
<message>
<source>IMPORT_OBSTACLE_FROM_FILE_ICO</source>
<translation>icon_import_obstacle.png</translation>
<source>DEFAULT_IMMERSIBLE_ZONE_NAME</source>
<translation>Immersible zone</translation>
</message>
+ <message>
+ <source>DEFAULT_STRICKLER_TABLE_NAME</source>
+ <translation>Strickler table</translation>
+ </message>
<message>
<source>IMAGES</source>
<translation>IMAGES</translation>
<source>OBSTACLES</source>
<translation>OBSTACLES</translation>
</message>
+ <message>
+ <source>STRICKLER_TABLES</source>
+ <translation>STRICKLER TABLES</translation>
+ </message>
<message>
<source>ARTIFICIAL_OBJECTS</source>
<translation>ARTIFICIAL OBJECTS</translation>
<source>DSK_EDIT_DIGUE</source>
<translation>Edit digue</translation>
</message>
+ <message>
+ <source>DSK_IMPORT_STRICKLER_TABLE</source>
+ <translation>Import Strickler table</translation>
+ </message>
+ <message>
+ <source>DSK_EXPORT_STRICKLER_TABLE</source>
+ <translation>Export Strickler table</translation>
+ </message>
+ <message>
+ <source>DSK_EDIT_STRICKLER_TABLE</source>
+ <translation>Edit Strickler table</translation>
+ </message>
<message>
<source>DSK_COPY</source>
<translation>Copy</translation>
<source>MEN_EDIT_DIGUE</source>
<translation>Edit digue</translation>
</message>
+ <message>
+ <source>MEN_IMPORT_STRICKLER_TABLE</source>
+ <translation>Import Strickler table</translation>
+ </message>
+ <message>
+ <source>MEN_EXPORT_STRICKLER_TABLE</source>
+ <translation>Export Strickler table</translation>
+ </message>
+ <message>
+ <source>MEN_EDIT_STRICKLER_TABLE</source>
+ <translation>Edit Strickler table</translation>
+ </message>
<message>
<source>MEN_CUT_IMAGES</source>
<translation>Cut images</translation>
<source>STB_EDIT_DIGUE</source>
<translation>Edit digue</translation>
</message>
+ <message>
+ <source>STB_IMPORT_STRICKLER_TABLE</source>
+ <translation>Import Strickler table</translation>
+ </message>
+ <message>
+ <source>STB_EXPORT_STRICKLER_TABLE</source>
+ <translation>Export Strickler table</translation>
+ </message>
+ <message>
+ <source>STB_EDIT_STRICKLER_TABLE</source>
+ <translation>Edit Strickler table</translation>
+ </message>
<message>
<source>STB_COPY</source>
<translation>Copy</translation>
</message>
</context>
+ <context>
+ <name>HYDROGUI_StricklerTableDlg</name>
+ <message>
+ <source>STRICKLER_TABLE_NAME</source>
+ <translation>Strickler table name</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>HYDROGUI_StricklerTableOp</name>
+ <message>
+ <source>IMPORT_STRICKLER_TABLE</source>
+ <translation>Import Strickler table</translation>
+ </message>
+ <message>
+ <source>EXPORT_STRICKLER_TABLE</source>
+ <translation>Export Strickler table</translation>
+ </message>
+ <message>
+ <source>EDIT_STRICKLER_TABLE</source>
+ <translation>Edit Strickler table</translation>
+ </message>
+ </context>
+
<context>
<name>HYDROGUI_TranslateObstacleDlg</name>
<message>