HYDROGUI_RecognizeContoursDlg.h
HYDROGUI_RecognizeContoursOp.h
HYDROGUI_LandCoverColoringOp.h
+ HYDROGUI_ShapeLandCover.h
)
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_RecognizeContoursDlg.cxx
HYDROGUI_RecognizeContoursOp.cxx
HYDROGUI_LandCoverColoringOp.cxx
+ HYDROGUI_ShapeLandCover.cxx
)
add_definitions(
#include "HYDROGUI_LandCoverDlg.h"
#include "HYDROGUI_Module.h"
+#include "HYDROGUI_OCCDisplayer.h"
#include "HYDROGUI_Shape.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
}
module()->setIsToUpdate( aZoneObj );
+ module()->getOCCDisplayer()->SetToUpdateColorScale();
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
if ( theObject->GetKind() == KIND_BATHYMETRY && theState ) {
setLandCoversScalarMapModeOff( theViewId );
+ } else if ( theObject->GetKind() == KIND_LAND_COVER && theState ) {
+ getOCCDisplayer()->SetToUpdateColorScale();
}
}
}
#include "HYDROGUI_Tool.h"
#include <HYDROGUI_ShapeImage.h>
#include <HYDROGUI_ShapeBathymetry.h>
+#include <HYDROGUI_ShapeLandCover.h>
#include "HYDROGUI_Operation.h"
#include "HYDROGUI_DataObject.h"
#include "HYDROGUI_ZLayers.h"
module()->removeObjectShape( (size_t)aViewer, anObj );
}
aViewer->update();
- UpdateColorScale( aViewer );
+ if ( !module()->isLandCoversScalarMapModeOn( (size_t)aViewer ) ) {
+ UpdateColorScale( aViewer );
+ }
}
HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int theViewerId,
aResShape = new HYDROGUI_ShapeImage( theContext, Handle_HYDROData_Image::DownCast( theObject ) );
else if( theObject->IsKind( STANDARD_TYPE( HYDROData_Bathymetry ) ) )
aResShape = new HYDROGUI_ShapeBathymetry( this, theContext, Handle_HYDROData_Bathymetry::DownCast( theObject ) );
+ else if( theObject->IsKind( STANDARD_TYPE( HYDROData_LandCover ) ) ) {
+ bool isScalarMode = module()->isLandCoversScalarMapModeOn( theViewerId );
+ aResShape = new HYDROGUI_ShapeLandCover( this, theContext, Handle_HYDROData_LandCover::DownCast( theObject ), -1, isScalarMode );
+ }
else
aResShape = new HYDROGUI_Shape( theContext, theObject );
void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer )
{
- if( !myToUpdateColorScale )
+ if( !myToUpdateColorScale || !theViewer )
return;
OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( theViewer->getViewManager()->getActiveView() );
aView->ColorScaleErase();
}
- bool isScaleColoringOn = isDisplayColorScale && !aColorScale.IsNull();
foreach( HYDROGUI_Shape* aShape, aLandCoverShapes ) {
- if ( !aShape || !aShape->isVisible() ) {
+ HYDROGUI_ShapeLandCover* aLandCoverShape =
+ dynamic_cast<HYDROGUI_ShapeLandCover*>( aShape );
+
+ if ( !aLandCoverShape || !aLandCoverShape->isVisible() ) {
continue;
}
-
+
Handle(HYDROData_LandCover) aLandCover =
- Handle(HYDROData_LandCover)::DownCast( aShape->getObject() );
+ Handle(HYDROData_LandCover)::DownCast( aLandCoverShape->getObject() );
if ( aLandCover.IsNull() ) {
continue;
}
-
+
QColor aUndefinedColor( Qt::gray );
QColor aColor = isLandCoverColoringOn ? aUndefinedColor : aLandCover->GetFillingColor();
}
}
- //@MZN aShape->update( false, false );
- aShape->setFillingColor( aColor, true, true );
+ aLandCoverShape->setFillingColor( aColor, true, true );
+ aLandCoverShape->setScalarMapModeEnabled( isLandCoverColoringOn );
+ theViewer->getAISContext()->Redisplay( aLandCoverShape->getAISObject() );
+ //theViewer->getAISContext()->UpdateCurrentViewer(); //@MZN
+ //theViewer->getAISContext()->UpdateCurrent();
+ //theViewer->getAISContext()->UpdateSelected( true );
}
myToUpdateColorScale = false;
setShape( aCompound, false, false );
}
- else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
- {
- Handle(HYDROData_LandCover) aLandCoverObj =
- Handle(HYDROData_LandCover)::DownCast( myObject );
-
- TopoDS_Shape aLandCoverShape = aLandCoverObj->GetShape();
- if ( !aLandCoverShape.IsNull() ) {
- setShape( aLandCoverShape, false, false );
- }
-
- QColor aFillingColor = aLandCoverObj->GetFillingColor();
- QColor aBorderColor = aLandCoverObj->GetBorderColor();
-
- setFillingColor( aFillingColor, false, false );
- setBorderColor( aBorderColor, false, false );
- }
}
if ( myShape.IsNull() || !isVisible() )
--- /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_ShapeLandCover.h"
+#include "HYDROGUI_OCCDisplayer.h"
+
+#include <HYDROData_LandCover.h>
+
+#include <AIS_InteractiveContext.hxx>
+
+HYDROGUI_ShapeLandCover::HYDROGUI_ShapeLandCover( HYDROGUI_OCCDisplayer* theDisplayer,
+ const Handle(AIS_InteractiveContext)& theContext,
+ const Handle_HYDROData_LandCover& theLandCover,
+ const int theZLayer,
+ const bool theIsScalarMode )
+: HYDROGUI_Shape( theContext, theLandCover, theZLayer ),
+ myDisplayer( theDisplayer ),
+ myIsScalarMapMode( theIsScalarMode )
+{
+}
+
+HYDROGUI_ShapeLandCover::~HYDROGUI_ShapeLandCover()
+{
+}
+
+void HYDROGUI_ShapeLandCover::update( bool theIsUpdateViewer, bool isDeactivateSelection )
+{
+ setIsToUpdate( false );
+
+ Handle(HYDROData_LandCover) aLandCoverObj =
+ Handle(HYDROData_LandCover)::DownCast( getObject() );
+
+ TopoDS_Shape aLandCoverShape = aLandCoverObj->GetShape();
+ if ( !aLandCoverShape.IsNull() ) {
+ setShape( aLandCoverShape, false, false );
+ }
+
+ if ( !myIsScalarMapMode ) {
+ QColor aFillingColor = aLandCoverObj->GetFillingColor();
+ QColor aBorderColor = aLandCoverObj->GetBorderColor();
+
+ setFillingColor( aFillingColor, false, false );
+ setBorderColor( aBorderColor, false, false );
+ } else {
+ updateShape( false, false );
+ }
+
+ HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
+}
+
+void HYDROGUI_ShapeLandCover::setScalarMapModeEnabled( const bool theIsToEnable )
+{
+ myIsScalarMapMode = theIsToEnable;
+}
+
+void HYDROGUI_ShapeLandCover::setVisible( const bool theState,
+ const bool theIsUpdateViewer )
+{
+ HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
+ myDisplayer->SetToUpdateColorScale();
+}
+
+void HYDROGUI_ShapeLandCover::displayShape( const bool theIsUpdateViewer )
+{
+ HYDROGUI_Shape::displayShape( theIsUpdateViewer );
+ myDisplayer->SetToUpdateColorScale();
+}
+
+void HYDROGUI_ShapeLandCover::display( const bool theIsUpdateViewer )
+{
+ HYDROGUI_Shape::display( theIsUpdateViewer );
+ myDisplayer->SetToUpdateColorScale();
+}
+
+void HYDROGUI_ShapeLandCover::erase( const bool theIsUpdateViewer )
+{
+ HYDROGUI_Shape::erase( theIsUpdateViewer );
+ myDisplayer->SetToUpdateColorScale();
+}
--- /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_SHAPE_LANDCOVER_H
+#define HYDROGUI_SHAPE_LANDCOVER_H
+
+#include <HYDROGUI_Shape.h>
+
+class Handle_HYDROData_LandCover;
+class HYDROGUI_OCCDisplayer;
+
+class HYDROGUI_ShapeLandCover : public HYDROGUI_Shape
+{
+public:
+ HYDROGUI_ShapeLandCover( HYDROGUI_OCCDisplayer* theDisplayer,
+ const Handle(AIS_InteractiveContext)& theContext,
+ const Handle_HYDROData_LandCover& theLandCover,
+ const int theZLayer = -1,
+ const bool theIsScalarMode = false );
+ virtual ~HYDROGUI_ShapeLandCover();
+
+ virtual void update( bool isUpdateViewer,
+ bool isDeactivateSelection );
+
+ virtual void display( const bool theIsUpdateViewer = true );
+ virtual void erase( const bool theIsUpdateViewer = true );
+
+ virtual void setVisible( const bool theState,
+ const bool theIsUpdateViewer = true );
+
+ /**
+ * Enable/disable scalar map coloring mode.
+ * @param theIsToEnable if true - scalar map coloring mode willbe enbaled, if false - disabled
+ */
+ virtual void setScalarMapModeEnabled( const bool theIsToEnable );
+
+protected:
+ virtual void displayShape( const bool theIsUpdateViewer );
+
+private:
+ HYDROGUI_OCCDisplayer* myDisplayer;
+ bool myIsScalarMapMode;
+};
+
+#endif
anUpdateFlags |= UF_FitAll;
}
- aModule->getOCCDisplayer()->SetToUpdateColorScale(); //@MZN
-
// Set VTK viewer active if show a bathymetry
if ( aVTKMgr )
{