1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025695: Visualization, AIS_InteractiveContext - define default HilightMode

AIS_InteractiveContext - removed the following unused properties:
- PreSelectionColor(), DefaultColor(), WasCurrentTouched(), ZDetection().
AIS_InteractiveObject - removed unused property SelectionPriority().

Prs3d_Drawer - removed properties HighlightStyle() and SelectionStyle().
Graphic3d_HighlightStyle has been superseded by Prs3d_Drawer
inheriting from new class Graphic3d_PresentationAttributes.

Graphic3d_PresentationAttributes (as Graphic3d_HighlightStyle replacement)
has been extended with new properties:
- ZLayer() defining Z-Layer for highlighting presentation.
- DisplayMode() defining display mode for highlighting.

StdSelect_BRepSelectionTool methods have been corrected to take
SelectMgr_EntityOwner instead of StdSelect_BRepOwner.
StdSelect_Shape - duplicated field myDrawer has been dropped.

AIS_InteractiveObject - myDrawer->Color() is now used instead of myOwnColor,
myDrawer->Transparency() instead of myTransparency
and myDrawer->ZLayer() instead of myZLayer.

PrsMgr_PresentationManager::Unhighlight() now unhighlight all modes.
The method taking Mode as argument has been marked deprecated.

New enumeration Prs3d_TypeOfHighlight has been introduced
defining different highlight types.
AIS_InteractiveObject::HighlightStyle() now takes enumeration argument
and defines different styles for Global and Local selection.

ComesFromDecomposition() property has been moved
from StdSelect_BRepOwner to SelectMgr_EntityOwner.
This commit is contained in:
kgv
2016-11-02 17:36:18 +03:00
committed by apn
parent 404c893694
commit f838dac48b
106 changed files with 1624 additions and 2273 deletions

View File

@@ -62,7 +62,8 @@ Graphic3d_GroupDefinitionError.hxx
Graphic3d_HatchStyle.hxx
Graphic3d_HatchStyle.cxx
Graphic3d_HighlightStyle.hxx
Graphic3d_HighlightStyle.cxx
Graphic3d_PresentationAttributes.hxx
Graphic3d_PresentationAttributes.cxx
Graphic3d_HorizontalTextAlignment.hxx
Graphic3d_IndexBuffer.hxx
Graphic3d_IndexedMapOfAddress.hxx

View File

@@ -17,7 +17,7 @@
#include <Graphic3d_BndBox3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_HighlightStyle.hxx>
#include <Graphic3d_PresentationAttributes.hxx>
#include <Graphic3d_SequenceOfGroup.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
@@ -101,7 +101,7 @@ public:
//! Returns valid handle to highlight style of the structure in case if
//! highlight flag is set to true
const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const { return myHighlightStyle; }
const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; }
public:
@@ -118,8 +118,8 @@ public:
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
//! Highlights structure with the given style
virtual void GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
const Handle(Graphic3d_Structure)& theStruct) = 0;
virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle,
const Handle(Graphic3d_Structure)& theStruct) = 0;
//! Unhighlights the structure and invalidates pointer to structure's highlight
//! style
@@ -167,7 +167,7 @@ protected:
Handle(Geom_Transformation) myTrsf;
Handle(Graphic3d_TransformPers) myTrsfPers;
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
Handle(Graphic3d_HighlightStyle) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true
Handle(Graphic3d_PresentationAttributes) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true
public:

View File

