@section upgrade_occt720 Upgrade to OCCT 7.2.0
+@subsection upgrade_720_removed Removed features
+
+The following obsolete features have been removed:
+* *AIS_InteractiveContext::PreSelectionColor()*, *::DefaultColor()*, *::WasCurrentTouched()*, *::ZDetection()*.
+ These properties were unused, and therefore application should remove occurrences of these methods.
+* *AIS_InteractiveObject::SelectionPriority()*.
+ These property was not implemented.
+
@subsection upgrade_occt720_correction_of_Offset_API Corrections in BRepOffset API
Class *BRepOffsetAPI_MakeOffsetShape*:
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = BodyMaker.Shape();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+@subsection upgrade_720_highlight Highlight style
+
+Management of highlight attributes has been revised and might require modifications from application side:
+* New class *Graphic3d_PresentationAttributes* defining basic presentation attributes has been introduced.
+ It's definition includes properties previously defined by class Graphic3d_HighlightStyle (*Color*, *Transparency*),
+ and new properties (*Display mode*, *ZLayer*, optional *FillArea aspect*).
+* Class *Prs3d_Drawer* now inherits class *Graphic3d_PresentationAttributes*.
+ So that overall presentation attributes are now split into two parts - Basic attributes and Detailed attributes.
+* Class *Graphic3d_HighlightStyle* has been dropped.
+ It is now defined as a typedef to *Prs3d_Drawer*.
+ Therefore, highlight style now also includes not only Basic presentation attributes, but also Detailed attributes
+ which can be used by custom presentation builders.
+* Highlighting style defined by class *Graphic3d_PresentationAttributes* now provides more options:
+ - *Graphic3d_PresentationAttributes::BasicFillAreaAspect()* property providing complete Material definition.
+ This option, when defined, can be used instead of the pair Object Material + Highlight Color.
+ - *Graphic3d_PresentationAttributes::ZLayer()* property specifying the Layer where highlighted presentation should be shown.
+ This property can be set to Graphic3d_ZLayerId_UNKNOWN, which means that ZLayer of main presentation should be used instead.
+ - *Graphic3d_PresentationAttributes::DisplayMode()* property specifying Display Mode for highlight presentation.
+* Since Highlight and Selection styles within *AIS_InteractiveContext* are now defined by *Prs3d_Drawer* inheriting from *Graphic3d_PresentationAttributes*,
+ it is now possible to customize default highlight attributes like *Display Mode* and *ZLayer*, which previously could be defined only on Object level.
+* Properties *Prs3d_Drawer::HighlightStyle()* and *Prs3d_Drawer::SelectionStyle()* have been removed.
+ Instead, *AIS_InteractiveObject* now defines *::DynamicHilightAttributes()* for dynamic highlighting in addition to *::HilightAttributes()* used for highlighting in selected state.
+* The following protected fields have been removed from class *AIS_InteractiveObject*:
+ - *myOwnColor*, replaced by *myDrawer->Color()*
+ - *myTransparency*, replaced by *myDrawer->Transparency()*
+ - *myZLayer*, replaced by *myDrawer->ZLayer()*
+* The method *PrsMgr_PresentationManager::Unhighlight()* taking Display Mode as an argument has been marked deprecated.
+ Implementation now performs unhighlighting of all highlighted presentation mode.
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
- myDrawer->LineAspect()->SetColor(myOwnColor);
+ myDrawer->LineAspect()->SetColor (myDrawer->Color());
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
- myDrawer->LineAspect()->SetColor(myOwnColor);
+ myDrawer->LineAspect()->SetColor (myDrawer->Color());
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
- myDrawer->LineAspect()->SetColor(myOwnColor);
+ myDrawer->LineAspect()->SetColor (myDrawer->Color());
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
- myDrawer->LineAspect()->SetColor(myOwnColor);
+ myDrawer->LineAspect()->SetColor (myDrawer->Color());
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
//Method for advanced customizable highlighting of picked object
void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner)
{
Handle( Prs3d_Presentation ) aHighlightPrs;
const SelectMgr_SequenceOfOwner& theOwners);
void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner);
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
void AIS_Axis::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (aCol);
myDrawer->LineAspect()->SetColor(aCol);
const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect();
void AIS_Circle::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (aCol);
Standard_Real WW = HasWidth() ? myOwnWidth :
myDrawer->HasLink() ?
if (!myDrawer->HasOwnLineAspect ()) {
Quantity_Color CC = Quantity_NOC_YELLOW;
- if( HasColor() ) CC = myOwnColor;
+ if( HasColor() ) CC = myDrawer->Color();
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
} else
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
else{
Quantity_Color CC = Quantity_NOC_YELLOW;;
- if( HasColor() ) CC = myOwnColor;
+ if( HasColor() ) CC = myDrawer->Color();
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->LineAspect()->SetColor(CC);
- myOwnColor = CC;
+ myDrawer->SetColor (CC);
}
}
Standard_Boolean toDrawLabel = GetLabelPosition() != Aspect_TOCSP_NONE;
TCollection_ExtendedString aTitle = GetTitle();
Standard_Integer aTitleHeight = aSpacer;
- Quantity_Color aFgColor (hasOwnColor ? myOwnColor : Quantity_NOC_WHITE);
+ Quantity_Color aFgColor (hasOwnColor ? myDrawer->Color() : Quantity_NOC_WHITE);
// Draw title
if (aTitle.Length())
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
{
setColor (myDrawer, theColor);
- myOwnColor = theColor;
+ myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
{
setTransparency (myDrawer, theValue);
- myTransparency = theValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )theValue);
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
AIS_ConnectedInteractive::AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
AIS_InteractiveObject(aTypeOfPresentation3d)
{
- SetHilightMode(0);
+ //
}
//=======================================================================
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <AIS_DimensionOwner.hxx>
#include <AIS_Dimension.hxx>
-#include <AIS_DimensionOwner.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <Standard_Type.hxx>
-#include <StdSelect_Shape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
return;
}
- thePM->Unhighlight (Selectable(), HighlightMode (mySelectionMode));
+ thePM->Unhighlight (Selectable());
}
//=======================================================================
//purpose :
//=======================================================================
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer /*theMode*/)
{
thePM->Color (Selectable(), theStyle, HighlightMode (mySelectionMode));
#include <PrsMgr_PresentationManager3d.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Standard_Boolean.hxx>
+
class SelectMgr_SelectableObject;
class PrsMgr_PresentationManager;
-
-class AIS_DimensionOwner;
DEFINE_STANDARD_HANDLE(AIS_DimensionOwner, SelectMgr_EntityOwner)
//! The owner is the entity which makes it possible to link
//! priority 4. The default priority is 5.
class AIS_DimensionOwner : public SelectMgr_EntityOwner
{
-
+ DEFINE_STANDARD_RTTIEXT(AIS_DimensionOwner, SelectMgr_EntityOwner)
public:
-
-
//! Initializes the dimension owner, theSO, and attributes it
//! the priority, thePriority.
Standard_EXPORT AIS_DimensionOwner(const Handle(SelectMgr_SelectableObject)& theSelObject, const AIS_DimensionSelectionMode theSelMode, const Standard_Integer thePriority = 0);
Standard_EXPORT AIS_DimensionSelectionMode SelectionMode() const;
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Returns true if an object with the selection mode
//! Removes highlighting from the selected part of dimension.
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode = 0) Standard_OVERRIDE;
-
-
-
- DEFINE_STANDARD_RTTIEXT(AIS_DimensionOwner,SelectMgr_EntityOwner)
-
-protected:
-
-
-
-
private:
-
AIS_DimensionSelectionMode mySelectionMode;
-
};
-
-
-
-
-
-
#endif // _AIS_DimensionOwner_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <AIS_GlobalStatus.hxx>
#include <AIS_DisplayMode.hxx>
-#include <AIS_GlobalStatus.hxx>
#include <Standard_Type.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
AIS_GlobalStatus::AIS_GlobalStatus():
myStatus(AIS_DS_None),
#include <Standard_Type.hxx>
#include <AIS_DisplayStatus.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
+#include <Prs3d_Drawer.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
-#include <MMgt_TShared.hxx>
+#include <Standard_Transient.hxx>
-
-class AIS_GlobalStatus;
-DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
//! Stores information about objects in graphic context:
//! - Status Of Display : in the main viewer
//! - Active Selection Modes
//! - is the Interactive Object Current ?
//! - Layer Index
-class AIS_GlobalStatus : public MMgt_TShared
+class AIS_GlobalStatus : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
public:
-
Standard_EXPORT AIS_GlobalStatus();
Standard_EXPORT AIS_GlobalStatus(const AIS_DisplayStatus aStat, const Standard_Integer aDispMode, const Standard_Integer aSelMode, const Standard_Boolean ishilighted = Standard_False, const Standard_Integer aLayerIndex = 0);
-
- void SetGraphicStatus (const AIS_DisplayStatus aStat);
-
- void AddSelectionMode (const Standard_Integer aMode);
- //! Sets display mode.
- void SetDisplayMode (const Standard_Integer theMode);
+ void SetGraphicStatus (const AIS_DisplayStatus theStatus) { myStatus = theStatus; }
- //! Returns the display mode.
- Standard_Integer DisplayMode() const;
-
- void SetLayerIndex (const Standard_Integer AnIndex);
-
- void SetHilightStatus (const Standard_Boolean aStat);
+ void AddSelectionMode (const Standard_Integer theMode) { if (!IsSModeIn (theMode)) mySelModes.Append (theMode); }
- //! Changes applied highlight style for a particular object
- void SetHilightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
- {
- myHiStyle = theStyle;
- }
+ //! Sets display mode.
+ void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
- //! Returns applied highlight style for a particular object
- const Handle(Graphic3d_HighlightStyle)& HilightStyle() const
- {
- return myHiStyle;
- }
+ //! Returns the display mode.
+ Standard_Integer DisplayMode() const { return myDispMode; }
- Standard_Boolean IsSubIntensityOn() const;
-
- void SubIntensityOn();
-
- void SubIntensityOff();
+ void SetLayerIndex (const Standard_Integer theIndex) { myLayerIndex = theIndex; }
+
+ void SetHilightStatus (const Standard_Boolean theStatus) { myIsHilit = theStatus; }
+
+ //! Changes applied highlight style for a particular object
+ void SetHilightStyle (const Handle(Prs3d_Drawer)& theStyle) { myHiStyle = theStyle; }
+
+ //! Returns applied highlight style for a particular object
+ const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; }
+
+ Standard_Boolean IsSubIntensityOn() const { return mySubInt; }
+
+ void SubIntensityOn() { mySubInt = Standard_True; }
+
+ void SubIntensityOff() { mySubInt = Standard_False; }
Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
Standard_EXPORT void ClearSelectionModes();
- AIS_DisplayStatus GraphicStatus() const;
+ AIS_DisplayStatus GraphicStatus() const { return myStatus; }
//! keeps the active selection modes of the object
//! in the main viewer.
- const TColStd_ListOfInteger& SelectionModes() const;
+ const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
- Standard_Boolean IsHilighted() const;
+ Standard_Boolean IsHilighted() const { return myIsHilit; }
Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
return myLayerIndex;
}
-
-
- DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus,MMgt_TShared)
-
-protected:
-
-
-
-
private:
-
+ TColStd_ListOfInteger mySelModes;
+ Handle(Prs3d_Drawer) myHiStyle;
AIS_DisplayStatus myStatus;
Standard_Integer myDispMode;
- TColStd_ListOfInteger mySelModes;
Standard_Integer myLayerIndex;
Standard_Boolean myIsHilit;
- Handle(Graphic3d_HighlightStyle) myHiStyle;
Standard_Boolean mySubInt;
-
};
-
-#include <AIS_GlobalStatus.lxx>
-
-
-
-
-
#endif // _AIS_GlobalStatus_HeaderFile
+++ /dev/null
-// Created on: 1997-01-24
-// Created by: Robert COUBLANC
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline void AIS_GlobalStatus::SetGraphicStatus(const AIS_DisplayStatus aStat)
-{
- myStatus = aStat;
-}
-
-inline void AIS_GlobalStatus::SetDisplayMode (const Standard_Integer theMode)
-{
- myDispMode = theMode;
-}
-inline void AIS_GlobalStatus::AddSelectionMode(const Standard_Integer aMode)
-{
- if(!IsSModeIn(aMode)) mySelModes.Append(aMode);
-}
-
-inline void AIS_GlobalStatus::SetLayerIndex(const Standard_Integer AnIndex)
-{
- myLayerIndex=AnIndex;
-}
-
-inline void AIS_GlobalStatus::SetHilightStatus(const Standard_Boolean aStat)
-{
- myIsHilit = aStat;
-}
-
-inline Standard_Boolean AIS_GlobalStatus::IsSubIntensityOn() const
-{
- return mySubInt;
-}
-inline void AIS_GlobalStatus::SubIntensityOn()
-{
- mySubInt = Standard_True;
-}
-inline void AIS_GlobalStatus::SubIntensityOff()
-{
- mySubInt = Standard_False;
-}
-
-
-
-inline AIS_DisplayStatus AIS_GlobalStatus::GraphicStatus() const
-{
- return myStatus;
-}
-
-inline Standard_Integer AIS_GlobalStatus::DisplayMode() const
-{
- return myDispMode;
-}
-
-inline const TColStd_ListOfInteger& AIS_GlobalStatus::SelectionModes() const
-{
- return mySelModes;
-}
-
-inline Standard_Boolean AIS_GlobalStatus::IsHilighted() const
-{
- return myIsHilit;
-}
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_PlaneAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_PresentableObject.hxx>
{
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
+
+ //! Initialize default highlighting attributes.
+ static void initDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer)
+ {
+ theDrawer->SetMethod (Aspect_TOHM_COLOR);
+ theDrawer->SetDisplayMode (0);
+
+ theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
+ *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
+ theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
+ theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
+ theDrawer->SetPlaneAspect (new Prs3d_PlaneAspect());
+ *theDrawer->PlaneAspect()->EdgesAspect() = *theDrawer->Link()->PlaneAspect()->EdgesAspect();
+ theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
+ theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
+
+ theDrawer->WireAspect()->SetWidth (2.0);
+ theDrawer->LineAspect()->SetWidth (2.0);
+ theDrawer->PlaneAspect()->EdgesAspect()->SetWidth (2.0);
+ theDrawer->FreeBoundaryAspect() ->SetWidth (2.0);
+ theDrawer->UnFreeBoundaryAspect()->SetWidth (2.0);
+ theDrawer->PointAspect()->SetTypeOfMarker (Aspect_TOM_O_POINT);
+ theDrawer->PointAspect()->SetScale (2.0);
+
+ // the triangulation should be computed using main presentation attributes,
+ // and should not be overridden by highlighting
+ theDrawer->SetAutoTriangulation (Standard_False);
+ }
}
//=======================================================================
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myWasLastMain(Standard_False),
-myCurrentTouched(Standard_False),
-mySelectedTouched(Standard_False),
myToHilightSelected(Standard_True),
+mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
-mySelection(new AIS_Selection()),
-myDefaultColor(Quantity_NOC_GOLDENROD),
-myHiStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_CYAN1)),
-mySelStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY80)),
-myPreselectionColor(Quantity_NOC_GREEN),
-mySubintStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY40)),
-myDisplayMode(0),
myCurLocalIndex(0),
myCurDetected(0),
myCurHighlighted(0),
-myZDetectionFlag(0),
myIsAutoActivateSelMode(Standard_True)
-{
+{
+ myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
+ myStyles[Prs3d_TypeOfHighlight_Selected] = new Prs3d_Drawer();
+ myStyles[Prs3d_TypeOfHighlight_Dynamic] = new Prs3d_Drawer();
+ myStyles[Prs3d_TypeOfHighlight_LocalSelected] = new Prs3d_Drawer();
+ myStyles[Prs3d_TypeOfHighlight_LocalDynamic] = new Prs3d_Drawer();
+ myStyles[Prs3d_TypeOfHighlight_SubIntensity] = new Prs3d_Drawer();
+
+ myDefaultDrawer->SetZLayer(Graphic3d_ZLayerId_Default);
+ myDefaultDrawer->SetDisplayMode(0);
+ {
+ const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Dynamic];
+ aStyle->Link (myDefaultDrawer);
+ initDefaultHilightAttributes (aStyle);
+ aStyle->SetZLayer(Graphic3d_ZLayerId_Top);
+ aStyle->SetColor (Quantity_NOC_CYAN1);
+ }
+ {
+ const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalDynamic];
+ aStyle->Link (myDefaultDrawer);
+ initDefaultHilightAttributes (aStyle);
+ aStyle->SetZLayer(Graphic3d_ZLayerId_Topmost);
+ aStyle->SetColor (Quantity_NOC_CYAN1);
+ }
+ {
+ const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Selected];
+ aStyle->Link (myDefaultDrawer);
+ initDefaultHilightAttributes (aStyle);
+ aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
+ aStyle->SetColor (Quantity_NOC_GRAY80);
+ }
+ {
+ const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalSelected];
+ aStyle->Link (myDefaultDrawer);
+ initDefaultHilightAttributes (aStyle);
+ aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
+ aStyle->SetColor (Quantity_NOC_GRAY80);
+ }
+ {
+ const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_SubIntensity];
+ aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
+ aStyle->SetMethod(Aspect_TOHM_COLOR);
+ aStyle->SetColor (Quantity_NOC_GRAY40);
+ }
+
InitAttributes();
}
{
if(myMainPM->IsHighlighted (theIObj, anOldMode))
{
- unhighlightGlobal (theIObj, anOldMode);
+ unhighlightGlobal (theIObj);
}
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
aStatus->SetGraphicStatus (AIS_DS_Displayed);
if (aStatus->IsHilighted())
{
- const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
- highlightGlobal (theIObj, aStatus->HilightStyle(), aHiMod);
+ highlightGlobal (theIObj, aStatus->HilightStyle(), theDispMode);
}
if (theSelectionMode != -1)
{
//purpose :
//=======================================================================
void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Boolean theIsToUpdate)
{
if (theObj.IsNull())
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
- const Standard_Integer aHilightMode = theObj->HasHilightMode() ? theObj->HilightMode() : 0;
- highlightGlobal (theObj, theStyle, aHilightMode);
+ highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
aStatus->SetHilightStyle (theStyle);
}
}
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
- aStatus->SetHilightStyle (new Graphic3d_HighlightStyle());
+ aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
- Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
- unhighlightGlobal (anIObj, aHilightMode);
+ unhighlightGlobal (anIObj);
}
}
else
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
- Handle(Graphic3d_HighlightStyle)& theStyle) const
+ Handle(Prs3d_Drawer)& theStyle) const
{
if (HasOpenedContext())
myLocalContexts (myCurLocalIndex)->HighlightStyle (theObj, theStyle);
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
- Handle(Graphic3d_HighlightStyle)& theStyle) const
+ Handle(Prs3d_Drawer)& theStyle) const
{
if (theOwner.IsNull() || !theOwner->HasSelectable())
return Standard_False;
// check if the object has own selection style. If not, it can
// only be highlighted with default selection style (because
// sub-intensity does not modify any selection states)
- theStyle = getSelStyle (anObj);
+ theStyle = getSelStyle (anObj, theOwner);
}
return Standard_True;
}
{
Standard_Integer aDispMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
- : (theIObj->AcceptDisplayMode (myDisplayMode)
- ? myDisplayMode
+ : (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
+ ? myDefaultDrawer->DisplayMode()
: 0);
return myMainPM->DisplayPriority (theIObj, aDispMode);
}
{
Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
- : (theIObj->AcceptDisplayMode (myDisplayMode)
- ? myDisplayMode
+ : (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
+ ? myDefaultDrawer->DisplayMode()
: 0);
myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
}
void AIS_InteractiveContext::SetDisplayMode(const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer)
{
- if (theMode == myDisplayMode)
+ if (theMode == myDefaultDrawer->DisplayMode())
{
return;
}
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (anObj))
{
myMainPM->BeginImmediateDraw();
- unhighlightGlobal (anObj, myDisplayMode);
+ unhighlightGlobal (anObj);
myMainPM->EndImmediateDraw (myMainVwr);
}
if (aStatus->IsSubIntensityOn())
{
highlightWithSubintensity (anObj, theMode);
}
- myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
+ myMainPM->SetVisibility (anObj, myDefaultDrawer->DisplayMode(), Standard_False);
}
}
- myDisplayMode = theMode;
+ myDefaultDrawer->SetDisplayMode (theMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
{
if (myMainPM->IsHighlighted (theIObj, anOldMode))
{
- unhighlightGlobal (theIObj, anOldMode);
+ unhighlightGlobal (theIObj);
}
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
aStatus->SetDisplayMode (theMode);
myMainPM->Display (theIObj, theMode);
- Standard_Integer aDispMode, aHiMode, aSelMode;
- GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
if (aStatus->IsHilighted())
{
- highlightGlobal (theIObj, getSelStyle (theIObj), aHiMode);
+ highlightGlobal (theIObj, getSelStyle (theIObj, theIObj->GlobalSelOwner()), theMode);
}
if (aStatus->IsSubIntensityOn())
{
}
const Standard_Integer anOldMode = theIObj->DisplayMode();
- if (myDisplayMode == anOldMode)
+ if (myDefaultDrawer->DisplayMode() == anOldMode)
{
return;
}
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
- aStatus->SetDisplayMode (myDisplayMode);
+ aStatus->SetDisplayMode (myDefaultDrawer->DisplayMode());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
if (myMainPM->IsHighlighted (theIObj, anOldMode))
{
- unhighlightGlobal (theIObj, anOldMode);
+ unhighlightGlobal (theIObj);
}
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
- myMainPM->Display (theIObj, myDisplayMode);
-
- Standard_Integer aDispMode, aHiMode, aSelMode;
- GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
+ myMainPM->Display (theIObj, myDefaultDrawer->DisplayMode());
if (aStatus->IsHilighted())
{
highlightSelected (theIObj->GlobalSelOwner());
}
if (aStatus->IsSubIntensityOn())
{
- highlightWithSubintensity (theIObj, myDisplayMode);
+ highlightWithSubintensity (theIObj, myDefaultDrawer->DisplayMode());
}
if (theToUpdateViewer)
{
if (myLastinMain->IsAutoHilight())
{
- const Standard_Integer aHiMode =
- theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
+ const Standard_Integer aHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
myLastinMain->HilightWithColor (myMainPM,
- myLastinMain->IsSelected() ? getSelStyle (theIObj) : getHiStyle (theIObj),
+ myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
aHiMode);
}
else
{
theIObj->HilightOwnerWithColor (myMainPM,
- myLastinMain->IsSelected() ? getSelStyle (theIObj) : getHiStyle (theIObj),
+ myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
myLastinMain);
}
}
setContextToObject (theIObj);
if (!theIObj->IsTransparent()
- && theValue <= 0.05)
+ && theValue <= 0.005)
{
return;
}
- if (theValue <= 0.05)
+ if (theValue <= 0.005)
{
UnsetTransparency (theIObj, theToUpdateViewer);
return;
theDispMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
- : (theIObj->AcceptDisplayMode (myDisplayMode)
- ? myDisplayMode
+ : (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
+ ? myDefaultDrawer->DisplayMode()
: 0);
theHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
theSelMode = theIObj->GlobalSelectionMode();
}
else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
{
- unhighlightGlobal (theIObj, aStatus->DisplayMode());
+ unhighlightGlobal (theIObj);
}
Standard_ENABLE_DEPRECATION_WARNINGS
}
if (aStatus->IsHilighted()
&& theIObj->HasHilightMode())
{
- unhighlightGlobal (theIObj, aDispMode);
+ unhighlightGlobal (theIObj);
}
if (!myLastPicked.IsNull()
if (aDispMode == theMode
&& myMainPM->IsHighlighted (theIObj, theMode))
{
- unhighlightGlobal (theIObj, theMode);
+ unhighlightGlobal (theIObj);
}
myMainPM->Erase (theIObj, theMode);
#include <AIS_KindOfInteractive.hxx>
#include <Standard_Real.hxx>
#include <Aspect_TypeOfFacingModel.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
#include <Standard_ShortReal.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <Standard_CString.hxx>
#include <AIS_Selection.hxx>
+#include <Prs3d_TypeOfHighlight.hxx>
class SelectMgr_SelectionManager;
class V3d_Viewer;
class AIS_InteractiveObject;
//! Removes all the objects from all opened Local Contexts
//! and from the Neutral Point
Standard_EXPORT void RemoveAll (const Standard_Boolean updateviewer = Standard_True);
-
//! Updates the display in the viewer to take dynamic
//! detection into account. On dynamic detection by the
Standard_DEPRECATED("Deprecated method Hilight()")
void Hilight (const Handle(AIS_InteractiveObject)& theObj, const Standard_Boolean theIsToUpdateViewer = Standard_True)
{
- return HilightWithColor (theObj, mySelStyle, theIsToUpdateViewer);
+ return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
}
//! Changes the color of all the lines of the object in view,
//! Object activates the selection mode; the object is
//! displayed but no viewer will be updated.
Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Boolean theIsToUpdate = Standard_True);
//! Returns highlight style of the object if it is marked as highlighted via global status
//! @param theObj [in] the object to check
Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
- Handle(Graphic3d_HighlightStyle)& theStyle) const;
+ Handle(Prs3d_Drawer)& theStyle) const;
//! Returns highlight style of the owner if it is selected
//! @param theOwner [in] the owner to check
Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
- Handle(Graphic3d_HighlightStyle)& theStyle) const;
+ Handle(Prs3d_Drawer)& theStyle) const;
//! Returns the display priority of the entity anIobj. This
//! will be display mode of anIobj if it is in the main
//! Returns the display mode setting.
//! Note that mode 3 is only used.
- Standard_Integer DisplayMode() const;
-
+ Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
+
+ //! Returns highlight style settings.
+ const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
+
+ //! Setup highlight style settings.
+ void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
+ const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
//! Returns current dynamic highlight style settings.
//! By default:
//! - the color of dynamic highlight is Quantity_NOC_CYAN1;
//! - the presentation for dynamic highlight is completely opaque;
//! - the type of highlight is Aspect_TOHM_COLOR.
- const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const
+ const Handle(Prs3d_Drawer)& HighlightStyle() const
{
- return myHiStyle;
+ return myStyles[Prs3d_TypeOfHighlight_Dynamic];
}
//! Setup the style of dynamic highlighting.
- void SetHighlightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle) { myHiStyle = theStyle; }
+ void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
//! Returns current selection style settings.
//! By default:
//! - the color of selection is Quantity_NOC_GRAY80;
//! - the presentation for selection is completely opaque;
//! - the type of highlight is Aspect_TOHM_COLOR.
- const Handle(Graphic3d_HighlightStyle)& SelectionStyle() const
+ const Handle(Prs3d_Drawer)& SelectionStyle() const
{
- return mySelStyle;
+ return myStyles[Prs3d_TypeOfHighlight_Selected];
}
//! Setup the style of selection highlighting.
- void SetSelectionStyle (const Handle(Graphic3d_HighlightStyle)& theStyle) { mySelStyle = theStyle; }
-
- //! Returns the name of the color used to show preselection.
- //! By default, this is Quantity_NOC_GREEN.
- Quantity_NameOfColor PreSelectionColor() const;
-
-
- //! Returns the name of the color used by default.
- //! By default, this is Quantity_NOC_GOLDENROD.
- Quantity_NameOfColor DefaultColor() const;
-
+ void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
//! Sub-intensity allows temporary highlighting of particular
//! objects with specified color in a manner of selection highlight,
//! By default, it is Quantity_NOC_GRAY40.
const Quantity_Color& SubIntensityColor() const
{
- return mySubintStyle->Color();
+ return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
}
//! Sub-intensity allows temporary highlighting of particular
//! By default, this is Quantity_NOC_GRAY40.
void SetSubIntensityColor (const Quantity_Color& theColor)
{
- mySubintStyle->SetColor (theColor);
+ myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
}
- //! Allows you to set the color used to show preselection.
- //! By default, this is Quantity_NOC_GREEN.
- //! A preselected entity is one which has been selected
- //! as the domain of application of a function such as a fillet.
- void SetPreselectionColor (const Quantity_NameOfColor aCol);
-
//! Sets the display mode of seen Interactive Objects.
//! aMode provides the display mode index of the entity aniobj.
//! If updateviewer equals Standard_True, the
//! Specify whether selected object must be hilighted when mouse cursor
//! is moved above it (in MoveTo method). By default this value is false and
//! selected object is not hilighted in this case.
- void SetToHilightSelected (const Standard_Boolean toHilight);
-
+ void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
+
//! Return value specified whether selected object must be hilighted
//! when mouse cursor is moved above it
- Standard_Boolean ToHilightSelected() const;
-
+ Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
//! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
//! local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void UpdateCurrent();
-
-
- //! Returns the current selection touched by the cursor.
- //! Objects selected when there is no open local context
- //! are called current objects; those selected in open
- //! local context, selected objects.
- Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
- Standard_Boolean WasCurrentTouched() const;
-
- Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
- void SetOkCurrent();
-
//! Returns true if there is a non-null interactive object in Neutral Point.
//! Objects selected when there is no open local context are called current objects;
//! Returns true if the automatic highlight mode is active
//! in an open context.
Standard_EXPORT Standard_Boolean AutomaticHilight() const;
-
- //! Enables/Disables the Z detection.
- //! If TRUE the detection echo can be partially hidden by the
- //! detected object.
- Standard_EXPORT void SetZDetection (const Standard_Boolean aStatus = Standard_False);
-
- //! Retrieves the Z detection state.
- Standard_EXPORT Standard_Boolean ZDetection() const;
-
+
//! Activates the selection mode aMode whose index is
//! given, for the given interactive entity anIobj.
Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
//! Returns the list of filters active in a local context.
Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
-
//! Returns the default attribute manager.
//! This contains all the color and line attributes which
//! can be used by interactive objects which do not have
//! their own attributes.
- const Handle(Prs3d_Drawer)& DefaultDrawer() const;
-
+ const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
+
//! Returns the current viewer.
- const Handle(V3d_Viewer)& CurrentViewer() const;
-
+ const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
+
//! Returns the list of displayed objects of a particular
//! Type WhichKind and Signature WhichSignature. By
//! Default, WhichSignature equals -1. This means that
Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
//! Returns true if there is an open context.
- Standard_Boolean HasOpenedContext() const;
+ Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
//! This method is only intended for advanced operation, particularly with
//! the aim to improve performance when many objects have to be selected
//! class AIS_InteractiveContext without trying to obtain an instance of
//! AIS_LocalContext.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
- Handle(AIS_LocalContext) LocalContext() const;
-
- const Handle(SelectMgr_SelectionManager)& SelectionManager() const;
-
- const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const;
-
- const Handle(StdSelect_ViewerSelector3d)& MainSelector() const;
+ Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
+
+ const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
+ const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
+
+ const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
+
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
//! for AutoHighlight, e.g. is used for selection.
//! If global owner is null, it simply highlights the whole object
Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
- const Standard_Integer theMode) const;
+ const Handle(Prs3d_Drawer)& theStyle,
+ const Standard_Integer theDispMode) const;
//! Helper function that unhighlights all owners that are stored in current AIS_Selection.
//! The function updates global status and selection state of owner and interactive object.
//! Helper function that unhighlights global selection owner of given interactive.
//! The function does not perform any updates of global or owner status
- Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode) const;
+ Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
//! Helper function that turns on sub-intensity in global status and highlights
//! given objects with sub-intensity color
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
//! dynamic highlight style of interactive context will be returned.
//! @param theObj [in] the object to check
- const Handle(Graphic3d_HighlightStyle)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj) const
+ const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
- const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
- ? aHiDrawer->HighlightStyle() : myHiStyle;
+ const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
+ if (!aHiDrawer.IsNull())
+ {
+ return aHiDrawer;
+ }
+
+ return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
}
//! Helper function that returns correct selection style for the object:
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
//! selection style of interactive context will be returned.
//! @param theObj [in] the object to check
- const Handle(Graphic3d_HighlightStyle)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const
+ const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
- ? aHiDrawer->SelectionStyle() : mySelStyle;
+ if (!aHiDrawer.IsNull())
+ {
+ return aHiDrawer;
+ }
+
+ return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
}
//! Assign the context to the object or throw exception if object was already assigned to another context.
}
}
+ //! Return display mode for highlighting.
+ Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
+ const Handle(Prs3d_Drawer)& theStyle,
+ const Standard_Integer theDispMode) const
+ {
+ if (!theStyle.IsNull()
+ && theStyle->DisplayMode() != -1
+ && theObj->AcceptDisplayMode (theStyle->DisplayMode()))
+ {
+ return theStyle->DisplayMode();
+ }
+ else if (theDispMode != -1)
+ {
+ return theDispMode;
+ }
+ else if (theObj->HasDisplayMode())
+ {
+ return theObj->DisplayMode();
+ }
+ return myDefaultDrawer->DisplayMode();
+ }
+
protected:
AIS_DataMapOfIOStatus myObjects;
Handle(SelectMgr_EntityOwner) myLastPicked;
Handle(SelectMgr_EntityOwner) myLastinMain;
Standard_Boolean myWasLastMain;
- Standard_Boolean myCurrentTouched;
- Standard_Boolean mySelectedTouched;
Standard_Boolean myToHilightSelected;
+ Handle(AIS_Selection) mySelection;
Handle(SelectMgr_OrFilter) myFilters;
Handle(Prs3d_Drawer) myDefaultDrawer;
- Handle(AIS_Selection) mySelection;
- Quantity_NameOfColor myDefaultColor;
- Handle(Graphic3d_HighlightStyle) myHiStyle;
- Handle(Graphic3d_HighlightStyle) mySelStyle;
- Quantity_NameOfColor myPreselectionColor;
- Handle(Graphic3d_HighlightStyle) mySubintStyle;
- Standard_Integer myDisplayMode;
+ Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
AIS_DataMapOfILC myLocalContexts;
Standard_Integer myCurLocalIndex;
Handle(V3d_View) mylastmoveview;
TColStd_SequenceOfInteger myDetectedSeq;
Standard_Integer myCurDetected;
Standard_Integer myCurHighlighted;
- Standard_Boolean myZDetectionFlag;
Standard_Boolean myIsAutoActivateSelMode;
};
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
-#include <AIS_InteractiveContext.lxx>
-
#endif // _AIS_InteractiveContext_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline const Handle(V3d_Viewer)& AIS_InteractiveContext::CurrentViewer() const
-{
- return myMainVwr;
-}
-
-inline Quantity_NameOfColor AIS_InteractiveContext::PreSelectionColor() const
-{
- return myPreselectionColor;
-}
-
-inline Quantity_NameOfColor AIS_InteractiveContext::DefaultColor() const
-{ return myDefaultColor;
-}
-
-inline void AIS_InteractiveContext::SetPreselectionColor(const Quantity_NameOfColor aCol)
-{
- myPreselectionColor = aCol;
-}
-
-inline Standard_Integer AIS_InteractiveContext::DisplayMode() const
-{
- return myDisplayMode;
-}
-
-inline const Handle(Prs3d_Drawer)& AIS_InteractiveContext::DefaultDrawer() const
-{return myDefaultDrawer;}
-inline const Handle(SelectMgr_SelectionManager)& AIS_InteractiveContext::SelectionManager() const
-{return mgrSelector ;}
-
-inline const Handle(PrsMgr_PresentationManager3d)& AIS_InteractiveContext::MainPrsMgr() const
-{return myMainPM ;}
-
-inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const
-{return myCurLocalIndex != 0;}
-
-inline Handle(AIS_LocalContext) AIS_InteractiveContext::LocalContext() const
-{ return (myCurLocalIndex > 0) ? myLocalContexts(myCurLocalIndex) : NULL; }
-
-inline Standard_Boolean AIS_InteractiveContext::WasCurrentTouched() const
-{return myCurrentTouched;}
-
-inline void AIS_InteractiveContext::SetOkCurrent()
-{myCurrentTouched= Standard_False;}
-
-
-inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::MainSelector() const
-{return myMainSel;}
-
-inline void AIS_InteractiveContext::SetToHilightSelected(const Standard_Boolean toHilight)
-{
- myToHilightSelected = toHilight;
-}
-
-inline Standard_Boolean AIS_InteractiveContext::ToHilightSelected() const
-{
- return myToHilightSelected;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(V3d_Viewer)& theViewer)
{
- const Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (anObj.IsNull())
+ {
return;
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
+ }
+
+ const Handle(Prs3d_Drawer)& aStyle = getHiStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
myMainPM->BeginImmediateDraw();
- theOwner->HilightWithColor (myMainPM, getHiStyle (anObj), aHiMode);
+ theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
myMainPM->EndImmediateDraw (theViewer.IsNull() ? myMainVwr : theViewer);
}
//=======================================================================
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner)
{
- const Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (anObj.IsNull())
+ {
return;
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
+ }
if (!theOwner->IsAutoHilight())
{
}
else
{
- theOwner->HilightWithColor (myMainPM, getSelStyle (anObj), aHiMode);
+ const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
+ theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
}
}
//purpose :
//=======================================================================
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
- const Standard_Integer theMode) const
+ const Handle(Prs3d_Drawer)& theStyle,
+ const Standard_Integer theDispMode) const
{
if (theObj.IsNull())
+ {
return;
+ }
+
+ const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, theDispMode);
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
if (aGlobOwner.IsNull())
{
- myMainPM->Color (theObj, theStyle, theMode);
+ myMainPM->Color (theObj, theStyle, aHiMode);
return;
}
}
else
{
- aGlobOwner->HilightWithColor (myMainPM, theStyle, theMode);
+ aGlobOwner->HilightWithColor (myMainPM, theStyle, aHiMode);
}
}
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ Handle(AIS_GlobalStatus) aStatus;
+ if (!myObjects.Find (anInteractive, aStatus))
+ {
+ continue;
+ }
+
if (anOwner->IsAutoHilight())
{
- const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
+ anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
- if (myObjects.IsBound (anInteractive) && myObjects (anInteractive)->IsSubIntensityOn())
+ if (aStatus->IsSubIntensityOn())
{
+ const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
}
}
}
else
{
- if (!anObjToClear.Contains (anInteractive))
- anObjToClear.Add (anInteractive);
+ anObjToClear.Add (anInteractive);
}
- anOwner->State (0);
+ anOwner->SetSelected (Standard_False);
if (anOwner == anInteractive->GlobalSelOwner())
{
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObj = anIter.Value();
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
- myMainPM->Unhighlight (anObj, aHiMode);
+ myMainPM->Unhighlight (anObj);
anObj->ClearSelected();
}
}
//function : unhighlightGlobal
//purpose :
//=======================================================================
-void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
- const Standard_Integer theMode) const
+void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const
{
if (theObj.IsNull())
+ {
return;
- const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
+ }
+ const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
if (aGlobOwner.IsNull())
{
- myMainPM->Unhighlight (theObj, theMode);
+ myMainPM->Unhighlight (theObj);
return;
}
if (aGlobOwner->IsAutoHilight())
{
- aGlobOwner->Unhilight (myMainPM, theMode);
+ aGlobOwner->Unhilight (myMainPM);
}
else
{
- myMainPM->Unhighlight (theObj, theMode);
+ myMainPM->Unhighlight (theObj);
theObj->ClearSelected();
}
}
const Standard_Integer theDispMode,
const Standard_Boolean theIsDisplayedOnly) const
{
- // the only differ with selection highlight is color, so
- // sync transparency values
- mySubintStyle->SetTransparency (mySelStyle->Transparency());
+ // the only differ with selection highlight is color, so sync transparency values
+ const Handle(Prs3d_Drawer)& aSubStyle = myStyles[Prs3d_TypeOfHighlight_SubIntensity];
+ aSubStyle->SetTransparency (myStyles[Prs3d_TypeOfHighlight_Selected]->Transparency());
if (theObject.IsNull())
{
continue;
aStatus->SubIntensityOn();
-
- if (theDispMode == -1)
- {
- myMainPM->Color (anObjsIter.Key(), mySubintStyle, aStatus->DisplayMode());
- }
- else
- myMainPM->Color (anObjsIter.Key(), mySubintStyle, theDispMode);
+ myMainPM->Color (anObjsIter.Key(), aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
}
}
else
return;
if (aStatus->GraphicStatus() != AIS_DS_Displayed && theIsDisplayedOnly)
- return;
+ return;
aStatus->SubIntensityOn();
-
- if (theDispMode == -1)
- {
- myMainPM->Color (theObject, mySubintStyle, aStatus->DisplayMode());
- }
- else
- myMainPM->Color (theObject, mySubintStyle, theDispMode);
+ myMainPM->Color (theObject, aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
}
}
{
// the only differ with selection highlight is color, so
// sync transparency values
- mySubintStyle->SetTransparency (mySelStyle->Transparency());
+ myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetTransparency (myStyles[Prs3d_TypeOfHighlight_Selected]->Transparency());
- myMainPM->Color (theObject, mySubintStyle, theMode);
+ myMainPM->Color (theObject, myStyles[Prs3d_TypeOfHighlight_SubIntensity], theMode);
}
//=======================================================================
{
// the only differ with selection highlight is color, so
// sync transparency values
- mySubintStyle->SetTransparency (mySelStyle->Transparency());
+ myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetTransparency (myStyles[Prs3d_TypeOfHighlight_Selected]->Transparency());
- theOwner->HilightWithColor (myMainPM, mySubintStyle, theMode);
+ theOwner->HilightWithColor (myMainPM, myStyles[Prs3d_TypeOfHighlight_SubIntensity], theMode);
}
//=======================================================================
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
{
myMainPM->ClearImmediateDraw();
- const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
- const Standard_Integer aHiMod = aLastPickedAIS->HasHilightMode() ? aLastPickedAIS->HilightMode() : 0;
if (!myLastPicked->IsSelected())
{
- myLastPicked->Unhilight (myMainPM, aHiMod);
+ myLastPicked->Unhilight (myMainPM);
toUpdateViewer = Standard_True;
}
else if (myToHilightSelected)
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
{
myMainPM->ClearImmediateDraw();
- const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
- Standard_Integer aHiMod = aLastPickedAIS->HasHilightMode() ? aLastPickedAIS->HilightMode() : 0;
if (!myLastPicked->IsSelected())
{
if (myLastPicked->IsAutoHilight())
{
- myLastPicked->Unhilight (myMainPM, aHiMod);
+ myLastPicked->Unhilight (myMainPM);
}
toUpdateViewer = Standard_True;
}
continue;
mySelection->Select (aCurOwner);
- aCurOwner->State (1);
+ aCurOwner->SetSelected (Standard_True);
}
HilightSelected (toUpdateViewer);
continue;
mySelection->Select (anOwner);
- anOwner->State (1);
+ anOwner->SetSelected (Standard_True);
}
HilightSelected (toUpdateViewer);
continue;
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
- Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
- anOwner->State (aState);
+ anOwner->SetSelected (aSelStatus == AIS_SS_Added);
}
HilightSelected (toUpdateViewer);
continue;
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
- Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
- anOwner->State (aState);
+ anOwner->SetSelected (aSelStatus == AIS_SS_Added);
}
HilightSelected (toUpdateViewer);
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- const Handle(Graphic3d_HighlightStyle)& anObjSelStyle = getSelStyle (anObj);
+ const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
+ Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
if (anOwner == anObj->GlobalSelOwner())
{
- Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
}
- anOwner->State (1);
+ anOwner->SetSelected (Standard_True);
if (!anOwner->IsAutoHilight())
{
NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
}
else
{
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
+ const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
}
- anOwner->State (0);
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
+ anOwner->SetSelected (Standard_False);
+ anOwner->Unhilight (myMainPM);
}
if (theToUpdateViewer)
void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Boolean theToUpdateViewer)
{
- if(HasOpenedContext())
+ if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->SetSelected (theObject, theToUpdateViewer);
}
if (theObject.IsNull())
+ {
return;
- if(!myObjects.IsBound (theObject))
+ }
+
+ if (!myObjects.IsBound (theObject))
+ {
Display (theObject, Standard_False);
+ }
if (!theObject->HasSelection (theObject->GlobalSelectionMode()))
+ {
return;
+ }
+ Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
+ if (anOwner.IsNull())
+ {
+ return;
+ }
- const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
- getSelStyle (theObject);
-
+ const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (theObject, anOwner);
if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
{
- Handle(Graphic3d_HighlightStyle) aCustomStyle;
+ Handle(Prs3d_Drawer) aCustomStyle;
if (HighlightStyle (theObject, aCustomStyle))
{
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
- if (!myFilters->IsOk (anOwner))
+ const Handle(SelectMgr_EntityOwner) aSelOwner = mySelection->Value();
+ if (!myFilters->IsOk (aSelOwner))
{
continue;
}
- Handle(AIS_InteractiveObject) aSelectable =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ Handle(AIS_InteractiveObject) aSelectable = Handle(AIS_InteractiveObject)::DownCast (aSelOwner->Selectable());
Unhilight (aSelectable, Standard_False);
- anOwner->State (0);
- if (anOwner == aSelectable->GlobalSelOwner())
+ aSelOwner->SetSelected (Standard_False);
+ if (aSelOwner == aSelectable->GlobalSelOwner())
{
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
}
}
// added to avoid untimely viewer update...
- Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
- if (anOwner.IsNull())
- return;
mySelection->ClearAndSelect (anOwner);
- Handle(Graphic3d_HighlightStyle) aCustomStyle;
+ Handle(Prs3d_Drawer) aCustomStyle;
if (HighlightStyle (theObject, aCustomStyle))
{
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
{
HilightWithColor (theObject, anObjSelStyle, Standard_False);
}
- anOwner->State (1);
+ anOwner->SetSelected (Standard_True);
if (theToUpdateViewer)
UpdateCurrentViewer();
if (theOwner.IsNull() || !theOwner->HasSelectable() || !myFilters->IsOk (theOwner))
return;
- const Handle(AIS_InteractiveObject) anObject =
- Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
- getSelStyle (anObject);
-
+ const Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
+ const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObject, theOwner);
if (NbSelected() == 1 && theOwner->IsSelected())
{
- Handle(Graphic3d_HighlightStyle) aCustomStyle;
+ Handle(Prs3d_Drawer) aCustomStyle;
if (HighlightStyle (theOwner, aCustomStyle))
{
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
unhighlightSelected();
mySelection->ClearAndSelect (theOwner);
- Handle(Graphic3d_HighlightStyle) aCustomStyle;
+ Handle(Prs3d_Drawer) aCustomStyle;
if (!HighlightStyle (theOwner, aCustomStyle) ||
(!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
{
+ theOwner->SetSelected (Standard_True);
highlightSelected (theOwner);
}
- theOwner->State (1);
+ theOwner->SetSelected (Standard_True);
if (theOwner == anObject->GlobalSelOwner())
{
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
return;
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
-
- Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
- theOwner->State (aState);
+ theOwner->SetSelected (aSelStat == AIS_SS_Added);
const Handle(AIS_InteractiveObject) anObj =
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
- if (aState == 1)
+ if (theOwner->IsSelected())
{
highlightSelected (theOwner);
if (isGlobal)
{
aStatus->SetHilightStatus (Standard_True);
- aStatus->SetHilightStyle (getSelStyle (anObj));
+ aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
}
}
else
{
if (theOwner->IsAutoHilight())
- theOwner->Unhilight (myMainPM, aHiMode);
+ {
+ theOwner->Unhilight (myMainPM);
+ }
else
+ {
anObj->ClearSelected();
+ }
aStatus->SetHilightStatus (Standard_False);
- aStatus->SetHilightStyle (new Graphic3d_HighlightStyle());
+ aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
if (theToUpdateViewer)
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated || theObj->GlobalSelOwner().IsNull())
return Standard_False;
- return theObj->GlobalSelOwner()->State() == 1;
+ return theObj->GlobalSelOwner()->IsSelected();
}
//=======================================================================
// the entities eventually detected just before the context was opened are unhighlighted...
if(!IsSelected(myLastPicked)){
if(!myLastPicked.IsNull()){
- const Handle(AIS_InteractiveObject) aLastPickedAIS =
- Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
- Standard_Integer HiMod = aLastPickedAIS->HasHilightMode()?aLastPickedAIS->HilightMode():0;
- unhighlightGlobal (aLastPickedAIS, HiMod);
+ const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
+ unhighlightGlobal (aLastPickedAIS);
}}
if(!mylastmoveview.IsNull()){
if(GB->GraphicStatus() == AIS_DS_Displayed)
{
- myMainPM->Unhighlight (anIObj, GB->DisplayMode());
+ myMainPM->Unhighlight (anIObj);
UpdMain = Standard_True;
}
- Standard_Integer DM,HM,SM;
- GetDefModes(anIObj,DM,HM,SM);
if(IsSelected(anIObj))
highlightSelected (anIObj->GlobalSelOwner());
}
}
else {
- const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
- getSelStyle (anIObj);
+ const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anIObj, anIObj->GlobalSelOwner());
if(myObjects.IsBound(anIObj)){
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
STAT->SubIntensityOff();
- myMainPM->Unhighlight (anIObj, STAT->DisplayMode());
+ myMainPM->Unhighlight (anIObj);
if (STAT->IsHilighted())
HilightWithColor (anIObj, anObjSelStyle, Standard_False);
}
myMainPM->Display (iobj, STAT->DisplayMode());
if(STAT->IsHilighted())
{
- const Handle(Graphic3d_HighlightStyle)& aStyle = STAT->HilightStyle();
- if (!aStyle.IsNull() && getSelStyle (iobj) != aStyle)
+ const Handle(Prs3d_Drawer)& aStyle = STAT->HilightStyle();
+ if (!aStyle.IsNull() && getSelStyle (iobj, iobj->GlobalSelOwner()) != aStyle)
HilightWithColor(iobj,aStyle,Standard_False);
}
//part selection
myMainVwr->Update();
}
}
-
-//=======================================================================
-//function : SetZDetection
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
-{
- myZDetectionFlag = aStatus;
-}
-
-//=======================================================================
-//function : ZDetection
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::ZDetection() const
-{
- return myZDetectionFlag;
-}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// Modified : 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
+#include <AIS_InteractiveObject.hxx>
#include <AIS_GraphicTool.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Bnd_Box.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
//function : AIS_InteractiveObject
//purpose :
//=======================================================================
-AIS_InteractiveObject::
-AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
-SelectMgr_SelectableObject(aTypeOfPresentation3d),
-myTransparency(0.),
-myOwnColor(Quantity_NOC_WHITE),
-myOwnMaterial(Graphic3d_NOM_DEFAULT),
-myHilightMode(-1),
-myOwnWidth(0.0),
-myInfiniteState(Standard_False),
-hasOwnColor(Standard_False),
-hasOwnMaterial(Standard_False),
-myCurrentFacingModel(Aspect_TOFM_BOTH_SIDE),
-myRecomputeEveryPrs(Standard_True),
-myCTXPtr(NULL),
-mySelPriority(-1),
-myDisplayMode (-1)
+AIS_InteractiveObject::AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
+: SelectMgr_SelectableObject (aTypeOfPresentation3d),
+ myCTXPtr (NULL),
+ myOwnWidth (0.0),
+ myOwnMaterial (Graphic3d_NOM_DEFAULT),
+ myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
+ myInfiniteState (Standard_False),
+ hasOwnColor (Standard_False),
+ hasOwnMaterial (Standard_False),
+ myRecomputeEveryPrs (Standard_True)
{
SetCurrentFacingModel();
}
}
//=======================================================================
-//function :
-//purpose :
+//function : SetDisplayMode
+//purpose :
//=======================================================================
-void AIS_InteractiveObject::SetDisplayMode(const Standard_Integer aMode)
+void AIS_InteractiveObject::SetDisplayMode (const Standard_Integer theMode)
{
- if( AcceptDisplayMode(aMode) )
- myDisplayMode = aMode;
+ if (AcceptDisplayMode (theMode))
+ {
+ myDrawer->SetDisplayMode (theMode);
+ }
}
//=======================================================================
//purpose :
//=======================================================================
-void AIS_InteractiveObject::SetColor(const Quantity_Color &aColor)
+void AIS_InteractiveObject::SetColor(const Quantity_Color& theColor)
{
- myOwnColor = aColor;
+ myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
}
if (HasColor())
{
- SetColor (myOwnColor);
+ SetColor (myDrawer->Color());
}
if (IsTransparent())
{
- SetTransparency (myTransparency);
+ SetTransparency (myDrawer->Transparency());
}
}
else
FMat.SetTransparency(aValue); BMat.SetTransparency(aValue);
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
- myTransparency = aValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )aValue);
}
//=======================================================================
Handle (Prs3d_ShadingAspect) SA;
myDrawer->SetShadingAspect(SA);
}
- myTransparency =0.0;
+ myDrawer->SetTransparency (0.0f);
}
//=======================================================================
//function : Transparency
//=======================================================================
Standard_Real AIS_InteractiveObject::Transparency() const
{
- return (myTransparency<=0.05 ? 0 : myTransparency);
+ return (myDrawer->Transparency() <= 0.005f ? 0.0 : myDrawer->Transparency());
// Graphic3d_MaterialAspect Mat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
// return Mat.Transparency();
}
hasOwnColor = Standard_False;
hasOwnMaterial = Standard_False;
myOwnWidth = 0.0;
- myTransparency = 0.0;
+ myDrawer->SetTransparency (0.0f);
}
//=======================================================================
//=======================================================================
Standard_Boolean AIS_InteractiveObject::HasPresentation() const
{
- return !GetContext().IsNull()
- && GetContext()->MainPrsMgr()->HasPresentation (this, myDisplayMode);
+ return HasInteractiveContext()
+ && myCTXPtr->MainPrsMgr()->HasPresentation (this, myDrawer->DisplayMode());
}
//=======================================================================
//=======================================================================
Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const
{
- return HasPresentation()
- ? GetContext()->MainPrsMgr()->Presentation (this, myDisplayMode)->Presentation()
+ if (!HasInteractiveContext())
+ {
+ return Handle(Prs3d_Presentation)();
+ }
+
+ Handle(PrsMgr_Presentation) aPrs = myCTXPtr->MainPrsMgr()->Presentation (this, myDrawer->DisplayMode(), false);
+ return !aPrs.IsNull()
+ ? aPrs->Presentation()
: Handle(Prs3d_Presentation)();
}
continue;
}
- Handle(Graphic3d_AspectFillArea3d) aFaceAsp = new Graphic3d_AspectFillArea3d();
- Handle(Graphic3d_AspectLine3d) aLineAsp = new Graphic3d_AspectLine3d();
- Handle(Graphic3d_AspectMarker3d) aPntAsp = new Graphic3d_AspectMarker3d();
- Handle(Graphic3d_AspectText3d) aTextAsp = new Graphic3d_AspectText3d();
- // TODO: Add methods for retrieving individual aspects from Graphic3d_Group
- aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
+ Handle(Graphic3d_AspectFillArea3d) aFaceAsp = aGrp->FillAreaAspect();
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
}
//=======================================================================
void AIS_InteractiveObject::BoundingBox (Bnd_Box& theBndBox)
{
- if (myDisplayMode == -1)
+ if (myDrawer->DisplayMode() == -1)
{
if (!myPresentations.IsEmpty())
{
{
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
{
- if (myPresentations (aPrsIter).Mode() == myDisplayMode)
+ if (myPresentations (aPrsIter).Mode() == myDrawer->DisplayMode())
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
//! wireaspect field of the drawer, but for a vertex, only
//! the point aspect field is affected by the color)
//! WARNING : Do not forget to set the corresponding fields
- //! here (hasOwnColor and myOwnColor)
+ //! here (hasOwnColor and myDrawer->SetColor())
Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor aColor);
//! Removes color settings. Only the Interactive Object
//! Returns true if the Interactive Object has a display
//! mode setting. Otherwise, it is displayed in Neutral Point.
- Standard_Boolean HasDisplayMode() const { return myDisplayMode != -1; }
+ Standard_Boolean HasDisplayMode() const { return myDrawer->DisplayMode() != -1; }
//! Sets the display mode aMode for the interactive object.
//! An object can have its own temporary display mode,
Standard_EXPORT void SetDisplayMode (const Standard_Integer aMode);
//! Removes display mode settings from the interactive object.
- void UnsetDisplayMode() { myDisplayMode = -1; }
+ void UnsetDisplayMode() { myDrawer->SetDisplayMode (-1); }
//! Returns the display mode setting of the Interactive Object.
//! The range of possibilities is the following:
//! - AIS_Shaded
//! This range can, however, be extended through the
//! creation of new display modes.
- Standard_Integer DisplayMode() const { return myDisplayMode; }
-
- //! Returns the selection priority setting. -1 indicates that there is none.
- //! You can modify the selection priority of an owner to
- //! make one entity more selectionable than another one.
- //! The default selection priority for an owner is 5, for
- //! example. To increase selection priority, choose a
- //! setting between 5 and 10. An entity with priority 7 will
- //! take priority over one with a setting of 6 if both
- //! objects are selected at the same time.
- //! You could give vertices priority 8, edges priority 7,
- //! faces priority 6, and shapes priority 5. If a vertex, an
- //! edge and a face are simultaneously detected during
- //! selection, only the vertex will then be highlighted.
- //! For trihedra, for example, the default priorities are the following four:
- //! - priority 1 - a trihedron
- //! - priority 5 - its origin
- //! - priority 3 - its axes
- //! - priority 2 - its planes
- Standard_Integer SelectionPriority() const { return mySelPriority; }
-
- //! Allows you to provide a setting thePriority for selection priority.
- //! You can modify selection priority of an owner to make
- //! one entity more selectionable than another one. The
- //! default selection priority for an owner is 5, for
- //! example. To increase selection priority, choose a
- //! setting between 5 and 10. An entity with priority 7 will
- //! take priority over one with a setting of 6.
- void SetSelectionPriority (const Standard_Integer thePriority) { mySelPriority = thePriority; }
-
- //! Removes the setting for selection priority. SelectionPriority then returns -1.
- void UnsetSelectionPriority() { mySelPriority = -1; }
-
- //! Returns true if there is a setting for selection priority.
- //! You can modify selection priority of an owner to make
- //! one entity more selectionable than another one. The
- //! default selection priority for an owner is 5, for
- //! example. To increase selection priority, choose a
- //! setting between 5 and 10. An entity with priority 7 will
- //! take priority over one with a setting of 6.
- Standard_Boolean HasSelectionPriority() const { return mySelPriority != -1; }
+ Standard_Integer DisplayMode() const { return myDrawer->DisplayMode(); }
//! Returns true if the Interactive Object is in highlight mode.
- Standard_Boolean HasHilightMode() const { return myHilightMode != -1; }
-
- //! Returns the setting for highlight mode.
- //! At dynamic detection, the presentation echoed by the
- //! Interactive Context, is by default the presentation
- //! already on the screen. You can specify a Highlight
- //! presentation mode which is valid no matter what the
- //! active representation of the object. It makes no
- //! difference whether this choice is temporary or
- //! definitive. To do this, we use the following functions:
- //! - SetHilightMode
- //! - UnSetHilightMode
- //! In the case of a shape, whether it is visualized in
- //! wireframe presentation or with shading, we want to
- //! systematically highlight the wireframe presentation.
- //! Consequently, we set the highlight mode to 0.
- Standard_Integer HilightMode() const { return myHilightMode; }
-
- //! Sets the highlight mode theMode for the interactive object.
- //! If, for example, you want to systematically highlight
- //! the wireframe presentation of a shape - whether
- //! visualized in wireframe presentation or with shading -
- //! you set the highlight mode to 0.
- void SetHilightMode (const Standard_Integer theMode) { myHilightMode = theMode; }
-
- //! Allows the user to take a given Prs for hilight
- //! ex : for a shape which would be displayed in shading mode
- //! the hilight Prs is the wireframe mode.
- //! if No specific hilight mode is defined, the displayed Prs
- //! will be the hilighted one.
- void UnsetHilightMode() { myHilightMode = -1; }
+ Standard_Boolean HasHilightMode() const { return !myHilightDrawer.IsNull() && myHilightDrawer->DisplayMode() != -1; }
+
+ //! Returns highlight display mode.
+ //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
+ Standard_Integer HilightMode() const { return !myHilightDrawer.IsNull() ? myHilightDrawer->DisplayMode() : -1; }
+
+ //! Sets highlight display mode.
+ //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
+ void SetHilightMode (const Standard_Integer theMode)
+ {
+ if (myHilightDrawer.IsNull())
+ {
+ myHilightDrawer = new Prs3d_Drawer();
+ myHilightDrawer->Link (myDrawer);
+ myHilightDrawer->SetAutoTriangulation (Standard_False);
+ myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
+ myHilightDrawer->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
+ }
+ if (myDynHilightDrawer.IsNull())
+ {
+ myDynHilightDrawer = new Prs3d_Drawer();
+ myDynHilightDrawer->Link (myDrawer);
+ myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
+ myDynHilightDrawer->SetAutoTriangulation (Standard_False);
+ myDynHilightDrawer->SetZLayer(Graphic3d_ZLayerId_Top);
+ }
+ myHilightDrawer ->SetDisplayMode (theMode);
+ myDynHilightDrawer->SetDisplayMode (theMode);
+ }
+
+ //! Unsets highlight display mode.
+ void UnsetHilightMode()
+ {
+ if (!myHilightDrawer.IsNull())
+ {
+ myHilightDrawer->SetDisplayMode (-1);
+ }
+ if (!myDynHilightDrawer.IsNull())
+ {
+ myDynHilightDrawer->SetDisplayMode (-1);
+ }
+ }
//! Returns true if the Interactive Object has color.
Standard_Boolean HasColor() const { return hasOwnColor; }
//! Returns the color setting of the Interactive Object.
- virtual Quantity_NameOfColor Color() const { return myOwnColor.Name(); }
+ virtual Quantity_NameOfColor Color() const { return myDrawer->Color().Name(); }
- virtual void Color (Quantity_Color& theColor) const { theColor = myOwnColor; }
+ virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
//! Returns true if the Interactive Object has width.
Standard_Boolean HasWidth() const { return myOwnWidth != 0.0; }
Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
//! Returns true if there is a transparency setting.
- Standard_Boolean IsTransparent() const { return myTransparency > 0.005; }
+ Standard_Boolean IsTransparent() const { return myDrawer->Transparency() > 0.005f; }
//! Returns the transparency setting.
//! This will be between 0.0 and 1.0.
protected:
-
//! The TypeOfPresention3d means that the interactive object
//! may have a presentation dependant of the view of Display.
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
- Standard_Real myTransparency;
- Quantity_Color myOwnColor;
- Graphic3d_NameOfMaterial myOwnMaterial;
- Standard_Integer myHilightMode;
+private:
+
+ AIS_InteractiveContext* myCTXPtr;
+ Handle(Standard_Transient) myOwner;
+
+protected:
+
+ TColStd_ListOfInteger myToRecomputeModes;
Standard_Real myOwnWidth;
+ Graphic3d_NameOfMaterial myOwnMaterial;
+ Aspect_TypeOfFacingModel myCurrentFacingModel;
Standard_Boolean myInfiniteState;
Standard_Boolean hasOwnColor;
Standard_Boolean hasOwnMaterial;
- Aspect_TypeOfFacingModel myCurrentFacingModel;
Standard_Boolean myRecomputeEveryPrs;
- TColStd_ListOfInteger myToRecomputeModes;
-
-private:
-
- AIS_InteractiveContext* myCTXPtr;
- Handle(Standard_Transient) myOwner;
- Standard_Integer mySelPriority;
- Standard_Integer myDisplayMode;
};
+++ /dev/null
-// Created on: 1997-01-08
-// Created by: Robert COUBLANC
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline Standard_Boolean AIS_InteractiveObject::AcceptShapeDecomposition() const
-{return Standard_False;}
-
-
-inline Standard_Boolean AIS_InteractiveObject::IsInfinite() const
-{return myInfiniteState;}
-
-inline Standard_Boolean AIS_InteractiveObject::HasColor() const
-{return hasOwnColor;}
-
-inline const Handle(Standard_Transient)&
-AIS_InteractiveObject::GetOwner() const
-{return myOwner;}
-
-inline void AIS_InteractiveObject::SetOwner(const Handle(Standard_Transient)& ApplicativeEntity)
-{myOwner = ApplicativeEntity;}
-
-inline const TColStd_ListOfTransient&
-AIS_InteractiveObject::Users() const
-{return myUsers;}
-
-inline Standard_Boolean AIS_InteractiveObject::HasDisplayMode() const
-{return myDisplayMode!=-1;}
-
-inline void AIS_InteractiveObject::UnsetDisplayMode()
-{myDisplayMode =-1;}
-
-inline Standard_Integer AIS_InteractiveObject::DisplayMode() const
-{return myDisplayMode;}
-
-inline Quantity_NameOfColor AIS_InteractiveObject::Color() const
-{
- return myOwnColor.Name();
-}
-
-inline void AIS_InteractiveObject::Color(Quantity_Color& aColor) const
-{
- aColor = myOwnColor;
-}
-
-inline Standard_Boolean AIS_InteractiveObject::HasWidth() const
-{return !(myOwnWidth == 0.);}
-
-inline Standard_Real AIS_InteractiveObject::Width() const
-{return myOwnWidth;}
-inline Standard_Boolean AIS_InteractiveObject::HasMaterial() const
-{return hasOwnMaterial;}
-
-//POP pour K4L
-inline Graphic3d_NameOfMaterial AIS_InteractiveObject::Material() const
-//inline Graphic3d_NameOfPhysicalMaterial AIS_InteractiveObject::Material() const
-{return myOwnMaterial;}
-
-inline Standard_Boolean AIS_InteractiveObject::HasHilightMode() const
-{return myHilightMode!=-1;}
-
-inline Standard_Integer AIS_InteractiveObject::HilightMode() const
-{return myHilightMode;}
-
-inline void AIS_InteractiveObject::SetHilightMode(const Standard_Integer aMode)
-{myHilightMode = aMode;}
-
-inline void AIS_InteractiveObject::UnsetHilightMode()
-{myHilightMode = -1;}
-
-
-inline Standard_Boolean AIS_InteractiveObject::IsTransparent() const
-{return myTransparency >0.005;}
-
-inline Standard_Boolean AIS_InteractiveObject::HasSelectionPriority() const
-{return mySelPriority != -1;}
-inline void AIS_InteractiveObject::SetSelectionPriority(const Standard_Integer P)
-{mySelPriority = P;}
-inline void AIS_InteractiveObject::UnsetSelectionPriority()
-{mySelPriority = -1;}
-inline Standard_Integer AIS_InteractiveObject::SelectionPriority() const
-{return mySelPriority;}
-
-inline Standard_Integer AIS_InteractiveObject::State() const
-{return mystate;}
-
-inline void AIS_InteractiveObject::State(const Standard_Integer TheState)
-{mystate = TheState;}
-
void AIS_Line::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (aCol);
Standard_Real WW = HasWidth()? myOwnWidth:
myDrawer->HasLink() ?
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
else{
Quantity_Color CC = Quantity_NOC_YELLOW;
- if( HasColor() ) CC = myOwnColor;
+ if( HasColor() ) CC = myDrawer->Color();
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
myDrawer->LineAspect()->SetColor(CC);
- myOwnColor = CC;
+ myDrawer->SetColor (CC);
}
}
if (!myDrawer->HasOwnLineAspect ()) {
Quantity_Color CC = Quantity_NOC_YELLOW;
- if( HasColor() ) CC = myOwnColor;
+ if( HasColor() ) CC = myDrawer->Color();
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
myDrawer->SetLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
} else
mylastgood(0),
myCurDetected(0),
myAISCurDetected(0),
-mySubintStyle (new Graphic3d_HighlightStyle (aCtx->SelectionStyle()))
-
+mySubintStyle (new Prs3d_Drawer())
{
+ mySubintStyle->Link (aCtx->SelectionStyle());
+ mySubintStyle->SetColor (aCtx->SelectionStyle()->Color());
+ mySubintStyle->SetTransparency (aCtx->SelectionStyle()->Transparency());
+ mySubintStyle->SetMethod (aCtx->SelectionStyle()->Method());
+
// bind self to AIS_InteractiveContext::myLocalContexts. Further, the
// constructor executes logic that implies that the context is already
// created and mapped.
if(STAT->IsSubIntensityOn()) {
STAT->SubIntensityOff();
if(STAT->HilightMode()==aMode)
- myMainPM->Unhighlight(anInteractive,STAT->HilightMode());
+ myMainPM->Unhighlight(anInteractive);
}
myMainPM->Clear(anInteractive,aMode); // correction connexions 23/09/97
jobdone = Standard_True;
//Display step
if(STAT->IsSubIntensityOn()) {
STAT->SubIntensityOff();
- myMainPM->Unhighlight(anInteractive,STAT->HilightMode());
+ myMainPM->Unhighlight (anInteractive);
}
Standard_Boolean status(Standard_False);
if(IsSelected(anInteractive))
AddOrRemoveSelected(anInteractive);
if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode()))
- myMainPM->Unhighlight(anInteractive,STAT->HilightMode());
+ {
+ myMainPM->Unhighlight (anInteractive);
+ }
myMainPM->SetVisibility (anInteractive, STAT->DisplayMode(), Standard_False);
STAT->SetDisplayMode(-1);
status = Standard_True;
{
if (Att->IsSubIntensityOn())
{
- myMainPM->Unhighlight (aSelectable, Att->HilightMode());
+ myMainPM->Unhighlight (aSelectable);
}
myMainPM->Erase (aSelectable, Att->DisplayMode());
}
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
- myMainPM->Color(anObject, getHiStyle (anObject), Att->HilightMode());
+ myMainPM->Color(anObject, myCTX->getHiStyle (anObject, anObject->GlobalSelOwner()), Att->HilightMode());
Att->SubIntensityOn();
}
//=======================================================================
//=======================================================================
void AIS_LocalContext::Hilight (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle)
+ const Handle(Prs3d_Drawer)& theStyle)
{
if (!myActiveObjects.IsBound (theObj))
{
Standard_ENABLE_DEPRECATION_WARNINGS
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
- myMainPM->Unhighlight(anObject,Att->HilightMode());
+ myMainPM->Unhighlight (anObject);
if(Att->IsTemporary() && Att->DisplayMode()==-1)
if(!IsSomeWhereElse)
myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False);
Att->SubIntensityOff();
- Att->SetHilightStyle (new Graphic3d_HighlightStyle());
+ Att->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}
Standard_Boolean AIS_LocalContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
- Handle(Graphic3d_HighlightStyle)& theStyle) const
+ Handle(Prs3d_Drawer)& theStyle) const
{
if (!myActiveObjects.IsBound (theObject))
return Standard_False;
// if object is temporary the presentations managed by myMainPM are removed
AIS_DisplayStatus TheDS = myCTX->DisplayStatus(SO);
- if(TheDS != AIS_DS_Displayed){
- if(myMainPM->IsDisplayed(SO,CurAtt->DisplayMode())){
- if(CurAtt->IsSubIntensityOn()&&
- myMainPM->IsHighlighted(SO,CurAtt->HilightMode()))
- myMainPM->Unhighlight(SO,CurAtt->HilightMode());
- myMainPM->Erase(SO,CurAtt->DisplayMode());
- }
-
- if(CurAtt->IsTemporary()){
- myMainPM->Erase(SO,CurAtt->DisplayMode());}
-// myMainPM->Clear(SO,CurAtt->DisplayMode());}
+ if(TheDS != AIS_DS_Displayed)
+ {
+ if (myMainPM->IsDisplayed(SO,CurAtt->DisplayMode()))
+ {
+ if (CurAtt->IsSubIntensityOn() && myMainPM->IsHighlighted (SO, CurAtt->HilightMode()))
+ {
+ myMainPM->Unhighlight (SO);
+ }
+ myMainPM->Erase (SO, CurAtt->DisplayMode());
+ }
+
+ if (CurAtt->IsTemporary())
+ {
+ myMainPM->Erase (SO, CurAtt->DisplayMode());
+ //myMainPM->Clear(SO,CurAtt->DisplayMode());
+ }
}
else {
if (CurAtt->IsSubIntensityOn())
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle);
+ const Handle(Prs3d_Drawer)& theStyle);
Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
- Handle(Graphic3d_HighlightStyle)& theStyle) const;
+ Handle(Prs3d_Drawer)& theStyle) const;
//! Define the current selection sensitivity for
//! this local context according to the view size.
//! stored in local status
Standard_EXPORT void RestoreActivatedModes() const;
-
-
-
DEFINE_STANDARD_RTTIEXT(AIS_LocalContext,MMgt_TShared)
-protected:
-
- //! Helper function that returns correct dynamic highlight style for the object:
- //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
- //! dynamic highlight style of interactive context will be returned.
- //! @param theObj [in] the object to check
- Standard_EXPORT const Handle(Graphic3d_HighlightStyle)& getHiStyle (const Handle(SelectMgr_SelectableObject)& theObj) const;
-
- //! Helper function that returns correct selection style for the object:
- //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
- //! selection style of interactive context will be returned.
- //! @param theObj [in] the object to check
- Standard_EXPORT const Handle(Graphic3d_HighlightStyle)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const;
-
private:
Standard_Integer myCurDetected;
AIS_SequenceOfInteractive myAISDetectedSeq;
Standard_Integer myAISCurDetected;
- Handle(Graphic3d_HighlightStyle) mySubintStyle;
+ Handle(Prs3d_Drawer) mySubintStyle;
};
TopoDS_Shape AIS_myDummyShape;
}
-static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
-{
- return IO->HasHilightMode() ? IO->HilightMode():0;
-}
-
-//=======================================================================
-//function : getHiStyle
-//purpose :
-//=======================================================================
-const Handle(Graphic3d_HighlightStyle)& AIS_LocalContext::getHiStyle (const Handle(SelectMgr_SelectableObject)& theObj) const
-{
- const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
- ? aHiDrawer->HighlightStyle() : myCTX->HighlightStyle();
-}
-
-//=======================================================================
-//function : getSelStyle
-//purpose :
-//=======================================================================
-const Handle(Graphic3d_HighlightStyle)& AIS_LocalContext::getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const
-{
- const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
- ? aHiDrawer->SelectionStyle() : myCTX->SelectionStyle();
-}
-
//==================================================
// Function: MoveTo
// Purpose :
return;
}
- const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ const Handle(Prs3d_Drawer)& aHiStyle = myCTX->getHiStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aHiStyle, -1);
myMainPM->BeginImmediateDraw();
- theOwner->HilightWithColor (myMainPM, getHiStyle (theOwner->Selectable()), aHilightMode);
+ theOwner->HilightWithColor (myMainPM, aHiStyle, aHiMode);
myMainPM->EndImmediateDraw (theView->Viewer());
}
return;
}
- const Handle(AIS_InteractiveObject)& anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- const Standard_Integer aHilightMode = GetHiMod (anObj);
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (IsSelected (theOwner))
{
if (theOwner->IsAutoHilight())
{
- theOwner->HilightWithColor (myMainPM, getSelStyle (anObj), aHilightMode);
+ const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aSelStyle, -1);
+ theOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
}
}
else
{
- theOwner->Unhilight (myMainPM, aHilightMode);
+ theOwner->Unhilight (myMainPM);
}
}
if (anOwner->IsAutoHilight())
{
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
- const Standard_Integer aHighMode = GetHiMod (anIO);
- anOwner->HilightWithColor (myMainPM, getSelStyle (anIO), aHighMode);
+ const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anIO, anOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anIO, aSelStyle, -1);
+ anOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
continue;
}
Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (aSelObj);
anObjMap.Add (aSelObj);
- Standard_Integer aHighMode = GetHiMod (anIO);
- anOwner->Unhilight (myMainPM, aHighMode);
+ anOwner->Unhilight (myMainPM);
}
for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator aMapIter (anObjMap);
myMainPM->BeginImmediateDraw();
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (mylastindex);
- const Standard_Integer aHilightMode = anOwner->HasSelectable()
- ? GetHiMod (Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()))
- : 0;
-
- myMapOfOwner->FindKey (mylastindex)->Unhilight (myMainPM, aHilightMode);
+ anOwner->Unhilight (myMainPM);
myMainPM->EndImmediateDraw (theView->Viewer());
mylastindex = 0;
return Standard_True;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <AIS_LocalStatus.hxx>
-#include <Standard_Transient.hxx>
+
#include <Standard_Type.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus, Standard_Transient)
AIS_LocalStatus::AIS_LocalStatus (const Standard_Boolean theIsTemporary,
const Standard_Boolean theIsToDecompose,
const Standard_Integer theSelectionMode,
const Standard_Integer theHilightMode,
const Standard_Boolean theIsSubIntensity,
- const Handle(Graphic3d_HighlightStyle)& theStyle)
+ const Handle(Prs3d_Drawer)& theStyle)
: myDecomposition (theIsToDecompose),
myIsTemporary (theIsTemporary),
myDMode (theDisplayMode),
#ifndef _AIS_LocalStatus_HeaderFile
#define _AIS_LocalStatus_HeaderFile
-#include <Graphic3d_HighlightStyle.hxx>
-#include <MMgt_TShared.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Standard_Transient.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_ListOfInteger.hxx>
-class Standard_Transient;
-
-class AIS_LocalStatus;
-DEFINE_STANDARD_HANDLE(AIS_LocalStatus, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(AIS_LocalStatus, Standard_Transient)
//! Stored Info about temporary objects.
-class AIS_LocalStatus : public MMgt_TShared
+class AIS_LocalStatus : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(AIS_LocalStatus, Standard_Transient)
public:
-
Standard_EXPORT AIS_LocalStatus (const Standard_Boolean theIsTemporary = Standard_True,
const Standard_Boolean theIsToDecompose = Standard_False,
const Standard_Integer theDisplayMode = -1,
const Standard_Integer theSelectionMode = -1,
const Standard_Integer theHilightMode = 0,
const Standard_Boolean theIsSubIntensity = 0,
- const Handle(Graphic3d_HighlightStyle)& theStyle = NULL);
+ const Handle(Prs3d_Drawer)& theStyle = Handle(Prs3d_Drawer)());
Standard_Boolean Decomposed() const;
Standard_Boolean IsSubIntensityOn() const;
- const Handle(Graphic3d_HighlightStyle)& HilightStyle() const
+ const Handle(Prs3d_Drawer)& HilightStyle() const
{
return myHiStyle;
}
void SetHilightMode (const Standard_Integer aMode);
- void SetHilightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
+ void SetHilightStyle (const Handle(Prs3d_Drawer)& theStyle)
{
myHiStyle = theStyle;
}
const Handle(Standard_Transient)& PreviousState() const;
-
-
-
- DEFINE_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
-
private:
Standard_Boolean myDecomposition;
Standard_Boolean myIsTemporary;
TColStd_ListOfInteger mySModes;
Standard_Boolean mySubIntensity;
Handle(Standard_Transient) myPreviousState;
- Handle(Graphic3d_HighlightStyle) myHiStyle;
+ Handle(Prs3d_Drawer) myHiStyle;
};
-
#include <AIS_LocalStatus.lxx>
-
-
-
-
#endif // _AIS_LocalStatus_HeaderFile
//purpose :
//=======================================================================
void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner)
{
Handle(AIS_ManipulatorOwner) anOwner = Handle(AIS_ManipulatorOwner)::DownCast (theOwner);
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw ).
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
protected:
//purpose :
//=======================================================================
void AIS_ManipulatorOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (theMode == 0)
return;
}
- thePM->Unhighlight (Selectable(), myMode);
+ thePM->Unhighlight (Selectable());
}
Standard_EXPORT virtual ~AIS_ManipulatorOwner() {}
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
}
//! Selectable() method modified to return myAssembly.
- virtual Handle(SelectMgr_SelectableObject) Selectable() const;
+ virtual Handle(SelectMgr_SelectableObject) Selectable() const Standard_OVERRIDE
+ {
+ return myAssembly;
+ }
- Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode) const;
+ virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode) const Standard_OVERRIDE;
- void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
- const Standard_Integer theMode);
+ virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Handle(Prs3d_Drawer)& theStyle,
+ const Standard_Integer theMode) Standard_OVERRIDE;
- void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer aMode);
+ virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer aMode) Standard_OVERRIDE;
private:
{
}
-//=======================================================================
-//function : Selectable
-//purpose :
-//=======================================================================
-Handle(SelectMgr_SelectableObject) SelectMgr_AssemblyEntityOwner::Selectable() const
-{
- return myAssembly;
-}
-
//=======================================================================
//function : IsHilighted
//purpose :
//purpose :
//=======================================================================
void SelectMgr_AssemblyEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (HasSelectable())
//function : Unhilight
//purpose :
//=======================================================================
-void SelectMgr_AssemblyEntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& PM,
- const Standard_Integer aMode)
+void SelectMgr_AssemblyEntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
+ const Standard_Integer )
{
if (HasSelectable())
{
- PM->Unhighlight (myAssembly, aMode);
+ thePrsMgr->Unhighlight (myAssembly);
}
}
{
myHasOwnPresentations = Standard_False;
myAssemblyOwner = NULL;
- SetHilightMode (0);
}
//=======================================================================
myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
{
InitDrawerAttributes();
- SetHilightMode(0);
}
//=======================================================================
{
InitDrawerAttributes();
ComputeFields();
- SetHilightMode(0);
-
}
myDrawer->ShadingAspect()->SetColor(aCol);
hasOwnColor=Standard_True;
- myOwnColor = aCol;
+ myDrawer->SetColor (aCol);
}
//=======================================================================
//function : SetColor
void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor = aCol;
+ myDrawer->SetColor (aCol);
myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
}
myHasTOM(Standard_False),
myTOM(Aspect_TOM_PLUS)
{
- myHilightMode=-99;
+ myHilightDrawer = new Prs3d_Drawer();
+ myHilightDrawer->SetDisplayMode (-99);
+ myHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_GRAY80, 3.0));
+ myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
+ myDynHilightDrawer = new Prs3d_Drawer();
+ myDynHilightDrawer->SetDisplayMode (-99);
+ myDynHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_CYAN1, 3.0));
+ myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
}
//=======================================================================
StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
else if (aMode== -99)
{
- Handle(Graphic3d_AspectMarker3d) PtA = new Graphic3d_AspectMarker3d ();
- PtA->SetType(Aspect_TOM_PLUS);
- PtA->SetScale(3.);
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(PtA);
+ TheGroup->SetPrimitivesAspect (myHilightDrawer->PointAspect()->Aspect());
Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1);
aPoint->AddVertex (myComponent->X(),myComponent->Y(),myComponent->Z());
TheGroup->AddPrimitiveArray (aPoint);
SetColor(Quantity_Color(aCol));
}
-void AIS_Point::SetColor(const Quantity_Color &aCol)
+void AIS_Point::SetColor (const Quantity_Color& theCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (theCol);
UpdatePointValues();
}
//purpose :
//=======================================================================
- Standard_Boolean AIS_Point::
-AcceptDisplayMode(const Standard_Integer aMode) const
-{return aMode == 0;}
-
+ Standard_Boolean AIS_Point::AcceptDisplayMode (const Standard_Integer theMode) const
+{
+ return theMode == 0
+ || theMode == -99;
+}
//=======================================================================
//function : UpdatePointValues
aScale = myDrawer->Link()->PointAspect()->Aspect()->Scale();
}
- if(hasOwnColor) aCol = myOwnColor;
+ if(hasOwnColor) aCol = myDrawer->Color();
if(myOwnWidth!=0.0) aScale = myOwnWidth;
if(myHasTOM) aTOM = myTOM;
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
if (HasColor())
{
- myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
}
- myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
myCurrentFacingModel);
if (HasColor())
{
- myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
- myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
}
}
else
void AIS_Relation::SetColor(const Quantity_Color &aCol)
{
- if(hasOwnColor && myOwnColor==aCol) return;
+ if(hasOwnColor && myDrawer->Color() == aCol) return;
if (!myDrawer->HasOwnTextAspect()) myDrawer->SetTextAspect(new Prs3d_TextAspect());
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (aCol);
myDrawer->TextAspect()->SetColor(aCol);
Standard_Real WW = HasWidth()? Width(): myDrawer->HasLink() ?
myInitAng(0.)
{
Set (shap);
- SetHilightMode(0);
}
//=======================================================================
void AIS_Shape::SetColor (const Quantity_Color& theColor)
{
setColor (myDrawer, theColor);
- myOwnColor = theColor;
+ myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
// modify shading presentation without re-computation
}
if (HasColor())
{
- myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
- myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
}
}
else
void AIS_Shape::SetTransparency (const Standard_Real theValue)
{
setTransparency (myDrawer, theValue);
- myTransparency = theValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )theValue);
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
void AIS_Shape::UnsetTransparency()
{
- myTransparency = 0.0;
+ myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
return;
void AIS_TextLabel::SetColor (const Quantity_Color& theColor)
{
hasOwnColor = Standard_True;
- myOwnColor = theColor;
+ myDrawer->SetColor (theColor);
myDrawer->TextAspect()->SetColor (theColor);
}
// override transparency
myDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
- myTransparency = theValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )theValue);
updatePresentation();
}
//=======================================================================
void AIS_Triangulation::UnsetTransparency()
{
- myTransparency = 0.0;
+ myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
return;
void AIS_Trihedron::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor = aCol;
+ myDrawer->SetColor (aCol);
if(!myDrawer->HasOwnDatumAspect()){
Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
void AIS_Trihedron::UnsetColor()
{
hasOwnColor=Standard_False;
- myOwnColor = Quantity_NOC_LIGHTSTEELBLUE4;
- myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(myOwnColor);
- myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(myOwnColor);
- myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(myOwnColor);
+ myDrawer->SetColor (Quantity_NOC_LIGHTSTEELBLUE4);
+ myDrawer->DatumAspect()->FirstAxisAspect() ->SetColor (myDrawer->Color());
+ myDrawer->DatumAspect()->SecondAxisAspect()->SetColor (myDrawer->Color());
+ myDrawer->DatumAspect()->ThirdAxisAspect() ->SetColor (myDrawer->Color());
if( HasTextColor() ) {
- SetTextColor(myOwnColor.Name());
+ SetTextColor(myDrawer->Color().Name());
myHasOwnTextColor = Standard_False;
}
if( HasArrowColor() ) {
- SetArrowColor(myOwnColor.Name());
+ SetArrowColor(myDrawer->Color().Name());
myHasOwnArrowColor = Standard_False;
}
AIS_FixRelation.lxx
AIS_GlobalStatus.cxx
AIS_GlobalStatus.hxx
-AIS_GlobalStatus.lxx
AIS_GraphicTool.cxx
AIS_GraphicTool.hxx
AIS_IdenticRelation.cxx
AIS_IndexedDataMapOfOwnerPrs.hxx
AIS_InteractiveContext.cxx
AIS_InteractiveContext.hxx
-AIS_InteractiveContext.lxx
AIS_InteractiveContext_1.cxx
AIS_InteractiveContext_2.cxx
AIS_InteractiveContext_3.cxx
AIS_InteractiveObject.cxx
AIS_InteractiveObject.hxx
-AIS_InteractiveObject.lxx
AIS_KindOfDimension.hxx
AIS_KindOfInteractive.hxx
AIS_KindOfRelation.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
#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>
//! 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:
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
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:
+++ /dev/null
-// Created on: 2016-09-23
-// 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.
-
-#include <Graphic3d_HighlightStyle.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT (Graphic3d_HighlightStyle, Standard_Transient)
#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
--- /dev/null
+// Created on: 2016-09-23
+// 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.
+
+#include <Graphic3d_PresentationAttributes.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT (Graphic3d_PresentationAttributes, Standard_Transient)
--- /dev/null
+// 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
//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())
{
//function : HighlightStyle
//purpose :
//=============================================================================
-const Handle(Graphic3d_HighlightStyle)& Graphic3d_Structure::HighlightStyle() const
+const Handle(Graphic3d_PresentationAttributes)& Graphic3d_Structure::HighlightStyle() const
{
return myCStructure->HighlightStyle();
}
//! @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.
//! 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).
#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).
myHilightDrawer->SetInteger ( MeshVS_DA_MarkerType, Aspect_TOM_STAR );
myHilightDrawer->SetColor ( MeshVS_DA_MarkerColor, Quantity_NOC_GRAY80 );
myHilightDrawer->SetDouble ( MeshVS_DA_MarkerScale, 2.0 );
-
- HilightAttributes()->SetSelectionStyle
- (new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY80, 0.0));
}
//================================================================
if (theOwners.Value (i) == GlobalSelOwner())
{
const Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
- const Handle(Graphic3d_HighlightStyle)& aSelStyle = GetContext().IsNull()
- ? HilightAttributes()->SelectionStyle() : GetContext()->SelectionStyle();
+ const Handle(Prs3d_Drawer)& aSelStyle = !HilightAttributes().IsNull() ? HilightAttributes() : GetContext()->SelectionStyle();
thePM->Color (this, aSelStyle, aHiMode);
continue;
}
// Purpose :
//================================================================
void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner)
{
if (theOwner.IsNull())
//! Draw hilighted owner presentation
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theColor,
+ const Handle(Prs3d_Drawer)& theColor,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
//! Clears internal selection presentation
// Purpose :
//================================================================
void MeshVS_MeshEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer /*theMode*/ )
{
Handle( SelectMgr_SelectableObject ) aSelObj;
//! Hilights owner with the certain color
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Strip hilight of owner
// Purpose :
//================================================================
void MeshVS_MeshOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer /*theMode*/)
{
Handle( SelectMgr_SelectableObject ) aSelObj;
}
}
-void MeshVS_MeshOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& thePM,
- const Standard_Integer theMode)
+void MeshVS_MeshOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer )
{
- SelectMgr_EntityOwner::Unhilight( thePM, theMode );
+ SelectMgr_EntityOwner::Unhilight (thePM);
Handle(TColStd_HPackedMapOfInteger) aNodes = GetDetectedNodes();
Handle(TColStd_HPackedMapOfInteger) aElems = GetDetectedElements();
Standard_EXPORT void SetDetectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems);
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theColor,
+ const Handle(Prs3d_Drawer)& theColor,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
// purpose :
// =======================================================================
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
- const OpenGl_Vec4* theHighlightColor)
+ const Handle(Graphic3d_PresentationAttributes)& theHighlight)
{
if (!myActiveProgram.IsNull())
{
+ const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
+ ? theHighlight->BasicFillAreaAspect()
+ : theAspect->Aspect();
myActiveProgram->SetUniform (this,
myActiveProgram->GetStateLocation (OpenGl_OCCT_TEXTURE_ENABLE),
- theAspect->Aspect()->ToMapTexture() ? 1 : 0);
+ anAspect->ToMapTexture() ? 1 : 0);
myActiveProgram->SetUniform (this,
myActiveProgram->GetStateLocation (OpenGl_OCCT_DISTINGUISH_MODE),
- theAspect->Aspect()->Distinguish() ? 1 : 0);
+ anAspect->Distinguish() ? 1 : 0);
OpenGl_Material aParams;
for (Standard_Integer anIndex = 0; anIndex < 2; ++anIndex)
continue;
}
- if (anIndex == 0 || !theAspect->Aspect()->Distinguish())
+ if (anIndex == 0 || !anAspect->Distinguish())
{
- const Graphic3d_MaterialAspect& aSrcMat = theAspect->Aspect()->FrontMaterial();
- const Quantity_Color& aSrcIntColor = theAspect->Aspect()->InteriorColor();
+ const Graphic3d_MaterialAspect& aSrcMat = anAspect->FrontMaterial();
+ const Quantity_Color& aSrcIntColor = anAspect->InteriorColor();
aParams.Init (aSrcMat, aSrcIntColor);
aParams.Diffuse.a() = 1.0f - (float )aSrcMat.Transparency();
}
else
{
- const Graphic3d_MaterialAspect& aSrcMat = theAspect->Aspect()->BackMaterial();
- const Quantity_Color& aSrcIntColor = theAspect->Aspect()->BackInteriorColor();
+ const Graphic3d_MaterialAspect& aSrcMat = anAspect->BackMaterial();
+ const Quantity_Color& aSrcIntColor = anAspect->BackInteriorColor();
aParams.Init (aSrcMat, aSrcIntColor);
aParams.Diffuse.a() = 1.0f - (float )aSrcMat.Transparency();
}
- if (theHighlightColor != NULL)
+ if (!theHighlight.IsNull()
+ && theHighlight->BasicFillAreaAspect().IsNull())
{
- aParams.SetColor (*theHighlightColor);
- aParams.Diffuse.a() = theHighlightColor->a();
+ aParams.SetColor (theHighlight->ColorRGBA());
+ aParams.Diffuse.a() = theHighlight->ColorRGBA().Alpha();
}
myActiveProgram->SetUniform (this, aLoc, OpenGl_Material::NbOfVec4(),
class OpenGl_Sampler;
class OpenGl_FrameBuffer;
class OpenGl_AspectFace;
+class Graphic3d_PresentationAttributes;
-class OpenGl_Context;
DEFINE_STANDARD_HANDLE(OpenGl_Context, Standard_Transient)
//! This class generalize access to the GL context and available extensions.
//! Setup current shading material.
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
- const OpenGl_Vec4* theHighlightColor = NULL);
+ const Handle(Graphic3d_PresentationAttributes)& theHighlight = Handle(Graphic3d_PresentationAttributes)());
//! Setup current color.
Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor);
// All primitives should gather material properties from the AspectFace in shading mode
if (isLightOn)
{
- aCtx->SetShadingMaterial (anAspectFace, theWorkspace->ToHighlight() ? theWorkspace->HighlightColor : NULL);
+ aCtx->SetShadingMaterial (anAspectFace, theWorkspace->HighlightStyle());
}
if (!theWorkspace->ActiveTexture().IsNull()
// function : GraphicHighlight
// purpose :
// =======================================================================
-void OpenGl_Structure::GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
- const Handle(Graphic3d_Structure)& theStruct)
+void OpenGl_Structure::GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle,
+ const Handle(Graphic3d_Structure)& theStruct)
{
if (!myHighlightStyle.IsNull()
&& myHighlightStyle->Method() == Aspect_TOHM_BOUNDBOX
// Render named status
if (highlight && myHighlightBox.IsNull())
{
- theWorkspace->SetHighlight (true);
+ theWorkspace->SetHighlightStyle (myHighlightStyle);
}
// Apply local transformation
aCtx->core11fwd->glFrontFace (GL_CW);
}
- // Apply highlight color
- const OpenGl_Vec4* aHighlightColor = theWorkspace->HighlightColor;
- if (!myHighlightStyle.IsNull())
- theWorkspace->HighlightColor = myHighlightStyle->ColorFltPtr();
-
// Collect clipping planes of structure scope
aCtx->ChangeClipping().SetLocalPlanes (aCtx, myClipPlanes);
aCtx->WorldViewState.Pop();
}
- // Restore highlight color
- theWorkspace->HighlightColor = aHighlightColor;
-
// Restore aspects
theWorkspace->SetAspectLine (aPrevAspectLine);
theWorkspace->SetAspectFace (aPrevAspectFace);
// Apply highlight box
if (!myHighlightBox.IsNull())
{
+ theWorkspace->SetHighlightStyle (myHighlightStyle);
myHighlightBox->Render (theWorkspace);
}
// Restore named status
- theWorkspace->SetHighlight (false);
+ theWorkspace->SetHighlightStyle (Handle(Graphic3d_PresentationAttributes)());
}
// =======================================================================
//! Highlights structure according to the given style and updates corresponding class fields
//! (highlight status and style)
- Standard_EXPORT virtual void GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
- const Handle(Graphic3d_Structure)& theStruct) Standard_OVERRIDE;
+ Standard_EXPORT virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle,
+ const Handle(Graphic3d_Structure)& theStruct) Standard_OVERRIDE;
//! Unighlights structure and updates corresponding class fields (highlight status and style)
Standard_EXPORT virtual void GraphicUnhighlight() Standard_OVERRIDE;
// =======================================================================
OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Window)& theWindow)
: NamedStatus (0),
- HighlightColor (&THE_WHITE_COLOR),
myView (theView),
myWindow (theWindow),
myGlContext (!theWindow.IsNull() ? theWindow->GetGlContext() : NULL),
ViewMatrix_applied (&myDefaultMatrix),
StructureMatrix_applied (&myDefaultMatrix),
myToAllowFaceCulling (false),
- myToHighlight (false),
myModelViewMatrix (myDefaultMatrix)
{
if (!myGlContext.IsNull() && myGlContext->MakeCurrent())
myGlContext->BindDefaultVao();
NamedStatus = !myTextureBound.IsNull() ? OPENGL_NS_TEXTURE : 0;
- HighlightColor = &THE_WHITE_COLOR;
+ myHighlightStyle.Nullify();
myToAllowFaceCulling = false;
myAspectLineSet = &myDefaultAspectLine;
myAspectFaceSet = &myDefaultAspectFace;
}
myMatTmp.Init (*aSrcMat, *aSrcIntColor);
- if (myToHighlight)
+ if (!myHighlightStyle.IsNull())
{
- myMatTmp.SetColor (*HighlightColor);
+ myMatTmp.SetColor (myHighlightStyle->ColorRGBA());
}
// handling transparency
}
if (myAspectFaceSet->Aspect() == myAspectFaceApplied
- && myToHighlight == myAspectFaceAppliedWithHL)
+ && !myHighlightStyle.IsNull() == myAspectFaceAppliedWithHL)
{
return myAspectFaceSet;
}
- myAspectFaceAppliedWithHL = myToHighlight;
+ myAspectFaceAppliedWithHL = !myHighlightStyle.IsNull();
#if !defined(GL_ES_VERSION_2_0)
const Aspect_InteriorStyle anIntstyle = myAspectFaceSet->Aspect()->InteriorStyle();
//// RELATED TO STATUS ////
- const OpenGl_Vec4* HighlightColor;
-
//! Return true if active group might activate face culling (e.g. primitives are closed).
bool ToAllowFaceCulling() const { return myToAllowFaceCulling; }
void SetAllowFaceCulling (bool theToAllow) { myToAllowFaceCulling = theToAllow; }
//! Return true if following structures should apply highlight color.
- bool ToHighlight() const { return myToHighlight; }
+ bool ToHighlight() const { return !myHighlightStyle.IsNull(); }
+
+ //! Return highlight style.
+ const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; }
- //! Set highlight.
- void SetHighlight (bool theToHighlight) { myToHighlight = theToHighlight; }
+ //! Set highlight style.
+ void SetHighlightStyle (const Handle(Graphic3d_PresentationAttributes)& theStyle) { myHighlightStyle = theStyle; }
//! Return line color taking into account highlight flag.
const OpenGl_Vec4& LineColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectLineSet->Aspect()->ColorRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectLineSet->Aspect()->ColorRGBA();
}
//! Return edge color taking into account highlight flag.
const OpenGl_Vec4& EdgeColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectFaceSet->AspectEdge()->Aspect()->ColorRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectFaceSet->AspectEdge()->Aspect()->ColorRGBA();
}
//! Return marker color taking into account highlight flag.
const OpenGl_Vec4& MarkerColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectMarkerSet->Aspect()->ColorRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectMarkerSet->Aspect()->ColorRGBA();
}
//! Return Interior color taking into account highlight flag.
const OpenGl_Vec4& InteriorColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectFaceSet->Aspect()->InteriorColorRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectFaceSet->Aspect()->InteriorColorRGBA();
}
//! Return text color taking into account highlight flag.
const OpenGl_Vec4& TextColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectTextSet->Aspect()->ColorRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectTextSet->Aspect()->ColorRGBA();
}
//! Return text Subtitle color taking into account highlight flag.
const OpenGl_Vec4& TextSubtitleColor() const
{
- return myToHighlight
- ? *HighlightColor
- : myAspectTextSet->Aspect()->ColorSubTitleRGBA();
+ return !myHighlightStyle.IsNull()
+ ? myHighlightStyle->ColorRGBA()
+ : myAspectTextSet->Aspect()->ColorSubTitleRGBA();
}
//! Currently set line aspect (can differ from applied).
OpenGl_Material myMatBack; //!< current back material state
OpenGl_Material myMatTmp; //!< temporary variable
bool myToAllowFaceCulling; //!< allow back face culling
- bool myToHighlight; //!< flag indicating highlighting mode
+ Handle(Graphic3d_PresentationAttributes) myHighlightStyle; //!< active highlight style
OpenGl_Matrix myModelViewMatrix; //!< Model matrix with applied structure transformations
Prs3d_ToolQuadric.cxx
Prs3d_ToolSphere.hxx
Prs3d_ToolSphere.cxx
+Prs3d_TypeOfHighlight.hxx
Prs3d_TypeOfHLR.hxx
Prs3d_TypeOfLinePicking.hxx
Prs3d_VertexDrawMode.hxx
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_TextAspect.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
// =======================================================================
// function : Prs3d_Drawer
myHasOwnDimLengthModelUnits (Standard_False),
myHasOwnDimAngleModelUnits (Standard_False),
myHasOwnDimLengthDisplayUnits (Standard_False),
- myHasOwnDimAngleDisplayUnits (Standard_False),
-
- myHasOwnHighlightStyle (Standard_False),
- myHasOwnSelectionStyle (Standard_False)
+ myHasOwnDimAngleDisplayUnits (Standard_False)
{
myDimensionModelUnits.SetLengthUnits ("m");
myDimensionModelUnits.SetAngleUnits ("rad");
myDatumAspect.Nullify();
myDimensionAspect.Nullify();
mySectionAspect.Nullify();
- myHighlightStyle.Nullify();
- mySelectionStyle.Nullify();
myHasOwnUIsoAspect = Standard_False;
myHasOwnVIsoAspect = Standard_False;
myHasOwnDimLengthDisplayUnits = Standard_False;
myHasOwnDimAngleModelUnits = Standard_False;
myHasOwnDimAngleDisplayUnits = Standard_False;
- myHasOwnHighlightStyle = Standard_False;
- myHasOwnSelectionStyle = Standard_False;
myVertexDrawMode = Prs3d_VDM_Inherited;
myTypeOfHLR = Prs3d_TOH_NotSet;
}
}
}
-
-// =======================================================================
-// function : SetHighlightStyle
-// purpose :
-// =======================================================================
-void Prs3d_Drawer::SetHighlightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
-{
- myHighlightStyle = theStyle;
- myHasOwnHighlightStyle = !myHighlightStyle.IsNull();
-}
-
-// =======================================================================
-// function : SetSelectionStyle
-// purpose :
-// =======================================================================
-void Prs3d_Drawer::SetSelectionStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
-{
- mySelectionStyle = theStyle;
- myHasOwnSelectionStyle = !mySelectionStyle.IsNull();
-}
#include <Quantity_Length.hxx>
#include <Aspect_TypeOfDeflection.hxx>
#include <Graphic3d_GroupAspect.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
+#include <Graphic3d_PresentationAttributes.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Standard_Real.hxx>
#include <Prs3d_VertexDrawMode.hxx>
class Prs3d_DimensionAspect;
class TCollection_AsciiString;
-class Prs3d_Drawer;
-DEFINE_STANDARD_HANDLE(Prs3d_Drawer, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(Prs3d_Drawer, Graphic3d_PresentationAttributes)
//! A graphic attribute manager which governs how
//! objects such as color, width, line thickness and deflection are displayed.
//! A drawer includes an instance of the Aspect classes with particular default values.
-class Prs3d_Drawer : public MMgt_TShared
+class Prs3d_Drawer : public Graphic3d_PresentationAttributes
{
-
+ DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
public:
//! Default constructor.
//! that overrides the one in the link.
Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
- //! Returns true if the drawer has its own style of dynamic highlighting
- //! that overrides the one in the link
- Standard_Boolean HasOwnHighlightStyle() const { return myHasOwnHighlightStyle; }
-
- //! Returns own dynamic highlight style or corresponding style of the link. If no one of
- //! them is defined, invalid handle will be returned.
- const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const
- {
- return HasOwnHighlightStyle() || myLink.IsNull()
- ? myHighlightStyle : myLink->HighlightStyle();
- }
-
- //! Allows to set own dynamic highlight style.
- Standard_EXPORT void SetHighlightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle);
-
- //! Returns true if the drawer has its own style of selection highlighting
- //! that overrides the one in the link
- Standard_Boolean HasOwnSelectionStyle() const { return myHasOwnSelectionStyle; }
-
- //! Returns own selection highlight style or corresponding style of the link. If no one of
- //! them is defined, invalid handle will be returned.
- const Handle(Graphic3d_HighlightStyle)& SelectionStyle() const
- {
- return HasOwnSelectionStyle() || myLink.IsNull()
- ? mySelectionStyle : myLink->SelectionStyle();
- }
-
- //! Allows to set own selection highlight style.
- Standard_EXPORT void SetSelectionStyle (const Handle(Graphic3d_HighlightStyle)& theStyle);
-
//! Returns the drawer to which the current object references.
const Handle(Prs3d_Drawer)& Link() { return myLink; }
Standard_Boolean HasLink() const { return !myLink.IsNull(); }
//! Sets theDrawer as a link to which the current object references.
- void Link (const Handle(Prs3d_Drawer)& theDrawer)
- {
- myLink = theDrawer;
- }
+ void Link (const Handle(Prs3d_Drawer)& theDrawer) { SetLink (theDrawer); }
+
+ //! Sets theDrawer as a link to which the current object references.
+ void SetLink (const Handle(Prs3d_Drawer)& theDrawer) { myLink = theDrawer; }
//! Removes local attributes.
Standard_EXPORT void ClearLocalAttributes();
Standard_Boolean myHasOwnDimLengthDisplayUnits;
Standard_Boolean myHasOwnDimAngleDisplayUnits;
- Handle(Graphic3d_HighlightStyle) myHighlightStyle;
- Standard_Boolean myHasOwnHighlightStyle;
- Handle(Graphic3d_HighlightStyle) mySelectionStyle;
- Standard_Boolean myHasOwnSelectionStyle;
-
-public:
-
- DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
-
};
+Standard_DEPRECATED("Class name is deprecated - use Prs3d_Drawer instead")
+typedef Prs3d_Drawer Graphic3d_HighlightStyle;
+
#endif // _Prs3d_Drawer_HeaderFile
--- /dev/null
+// 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 _Prs3d_TypeOfHighlight_HeaderFile
+#define _Prs3d_TypeOfHighlight_HeaderFile
+
+//! Type of highlighting to apply specific style.
+enum Prs3d_TypeOfHighlight
+{
+ Prs3d_TypeOfHighlight_None = 0, //!< no highlighting
+ Prs3d_TypeOfHighlight_Selected, //!< entire object is selected
+ Prs3d_TypeOfHighlight_Dynamic, //!< entire object is dynamically highlighted
+ Prs3d_TypeOfHighlight_LocalSelected, //!< part of the object is selected
+ Prs3d_TypeOfHighlight_LocalDynamic, //!< part of the object is dynamically highlighted
+ Prs3d_TypeOfHighlight_SubIntensity, //!< sub-intensity style
+ Prs3d_TypeOfHighlight_NB
+};
+
+#endif // _Prs3d_TypeOfHighlight_HeaderFile
PrsMgr_PresentableObjectPointer.hxx
PrsMgr_Presentation.cxx
PrsMgr_Presentation.hxx
-PrsMgr_Presentation.lxx
PrsMgr_Presentation3d.hxx
PrsMgr_PresentationManager.cxx
PrsMgr_PresentationManager.hxx
-PrsMgr_PresentationManager.lxx
PrsMgr_PresentationManager3d.hxx
PrsMgr_PresentationPointer.hxx
PrsMgr_Presentations.hxx
#include <PrsMgr_PresentableObject.hxx>
+#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentableObject,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient)
namespace
{
//purpose :
//=======================================================================
PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
-: myTypeOfPresentation3d (theType),
+: myDrawer (new Prs3d_Drawer()),
+ myTypeOfPresentation3d (theType),
myIsMutable (Standard_False),
- myZLayer (Graphic3d_ZLayerId_Default),
myHasOwnPresentations (Standard_True),
myParent (NULL)
{
- //
+ myDrawer->SetDisplayMode (-1);
}
//=======================================================================
//=======================================================================
void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
{
- if (myZLayer == theLayerId)
+ if (myDrawer->ZLayer() == theLayerId)
{
return;
}
- myZLayer = theLayerId;
+ myDrawer->SetZLayer (theLayerId);
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
{
const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter);
//=======================================================================
Graphic3d_ZLayerId PrsMgr_PresentableObject::ZLayer() const
{
- return myZLayer;
+ return myDrawer->ZLayer();
}
// =======================================================================
aModedPrs.Presentation()->Presentation()->SetMutable (theIsMutable);
}
}
+
+// =======================================================================
+// function : SetAttributes
+// purpose :
+// =======================================================================
+void PrsMgr_PresentableObject::SetAttributes (const Handle(Prs3d_Drawer)& theDrawer)
+{
+ myDrawer = theDrawer;
+}
+
+// =======================================================================
+// function : UnsetAttributes
+// purpose :
+// =======================================================================
+void PrsMgr_PresentableObject::UnsetAttributes()
+{
+ Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
+ if (myDrawer->HasLink())
+ {
+ aDrawer->Link(myDrawer->Link());
+ }
+ myDrawer = aDrawer;
+}
//! the relevant daughter classes and their member
//! functions in AIS. This is particularly true in the
//! creation of new interactive objects.
-class PrsMgr_PresentableObject : public MMgt_TShared
+class PrsMgr_PresentableObject : public Standard_Transient
{
- DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject, MMgt_TShared)
+ DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient)
+ friend class PrsMgr_Presentation;
+ friend class PrsMgr_PresentationManager;
public:
PrsMgr_Presentations& Presentations() { return myPresentations; }
//! Returns parent of current object in scene hierarchy.
PrsMgr_PresentableObjectPointer Parent() const { return myParent; }
+ //! Initializes the drawing tool theDrawer.
+ Standard_EXPORT virtual void SetAttributes(const Handle(Prs3d_Drawer)& theDrawer);
-friend class PrsMgr_Presentation;
-friend class PrsMgr_PresentationManager;
-friend
- Standard_EXPORT Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector);
-friend
- Standard_EXPORT void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Graphic3d_Structure)& theGivenStruct);
-friend
- Standard_EXPORT Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Geom_Transformation)& theTrsf);
-friend
- Standard_EXPORT void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Geom_Transformation)& theTrsf, const Handle(Graphic3d_Structure)& theGivenStruct);
+ //! Returns the attributes settings.
+ const Handle(Prs3d_Drawer)& Attributes() const
+ {
+ return myDrawer;
+ }
+
+ //! Clears settings provided by the drawing tool theDrawer.
+ Standard_EXPORT virtual void UnsetAttributes();
+
+ //! Returns the hilight attributes settings.
+ const Handle(Prs3d_Drawer)& HilightAttributes() const { return myHilightDrawer; }
+
+ //! Initializes the hilight drawing tool theDrawer.
+ virtual void SetHilightAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myHilightDrawer = theDrawer; }
+
+ //! Returns the hilight attributes settings.
+ const Handle(Prs3d_Drawer)& DynamicHilightAttributes() const { return myDynHilightDrawer; }
+
+ //! Initializes the dynamic hilight drawing tool.
+ virtual void SetDynamicHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer) { myDynHilightDrawer = theDrawer; }
+
+ //! Clears settings provided by the hilight drawing tool theDrawer.
+ virtual void UnsetHilightAttributes() { myHilightDrawer.Nullify(); }
protected:
protected:
PrsMgr_Presentations myPresentations;
- PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d;
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
+ Handle(Prs3d_Drawer) myDrawer;
+ Handle(Prs3d_Drawer) myHilightDrawer;
+ Handle(Prs3d_Drawer) myDynHilightDrawer;
+ PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d;
Standard_Boolean myIsMutable;
- Graphic3d_ZLayerId myZLayer;
Standard_Boolean myHasOwnPresentations;
private:
};
-DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, Standard_Transient)
#endif // _PrsMgr_PresentableObject_HeaderFile
#include <PrsMgr_Presentation.hxx>
#include <Geom_Transformation.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
#include <Graphic3d_DataStructureManager.hxx>
#include <Graphic3d_Structure.hxx>
#include <Precision.hxx>
+#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <Standard_Type.hxx>
#include <Graphic3d_CView.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Presentation,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Presentation, Standard_Transient)
namespace
{
//function : Highlight
//purpose :
//=======================================================================
-void PrsMgr_Presentation::Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle)
+void PrsMgr_Presentation::Highlight (const Handle(Prs3d_Drawer)& theStyle)
{
if (!IsHighlighted())
{
#ifndef _PrsMgr_Presentation_HeaderFile
#define _PrsMgr_Presentation_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
#include <PrsMgr_PresentableObjectPointer.hxx>
+#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Quantity_Length.hxx>
+
class PrsMgr_PresentationManager;
class PrsMgr_Prs;
class PrsMgr_PresentableObject;
class Quantity_Color;
class Geom_Transformation;
class Prs3d_Presentation;
-class Graphic3d_HighlightStyle;
+class Prs3d_Drawer;
class Graphic3d_Structure;
class Graphic3d_DataStructureManager;
class Prs3d_Projector;
+DEFINE_STANDARD_HANDLE(PrsMgr_Presentation, Standard_Transient)
-class PrsMgr_Presentation;
-DEFINE_STANDARD_HANDLE(PrsMgr_Presentation, MMgt_TShared)
-
-
-class PrsMgr_Presentation : public MMgt_TShared
+class PrsMgr_Presentation : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(PrsMgr_Presentation, Standard_Transient)
+ friend class PrsMgr_PresentationManager;
+ friend class PrsMgr_PresentableObject;
+ friend class PrsMgr_Prs;
public:
-
//! Destructor
Standard_EXPORT ~PrsMgr_Presentation();
-
- const Handle(Prs3d_Presentation)& Presentation() const;
-
- //! returns the PresentationManager in which the presentation has been created.
- const Handle(PrsMgr_PresentationManager)& PresentationManager() const;
-
- void SetUpdateStatus (const Standard_Boolean theStat);
-
- Standard_Boolean MustBeUpdated() const;
-
-friend class PrsMgr_PresentationManager;
-friend class PrsMgr_PresentableObject;
-friend class PrsMgr_Prs;
+ const Handle(Prs3d_Presentation)& Presentation() const { return myStructure; }
- DEFINE_STANDARD_RTTIEXT(PrsMgr_Presentation,MMgt_TShared)
-
-protected:
-
+ //! returns the PresentationManager in which the presentation has been created.
+ const Handle(PrsMgr_PresentationManager)& PresentationManager() const { return myPresentationManager; }
+ void SetUpdateStatus (const Standard_Boolean theUpdateStatus) { myMustBeUpdated = theUpdateStatus; }
+ Standard_Boolean MustBeUpdated() const { return myMustBeUpdated; }
private:
-
Standard_EXPORT PrsMgr_Presentation(const Handle(PrsMgr_PresentationManager)& thePresentationManager, const Handle(PrsMgr_PresentableObject)& thePresentableObject);
Standard_EXPORT void Display();
Standard_EXPORT void SetVisible (const Standard_Boolean theValue);
- Standard_EXPORT void Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle);
+ Standard_EXPORT void Highlight (const Handle(Prs3d_Drawer)& theStyle);
Standard_EXPORT void Unhighlight() const;
Standard_Boolean myMustBeUpdated;
Standard_Integer myBeforeHighlightState;
-
};
-
-#include <PrsMgr_Presentation.lxx>
-
-
-
-
-
#endif // _PrsMgr_Presentation_HeaderFile
+++ /dev/null
-// Created on: 1997-02-20
-// Created by: Robert COUBLANC
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-#include <PrsMgr_Prs.hxx>
-
-inline void PrsMgr_Presentation::SetUpdateStatus (const Standard_Boolean theUpdateStatus)
-{
- myMustBeUpdated = theUpdateStatus;
-}
-
-inline Standard_Boolean PrsMgr_Presentation::MustBeUpdated() const
-{
- return myMustBeUpdated;
-}
-
-inline const Handle(PrsMgr_PresentationManager)& PrsMgr_Presentation::PresentationManager() const
-{
- return myPresentationManager;
-}
-
-inline const Handle(Prs3d_Presentation)& PrsMgr_Presentation::Presentation() const
-{
- return myStructure;
-}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <PrsMgr_PresentationManager.hxx>
#include <Geom_Transformation.hxx>
#include <Graphic3d_GraphicDriver.hxx>
+#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_PresentationShadow.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_Presentation.hxx>
-#include <PrsMgr_PresentationManager.hxx>
#include <PrsMgr_Presentations.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Type.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
#include <V3d_View.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentationManager,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentationManager, Standard_Transient)
// =======================================================================
// function : PrsMgr_PresentationManager
// function : Unhighlight
// purpose :
// =======================================================================
-void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObj,
- const Standard_Integer theMode)
+void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObj)
{
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
{
- Unhighlight (anIter.Value(), theMode);
+ Unhighlight (anIter.Value());
}
- const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
- if (!aPrs.IsNull())
+ const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
+ for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
{
- aPrs->Unhighlight();
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter);
+ const Handle(PrsMgr_Presentation)& aPrs = aModedPrs.Presentation();
+ const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager();
+ if (this == aPrsMgr
+ && aPrs->IsHighlighted())
+ {
+ aPrs->Unhighlight();
+ }
}
}
Presentation (thePrsObj, theMode)->SetTransformation (theTransformation);
}
-
// =======================================================================
// function : Color
// purpose :
// =======================================================================
void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode,
const Handle(PrsMgr_PresentableObject)& theSelObj,
const Standard_Integer theImmediateStructLayerId)
#include <Graphic3d_NameOfMaterial.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_ZLayerId.hxx>
-#include <MMgt_TShared.hxx>
+#include <Standard_Transient.hxx>
#include <PrsMgr_ListOfPresentations.hxx>
#include <Quantity_Color.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Standard_Type.hxx>
class Geom_Transformation;
+class Prs3d_Drawer;
class Prs3d_Presentation;
class PrsMgr_PresentableObject;
class PrsMgr_Presentation;
class Standard_NoSuchObject;
class V3d_Viewer;
-class PrsMgr_PresentationManager;
-DEFINE_STANDARD_HANDLE(PrsMgr_PresentationManager, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(PrsMgr_PresentationManager, Standard_Transient)
//! A framework to manage 3D displays, graphic entities and their updates.
//! Used in the AIS package (Application Interactive Services), to enable the advanced user to define the
//! default display mode of a new interactive object which extends the list of signatures and types.
//! Definition of new display types is handled by calling the presentation algorithms provided by the StdPrs package.
-class PrsMgr_PresentationManager : public MMgt_TShared
+class PrsMgr_PresentationManager : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentationManager, Standard_Transient)
public:
-
-
//! Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
Standard_EXPORT PrsMgr_PresentationManager(const Handle(Graphic3d_StructureManager)& theStructureManager);
//! Sets the visibility of presentable object.
Standard_EXPORT void SetVisibility (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Boolean theValue);
- //! Removes highlighting from the presentation of the
- //! presentable object thePrsObject in this framework with the display mode theMode.
- Standard_EXPORT void Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
-
+ //! Removes highlighting from the presentation of the presentable object.
+ Standard_EXPORT void Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObject);
+
+ Standard_DEPRECATED("Deprecated method Unhighlight() - argument theMode will be ignored")
+ void Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) { Unhighlight (thePrsObject); (void )theMode; }
//! Sets the display priority theNewPrior of the
//! presentable object thePrsObject in this framework with the display mode theMode.
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
//! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
- Standard_Boolean IsImmediateModeOn() const;
+ Standard_Boolean IsImmediateModeOn() const { return myImmediateModeOn > 0; }
//! Highlights the graphic object thePrsObject in the color theColor.
//! thePrsObject has the display mode theMode;
//! this has the default value of 0, that is, the wireframe display mode.
Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0,
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL,
const Graphic3d_ZLayerId theImmediateStructLayerId = Graphic3d_ZLayerId_Topmost);
Standard_EXPORT void Transform (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(Geom_Transformation)& theTransformation, const Standard_Integer theMode = 0);
//! Returns the structure manager.
- const Handle(Graphic3d_StructureManager)& StructureManager() const;
+ const Handle(Graphic3d_StructureManager)& StructureManager() const { return myStructureManager; }
//! Returns true if there is a presentation of the
//! presentable object thePrsObject in this framework, thePrsObject having the display mode theMode.
const Standard_Integer theMode = 0,
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL);
-
-
- DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentationManager,MMgt_TShared)
-
protected:
-
//! Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
Standard_EXPORT Standard_Boolean RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
- Handle(Graphic3d_StructureManager) myStructureManager;
- Standard_Integer myImmediateModeOn;
- PrsMgr_ListOfPresentations myImmediateList;
- PrsMgr_ListOfPresentations myViewDependentImmediateList;
-
-
private:
//! Handles the structures from <myImmediateList> and displays it separating view-dependent structures and taking into account
//! structure visibility by setting proper affinity.
void displayImmediate (const Handle(V3d_Viewer)& theViewer);
-};
-
-
-#include <PrsMgr_PresentationManager.lxx>
-
+protected:
+ Handle(Graphic3d_StructureManager) myStructureManager;
+ Standard_Integer myImmediateModeOn;
+ PrsMgr_ListOfPresentations myImmediateList;
+ PrsMgr_ListOfPresentations myViewDependentImmediateList;
+};
#endif // _PrsMgr_PresentationManager_HeaderFile
+++ /dev/null
-// Created on: 1998-04-23
-// Created by: Robert COUBLANC
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline Standard_Boolean PrsMgr_PresentationManager::IsImmediateModeOn() const
-{
- return myImmediateModeOn > 0;
-}
-
-inline const Handle(Graphic3d_StructureManager)& PrsMgr_PresentationManager::StructureManager() const
-{
- return myStructureManager;
-}
Handle(AIS_InteractiveObject) aCircle=new AIS_Circle(ahCircle);
myAISContext->Display(aCircle);
- const Handle(Graphic3d_HighlightStyle)& aSelStyle = myAISContext->SelectionStyle();
+ const Handle(Prs3d_Drawer)& aSelStyle = myAISContext->SelectionStyle();
aSelStyle->SetColor (Quantity_NOC_BLUE1);
myAISContext->AddOrRemoveSelected(aTrihedron);
aBoxObjs[aBoxIdx]->SetHilightMode (AIS_Shaded);
}
- aBoxObjs[1]->HilightAttributes()->SetHighlightStyle (new Graphic3d_HighlightStyle (
- Aspect_TOHM_COLOR, Quantity_NOC_RED, 0.8f));
- aBoxObjs[2]->HilightAttributes()->SetSelectionStyle (new Graphic3d_HighlightStyle (
- Aspect_TOHM_COLOR, Quantity_NOC_RED, 0.0f));
+ {
+ Handle(Prs3d_Drawer) aHiStyle = new Prs3d_Drawer();
+ aBoxObjs[1]->SetDynamicHilightAttributes (aHiStyle);
+ aHiStyle->SetDisplayMode (AIS_Shaded);
+ aHiStyle->SetColor (Quantity_NOC_RED);
+ aHiStyle->SetTransparency (0.8f);
+ }
+ {
+ Handle(Prs3d_Drawer) aSelStyle = new Prs3d_Drawer();
+ aBoxObjs[2]->SetHilightAttributes (aSelStyle);
+ aSelStyle->SetDisplayMode (AIS_Shaded);
+ aSelStyle->SetColor (Quantity_NOC_RED);
+ aSelStyle->SetTransparency (0.0f);
+ aSelStyle->SetZLayer (Graphic3d_ZLayerId_Topmost);
+ }
for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
{
return 0;
}
-static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- if(aContext.IsNull()) {
- di << argv[0] << "ERROR : use 'vinit' command before \n";
- return 1;
- }
- if ( argc != 1 && argc != 2) {
- di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]\n";
- return 1;
- }
- aContext->SetZDetection(((argc == 1 || (argc == 2 && Draw::Atoi(argv[1]) == 1)) ? Standard_True : Standard_False));
- return 0;
-}
-
#include <GccEnt_Position.hxx>
#include <Geom2dGcc_QualifiedCurve.hxx>
#include <Geom2dGcc_Circ2d2TanRad.hxx>
theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
- theCommands.Add("OCC137_z","OCC137_z [ZDetection_mode]",__FILE__,OCC137_z,group);
theCommands.Add("OCC24303", "OCC24303 SolID ", __FILE__, OCC24303,group);
return;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <SelectBasics_EntityOwner.hxx>
-#include <Standard_Type.hxx>
-#include <TopLoc_Location.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(SelectBasics_EntityOwner,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(SelectBasics_EntityOwner, Standard_Transient)
//========================================
-// Function : Create
-// Purpose :
+// Function : SelectBasics_EntityOwner
+// Purpose :
//========================================
-SelectBasics_EntityOwner
-::SelectBasics_EntityOwner (const Standard_Integer aPriority):
-mypriority(aPriority)
-{}
+SelectBasics_EntityOwner::SelectBasics_EntityOwner (const Standard_Integer thePriority)
+: mypriority (thePriority)
+{
+ //
+}
#define _SelectBasics_EntityOwner_HeaderFile
#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
-class TopLoc_Location;
-
-
-class SelectBasics_EntityOwner;
-DEFINE_STANDARD_HANDLE(SelectBasics_EntityOwner, MMgt_TShared)
+#include <TopLoc_Location.hxx>
//! defines an abstract owner of sensitive primitives.
//! Owners are typically used to establish a connection
//! a user can give vertex priority [3], edges [2] faces [1] shape [0],
//! so that if during selection one vertex one edge and one face are
//! simultaneously detected, the vertex will only be hilighted.
-class SelectBasics_EntityOwner : public MMgt_TShared
+class SelectBasics_EntityOwner : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(SelectBasics_EntityOwner, Standard_Transient)
public:
-
//! sets the selectable priority of the owner
- void Set (const Standard_Integer aPriority);
-
- Standard_Integer Priority() const;
-
+ void SetPriority (const Standard_Integer thePriority) { mypriority = thePriority; }
+
+ Standard_Integer Priority() const { return mypriority; }
+
Standard_EXPORT virtual Standard_Boolean HasLocation() const = 0;
-
+
Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) = 0;
-
+
Standard_EXPORT virtual void ResetLocation() = 0;
-
+
Standard_EXPORT virtual TopLoc_Location Location() const = 0;
+public:
+ //! sets the selectable priority of the owner
+ void Set (const Standard_Integer thePriority) { SetPriority (thePriority); }
+protected:
- DEFINE_STANDARD_RTTIEXT(SelectBasics_EntityOwner,MMgt_TShared)
+ Standard_EXPORT SelectBasics_EntityOwner (const Standard_Integer thePriority = 0);
protected:
-
- Standard_EXPORT SelectBasics_EntityOwner(const Standard_Integer aPriority = 0);
-
Standard_Integer mypriority;
-
-private:
-
-
-
-
};
-
-#include <SelectBasics_EntityOwner.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(SelectBasics_EntityOwner, Standard_Transient)
#endif // _SelectBasics_EntityOwner_HeaderFile
SelectMgr_DataMapOfObjectSelectors.hxx
SelectMgr_EntityOwner.cxx
SelectMgr_EntityOwner.hxx
-SelectMgr_EntityOwner.lxx
SelectMgr_Filter.cxx
SelectMgr_Filter.hxx
SelectMgr_Frustum.hxx
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <SelectMgr_EntityOwner.hxx>
#include <PrsMgr_PresentationManager.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <SelectMgr_SelectableObject.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Type.hxx>
#include <TopLoc_Location.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
//==================================================
-// Function:
+// Function: SelectMgr_EntityOwner
// Purpose :
//==================================================
-SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Standard_Integer aPriority):
-SelectBasics_EntityOwner(aPriority),
-mySelectable(NULL),
-myIsSelected (Standard_False)
+SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Standard_Integer thePriority)
+: SelectBasics_EntityOwner (thePriority),
+ mySelectable (NULL),
+ myIsSelected (Standard_False),
+ myFromDecomposition (Standard_False)
{
+ //
}
-SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO,
- const Standard_Integer aPriority):
-SelectBasics_EntityOwner(aPriority),
-myIsSelected (Standard_False)
+//==================================================
+// Function: SelectMgr_EntityOwner
+// Purpose :
+//==================================================
+SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_SelectableObject)& theSelObj,
+ const Standard_Integer thePriority)
+: SelectBasics_EntityOwner (thePriority),
+ mySelectable (theSelObj.operator->()),
+ myIsSelected (Standard_False),
+ myFromDecomposition (Standard_False)
{
- mySelectable = aSO.operator->();
+ //
}
-SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority)
-:
- SelectBasics_EntityOwner(aPriority),
- mySelectable (theOwner->mySelectable)
+//==================================================
+// Function: SelectMgr_EntityOwner
+// Purpose :
+//==================================================
+SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Standard_Integer thePriority)
+: SelectBasics_EntityOwner (thePriority),
+ mySelectable (theOwner->mySelectable),
+ myIsSelected (Standard_False),
+ myFromDecomposition (Standard_False)
{
+ //
}
-
//=======================================================================
-//function : About Selectable...
-//purpose :
+//function : SetSelectable
+//purpose :
//=======================================================================
-void SelectMgr_EntityOwner::Set(const Handle(SelectMgr_SelectableObject)& aSO)
+void SelectMgr_EntityOwner::SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj)
{
- mySelectable = aSO.operator->();
-}
-
-Standard_Boolean SelectMgr_EntityOwner::HasSelectable() const
-{
- return mySelectable != NULL;
+ mySelectable = theSelObj.operator->();
}
+//=======================================================================
+//function : Selectable
+//purpose :
+//=======================================================================
Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
{
return mySelectable;
}
//=======================================================================
-//function : about Hilight
-//purpose :
+//function : IsHilighted
+//purpose :
//=======================================================================
-Standard_Boolean SelectMgr_EntityOwner::IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
- const Standard_Integer aMode) const
-{if(HasSelectable())
- return PM->IsHighlighted(mySelectable,aMode);
- return Standard_False;
+Standard_Boolean SelectMgr_EntityOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
+ const Standard_Integer theMode) const
+{
+ return mySelectable != NULL
+ && thePrsMgr->IsHighlighted (mySelectable, theMode);
}
void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
- if (HasSelectable())
+ if (!HasSelectable())
{
- if (IsAutoHilight())
- {
- const Graphic3d_ZLayerId aLayerId = mySelectable->GlobalSelOwner().get() == this ?
- Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
- thePM->Color (mySelectable, theStyle, theMode, NULL, aLayerId);
- }
- else
- mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
+ return;
+ }
+
+ if (IsAutoHilight())
+ {
+ const Graphic3d_ZLayerId aHiLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : mySelectable->ZLayer();
+ thePM->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
+ }
+ else
+ {
+ mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
}
}
-void SelectMgr_EntityOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
- const Standard_Integer aMode)
+void SelectMgr_EntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer )
{
- if(HasSelectable())
- PM->Unhighlight(mySelectable,aMode);
+ if (HasSelectable())
+ {
+ thePrsMgr->Unhighlight (mySelectable);
+ }
}
void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
{
- if ( mySelectable==0 )
- return Standard_True;
- else
- return mySelectable->IsAutoHilight();
+ return mySelectable == NULL
+ || mySelectable->IsAutoHilight();
}
Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
#ifndef _SelectMgr_EntityOwner_HeaderFile
#define _SelectMgr_EntityOwner_HeaderFile
+#include <Graphic3d_ZLayerId.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <PrsMgr_PresentationManager3d.hxx>
+#include <SelectBasics_EntityOwner.hxx>
+#include <SelectMgr_SelectableObject.hxx>
#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <SelectMgr_SOPtr.hxx>
#include <Standard_Boolean.hxx>
-#include <SelectBasics_EntityOwner.hxx>
#include <Standard_Integer.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
+#include <Standard_Type.hxx>
#include <Quantity_NameOfColor.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
-#include <Graphic3d_ZLayerId.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-class Standard_NoSuchObject;
-class PrsMgr_PresentationManager;
-class TopLoc_Location;
-class V3d_Viewer;
-
-class SelectMgr_EntityOwner;
-DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
+class V3d_Viewer;
//! A framework to define classes of owners of sensitive primitives.
//! The owner is the link between application and
//! it must define owner classes inheriting this framework.
class SelectMgr_EntityOwner : public SelectBasics_EntityOwner
{
-
+ DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
public:
-
//! Initializes the selection priority aPriority.
Standard_EXPORT SelectMgr_EntityOwner(const Standard_Integer aPriority = 0);
-
+
//! Constructs a framework with the selectable object
//! anSO being attributed the selection priority aPriority.
Standard_EXPORT SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO, const Standard_Integer aPriority = 0);
-
+
//! Constructs a framework from existing one
//! anSO being attributed the selection priority aPriority.
Standard_EXPORT SelectMgr_EntityOwner(const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority = 0);
//! Returns true if there is a selectable object to serve as an owner.
- Standard_EXPORT Standard_Boolean HasSelectable() const;
-
+ Standard_Boolean HasSelectable() const { return mySelectable != NULL; }
+
//! Returns a selectable object detected in the working context.
Standard_EXPORT virtual Handle(SelectMgr_SelectableObject) Selectable() const;
-
- //! Sets the selectable object anSO to be used by the
- //! second constructor above.
- Standard_EXPORT void Set (const Handle(SelectMgr_SelectableObject)& aSO);
-
+
+ //! Sets the selectable object.
+ Standard_EXPORT virtual void SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj);
+
//! Returns true if the presentation manager aPM
//! highlights selections corresponding to the selection mode aMode.
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const;
//! selectable object manages highlighting on its own, execution will be passed to
//! SelectMgr_SelectableObject::HilightOwnerWithColor method
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0);
-
- //! Removes highlighting from the owner of a detected
- //! selectable object in the presentation manager aPM.
+
+ //! Removes highlighting from the owner of a detected selectable object in the presentation manager.
//! This object could be the owner of a sensitive primitive.
- //! The display mode for the highlight is aMode; this has
- //! the default value of 0, that is, wireframe mode.
- Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
-
+ //! @param thePrsMgr presentation manager
+ //! @param theMode obsolete argument for compatibility, should be ignored by implementations
+ Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode = 0);
+
//! Clears the owners matching the value of the selection
//! mode aMode from the presentation manager object aPM.
Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
//! Set the state of the owner.
//! @param theIsSelected [in] shows if owner is selected.
- void SetSelected (const Standard_Boolean theIsSelected);
-
+ void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
+
//! @return Standard_True if the owner is selected.
- Standard_Boolean IsSelected() const;
-
+ Standard_Boolean IsSelected() const { return myIsSelected; }
+
//! Set the state of the owner.
//! The method is deprecated. Use SetSelected() instead.
- void State (const Standard_Integer aStatus);
-
- Standard_Integer State() const;
-
+ void State (const Standard_Integer theStatus) { myIsSelected = (theStatus == 1); }
+
+ Standard_Integer State() const { return myIsSelected ? 1 : 0; }
+
//! if owner is not auto hilighted, for group contains many such owners
//! will be called one method HilightSelected of SelectableObject
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const;
return mySelectable == theOther.get();
}
+ //! Returns TRUE if this owner points to a part of object and FALSE for entire object.
+ Standard_Boolean ComesFromDecomposition() const { return myFromDecomposition; }
- DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
+ //! Sets flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE).
+ void SetComesFromDecomposition (const Standard_Boolean theIsFromDecomposition) { myFromDecomposition = theIsFromDecomposition; }
-protected:
-
-
-
-
-private:
+public:
+ //! Sets the selectable object.
+ void Set (const Handle(SelectMgr_SelectableObject)& theSelObj) { SetSelectable (theSelObj); }
- SelectMgr_SOPtr mySelectable;
- Standard_Boolean myIsSelected;
+protected:
+ SelectMgr_SelectableObject* mySelectable; //!< raw pointer to selectable object
+ Standard_Boolean myIsSelected; //!< flag indicating selected state
+ Standard_Boolean myFromDecomposition; //!< flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE)
};
-
-#include <SelectMgr_EntityOwner.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
#endif // _SelectMgr_EntityOwner_HeaderFile
+++ /dev/null
-// Created on: 1998-06-17
-// Created by: Robert COUBLANC
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline Standard_Integer SelectMgr_EntityOwner::State() const
-{ return myIsSelected ? 1 : 0; }
-
-inline void SelectMgr_EntityOwner::State(const Standard_Integer aStatus)
-{ myIsSelected = (aStatus == 1);}
-
-inline Standard_Boolean SelectMgr_EntityOwner::IsSelected() const
-{ return myIsSelected; }
-
-inline void SelectMgr_EntityOwner::SetSelected (const Standard_Boolean theIsSelected)
-{ myIsSelected = theIsSelected; }
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <SelectMgr_SelectableObject.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Bnd_Box.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
-#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <Standard_NoSuchObject.hxx>
return ifound;
}
-
-
//==================================================
-// Function:
+// Function: SelectMgr_SelectableObject
// Purpose :
//==================================================
SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
: PrsMgr_PresentableObject (aTypeOfPresentation3d),
- myDrawer (new Prs3d_Drawer()),
- myHilightDrawer (new Prs3d_Drawer()),
myAssemblyOwner (NULL),
myAutoHilight (Standard_True),
myGlobalSelMode (0)
{
- InitDefaultHilightAttributes (myHilightDrawer);
- myHilightDrawer->Link (myDrawer);
+ //
}
//==================================================
//purpose :
//=======================================================================
void SelectMgr_SelectableObject::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)&,
- const Handle(Graphic3d_HighlightStyle)&,
+ const Handle(Prs3d_Drawer)&,
const Handle(SelectMgr_EntityOwner)&)
{
Standard_NotImplemented::Raise ("SelectMgr_SelectableObject::HilightOwnerWithColor");
}
}
-//=======================================================================
-//function : SetAttributes
-//purpose :
-//=======================================================================
-void SelectMgr_SelectableObject::SetAttributes (const Handle(Prs3d_Drawer)& theDrawer)
-{
- myDrawer = theDrawer;
-}
-
-//=======================================================================
-//function : UnsetAttributes
-//purpose :
-//=======================================================================
-void SelectMgr_SelectableObject::UnsetAttributes()
-{
- Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
- if (myDrawer->HasLink())
- {
- aDrawer->Link (myDrawer->Link());
- }
- myDrawer = aDrawer;
-}
-
-//=======================================================================
-//function : SetHilightAttributes
-//purpose :
-//=======================================================================
-void SelectMgr_SelectableObject::SetHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer)
-{
- myHilightDrawer = theDrawer;
-}
-
-//=======================================================================
-//function : UnsetAttributes
-//purpose :
-//=======================================================================
-void SelectMgr_SelectableObject::UnsetHilightAttributes()
-{
- Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
- InitDefaultHilightAttributes (aDrawer);
- aDrawer->Link (myDrawer);
- myHilightDrawer = aDrawer;
-}
-
-//=======================================================================
-//function : InitDefaultHilightAttributes
-//purpose :
-//=======================================================================
-void SelectMgr_SelectableObject::InitDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer)
-{
- if (!theDrawer->HasOwnPointAspect())
- {
- theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
- if (theDrawer->HasLink())
- {
- *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
- }
- }
- if (!theDrawer->HasOwnLineAspect())
- {
- theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
- if (theDrawer->HasLink())
- {
- *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
- }
- }
- if (!theDrawer->HasOwnWireAspect())
- {
- theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
- if (theDrawer->HasLink())
- {
- *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
- }
- }
- if (!theDrawer->HasOwnPlaneAspect())
- {
- theDrawer->SetPlaneAspect (new Prs3d_PlaneAspect());
- if (theDrawer->HasLink())
- {
- *theDrawer->PlaneAspect()->EdgesAspect() = *theDrawer->Link()->PlaneAspect()->EdgesAspect();
- }
- }
- if (!theDrawer->HasOwnFreeBoundaryAspect())
- {
- theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
- if (theDrawer->HasLink())
- {
- *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
- }
- }
- if (!theDrawer->HasOwnUnFreeBoundaryAspect())
- {
- theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
- if (theDrawer->HasLink())
- {
- *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
- }
- }
-
- theDrawer->WireAspect()->SetWidth(2.);
- theDrawer->LineAspect()->SetWidth(2.);
- theDrawer->PlaneAspect()->EdgesAspect()->SetWidth(2.);
- theDrawer->FreeBoundaryAspect()->SetWidth(2.);
- theDrawer->UnFreeBoundaryAspect()->SetWidth(2.);
- theDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_O_POINT);
- theDrawer->PointAspect()->SetScale(2.);
-
- // By default the hilight drawer has absolute type of deflection.
- // It is supposed that absolute deflection is taken from Link().
- // It is necessary to use for all sub-shapes identical coefficient
- // computed in ::Compute() call for whole shape and stored in base drawer.
- theDrawer->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
-}
-
//=======================================================================
//function : SetAssemblyOwner
//purpose : Sets common entity owner for assembly sensitive object entities
//! in AIS. This is particularly true in the creation of new interactive objects.
class SelectMgr_SelectableObject : public PrsMgr_PresentableObject
{
-
+ DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectableObject, PrsMgr_PresentableObject)
+ friend class SelectMgr_SelectionManager;
public:
//! Clears all selections of the object
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw )
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner);
//! If returns True, the old mechanism for highlighting
//! by storing its minimum and maximum 3d coordinates
//! to output parameters
Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox) = 0;
-
- //! Initializes the drawing tool theDrawer.
- Standard_EXPORT virtual void SetAttributes (const Handle(Prs3d_Drawer)& theDrawer);
-
- //! Returns the attributes settings.
- const Handle(Prs3d_Drawer)& Attributes() const
- {
- return myDrawer;
- }
-
- //! Clears settings provided by the drawing tool theDrawer.
- Standard_EXPORT virtual void UnsetAttributes();
-
- //! Initializes the hilight drawing tool theDrawer.
- Standard_EXPORT virtual void SetHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer);
-
- //! Returns the hilight attributes settings.
- const Handle(Prs3d_Drawer)& HilightAttributes() const
- {
- return myHilightDrawer;
- }
- //! Clears settings provided by the hilight drawing tool theDrawer.
- Standard_EXPORT virtual void UnsetHilightAttributes();
-
- //! Initializes theDrawer by default hilight settings.
- Standard_EXPORT static void InitDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer);
-
//! Sets common entity owner for assembly sensitive object entities
Standard_EXPORT void SetAssemblyOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer theMode = -1);
//! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const;
-
-friend class SelectMgr_SelectionManager;
-
-
- DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectableObject,PrsMgr_PresentableObject)
-
protected:
Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
protected:
SelectMgr_SequenceOfSelection myselections;
- Handle(Prs3d_Drawer) myDrawer;
- Handle(Prs3d_Drawer) myHilightDrawer;
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
Standard_Boolean myAutoHilight;
StdSelect_SensitivityMode.hxx
StdSelect_Shape.cxx
StdSelect_Shape.hxx
-StdSelect_Shape.lxx
StdSelect_ShapeTypeFilter.cxx
StdSelect_ShapeTypeFilter.hxx
StdSelect_ShapeTypeFilter.lxx
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <StdSelect_BRepOwner.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Prs3d_Drawer.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <Standard_Type.hxx>
-#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_Shape.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StdSelect_BRepOwner,SelectMgr_EntityOwner)
//==================================================
-// Function:
+// Function: StdSelect_BRepOwner
// Purpose :
//==================================================
-StdSelect_BRepOwner::StdSelect_BRepOwner(const Standard_Integer aPriority):
-SelectMgr_EntityOwner(aPriority),
-myFromDecomposition(Standard_False),
-myCurMode(0)
+StdSelect_BRepOwner::StdSelect_BRepOwner (const Standard_Integer thePriority)
+: SelectMgr_EntityOwner (thePriority),
+ myCurMode (0)
{
+ //
}
-StdSelect_BRepOwner::StdSelect_BRepOwner(const TopoDS_Shape& aShape,
- const Standard_Integer aPriority,
- const Standard_Boolean ComesFromDecomposition):
-SelectMgr_EntityOwner(aPriority),
-myFromDecomposition(ComesFromDecomposition),
-myShape(aShape),
-myCurMode(0)
+//==================================================
+// Function: StdSelect_BRepOwner
+// Purpose :
+//==================================================
+StdSelect_BRepOwner::StdSelect_BRepOwner (const TopoDS_Shape& theShape,
+ const Standard_Integer thePriority,
+ const Standard_Boolean theComesFromDecomposition)
+: SelectMgr_EntityOwner (thePriority),
+ myShape (theShape),
+ myCurMode (0)
{
+ myFromDecomposition = theComesFromDecomposition;
}
-StdSelect_BRepOwner::StdSelect_BRepOwner(const TopoDS_Shape& aShape,
- const Handle (SelectMgr_SelectableObject)& theOrigin,
- const Standard_Integer aPriority,
- const Standard_Boolean ComesFromDecomposition):
-SelectMgr_EntityOwner(theOrigin,aPriority),
-myFromDecomposition(ComesFromDecomposition),
-myShape(aShape),
-myCurMode(0)
+//==================================================
+// Function: StdSelect_BRepOwner
+// Purpose :
+//==================================================
+StdSelect_BRepOwner::StdSelect_BRepOwner (const TopoDS_Shape& theShape,
+ const Handle (SelectMgr_SelectableObject)& theOrigin,
+ const Standard_Integer thePriority,
+ const Standard_Boolean theComesFromDecomposition)
+: SelectMgr_EntityOwner (theOrigin, thePriority),
+ myShape (theShape),
+ myCurMode (0)
{
+ myFromDecomposition = theComesFromDecomposition;
}
//=======================================================================
//purpose :
//=======================================================================
void StdSelect_BRepOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
- Standard_Integer M = (theMode < 0) ? myCurMode : theMode;
- Graphic3d_ZLayerId aHiLayer = this == Selectable()->GlobalSelOwner().get() ?
- Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
- Handle(SelectMgr_SelectableObject) aSel = Selectable();
-
- if (myFromDecomposition)
+ if (!HasSelectable())
{
- // do the update flag check
- if (!myPrsSh.IsNull())
- {
- TColStd_ListOfInteger aModesList;
- myPrsSh->ToBeUpdated (aModesList);
- if (!aModesList.IsEmpty())
- myPrsSh.Nullify();
- }
-
- Handle(Prs3d_Drawer) aDrawer;
- if (!aSel.IsNull())
- {
- aDrawer = aSel->HilightAttributes();
- }
- else
- {
- aDrawer = new Prs3d_Drawer();
- SelectMgr_SelectableObject::InitDefaultHilightAttributes (aDrawer);
- }
+ return;
+ }
- // generate new presentable shape
- if(myPrsSh.IsNull())
- {
- if(HasLocation())
- {
- TopLoc_Location lbid = Location() * myShape.Location();
- TopoDS_Shape ShBis = myShape.Located(lbid);
- myPrsSh = new StdSelect_Shape(ShBis, aDrawer);
- }
- else
- myPrsSh = new StdSelect_Shape(myShape, aDrawer);
- }
- if (!aSel.IsNull())
- {
- myPrsSh->SetZLayer (aSel->ZLayer());
- myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
- }
+ const Standard_Integer aDispMode = (theMode < 0) ? myCurMode : theMode;
+ Handle(SelectMgr_SelectableObject) aSel = Selectable();
+ const Graphic3d_ZLayerId aHiLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : aSel->ZLayer();
+ if (!myFromDecomposition)
+ {
+ thePM->Color (aSel, theStyle, aDispMode, NULL, aHiLayer);
+ return;
+ }
- // highlight with color and set layer
- thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
+ // do the update flag check
+ if (!myPrsSh.IsNull())
+ {
+ TColStd_ListOfInteger aModesList;
+ myPrsSh->ToBeUpdated (aModesList);
+ if (!aModesList.IsEmpty())
+ myPrsSh.Nullify();
}
- else
+
+ // generate new presentable shape
+ if (myPrsSh.IsNull())
{
- if (!myPrsSh.IsNull())
+ if (HasLocation())
{
- thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
+ TopLoc_Location lbid = Location() * myShape.Location();
+ TopoDS_Shape ShBis = myShape.Located(lbid);
+ myPrsSh = new StdSelect_Shape (ShBis, theStyle);
}
else
{
- thePM->Color (aSel, theStyle, M, NULL, aHiLayer);
+ myPrsSh = new StdSelect_Shape (myShape, theStyle);
}
}
+
+ // initialize presentation attributes of child presentation
+ myPrsSh->SetZLayer (aSel->ZLayer());
+ myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
+ myPrsSh->Attributes()->SetLink (theStyle);
+ myPrsSh->Attributes()->SetColor (theStyle->Color());
+ myPrsSh->Attributes()->SetTransparency (theStyle->Transparency());
+ myPrsSh->Attributes()->SetBasicFillAreaAspect (theStyle->BasicFillAreaAspect());
+
+ // highlight with color and set layer
+ thePM->Color (myPrsSh, theStyle, aDispMode, aSel, aHiLayer);
}
-void StdSelect_BRepOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
- const Standard_Integer aMode)
+void StdSelect_BRepOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer )
{
- Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
- if(myPrsSh.IsNull() || !myFromDecomposition)
- PM->Unhighlight(Selectable(),M);
+ if (myPrsSh.IsNull() || !myFromDecomposition)
+ {
+ thePrsMgr->Unhighlight (Selectable());
+ }
else
- PM->Unhighlight(myPrsSh,M);
+ {
+ thePrsMgr->Unhighlight (myPrsSh);
+ }
}
void StdSelect_BRepOwner::Clear(const Handle(PrsMgr_PresentationManager)& PM,
myPrsSh->SetToUpdate();
}
-//=======================================================================
-//function : SetZLayer
-//purpose :
-//=======================================================================
-void StdSelect_BRepOwner::SetZLayer (const Graphic3d_ZLayerId theLayerId)
-{
- if (!myPrsSh.IsNull())
- {
- myPrsSh->SetZLayer (theLayerId);
- }
-}
-
//=======================================================================
//function : UpdateHighlightTrsf
//purpose :
class PrsMgr_PresentationManager;
class TopLoc_Location;
-
-class StdSelect_BRepOwner;
DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
//! Defines Specific Owners for Sensitive Primitives
//! must be redefined by each User.
class StdSelect_BRepOwner : public SelectMgr_EntityOwner
{
-
+ DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
public:
-
//! Constructs an owner specification framework defined
//! by the priority aPriority.
Standard_EXPORT StdSelect_BRepOwner(const Standard_Integer aPriority);
Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Handle(SelectMgr_SelectableObject)& theOrigin, const Standard_Integer aPriority = 0, const Standard_Boolean FromDecomposition = Standard_False);
//! returns False if no shape was set
- Standard_Boolean HasShape() const;
-
+ Standard_Boolean HasShape() const { return !myShape.IsNull(); }
+
//! <FromDecomposition> indicates whether <aShape>
//! comes from decomposition of a bigger shape.
Standard_EXPORT void Set (const TopoDS_Shape& aShape, const Standard_Boolean FromDecomposition = Standard_False);
-
- Standard_Boolean ComesFromDecomposition() const;
-
- const TopoDS_Shape& Shape() const;
-
+
+ const TopoDS_Shape& Shape() const { return myShape; }
//! Returns true if this framework has a highlight mode defined for it.
- Standard_Boolean HasHilightMode() const;
+ Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
//! Sets the highlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
- void SetHilightMode (const Standard_Integer aMode);
-
+ void SetHilightMode (const Standard_Integer theMode) { myCurMode = theMode; }
+
//! Resets the higlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
- void ResetHilightMode();
-
+ void ResetHilightMode() { myCurMode = -1; }
+
//! Returns the highlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
- Standard_Integer HilightMode() const;
-
+ Standard_Integer HilightMode() const { return myCurMode; }
+
//! Returns true if an object with the selection mode
//! aMode is highlighted in the presentation manager aPM.
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Handle(Graphic3d_HighlightStyle)& theStyle,
+ const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Removes highlighting from the type of shape
Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
Standard_EXPORT virtual void ResetLocation() Standard_OVERRIDE;
-
- //! Set Z layer ID and update all presentations.
- Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId) Standard_OVERRIDE;
//! Implements immediate application of location transformation of parent object to dynamic highlight structure
Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
const Handle(PrsMgr_PresentationManager3d)& theManager,
const Standard_Integer theDispMode) Standard_OVERRIDE;
- DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner,SelectMgr_EntityOwner)
-
protected:
-
- Standard_Boolean myFromDecomposition;
TopoDS_Shape myShape;
-
-
-private:
-
-
Handle(StdSelect_Shape) myPrsSh;
Standard_Integer myCurMode;
-
};
-
-#include <StdSelect_BRepOwner.lxx>
-
-
-
-
-
#endif // _StdSelect_BRepOwner_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <StdSelect_BRepSelectionTool.hxx>
#include <Bnd_Box.hxx>
#include <BRep_Tool.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_NullObject.hxx>
#include <StdSelect_BRepOwner.hxx>
-#include <StdSelect_BRepSelectionTool.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
// Function: Load
// Purpose :
//==================================================
-void StdSelect_BRepSelectionTool
-::Load (const Handle(SelectMgr_Selection)& theSelection,
- const TopoDS_Shape& theShape,
- const TopAbs_ShapeEnum theType,
- const Standard_Real theDeflection,
- const Standard_Real theDeviationAngle,
- const Standard_Boolean isAutoTriangulation,
- const Standard_Integer thePriority,
- const Standard_Integer theNbPOnEdge,
- const Standard_Real theMaxParam)
+void StdSelect_BRepSelectionTool::Load (const Handle(SelectMgr_Selection)& theSelection,
+ const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theType,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeviationAngle,
+ const Standard_Boolean isAutoTriangulation,
+ const Standard_Integer thePriority,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxParam)
{
Standard_Integer aPriority = (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
// Function: Load
// Purpose :
//==================================================
-void StdSelect_BRepSelectionTool
-::Load (const Handle(SelectMgr_Selection)& theSelection,
- const Handle(SelectMgr_SelectableObject)& theSelectableObj,
- const TopoDS_Shape& theShape,
- const TopAbs_ShapeEnum theType,
- const Standard_Real theDeflection,
- const Standard_Real theDeviationAngle,
- const Standard_Boolean isAutoTriangulation,
- const Standard_Integer thePriority,
- const Standard_Integer theNbPOnEdge,
- const Standard_Real theMaxParam)
+void StdSelect_BRepSelectionTool::Load (const Handle(SelectMgr_Selection)& theSelection,
+ const Handle(SelectMgr_SelectableObject)& theSelectableObj,
+ const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theType,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeviationAngle,
+ const Standard_Boolean isAutoTriangulation,
+ const Standard_Integer thePriority,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxParam)
{
Load (theSelection,
theShape,
// Function: ComputeSensitive
// Purpose :
//==================================================
-void StdSelect_BRepSelectionTool
-::ComputeSensitive (const TopoDS_Shape& theShape,
- const Handle(StdSelect_BRepOwner)& theOwner,
- const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Real theDeflection,
- const Standard_Real theDeviationAngle,
- const Standard_Integer theNbPOnEdge,
- const Standard_Real theMaxParam,
- const Standard_Boolean isAutoTriangulation)
+void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeviationAngle,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxParam,
+ const Standard_Boolean isAutoTriangulation)
{
switch (theShape.ShapeType())
{
//=====================================================
// Function : GetEdgeSensitive
-// Purpose : create a sensitive edge to add it
-// in computeselection to "aselection" (case of selection of an edge)
-// or to "aSensitiveWire" (case of selection of a wire; in this case,
-// the sensitive wire is added to "aselection" )
-// odl - for selection by rectangle -
+// Purpose :
//=====================================================
-void StdSelect_BRepSelectionTool
-::GetEdgeSensitive (const TopoDS_Shape& theShape,
- const Handle(StdSelect_BRepOwner)& theOwner,
- const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Real theDeflection,
- const Standard_Real theDeviationAngle,
- const Standard_Integer theNbPOnEdge,
- const Standard_Real theMaxParam,
- Handle(Select3D_SensitiveEntity)& theSensitive)
+void StdSelect_BRepSelectionTool::GetEdgeSensitive (const TopoDS_Shape& theShape,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeviationAngle,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxParam,
+ Handle(Select3D_SensitiveEntity)& theSensitive)
{
const TopoDS_Edge& anEdge = TopoDS::Edge (theShape);
BRepAdaptor_Curve cu3d;
}
}
-//=====================================================
-// Function : GetStandardPriority
-// Purpose :
-//=====================================================
-Standard_Integer StdSelect_BRepSelectionTool::GetStandardPriority (const TopoDS_Shape& theShape,
- const TopAbs_ShapeEnum theType)
-{
- switch (theType)
- {
- case TopAbs_VERTEX: return 8;
- case TopAbs_EDGE: return 7;
- case TopAbs_WIRE: return 6;
- case TopAbs_FACE: return 5;
- case TopAbs_SHAPE:
- default:
- switch (theShape.ShapeType())
- {
- case TopAbs_VERTEX: return 9;
- case TopAbs_EDGE: return 8;
- case TopAbs_WIRE: return 7;
- case TopAbs_FACE: return 6;
- case TopAbs_SHELL: return 5;
- case TopAbs_COMPOUND:
- case TopAbs_COMPSOLID:
- case TopAbs_SOLID:
- case TopAbs_SHAPE:
- default:
- return 4;
- }
- }
-}
-
//=======================================================================
//function : GetSensitiveEntityForFace
//purpose :
//=======================================================================
-Standard_Boolean StdSelect_BRepSelectionTool
-::GetSensitiveForFace (const TopoDS_Face& theFace,
- const Handle(StdSelect_BRepOwner)& theOwner,
- Select3D_EntitySequence& theSensitiveList,
- const Standard_Boolean /*theAutoTriangulation*/,
- const Standard_Integer NbPOnEdge,
- const Standard_Real theMaxParam,
- const Standard_Boolean theInteriorFlag)
+Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_Face& theFace,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ Select3D_EntitySequence& theSensitiveList,
+ const Standard_Boolean /*theAutoTriangulation*/,
+ const Standard_Integer NbPOnEdge,
+ const Standard_Real theMaxParam,
+ const Standard_Boolean theInteriorFlag)
{
// check if there is triangulation of the face...
TopLoc_Location aLoc;
class StdSelect_BRepSelectionTool
{
public:
-
DEFINE_STANDARD_ALLOC
-
//! Decomposition of <aShape> into sensitive entities following
//! a mode of decomposition <aType>. These entities are stored in <aSelection>.
//! BrepOwners are created to store the identity of the picked shapes
//! You can use the function Load to modify the
//! selection priority of an owner to make one entity
//! more selectable than another one.
- Standard_EXPORT static Standard_Integer GetStandardPriority (const TopoDS_Shape& aShap, const TopAbs_ShapeEnum aType);
-
- //! Computes the sensitive primitives corresponding to
- //! the subshape aShape with the owner anOwner.
- //! Stores them in the SelectMgr_Selection object, and returns this object.
- //! The number NbPOnEdge is used to define edges and wires.
- //! In the case of infinite objects, the value
- //! MaximalParameter serves to limit computation time
- //! by limiting the sensitive area. The default value is 500.
- //! If AutoTriangulation is true, triangulation will be
- //! computed for the faces which have none. If it is false,
- //! sensitive entities on these faces will be calculated.
- Standard_EXPORT static void ComputeSensitive (const TopoDS_Shape& aShape, const Handle(StdSelect_BRepOwner)& anOwner, const Handle(SelectMgr_Selection)& aSelection, const Standard_Real theDeflection, const Standard_Real theDeviationAngle, const Standard_Integer NbPOnEdge, const Standard_Real MaximalParameter, const Standard_Boolean AutoTriangulation = Standard_True);
-
- //! appends to <OutList> the 3D
- //! sensitive entities created for selection of <aFace>
- //! if<InteriorFlag> = False the face will be sensitive only on its boundary
- Standard_EXPORT static Standard_Boolean GetSensitiveForFace (const TopoDS_Face& aFace, const Handle(StdSelect_BRepOwner)& anOwner, Select3D_EntitySequence& OutList, const Standard_Boolean AutoTriangulation = Standard_True, const Standard_Integer NbPOnEdge = 9, const Standard_Real MaxiParam = 500, const Standard_Boolean InteriorFlag = Standard_True);
+ static Standard_Integer GetStandardPriority (const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theType)
+ {
+ switch (theType)
+ {
+ case TopAbs_VERTEX: return 8;
+ case TopAbs_EDGE: return 7;
+ case TopAbs_WIRE: return 6;
+ case TopAbs_FACE: return 5;
+ case TopAbs_SHAPE:
+ default: break;
+ }
+
+ switch (theShape.ShapeType())
+ {
+ case TopAbs_VERTEX: return 9;
+ case TopAbs_EDGE: return 8;
+ case TopAbs_WIRE: return 7;
+ case TopAbs_FACE: return 6;
+ case TopAbs_SHELL: return 5;
+ case TopAbs_COMPOUND:
+ case TopAbs_COMPSOLID:
+ case TopAbs_SOLID:
+ case TopAbs_SHAPE:
+ default:
+ return 4;
+ }
+ }
+
+ //! Computes the sensitive primitives, stores them in the SelectMgr_Selection object, and returns this object.
+ //! @param theShape shape to compute sensitive entities
+ //! @param theOwner selectable owner object
+ //! @param theSelection selection to append new sensitive entities
+ //! @param theDeflection linear deflection
+ //! @param theDeflAngle angular deflection
+ //! @param theNbPOnEdge sensitivity parameters for edges and wires
+ //! @param theMaxiParam sensitivity parameters for infinite objects (the default value is 500)
+ //! @param theAutoTriang flag to compute triangulation for the faces which have none
+ Standard_EXPORT static void ComputeSensitive (const TopoDS_Shape& theShape,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeflAngle,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxiParam,
+ const Standard_Boolean theAutoTriang = Standard_True);
+
+ //! Creates the 3D sensitive entities for Face selection.
+ //! @param theFace face to compute sensitive entities
+ //! @param theOwner selectable owner object
+ //! @param theOutList output result list to append created entities
+ //! @param theAutoTriang obsolete flag (has no effect)
+ //! @param theNbPOnEdge sensitivity parameters
+ //! @param theMaxiParam sensitivity parameters
+ //! @param theInteriorFlag flag indicating that face interior (TRUE) or face boundary (FALSE) should be selectable
+ Standard_EXPORT static Standard_Boolean GetSensitiveForFace (const TopoDS_Face& theFace,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ Select3D_EntitySequence& theOutList,
+ const Standard_Boolean theAutoTriang = Standard_True,
+ const Standard_Integer theNbPOnEdge = 9,
+ const Standard_Real theMaxiParam = 500,
+ const Standard_Boolean theInteriorFlag = Standard_True);
+
+ //! Create a sensitive edge or sensitive wire.
+ //! @param theShape either TopoDS_Edge or TopoDS_Wire to compute sensitive entities
+ //! @param theOwner selectable owner object
+ //! @param theSelection selection to append new sensitive entities
+ //! @param theDeflection linear deflection
+ //! @param theDeviationAngle angular deflection
+ //! @param theNbPOnEdge sensitivity parameters
+ //! @param theMaxiParam sensitivity parameters
+ Standard_EXPORT static void GetEdgeSensitive (const TopoDS_Shape& theShape,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Real theDeflection,
+ const Standard_Real theDeviationAngle,
+ const Standard_Integer theNbPOnEdge,
+ const Standard_Real theMaxiParam,
+ Handle(Select3D_SensitiveEntity)& theSensitive);
//! Traverses the selection given and pre-builds BVH trees for heavyweight
- //! sensitive entities containing more than BVH_PRIMITIVE_LIMIT (defined in .cxx file)
- //! sub-elements
+ //! sensitive entities containing more than BVH_PRIMITIVE_LIMIT (defined in .cxx file) sub-elements.
Standard_EXPORT static void PreBuildBVH (const Handle(SelectMgr_Selection)& theSelection);
-
-protected:
-
-
-
-
-
-private:
-
- Standard_EXPORT static void GetEdgeSensitive (const TopoDS_Shape& aShape, const Handle(StdSelect_BRepOwner)& anOwner, const Handle(SelectMgr_Selection)& aSelection, const Standard_Real theDeflection, const Standard_Real theDeflectionAngle, const Standard_Integer NbPOnEdge, const Standard_Real MaximalParameter, Handle(Select3D_SensitiveEntity)& aSensitive);
-
-
-
-
};
-
-
-
-
-
-
#endif // _StdSelect_BRepSelectionTool_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <StdSelect_Shape.hxx>
#include <Geom_Transformation.hxx>
#include <Prs3d_Drawer.hxx>
#include <Standard_Type.hxx>
#include <StdPrs_WFShape.hxx>
#include <StdPrs_ShadedShape.hxx>
-#include <StdSelect_Shape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StdSelect_Shape,PrsMgr_PresentableObject)
-StdSelect_Shape::StdSelect_Shape (const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer):
- mysh (theShape),
- myDrawer (theDrawer)
-{}
+StdSelect_Shape::StdSelect_Shape (const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer)
+: mysh (theShape)
+{
+ if (!theDrawer.IsNull())
+ {
+ myDrawer->SetLink (theDrawer);
+ }
+}
void StdSelect_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*PM*/,
const Handle(Prs3d_Presentation)& P,
#include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Standard_Integer.hxx>
+
class TopoDS_Shape;
class Prs3d_Presentation;
class Prs3d_Projector;
class Geom_Transformation;
-
-class StdSelect_Shape;
-DEFINE_STANDARD_HANDLE(StdSelect_Shape, PrsMgr_PresentableObject)
-
//! Presentable shape only for purpose of display for BRepOwner...
class StdSelect_Shape : public PrsMgr_PresentableObject
{
-
+ DEFINE_STANDARD_RTTIEXT(StdSelect_Shape, PrsMgr_PresentableObject)
public:
-
- Standard_EXPORT StdSelect_Shape(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer);
+ Standard_EXPORT StdSelect_Shape(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer = Handle(Prs3d_Drawer)());
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
//! WARNING :<aTrsf> must be applied
//! to the object to display before computation !!!
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
-
- const TopoDS_Shape& Shape() const;
-
- void Shape (const TopoDS_Shape& sh);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StdSelect_Shape,PrsMgr_PresentableObject)
-
-protected:
-
+ const TopoDS_Shape& Shape() const { return mysh; }
+ void Shape (const TopoDS_Shape& theShape) { mysh = theShape; }
private:
-
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
- TopoDS_Shape mysh;
- Handle(Prs3d_Drawer) myDrawer;
+private:
+ TopoDS_Shape mysh;
};
-
-#include <StdSelect_Shape.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(StdSelect_Shape, PrsMgr_PresentableObject)
#endif // _StdSelect_Shape_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
const Standard_Integer theDispMode,
const TCollection_AsciiString& theName,
const ViewerTest_BndAction theAction,
- const Handle(Graphic3d_HighlightStyle)& theStyle)
+ const Handle(Prs3d_Drawer)& theStyle)
{
switch (theAction)
{
case BndAction_Hide:
{
- theMgr->Unhighlight (theObj, theDispMode);
+ theMgr->Unhighlight (theObj);
break;
}
case BndAction_Show:
ViewerTest_BndAction anAction = BndAction_Show;
Standard_Integer aMode = -1;
- Handle(Graphic3d_HighlightStyle) aStyle;
+ Handle(Prs3d_Drawer) aStyle;
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
}
if (anAction == BndAction_Show)
- aStyle = new Graphic3d_HighlightStyle (Aspect_TOHM_BOUNDBOX, Quantity_NOC_GRAY99, 0.0);
+ {
+ aStyle = new Prs3d_Drawer();
+ aStyle->SetMethod (Aspect_TOHM_BOUNDBOX);
+ aStyle->SetColor (Quantity_NOC_GRAY99);
+ }
Standard_Integer aHighlightedMode = -1;
if (anArgIter < theArgNb)
Handle(AIS_InteractiveObject) anObject =
Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
- // Enable trianle edge mode
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeOn();
+ // Enable triangle edge mode
+ if (!anObject->Attributes()->HasOwnShadingAspect())
+ {
+ anObject->Attributes()->SetShadingAspect (new Prs3d_ShadingAspect());
+ *anObject->Attributes()->ShadingAspect()->Aspect() = *anObject->Attributes()->Link()->ShadingAspect()->Aspect();
+ }
+ const Handle(Prs3d_ShadingAspect)& aFillAreaAspect = anObject->Attributes()->ShadingAspect();
+ aFillAreaAspect->Aspect()->SetEdgeOn();
// Parse parameters
for (Standard_Integer anIt = 2; anIt < theArgNum; ++anIt)
aB > 1 ? aB / 255.0 : aB,
Quantity_TOC_RGB);
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeColor (aColor);
+ aFillAreaAspect->Aspect()->SetEdgeColor (aColor);
}
else if (aParam.IsEqual ("-force"))
{
}
else
{
- anObject->SetAspect (anObject->Attributes()->ShadingAspect());
+ anObject->SetAspect (aFillAreaAspect);
}
//Update view
return 0;
}
-//===============================================================================================
-//function : parseColor
-//purpose :
-//===============================================================================================
-static Standard_Boolean parseColor (ViewerTest_CmdParser& theParser,
- const std::string& theOptionName,
- Quantity_Color& theColor)
-{
- std::string aColorArg = theParser.Arg (theOptionName, 0);
- if (std::isdigit (aColorArg[0]))
- {
- Graphic3d_Vec3d aColor = theParser.ArgVec3d (theOptionName);
- if (aColor.x() < 0.0 || aColor.x() > 1.0
- || aColor.y() < 0.0 || aColor.y() > 1.0
- || aColor.z() < 0.0 || aColor.z() > 1.0)
- {
- std::cerr << "Error: RGB color values should be within range 0..1!\n";
- return Standard_False;
- }
- theColor.SetValues (aColor.x(), aColor.y(), aColor.z(), Quantity_TOC_RGB);
- }
- else
- {
- Quantity_NameOfColor aName = Quantity_NOC_BLACK;
- if (!Quantity_Color::ColorFromName (aColorArg.c_str(), aName))
- {
- std::cerr << "Name: " << theParser.Arg (theOptionName, 0)
- << " does not correspond to any color in Quantity_NameOfColor!"
- << std::endl;
- return Standard_False;
- }
- theColor.SetValues (aName);
- }
-
- return Standard_True;
-}
-
//===============================================================================================
//function : VSelectionProperties
//purpose :
return 1;
}
- ViewerTest_CmdParser aCmd;
+ Standard_Boolean toPrint = theArgsNb == 1;
+ Standard_Boolean toRedraw = Standard_False;
+ Standard_Integer anArgIter = 1;
+ Prs3d_TypeOfHighlight aType = Prs3d_TypeOfHighlight_None;
+ if (anArgIter < theArgsNb)
+ {
+ TCollection_AsciiString anArgFirst (theArgVec[anArgIter]);
+ anArgFirst.LowerCase();
+ ++anArgIter;
+ if (anArgFirst == "dynhighlight"
+ || anArgFirst == "dynhilight"
+ || anArgFirst == "dynamichighlight"
+ || anArgFirst == "dynamichilight")
+ {
+ aType = Prs3d_TypeOfHighlight_Dynamic;
+ }
+ else if (anArgFirst == "localdynhighlight"
+ || anArgFirst == "localdynhilight"
+ || anArgFirst == "localdynamichighlight"
+ || anArgFirst == "localdynamichilight")
+ {
+ aType = Prs3d_TypeOfHighlight_LocalDynamic;
+ }
+ else if (anArgFirst == "selhighlight"
+ || anArgFirst == "selhilight"
+ || anArgFirst == "selectedhighlight"
+ || anArgFirst == "selectedhilight")
+ {
+ aType = Prs3d_TypeOfHighlight_Selected;
+ }
+ else if (anArgFirst == "localselhighlight"
+ || anArgFirst == "localselhilight"
+ || anArgFirst == "localselectedhighlight"
+ || anArgFirst == "localselectedhilight")
+ {
+ aType = Prs3d_TypeOfHighlight_LocalSelected;
+ }
+ else
+ {
+ --anArgIter;
+ }
+ }
+ for (; anArgIter < theArgsNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-help")
+ {
+ theDi.PrintHelp (theArgVec[0]);
+ return 0;
+ }
+ else if (anArg == "-print")
+ {
+ toPrint = Standard_True;
+ }
+ else if (anArg == "-autoactivate")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (anArgIter + 1 < theArgsNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aCtx->SetAutoActivateSelection (toEnable);
+ }
+ else if (anArg == "-pixtol"
+ && anArgIter + 1 < theArgsNb)
+ {
+ aCtx->SetPixelTolerance (Draw::Atoi (theArgVec[++anArgIter]));
+ }
+ else if ((anArg == "-mode"
+ || anArg == "-dispmode")
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.AddOption ("autoActivate");
- aCmd.AddOption ("pixTol");
+ const Standard_Integer aDispMode = Draw::Atoi (theArgVec[++anArgIter]);
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetDisplayMode (aDispMode);
+ toRedraw = Standard_True;
+ }
+ else if (anArg == "-layer"
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.AddOption ("selColor");
- aCmd.AddOption ("hiColor");
- aCmd.AddOption ("selTransp");
- aCmd.AddOption ("hiTransp");
+ const Standard_Integer aNewLayer = Draw::Atoi (theArgVec[++anArgIter]);
+ if (aNewLayer != Graphic3d_ZLayerId_UNKNOWN)
+ {
+ TColStd_SequenceOfInteger aLayers;
+ aCtx->CurrentViewer()->GetAllZLayers (aLayers);
+ if (std::find (aLayers.begin(), aLayers.end(), aNewLayer) == aLayers.end())
+ {
+ std::cout << "Syntax error: Layer " << aNewLayer << " is undefined\n";
+ return 1;
+ }
+ }
- aCmd.AddOption ("print");
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetZLayer (aNewLayer);
+ toRedraw = Standard_True;
+ }
+ else if (anArg == "-hicolor"
+ || anArg == "-selcolor"
+ || anArg == "-color")
+ {
+ if (anArg.StartsWith ("-hi"))
+ {
+ aType = Prs3d_TypeOfHighlight_Dynamic;
+ }
+ else if (anArg.StartsWith ("-sel"))
+ {
+ aType = Prs3d_TypeOfHighlight_Selected;
+ }
+ else if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.Parse (theArgsNb, theArgVec);
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aColor);
+ if (aNbParsed == 0)
+ {
+ std::cout << "Syntax error: need more arguments.\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
- if (aCmd.HasOption ("help"))
- {
- theDi.PrintHelp (theArgVec[0]);
- return 0;
- }
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetColor (aColor);
+ toRedraw = Standard_True;
+ }
+ else if ((anArg == "-transp"
+ || anArg == "-transparency"
+ || anArg == "-hitransp"
+ || anArg == "-seltransp"
+ || anArg == "-hitransplocal"
+ || anArg == "-seltransplocal")