set(PROJECT_HEADERS
HYDROGUI.h
HYDROGUI_AISCurve.h
+ HYDROGUI_CalculationDlg.h
+ HYDROGUI_CalculationOp.h
HYDROGUI_ColorWidget.h
HYDROGUI_DataModel.h
HYDROGUI_DataObject.h
set(PROJECT_SOURCES
HYDROGUI_AISCurve.cxx
+ HYDROGUI_CalculationDlg.cxx
+ HYDROGUI_CalculationOp.cxx
HYDROGUI_ColorWidget.cxx
HYDROGUI_DataModel.cxx
HYDROGUI_DataObject.cxx
RelativePath=".\HYDROGUI_AISCurve.cxx"
>
</File>
+ <File
+ RelativePath=".\HYDROGUI_CalculationDlg.cxx"
+ >
+ </File>
+ <File
+ RelativePath=".\HYDROGUI_CalculationOp.cxx"
+ >
+ </File>
<File
RelativePath=".\HYDROGUI_ColorWidget.cxx"
>
RelativePath=".\HYDROGUI_AISCurve.h"
>
</File>
+ <File
+ RelativePath=".\HYDROGUI_CalculationDlg.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating moc_$(InputName).cxx"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx"
+ Outputs="moc/moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\HYDROGUI_CalculationOp.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating moc_$(InputName).cxx"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx"
+ Outputs="moc/moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath=".\HYDROGUI_ColorWidget.h"
>
<Filter
Name="Moc Files"
>
+ <File
+ RelativePath=".\moc\moc_HYDROGUI_CalculationDlg.cxx"
+ >
+ </File>
+ <File
+ RelativePath=".\moc\moc_HYDROGUI_CalculationOp.cxx"
+ >
+ </File>
<File
RelativePath=".\moc\moc_HYDROGUI_ColorWidget.cxx"
>
--- /dev/null
+// 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
+//
+// 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.
+//
+// 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_CalculationDlg.h"
+
+#include "HYDROGUI_Tool.h"
+
+#include <SUIT_FileDlg.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QPicture>
+#include <QToolButton>
+
+HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+ // Calculation name
+ myObjectNameGroup = new QGroupBox( tr( "CALCULATION_NAME" ) );
+
+ myObjectName = new QLineEdit( myObjectNameGroup );
+
+ QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
+ aNameLayout->setMargin( 5 );
+ aNameLayout->setSpacing( 5 );
+ aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
+ aNameLayout->addWidget( myObjectName );
+
+ // Common
+ addWidget( myObjectNameGroup );
+ addStretch();
+}
+
+HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg()
+{
+}
+
+void HYDROGUI_CalculationDlg::reset()
+{
+ myObjectName->clear();
+}
+
+void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
+{
+ myObjectName->setText( theName );
+}
+
+QString HYDROGUI_CalculationDlg::getObjectName() const
+{
+ return myObjectName->text();
+}
+
+
+
+
--- /dev/null
+// 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
+//
+// 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.
+//
+// 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_CALCULATIONDLG_H
+#define HYDROGUI_CALCULATIONDLG_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QGroupBox;
+class QLineEdit;
+
+class HYDROGUI_CalculationDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+ virtual ~HYDROGUI_CalculationDlg();
+
+ void reset();
+
+ void setObjectName( const QString& theName );
+ QString getObjectName() const;
+
+private:
+ QGroupBox* myObjectNameGroup;
+ QLineEdit* myObjectName;
+
+};
+
+#endif
+
--- /dev/null
+// 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
+//
+// 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.
+//
+// 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_CalculationOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_CalculationDlg.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <LightApp_Application.h>
+#include <LightApp_UpdateFlags.h>
+
+HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit )
+: HYDROGUI_Operation( theModule ),
+ myIsEdit( theIsEdit )
+{
+ setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) );
+}
+
+HYDROGUI_CalculationOp::~HYDROGUI_CalculationOp()
+{
+}
+
+void HYDROGUI_CalculationOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ aPanel->reset();
+
+ QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Case" );
+
+ myEditedObject.Nullify();
+ if ( myIsEdit )
+ {
+ myEditedObject = Handle(HYDROData_Calculation)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if ( !myEditedObject.IsNull() )
+ anObjectName = myEditedObject->GetName();
+ }
+
+ aPanel->setObjectName( anObjectName );
+}
+
+void HYDROGUI_CalculationOp::abortOperation()
+{
+ HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_CalculationOp::commitOperation()
+{
+ HYDROGUI_Operation::commitOperation();
+}
+
+HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
+{
+ HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName() );
+ return aPanel;
+}
+
+bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg )
+{
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return false;
+
+ QString anObjectName = aPanel->getObjectName().simplified();
+ if ( anObjectName.isEmpty() )
+ {
+ theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
+ return false;
+ }
+
+ // check that there are no other objects with the same name in the document
+ Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
+ if ( !anObject.IsNull() )
+ {
+ theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
+ return false;
+ }
+
+ Handle(HYDROData_Calculation) aCalculObj = myIsEdit ? myEditedObject :
+ Handle(HYDROData_Calculation)::DownCast( doc()->CreateObject( KIND_CALCULATION ) );
+ if ( aCalculObj.IsNull() )
+ return false;
+
+ aCalculObj->SetName( anObjectName );
+
+ theUpdateFlags = UF_Model;
+
+ return true;
+}
+
+
--- /dev/null
+// 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
+//
+// 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.
+//
+// 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_CALCULATIONOP_H
+#define HYDROGUI_CALCULATIONOP_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_Calculation.h>
+
+class HYDROGUI_CalculationOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit );
+ virtual ~HYDROGUI_CalculationOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+ virtual void commitOperation();
+
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+
+private:
+ bool myIsEdit;
+ Handle(HYDROData_Calculation) myEditedObject;
+
+};
+
+#endif
+
+
#include "HYDROGUI_Tool.h"
#include <HYDROData_Bathymetry.h>
+#include <HYDROData_Calculation.h>
#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
#include <HYDROData_Iterator.h>
createObject( aBathymetryRootObj, aBathymetryObj );
}
+ LightApp_DataObject* aCalculRootObj = createObject( aRootObj, "CALCULATION CASES" );
+
+ anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION );
+ for( ; anIterator.More(); anIterator.Next() )
+ {
+ Handle(HYDROData_Calculation) aCalculObj =
+ Handle(HYDROData_Calculation)::DownCast( anIterator.Current() );
+ if( !aCalculObj.IsNull() )
+ createObject( aCalculRootObj, aCalculObj );
+ }
+
LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, "POLYLINES" );
anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE );
bool anIsSplittedImage = false;
bool anIsMustBeUpdatedImage = false;
bool anIsPolyline = false;
+ bool anIsCalculation = false;
bool anIsVisualState = false;
HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
}
else if( anObject->GetKind() == KIND_POLYLINE )
anIsPolyline = true;
+ else if( anObject->GetKind() == KIND_CALCULATION )
+ anIsCalculation = true;
else if( anObject->GetKind() == KIND_VISUAL_STATE )
anIsVisualState = true;
}
theMenu->addAction( action( EditPolylineId ) );
theMenu->addSeparator();
}
+ else if( anIsCalculation )
+ {
+ theMenu->addAction( action( EditCalculationId ) );
+ theMenu->addSeparator();
+ }
else if( anIsVisualState )
{
theMenu->addAction( action( SaveVisualStateId ) );
#include "HYDROGUI_ExportImageOp.h"
#include "HYDROGUI_ImportImageOp.h"
#include "HYDROGUI_ImportBathymetryOp.h"
+#include "HYDROGUI_CalculationOp.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_ObserveImageOp.h"
#include "HYDROGUI_PolylineOp.h"
createAction( ImportBathymetryId, "IMPORT_BATHYMETRY", "", Qt::CTRL + Qt::SHIFT + Qt::Key_I );
+ createAction( CreateCalculationId, "CREATE_CALCULATION" );
+ createAction( EditCalculationId, "EDIT_CALCULATION" );
+
createAction( FuseImagesId, "FUSE_IMAGES" );
createAction( EditFusedImageId, "EDIT_FUSED_IMAGE" );
createMenu( ImportImageId, aHydroId, -1, -1 );
createMenu( ImportBathymetryId, aHydroId, -1, -1 );
createMenu( CreatePolylineId, aHydroId, -1, -1 );
+ createMenu( CreateCalculationId, aHydroId, -1, -1 );
createMenu( FuseImagesId, aHydroId, -1, -1 );
createMenu( CutImagesId, aHydroId, -1, -1 );
createMenu( SplitImageId, aHydroId, -1, -1 );
case ImportBathymetryId:
anOp = new HYDROGUI_ImportBathymetryOp( aModule );
break;
+ case CreateCalculationId:
+ case EditCalculationId:
+ anOp = new HYDROGUI_CalculationOp( aModule, theId == EditCalculationId );
+ break;
case FuseImagesId:
case EditFusedImageId:
anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Fuse, theId == EditFusedImageId );
ImportBathymetryId,
EditImportedBathymetryId,
+ CreateCalculationId,
+ EditCalculationId,
+
FuseImagesId,
EditFusedImageId,
<translation>Object with name '%1' already exists in the document.</translation>
</message>
</context>
-
+
+ <context>
+ <name>HYDROGUI_CalculationDlg</name>
+ <message>
+ <source>CALCULATION_NAME</source>
+ <translation>Calculation Case name</translation>
+ </message>
+ <message>
+ <source>NAME</source>
+ <translation>Name</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>HYDROGUI_CalculationOp</name>
+ <message>
+ <source>CREATE_CALCULATION</source>
+ <translation>Create calculation Case</translation>
+ </message>
+ <message>
+ <source>EDIT_CALCULATION</source>
+ <translation>Edit calculation Case</translation>
+ </message>
+ </context>
+
<context>
<name>HYDROGUI_DataModel</name>
<message>
<context>
<name>HYDROGUI_Module</name>
+ <message>
+ <source>DSK_CREATE_CALCULATION</source>
+ <translation>Create calculation Case</translation>
+ </message>
<message>
<source>DSK_CREATE_POLYLINE</source>
<translation>Create polyline</translation>
<source>DSK_DELETE</source>
<translation>Delete</translation>
</message>
+ <message>
+ <source>DSK_EDIT_CALCULATION</source>
+ <translation>Edit calculation Case</translation>
+ </message>
<message>
<source>DSK_EDIT_CUT_IMAGE</source>
<translation>Edit cut image</translation>
<source>DSK_UPDATE_IMAGE</source>
<translation>Update image</translation>
</message>
+ <message>
+ <source>MEN_CREATE_CALCULATION</source>
+ <translation>Create new calculation Case</translation>
+ </message>
<message>
<source>MEN_CREATE_POLYLINE</source>
<translation>Create polyline</translation>
<source>MEN_DESK_HYDRO</source>
<translation>HYDRO</translation>
</message>
+ <message>
+ <source>MEN_EDIT_CALCULATION</source>
+ <translation>Edit calculation Case</translation>
+ </message>
<message>
<source>MEN_EDIT_CUT_IMAGE</source>
<translation>Edit cut image</translation>
<source>MEN_UPDATE_IMAGE</source>
<translation>Update image</translation>
</message>
+ <message>
+ <source>STB_CREATE_CALCULATION</source>
+ <translation>Create new calculation Case</translation>
+ </message>
<message>
<source>STB_CREATE_POLYLINE</source>
<translation>Create polyline</translation>
<source>STB_DELETE</source>
<translation>Delete</translation>
</message>
+ <message>
+ <source>STB_EDIT_CALCULATION</source>
+ <translation>Edit calculation Case</translation>
+ </message>
<message>
<source>STB_EDIT_CUT_IMAGE</source>
<translation>Edit cut image</translation>