@@ -16,102 +16,7 @@
#ifndef _Graphic3d_HighlightStyle_HeaderFile
#define _Graphic3d_HighlightStyle_HeaderFile
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Graphic3d_Vec4.hxx>
#include <Quantity_ColorRGBA.hxx>
//! A class for setting up highlight properties, such as:
//! - highlight method (box or some of object's presentations);
//! - highlight color;
//! - transparency coefficient.
class Graphic3d_HighlightStyle : public Standard_Transient
{
public:
//! Creates the style. Default parameters are:
//! - method: color;
//! - color: white;
//! - transparency: 0.f.
Graphic3d_HighlightStyle (const Aspect_TypeOfHighlightMethod theMethod = Aspect_TOHM_COLOR,
const Quantity_Color& theColor = Quantity_NOC_WHITE,
const Standard_ShortReal theTransparency = 0.f)
: myMethod (theMethod)
{
myColor.ChangeRGB() = theColor;
myColor.SetAlpha (1.f - theTransparency);
myColorFltPtr = new Graphic3d_Vec4 (myColor.GetRGB(), myColor.Alpha());
};
//! Creates a copy of the given style
Graphic3d_HighlightStyle (const Handle(Graphic3d_HighlightStyle)& theOther)
: myMethod (theOther->myMethod),
myColor (theOther->myColor)
{
myColorFltPtr = new Graphic3d_Vec4 (myColor.GetRGB(), myColor.Alpha());
};
//! Deletes color pointer stored for consistency with TKOpenGl
virtual ~Graphic3d_HighlightStyle()
{
delete myColorFltPtr;
myColorFltPtr = NULL;
}
//! Changes current highlight method to the given one
void SetMethod (const Aspect_TypeOfHighlightMethod theMethod)
{
myMethod = theMethod;
}
//! Returns current highlight method
Aspect_TypeOfHighlightMethod Method() const
{
return myMethod;
}
//! Changes highlight color to the given one
void SetColor (const Quantity_Color& theColor)
{
myColor.ChangeRGB() = theColor;
myColorFltPtr->xyz() = theColor;
}
//! Returns current highlight color
const Quantity_Color& Color() const
{
return myColor.GetRGB();
}
//! Changes transparency of a highlight presentation to the given one
void SetTransparency (const Standard_ShortReal theTranspCoef)
{
myColor.SetAlpha (1.f - theTranspCoef);
myColorFltPtr->a() = myColor.Alpha();
}
//! Returns current transparency of a highlight presentation
Standard_ShortReal Transparency() const
{
return 1.f - myColor.Alpha();
}
//! Returns pointer to current highlight color in RGBA format
const Graphic3d_Vec4* ColorFltPtr() const
{
return myColorFltPtr;
}
DEFINE_STANDARD_RTTIEXT (Graphic3d_HighlightStyle, Standard_Transient)
private:
Aspect_TypeOfHighlightMethod myMethod; //!< Box or color highlighting
Quantity_ColorRGBA myColor; //!< 3-component highlight color with opacity
Graphic3d_Vec4* myColorFltPtr; //!< For consistency with TKOpenGl
};
DEFINE_STANDARD_HANDLE (Graphic3d_HighlightStyle, Standard_Transient)
// header file for deprecated type Graphic3d_HighlightStyle
#include <Prs3d_Drawer.hxx>
#endif // _Graphic3d_HighlightStyle_HeaderFile

View File

