GEOMAPI_EXPORT
void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
- /// Reyirns shape used for the presentation creation (can be NULL)
+ /// Returns shape used for the presentation creation (can be NULL)
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
/** \brief Creates AIS_LengthDimension object
ModuleBase_WidgetRadiobox.h
ModuleBase_WidgetPointInput.h
ModuleBase_ITreeNode.h
+ ModuleBase_IStepPrs.h
)
SET(PROJECT_MOC_HEADERS
ModuleBase_WidgetNameEdit.cpp
ModuleBase_WidgetRadiobox.cpp
ModuleBase_WidgetPointInput.cpp
+ ModuleBase_IStepPrs.cpp
)
SET(PROJECT_LIBRARIES
}
}
-Handle(AIS_InteractiveObject) ModuleBase_IModule::createPresentation(const ResultPtr& theResult)
+Handle(AIS_InteractiveObject) ModuleBase_IModule::createPresentation(const ObjectPtr& theResult)
{
return Handle(AIS_InteractiveObject)();
}
/// Create specific for the module presentation
/// \param theResult an object for presentation
/// \return created presentation or NULL(default value)
- virtual Handle(AIS_InteractiveObject) createPresentation(
- const std::shared_ptr<ModelAPI_Result>& theResult);
+ virtual Handle(AIS_InteractiveObject) createPresentation(const ObjectPtr& theResult);
//! Returns data object by AIS
virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, 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 "ModuleBase_IStepPrs.h"
+
+ModuleBase_IStepPrs::ModuleBase_IStepPrs()
+{
+}
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, 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 ModuleBase_IStepPrs_H
+#define ModuleBase_IStepPrs_H
+
+#include "ModuleBase.h"
+#include <ModelAPI_AttributeTables.h>
+
+class MODULEBASE_EXPORT ModuleBase_IStepPrs
+{
+public:
+ ModuleBase_IStepPrs();
+
+ virtual ModelAPI_AttributeTables::ValueType dataType() const = 0;
+
+ virtual bool dataRange(double& theMin, double& theMax) const = 0;
+};
+
+#endif
\ No newline at end of file
ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult);
SetAutoHilight(aResOwner.get() == NULL);
- init();
-}
-
-//********************************************************************
-ModuleBase_ResultPrs::ModuleBase_ResultPrs(FieldStepPtr theStep)
- : ViewerData_AISShape(TopoDS_Shape()), myStep(theStep), myAdditionalSelectionPriority(0),
- myTransparency(1), myIsSubstituted(false)
-{
- GeomShapePtr aShapePtr = theStep->field()->shape();
- TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
- Set(aShape);
-
- init();
-}
-
-
-//********************************************************************
-void ModuleBase_ResultPrs::init()
-{
// Set own free boundaries aspect in order to have free
// and unfree boundaries with different colors
Handle(Prs3d_Drawer) aDrawer = Attributes();
setEdgesDefaultColor();
}
-
//********************************************************************
void ModuleBase_ResultPrs::setAdditionalSelectionPriority(const int thePriority)
{
return true;
}
-//********************************************************************
-GeomShapePtr ModuleBase_ResultPrs::getOriginalShape() const
-{
- if (myStep.get())
- return myStep->field()->shape();
- return myResult->shape();
-}
-
//********************************************************************
void ModuleBase_ResultPrs::Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
- std::shared_ptr<GeomAPI_Shape> aShapePtr = getOriginalShape();
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = myResult->shape();
bool aReadyToDisplay = aShapePtr.get();
if (aReadyToDisplay) {
myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
/// \param theResult a result object
Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
- /// Constructor
- /// \param theResult a result object
- Standard_EXPORT ModuleBase_ResultPrs(FieldStepPtr theStep);
-
//! Method which draws selected owners ( for fast presentation draw )
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners);
void setEdgesDefaultColor();
- void init();
-
- GeomShapePtr getOriginalShape() const;
-
private:
/// Reference to result object
ResultPtr myResult;
- /// Reference to step object (initialised is only or step or result)
- FieldStepPtr myStep;
-
/// Original shape of the result object
TopoDS_Shape myOriginalShape;
PartSet_CenterPrs.h
PartSet_ExternalPointsMgr.h
PartSet_TreeNodes.h
+ PartSet_FieldStepPrs.h
)
SET(PROJECT_MOC_HEADERS
PartSet_CenterPrs.cpp
PartSet_ExternalPointsMgr.cpp
PartSet_TreeNodes.cpp
+ PartSet_FieldStepPrs.cpp
)
SET(PROJECT_RESOURCES
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, 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 "PartSet_FieldStepPrs.h"
+
+#include <CollectionPlugin_Field.h>
+
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeIntArray.h>
+#include <ModelAPI_AttributeStringArray.h>
+
+#include <AIS_ColorScale.hxx>
+
+
+IMPLEMENT_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape);
+
+
+void emptyDeleter(ModelAPI_ResultField* theF)
+{
+ // Do nothing
+}
+
+PartSet_FieldStepPrs::PartSet_FieldStepPrs(FieldStepPtr theStep)
+: ViewerData_AISShape(TopoDS_Shape()), myStep(theStep)
+{
+ ModelAPI_ResultField* aField = theStep->field();
+ GeomShapePtr aShapePtr = aField->shape();
+ TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+ Set(aShape);
+
+ // Get parameters of the Field
+ // Make shared_ptr which will not delete original pointer after exit
+ std::shared_ptr<ModelAPI_ResultField> aFieldPtr(aField, emptyDeleter);
+ myFeature = ModelAPI_Feature::feature(aFieldPtr);
+}
+
+
+ModelAPI_AttributeTables::ValueType PartSet_FieldStepPrs::dataType() const
+{
+ DataPtr aData = myFeature->data();
+ AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID());
+ return aTablesAttr->type();
+}
+
+bool PartSet_FieldStepPrs::dataRange(double& theMin, double& theMax) const
+{
+ ModelAPI_AttributeTables::ValueType aType = dataType();
+ if ((aType == ModelAPI_AttributeTables::DOUBLE) || (aType == ModelAPI_AttributeTables::INTEGER)) {
+ range(theMin, theMax);
+ return true;
+ }
+ return false;
+}
+
+QList<double> PartSet_FieldStepPrs::range(double& theMin, double& theMax) const
+{
+ ModelAPI_AttributeTables::ValueType aType = dataType();
+ DataPtr aData = myFeature->data();
+ int aStep = myStep->id();
+ AttributeTablesPtr aTablesAttr = aData->tables(CollectionPlugin_Field::VALUES_ID());
+ int aRows = aTablesAttr->rows();
+ int aCols = aTablesAttr->columns();
+
+ QList<double> aFieldStepData;
+ for (int j = 0; j < aCols; j++) {
+ for (int k = 1; k < aRows; k++) { // Do not use default values
+ ModelAPI_AttributeTables::Value aVal = aTablesAttr->value(k, j, aStep);
+ switch (aType) {
+ case ModelAPI_AttributeTables::DOUBLE:
+ aFieldStepData << aVal.myDouble;
+ break;
+ case ModelAPI_AttributeTables::INTEGER:
+ aFieldStepData << aVal.myInt;
+ break;
+ }
+ }
+ }
+ QList<double> aShapeData;
+ double aRangeMin = aFieldStepData.first(), aRangeMax = aFieldStepData.last();
+ for (int aRow = 0; aRow < aRows - 1; aRow++) {
+ double aNorm = 0;
+ int aBaseIndex = aRow * aCols;
+ for (int aCol = 0; aCol < aCols; aCol++) {
+ int anIndex = aCol + aBaseIndex;
+ double aValue = aFieldStepData.at(anIndex);
+ aNorm += aValue * aValue;
+ }
+ aNorm = pow(aNorm, 0.5);
+ aRangeMin = Min(aRangeMin, aNorm);
+ aRangeMax = Max(aRangeMax, aNorm);
+ aShapeData << aNorm;
+ }
+ theMin = aRangeMin;
+ theMax = aRangeMax;
+ return aShapeData;
+}
+
+
+void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode)
+{
+ ModelAPI_AttributeTables::ValueType aType = dataType();
+ if ((aType == ModelAPI_AttributeTables::DOUBLE) ||
+ (aType == ModelAPI_AttributeTables::INTEGER)) {
+ double aMin, aMax;
+ QList<double> aShapeData = range(aMin, aMax);
+ int aNbIntertvals = 20;
+
+ DataPtr aData = myFeature->data();
+ AttributeSelectionListPtr aSelList = aData->selectionList(CollectionPlugin_Field::SELECTED_ID());
+ for (int i = 0; i < aSelList->size(); i++) {
+ AttributeSelectionPtr aSelection = aSelList->value(i);
+ GeomShapePtr aShapePtr = aSelection->value();
+ TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+ double aValue = aShapeData.at(i);
+ Quantity_Color aColor;
+ if (AIS_ColorScale::FindColor(aValue, aMin, aMax, aNbIntertvals, aColor))
+ SetCustomColor(aShape, aColor);
+ }
+ }
+ ViewerData_AISShape::Compute(thePrsMgr, thePrs, theMode);
+}
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, 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 PartSet_FieldStepPrs_H
+#define PartSet_FieldStepPrs_H
+
+#include "PartSet.h"
+#include <ModuleBase_IStepPrs.h>
+
+#include <ModelAPI_ResultField.h>
+#include <ModelAPI_Feature.h>
+
+#include <ViewerData_AISShape.hxx>
+
+#include <QList>
+
+DEFINE_STANDARD_HANDLE(PartSet_FieldStepPrs, ViewerData_AISShape)
+
+/**
+* \ingroup GUI
+* A redefinition of standard AIS Interactive Object in order to provide specific behaviour
+* for wire presentations based in a one plane
+*/
+class PartSet_FieldStepPrs : public ViewerData_AISShape, public ModuleBase_IStepPrs
+{
+public:
+ /// Constructor
+ /// \param theResult a result object
+ Standard_EXPORT PartSet_FieldStepPrs(FieldStepPtr theStep);
+
+ ModelAPI_AttributeTables::ValueType dataType() const;
+
+ bool dataRange(double& theMin, double& theMax) const;
+
+ DEFINE_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape)
+
+protected:
+ //! Compute presentation considering sub-shape color map.
+ virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs, const Standard_Integer theMode);
+
+private:
+ QList<double> range(double& theMin, double& theMax) const;
+
+ FieldStepPtr myStep;
+ FeaturePtr myFeature;
+};
+
+#endif
#include "PartSet_IconFactory.h"
#include "PartSet_OverconstraintListener.h"
#include "PartSet_TreeNodes.h"
+#include "PartSet_FieldStepPrs.h"
#include "PartSet_Filters.h"
#include "PartSet_FilterInfinite.h"
#include <ModuleBase_WidgetFactory.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_ViewerPrs.h>
+#include <ModelAPI_ResultField.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Events.h>
}
//******************************************************
-Handle(AIS_InteractiveObject) PartSet_Module::createPresentation(const ResultPtr& theResult)
+Handle(AIS_InteractiveObject) PartSet_Module::createPresentation(const ObjectPtr& theObject)
{
- return mySketchMgr->createPresentation(theResult);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult.get())
+ return mySketchMgr->createPresentation(aResult);
+ else {
+ FieldStepPtr aStep =
+ std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(theObject);
+ if (aStep.get()) {
+ return new PartSet_FieldStepPrs(aStep);
+ }
+ }
+ return Handle(AIS_InteractiveObject)();
}
//******************************************************
/// Create specific for the module presentation
/// \param theResult an object for presentation
/// \return created presentation or NULL(default value)
- virtual Handle(AIS_InteractiveObject) createPresentation(
- const std::shared_ptr<ModelAPI_Result>& theResult);
+ virtual Handle(AIS_InteractiveObject) createPresentation(const ObjectPtr& theResult);
//! Returns data object by AIS
virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
#include <ModelAPI_AttributeIntArray.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_ResultField.h>
#include <ModuleBase_BRepOwner.h>
#include <ModuleBase_IModule.h>
}
anAIS = aPrs->getAISObject(anAIS);
} else {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- if (aResult.get() != NULL) {
- anAIS = createPresentation(aResult);
- isShading = true;
- }
- else {
- FieldStepPtr aStep =
- std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(theObject);
- if (aStep) {
- GeomShapePtr aShapePtr = aStep->field()->shape();
+ Handle(AIS_InteractiveObject) anAISPrs =
+ myWorkshop->module()->createPresentation(theObject);
+ if (anAISPrs.IsNull()) {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult.get() != NULL) {
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
if (aShapePtr.get() != NULL) {
- Handle(AIS_InteractiveObject) anAISPrs = new ModuleBase_ResultPrs(aStep);
- anAIS = AISObjectPtr(new GeomAPI_AISObject());
- anAIS->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs));
- isShading = true;
+ anAISPrs = new ModuleBase_ResultPrs(aResult);
}
}
}
+ Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs);
+ if (!aShapePrs.IsNull())
+ ModuleBase_Tools::setPointBallHighlighting((AIS_Shape*)aShapePrs.get());
+ anAIS = AISObjectPtr(new GeomAPI_AISObject());
+ anAIS->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs));
+ isShading = true;
}
if (anAIS)
aDisplayed = display(theObject, anAIS, isShading, theUpdateViewer);
}
-//**************************************************************
-AISObjectPtr XGUI_Displayer::createPresentation(const ResultPtr& theResult) const
-{
- AISObjectPtr anAIS;
- if (theResult.get() != NULL) {
- std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
- if (aShapePtr.get() != NULL) {
- anAIS = AISObjectPtr(new GeomAPI_AISObject());
- Handle(AIS_InteractiveObject) anAISPrs =
- myWorkshop->module()->createPresentation(theResult);
- if (anAISPrs.IsNull())
- anAISPrs = new ModuleBase_ResultPrs(theResult);
- else {
- Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs);
- if (!aShapePrs.IsNull())
- ModuleBase_Tools::setPointBallHighlighting((AIS_Shape*)aShapePrs.get());
- }
- anAIS->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs));
- }
- }
- return anAIS;
-}
-
-
//**************************************************************
bool canBeShaded(Handle(AIS_InteractiveObject) theAIS, ModuleBase_IModule* theModule)
{
private:
XGUI_SelectionActivate* selectionActivate() const;
- AISObjectPtr createPresentation(const ResultPtr& theResult) const;
-
private:
XGUI_Workshop* myWorkshop; ///< Reference to workshop
#ifdef TINSPECTOR
#include <ModelAPI_Object.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultField.h>
+#include <ModuleBase_IStepPrs.h>
#include <GeomAPI_Shape.h>
}
}
aDisplayer->setSelected(aSelectedPrs);
+ myWorkshop->viewer()->setColorScaleShown(false);
+ if (aSelectedPrs.size() == 1) {
+ FieldStepPtr aStep =
+ std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>
+ (aSelectedPrs.first()->object());
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ if (aStep.get() && aDisplayer->isVisible(aStep)) {
+ XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
+ AISObjectPtr aAisPtr = aDisplayer->getAISObject(aStep);
+ Handle(AIS_InteractiveObject) aIO = aAisPtr->impl<Handle(AIS_InteractiveObject)>();
+ ModuleBase_IStepPrs* aPrs = dynamic_cast<ModuleBase_IStepPrs*>(aIO.get());
+ if (aPrs) {
+ ModelAPI_AttributeTables::ValueType aType = aPrs->dataType();
+ if ((aType == ModelAPI_AttributeTables::DOUBLE) ||
+ (aType == ModelAPI_AttributeTables::INTEGER) ||
+ (aType == ModelAPI_AttributeTables::BOOLEAN)) {
+ aViewer->setupColorScale();
+ if (aType == ModelAPI_AttributeTables::BOOLEAN) {
+ aViewer->setColorScaleIntervals(2);
+ aViewer->setColorScaleRange(0, 1);
+ }
+ else {
+ double aMin, aMax;
+ aPrs->dataRange(aMin, aMax);
+ aViewer->setColorScaleRange(aMin, aMax);
+ }
+ aViewer->setColorScaleTitle("Step");
+ aViewer->setColorScaleShown(true);
+ }
+ }
+ }
+ }
emit selectionChanged();
}
}
#endif
+
+bool XGUI_ViewerProxy::isColorScaleVisible() const
+{
+#ifdef HAVE_SALOME
+ return myWorkshop->salomeConnector()->viewer()->isColorScaleVisible();
+#else
+ return myWorkshop->mainWindow()->viewer()->isColorScaleVisible();
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleShown(bool on)
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ myWorkshop->mainWindow()->viewer()->setColorScaleShown(on);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScalePosition(double theX, double theY)
+{
+ QWidget* aWindow = activeViewPort();
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetPosition(aWindow->width() * theX, aWindow->height() * theY);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleSize(double theW, double theH)
+{
+ QWidget* aWindow = activeViewPort();
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetWidth(aWindow->width() * theW);
+ aColorScale->SetHeight(aWindow->height() * theH);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleRange(double theMin, double theMax)
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetRange(theMin, theMax);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleIntervals(int theNb)
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetNumberOfIntervals(theNb);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleTextHeigth(int theH)
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetTextHeight(theH);
+#endif
+}
+
+void XGUI_ViewerProxy::setColorScaleTitle(const QString& theText)
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->setColorScaleShown(on);
+#else
+ Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
+ aColorScale->SetTitle(theText.toStdString().c_str());
+#endif
+}
+
+
+//******************************************************
+void XGUI_ViewerProxy::setupColorScale()
+{
+ setColorScalePosition(0.03, 0.35);
+ setColorScaleSize(0.2, 0.5);
+ setColorScaleTextHeigth(14);
+ setColorScaleIntervals(20);
+}
+
+
//***************************************
//void XGUI_ViewerProxy::Zfitall()
//{
virtual void updateHighlight();
+ // Methods for color scale management
+
+ //! Returns True if ColorScale is visible
+ virtual bool isColorScaleVisible() const;
+
+ //! Show/Hide ColorScale object
+ virtual void setColorScaleShown(bool on);
+
+ //! Set position of color scale
+ // \param theX is X position relative to current view width
+ // \param theY is Y position relative to current view heigth
+ virtual void setColorScalePosition(double theX, double theY);
+
+ //! Set size of color scale
+ // \param theW is width relative to current view width
+ // \param theh is height relative to current view heigth
+ virtual void setColorScaleSize(double theW, double theH);
+
+ //! Set range of color scale
+ // \param theMin is a minimal value
+ // \param theMax is a maximal value
+ virtual void setColorScaleRange(double theMin, double theMax);
+
+ //! Set number of intervals of color scale
+ // \param theNb is number of intervals
+ virtual void setColorScaleIntervals(int theNb);
+
+ //! Set text heigth of color scale
+ // \param theH is number of intervals
+ virtual void setColorScaleTextHeigth(int theH);
+
+ //! Set title of color scale
+ // \param theText is a title
+ virtual void setColorScaleTitle(const QString& theText);
+
+ //! Set color scale parameters according to user preferences and window size
+ void setupColorScale();
+
// Fit all along Z (perpendicular to display)
//virtual void Zfitall();
void displayHighlight(FeaturePtr theFeature, const TopoDS_Shape& theIgnoreShape);
void eraseHighlight();
+
XGUI_Workshop* myWorkshop;
ResultPtr myResult;
AIS_ListOfInteractive myHighlights;