mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025695: Visualization, AIS_InteractiveContext - define default HilightMode
AIS_InteractiveContext - removed the following unused properties: - PreSelectionColor(), DefaultColor(), WasCurrentTouched(), ZDetection(). AIS_InteractiveObject - removed unused property SelectionPriority(). Prs3d_Drawer - removed properties HighlightStyle() and SelectionStyle(). Graphic3d_HighlightStyle has been superseded by Prs3d_Drawer inheriting from new class Graphic3d_PresentationAttributes. Graphic3d_PresentationAttributes (as Graphic3d_HighlightStyle replacement) has been extended with new properties: - ZLayer() defining Z-Layer for highlighting presentation. - DisplayMode() defining display mode for highlighting. StdSelect_BRepSelectionTool methods have been corrected to take SelectMgr_EntityOwner instead of StdSelect_BRepOwner. StdSelect_Shape - duplicated field myDrawer has been dropped. AIS_InteractiveObject - myDrawer->Color() is now used instead of myOwnColor, myDrawer->Transparency() instead of myTransparency and myDrawer->ZLayer() instead of myZLayer. PrsMgr_PresentationManager::Unhighlight() now unhighlight all modes. The method taking Mode as argument has been marked deprecated. New enumeration Prs3d_TypeOfHighlight has been introduced defining different highlight types. AIS_InteractiveObject::HighlightStyle() now takes enumeration argument and defines different styles for Global and Local selection. ComesFromDecomposition() property has been moved from StdSelect_BRepOwner to SelectMgr_EntityOwner.
This commit is contained in:
@@ -9,7 +9,6 @@ SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx
|
||||
SelectMgr_DataMapOfObjectSelectors.hxx
|
||||
SelectMgr_EntityOwner.cxx
|
||||
SelectMgr_EntityOwner.hxx
|
||||
SelectMgr_EntityOwner.lxx
|
||||
SelectMgr_Filter.cxx
|
||||
SelectMgr_Filter.hxx
|
||||
SelectMgr_Frustum.hxx
|
||||
|
@@ -14,10 +14,9 @@
|
||||
// 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>
|
||||
@@ -25,84 +24,101 @@
|
||||
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)&,
|
||||
@@ -136,10 +152,8 @@ void SelectMgr_EntityOwner::ResetLocation()
|
||||
|
||||
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
|
||||
|
@@ -17,27 +17,19 @@
|
||||
#ifndef _SelectMgr_EntityOwner_HeaderFile
|
||||
#define _SelectMgr_EntityOwner_HeaderFile
|
||||
|
||||
#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 <Quantity_NameOfColor.hxx>
|
||||
#include <Graphic3d_HighlightStyle.hxx>
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
class Standard_NoSuchObject;
|
||||
class PrsMgr_PresentationManager;
|
||||
class TopLoc_Location;
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
|
||||
class V3d_Viewer;
|
||||
|
||||
|
||||
class SelectMgr_EntityOwner;
|
||||
DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
|
||||
|
||||
//! A framework to define classes of owners of sensitive primitives.
|
||||
//! The owner is the link between application and
|
||||
//! selection data structures.
|
||||
@@ -45,31 +37,29 @@ DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
|
||||
//! 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;
|
||||
@@ -79,16 +69,15 @@ public:
|
||||
//! 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);
|
||||
@@ -103,17 +92,17 @@ public:
|
||||
|
||||
//! 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;
|
||||
@@ -137,28 +126,25 @@ public:
|
||||
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; }
|
||||
|
||||
public:
|
||||
|
||||
//! Sets the selectable object.
|
||||
void Set (const Handle(SelectMgr_SelectableObject)& theSelObj) { SetSelectable (theSelObj); }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
SelectMgr_SOPtr mySelectable;
|
||||
Standard_Boolean myIsSelected;
|
||||
|
||||
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
|
||||
|
@@ -1,27 +0,0 @@
|
||||
// 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; }
|
@@ -14,6 +14,7 @@
|
||||
// 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>
|
||||
@@ -31,7 +32,6 @@
|
||||
#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>
|
||||
@@ -50,23 +50,18 @@ static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq,
|
||||
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);
|
||||
//
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -319,7 +314,7 @@ void SelectMgr_SelectableObject::ClearSelected ()
|
||||
//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");
|
||||
@@ -438,120 +433,6 @@ void SelectMgr_SelectableObject::updateSelection (const Standard_Integer theMode
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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
|
||||
|
@@ -53,7 +53,8 @@ DEFINE_STANDARD_HANDLE(SelectMgr_SelectableObject, PrsMgr_PresentableObject)
|
||||
//! 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
|
||||
@@ -143,7 +144,7 @@ public:
|
||||
//! 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
|
||||
@@ -176,34 +177,7 @@ public:
|
||||
//! 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);
|
||||
|
||||
@@ -223,12 +197,6 @@ public:
|
||||
//! 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);
|
||||
@@ -243,8 +211,6 @@ protected:
|
||||
protected:
|
||||
|
||||
SelectMgr_SequenceOfSelection myselections;
|
||||
Handle(Prs3d_Drawer) myDrawer;
|
||||
Handle(Prs3d_Drawer) myHilightDrawer;
|
||||
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
|
||||
Standard_Boolean myAutoHilight;
|
||||
|
||||
|
Reference in New Issue
Block a user