* \param theDoc document to iterate
* \param theKind kind of the iterated object, can be UNKNOWN: to iterate all objects
*/
- HYDRODATA_EXPORT HYDROData_Iterator(Handle(HYDROData_Document) theDoc, ObjectKind theKind);
+ HYDRODATA_EXPORT HYDROData_Iterator(Handle(HYDROData_Document) theDoc,
+ ObjectKind theKind = KIND_UNKNOWN);
/**
* Iterates to the next object
#include <TDataStd_Name.hxx>
#include <TDataStd_ByteArray.hxx>
+#include <TDataStd_UAttribute.hxx>
#include <TDF_CopyLabel.hxx>
+static const Standard_GUID GUID_VISIBILITY("d6a715c5-9c86-4adc-8a6c-13188f3ad94b");
+
IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,MMgt_TShared)
TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
}
+bool HYDROData_Object::GetVisibility() const
+{
+ return myLab.IsAttribute(GUID_VISIBILITY);
+}
+
+void HYDROData_Object::SetVisibility(bool theState)
+{
+ if (theState) {
+ TDataStd_UAttribute::Set(myLab, GUID_VISIBILITY);
+ } else {
+ myLab.ForgetAttribute(GUID_VISIBILITY);
+ }
+}
+
bool HYDROData_Object::IsRemoved() const
{
return !myLab.HasAttribute();
*/
HYDRODATA_EXPORT void SetName(const QString& theName);
+ /**
+ * Returns the object visibility state.
+ * \returns visibility state
+ */
+ HYDRODATA_EXPORT bool GetVisibility() const;
+
+ /**
+ * Sets the object visibility state.
+ * \param theState visibility state
+ */
+ HYDRODATA_EXPORT void SetVisibility(bool theState);
+
/**
* Checks is object exists in the data structure.
* \returns true is object is not exists in the data model
setPoints( aPointsArray );
}
-bool HYDROData_Polyline::insertPoint( int theIndex, const QPointF& thePoint)
+void HYDROData_Polyline::insertPoint( int theIndex, const QPointF& thePoint)
{
QList<QPointF> aPointsArray = points();
aPointsArray.insert( theIndex, thePoint );
setPoints( aPointsArray );
}
-bool HYDROData_Polyline::removePoint( int theIndex )
+void HYDROData_Polyline::removePoint( int theIndex )
{
QList<QPointF> aPointsArray = points();
aPointsArray.removeAt( theIndex );
* Add point to the point list at the specified position
* \param theIndex the index of the list the point will insert after
*/
- HYDRODATA_EXPORT bool insertPoint( int theIndex, const QPointF& thePoint);
+ HYDRODATA_EXPORT void insertPoint( int theIndex, const QPointF& thePoint);
/**
* Remove point from polyline
* \param theIndex the point index
*/
- HYDRODATA_EXPORT bool removePoint( int theIndex );
+ HYDRODATA_EXPORT void removePoint( int theIndex );
/**
* Remove all points from polyline
* Find a data object by the specified entry and kind
*/
Handle(HYDROData_Object) objectByEntry( const QString& theEntry,
- const ObjectKind theObjectKind );
+ const ObjectKind theObjectKind = KIND_UNKNOWN );
/**
* Check if it is possible to perform 'undo' operation
--- /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_DeleteOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Object.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_DataOwner.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_SelectionMgr.h>
+
+HYDROGUI_DeleteOp::HYDROGUI_DeleteOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+ setName( tr( "DELETE" ) );
+}
+
+HYDROGUI_DeleteOp::~HYDROGUI_DeleteOp()
+{
+}
+
+void HYDROGUI_DeleteOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_DataModel* aModel = module()->getDataModel();
+
+ SUIT_SelectionMgr* aSelectionMgr = selectionMgr();
+ SUIT_DataOwnerPtrList anOwners;
+ aSelectionMgr->selected( anOwners );
+
+ if( !anOwners.isEmpty() )
+ {
+ int anAnswer = SUIT_MessageBox::question( module()->getApp()->desktop(),
+ tr( "DELETE_OBJECTS" ),
+ tr( "CONFIRM_DELETION" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No );
+ if( anAnswer == QMessageBox::No )
+ {
+ abort();
+ return;
+ }
+ }
+
+ foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ {
+ if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
+ {
+ Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
+ if( !anObject.IsNull() )
+ anObject->Remove();
+ }
+ }
+
+ module()->update( UF_Model | UF_Viewer );
+ commit();
+}
--- /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_DELETEOP_H
+#define HYDROGUI_DELETEOP_H
+
+#include "HYDROGUI_Operation.h"
+
+class HYDROGUI_DeleteOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_DeleteOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_DeleteOp();
+
+protected:
+ virtual void startOperation();
+};
+
+#endif
if( !aViewPort )
return;
- GraphicsView_ObjectListIterator anIter( aViewPort->getObjects() );
+ GraphicsView_ObjectListIterator anIter( HYDROGUI_Tool::GetPrsList( aViewPort ) );
while( anIter.hasNext() )
{
if( GraphicsView_Object* anObject = anIter.next() )
{
aViewPort->removeItem( anObject );
- //delete anObject; // ouv: to do
+ delete anObject;
}
}
}
HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)myModule->dataModel();
if( aModel )
{
- GraphicsView_ObjectList anObjectList = aViewPort->getObjects();
+ GraphicsView_ObjectList anObjectList = HYDROGUI_Tool::GetPrsList( aViewPort );
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
// the object may be null or dead
if( HYDROGUI_Prs* aPrs = HYDROGUI_Tool::GetPresentation( anObj, anObjectList ) )
{
aViewPort->removeItem( aPrs );
- //delete aPrs; // ouv: to do
+ delete aPrs;
}
}
}
if( aPrs )
{
- bool isVisible = true; // anObj->IsVisible()
- aPrs->setVisible( true );
+ bool anIsVisible = anObj->GetVisibility();
+ aPrs->setVisible( anIsVisible );
}
}
if( !aViewPort )
return;
- GraphicsView_ObjectListIterator anIter( aViewPort->getObjects() );
+ GraphicsView_ObjectListIterator anIter( HYDROGUI_Tool::GetPrsList( aViewPort ) );
while( anIter.hasNext() )
{
- GraphicsView_Object* tmp = anIter.next();
- if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( tmp ) )
+ if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
{
Handle(HYDROData_Object) anObject = aPrs->getObject();
- if( anObject.IsNull() )
+ if( !anObject.IsNull() && anObject->IsRemoved() )
{
aViewPort->removeItem( aPrs );
- //delete aPrs; // ouv: to do
+ delete aPrs;
}
}
}
if ( anOwner )
{
QString anEntry = anOwner->entry();
- Handle(HYDROData_Object) aModelObject = aModel->objectByEntry( anEntry, KIND_IMAGE );
+ Handle(HYDROData_Object) aModelObject = aModel->objectByEntry( anEntry );
if( !aModelObject.IsNull() )
{
if( HYDROGUI_Prs* aPrs = HYDROGUI_Tool::GetPresentation( aModelObject, anObjectList ) )
anImageObj->SetImage( anImage );
anImageObj->SetTrsf( aTransform );
+ anImageObj->SetVisibility( true );
theUpdateFlags = UF_Model | UF_Viewer;
return true;
#include <GraphicsView_Viewer.h>
#include <LightApp_Application.h>
+#include <LightApp_DataOwner.h>
#include <LightApp_GVSelector.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
+#include <SALOME_Event.h>
+
#include <SUIT_Study.h>
#include <SUIT_ViewManager.h>
+#include <QAction>
#include <QApplication>
+#include <QMenu>
extern "C" HYDRO_EXPORT CAM_Module* createModule()
{
setMenuShown( true );
setToolShown( true );
+ update( UF_All );
+
updateCommandsStatus();
return aRes;
theTypesList << GraphicsView_Viewer::Type();
}
+void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
+ QMenu* theMenu,
+ QString& theTitle )
+{
+ HYDROGUI_DataModel* aModel = getDataModel();
+
+ LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
+ if( !aSelectionMgr )
+ return;
+
+ SUIT_DataOwnerPtrList anOwners;
+ aSelectionMgr->selected( anOwners );
+
+ bool anIsSelection = false;
+ bool anIsVisibleInSelection = false;
+ bool anIsHiddenInSelection = false;
+
+ foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ {
+ if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
+ {
+ Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
+ if( !anObject.IsNull() )
+ {
+ bool aVisibility = anObject->GetVisibility();
+ anIsVisibleInSelection |= aVisibility;
+ anIsHiddenInSelection |= !aVisibility;
+ anIsSelection = true;
+ }
+ }
+ }
+
+ if( anIsSelection )
+ {
+ theMenu->addAction( action( DeleteId ) );
+ theMenu->addSeparator();
+ }
+
+ if( anIsSelection )
+ {
+ if( anIsHiddenInSelection )
+ theMenu->addAction( action( ShowId ) );
+ theMenu->addAction( action( ShowOnlyId ) );
+ if( anIsVisibleInSelection )
+ theMenu->addAction( action( HideId ) );
+ theMenu->addSeparator();
+ }
+ theMenu->addAction( action( ShowAllId ) );
+ theMenu->addAction( action( HideAllId ) );
+ theMenu->addSeparator();
+}
+
void HYDROGUI_Module::update( const int flags )
{
if( !isUpdateEnabled() )
return new HYDROGUI_DataModel( this );
}
+void HYDROGUI_Module::customEvent( QEvent* e )
+{
+ int aType = e->type();
+ if ( aType == NewViewEvent )
+ {
+ SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
+ if( GraphicsView_ViewFrame* aViewFrame = ( GraphicsView_ViewFrame* )ce->data() )
+ {
+ if( GraphicsView_Viewer* aViewer = dynamic_cast<GraphicsView_Viewer*>( aViewFrame->getViewer() ) )
+ {
+ update( UF_Viewer | UF_GV_Forced );
+ aViewer->activateTransform( GraphicsView_Viewer::FitAll );
+
+ if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
+ {
+ aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect );
+ aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu );
+ aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection );
+ }
+ }
+ }
+ }
+}
+
+bool HYDROGUI_Module::eventFilter( QObject* theObj, QEvent* theEvent )
+{
+ QEvent::Type aType = theEvent->type();
+ if( theObj->inherits( "GraphicsView_ViewFrame" ) )
+ {
+ if( aType == QEvent::Show )
+ {
+ SALOME_CustomEvent* e = new SALOME_CustomEvent( NewViewEvent );
+ e->setData( theObj );
+ QApplication::postEvent( this, e );
+ theObj->removeEventFilter( this );
+ }
+ }
+ return LightApp_Module::eventFilter( theObj, theEvent );
+}
+
void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
{
LightApp_Module::onViewManagerAdded( theViewManager );
createSelector( theViewManager ); // replace the default selector
}
-void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theWnd )
+void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
{
+ if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
+ {
+ if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
+ {
+ aViewFrame->installEventFilter( this );
+ }
+ }
}
void HYDROGUI_Module::updateGV( const bool theIsInit,
#include <LightApp_Module.h>
+#include <QEvent>
+
class GraphicsView_Viewer;
class SUIT_ViewWindow;
{
Q_OBJECT
+ enum CustomEvent { NewViewEvent = QEvent::User + 100 };
+
public:
HYDROGUI_Module();
virtual ~HYDROGUI_Module();
virtual void windows( QMap<int, int>& ) const;
virtual void viewManagers( QStringList& ) const;
+ virtual void contextMenuPopup( const QString&, QMenu*, QString& );
+
virtual void update( const int );
virtual void updateCommandsStatus();
protected:
virtual LightApp_Operation* createOperation( const int ) const;
+ virtual void customEvent( QEvent* );
+ virtual bool eventFilter( QObject*, QEvent* );
+
protected slots:
void onOperation();
if( inputPanel() )
{
- inputPanel()->show();
myModule->getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, inputPanel() );
+ inputPanel()->show();
}
}
inputPanel()->hide();
}
+HYDROGUI_InputPanel* HYDROGUI_Operation::createInputPanel() const
+{
+ return NULL;
+}
+
bool HYDROGUI_Operation::processApply( int& theUpdateFlags )
{
return false;
return HYDROData_Document::Document( aStudyId );
}
-Handle_HYDROData_Object HYDROGUI_Operation::FindObjectByName( const QString& theName, int theKind ) const
+Handle_HYDROData_Object HYDROGUI_Operation::findObjectByName( const QString& theName, int theKind ) const
{
HYDROData_Iterator anIt( doc(), theKind );
for( ; anIt.More(); anIt.Next() )
virtual void abortOperation();
virtual void commitOperation();
- virtual HYDROGUI_InputPanel* createInputPanel() const = 0;
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
virtual bool processApply( int& theUpdateFlags );
virtual void processCancel();
Handle_HYDROData_Document doc() const;
- Handle_HYDROData_Object FindObjectByName( const QString& theName, int theKind ) const;
+ Handle_HYDROData_Object findObjectByName( const QString& theName, int theKind ) const;
protected slots:
virtual void onApply();
#include "HYDROGUI_Operations.h"
#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_DeleteOp.h"
#include "HYDROGUI_ImportImageOp.h"
#include "HYDROGUI_Module.h"
+#include "HYDROGUI_ShowHideOp.h"
#include "HYDROGUI_TwoImagesOp.h"
#include "HYDROGUI_UpdateFlags.h"
createAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
createAction( FuseId, "FUSE_IMAGES" );
createAction( CutId, "CUT_IMAGES" );
+
+ createAction( DeleteId, "DELETE", "", Qt::Key_Delete );
+
+ createAction( ShowId, "SHOW" );
+ createAction( ShowOnlyId, "SHOW_ONLY" );
+ createAction( ShowAllId, "SHOW_ALL" );
+ createAction( HideId, "HIDE" );
+ createAction( HideAllId, "HIDE_ALL" );
}
void HYDROGUI_Module::createMenus()
case CutId:
anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Cut );
break;
+ case DeleteId:
+ anOp = new HYDROGUI_DeleteOp( aModule );
+ break;
+ case ShowId:
+ case ShowOnlyId:
+ case ShowAllId:
+ case HideId:
+ case HideAllId:
+ anOp = new HYDROGUI_ShowHideOp( aModule, theId );
+ break;
}
if( !anOp )
enum OperationId
{
- FirstId,
+ FirstId = 0,
UndoId,
RedoId,
ImportImageId,
FuseId,
CutId,
+
+ DeleteId,
+
+ ShowId,
+ ShowOnlyId,
+ ShowAllId,
+ HideId,
+ HideAllId,
};
#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_ShowHideOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Object.h>
+
+#include <LightApp_DataOwner.h>
+
+#include <SUIT_SelectionMgr.h>
+
+HYDROGUI_ShowHideOp::HYDROGUI_ShowHideOp( HYDROGUI_Module* theModule, int theId )
+: HYDROGUI_Operation( theModule ),
+ myId( theId )
+{
+ QString aName;
+ switch( myId )
+ {
+ case ShowId: aName = tr( "SHOW" ); break;
+ case ShowOnlyId: aName = tr( "SHOW_ONLY" ); break;
+ case ShowAllId: aName = tr( "SHOW_ALL" ); break;
+ case HideId: aName = tr( "HIDE" ); break;
+ case HideAllId: aName = tr( "HIDE_ALL" ); break;
+ default: break;
+ }
+ setName( aName );
+}
+
+HYDROGUI_ShowHideOp::~HYDROGUI_ShowHideOp()
+{
+}
+
+void HYDROGUI_ShowHideOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_DataModel* aModel = module()->getDataModel();
+
+ // for all objects
+ if( myId == ShowOnlyId || myId == ShowAllId || myId == HideAllId )
+ {
+ bool aVisibility = myId == ShowAllId;
+ HYDROData_Iterator anIterator( doc() );
+ for( ; anIterator.More(); anIterator.Next() )
+ {
+ Handle(HYDROData_Object) anObject = anIterator.Current();
+ if( !anObject.IsNull() )
+ anObject->SetVisibility( aVisibility );
+ }
+ }
+
+ // for selected objects
+ if( myId == ShowId || myId == ShowOnlyId || myId == HideId )
+ {
+ SUIT_SelectionMgr* aSelectionMgr = selectionMgr();
+ SUIT_DataOwnerPtrList anOwners;
+ aSelectionMgr->selected( anOwners );
+
+ bool aVisibility = myId == ShowId || myId == ShowOnlyId;
+ foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ {
+ if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
+ {
+ Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
+ if( !anObject.IsNull() )
+ anObject->SetVisibility( aVisibility ? true : false );
+ }
+ }
+ }
+
+ module()->update( UF_Viewer );
+ commit();
+}
--- /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_SHOWHIDEOP_H
+#define HYDROGUI_SHOWHIDEOP_H
+
+#include "HYDROGUI_Operation.h"
+
+class HYDROGUI_ShowHideOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ShowHideOp( HYDROGUI_Module* theModule, int theId );
+ virtual ~HYDROGUI_ShowHideOp();
+
+protected:
+ virtual void startOperation();
+
+private:
+ int myId;
+};
+
+#endif
HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Object)& theObj,
const GraphicsView_ObjectList& theObjects )
{
- GraphicsView_ObjectListIterator anIter( theObjects );
- while( anIter.hasNext() )
- if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
- if( aPrs->getObject()->Label() == theObj->Label() )
- return aPrs;
+ if( !theObj.IsNull() )
+ {
+ GraphicsView_ObjectListIterator anIter( theObjects );
+ while( anIter.hasNext() )
+ {
+ if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
+ {
+ Handle(HYDROData_Object) anObj = aPrs->getObject();
+ if( !anObj.IsNull() && anObj->Label() == theObj->Label() )
+ return aPrs;
+ }
+ }
+ }
return NULL;
}
+
+GraphicsView_ObjectList HYDROGUI_Tool::GetPrsList( GraphicsView_ViewPort* theViewPort )
+{
+ GraphicsView_ObjectList aList;
+ if( theViewPort )
+ {
+ GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
+ while( anIter.hasNext() )
+ if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
+ aList.append( aPrs );
+ }
+ return aList;
+}
#include <HYDROData_Object.h>
#include <GraphicsView_Defs.h>
+#include <GraphicsView_ViewPort.h>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
*/
static HYDROGUI_Prs* GetPresentation( const Handle(HYDROData_Object)& theObj,
const GraphicsView_ObjectList& theObjects );
+
+ /**
+ * \brief Get list of HYDRO presentations from the specified viewport
+ * \param theViewPort viewport
+ * \return list of HYDRO presentations
+ */
+ static GraphicsView_ObjectList GetPrsList( GraphicsView_ViewPort* theViewPort );
};
#endif
return false;
Handle(HYDROData_Image) anImage1 = Handle(HYDROData_Image)::DownCast(
- FindObjectByName( aName1, KIND_IMAGE ) );
+ findObjectByName( aName1, KIND_IMAGE ) );
Handle(HYDROData_Image) anImage2 = Handle(HYDROData_Image)::DownCast(
- FindObjectByName( aName2, KIND_IMAGE ) );
+ findObjectByName( aName2, KIND_IMAGE ) );
if( anImage1.IsNull() || anImage2.IsNull() )
return false;
<translation>Study could not be saved</translation>
</message>
</context>
+ <context>
+ <name>HYDROGUI_DeleteOp</name>
+ <message>
+ <source>DELETE</source>
+ <translation>Delete</translation>
+ </message>
+ <message>
+ <source>DELETE_OBJECTS</source>
+ <translation>Delete objects</translation>
+ </message>
+ <message>
+ <source>CONFIRM_DELETION</source>
+ <translation>Do you really want to delete the selected object(s)?</translation>
+ </message>
+ </context>
<context>
<name>HYDROGUI_InputPanel</name>
<message>
<source>DSK_CUT_IMAGES</source>
<translation>Cut images</translation>
</message>
+ <message>
+ <source>DSK_DELETE</source>
+ <translation>Delete</translation>
+ </message>
<message>
<source>DSK_FUSE_IMAGES</source>
<translation>Fuse images</translation>
</message>
+ <message>
+ <source>DSK_HIDE</source>
+ <translation>Hide</translation>
+ </message>
+ <message>
+ <source>DSK_HIDE_ALL</source>
+ <translation>Hide all</translation>
+ </message>
<message>
<source>DSK_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>DSK_REDO</source>
<translation>Redo</translation>
</message>
+ <message>
+ <source>DSK_SHOW</source>
+ <translation>Show</translation>
+ </message>
+ <message>
+ <source>DSK_SHOW_ALL</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>DSK_SHOW_ONLY</source>
+ <translation>Show only</translation>
+ </message>
<message>
<source>DSK_UNDO</source>
<translation>Undo</translation>
<translation>Cut images</translation>
</message>
<message>
- <source>MEN_FUSE_IMAGES</source>
- <translation>Fuse images</translation>
+ <source>MEN_DELETE</source>
+ <translation>Delete</translation>
</message>
<message>
<source>MEN_DESK_HYDRO</source>
<translation>HYDRO</translation>
</message>
+ <message>
+ <source>MEN_FUSE_IMAGES</source>
+ <translation>Fuse images</translation>
+ </message>
+ <message>
+ <source>MEN_HIDE</source>
+ <translation>Hide</translation>
+ </message>
+ <message>
+ <source>MEN_HIDE_ALL</source>
+ <translation>Hide all</translation>
+ </message>
<message>
<source>MEN_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>MEN_REDO</source>
<translation>Redo</translation>
</message>
+ <message>
+ <source>MEN_SHOW</source>
+ <translation>Show</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_ALL</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_ONLY</source>
+ <translation>Show only</translation>
+ </message>
<message>
<source>MEN_UNDO</source>
<translation>Undo</translation>
<source>STB_CUT_IMAGES</source>
<translation>Cut images</translation>
</message>
+ <message>
+ <source>STB_DELETE</source>
+ <translation>Delete</translation>
+ </message>
<message>
<source>STB_FUSE_IMAGES</source>
<translation>Fuse images</translation>
</message>
+ <message>
+ <source>STB_HIDE</source>
+ <translation>Hide</translation>
+ </message>
+ <message>
+ <source>STB_HIDE_ALL</source>
+ <translation>Hide all</translation>
+ </message>
<message>
<source>STB_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>STB_REDO</source>
<translation>Redo</translation>
</message>
+ <message>
+ <source>STB_SHOW</source>
+ <translation>Show</translation>
+ </message>
+ <message>
+ <source>STB_SHOW_ALL</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>STB_SHOW_ONLY</source>
+ <translation>Show only</translation>
+ </message>
<message>
<source>STB_UNDO</source>
<translation>Undo</translation>
</message>
</context>
+ <context>
+ <name>HYDROGUI_ShowHideOp</name>
+ <message>
+ <source>SHOW</source>
+ <translation>Show</translation>
+ </message>
+ <message>
+ <source>SHOW_ALL</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>SHOW_ONLY</source>
+ <translation>Show only</translation>
+ </message>
+ <message>
+ <source>HIDE</source>
+ <translation>Hide</translation>
+ </message>
+ <message>
+ <source>HIDE_ALL</source>
+ <translation>Hide all</translation>
+ </message>
+ </context>
<context>
<name>HYDROGUI_TwoImagesDlg</name>
<message>