HYDROGUI_SetTransparencyOp.h
HYDROGUI_TransparencyDlg.h
HYDROGUI_Overview.h
+ HYDROGUI_PolylineStyleOp.h
+ HYDROGUI_PolylineStyleDlg.h
)
QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_SetTransparencyOp.cxx
HYDROGUI_TransparencyDlg.cxx
HYDROGUI_Overview.cxx
+ HYDROGUI_PolylineStyleOp.cxx
+ HYDROGUI_PolylineStyleDlg.cxx
)
add_definitions(
theMenu->addSeparator();
}
- bool anIsPoly = anIsPolyline || anIsPolyline3D;
- if (anIsPoly && !anIsLandCoverMap)
+ bool isPoly = anIsPolyline || anIsPolyline3D;
+ if (isPoly && !anIsLandCoverMap)
theMenu->addAction( action( ExportToShapeFileID ) );
+ if( isPoly )
+ theMenu->addAction( action( PolylineStyleId ) );
// Add copy action
QAction* aCopyAction = action( CopyId );
#include "HYDROGUI_ImportLandCoverMapOp.h"
#include "HYDROGUI_BathymetrySelectionOp.h"
#include "HYDROGUI_BathymetryOp.h"
+#include "HYDROGUI_PolylineStyleOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" );
createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
+
+ createAction( PolylineStyleId, "POLYLINE_STYLE" );
}
void HYDROGUI_Module::createMenus()
case LandCoverScalarMapModeOffId:
anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId );
break;
+ case PolylineStyleId:
+ anOp = new HYDROGUI_PolylineStyleOp( aModule );
+ break;
}
if( !anOp )
BathymetryRescaleVisibleId,
BathymetryRescaleUserId,
BathymetryRescaleDefaultId,
+
+ PolylineStyleId,
};
#endif
--- /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
+//
+
+#include "HYDROGUI_PolylineStyleDlg.h"
+#include <QFrame>
+#include <QLayout>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QLabel>
+#include <QGroupBox>
+
+HYDROGUI_PolylineStyleDlg::HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule )
+ : HYDROGUI_InputPanel( theModule, tr( "POLYLINE_STYLE" ) )
+{
+ QGroupBox* group = new QGroupBox( tr( "POLYLINE_STYLE" ), mainFrame() );
+
+ QGridLayout* lay = new QGridLayout( group );
+
+ myShape = new QComboBox( mainFrame() );
+ myShape->addItem( "???" );
+ myShape->addItem( tr( "No" ) );
+ myShape->addItem( tr( "Triangle" ) );
+ myShape->addItem( tr( "Cone" ) );
+
+ mySize = new QSpinBox( mainFrame() );
+ mySize->setRange( -1, 50 );
+ mySize->setSpecialValueText( " " );
+
+ lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW" ) ), 0, 0 );
+ lay->addWidget( myShape, 0, 1 );
+ lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW_SIZE" ) ), 1, 0 );
+ lay->addWidget( mySize, 1, 1 );
+ lay->setRowStretch( 2, 1 );
+
+ addWidget( group );
+}
+
+HYDROGUI_PolylineStyleDlg::~HYDROGUI_PolylineStyleDlg()
+{
+}
+
+void HYDROGUI_PolylineStyleDlg::getStyle( int& theShape, int& theSize ) const
+{
+ theShape = myShape->currentIndex();
+ theSize = mySize->value();
+}
+
+void HYDROGUI_PolylineStyleDlg::setStyle( int theShape, int theSize )
+{
+ myShape->setCurrentIndex( theShape );
+ mySize->setValue( theSize );
+}
+
--- /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_PolylineStyleDlg_H
+#define HYDROGUI_PolylineStyleDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QComboBox;
+class QSpinBox;
+
+class HYDROGUI_PolylineStyleDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_PolylineStyleDlg();
+
+ void getStyle( int&, int& ) const;
+ void setStyle( int, int );
+
+private:
+ QComboBox* myShape;
+ QSpinBox* mySize;
+};
+
+#endif
--- /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
+//
+
+#include <HYDROGUI_PolylineStyleOp.h>
+#include <HYDROGUI_PolylineStyleDlg.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <AIS_InteractiveContext.hxx>
+
+HYDROGUI_PolylineStyleOp::HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule )
+ : HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_PolylineStyleOp::~HYDROGUI_PolylineStyleOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_PolylineStyleOp::createInputPanel() const
+{
+ return new HYDROGUI_PolylineStyleDlg( module() );
+}
+
+Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule );
+
+QList<Handle(HYDROGUI_Arrow)> getSelectedArrows( HYDROGUI_Module* theModule )
+{
+ QList<Handle(HYDROGUI_Arrow)> arrows;
+ Handle(AIS_InteractiveContext) ctx = getContext( theModule );
+
+ AIS_ListOfInteractive objs;
+ ctx->DisplayedObjects( objs );
+ AIS_ListIteratorOfListOfInteractive it( objs );
+ for( ; it.More(); it.Next() )
+ {
+ Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( it.Value() );
+ Handle(AIS_InteractiveObject) obj = arrow;
+ if( !obj.IsNull() && ctx->IsSelected( obj ) )
+ arrows.append( arrow );
+ }
+ return arrows;
+}
+
+void HYDROGUI_PolylineStyleOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ myArrows = getSelectedArrows( module() );
+
+ int aCommonType=-1, aCommonSize=-1;
+ bool isInit = false;
+ foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+ {
+ if( !isInit )
+ {
+ aCommonType = arrow->GetType();
+ aCommonSize = arrow->GetSize();
+ }
+ else
+ {
+ if( aCommonType != -1 && aCommonType != arrow->GetType() )
+ aCommonType = -1;
+ if( aCommonSize != -1 && aCommonSize != arrow->GetSize() )
+ aCommonSize = -1;
+ }
+
+ isInit = true;
+ }
+
+ HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+ dlg->setStyle( aCommonType+1, aCommonSize );
+}
+
+bool HYDROGUI_PolylineStyleOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ Handle(AIS_InteractiveContext) ctx = getContext( module() );
+
+ int aType, aSize;
+ HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+ dlg->getStyle( aType, aSize );
+ aType--;
+
+ foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+ {
+ if( aType>=0 )
+ arrow->SetType( (HYDROGUI_Arrow::Type)aType );
+ if( aSize>=0 )
+ arrow->SetSize( aSize );
+ ctx->Redisplay( arrow, Standard_False );
+ }
+ theUpdateFlags = UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+ return true;
+}
--- /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_POLYLINE_STYLE_OP_H
+#define HYDROGUI_POLYLINE_STYLE_OP_H
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROGUI_Polyline.h>
+
+class HYDROGUI_PolylineStyleOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_PolylineStyleOp();
+
+protected:
+ virtual void startOperation();
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
+
+private:
+ QList<Handle(HYDROGUI_Arrow)> myArrows;
+};
+
+#endif
int aType = -1;
int aSize = -1;
- if( aResMgr )
+
+ if( myShapes.length()>1 )
+ {
+ Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( myShapes[1] );
+ if( !arrow.IsNull() )
+ {
+ aType = arrow->GetType();
+ aSize = arrow->GetSize();
+ }
+ }
+ if( aResMgr && ( aType<0 || aSize < 0 ) )
{
aResMgr->value( "polyline", "arrow_type", aType );
aResMgr->value( "polyline", "arrow_size", aSize );
<source>DSK_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
+ <message>
+ <source>DSK_POLYLINE_STYLE</source>
+ <translation>Polyline style</translation>
+ </message>
<message>
<source>DSK_IMPORT_IMAGE</source>
<translation>Import image</translation>
<source>MEN_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
+ <message>
+ <source>MEN_POLYLINE_STYLE</source>
+ <translation>Polyline style</translation>
+ </message>
<message>
<source>MEN_IMPORT_IMAGE</source>
<translation>Import image</translation>
<translation>Selection on bathymetry</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_SELECTION
- </source>
+ <source>STB_BATHYMETRY_RESCALE_SELECTION</source>
<translation>Rescale bathymetry by selection</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_VISIBLE
- </source>
+ <source>STB_POLYLINE_STYLE</source>
+ <translation>Change polyline style</translation>
+ </message>
+ <message>
+ <source>STB_BATHYMETRY_RESCALE_VISIBLE</source>
<translation>Rescale bathymetry by visible range</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_USER
- </source>
+ <source>STB_BATHYMETRY_RESCALE_USER</source>
<translation>Custom rescale bathymetry</translation>
</message>
<message>
- <source>
- STB_BATHYMETRY_RESCALE_DEFAULT
- </source>
+ <source>STB_BATHYMETRY_RESCALE_DEFAULT</source>
<translation>Default rescale bathymetry</translation>
</message>
<message>
</message>
</context>
+ <context>
+ <name>HYDROGUI_PolylineStyleDlg</name>
+ <message>
+ <source>POLYLINE_STYLE</source>
+ <translation>Polyline style</translation>
+ </message>
+ <message>
+ <source>PREF_POLYLINE_ARROW</source>
+ <translation>Polyline arrow</translation>
+ </message>
+ <message>
+ <source>PREF_POLYLINE_ARROW_SIZE</source>
+ <translation>Polyline arrow size</translation>
+ </message>
+ </context>
+
</TS>