HYDROGUI_PolylineStyleOp.h
HYDROGUI_PolylineStyleDlg.h
HYDROGUI_ZoneTool.h
- HYDROGUI_RegenerateRegionColorsOp.h
+ HYDROGUI_RegenerateRegionColorsOp.h
+ HYDROGUI_ZoneSetColorOp.h
)
QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_PolylineStyleOp.cxx
HYDROGUI_PolylineStyleDlg.cxx
HYDROGUI_ZoneTool.cxx
- HYDROGUI_RegenerateRegionColorsOp.cxx
+ HYDROGUI_RegenerateRegionColorsOp.cxx
+ HYDROGUI_ZoneSetColorOp.cxx
)
add_definitions(
theMenu->addAction( action( LoadVisualStateId ) );
theMenu->addSeparator();
}
+ else if (anIsZone)
+ theMenu->addAction( action( ZoneSetColorId ) );
if ( anIsStream || anIsChannel || anIsDigue || anIsObstacle )
{
#include "HYDROGUI_BathymetryOp.h"
#include "HYDROGUI_RegenerateRegionColorsOp.h"
#include "HYDROGUI_PolylineStyleOp.h"
-
+#include "HYDROGUI_ZoneSetColorOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
#include <HYDROData_SplitToZonesTool.h>
createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" );
+ createAction( ZoneSetColorId, "ZONE_SET_COLOR" );
createAction( ShowHideArrows, "SHOW_HIDE_ARROWS" );
}
anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId );
break;
case RegenerateRegionColorsId:
- anOp = new HYDROGUI_RegenerateRegionColorsOp( aModule );
+ anOp = new HYDROGUI_RegenerateRegionColorsOp( aModule );
+ case ZoneSetColorId:
+ anOp = new HYDROGUI_ZoneSetColorOp( aModule );
}
if( !anOp )
BathymetryRescaleDefaultId,
RegenerateRegionColorsId,
ShowHideArrows,
+ ZoneSetColorId
};
#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_ZoneSetColorOp.h"
+
+#include "HYDROGUI_Module.h"
+#include <QColorDialog>
+#include <LightApp_Application.h>
+#include <SUIT_Desktop.h>
+#include <LightApp_UpdateFlags.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROGUI_Tool2.h>
+#include <QApplication>
+
+HYDROGUI_ZoneSetColorOp::HYDROGUI_ZoneSetColorOp( HYDROGUI_Module* theModule )
+ : HYDROGUI_Operation( theModule )
+{
+ setName( tr( "ZONE_SET_COLOR" ) );
+}
+
+HYDROGUI_ZoneSetColorOp::~HYDROGUI_ZoneSetColorOp()
+{
+}
+
+void HYDROGUI_ZoneSetColorOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+ myZone = Handle(HYDROData_Zone)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( !myZone.IsNull() )
+ onApply();
+ else
+ onCancel();
+}
+
+bool HYDROGUI_ZoneSetColorOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ theUpdateFlags = 0;
+ if(myZone)
+ {
+ QColor aZoneColor = myZone->GetColor(QColor(1,1,1));
+ QApplication::restoreOverrideCursor();
+ QColor aNewColor = QColorDialog::getColor( aZoneColor );
+ myZone->SetColor(aNewColor);
+ theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+ return true;
+ }
+ return false;
+}
+
+
--- /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_ZONESETCOLOROP_H
+#define HYDROGUI_ZONESETCOLOROP_H
+
+#include "HYDROGUI_Operation.h"
+#include <HYDROData_Zone.h>;
+
+class HYDROGUI_ZoneSetColorOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ZoneSetColorOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_ZoneSetColorOp();
+
+protected:
+ virtual void startOperation();
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries );
+
+
+private:
+ Handle(HYDROData_Zone) myZone;
+};
+
+#endif
<source>MEN_REGENERATE_REGION_COLORS</source>
<translation>Regenerate region colors</translation>
</message>
-
+ <message>
+ <source>MEN_ZONE_SET_COLOR</source>
+ <translation>Set color</translation>
+ </message>
<message>
<source>STB_CREATE_CALCULATION</source>
<translation>Create calculation case</translation>