@@ -13,6 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_HighlightStyle.hxx>
#include <Graphic3d_PresentationAttributes.hxx>
IMPLEMENT_STANDARD_RTTIEXT (Graphic3d_HighlightStyle, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT (Graphic3d_PresentationAttributes, Standard_Transient)

View File

@@ -0,0 +1,105 @@
// Created on: 2016-08-24
// Created by: Varvara POSKONINA
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_PresentationAttributes_HeaderFile
#define _Graphic3d_PresentationAttributes_HeaderFile
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Quantity_ColorRGBA.hxx>
//! Class defines presentation properties.
class Graphic3d_PresentationAttributes : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_PresentationAttributes, Standard_Transient)
public:
//! Empty constructor.
Graphic3d_PresentationAttributes()
: myBasicColor (Quantity_NOC_WHITE),
myHiMethod (Aspect_TOHM_COLOR),
myZLayer (Graphic3d_ZLayerId_Default),
myDispMode (0)
{
//
}
//! Destructor.
virtual ~Graphic3d_PresentationAttributes() {}
//! Returns highlight method, Aspect_TOHM_COLOR by default.
Aspect_TypeOfHighlightMethod Method() const { return myHiMethod; }
//! Changes highlight method to the given one.
virtual void SetMethod (const Aspect_TypeOfHighlightMethod theMethod) { myHiMethod = theMethod; }
//! Returns basic presentation color (including alpha channel).
const Quantity_ColorRGBA& ColorRGBA() const { return myBasicColor; }
//! Returns basic presentation color, Quantity_NOC_WHITE by default.
const Quantity_Color& Color() const { return myBasicColor.GetRGB(); }
//! Sets basic presentation color (RGB components, does not modifies transparency).
virtual void SetColor (const Quantity_Color& theColor)
{
myBasicColor.ChangeRGB() = theColor;
}
//! Returns basic presentation transparency (0 - opaque, 1 - fully transparent), 0 by default (opaque).
Standard_ShortReal Transparency() const { return 1.0f - myBasicColor.Alpha(); }
//! Sets basic presentation transparency (0 - opaque, 1 - fully transparent).
virtual void SetTransparency (const Standard_ShortReal theTranspCoef)
{
myBasicColor.SetAlpha (1.0f - theTranspCoef);
}
//! Returns presentation Zlayer, Graphic3d_ZLayerId_Default by default.
//! Graphic3d_ZLayerId_UNKNOWN means undefined (a layer of main presentation to be used).
Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
//! Sets presentation Zlayer.
virtual void SetZLayer (const Graphic3d_ZLayerId theLayer) { myZLayer = theLayer; }
//! Returns display mode, 0 by default.
//! -1 means undefined (main display mode of presentation to be used).
Standard_Integer DisplayMode() const { return myDispMode; }
//! Sets display mode.
virtual void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
//! Return basic presentation fill area aspect, NULL by default.
//! When set, might be used instead of Color() property.
const Handle(Graphic3d_AspectFillArea3d)& BasicFillAreaAspect() const { return myBasicFillAreaAspect; }
//! Sets basic presentation fill area aspect.
virtual void SetBasicFillAreaAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myBasicFillAreaAspect = theAspect; }
protected:
Handle(Graphic3d_AspectFillArea3d) myBasicFillAreaAspect; //!< presentation fill area aspect
Quantity_ColorRGBA myBasicColor; //!< presentation color
Aspect_TypeOfHighlightMethod myHiMethod; //!< box or color highlighting
Graphic3d_ZLayerId myZLayer; //!< Z-layer
Standard_Integer myDispMode; //!< display mode
};
DEFINE_STANDARD_HANDLE (Graphic3d_PresentationAttributes, Standard_Transient)
#endif // _Graphic3d_PresentationAttributes_HeaderFile

View File

@@ -254,8 +254,8 @@ void Graphic3d_Structure::Erase()
//function : Highlight
//purpose :
//=============================================================================
void Graphic3d_Structure::Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Boolean theToUpdateMgr)
void Graphic3d_Structure::Highlight (const Handle(Graphic3d_PresentationAttributes)& theStyle,
const Standard_Boolean theToUpdateMgr)
{
if (IsDeleted())
{
@@ -322,7 +322,7 @@ void Graphic3d_Structure::UnHighlight()
//function : HighlightStyle
//purpose :
//=============================================================================
const Handle(Graphic3d_HighlightStyle)& Graphic3d_Structure::HighlightStyle() const
const Handle(Graphic3d_PresentationAttributes)& Graphic3d_Structure::HighlightStyle() const
{
return myCStructure->HighlightStyle();
}

View File

@@ -106,7 +106,7 @@ public:
//! @param theStyle [in] the style (type of highlighting: box/color, color and opacity)
//! @param theToUpdateMgr [in] defines whether related computed structures will be
//! highlighted via structure manager or not
Standard_EXPORT void Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Boolean theToUpdateMgr = Standard_True);
Standard_EXPORT void Highlight (const Handle(Graphic3d_PresentationAttributes)& theStyle, const Standard_Boolean theToUpdateMgr = Standard_True);
//! Suppress the structure <me>.
//! It will be erased at the next screen update.
@@ -232,7 +232,7 @@ public:
//! Returns the highlight color for the Highlight method
//! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
Standard_EXPORT const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const;
Standard_EXPORT const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const;
//! Returns Standard_True if the structure <me> is deleted.
//! <me> is deleted after the call Remove (me).

View File

@@ -16,6 +16,8 @@
#ifndef _Graphic3d_ZLayerId_HeaderFile
#define _Graphic3d_ZLayerId_HeaderFile
#include <Standard_Integer.hxx>
typedef Standard_Integer Graphic3d_ZLayerId;
//! This enumeration defines the list of predefined layers, which can not be removed (but settings can be overridden).