HYDROGUI_RecognizeContoursDlg.h
HYDROGUI_RecognizeContoursOp.h
HYDROGUI_LandCoverColoringOp.h
+ HYDROGUI_SetTransparencyOp.h
+ HYDROGUI_TransparencyDlg.h
)
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_RecognizeContoursDlg.cxx
HYDROGUI_RecognizeContoursOp.cxx
HYDROGUI_LandCoverColoringOp.cxx
+ HYDROGUI_SetTransparencyOp.cxx
+ HYDROGUI_TransparencyDlg.cxx
)
add_definitions(
if ( anIsObjectCanBeColored )
{
theMenu->addAction( action( SetColorId ) );
+ if ( anIsLandCoverMap )
+ theMenu->addAction( action( SetTransparencyId ) );
theMenu->addSeparator();
}
} else if ( anAllAreProfiles ) {
#include "HYDROGUI_MergePolylinesOp.h"
#include "HYDROGUI_SplitPolylinesOp.h"
#include "HYDROGUI_LandCoverColoringOp.h"
+#include "HYDROGUI_SetTransparencyOp.h"
#include "HYDROGUI_ImportLandCoverMapOp.h"
SLOT( onDelete() ) );
createAction( SetColorId, "COLOR" );
+ createAction( SetTransparencyId, "TRANSPARENCY" );
createAction( SetZLevelId, "ZLEVEL" );
createAction( EditLocalCSId, "EDIT_LOCAL_CS" );
case SetColorId:
anOp = new HYDROGUI_SetColorOp( aModule );
break;
+ case SetTransparencyId:
+ anOp = new HYDROGUI_SetTransparencyOp( aModule );
+ break;
case SetZLevelId:
anOp = new HYDROGUI_ZLevelsOp( aModule );
break;
HideAllId,
SetColorId,
+ SetTransparencyId,
SetZLevelId,
EditLocalCSId,
--- /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_SetTransparencyOp.h"
+
+#include "HYDROGUI_TransparencyDlg.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <LightApp_Application.h>
+#include <LightApp_UpdateFlags.h>
+
+#include <SUIT_Desktop.h>
+
+/**
+ Constructor.
+ @param theModule the module
+*/
+HYDROGUI_SetTransparencyOp::HYDROGUI_SetTransparencyOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule ),
+ myDlg( NULL )
+{
+ setName( tr( "SET_TRANSPARENCY" ) );
+}
+
+/**
+ Destructor.
+*/
+HYDROGUI_SetTransparencyOp::~HYDROGUI_SetTransparencyOp()
+{
+}
+
+void HYDROGUI_SetTransparencyOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ myEditedObject = Handle(HYDROData_LandCoverMap)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if ( !myEditedObject.IsNull() )
+ {
+ myDlg = new HYDROGUI_TransparencyDlg( module()->getApp()->desktop() );
+ myDlg->setModal( true );
+ myDlg->setWindowTitle( getName() );
+ myDlg->setTransparency( myEditedObject->GetTransparency() );
+
+ connect( myDlg, SIGNAL( applyAndClose() ), this, SLOT( onApplyAndClose() ) );
+ connect( myDlg, SIGNAL( apply() ), this, SLOT( onApply() ) );
+ connect( myDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
+
+ myDlg->exec();
+ }
+}
+
+bool HYDROGUI_SetTransparencyOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ if ( !myDlg || myEditedObject.IsNull() )
+ return false;
+
+ myEditedObject->SetTransparency( myDlg->getTransparency() );
+
+ module()->setIsToUpdate( myEditedObject );
+ theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+
+ return true;
+}
+
+void HYDROGUI_SetTransparencyOp::processCancel()
+{
+ // Delete the dialog
+ if ( myDlg ) {
+ delete myDlg;
+ myDlg = 0;
+ }
+}
+
+void HYDROGUI_SetTransparencyOp::onApplyAndClose()
+{
+ HYDROGUI_Operation::onApplyAndClose();
+ if ( myDlg )
+ myDlg->reject();
+}
--- /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_SETTRANSPARENCYOP_H
+#define HYDROGUI_SETTRANSPARENCYOP_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_LandCoverMap.h>
+
+class HYDROGUI_TransparencyDlg;
+
+class HYDROGUI_SetTransparencyOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_SetTransparencyOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_SetTransparencyOp( );
+
+protected:
+ virtual void startOperation();
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries );
+ virtual void processCancel();
+
+protected slots:
+ virtual void onApplyAndClose();
+
+private:
+ HYDROGUI_TransparencyDlg* myDlg;
+
+ Handle(HYDROData_LandCoverMap) myEditedObject;
+};
+
+#endif
#include <HYDROData_ShapesGroup.h>
#include <HYDROData_Stream.h>
#include <HYDROData_Zone.h>
+#include <HYDROData_LandCoverMap.h>
#include <AIS_Shape.hxx>
#include <BRep_Builder.hxx>
if ( !myObject.IsNull() )
myShape->SetOwner( myObject );
- myShape->SetTransparency( 0 );
+ if ( !myObject->IsKind( STANDARD_TYPE(HYDROData_LandCoverMap) ) )
+ myShape->SetTransparency( 0 );
myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
myShape->SetSelectionMode( (Standard_Integer)mySelectionMode );
--- /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_TransparencyDlg.h"
+
+#include <QtxDoubleSpinBox.h>
+
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+
+const double RANGE = 1;
+const double STEP = 0.1;
+const double PREC = 1;
+
+/**
+ Constructor.
+ @param theParent the parent widget
+*/
+HYDROGUI_TransparencyDlg::HYDROGUI_TransparencyDlg( QWidget* theParent )
+ : QDialog( theParent )
+{
+ myTransparency = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, this );
+ myTransparency->setValue( 0.5 );
+
+ // Apply and close buttons
+ myApplyAndClose = new QPushButton( tr("APPLY_AND_CLOSE") );
+ myApplyAndClose->setDefault( true );
+ myApply = new QPushButton( tr("APPLY") );
+ myClose = new QPushButton( tr("CLOSE") );
+
+ // Layout
+ // Spin-box layout
+ QHBoxLayout* aLayout = new QHBoxLayout();
+ aLayout->setMargin( 5 );
+ aLayout->setSpacing( 5 );
+ aLayout->addWidget( new QLabel( tr( "TRANSPARENCY" ), this ) );
+ aLayout->addWidget( myTransparency );
+ // Apply and close buttons layout
+ QHBoxLayout* aDlgButtonsLayout = new QHBoxLayout();
+ aDlgButtonsLayout->addWidget( myApplyAndClose );
+ aDlgButtonsLayout->addWidget( myApply );
+ aDlgButtonsLayout->addWidget( myClose );
+ aDlgButtonsLayout->addStretch();
+ // Main layout
+ QVBoxLayout* aMainLayout = new QVBoxLayout( this );
+ aMainLayout->setMargin( 5 );
+ aMainLayout->setSpacing( 5 );
+ aMainLayout->addLayout( aLayout );
+ aMainLayout->addLayout( aDlgButtonsLayout );
+
+ // Connections
+ connect( myApplyAndClose, SIGNAL( clicked() ), this, SIGNAL( applyAndClose() ) );
+ connect( myApply, SIGNAL( clicked() ), this, SIGNAL( apply() ) );
+ connect( myClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ setFixedSize( 300, 90 );
+}
+
+/**
+ Destructor.
+*/
+HYDROGUI_TransparencyDlg::~HYDROGUI_TransparencyDlg()
+{
+}
+
+void HYDROGUI_TransparencyDlg::setTransparency( const double& theValue )
+{
+ myTransparency->setValue( theValue );
+}
+
+double HYDROGUI_TransparencyDlg::getTransparency() const
+{
+ return myTransparency->value();
+}
--- /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_TRANSPARENCYDLG_H
+#define HYDROGUI_TRANSPARENCYDLG_H
+
+#include <QDialog>
+
+class QPushButton;
+class QtxDoubleSpinBox;
+
+class HYDROGUI_TransparencyDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_TransparencyDlg( QWidget* theParent );
+ virtual ~HYDROGUI_TransparencyDlg();
+
+ void setTransparency( const double& theValue );
+ double getTransparency() const;
+
+signals:
+ void applyAndClose();
+ void apply();
+
+private:
+ QtxDoubleSpinBox* myTransparency;
+ QPushButton* myApplyAndClose; ///< the apply changes and close dialog button
+ QPushButton* myApply; ///< the apply changes button
+ QPushButton* myClose; ///< the close dialog button
+};
+
+#endif
<source>DSK_COLOR</source>
<translation>Set object color</translation>
</message>
+ <message>
+ <source>DSK_TRANSPARENCY</source>
+ <translation>Set object transparency</translation>
+ </message>
<message>
<source>DSK_ZLEVEL</source>
<translation>Change layer order</translation>
<source>MEN_COLOR</source>
<translation>Color</translation>
</message>
+ <message>
+ <source>MEN_TRANSPARENCY</source>
+ <translation>Transparency</translation>
+ </message>
<message>
<source>MEN_ZLEVEL</source>
<translation>Change layer order</translation>
<source>STB_COLOR</source>
<translation>Set object color</translation>
</message>
+ <message>
+ <source>STB_TRANSPARENCY</source>
+ <translation>Set object transparency</translation>
+ </message>
<message>
<source>STB_ZLEVEL</source>
<translation>Change layer order</translation>
</message>
</context>
+ <context>
+ <name>HYDROGUI_SetTransparencyOp</name>
+ <message>
+ <source>SET_TRANSPARENCY</source>
+ <translation>Set transparency</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>HYDROGUI_TransparencyDlg</name>
+ <message>
+ <source>TRANSPARENCY</source>
+ <translation>Transparency</translation>
+ </message>
+ <message>
+ <source>APPLY_AND_CLOSE</source>
+ <translation>Apply and Close</translation>
+ </message>
+ <message>
+ <source>APPLY</source>
+ <translation>Apply</translation>
+ </message>
+ <message>
+ <source>CLOSE</source>
+ <translation>Close</translation>
+ </message>
+ </context>
+
<context>
<name>HYDROGUI_StreamDlg</name>
<message>