#include "HYDROData_Bathymetry.h"
#include "HYDROData_Document.h"
#include "HYDROData_Tool.h"
+#include "HYDROData_PolylineXY.h"
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
}
+bool HYDROData_Bathymetry::CreateBoundaryPolyline() const
+{
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ Handle_HYDROData_PolylineXY aResult =
+ Handle_HYDROData_PolylineXY::DownCast( aDocument->CreateObject( KIND_POLYLINEXY ) );
+
+ if( aResult.IsNull() )
+ return false;
+
+ aResult->SetName( GetName() + "_boundary" );
+ double Xmin = 0.0, Xmax = 0.0, Ymin = 0.0, Ymax = 0.0;
+ bool isFirst = true;
+ AltitudePoints aPoints = GetAltitudePoints();
+ foreach( AltitudePoint aPnt, aPoints )
+ {
+ double x = aPnt.X(), y = aPnt.Y();
+ if( isFirst || x<Xmin )
+ Xmin = x;
+ if( isFirst || x>Xmax )
+ Xmax = x;
+ if( isFirst || y<Ymin )
+ Ymin = y;
+ if( isFirst || y>Ymax )
+ Ymax = y;
+ isFirst = false;
+ }
+
+ aResult->AddSection( "bound", HYDROData_IPolyline::SECTION_POLYLINE, true );
+ aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmin, Ymin ) );
+ aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmin, Ymax ) );
+ aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymax ) );
+ aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymin ) );
+ aResult->Update();
+ return true;
+}
*/
HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFileName );
+ HYDRODATA_EXPORT bool CreateBoundaryPolyline() const;
private:
HYDROGUI_GeoreferencementDlg.h
HYDROGUI_GeoreferencementOp.h
HYDROGUI_Actor.h
+ HYDROGUI_BathymetryBoundsOp.h
)
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_GeoreferencementDlg.cxx
HYDROGUI_GeoreferencementOp.cxx
HYDROGUI_Actor.cxx
+ HYDROGUI_BathymetryBoundsOp.cxx
)
add_definitions(
--- /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_BathymetryBoundsOp.h>
+#include <HYDROGUI_Tool.h>
+#include <HYDROGUI_UpdateFlags.h>
+
+HYDROGUI_BathymetryBoundsOp::HYDROGUI_BathymetryBoundsOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_BathymetryBoundsOp::~HYDROGUI_BathymetryBoundsOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_BathymetryBoundsOp::createInputPanel() const
+{
+ return 0;
+}
+
+void HYDROGUI_BathymetryBoundsOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ myBath = Handle(HYDROData_Bathymetry)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( myBath.IsNull() )
+ onCancel();
+ else
+ onApply();
+}
+
+bool HYDROGUI_BathymetryBoundsOp::processApply( int& theUpdateFlags, QString& theErrorMsg )
+{
+ bool isOK = myBath->CreateBoundaryPolyline();
+ theUpdateFlags = 0;
+ if( isOK )
+ theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+ else
+ theErrorMsg = tr( "CANNOT_CREATE_BOUNDARY_POLYLINE" );
+ return isOK;
+}
--- /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_BATHYMETRY_BOUND_H
+#define HYDROGUI_BATHYMETRY_BOUND_H
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROData_Bathymetry.h>
+
+class HYDROGUI_BathymetryBoundsOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_BathymetryBoundsOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_BathymetryBoundsOp();
+
+protected:
+ virtual void startOperation();
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+
+private:
+ Handle(HYDROData_Bathymetry) myBath;
+};
+
+#endif
else if( anIsBathymetry )
{
theMenu->addAction( action( EditImportedBathymetryId ) );
+ theMenu->addAction( action( BathymetryBoundsId ) );
theMenu->addSeparator();
}
else if( anIsPolyline )
#include "HYDROGUI_ImportProfilesOp.h"
#include "HYDROGUI_GeoreferencementOp.h"
#include "HYDROGUI_SetColorOp.h"
+#include "HYDROGUI_BathymetryBoundsOp.h"
#include "HYDROGUI_Tool.h"
#include <HYDROData_Document.h>
createAction( ImportBathymetryId, "IMPORT_BATHYMETRY", "IMPORT_BATHYMETRY_ICO", Qt::CTRL + Qt::Key_B );
createAction( EditImportedBathymetryId, "EDIT_IMPORTED_BATHYMETRY", "EDIT_IMPORTED_BATHYMETRY_ICO" );
+ createAction( BathymetryBoundsId, "BATHYMETRY_BOUNDS", "BATHYMETRY_BOUNDS_ICO" );
createAction( CreateImmersibleZoneId, "CREATE_IMMERSIBLE_ZONE", "CREATE_IMMERSIBLE_ZONE_ICO" );
createAction( EditImmersibleZoneId, "EDIT_IMMERSIBLE_ZONE", "EDIT_IMMERSIBLE_ZONE_ICO" );
case EditImportedBathymetryId:
anOp = new HYDROGUI_ImportBathymetryOp( aModule, theId == EditImportedBathymetryId );
break;
+ case BathymetryBoundsId:
+ anOp = new HYDROGUI_BathymetryBoundsOp( aModule );
+ break;
case CreateImmersibleZoneId:
case EditImmersibleZoneId:
anOp = new HYDROGUI_ImmersibleZoneOp( aModule, theId == EditImmersibleZoneId );
ImportBathymetryId,
EditImportedBathymetryId,
+ BathymetryBoundsId,
CreateImmersibleZoneId,
EditImmersibleZoneId,
<source>DSK_EDIT_IMPORTED_BATHYMETRY</source>
<translation>Edit imported bathymetry</translation>
</message>
+ <message>
+ <source>DSK_BATHYMETRY_BOUNDS</source>
+ <translation>Create boundary polyline</translation>
+ </message>
<message>
<source>DSK_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>MEN_EDIT_IMPORTED_BATHYMETRY</source>
<translation>Edit imported bathymetry</translation>
</message>
+ <message>
+ <source>MEN_BATHYMETRY_BOUNDS</source>
+ <translation>Create boundary polyline</translation>
+ </message>
<message>
<source>MEN_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>STB_EDIT_IMPORTED_BATHYMETRY</source>
<translation>Edit imported bathymetry</translation>
</message>
+ <message>
+ <source>STB_BATHYMETRY_BOUNDS</source>
+ <translation>Create boundary polyline</translation>
+ </message>
<message>
<source>STB_IMPORT_IMAGE</source>
<translation>Import image</translation>