/**
* Returns the kind of this object. Must be redefined in all objects of known type.
*/
- HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_STREAM;}
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
/**
* Dump object to Python script representation.
HYDROGUI_OCCSelector.h
HYDROGUI_Operation.h
HYDROGUI_Operations.h
+ HYDROGUI_Poly3DDlg.h
+ HYDROGUI_Poly3DOp.h
HYDROGUI_PolylineDlg.h
HYDROGUI_PolylineOp.h
HYDROGUI_ProfileDlg.h
HYDROGUI_OCCSelector.cxx
HYDROGUI_Operation.cxx
HYDROGUI_Operations.cxx
+ HYDROGUI_Poly3DDlg.cxx
+ HYDROGUI_Poly3DOp.cxx
HYDROGUI_PolylineDlg.cxx
HYDROGUI_PolylineOp.cxx
HYDROGUI_ProfileDlg.cxx
bool anIsSplittedImage = false;
bool anIsMustBeUpdatedImage = false;
bool anIsPolyline = false;
+ bool anIsPolyline3D = false;
bool anIsProfile = false;
bool anIsValidProfile = false;
bool anAllAreProfiles = false;
}
else if( anObject->GetKind() == KIND_POLYLINEXY )
anIsPolyline = true;
+ else if( anObject->GetKind() == KIND_POLYLINE )
+ anIsPolyline3D = true;
else if( anObject->GetKind() == KIND_PROFILE ) {
anIsProfile = true;
aNbOfSelectedProfiles++;
case KIND_POLYLINEXY:
theMenu->addAction( action( CreatePolylineId ) );
break;
+ case KIND_POLYLINE:
+ theMenu->addAction( action( CreatePolyline3DId ) );
+ break;
case KIND_PROFILE:
theMenu->addAction( action( CreateProfileId ) );
theMenu->addAction( action( ImportProfilesId ) );
theMenu->addAction( action( EditPolylineId ) );
theMenu->addSeparator();
}
+ else if( anIsPolyline3D )
+ {
+ theMenu->addAction( action( EditPolyline3DId ) );
+ theMenu->addSeparator();
+ }
else if( anIsProfile )
{
theMenu->addAction( action( EditProfileId ) );
theMenu->addAction( action( DeleteId ) );
theMenu->addSeparator();
- if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone ||
+ if( anIsImage || anIsPolyline || anIsPolyline3D || anIsImmersibleZone || anIsZone ||
anIsRegion || anIsBathymetry || anIsObstacle || anIsValidProfile )
{
if( anIsHiddenInSelection )
#include "HYDROGUI_Module.h"
#include "HYDROGUI_ObserveImageOp.h"
#include "HYDROGUI_PolylineOp.h"
+#include "HYDROGUI_Poly3DOp.h"
#include "HYDROGUI_ProfileOp.h"
#include "HYDROGUI_RemoveImageRefsOp.h"
#include "HYDROGUI_ShowHideOp.h"
createAction( CreatePolylineId, "CREATE_POLYLINE" );
createAction( EditPolylineId, "EDIT_POLYLINE" );
+ createAction( CreatePolyline3DId, "CREATE_POLYLINE_3D" );
+ createAction( EditPolyline3DId, "EDIT_POLYLINE_3D" );
+
createAction( CreateProfileId, "CREATE_PROFILE" );
createAction( ImportProfilesId, "IMPORT_PROFILES" );
createAction( EditProfileId, "EDIT_PROFILE" );
createMenu( ImportImageId, aHydroId, -1, -1 );
createMenu( ImportBathymetryId, aHydroId, -1, -1 );
createMenu( CreatePolylineId, aHydroId, -1, -1 );
+ createMenu( CreatePolyline3DId, aHydroId, -1, -1 );
int aNewProfileId = createMenu( tr( "MEN_PROFILE" ), aHydroId, -1 );
createMenu( CreateProfileId, aNewProfileId, -1, -1 );
case RemoveImageRefsId:
anOp = new HYDROGUI_RemoveImageRefsOp( aModule );
break;
+ case CreatePolyline3DId:
+ case EditPolyline3DId:
+ anOp = new HYDROGUI_Poly3DOp( aModule, theId == EditPolyline3DId );
+ break;
case CreatePolylineId:
case EditPolylineId:
anOp = new HYDROGUI_PolylineOp( aModule, theId == EditPolylineId );
CreatePolylineId,
EditPolylineId,
+ CreatePolyline3DId,
+ EditPolyline3DId,
+
ImportProfilesId,
CreateProfileId,
EditProfileId,
--- /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_Poly3DDlg.h"
+
+#include "HYDROGUI_ObjSelector.h"
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+
+HYDROGUI_Poly3DDlg::HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle ),
+ myIsEdit( false )
+{
+ // Profile name
+ QGroupBox* aNameGroup = new QGroupBox( tr( "POLYLINE_3D_NAME" ) );
+
+ QLabel* aNameLabel = new QLabel( tr( "NAME" ), aNameGroup );
+ myName = new QLineEdit( aNameGroup );
+
+ QGridLayout* aNameLayout = new QGridLayout( aNameGroup );
+ aNameLayout->setMargin( 5 );
+ aNameLayout->setSpacing( 5 );
+ aNameLayout->addWidget( aNameLabel, 0, 0 );
+ aNameLayout->addWidget( myName, 0, 1 );
+
+ // Parameters
+ QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
+
+ myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
+ myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
+
+ myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
+ myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
+
+ QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
+ aParamLayout->setMargin( 5 );
+ aParamLayout->setSpacing( 5 );
+ aParamLayout->addWidget( myProfileLabel, 0, 0 );
+ aParamLayout->addWidget( myProfile, 0, 1 );
+ aParamLayout->addWidget( myPolylineLabel, 1, 0 );
+ aParamLayout->addWidget( myPolyline, 1, 1 );
+
+ // Common
+ addWidget( aNameGroup );
+ addWidget( aParamGroup );
+ addStretch();
+
+ setMode( myIsEdit );
+}
+
+HYDROGUI_Poly3DDlg::~HYDROGUI_Poly3DDlg()
+{
+}
+
+void HYDROGUI_Poly3DDlg::reset()
+{
+ myName->clear();
+ myProfile->Clear();
+ myPolyline->Clear();
+}
+
+void HYDROGUI_Poly3DDlg::setMode( const bool theIsEdit )
+{
+ myIsEdit = theIsEdit;
+}
+
+void HYDROGUI_Poly3DDlg::setResultName( const QString& theName )
+{
+ myName->setText( theName );
+}
+
+QString HYDROGUI_Poly3DDlg::getResultName() const
+{
+ return myName->text();
+}
+
+void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theName1,
+ const QString& theName2 )
+{
+ myProfile->SetName( theName1 );
+ myPolyline->SetName( theName2 );
+}
+
+bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theName1,
+ QString& theName2 ) const
+{
+ theName1 = myProfile->GetName();
+ theName2 = myPolyline->GetName();
+ return !theName1.isEmpty() && !theName2.isEmpty();
+}
+
+void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
+{
+ myProfile->SetName( theName );
+ myPolyline->SetChecked( true );
+ myPolyline->SetName( QString() );
+}
--- /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_POLY3DDLG_H
+#define HYDROGUI_POLY3DDLG_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+
+class HYDROGUI_ObjSelector;
+
+class HYDROGUI_Poly3DDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+ virtual ~HYDROGUI_Poly3DDlg();
+
+ void reset();
+
+ void setMode( const bool theIsEdit );
+
+ void setResultName( const QString& theName );
+ QString getResultName() const;
+
+ void setSelectedObjects( const QString& theName1,
+ const QString& theName2 );
+ bool getSelectedObjects( QString& theName1,
+ QString& theName2 ) const;
+
+ void setPreselectedObject( const QString& theName );
+
+private:
+ bool myIsEdit;
+
+ QLineEdit* myName;
+
+ QLabel* myProfileLabel;
+ HYDROGUI_ObjSelector* myProfile;
+
+ QLabel* myPolylineLabel;
+ HYDROGUI_ObjSelector* myPolyline;
+};
+
+#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_Poly3DOp.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Poly3DDlg.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Polyline3D.h>
+#include <HYDROData_Profile.h>
+#include <HYDROData_PolylineXY.h>
+
+#include <HYDROData_OperationsFactory.h>
+
+HYDROGUI_Poly3DOp::HYDROGUI_Poly3DOp( HYDROGUI_Module* theModule,
+ const bool theIsEdit )
+: HYDROGUI_Operation( theModule ),
+ myIsEdit( theIsEdit ),
+ myEditedObject( 0 )
+{
+ setName( theIsEdit ? tr( "EDIT_POLYLINE_3D" ) : tr( "CREATE_POLYLINE_3D" ) );
+}
+
+HYDROGUI_Poly3DOp::~HYDROGUI_Poly3DOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_Poly3DOp::createInputPanel() const
+{
+ return new HYDROGUI_Poly3DDlg( module(), getName() );
+}
+
+void HYDROGUI_Poly3DOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_Poly3DDlg* aPanel = (HYDROGUI_Poly3DDlg*)inputPanel();
+ aPanel->reset();
+ aPanel->setMode( myIsEdit );
+
+ QString aPoly3DName;
+ if( myIsEdit )
+ {
+ myEditedObject = Handle(HYDROData_Polyline3D)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( !myEditedObject.IsNull() )
+ aPoly3DName = myEditedObject->GetName();
+ }
+ else
+ {
+ aPoly3DName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "POLYLINE_3D" ) );
+ }
+ aPanel->setResultName( aPoly3DName );
+
+ QString aSelectedName1, aSelectedName2;
+ if( myIsEdit && !myEditedObject.IsNull() )
+ {
+ Handle(HYDROData_Entity) anObject1 = myEditedObject->GetProfileUZ()->GetFatherObject();
+ if( !anObject1.IsNull() )
+ aSelectedName1 = anObject1->GetName();
+ Handle(HYDROData_Entity) anObject2 = myEditedObject->GetPolylineXY();
+ if( !anObject2.IsNull() )
+ aSelectedName2 = anObject2->GetName();
+ aPanel->setSelectedObjects( aSelectedName1, aSelectedName2 );
+ }
+ else if( !myIsEdit )
+ {
+ Handle(HYDROData_Profile) aSelectedProfile =
+ Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( !aSelectedProfile.IsNull() )
+ {
+ QString aSelectedName = aSelectedProfile->GetName();
+ aPanel->setPreselectedObject( aSelectedName );
+ }
+ }
+}
+
+bool HYDROGUI_Poly3DOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg )
+{
+ HYDROGUI_Poly3DDlg* aPanel = dynamic_cast<HYDROGUI_Poly3DDlg*>( inputPanel() );
+
+ QString aResultName = aPanel->getResultName();
+ if( aResultName.isEmpty() )
+ return false;
+
+ QString aSelectedName1, aSelectedName2;
+ if( !aPanel->getSelectedObjects( aSelectedName1, aSelectedName2 ) )
+ return false;
+
+ if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != aResultName ) )
+ {
+ // check that there are no other objects with the same name in the document
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), aResultName );
+ if( !anObject.IsNull() )
+ {
+ theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( aResultName );
+ return false;
+ }
+ }
+
+ Handle(HYDROData_Entity) anObject1 =
+ HYDROGUI_Tool::FindObjectByName( module(), aSelectedName1, KIND_PROFILE ) ;
+ Handle(HYDROData_Entity) anObject2 =
+ HYDROGUI_Tool::FindObjectByName( module(), aSelectedName2, KIND_POLYLINEXY );
+ if( anObject1.IsNull() || anObject2.IsNull() )
+ return false;
+
+ Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( anObject1 );
+ Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( anObject2 );
+
+ if( aProfile.IsNull() || aPolyline.IsNull() )
+ return false;
+
+ Handle(HYDROData_ProfileUZ) aProfileUZ = aProfile->GetProfileUZ();
+ if( aProfileUZ.IsNull() )
+ return false;
+
+ Handle(HYDROData_Polyline3D) aResult;
+ if( myIsEdit )
+ {
+ aResult = myEditedObject;
+ aResult->RemoveProfileUZ();
+ aResult->RemovePolylineXY();
+ }
+ else
+ {
+ aResult = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) );
+ }
+
+ if( aResult.IsNull() )
+ return false;
+
+ aResult->SetName( aResultName );
+ aResult->SetProfileUZ( aProfileUZ );
+ aResult->SetPolylineXY( aPolyline );
+
+ aResult->Update();
+
+ if( !myIsEdit )
+ {
+ size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+ module()->setObjectVisible( aViewId, anObject1, false );
+ module()->setObjectVisible( aViewId, anObject2, false );
+ module()->setObjectVisible( aViewId, aResult, true );
+ }
+
+ theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
+ 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_POLY3DOP_H
+#define HYDROGUI_POLY3DOP_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_Polyline3D.h>
+
+class HYDROGUI_Poly3DOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_Poly3DOp( HYDROGUI_Module* theModule, const bool theIsEdit );
+ virtual ~HYDROGUI_Poly3DOp();
+
+protected:
+ virtual void startOperation();
+
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+
+private:
+ bool myIsEdit;
+ Handle(HYDROData_Polyline3D) myEditedObject;
+};
+
+#endif