HYDROGUI_GeoreferencementOp.h
HYDROGUI_Actor.h
HYDROGUI_BathymetryBoundsOp.h
+ HYDROGUI_BathymetrySelectionOp.h
HYDROGUI_TranslateObstacleDlg.h
HYDROGUI_TranslateObstacleOp.h
HYDROGUI_ListModel.h
HYDROGUI_GeoreferencementOp.cxx
HYDROGUI_Actor.cxx
HYDROGUI_BathymetryBoundsOp.cxx
+ HYDROGUI_BathymetrySelectionOp.cxx
HYDROGUI_TranslateObstacleDlg.cxx
HYDROGUI_TranslateObstacleOp.cxx
HYDROGUI_ListModel.cxx
--- /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
+//See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_BathymetrySelectionOp.h>
+#include <HYDROGUI_Module.h>
+#include <HYDROGUI_BathymetryPrs.h>
+#include <OCCViewer_ViewManager.h>
+#include <LightApp_Application.h>
+
+HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule ), myIsActive( false )
+{
+}
+
+HYDROGUI_BathymetrySelectionOp::~HYDROGUI_BathymetrySelectionOp()
+{
+}
+
+void HYDROGUI_BathymetrySelectionOp::startOperation()
+{
+ activateSelection( true );
+}
+
+void HYDROGUI_BathymetrySelectionOp::abortOperation()
+{
+ activateSelection( false );
+}
+
+void HYDROGUI_BathymetrySelectionOp::commitOperation()
+{
+ activateSelection( false );
+}
+
+void HYDROGUI_BathymetrySelectionOp::stopOperation()
+{
+ activateSelection( false );
+}
+
+void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
+{
+ if( myIsActive==isActive )
+ return;
+
+ LightApp_Application* app = module()->getApp();
+ OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>
+ ( app->getViewManager( OCCViewer_Viewer::Type(), true ) );
+ Handle(AIS_InteractiveContext) ctx = mgr->getOCCViewer()->getAISContext();
+
+
+ QList<Handle(HYDROGUI_BathymetryPrs)> baths;
+
+ AIS_ListOfInteractive objs;
+ ctx->DisplayedObjects( objs );
+ AIS_ListIteratorOfListOfInteractive it( objs );
+ for( ; it.More(); it.Next() )
+ {
+ Handle(HYDROGUI_BathymetryPrs) bath = Handle(HYDROGUI_BathymetryPrs)::DownCast( it.Value() );
+ if( !bath.IsNull() )
+ baths.append( bath );
+ }
+
+ if( isActive )
+ {
+ const int aSelectionMode = 1;
+ ctx->OpenLocalContext( Standard_True );
+ foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
+ ctx->Activate( bath, aSelectionMode, Standard_True );
+ ctx->UpdateCurrentViewer();
+ }
+ else
+ {
+ foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
+ ctx->Deactivate( bath );
+ ctx->CloseLocalContext( -1, Standard_True );
+ }
+
+ myIsActive = isActive;
+}
--- /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_BATHYMETRY_SELECTION_H
+#define HYDROGUI_BATHYMETRY_SELECTION_H
+
+#include <HYDROGUI_Operation.h>
+
+class HYDROGUI_BathymetrySelectionOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_BathymetrySelectionOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+ virtual void commitOperation();
+ virtual void stopOperation();
+
+ void activateSelection( bool );
+
+private:
+ bool myIsActive;
+};
+
+#endif
protected slots:
void onOperation();
void onDelete();
+ void onBathymetrySelection();
bool onUndo( int theNumActions );
#include "HYDROGUI_SplitPolylinesOp.h"
#include "HYDROGUI_LandCoverColoringOp.h"
#include "HYDROGUI_SetTransparencyOp.h"
-
#include "HYDROGUI_ImportLandCoverMapOp.h"
+#include "HYDROGUI_BathymetrySelectionOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.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( BathymetrySelectionId, "BATHYMETRY_SELECTION", "BATHYMETRY_SELECTION_ICO",
+ 0, true, SLOT( onBathymetrySelection() ) );
createAction( CreateImmersibleZoneId, "CREATE_IMMERSIBLE_ZONE", "CREATE_IMMERSIBLE_ZONE_ICO" );
createAction( EditImmersibleZoneId, "EDIT_IMMERSIBLE_ZONE", "EDIT_IMMERSIBLE_ZONE_ICO" );
createTool( FuseImagesId, aToolBar );
createTool( CutImagesId, aToolBar );
createTool( SplitImageId, aToolBar );
+
+ createTool( separator(), aToolBar );
+ createTool( BathymetrySelectionId, aToolBar );
}
void HYDROGUI_Module::createUndoRedoActions()
case BathymetryBoundsId:
anOp = new HYDROGUI_BathymetryBoundsOp( aModule );
break;
+ case BathymetrySelectionId:
+ anOp = new HYDROGUI_BathymetrySelectionOp( aModule );
+ break;
case CreateImmersibleZoneId:
case EditImmersibleZoneId:
anOp = new HYDROGUI_ImmersibleZoneOp( aModule, theId == EditImmersibleZoneId );
}
return aRes;
}
+
+void HYDROGUI_Module::onBathymetrySelection()
+{
+ QAction* a = qobject_cast<QAction*>( sender() );
+ if( !a )
+ return;
+
+ bool isChecked = a->isChecked();
+ if( isChecked )
+ startOperation( BathymetrySelectionId );
+ else
+ operation( BathymetrySelectionId )->abort();
+}
LandCoverScalarMapModeOnId,
LandCoverScalarMapModeOffId,
+
+ BathymetrySelectionId,
};
#endif