mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027818: Visualization - provide an interface to define highlight presentation properties
- introduces a wrapper for setting up highlight properties: Graphic3d_HighlightStyle; - API of all methods that use highlight or selection color is changed to deal with Graphic3d_HighlightStyle; - highlight in shading mode now supports transparency, implemented via blending; - transparency for selection can also be set, but implementing custom entity owners with additional presentation on application level; - methods PrsMgr_PresentationManager::Highlight, PrsMgr_PresentationManager::BoundBox that highlight object with hard-coded color are removed; - deprecated methods of SelectMgr_EntityOwner, that use presentation manager's highlight method, were removed; - methods of IsHilighted AIS context with selection color checks were replaced; - added API to store dynamic and selection highlight to Prs3d_Drawer class; - customization of dynamic and selection highlight for particular objects is now available through SelectMgr_SelectableObject::HilightAttributes(); - AIS_InteractiveContext highlight methods were updated to support individual highlight styles of interactive objects; - introduced new command - vselprops, that allows to customize global selection and highlight properties like autoactivation, pixel tolerance and colors; - Draw Harness commands vautoactivatesel and vselprecision were removed, use vselprops instead; - fixed bug in command's parser; - test case for issue #27818
This commit is contained in:
parent
3a9b5dc86a
commit
8e5fb5eabc
@ -1045,6 +1045,24 @@ Flags *Graphic3d_TMF_PanPers* and *Graphic3d_TMF_FullPers* has been removed.
|
|||||||
Several transformation persistence methods in PrsMgr_PresentableObject have been marked deprecated.
|
Several transformation persistence methods in PrsMgr_PresentableObject have been marked deprecated.
|
||||||
Transformation persistence should be defined using directly Graphic3d_TransformPers constructor and passed by a handle, not value.
|
Transformation persistence should be defined using directly Graphic3d_TransformPers constructor and passed by a handle, not value.
|
||||||
|
|
||||||
|
@subsection_upgrade_710_selprops Dynamic highlight and selection properties
|
||||||
|
|
||||||
|
Release 7.1.0 introduces *Graphic3d_HighlightStyle* - an entity that allows flexible customization of highlighting parameters (such as method, highlight color and transparency). Therefore, API of methods related to highlighting in the following core classes:
|
||||||
|
- *AIS_InteractiveContext* (methods HilightWithColor(), Hilight());
|
||||||
|
- *PrsMgr_PresentationManager* (method Color());
|
||||||
|
- *SelectMgr_EntityOwner* (method HilightWithColor())
|
||||||
|
was changed to process Graphic3d_HighlightStyle instead of Quantity_Color.
|
||||||
|
|
||||||
|
Method AIS_InteractiveContext::Hilight is now deprecated and highlights interactive object with selection style.
|
||||||
|
|
||||||
|
Group of methods AIS_InteractiveContext::IsHilighted changed behavior - now they only check object's or owner's highlight flags in global status. If highlight color is required on application level, overloaded methods AIS_InteractiveContext::HighlightStyle for owner and object must be used instead.
|
||||||
|
|
||||||
|
The following methods were replaced in AIS_InteractiveContext API:
|
||||||
|
- *HilightColor*, *SetHilightColor* were replaced by *HighlightStyle*, *ChangeHighlightStyle*;
|
||||||
|
- *SelectionColor* setter and getter were replaced by *SelectionStyle*, *ChangeSelectionStyle*.
|
||||||
|
|
||||||
|
API of Prs3d_Drawer was extended to allow setting up styles for both dynamic selection and highlighting. Therefore, on application level changing highlight style for particular object must be implemented via SelectMgr_SelectableObject::HilightAttributes() and processed in entity owner.
|
||||||
|
|
||||||
@subsection upgrade_710_removed Removed features
|
@subsection upgrade_710_removed Removed features
|
||||||
|
|
||||||
The following obsolete features have been removed:
|
The following obsolete features have been removed:
|
||||||
@ -1057,6 +1075,8 @@ The following obsolete features have been removed:
|
|||||||
* 3D viewer printing API *V3d_View::Print()* has been removed. This functionality was available on Windows platforms only.
|
* 3D viewer printing API *V3d_View::Print()* has been removed. This functionality was available on Windows platforms only.
|
||||||
Applications should use general image dump API *V3d_View::ToPixMap()* and manage printing using platform-specific API at application level.
|
Applications should use general image dump API *V3d_View::ToPixMap()* and manage printing using platform-specific API at application level.
|
||||||
Text resolution can be managed by rendering parameter *Graphic3d_RenderingParams::Resolution*, returned by *V3d_View::ChangeRenderingParams()*.
|
Text resolution can be managed by rendering parameter *Graphic3d_RenderingParams::Resolution*, returned by *V3d_View::ChangeRenderingParams()*.
|
||||||
|
* Methods PrsMgr_PresentationManager::BoundBox, PrsMgr_PresentationManager::Hilight and SelectMgr_EntityOwner::Hilight were removed as not used.
|
||||||
|
Corresponding method in custom implementations of SelectMgr_EntityOwner can be removed safely. PrsMgr_PresentationManager::Color with corresponding style must be used instead of removed presentation manager's methods.
|
||||||
|
|
||||||
@subsection upgrade_occt710_correction_of_TObj_Model Correction in TObj_Model class
|
@subsection upgrade_occt710_correction_of_TObj_Model Correction in TObj_Model class
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ void Sample2D_Face::ClearSelected ()
|
|||||||
|
|
||||||
//Method for advanced customizable highlighting of picked object
|
//Method for advanced customizable highlighting of picked object
|
||||||
void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Handle(SelectMgr_EntityOwner)& theOwner)
|
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||||
{
|
{
|
||||||
Handle( Prs3d_Presentation ) aHighlightPrs;
|
Handle( Prs3d_Presentation ) aHighlightPrs;
|
||||||
@ -347,7 +347,7 @@ void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationMana
|
|||||||
Prs3d_Root::NewGroup ( aHighlightPrs );
|
Prs3d_Root::NewGroup ( aHighlightPrs );
|
||||||
Handle (Graphic3d_Group) aHilightGroup = Prs3d_Root::CurrentGroup(aHighlightPrs);
|
Handle (Graphic3d_Group) aHilightGroup = Prs3d_Root::CurrentGroup(aHighlightPrs);
|
||||||
Handle(Graphic3d_AspectLine3d) aLineAspect =
|
Handle(Graphic3d_AspectLine3d) aLineAspect =
|
||||||
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID,2);
|
new Graphic3d_AspectLine3d(theStyle->Color(), Aspect_TOL_SOLID,2);
|
||||||
switch(theOwner->Priority())
|
switch(theOwner->Priority())
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
|
@ -53,7 +53,7 @@ private:
|
|||||||
const SelectMgr_SequenceOfOwner& theOwners);
|
const SelectMgr_SequenceOfOwner& theOwners);
|
||||||
|
|
||||||
void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||||
|
|
||||||
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||||
|
@ -80,21 +80,6 @@ Standard_Boolean AIS_DimensionOwner::IsHilighted (const Handle(PrsMgr_Presentati
|
|||||||
return thePM->IsHighlighted (Selectable(), HighlightMode (mySelectionMode));
|
return thePM->IsHighlighted (Selectable(), HighlightMode (mySelectionMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Hilight
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void AIS_DimensionOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
|
||||||
const Standard_Integer /*theMode*/)
|
|
||||||
{
|
|
||||||
if (!HasSelectable())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thePM->Highlight (Selectable(), HighlightMode (mySelectionMode));
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Unhilight
|
//function : Unhilight
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -115,8 +100,8 @@ void AIS_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& th
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer /*theMode*/)
|
const Standard_Integer /*theMode*/)
|
||||||
{
|
{
|
||||||
thePM->Color (Selectable(), theColor, HighlightMode (mySelectionMode));
|
thePM->Color (Selectable(), theStyle, HighlightMode (mySelectionMode));
|
||||||
}
|
}
|
||||||
|
@ -57,14 +57,14 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT AIS_DimensionSelectionMode SelectionMode() const;
|
Standard_EXPORT AIS_DimensionSelectionMode SelectionMode() const;
|
||||||
|
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if an object with the selection mode
|
//! Returns true if an object with the selection mode
|
||||||
//! aMode is highlighted in the presentation manager aPM.
|
//! aMode is highlighted in the presentation manager aPM.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode = 0) const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode = 0) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Removes highlighting from the selected part of dimension.
|
//! 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;
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ myStatus(AIS_DS_None),
|
|||||||
myDispMode(AIS_WireFrame),
|
myDispMode(AIS_WireFrame),
|
||||||
myLayerIndex(0),
|
myLayerIndex(0),
|
||||||
myIsHilit(Standard_False),
|
myIsHilit(Standard_False),
|
||||||
myHiCol(Quantity_NOC_WHITE),
|
|
||||||
mySubInt(Standard_False)
|
mySubInt(Standard_False)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -36,13 +35,11 @@ AIS_GlobalStatus::AIS_GlobalStatus(const AIS_DisplayStatus DS,
|
|||||||
const Standard_Integer DMode,
|
const Standard_Integer DMode,
|
||||||
const Standard_Integer SMode,
|
const Standard_Integer SMode,
|
||||||
const Standard_Boolean /*ishilighted*/,
|
const Standard_Boolean /*ishilighted*/,
|
||||||
const Quantity_NameOfColor TheHiCol,
|
|
||||||
const Standard_Integer Layer):
|
const Standard_Integer Layer):
|
||||||
myStatus(DS),
|
myStatus(DS),
|
||||||
myDispMode(DMode),
|
myDispMode(DMode),
|
||||||
myLayerIndex(Layer),
|
myLayerIndex(Layer),
|
||||||
myIsHilit(Standard_False),
|
myIsHilit(Standard_False),
|
||||||
myHiCol(TheHiCol),
|
|
||||||
mySubInt(Standard_False)
|
mySubInt(Standard_False)
|
||||||
{
|
{
|
||||||
mySelModes.Append(SMode);
|
mySelModes.Append(SMode);
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
#include <AIS_DisplayStatus.hxx>
|
#include <AIS_DisplayStatus.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
#include <Standard_Integer.hxx>
|
#include <Standard_Integer.hxx>
|
||||||
#include <Standard_Boolean.hxx>
|
#include <Standard_Boolean.hxx>
|
||||||
#include <Quantity_NameOfColor.hxx>
|
|
||||||
#include <MMgt_TShared.hxx>
|
#include <MMgt_TShared.hxx>
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT AIS_GlobalStatus();
|
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 Quantity_NameOfColor TheHiCol = Quantity_NOC_WHITE, const Standard_Integer aLayerIndex = 0);
|
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 SetGraphicStatus (const AIS_DisplayStatus aStat);
|
||||||
|
|
||||||
@ -61,9 +61,19 @@ public:
|
|||||||
void SetLayerIndex (const Standard_Integer AnIndex);
|
void SetLayerIndex (const Standard_Integer AnIndex);
|
||||||
|
|
||||||
void SetHilightStatus (const Standard_Boolean aStat);
|
void SetHilightStatus (const Standard_Boolean aStat);
|
||||||
|
|
||||||
void SetHilightColor (const Quantity_NameOfColor aHiCol);
|
//! Changes applied highlight style for a particular object
|
||||||
|
void SetHilightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
|
{
|
||||||
|
myHiStyle = theStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns applied highlight style for a particular object
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& HilightStyle() const
|
||||||
|
{
|
||||||
|
return myHiStyle;
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean IsSubIntensityOn() const;
|
Standard_Boolean IsSubIntensityOn() const;
|
||||||
|
|
||||||
void SubIntensityOn();
|
void SubIntensityOn();
|
||||||
@ -81,9 +91,7 @@ public:
|
|||||||
const TColStd_ListOfInteger& SelectionModes() const;
|
const TColStd_ListOfInteger& SelectionModes() const;
|
||||||
|
|
||||||
Standard_Boolean IsHilighted() const;
|
Standard_Boolean IsHilighted() const;
|
||||||
|
|
||||||
Quantity_NameOfColor HilightColor() const;
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
|
Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
|
||||||
|
|
||||||
//! Returns layer index.
|
//! Returns layer index.
|
||||||
@ -109,7 +117,7 @@ private:
|
|||||||
TColStd_ListOfInteger mySelModes;
|
TColStd_ListOfInteger mySelModes;
|
||||||
Standard_Integer myLayerIndex;
|
Standard_Integer myLayerIndex;
|
||||||
Standard_Boolean myIsHilit;
|
Standard_Boolean myIsHilit;
|
||||||
Quantity_NameOfColor myHiCol;
|
Handle(Graphic3d_HighlightStyle) myHiStyle;
|
||||||
Standard_Boolean mySubInt;
|
Standard_Boolean mySubInt;
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@ inline void AIS_GlobalStatus::SetHilightStatus(const Standard_Boolean aStat)
|
|||||||
{
|
{
|
||||||
myIsHilit = aStat;
|
myIsHilit = aStat;
|
||||||
}
|
}
|
||||||
inline void AIS_GlobalStatus::SetHilightColor(const Quantity_NameOfColor aCol)
|
|
||||||
{myHiCol = aCol;}
|
|
||||||
|
|
||||||
inline Standard_Boolean AIS_GlobalStatus::IsSubIntensityOn() const
|
inline Standard_Boolean AIS_GlobalStatus::IsSubIntensityOn() const
|
||||||
{
|
{
|
||||||
@ -74,6 +72,3 @@ inline Standard_Boolean AIS_GlobalStatus::IsHilighted() const
|
|||||||
{
|
{
|
||||||
return myIsHilit;
|
return myIsHilit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_GlobalStatus::HilightColor() const
|
|
||||||
{return myHiCol;}
|
|
||||||
|
@ -88,10 +88,10 @@ myFilters(new SelectMgr_OrFilter()),
|
|||||||
myDefaultDrawer(new Prs3d_Drawer()),
|
myDefaultDrawer(new Prs3d_Drawer()),
|
||||||
mySelection(new AIS_Selection()),
|
mySelection(new AIS_Selection()),
|
||||||
myDefaultColor(Quantity_NOC_GOLDENROD),
|
myDefaultColor(Quantity_NOC_GOLDENROD),
|
||||||
myHilightColor(Quantity_NOC_CYAN1),
|
myHiStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_CYAN1)),
|
||||||
mySelectionColor(Quantity_NOC_GRAY80),
|
mySelStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY80)),
|
||||||
myPreselectionColor(Quantity_NOC_GREEN),
|
myPreselectionColor(Quantity_NOC_GREEN),
|
||||||
mySubIntensity(Quantity_NOC_GRAY40),
|
mySubintStyle(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY40)),
|
||||||
myDisplayMode(0),
|
myDisplayMode(0),
|
||||||
myCurLocalIndex(0),
|
myCurLocalIndex(0),
|
||||||
myAISCurDetected(0),
|
myAISCurDetected(0),
|
||||||
@ -445,7 +445,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
{
|
{
|
||||||
if(myMainPM->IsHighlighted (theIObj, anOldMode))
|
if(myMainPM->IsHighlighted (theIObj, anOldMode))
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, anOldMode);
|
unhighlightGlobal (theIObj, anOldMode);
|
||||||
}
|
}
|
||||||
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
if (aStatus->IsHilighted())
|
if (aStatus->IsHilighted())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
||||||
myMainPM->Color (theIObj, aStatus->HilightColor(), aHiMod);
|
highlightGlobal (theIObj, aStatus->HilightStyle(), aHiMod);
|
||||||
}
|
}
|
||||||
if (theSelectionMode != -1)
|
if (theSelectionMode != -1)
|
||||||
{
|
{
|
||||||
@ -847,85 +847,47 @@ void AIS_InteractiveContext::ClearPrs (const Handle(AIS_InteractiveObject)& theI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Hilight
|
//function : HilightWithColor
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIObj,
|
|
||||||
const Standard_Boolean theToUpdateViewer)
|
|
||||||
{
|
|
||||||
if (theIObj.IsNull())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
if (!HasOpenedContext())
|
|
||||||
{
|
|
||||||
if (!myObjects.IsBound (theIObj))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
|
||||||
aStatus->SetHilightStatus (Standard_True);
|
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
|
||||||
{
|
|
||||||
Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
|
||||||
myMainPM->Highlight (theIObj, aHilightMode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myLocalContexts (myCurLocalIndex)->Hilight (theIObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
|
||||||
{
|
|
||||||
myMainVwr->Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Hilight
|
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject)& theObj,
|
||||||
void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject)& anIObj,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Quantity_NameOfColor aCol,
|
const Standard_Boolean theIsToUpdate)
|
||||||
const Standard_Boolean updateviewer)
|
|
||||||
{
|
{
|
||||||
if(anIObj.IsNull()) return;
|
if (theObj.IsNull())
|
||||||
|
return;
|
||||||
|
|
||||||
if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
|
if (!theObj->HasInteractiveContext())
|
||||||
|
theObj->SetContext (this);
|
||||||
|
|
||||||
if (!HasOpenedContext())
|
if (!HasOpenedContext())
|
||||||
{
|
{
|
||||||
if(!myObjects.IsBound(anIObj)) return;
|
if (!myObjects.IsBound (theObj))
|
||||||
|
return;
|
||||||
|
|
||||||
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
|
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
|
||||||
aStatus->SetHilightStatus (Standard_True);
|
aStatus->SetHilightStatus (Standard_True);
|
||||||
|
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||||
{
|
{
|
||||||
const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
|
const Standard_Integer aHilightMode = theObj->HasHilightMode() ? theObj->HilightMode() : 0;
|
||||||
myMainPM->Color (anIObj, aCol, aHilightMode);
|
highlightGlobal (theObj, theStyle, aHilightMode);
|
||||||
aStatus->SetHilightColor (aCol);
|
aStatus->SetHilightStyle (theStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myLocalContexts(myCurLocalIndex)->Hilight(anIObj,aCol);
|
myLocalContexts (myCurLocalIndex)->Hilight (theObj, theStyle);
|
||||||
}
|
}
|
||||||
if(updateviewer) myMainVwr->Update();
|
|
||||||
|
if (theIsToUpdate)
|
||||||
|
myMainVwr->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Unhilight
|
//function : Unhilight
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
|
void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
|
||||||
{
|
{
|
||||||
if(anIObj.IsNull()) return;
|
if(anIObj.IsNull()) return;
|
||||||
@ -936,12 +898,12 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
|
|||||||
|
|
||||||
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
|
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
|
||||||
aStatus->SetHilightStatus (Standard_False);
|
aStatus->SetHilightStatus (Standard_False);
|
||||||
aStatus->SetHilightColor(Quantity_NOC_WHITE);
|
aStatus->SetHilightStyle (new Graphic3d_HighlightStyle());
|
||||||
|
|
||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||||
{
|
{
|
||||||
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
|
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
|
||||||
myMainPM->Unhighlight (anIObj, aHilightMode);
|
unhighlightGlobal (anIObj, aHilightMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -953,66 +915,35 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsHilighted
|
//function : IsHilighted
|
||||||
//purpose :
|
//purpose : Returns true if the objects global status is set to highlighted.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const
|
||||||
Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj) const
|
|
||||||
{
|
{
|
||||||
if(anIObj.IsNull()) return Standard_False;
|
if (!HasOpenedContext())
|
||||||
|
{
|
||||||
if (!HasOpenedContext()){
|
if (!myObjects.IsBound (theObj))
|
||||||
if(!myObjects.IsBound(anIObj))
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
return myObjects(anIObj)->IsHilighted();
|
|
||||||
}
|
|
||||||
AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
|
|
||||||
for(;ItM.More();ItM.Next()){
|
|
||||||
if(ItM.Value()->IsHilighted(anIObj))
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj,
|
return myObjects (theObj)->IsHilighted();
|
||||||
Standard_Boolean& WithColor,
|
|
||||||
Quantity_NameOfColor& TheHiCol) const
|
|
||||||
{
|
|
||||||
if(!HasOpenedContext()){
|
|
||||||
if(myObjects.IsBound(anIObj)){
|
|
||||||
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
|
|
||||||
if(STAT->IsHilighted()){
|
|
||||||
if(STAT->HilightColor()!=Quantity_NOC_WHITE){
|
|
||||||
WithColor=Standard_True;
|
|
||||||
TheHiCol = STAT->HilightColor();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
WithColor = Standard_False;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
Standard_Integer MaxIndex = HighestIndex();
|
|
||||||
for(Standard_Integer i=MaxIndex;i>=1 ; i--){
|
for (Standard_Integer aCtxIdx = HighestIndex(); aCtxIdx >= 1; aCtxIdx--)
|
||||||
if(myLocalContexts.IsBound(i)){
|
{
|
||||||
if(myLocalContexts(i)->IsHilighted(anIObj,WithColor,TheHiCol))
|
if (myLocalContexts.IsBound (aCtxIdx))
|
||||||
|
{
|
||||||
|
if (myLocalContexts (aCtxIdx)->IsHilighted (theObj))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsHilighted
|
//function : IsHilighted
|
||||||
//purpose : Returns true if the objects global status is set to highlighted.
|
//purpose : Returns true if the owner is highlighted with selection style.
|
||||||
// theIsCustomColor flag defines if highlight color is not equal to OCCT's
|
|
||||||
// default Quantity_NOC_WHITE color. If theIsCustomColor is true,
|
|
||||||
// custom highlight color name will be stored to theCustomColorName
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const
|
||||||
Standard_Boolean& theIsCustomColor,
|
|
||||||
Quantity_NameOfColor& theCustomColorName) const
|
|
||||||
{
|
{
|
||||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@ -1020,26 +951,72 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_Ent
|
|||||||
const Handle(AIS_InteractiveObject) anObj =
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
|
|
||||||
if (!myObjects.IsBound (anObj))
|
if (anObj->GlobalSelOwner() == theOwner)
|
||||||
|
{
|
||||||
|
if (!myObjects.IsBound (anObj))
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
return myObjects (anObj)->IsHilighted();
|
||||||
|
}
|
||||||
|
|
||||||
|
return theOwner->IsSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : HighlightStyle
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
|
Handle(Graphic3d_HighlightStyle)& theStyle) const
|
||||||
|
{
|
||||||
|
if (HasOpenedContext())
|
||||||
|
myLocalContexts (myCurLocalIndex)->HighlightStyle (theObj, theStyle);
|
||||||
|
|
||||||
|
if (IsHilighted (theObj))
|
||||||
|
{
|
||||||
|
theStyle = myObjects (theObj)->HilightStyle();
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theStyle.Nullify();
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : HighlightStyle
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
|
Handle(Graphic3d_HighlightStyle)& theStyle) const
|
||||||
|
{
|
||||||
|
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
const Handle(AIS_GlobalStatus)& anObjStatus = myObjects (anObj);
|
if (IsHilighted (theOwner))
|
||||||
if (anObjStatus->IsHilighted())
|
|
||||||
{
|
{
|
||||||
if (anObjStatus->HilightColor() != Quantity_NOC_WHITE)
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
|
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
|
if (anObj->GlobalSelOwner() == theOwner)
|
||||||
{
|
{
|
||||||
theIsCustomColor = Standard_True;
|
theStyle = myObjects (anObj)->HilightStyle();
|
||||||
theCustomColorName = anObjStatus->HilightColor();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theIsCustomColor = Standard_False;
|
// since part selection style is not stored in global status,
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
return Standard_False;
|
{
|
||||||
|
theStyle.Nullify();
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1356,7 +1333,7 @@ void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& t
|
|||||||
|
|
||||||
// if the object or its part is highlighted dynamically, it is necessary to apply location transformation
|
// if the object or its part is highlighted dynamically, it is necessary to apply location transformation
|
||||||
// to its highlight structure immediately
|
// to its highlight structure immediately
|
||||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
|
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
|
||||||
{
|
{
|
||||||
myLastPicked->UpdateHighlightTrsf (myMainVwr,
|
myLastPicked->UpdateHighlightTrsf (myMainVwr,
|
||||||
myMainPM,
|
myMainPM,
|
||||||
@ -1517,15 +1494,15 @@ void AIS_InteractiveContext::SetDisplayMode(const Standard_Integer theMode,
|
|||||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||||
{
|
{
|
||||||
myMainPM->Display (anObj, theMode);
|
myMainPM->Display (anObj, theMode);
|
||||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == anObj)
|
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (anObj))
|
||||||
{
|
{
|
||||||
myMainPM->BeginImmediateDraw();
|
myMainPM->BeginImmediateDraw();
|
||||||
myMainPM->Unhighlight (anObj, myDisplayMode);
|
unhighlightGlobal (anObj, myDisplayMode);
|
||||||
myMainPM->EndImmediateDraw (myMainVwr);
|
myMainPM->EndImmediateDraw (myMainVwr);
|
||||||
}
|
}
|
||||||
if (aStatus->IsSubIntensityOn())
|
if (aStatus->IsSubIntensityOn())
|
||||||
{
|
{
|
||||||
myMainPM->Color (anObj, mySubIntensity, theMode);
|
highlightWithSubintensity (anObj, theMode);
|
||||||
}
|
}
|
||||||
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
|
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
|
||||||
}
|
}
|
||||||
@ -1574,7 +1551,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
|
|||||||
{
|
{
|
||||||
if (myMainPM->IsHighlighted (theIObj, anOldMode))
|
if (myMainPM->IsHighlighted (theIObj, anOldMode))
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, anOldMode);
|
unhighlightGlobal (theIObj, anOldMode);
|
||||||
}
|
}
|
||||||
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||||
}
|
}
|
||||||
@ -1586,11 +1563,11 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
|
|||||||
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
|
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
|
||||||
if (aStatus->IsHilighted())
|
if (aStatus->IsHilighted())
|
||||||
{
|
{
|
||||||
myMainPM->Highlight (theIObj, aHiMode);
|
highlightGlobal (theIObj, getSelStyle (theIObj), aHiMode);
|
||||||
}
|
}
|
||||||
if (aStatus->IsSubIntensityOn())
|
if (aStatus->IsSubIntensityOn())
|
||||||
{
|
{
|
||||||
myMainPM->Color (theIObj, mySubIntensity, theMode);
|
highlightWithSubintensity (theIObj, theMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -1632,7 +1609,7 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
|
|||||||
{
|
{
|
||||||
if (myMainPM->IsHighlighted (theIObj, anOldMode))
|
if (myMainPM->IsHighlighted (theIObj, anOldMode))
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, anOldMode);
|
unhighlightGlobal (theIObj, anOldMode);
|
||||||
}
|
}
|
||||||
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||||
myMainPM->Display (theIObj, myDisplayMode);
|
myMainPM->Display (theIObj, myDisplayMode);
|
||||||
@ -1641,11 +1618,11 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
|
|||||||
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
|
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
|
||||||
if (aStatus->IsHilighted())
|
if (aStatus->IsHilighted())
|
||||||
{
|
{
|
||||||
myMainPM->Highlight (theIObj, aHiMode);
|
highlightSelected (theIObj->GlobalSelOwner());
|
||||||
}
|
}
|
||||||
if (aStatus->IsSubIntensityOn())
|
if (aStatus->IsSubIntensityOn())
|
||||||
{
|
{
|
||||||
myMainPM->Color (theIObj, mySubIntensity, myDisplayMode);
|
highlightWithSubintensity (theIObj, myDisplayMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -2054,17 +2031,21 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
|||||||
|
|
||||||
theIObj->SetWidth (theWidth);
|
theIObj->SetWidth (theWidth);
|
||||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||||
{
|
{
|
||||||
if (myLastinMain->IsAutoHilight())
|
if (myLastinMain->IsAutoHilight())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode =
|
const Standard_Integer aHiMode =
|
||||||
theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||||
myLastinMain->HilightWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, aHiMode);
|
myLastinMain->HilightWithColor (myMainPM,
|
||||||
|
myLastinMain->IsSelected() ? getSelStyle (theIObj) : getHiStyle (theIObj),
|
||||||
|
aHiMode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theIObj->HilightOwnerWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, myLastinMain);
|
theIObj->HilightOwnerWithColor (myMainPM,
|
||||||
|
myLastinMain->IsSelected() ? getSelStyle (theIObj) : getHiStyle (theIObj),
|
||||||
|
myLastinMain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2344,7 +2325,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
|||||||
}
|
}
|
||||||
else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
|
else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, aStatus->DisplayMode());
|
unhighlightGlobal (theIObj, aStatus->DisplayMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2353,11 +2334,11 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
|||||||
if (aStatus->IsHilighted()
|
if (aStatus->IsHilighted()
|
||||||
&& theIObj->HasHilightMode())
|
&& theIObj->HasHilightMode())
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, aDispMode);
|
unhighlightGlobal (theIObj, aDispMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myLastPicked.IsNull()
|
if (!myLastPicked.IsNull()
|
||||||
&& myLastPicked->Selectable() == theIObj)
|
&& myLastPicked->IsSameSelectable (theIObj))
|
||||||
{
|
{
|
||||||
myMainPM->ClearImmediateDraw();
|
myMainPM->ClearImmediateDraw();
|
||||||
}
|
}
|
||||||
@ -2390,7 +2371,7 @@ void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObje
|
|||||||
SelectMgr_SequenceOfOwner aSeq;
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
if (aSelIter.Value()->Selectable() == theObject
|
if (aSelIter.Value()->IsSameSelectable (theObject)
|
||||||
&& aSelIter.Value()->IsSelected())
|
&& aSelIter.Value()->IsSelected())
|
||||||
{
|
{
|
||||||
aSeq.Append (aSelIter.Value());
|
aSeq.Append (aSelIter.Value());
|
||||||
@ -2447,9 +2428,9 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
|||||||
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||||
myLastinMain.Nullify();
|
myLastinMain.Nullify();
|
||||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
|
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
|
||||||
myLastPicked.Nullify();
|
myLastPicked.Nullify();
|
||||||
myMainPM->ClearImmediateDraw();
|
myMainPM->ClearImmediateDraw();
|
||||||
|
|
||||||
@ -2480,7 +2461,7 @@ void AIS_InteractiveContext::ClearGlobalPrs (const Handle(AIS_InteractiveObject)
|
|||||||
if (aDispMode == theMode
|
if (aDispMode == theMode
|
||||||
&& myMainPM->IsHighlighted (theIObj, theMode))
|
&& myMainPM->IsHighlighted (theIObj, theMode))
|
||||||
{
|
{
|
||||||
myMainPM->Unhighlight (theIObj, theMode);
|
unhighlightGlobal (theIObj, theMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
myMainPM->Erase (theIObj, theMode);
|
myMainPM->Erase (theIObj, theMode);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <AIS_KindOfInteractive.hxx>
|
#include <AIS_KindOfInteractive.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
#include <Aspect_TypeOfFacingModel.hxx>
|
#include <Aspect_TypeOfFacingModel.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <Graphic3d_NameOfMaterial.hxx>
|
#include <Graphic3d_NameOfMaterial.hxx>
|
||||||
#include <Standard_ShortReal.hxx>
|
#include <Standard_ShortReal.hxx>
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
@ -277,8 +278,11 @@ public:
|
|||||||
//! Standard_False, the presentation of the Interactive
|
//! Standard_False, the presentation of the Interactive
|
||||||
//! Object activates the selection mode; the object is
|
//! Object activates the selection mode; the object is
|
||||||
//! displayed but no viewer will be updated.
|
//! displayed but no viewer will be updated.
|
||||||
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
Standard_DEPRECATED("Deprecated method Hilight()")
|
||||||
|
void Hilight (const Handle(AIS_InteractiveObject)& theObj, const Standard_Boolean theIsToUpdateViewer = Standard_True)
|
||||||
|
{
|
||||||
|
return HilightWithColor (theObj, mySelStyle, theIsToUpdateViewer);
|
||||||
|
}
|
||||||
|
|
||||||
//! Changes the color of all the lines of the object in view,
|
//! Changes the color of all the lines of the object in view,
|
||||||
//! aniobj. It paints these lines the color passed as the
|
//! aniobj. It paints these lines the color passed as the
|
||||||
@ -287,7 +291,9 @@ public:
|
|||||||
//! Standard_False, the presentation of the Interactive
|
//! Standard_False, the presentation of the Interactive
|
||||||
//! Object activates the selection mode; the object is
|
//! Object activates the selection mode; the object is
|
||||||
//! displayed but no viewer will be updated.
|
//! displayed but no viewer will be updated.
|
||||||
Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aCol, const Standard_Boolean updateviewer = Standard_True);
|
Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Boolean theIsToUpdate = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! Removes hilighting from the entity aniobj. Updates the viewer.
|
//! Removes hilighting from the entity aniobj. Updates the viewer.
|
||||||
@ -559,19 +565,25 @@ public:
|
|||||||
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
|
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
|
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& aniobj) const;
|
|
||||||
|
|
||||||
//! if <anIObj> is hilighted with a specific color
|
|
||||||
//! <WithColor> will be returned TRUE
|
|
||||||
//! <theHiCol> gives the name of the hilightcolor
|
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anIobj, Standard_Boolean& WithColor, Quantity_NameOfColor& theHiCol) const;
|
|
||||||
|
|
||||||
//! if <theOwner> is hilighted with a specific color, than <theIsCustomColor> will be set
|
//! Returns true if the object is marked as highlighted via its global
|
||||||
//! to true and <theCustomColorName> will have the name of the color stored
|
//! status
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
//! @param theObj [in] the object to check
|
||||||
Standard_Boolean& theIsCustomColor,
|
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
|
||||||
Quantity_NameOfColor& theCustomColorName) const;
|
|
||||||
|
//! Returns true if the owner is marked as selected
|
||||||
|
//! @param theOwner [in] the owner to check
|
||||||
|
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||||
|
|
||||||
|
//! 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;
|
||||||
|
|
||||||
|
//! 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;
|
||||||
|
|
||||||
//! Returns the display priority of the entity anIobj. This
|
//! Returns the display priority of the entity anIobj. This
|
||||||
//! will be display mode of anIobj if it is in the main
|
//! will be display mode of anIobj if it is in the main
|
||||||
@ -621,15 +633,46 @@ public:
|
|||||||
Standard_Integer DisplayMode() const;
|
Standard_Integer DisplayMode() const;
|
||||||
|
|
||||||
|
|
||||||
//! Returns the name of the color used to show
|
//! Returns current dynamic highlight style settings.
|
||||||
//! highlighted entities, that is, entities picked out by the mouse.
|
//! By default:
|
||||||
Quantity_NameOfColor HilightColor() const;
|
//! - 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
|
||||||
|
{
|
||||||
|
return myHiStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Allows to manage the style of dynamic highlighting.
|
||||||
|
//! 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.
|
||||||
|
Handle(Graphic3d_HighlightStyle)& ChangeHighlightStyle()
|
||||||
|
{
|
||||||
|
return myHiStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! 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
|
||||||
|
{
|
||||||
|
return mySelStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Allows to manage the style of selection highlighting.
|
||||||
|
//! 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.
|
||||||
|
Handle(Graphic3d_HighlightStyle)& ChangeSelectionStyle()
|
||||||
|
{
|
||||||
|
return mySelStyle;
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns the name of the color used to show selected entities.
|
|
||||||
//! By default, this is Quantity_NOC_GRAY80.
|
|
||||||
Quantity_NameOfColor SelectionColor() const;
|
|
||||||
|
|
||||||
//! Returns the name of the color used to show preselection.
|
//! Returns the name of the color used to show preselection.
|
||||||
//! By default, this is Quantity_NOC_GREEN.
|
//! By default, this is Quantity_NOC_GREEN.
|
||||||
Quantity_NameOfColor PreSelectionColor() const;
|
Quantity_NameOfColor PreSelectionColor() const;
|
||||||
@ -640,34 +683,33 @@ public:
|
|||||||
Quantity_NameOfColor DefaultColor() const;
|
Quantity_NameOfColor DefaultColor() const;
|
||||||
|
|
||||||
|
|
||||||
//! Returns the name of the color used to show that an
|
//! Sub-intensity allows temporary highlighting of particular
|
||||||
//! object is not currently selected.
|
//! objects with specified color in a manner of selection highlight,
|
||||||
|
//! but without actual selection (e.g., global status and owner's
|
||||||
|
//! selection state will not be updated).
|
||||||
|
//! The method returns the color of such highlighting.
|
||||||
|
//! By default, it is Quantity_NOC_GRAY40.
|
||||||
|
const Quantity_Color& SubIntensityColor() const
|
||||||
|
{
|
||||||
|
return mySubintStyle->Color();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sub-intensity allows temporary highlighting of particular
|
||||||
|
//! objects with specified color in a manner of selection highlight,
|
||||||
|
//! but without actual selection (e.g., global status and owner's
|
||||||
|
//! selection state will not be updated).
|
||||||
|
//! The method sets up the color for such highlighting.
|
||||||
//! By default, this is Quantity_NOC_GRAY40.
|
//! By default, this is Quantity_NOC_GRAY40.
|
||||||
Quantity_NameOfColor SubIntensityColor() const;
|
void SetSubIntensityColor (const Quantity_Color& theColor)
|
||||||
|
{
|
||||||
|
mySubintStyle->SetColor (theColor);
|
||||||
//! Sets the color used to show highlighted entities, that
|
}
|
||||||
//! is, entities picked by the mouse.
|
|
||||||
//! By default, this is Quantity_NOC_CYAN1.
|
|
||||||
void SetHilightColor (const Quantity_NameOfColor aHiCol);
|
|
||||||
|
|
||||||
|
|
||||||
//! Sets the color used to show selected entities.
|
|
||||||
//! By default, this is Quantity_NOC_GRAY80.
|
|
||||||
void SelectionColor (const Quantity_NameOfColor aCol);
|
|
||||||
|
|
||||||
|
|
||||||
//! Allows you to set the color used to show preselection.
|
//! Allows you to set the color used to show preselection.
|
||||||
//! By default, this is Quantity_NOC_GREEN.
|
//! By default, this is Quantity_NOC_GREEN.
|
||||||
//! A preselected entity is one which has been selected
|
//! A preselected entity is one which has been selected
|
||||||
//! as the domain of application of a function such as a fillet.
|
//! as the domain of application of a function such as a fillet.
|
||||||
void SetPreselectionColor (const Quantity_NameOfColor aCol);
|
void SetPreselectionColor (const Quantity_NameOfColor aCol);
|
||||||
|
|
||||||
|
|
||||||
//! Sets the color used to show that an object is not currently selected.
|
|
||||||
//! By default, this is Quantity_NOC_GRAY40.
|
|
||||||
void SetSubIntensityColor (const Quantity_NameOfColor aCol);
|
|
||||||
|
|
||||||
|
|
||||||
//! Sets the display mode of seen Interactive Objects.
|
//! Sets the display mode of seen Interactive Objects.
|
||||||
//! aMode provides the display mode index of the entity aniobj.
|
//! aMode provides the display mode index of the entity aniobj.
|
||||||
@ -1586,20 +1628,21 @@ protected:
|
|||||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||||
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
|
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||||
|
|
||||||
//! Helper function that highlights the owner given with <theColor> without
|
//! Helper function that highlights the owner given with <theStyle> without
|
||||||
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
|
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
|
||||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, highlight will be synchronized
|
|
||||||
//! automatically in all views of the viewer.
|
|
||||||
Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
const Quantity_NameOfColor theColor,
|
|
||||||
const Handle(V3d_Viewer)& theViewer = NULL);
|
const Handle(V3d_Viewer)& theViewer = NULL);
|
||||||
|
|
||||||
//! Helper function that highlights the owner given with <theColor> with check
|
//! Helper function that highlights the owner given with <theStyle> with check
|
||||||
//! for AutoHighlight, e.g. is used for selection.
|
//! for AutoHighlight, e.g. is used for selection.
|
||||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, selection color will be synchronized
|
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||||
//! automatically in all views of the viewer.
|
|
||||||
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
//! Helper function that highlights global owner of the object given with <theStyle> with check
|
||||||
const Quantity_NameOfColor theSelColor);
|
//! 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;
|
||||||
|
|
||||||
//! Helper function that unhighlights all owners that are stored in current AIS_Selection.
|
//! 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.
|
//! The function updates global status and selection state of owner and interactive object.
|
||||||
@ -1607,6 +1650,56 @@ protected:
|
|||||||
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
|
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
|
||||||
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
|
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
|
||||||
|
|
||||||
|
//! 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;
|
||||||
|
|
||||||
|
//! Helper function that turns on sub-intensity in global status and highlights
|
||||||
|
//! given objects with sub-intensity color
|
||||||
|
//! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
|
||||||
|
//! all inveractive objects of the context
|
||||||
|
//! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
|
||||||
|
//! all display modes in global status's list of modes
|
||||||
|
//! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
|
||||||
|
//! status AIS_DS_Displayed
|
||||||
|
Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
|
||||||
|
const Standard_Integer theDispMode = -1,
|
||||||
|
const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
|
||||||
|
|
||||||
|
//! Helper function that highlights the object with sub-intensity color without any checks
|
||||||
|
//! @param theObject [in] the object that will be highlighted
|
||||||
|
//! @param theMode [in] display mode
|
||||||
|
Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
|
||||||
|
const Standard_Integer theMode) const;
|
||||||
|
|
||||||
|
//! Helper function that highlights the owner with sub-intensity color without any checks
|
||||||
|
//! @param theOwner [in] the owner that will be highlighted
|
||||||
|
//! @param theMode [in] display mode
|
||||||
|
Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
|
const Standard_Integer theMode) const;
|
||||||
|
|
||||||
|
//! 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
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj) const
|
||||||
|
{
|
||||||
|
const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
|
||||||
|
return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
|
||||||
|
? aHiDrawer->HighlightStyle() : myHiStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! 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)& aHiDrawer = theObj->HilightAttributes();
|
||||||
|
return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
|
||||||
|
? aHiDrawer->SelectionStyle() : mySelStyle;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
AIS_DataMapOfIOStatus myObjects;
|
AIS_DataMapOfIOStatus myObjects;
|
||||||
@ -1624,10 +1717,10 @@ protected:
|
|||||||
Handle(Prs3d_Drawer) myDefaultDrawer;
|
Handle(Prs3d_Drawer) myDefaultDrawer;
|
||||||
Handle(AIS_Selection) mySelection;
|
Handle(AIS_Selection) mySelection;
|
||||||
Quantity_NameOfColor myDefaultColor;
|
Quantity_NameOfColor myDefaultColor;
|
||||||
Quantity_NameOfColor myHilightColor;
|
Handle(Graphic3d_HighlightStyle) myHiStyle;
|
||||||
Quantity_NameOfColor mySelectionColor;
|
Handle(Graphic3d_HighlightStyle) mySelStyle;
|
||||||
Quantity_NameOfColor myPreselectionColor;
|
Quantity_NameOfColor myPreselectionColor;
|
||||||
Quantity_NameOfColor mySubIntensity;
|
Handle(Graphic3d_HighlightStyle) mySubintStyle;
|
||||||
Standard_Integer myDisplayMode;
|
Standard_Integer myDisplayMode;
|
||||||
AIS_DataMapOfILC myLocalContexts;
|
AIS_DataMapOfILC myLocalContexts;
|
||||||
Standard_Integer myCurLocalIndex;
|
Standard_Integer myCurLocalIndex;
|
||||||
|
@ -17,16 +17,6 @@ inline const Handle(V3d_Viewer)& AIS_InteractiveContext::CurrentViewer() const
|
|||||||
return myMainVwr;
|
return myMainVwr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_InteractiveContext::HilightColor() const
|
|
||||||
{
|
|
||||||
return myHilightColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_InteractiveContext::SelectionColor() const
|
|
||||||
{
|
|
||||||
return mySelectionColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_InteractiveContext::PreSelectionColor() const
|
inline Quantity_NameOfColor AIS_InteractiveContext::PreSelectionColor() const
|
||||||
{
|
{
|
||||||
return myPreselectionColor;
|
return myPreselectionColor;
|
||||||
@ -36,30 +26,11 @@ inline Quantity_NameOfColor AIS_InteractiveContext::DefaultColor() const
|
|||||||
{ return myDefaultColor;
|
{ return myDefaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_InteractiveContext::SubIntensityColor() const
|
|
||||||
{
|
|
||||||
return mySubIntensity;
|
|
||||||
}
|
|
||||||
inline void AIS_InteractiveContext::SetHilightColor(const Quantity_NameOfColor aHiCol)
|
|
||||||
{
|
|
||||||
myHilightColor = aHiCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void AIS_InteractiveContext::SelectionColor(const Quantity_NameOfColor aCol)
|
|
||||||
{
|
|
||||||
mySelectionColor = aCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void AIS_InteractiveContext::SetPreselectionColor(const Quantity_NameOfColor aCol)
|
inline void AIS_InteractiveContext::SetPreselectionColor(const Quantity_NameOfColor aCol)
|
||||||
{
|
{
|
||||||
myPreselectionColor = aCol;
|
myPreselectionColor = aCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AIS_InteractiveContext::SetSubIntensityColor(const Quantity_NameOfColor aCol)
|
|
||||||
{
|
|
||||||
mySubIntensity = aCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Standard_Integer AIS_InteractiveContext::DisplayMode() const
|
inline Standard_Integer AIS_InteractiveContext::DisplayMode() const
|
||||||
{
|
{
|
||||||
return myDisplayMode;
|
return myDisplayMode;
|
||||||
|
@ -64,7 +64,6 @@ namespace
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
const Quantity_NameOfColor theColor,
|
|
||||||
const Handle(V3d_Viewer)& theViewer)
|
const Handle(V3d_Viewer)& theViewer)
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveObject) anObj =
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
@ -74,7 +73,7 @@ void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOw
|
|||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
||||||
|
|
||||||
myMainPM->BeginImmediateDraw();
|
myMainPM->BeginImmediateDraw();
|
||||||
theOwner->HilightWithColor (myMainPM, theColor, aHiMode);
|
theOwner->HilightWithColor (myMainPM, getHiStyle (anObj), aHiMode);
|
||||||
myMainPM->EndImmediateDraw (theViewer.IsNull() ? myMainVwr : theViewer);
|
myMainPM->EndImmediateDraw (theViewer.IsNull() ? myMainVwr : theViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +81,7 @@ void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOw
|
|||||||
//function : highlightSelected
|
//function : highlightSelected
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||||
const Quantity_NameOfColor theSelColor)
|
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveObject) anObj =
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
@ -96,7 +94,7 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
|||||||
SelectMgr_SequenceOfOwner aSeq;
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
if (aSelIter.Value()->Selectable() == anObj)
|
if (aSelIter.Value()->IsSameSelectable (anObj))
|
||||||
{
|
{
|
||||||
aSeq.Append (aSelIter.Value());
|
aSeq.Append (aSelIter.Value());
|
||||||
}
|
}
|
||||||
@ -105,7 +103,43 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theOwner->HilightWithColor (myMainPM, theSelColor, aHiMode);
|
theOwner->HilightWithColor (myMainPM, getSelStyle (anObj), aHiMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : highlightGlobal
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
if (theObj.IsNull())
|
||||||
|
return;
|
||||||
|
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
|
||||||
|
|
||||||
|
if (aGlobOwner.IsNull())
|
||||||
|
{
|
||||||
|
myMainPM->Color (theObj, theStyle, theMode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aGlobOwner->IsAutoHilight())
|
||||||
|
{
|
||||||
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
|
{
|
||||||
|
if (aSelIter.Value()->IsSameSelectable (theObj))
|
||||||
|
{
|
||||||
|
aSeq.Append (aSelIter.Value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
theObj->HilightSelected (myMainPM, aSeq);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aGlobOwner->HilightWithColor (myMainPM, theStyle, theMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +162,7 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
|
|||||||
{
|
{
|
||||||
if (myObjects.IsBound (anInteractive) && myObjects (anInteractive)->IsSubIntensityOn())
|
if (myObjects.IsBound (anInteractive) && myObjects (anInteractive)->IsSubIntensityOn())
|
||||||
{
|
{
|
||||||
anOwner->HilightWithColor (myMainPM, mySubIntensity, aHiMode);
|
highlightWithSubintensity (anOwner, aHiMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,6 +186,112 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : unhighlightGlobal
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
|
const Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
if (theObj.IsNull())
|
||||||
|
return;
|
||||||
|
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
|
||||||
|
|
||||||
|
if (aGlobOwner.IsNull())
|
||||||
|
{
|
||||||
|
myMainPM->Unhighlight (theObj, theMode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aGlobOwner->IsAutoHilight())
|
||||||
|
{
|
||||||
|
aGlobOwner->Unhilight (myMainPM, theMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myMainPM->Unhighlight (theObj, theMode);
|
||||||
|
theObj->ClearSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : turnOnSubintensity
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject,
|
||||||
|
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());
|
||||||
|
|
||||||
|
if (theObject.IsNull())
|
||||||
|
{
|
||||||
|
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjsIter (myObjects); anObjsIter.More(); anObjsIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(AIS_GlobalStatus)& aStatus = anObjsIter.Value();
|
||||||
|
if (aStatus->GraphicStatus() != AIS_DS_Displayed && theIsDisplayedOnly)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aStatus->SubIntensityOn();
|
||||||
|
|
||||||
|
if (theDispMode == -1)
|
||||||
|
{
|
||||||
|
myMainPM->Color (anObjsIter.Key(), mySubintStyle, aStatus->DisplayMode());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myMainPM->Color (anObjsIter.Key(), mySubintStyle, theDispMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Handle(AIS_GlobalStatus) aStatus;
|
||||||
|
if (!myObjects.Find (theObject, aStatus))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (aStatus->GraphicStatus() != AIS_DS_Displayed && theIsDisplayedOnly)
|
||||||
|
return;
|
||||||
|
|
||||||
|
aStatus->SubIntensityOn();
|
||||||
|
|
||||||
|
if (theDispMode == -1)
|
||||||
|
{
|
||||||
|
myMainPM->Color (theObject, mySubintStyle, aStatus->DisplayMode());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myMainPM->Color (theObject, mySubintStyle, theDispMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : highlightWithSubintensity
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
|
||||||
|
const Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
// the only differ with selection highlight is color, so
|
||||||
|
// sync transparency values
|
||||||
|
mySubintStyle->SetTransparency (mySelStyle->Transparency());
|
||||||
|
|
||||||
|
myMainPM->Color (theObject, mySubintStyle, theMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : highlightWithSubintensity
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
|
const Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
// the only differ with selection highlight is color, so
|
||||||
|
// sync transparency values
|
||||||
|
mySubintStyle->SetTransparency (mySelStyle->Transparency());
|
||||||
|
|
||||||
|
theOwner->HilightWithColor (myMainPM, mySubintStyle, theMode);
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : MoveTo
|
//function : MoveTo
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -241,7 +381,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
}
|
}
|
||||||
else if (myToHilightSelected)
|
else if (myToHilightSelected)
|
||||||
{
|
{
|
||||||
highlightWithColor (aNewPickedOwner, mySelectionColor, theView->Viewer());
|
highlightSelected (aNewPickedOwner);
|
||||||
toUpdateViewer = Standard_True;
|
toUpdateViewer = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +395,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
{
|
{
|
||||||
if (!myLastPicked->IsSelected() || myToHilightSelected)
|
if (!myLastPicked->IsSelected() || myToHilightSelected)
|
||||||
{
|
{
|
||||||
highlightWithColor (myLastPicked, myHilightColor, theView->Viewer());
|
highlightWithColor (myLastPicked, theView->Viewer());
|
||||||
toUpdateViewer = Standard_True;
|
toUpdateViewer = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +424,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
}
|
}
|
||||||
else if (myToHilightSelected)
|
else if (myToHilightSelected)
|
||||||
{
|
{
|
||||||
highlightSelected (myLastPicked, mySelectionColor);
|
highlightSelected (myLastPicked);
|
||||||
toUpdateViewer = Standard_True;
|
toUpdateViewer = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,11 +906,12 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
|||||||
{
|
{
|
||||||
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& anObjSelStyle = getSelStyle (anObj);
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
||||||
aState->SetHilightStatus (Standard_True);
|
aState->SetHilightStatus (Standard_True);
|
||||||
aState->SetHilightColor (mySelectionColor);
|
aState->SetHilightStyle (anObjSelStyle);
|
||||||
}
|
}
|
||||||
anOwner->State (1);
|
anOwner->State (1);
|
||||||
if (!anOwner->IsAutoHilight())
|
if (!anOwner->IsAutoHilight())
|
||||||
@ -790,7 +931,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
||||||
anOwner->HilightWithColor (myMainPM, mySelectionColor, aHiMode);
|
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,15 +1032,17 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
if (theObject->HasSelection (0))
|
if (theObject->HasSelection (0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
|
||||||
|
getSelStyle (theObject);
|
||||||
|
|
||||||
if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
|
if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
|
||||||
{
|
{
|
||||||
Quantity_NameOfColor aHiCol;
|
Handle(Graphic3d_HighlightStyle) aCustomStyle;
|
||||||
Standard_Boolean hasHiCol = Standard_False;
|
if (HighlightStyle (theObject, aCustomStyle))
|
||||||
if (IsHilighted (theObject, hasHiCol, aHiCol))
|
|
||||||
{
|
{
|
||||||
if (hasHiCol && aHiCol!= mySelectionColor)
|
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
|
||||||
{
|
{
|
||||||
HilightWithColor (theObject, mySelectionColor, theToUpdateViewer);
|
HilightWithColor (theObject, anObjSelStyle, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -936,20 +1079,19 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (theObject);
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (theObject);
|
||||||
aState->SetHilightStatus (Standard_True);
|
aState->SetHilightStatus (Standard_True);
|
||||||
aState->SetHilightColor (mySelectionColor);
|
aState->SetHilightStyle (anObjSelStyle);
|
||||||
}
|
}
|
||||||
Quantity_NameOfColor aHiCol;
|
Handle(Graphic3d_HighlightStyle) aCustomStyle;
|
||||||
Standard_Boolean hasHiCol = Standard_False;
|
if (HighlightStyle (theObject, aCustomStyle))
|
||||||
if (IsHilighted (theObject, hasHiCol, aHiCol))
|
|
||||||
{
|
{
|
||||||
if (hasHiCol && aHiCol!= mySelectionColor)
|
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
|
||||||
{
|
{
|
||||||
HilightWithColor (theObject, mySelectionColor, Standard_False);
|
HilightWithColor (theObject, anObjSelStyle, Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HilightWithColor (theObject, mySelectionColor, Standard_False);
|
HilightWithColor (theObject, anObjSelStyle, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -968,17 +1110,18 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
|||||||
|
|
||||||
const Handle(AIS_InteractiveObject) anObject =
|
const Handle(AIS_InteractiveObject) anObject =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
|
||||||
|
getSelStyle (anObject);
|
||||||
|
|
||||||
if (NbSelected() == 1 && theOwner->IsSelected())
|
if (NbSelected() == 1 && theOwner->IsSelected())
|
||||||
{
|
{
|
||||||
Quantity_NameOfColor aCustomColor;
|
Handle(Graphic3d_HighlightStyle) aCustomStyle;
|
||||||
Standard_Boolean isCustomColorSet;
|
if (HighlightStyle (theOwner, aCustomStyle))
|
||||||
if (IsHilighted (theOwner, isCustomColorSet, aCustomColor))
|
|
||||||
{
|
{
|
||||||
if (isCustomColorSet && aCustomColor != mySelectionColor)
|
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode = anObject->HasHilightMode() ? anObject->HilightMode() : 0;
|
const Standard_Integer aHiMode = anObject->HasHilightMode() ? anObject->HilightMode() : 0;
|
||||||
theOwner->HilightWithColor (myMainPM, mySelectionColor, aHiMode);
|
theOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -990,19 +1133,19 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
|||||||
unhighlightSelected();
|
unhighlightSelected();
|
||||||
|
|
||||||
mySelection->ClearAndSelect (theOwner);
|
mySelection->ClearAndSelect (theOwner);
|
||||||
theOwner->State (1);
|
Handle(Graphic3d_HighlightStyle) aCustomStyle;
|
||||||
Quantity_NameOfColor aCustomColor;
|
if (!HighlightStyle (theOwner, aCustomStyle) ||
|
||||||
Standard_Boolean isCustomColorSet;
|
(!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
|
||||||
if (!IsHilighted (theOwner, isCustomColorSet, aCustomColor) || (isCustomColorSet && aCustomColor!= mySelectionColor))
|
|
||||||
{
|
{
|
||||||
highlightSelected (theOwner, mySelectionColor);
|
highlightSelected (theOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
theOwner->State (1);
|
||||||
if (theOwner == anObject->GlobalSelOwner())
|
if (theOwner == anObject->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
||||||
aState->SetHilightStatus (Standard_True);
|
aState->SetHilightStatus (Standard_True);
|
||||||
aState->SetHilightColor (mySelectionColor);
|
aState->SetHilightStyle (anObjSelStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -1083,11 +1226,11 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
|||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
||||||
if (aState == 1)
|
if (aState == 1)
|
||||||
{
|
{
|
||||||
highlightSelected (theOwner, mySelectionColor);
|
highlightSelected (theOwner);
|
||||||
if (isGlobal)
|
if (isGlobal)
|
||||||
{
|
{
|
||||||
aStatus->SetHilightStatus (Standard_True);
|
aStatus->SetHilightStatus (Standard_True);
|
||||||
aStatus->SetHilightColor (mySelectionColor);
|
aStatus->SetHilightStyle (getSelStyle (anObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1097,7 +1240,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
|||||||
else
|
else
|
||||||
anObj->ClearSelected();
|
anObj->ClearSelected();
|
||||||
aStatus->SetHilightStatus (Standard_False);
|
aStatus->SetHilightStatus (Standard_False);
|
||||||
aStatus->SetHilightColor (Quantity_NOC_WHITE);
|
aStatus->SetHilightStyle (new Graphic3d_HighlightStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
|
@ -60,7 +60,7 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
|
|||||||
const Handle(AIS_InteractiveObject) aLastPickedAIS =
|
const Handle(AIS_InteractiveObject) aLastPickedAIS =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
|
||||||
Standard_Integer HiMod = aLastPickedAIS->HasHilightMode()?aLastPickedAIS->HilightMode():0;
|
Standard_Integer HiMod = aLastPickedAIS->HasHilightMode()?aLastPickedAIS->HilightMode():0;
|
||||||
myMainPM->Unhighlight (aLastPickedAIS, HiMod);
|
unhighlightGlobal (aLastPickedAIS, HiMod);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
if(!mylastmoveview.IsNull()){
|
if(!mylastmoveview.IsNull()){
|
||||||
@ -356,36 +356,18 @@ void AIS_InteractiveContext::
|
|||||||
SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
|
SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
|
||||||
const Standard_Boolean updateviewer)
|
const Standard_Boolean updateviewer)
|
||||||
{
|
{
|
||||||
if(!HasOpenedContext()){
|
if(!HasOpenedContext())
|
||||||
if(!myObjects.IsBound(anIObj))
|
{
|
||||||
return;
|
turnOnSubintensity (anIObj);
|
||||||
const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
|
|
||||||
if(GB->IsSubIntensityOn())
|
|
||||||
return;
|
|
||||||
GB->SubIntensityOn();
|
|
||||||
Standard_Boolean UpdMain(Standard_False);
|
|
||||||
|
|
||||||
if (GB->GraphicStatus() == AIS_DS_Displayed)
|
|
||||||
{
|
|
||||||
myMainPM->Color (anIObj, mySubIntensity, GB->DisplayMode());
|
|
||||||
UpdMain = Standard_True;
|
|
||||||
}
|
|
||||||
if(updateviewer){
|
|
||||||
if(UpdMain)
|
|
||||||
myMainVwr->Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if(myObjects.IsBound(anIObj)){
|
{
|
||||||
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
|
turnOnSubintensity (anIObj, -1, Standard_False);
|
||||||
STAT->SubIntensityOn();
|
myLocalContexts(myCurLocalIndex)->SubIntensityOn (anIObj);
|
||||||
myMainPM->Color (anIObj, mySubIntensity, STAT->DisplayMode());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
|
|
||||||
|
|
||||||
if(updateviewer) myMainVwr->Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateviewer)
|
||||||
|
myMainVwr->Update();
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SubIntensityOff
|
//function : SubIntensityOff
|
||||||
@ -414,7 +396,7 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
|
|||||||
Standard_Integer DM,HM,SM;
|
Standard_Integer DM,HM,SM;
|
||||||
GetDefModes(anIObj,DM,HM,SM);
|
GetDefModes(anIObj,DM,HM,SM);
|
||||||
if(IsSelected(anIObj))
|
if(IsSelected(anIObj))
|
||||||
myMainPM->Highlight(anIObj,HM);
|
highlightSelected (anIObj->GlobalSelOwner());
|
||||||
|
|
||||||
if(updateviewer){
|
if(updateviewer){
|
||||||
if(UpdMain)
|
if(UpdMain)
|
||||||
@ -422,17 +404,19 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& anObjSelStyle =
|
||||||
|
getSelStyle (anIObj);
|
||||||
if(myObjects.IsBound(anIObj)){
|
if(myObjects.IsBound(anIObj)){
|
||||||
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
|
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
|
||||||
STAT->SubIntensityOff();
|
STAT->SubIntensityOff();
|
||||||
myMainPM->Unhighlight (anIObj, STAT->DisplayMode());
|
myMainPM->Unhighlight (anIObj, STAT->DisplayMode());
|
||||||
if(STAT->IsHilighted())
|
if (STAT->IsHilighted())
|
||||||
Hilight(anIObj);
|
HilightWithColor (anIObj, anObjSelStyle, Standard_False);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
|
myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
|
||||||
if(IsSelected(anIObj))
|
if (IsSelected(anIObj))
|
||||||
Hilight(anIObj);
|
HilightWithColor (anIObj, anObjSelStyle, Standard_False);
|
||||||
|
|
||||||
if(updateviewer) myMainVwr->Update();
|
if(updateviewer) myMainVwr->Update();
|
||||||
}
|
}
|
||||||
@ -442,21 +426,15 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
|
|||||||
//function : SubIntensityOn
|
//function : SubIntensityOn
|
||||||
//purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
|
//purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::SubIntensityOn (const Standard_Boolean theIsToUpdateViewer)
|
||||||
void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
|
|
||||||
{
|
{
|
||||||
if(!HasOpenedContext()) return;
|
if (!HasOpenedContext())
|
||||||
|
return;
|
||||||
AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
|
|
||||||
for(;It.More();It.Next()){
|
turnOnSubintensity();
|
||||||
const Handle(AIS_GlobalStatus)& STAT = It.Value();
|
|
||||||
if(STAT->GraphicStatus()==AIS_DS_Displayed)
|
if (theIsToUpdateViewer)
|
||||||
{
|
myMainVwr->Update();
|
||||||
STAT->SubIntensityOn();
|
|
||||||
myMainPM->Color (It.Key(), mySubIntensity, STAT->DisplayMode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(updateviewer) myMainVwr->Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -782,11 +760,11 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
|
|||||||
|
|
||||||
// part display...
|
// part display...
|
||||||
myMainPM->Display (iobj, STAT->DisplayMode());
|
myMainPM->Display (iobj, STAT->DisplayMode());
|
||||||
if(STAT->IsHilighted()){
|
if(STAT->IsHilighted())
|
||||||
if(STAT->HilightColor()!=Quantity_NOC_WHITE)
|
{
|
||||||
HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
|
const Handle(Graphic3d_HighlightStyle)& aStyle = STAT->HilightStyle();
|
||||||
else
|
if (!aStyle.IsNull() && getSelStyle (iobj) != aStyle)
|
||||||
Hilight(iobj,Standard_False);
|
HilightWithColor(iobj,aStyle,Standard_False);
|
||||||
}
|
}
|
||||||
//part selection
|
//part selection
|
||||||
for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
|
for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
|
||||||
|
@ -77,7 +77,8 @@ mySelection(new AIS_Selection()),
|
|||||||
mylastindex(0),
|
mylastindex(0),
|
||||||
mylastgood(0),
|
mylastgood(0),
|
||||||
myCurDetected(0),
|
myCurDetected(0),
|
||||||
myAISCurDetected(0)
|
myAISCurDetected(0),
|
||||||
|
mySubintStyle (new Graphic3d_HighlightStyle (aCtx->SelectionStyle()))
|
||||||
|
|
||||||
{
|
{
|
||||||
// bind self to AIS_InteractiveContext::myLocalContexts. Further, the
|
// bind self to AIS_InteractiveContext::myLocalContexts. Further, the
|
||||||
@ -636,11 +637,14 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
|||||||
void AIS_LocalContext::SubIntensityOn(const Handle(AIS_InteractiveObject)& anObject)
|
void AIS_LocalContext::SubIntensityOn(const Handle(AIS_InteractiveObject)& anObject)
|
||||||
{
|
{
|
||||||
if(!myActiveObjects.IsBound(anObject)) return;
|
if(!myActiveObjects.IsBound(anObject)) return;
|
||||||
|
mySubintStyle->SetColor (myCTX->SubIntensityColor());
|
||||||
|
|
||||||
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
|
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
|
||||||
|
|
||||||
if(Att->IsTemporary())
|
if(Att->IsTemporary())
|
||||||
myMainPM->Color(anObject,myCTX->SubIntensityColor(),Att->DisplayMode());
|
{
|
||||||
|
myMainPM->Color (anObject, mySubintStyle, Att->DisplayMode());
|
||||||
|
}
|
||||||
|
|
||||||
Att->SubIntensityOn();
|
Att->SubIntensityOn();
|
||||||
}
|
}
|
||||||
@ -677,7 +681,7 @@ void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject)
|
|||||||
|
|
||||||
}
|
}
|
||||||
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
|
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
|
||||||
myMainPM->Color(anObject,myCTX->HilightColor(),Att->HilightMode());
|
myMainPM->Color(anObject, getHiStyle (anObject), Att->HilightMode());
|
||||||
Att->SubIntensityOn();
|
Att->SubIntensityOn();
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -685,21 +689,19 @@ void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject,
|
void AIS_LocalContext::Hilight (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
const Quantity_NameOfColor Col)
|
const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
{
|
{
|
||||||
if(!myActiveObjects.IsBound(anObject)){
|
if (!myActiveObjects.IsBound (theObj))
|
||||||
Standard_Integer HiMod = anObject->HasHilightMode()? anObject->HilightMode() : 0;
|
{
|
||||||
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(Standard_True,
|
Handle(AIS_LocalStatus) aStatus = new AIS_LocalStatus
|
||||||
Standard_False,
|
(Standard_True, Standard_False, -1, -1, theObj->HasHilightMode() ? theObj->HilightMode() : 0);
|
||||||
-1,-1,HiMod);
|
myActiveObjects.Bind (theObj, aStatus);
|
||||||
myActiveObjects.Bind(anObject,Att);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
|
const Handle(AIS_LocalStatus)& aStatus = myActiveObjects (theObj);
|
||||||
myMainPM->Color(anObject,Col,Att->HilightMode());
|
myMainPM->Color (theObj, theStyle, aStatus->HilightMode());
|
||||||
Att->SubIntensityOn();
|
aStatus->SubIntensityOn();
|
||||||
Att->SetHilightColor(Col);
|
aStatus->SetHilightStyle (theStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -723,7 +725,7 @@ void AIS_LocalContext::Unhilight(const Handle(AIS_InteractiveObject)& anObject)
|
|||||||
myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False);
|
myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False);
|
||||||
|
|
||||||
Att->SubIntensityOff();
|
Att->SubIntensityOff();
|
||||||
Att->SetHilightColor(Quantity_NOC_WHITE);
|
Att->SetHilightStyle (new Graphic3d_HighlightStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -749,19 +751,18 @@ Standard_Boolean AIS_LocalContext::IsHilighted(const Handle(AIS_InteractiveObjec
|
|||||||
return myActiveObjects(anObject)->IsSubIntensityOn();
|
return myActiveObjects(anObject)->IsSubIntensityOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean AIS_LocalContext::IsHilighted(const Handle(AIS_InteractiveObject)& anObject,
|
Standard_Boolean AIS_LocalContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
|
||||||
Standard_Boolean& WithColor,
|
Handle(Graphic3d_HighlightStyle)& theStyle) const
|
||||||
Quantity_NameOfColor& HiCol) const
|
|
||||||
{
|
{
|
||||||
if(!myActiveObjects.IsBound(anObject)) return Standard_False;
|
if (!myActiveObjects.IsBound (theObject))
|
||||||
if( myActiveObjects(anObject)->IsSubIntensityOn()){
|
return Standard_False;
|
||||||
HiCol = myActiveObjects(anObject)->HilightColor();
|
|
||||||
if(HiCol==Quantity_NOC_WHITE)
|
if (myActiveObjects (theObject)->IsSubIntensityOn())
|
||||||
WithColor = Standard_True;
|
{
|
||||||
else
|
theStyle = myActiveObjects (theObject)->HilightStyle();
|
||||||
WithColor = Standard_False;
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,13 +302,15 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& anObject);
|
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& anObject);
|
||||||
|
|
||||||
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& anObject, const Quantity_NameOfColor aCol);
|
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& theObj,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle);
|
||||||
|
|
||||||
Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& anObject);
|
Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& anObject);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anObject) const;
|
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anObject) const;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anObject, Standard_Boolean& WithColor, Quantity_NameOfColor& HiCol) const;
|
Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
|
||||||
|
Handle(Graphic3d_HighlightStyle)& theStyle) const;
|
||||||
|
|
||||||
//! Define the current selection sensitivity for
|
//! Define the current selection sensitivity for
|
||||||
//! this local context according to the view size.
|
//! this local context according to the view size.
|
||||||
@ -370,8 +372,17 @@ public:
|
|||||||
|
|
||||||
protected:
|
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:
|
private:
|
||||||
|
|
||||||
@ -429,7 +440,7 @@ private:
|
|||||||
Standard_Integer myCurDetected;
|
Standard_Integer myCurDetected;
|
||||||
AIS_SequenceOfInteractive myAISDetectedSeq;
|
AIS_SequenceOfInteractive myAISDetectedSeq;
|
||||||
Standard_Integer myAISCurDetected;
|
Standard_Integer myAISCurDetected;
|
||||||
|
Handle(Graphic3d_HighlightStyle) mySubintStyle;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,6 +62,28 @@ static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
|
|||||||
return IO->HasHilightMode() ? IO->HilightMode():0;
|
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
|
// Function: MoveTo
|
||||||
// Purpose :
|
// Purpose :
|
||||||
@ -482,7 +504,7 @@ void AIS_LocalContext::Hilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
|||||||
|
|
||||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
||||||
myMainPM->BeginImmediateDraw();
|
myMainPM->BeginImmediateDraw();
|
||||||
theOwner->HilightWithColor (myMainPM, myCTX->HilightColor(), aHilightMode);
|
theOwner->HilightWithColor (myMainPM, getHiStyle (theOwner->Selectable()), aHilightMode);
|
||||||
myMainPM->EndImmediateDraw (theView->Viewer());
|
myMainPM->EndImmediateDraw (theView->Viewer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,12 +520,13 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
const Handle(AIS_InteractiveObject)& anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||||
|
const Standard_Integer aHilightMode = GetHiMod (anObj);
|
||||||
if (IsSelected (theOwner))
|
if (IsSelected (theOwner))
|
||||||
{
|
{
|
||||||
if (theOwner->IsAutoHilight())
|
if (theOwner->IsAutoHilight())
|
||||||
{
|
{
|
||||||
theOwner->HilightWithColor (myMainPM, myCTX->SelectionColor(), aHilightMode);
|
theOwner->HilightWithColor (myMainPM, getSelStyle (anObj), aHilightMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -536,7 +559,7 @@ void AIS_LocalContext::HilightPicked (const Standard_Boolean theToUpdateviewer)
|
|||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
|
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
|
||||||
const Standard_Integer aHighMode = GetHiMod (anIO);
|
const Standard_Integer aHighMode = GetHiMod (anIO);
|
||||||
anOwner->HilightWithColor (myMainPM, myCTX->SelectionColor(), aHighMode);
|
anOwner->HilightWithColor (myMainPM, getSelStyle (anIO), aHighMode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,7 +796,7 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
|
|||||||
SelectMgr_SequenceOfOwner aSeq;
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
if (aSelIter.Value()->Selectable() == anobj)
|
if (aSelIter.Value()->IsSameSelectable (anobj))
|
||||||
{
|
{
|
||||||
aSeq.Append (aSelIter.Value());
|
aSeq.Append (aSelIter.Value());
|
||||||
}
|
}
|
||||||
@ -863,7 +886,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
|||||||
for (Standard_Integer anIdx = 1; anIdx <= myDetectedSeq.Length(); ++anIdx)
|
for (Standard_Integer anIdx = 1; anIdx <= myDetectedSeq.Length(); ++anIdx)
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (anIdx));
|
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (anIdx));
|
||||||
if (anOwner.IsNull() || anOwner->Selectable() != theIO || aValidOwners.Contains (anOwner))
|
if (anOwner.IsNull() || !anOwner->IsSameSelectable (theIO) || aValidOwners.Contains (anOwner))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -885,7 +908,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
|||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
if (anOwner->Selectable() != theIO)
|
if (!anOwner->IsSameSelectable (theIO))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -921,7 +944,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anOwner->Selectable() != theIO || aValidOwners.Contains (anOwner))
|
if (!anOwner->IsSameSelectable (theIO) || aValidOwners.Contains (anOwner))
|
||||||
{
|
{
|
||||||
anOwnersToKeep.Add (anOwner);
|
anOwnersToKeep.Add (anOwner);
|
||||||
}
|
}
|
||||||
@ -1405,7 +1428,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO (const H
|
|||||||
|
|
||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
if (theObj != aSelIter.Value()->Selectable())
|
if (!aSelIter.Value()->IsSameSelectable (theObj))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -20,22 +20,23 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
|
||||||
|
|
||||||
AIS_LocalStatus::AIS_LocalStatus(const Standard_Boolean IsTemp,
|
AIS_LocalStatus::AIS_LocalStatus (const Standard_Boolean theIsTemporary,
|
||||||
const Standard_Boolean Decomp,
|
const Standard_Boolean theIsToDecompose,
|
||||||
const Standard_Integer DMode,
|
const Standard_Integer theDisplayMode,
|
||||||
const Standard_Integer SMode,
|
const Standard_Integer theSelectionMode,
|
||||||
const Standard_Integer HMode,
|
const Standard_Integer theHilightMode,
|
||||||
const Standard_Boolean SubIntensity,
|
const Standard_Boolean theIsSubIntensity,
|
||||||
const Quantity_NameOfColor HiCol):
|
const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
myDecomposition(Decomp),
|
: myDecomposition (theIsToDecompose),
|
||||||
myIsTemporary(IsTemp),
|
myIsTemporary (theIsTemporary),
|
||||||
myDMode(DMode),
|
myDMode (theDisplayMode),
|
||||||
myFirstDisplay(Standard_False),
|
myFirstDisplay (Standard_False),
|
||||||
myHMode(HMode),
|
myHMode (theHilightMode),
|
||||||
mySubIntensity(SubIntensity),
|
mySubIntensity (theIsSubIntensity),
|
||||||
myHiCol(HiCol)
|
myHiStyle (theStyle)
|
||||||
{
|
{
|
||||||
if(SMode!=-1) mySModes.Append(SMode);
|
if (theSelectionMode != -1)
|
||||||
|
mySModes.Append (theSelectionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,14 +17,13 @@
|
|||||||
#ifndef _AIS_LocalStatus_HeaderFile
|
#ifndef _AIS_LocalStatus_HeaderFile
|
||||||
#define _AIS_LocalStatus_HeaderFile
|
#define _AIS_LocalStatus_HeaderFile
|
||||||
|
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
|
#include <MMgt_TShared.hxx>
|
||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
#include <Standard_Boolean.hxx>
|
#include <Standard_Boolean.hxx>
|
||||||
#include <Standard_Integer.hxx>
|
#include <Standard_Integer.hxx>
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
#include <Quantity_NameOfColor.hxx>
|
|
||||||
#include <MMgt_TShared.hxx>
|
|
||||||
class Standard_Transient;
|
class Standard_Transient;
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +37,13 @@ class AIS_LocalStatus : public MMgt_TShared
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT AIS_LocalStatus(const Standard_Boolean IsTemporary = Standard_True, const Standard_Boolean Decompose = Standard_False, const Standard_Integer DisplayMode = -1, const Standard_Integer SelectionMode = -1, const Standard_Integer HilightMode = 0, const Standard_Boolean SubIntensity = 0, const Quantity_NameOfColor TheHiCol = Quantity_NOC_WHITE);
|
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);
|
||||||
|
|
||||||
Standard_Boolean Decomposed() const;
|
Standard_Boolean Decomposed() const;
|
||||||
|
|
||||||
@ -54,7 +59,10 @@ public:
|
|||||||
|
|
||||||
Standard_Boolean IsSubIntensityOn() const;
|
Standard_Boolean IsSubIntensityOn() const;
|
||||||
|
|
||||||
Quantity_NameOfColor HilightColor() const;
|
const Handle(Graphic3d_HighlightStyle)& HilightStyle() const
|
||||||
|
{
|
||||||
|
return myHiStyle;
|
||||||
|
}
|
||||||
|
|
||||||
void SetDecomposition (const Standard_Boolean astatus);
|
void SetDecomposition (const Standard_Boolean astatus);
|
||||||
|
|
||||||
@ -76,7 +84,10 @@ public:
|
|||||||
|
|
||||||
void SetHilightMode (const Standard_Integer aMode);
|
void SetHilightMode (const Standard_Integer aMode);
|
||||||
|
|
||||||
void SetHilightColor (const Quantity_NameOfColor aHiCol);
|
void SetHilightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
|
{
|
||||||
|
myHiStyle = theStyle;
|
||||||
|
}
|
||||||
|
|
||||||
void SubIntensityOn();
|
void SubIntensityOn();
|
||||||
|
|
||||||
@ -91,14 +102,7 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
|
DEFINE_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean myDecomposition;
|
Standard_Boolean myDecomposition;
|
||||||
Standard_Boolean myIsTemporary;
|
Standard_Boolean myIsTemporary;
|
||||||
Standard_Integer myDMode;
|
Standard_Integer myDMode;
|
||||||
@ -106,10 +110,8 @@ private:
|
|||||||
Standard_Integer myHMode;
|
Standard_Integer myHMode;
|
||||||
TColStd_ListOfInteger mySModes;
|
TColStd_ListOfInteger mySModes;
|
||||||
Standard_Boolean mySubIntensity;
|
Standard_Boolean mySubIntensity;
|
||||||
Quantity_NameOfColor myHiCol;
|
|
||||||
Handle(Standard_Transient) myPreviousState;
|
Handle(Standard_Transient) myPreviousState;
|
||||||
|
Handle(Graphic3d_HighlightStyle) myHiStyle;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,9 +63,3 @@ inline void AIS_LocalStatus::SetFirstDisplay(const Standard_Boolean aStat)
|
|||||||
|
|
||||||
inline Standard_Boolean AIS_LocalStatus::IsFirstDisplay() const
|
inline Standard_Boolean AIS_LocalStatus::IsFirstDisplay() const
|
||||||
{return myFirstDisplay;}
|
{return myFirstDisplay;}
|
||||||
|
|
||||||
inline void AIS_LocalStatus::SetHilightColor(const Quantity_NameOfColor aCol)
|
|
||||||
{myHiCol = aCol;}
|
|
||||||
|
|
||||||
inline Quantity_NameOfColor AIS_LocalStatus::HilightColor() const
|
|
||||||
{return myHiCol;}
|
|
||||||
|
@ -840,12 +840,12 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
|
|||||||
|
|
||||||
if (!theSeq (1)->IsKind (STANDARD_TYPE (AIS_ManipulatorOwner)))
|
if (!theSeq (1)->IsKind (STANDARD_TYPE (AIS_ManipulatorOwner)))
|
||||||
{
|
{
|
||||||
thePM->Color (this, GetContext()->HilightColor(), 0);
|
thePM->Color (this, GetContext()->HighlightStyle(), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(AIS_ManipulatorOwner) anOwner = Handle(AIS_ManipulatorOwner)::DownCast (theSeq (1));
|
Handle(AIS_ManipulatorOwner) anOwner = Handle(AIS_ManipulatorOwner)::DownCast (theSeq (1));
|
||||||
myHighlightAspect->Aspect()->SetInteriorColor (GetContext()->HilightColor());
|
myHighlightAspect->Aspect()->SetInteriorColor (GetContext()->HighlightStyle()->Color());
|
||||||
Handle(Graphic3d_Group) aGroup = getGroup (anOwner->Index(), anOwner->Mode());
|
Handle(Graphic3d_Group) aGroup = getGroup (anOwner->Index(), anOwner->Mode());
|
||||||
if (aGroup.IsNull())
|
if (aGroup.IsNull())
|
||||||
{
|
{
|
||||||
@ -871,7 +871,9 @@ void AIS_Manipulator::ClearSelected()
|
|||||||
//function : HilightOwnerWithColor
|
//function : HilightOwnerWithColor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner)
|
void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||||
{
|
{
|
||||||
Handle(AIS_ManipulatorOwner) anOwner = Handle(AIS_ManipulatorOwner)::DownCast (theOwner);
|
Handle(AIS_ManipulatorOwner) anOwner = Handle(AIS_ManipulatorOwner)::DownCast (theOwner);
|
||||||
Handle(Prs3d_Presentation) aPresentation = getHighlightPresentation (anOwner);
|
Handle(Prs3d_Presentation) aPresentation = getHighlightPresentation (anOwner);
|
||||||
@ -879,7 +881,7 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
aPresentation->Highlight (Aspect_TOHM_COLOR, theColor);
|
aPresentation->Highlight (theStyle);
|
||||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
||||||
aGroupIter.More(); aGroupIter.Next())
|
aGroupIter.More(); aGroupIter.Next())
|
||||||
{
|
{
|
||||||
|
@ -323,7 +323,9 @@ public: //! @name Presentation computation
|
|||||||
|
|
||||||
//! Method which hilight an owner belonging to
|
//! Method which hilight an owner belonging to
|
||||||
//! this selectable object ( for fast presentation draw ).
|
//! this selectable object ( for fast presentation draw ).
|
||||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -36,16 +36,16 @@ AIS_ManipulatorOwner::AIS_ManipulatorOwner (const Handle(SelectMgr_SelectableObj
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_ManipulatorOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void AIS_ManipulatorOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (theMode == 0)
|
if (theMode == 0)
|
||||||
{
|
{
|
||||||
SelectMgr_EntityOwner::HilightWithColor (thePM, theColor, theMode);
|
SelectMgr_EntityOwner::HilightWithColor (thePM, theStyle, theMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Selectable()->HilightOwnerWithColor (thePM, theColor, this);
|
Selectable()->HilightOwnerWithColor (thePM, theStyle, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -63,21 +63,6 @@ Standard_Boolean AIS_ManipulatorOwner::IsHilighted (const Handle(PrsMgr_Presenta
|
|||||||
return thePM->IsHighlighted (Selectable(), myMode);
|
return thePM->IsHighlighted (Selectable(), myMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Hilight
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void AIS_ManipulatorOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
|
||||||
const Standard_Integer /*theMode*/)
|
|
||||||
{
|
|
||||||
if (!HasSelectable())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thePM->Highlight (Selectable(), myMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Unhilight
|
//function : Unhilight
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -37,13 +37,13 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT virtual ~AIS_ManipulatorOwner() {}
|
Standard_EXPORT virtual ~AIS_ManipulatorOwner() {}
|
||||||
|
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Standard_Integer theMode) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
const Standard_Integer theMode) const Standard_OVERRIDE;
|
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT AIS_ManipulatorMode Mode() const { return myMode; }
|
Standard_EXPORT AIS_ManipulatorMode Mode() const { return myMode; }
|
||||||
|
@ -52,11 +52,9 @@ namespace
|
|||||||
|
|
||||||
Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode) const;
|
Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode) const;
|
||||||
|
|
||||||
void Hilight (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode);
|
void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM,
|
const Standard_Integer theMode);
|
||||||
const Quantity_NameOfColor aColor,
|
|
||||||
const Standard_Integer aMode);
|
|
||||||
|
|
||||||
void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer aMode);
|
void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer aMode);
|
||||||
|
|
||||||
@ -103,36 +101,23 @@ Standard_Boolean SelectMgr_AssemblyEntityOwner::IsHilighted (const Handle(PrsMgr
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Hilight
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void SelectMgr_AssemblyEntityOwner::Hilight (const Handle(PrsMgr_PresentationManager)& PM,
|
|
||||||
const Standard_Integer aMode)
|
|
||||||
{
|
|
||||||
if (HasSelectable())
|
|
||||||
{
|
|
||||||
PM->Highlight (myAssembly, aMode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : HilightWithColor
|
//function : HilightWithColor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_AssemblyEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM,
|
void SelectMgr_AssemblyEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor aColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer aMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (HasSelectable())
|
if (HasSelectable())
|
||||||
{
|
{
|
||||||
if (IsAutoHilight())
|
if (IsAutoHilight())
|
||||||
{
|
{
|
||||||
PM->Color (myAssembly, aColor, aMode);
|
thePM->Color (myAssembly, theStyle, theMode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myAssembly->HilightOwnerWithColor (PM, aColor, this);
|
myAssembly->HilightOwnerWithColor (thePM, theStyle, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,8 @@ Graphic3d_Group.cxx
|
|||||||
Graphic3d_Group.hxx
|
Graphic3d_Group.hxx
|
||||||
Graphic3d_GroupAspect.hxx
|
Graphic3d_GroupAspect.hxx
|
||||||
Graphic3d_GroupDefinitionError.hxx
|
Graphic3d_GroupDefinitionError.hxx
|
||||||
|
Graphic3d_HighlightStyle.hxx
|
||||||
|
Graphic3d_HighlightStyle.cxx
|
||||||
Graphic3d_HorizontalTextAlignment.hxx
|
Graphic3d_HorizontalTextAlignment.hxx
|
||||||
Graphic3d_IndexBuffer.hxx
|
Graphic3d_IndexBuffer.hxx
|
||||||
Graphic3d_IndexedMapOfAddress.hxx
|
Graphic3d_IndexedMapOfAddress.hxx
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <Graphic3d_BndBox4f.hxx>
|
#include <Graphic3d_BndBox4f.hxx>
|
||||||
#include <Graphic3d_Group.hxx>
|
#include <Graphic3d_Group.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||||
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
||||||
#include <Graphic3d_TypeOfComposition.hxx>
|
#include <Graphic3d_TypeOfComposition.hxx>
|
||||||
@ -98,6 +99,10 @@ public:
|
|||||||
//! Get z layer ID
|
//! Get z layer ID
|
||||||
Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
|
Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
|
||||||
|
|
||||||
|
//! 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; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Update structure visibility state
|
//! Update structure visibility state
|
||||||
@ -112,13 +117,13 @@ public:
|
|||||||
//! Disconnect other structure to this one
|
//! Disconnect other structure to this one
|
||||||
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
|
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
|
||||||
|
|
||||||
//! Highlight entire structure with color
|
//! Highlights structure with the given style
|
||||||
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
|
virtual void GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Boolean theToCreate) = 0;
|
const Handle(Graphic3d_Structure)& theStruct) = 0;
|
||||||
|
|
||||||
//! Highlight structure using boundary box
|
//! Unhighlights the structure and invalidates pointer to structure's highlight
|
||||||
virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
//! style
|
||||||
const Standard_Boolean theToCreate) = 0;
|
virtual void GraphicUnhighlight() = 0;
|
||||||
|
|
||||||
//! Create shadow link to this structure
|
//! Create shadow link to this structure
|
||||||
virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
|
virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
|
||||||
@ -136,8 +141,6 @@ public:
|
|||||||
int Priority;
|
int Priority;
|
||||||
int PreviousPriority;
|
int PreviousPriority;
|
||||||
|
|
||||||
Quantity_Color HighlightColor;
|
|
||||||
|
|
||||||
int ContainsFacet;
|
int ContainsFacet;
|
||||||
|
|
||||||
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
|
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
|
||||||
@ -164,6 +167,7 @@ protected:
|
|||||||
Handle(Geom_Transformation) myTrsf;
|
Handle(Geom_Transformation) myTrsf;
|
||||||
Handle(Graphic3d_TransformPers) myTrsfPers;
|
Handle(Graphic3d_TransformPers) myTrsfPers;
|
||||||
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
|
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
|
||||||
|
Handle(Graphic3d_HighlightStyle) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
||||||
if (!aCompStruct->IsHighlighted())
|
if (!aCompStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
|
aCompStruct->Highlight (aStruct->HighlightStyle(), Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
|||||||
|
|
||||||
if (aStruct->IsHighlighted())
|
if (aStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
|
aCompStruct->Highlight (aStruct->HighlightStyle(), Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean hasResult = Standard_False;
|
Standard_Boolean hasResult = Standard_False;
|
||||||
@ -335,7 +335,7 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
|||||||
|
|
||||||
if (theStruct->IsHighlighted())
|
if (theStruct->IsHighlighted())
|
||||||
{
|
{
|
||||||
aCompStruct->Highlight (Aspect_TOHM_COLOR, theStruct->HighlightColor(), Standard_False);
|
aCompStruct->Highlight (theStruct->HighlightStyle(), Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The previous calculation is removed and the new one is displayed
|
// The previous calculation is removed and the new one is displayed
|
||||||
@ -848,7 +848,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
|||||||
|
|
||||||
if (theStructure->IsHighlighted())
|
if (theStructure->IsHighlighted())
|
||||||
{
|
{
|
||||||
aStruct->Highlight (Aspect_TOHM_COLOR, theStructure->HighlightColor(), Standard_False);
|
aStruct->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is displayed only if the calculated structure
|
// It is displayed only if the calculated structure
|
||||||
@ -912,14 +912,13 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure,
|
|||||||
// function : Highlight
|
// function : Highlight
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Graphic3d_CView::Highlight (const Handle(Graphic3d_Structure)& theStructure,
|
void Graphic3d_CView::Highlight (const Handle(Graphic3d_Structure)& theStructure)
|
||||||
const Aspect_TypeOfHighlightMethod theMethod)
|
|
||||||
{
|
{
|
||||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||||
aCompStruct->Highlight (theMethod, theStructure->HighlightColor(), Standard_False);
|
aCompStruct->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,7 +970,7 @@ void Graphic3d_CView::UnHighlight (const Handle(Graphic3d_Structure)& theStructu
|
|||||||
if (anIndex != 0)
|
if (anIndex != 0)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||||
aCompStruct->GraphicUnHighlight();
|
aCompStruct->CStructure()->GraphicUnhighlight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,8 +189,7 @@ private:
|
|||||||
const Aspect_TypeOfUpdate theUpdateMode);
|
const Aspect_TypeOfUpdate theUpdateMode);
|
||||||
|
|
||||||
//! Highlights the structure in the view.
|
//! Highlights the structure in the view.
|
||||||
Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure,
|
Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
const Aspect_TypeOfHighlightMethod theMethod);
|
|
||||||
|
|
||||||
//! Transforms the structure in the view.
|
//! Transforms the structure in the view.
|
||||||
Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
||||||
|
18
src/Graphic3d/Graphic3d_HighlightStyle.cxx
Normal file
18
src/Graphic3d/Graphic3d_HighlightStyle.cxx
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// 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)
|
117
src/Graphic3d/Graphic3d_HighlightStyle.hxx
Normal file
117
src/Graphic3d/Graphic3d_HighlightStyle.hxx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
// 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_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)
|
||||||
|
|
||||||
|
#endif // _Graphic3d_HighlightStyle_HeaderFile
|
@ -44,8 +44,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
|||||||
: myStructureManager (theManager.operator->()),
|
: myStructureManager (theManager.operator->()),
|
||||||
myFirstStructureManager (theManager.operator->()),
|
myFirstStructureManager (theManager.operator->()),
|
||||||
myComputeVisual (Graphic3d_TOS_ALL),
|
myComputeVisual (Graphic3d_TOS_ALL),
|
||||||
myHighlightColor (Quantity_NOC_WHITE),
|
|
||||||
myHighlightMethod (Aspect_TOHM_COLOR),
|
|
||||||
myOwner (NULL),
|
myOwner (NULL),
|
||||||
myVisual (Graphic3d_TOS_ALL)
|
myVisual (Graphic3d_TOS_ALL)
|
||||||
{
|
{
|
||||||
@ -61,8 +59,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
|||||||
: myStructureManager (theManager.operator->()),
|
: myStructureManager (theManager.operator->()),
|
||||||
myFirstStructureManager (theManager.operator->()),
|
myFirstStructureManager (theManager.operator->()),
|
||||||
myComputeVisual (thePrs->myComputeVisual),
|
myComputeVisual (thePrs->myComputeVisual),
|
||||||
myHighlightColor (thePrs->myHighlightColor),
|
|
||||||
myHighlightMethod (thePrs->myHighlightMethod),
|
|
||||||
myOwner (thePrs->myOwner),
|
myOwner (thePrs->myOwner),
|
||||||
myVisual (thePrs->myVisual)
|
myVisual (thePrs->myVisual)
|
||||||
{
|
{
|
||||||
@ -273,17 +269,14 @@ void Graphic3d_Structure::Erase()
|
|||||||
//function : Highlight
|
//function : Highlight
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
|
void Graphic3d_Structure::Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Quantity_Color& theColor,
|
const Standard_Boolean theToUpdateMgr)
|
||||||
const Standard_Boolean theToUpdateMgr)
|
|
||||||
{
|
{
|
||||||
if (IsDeleted())
|
if (IsDeleted())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myHighlightColor = theColor;
|
|
||||||
|
|
||||||
// Highlight on already Highlighted structure.
|
// Highlight on already Highlighted structure.
|
||||||
if (myCStructure->highlight)
|
if (myCStructure->highlight)
|
||||||
{
|
{
|
||||||
@ -304,7 +297,7 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
|
|||||||
|
|
||||||
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
|
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
|
||||||
|
|
||||||
GraphicHighlight (theMethod);
|
myCStructure->GraphicHighlight (theStyle, this);
|
||||||
|
|
||||||
if (!theToUpdateMgr)
|
if (!theToUpdateMgr)
|
||||||
{
|
{
|
||||||
@ -313,7 +306,7 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
|
|||||||
|
|
||||||
if (myCStructure->stick)
|
if (myCStructure->stick)
|
||||||
{
|
{
|
||||||
myStructureManager->Highlight (this, theMethod);
|
myStructureManager->Highlight (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
@ -350,7 +343,7 @@ void Graphic3d_Structure::UnHighlight()
|
|||||||
{
|
{
|
||||||
myCStructure->highlight = 0;
|
myCStructure->highlight = 0;
|
||||||
|
|
||||||
GraphicUnHighlight();
|
myCStructure->GraphicUnhighlight();
|
||||||
myStructureManager->UnHighlight (this);
|
myStructureManager->UnHighlight (this);
|
||||||
|
|
||||||
ResetDisplayPriority();
|
ResetDisplayPriority();
|
||||||
@ -359,12 +352,12 @@ void Graphic3d_Structure::UnHighlight()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : HighlightColor
|
//function : HighlightStyle
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
const Quantity_Color& Graphic3d_Structure::HighlightColor() const
|
const Handle(Graphic3d_HighlightStyle)& Graphic3d_Structure::HighlightStyle() const
|
||||||
{
|
{
|
||||||
return myHighlightColor;
|
return myCStructure->HighlightStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1302,30 +1295,6 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
|
|||||||
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
|
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : GraphicHighlight
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod theMethod)
|
|
||||||
{
|
|
||||||
myCStructure->highlight = 1;
|
|
||||||
myHighlightMethod = theMethod;
|
|
||||||
switch (theMethod)
|
|
||||||
{
|
|
||||||
case Aspect_TOHM_COLOR:
|
|
||||||
{
|
|
||||||
myCStructure->HighlightWithColor (myHighlightColor, Standard_True);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Aspect_TOHM_BOUNDBOX:
|
|
||||||
{
|
|
||||||
myCStructure->HighlightColor = myHighlightColor;
|
|
||||||
myCStructure->HighlightWithBndBox (this, Standard_True);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : GraphicTransform
|
//function : GraphicTransform
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1335,24 +1304,6 @@ void Graphic3d_Structure::GraphicTransform (const Handle(Geom_Transformation)& t
|
|||||||
myCStructure->SetTransformation (theTrsf);
|
myCStructure->SetTransformation (theTrsf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : GraphicUnHighlight
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void Graphic3d_Structure::GraphicUnHighlight()
|
|
||||||
{
|
|
||||||
myCStructure->highlight = 0;
|
|
||||||
switch (myHighlightMethod)
|
|
||||||
{
|
|
||||||
case Aspect_TOHM_COLOR:
|
|
||||||
myCStructure->HighlightWithColor (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f), Standard_False);
|
|
||||||
break;
|
|
||||||
case Aspect_TOHM_BOUNDBOX:
|
|
||||||
myCStructure->HighlightWithBndBox (this, Standard_False);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : ComputeVisual
|
//function : ComputeVisual
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#include <Graphic3d_CStructure.hxx>
|
#include <Graphic3d_CStructure.hxx>
|
||||||
#include <Graphic3d_IndexedMapOfAddress.hxx>
|
#include <Graphic3d_IndexedMapOfAddress.hxx>
|
||||||
#include <Quantity_Color.hxx>
|
|
||||||
#include <Aspect_TypeOfHighlightMethod.hxx>
|
|
||||||
#include <Standard_Address.hxx>
|
#include <Standard_Address.hxx>
|
||||||
#include <Graphic3d_TypeOfStructure.hxx>
|
#include <Graphic3d_TypeOfStructure.hxx>
|
||||||
#include <MMgt_TShared.hxx>
|
#include <MMgt_TShared.hxx>
|
||||||
@ -46,7 +44,6 @@ class Graphic3d_StructureDefinitionError;
|
|||||||
class Graphic3d_TransformError;
|
class Graphic3d_TransformError;
|
||||||
class Graphic3d_Group;
|
class Graphic3d_Group;
|
||||||
class Graphic3d_StructureManager;
|
class Graphic3d_StructureManager;
|
||||||
class Quantity_Color;
|
|
||||||
class Graphic3d_DataStructureManager;
|
class Graphic3d_DataStructureManager;
|
||||||
class Bnd_Box;
|
class Bnd_Box;
|
||||||
class gp_Pnt;
|
class gp_Pnt;
|
||||||
@ -105,10 +102,11 @@ public:
|
|||||||
//! of the visualiser.
|
//! of the visualiser.
|
||||||
Standard_EXPORT virtual void Erase();
|
Standard_EXPORT virtual void Erase();
|
||||||
|
|
||||||
//! Highlights the structure <me> in all the views of the visualiser, using the following methods:
|
//! Highlights the structure in all the views with the given style
|
||||||
//! TOHM_COLOR = drawn in the highlight color
|
//! @param theStyle [in] the style (type of highlighting: box/color, color and opacity)
|
||||||
//! TOHM_BOUNDBOX = enclosed by the boundary box
|
//! @param theToUpdateMgr [in] defines whether related computed structures will be
|
||||||
Standard_EXPORT void Highlight (const Aspect_TypeOfHighlightMethod theMethod, const Quantity_Color& theColor, const Standard_Boolean theToUpdateMgr = Standard_True);
|
//! highlighted via structure manager or not
|
||||||
|
Standard_EXPORT void Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Boolean theToUpdateMgr = Standard_True);
|
||||||
|
|
||||||
//! Suppress the structure <me>.
|
//! Suppress the structure <me>.
|
||||||
//! It will be erased at the next screen update.
|
//! It will be erased at the next screen update.
|
||||||
@ -234,7 +232,7 @@ public:
|
|||||||
|
|
||||||
//! Returns the highlight color for the Highlight method
|
//! Returns the highlight color for the Highlight method
|
||||||
//! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
|
//! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
|
||||||
Standard_EXPORT const Quantity_Color& HighlightColor() const;
|
Standard_EXPORT const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const;
|
||||||
|
|
||||||
//! Returns Standard_True if the structure <me> is deleted.
|
//! Returns Standard_True if the structure <me> is deleted.
|
||||||
//! <me> is deleted after the call Remove (me).
|
//! <me> is deleted after the call Remove (me).
|
||||||
@ -362,16 +360,10 @@ public:
|
|||||||
Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter);
|
Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter);
|
||||||
|
|
||||||
Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter);
|
Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter);
|
||||||
|
|
||||||
//! Highlights the structure <me>.
|
|
||||||
Standard_EXPORT void GraphicHighlight (const Aspect_TypeOfHighlightMethod Method);
|
|
||||||
|
|
||||||
//! Internal method which sets new transformation without calling graphic manager callbacks.
|
//! Internal method which sets new transformation without calling graphic manager callbacks.
|
||||||
Standard_EXPORT void GraphicTransform (const Handle(Geom_Transformation)& theTrsf);
|
Standard_EXPORT void GraphicTransform (const Handle(Geom_Transformation)& theTrsf);
|
||||||
|
|
||||||
//! Suppress the highlight for the structure <me>.
|
|
||||||
Standard_EXPORT void GraphicUnHighlight();
|
|
||||||
|
|
||||||
//! Returns the identification number of the structure <me>.
|
//! Returns the identification number of the structure <me>.
|
||||||
Standard_EXPORT Standard_Integer Identification() const;
|
Standard_EXPORT Standard_Integer Identification() const;
|
||||||
|
|
||||||
@ -454,8 +446,6 @@ protected:
|
|||||||
Handle(Graphic3d_CStructure) myCStructure;
|
Handle(Graphic3d_CStructure) myCStructure;
|
||||||
Graphic3d_IndexedMapOfAddress myAncestors;
|
Graphic3d_IndexedMapOfAddress myAncestors;
|
||||||
Graphic3d_IndexedMapOfAddress myDescendants;
|
Graphic3d_IndexedMapOfAddress myDescendants;
|
||||||
Quantity_Color myHighlightColor;
|
|
||||||
Aspect_TypeOfHighlightMethod myHighlightMethod;
|
|
||||||
Standard_Address myOwner;
|
Standard_Address myOwner;
|
||||||
Graphic3d_TypeOfStructure myVisual;
|
Graphic3d_TypeOfStructure myVisual;
|
||||||
|
|
||||||
|
@ -355,15 +355,14 @@ void Graphic3d_StructureManager::Erase (const Handle(Graphic3d_Structure)& theSt
|
|||||||
// function : Erase
|
// function : Erase
|
||||||
// purpose :
|
// purpose :
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
void Graphic3d_StructureManager::Highlight (const Handle(Graphic3d_Structure)& theStructure,
|
void Graphic3d_StructureManager::Highlight (const Handle(Graphic3d_Structure)& theStructure)
|
||||||
const Aspect_TypeOfHighlightMethod theMethod)
|
|
||||||
{
|
{
|
||||||
myHighlightedStructure.Add (theStructure);
|
myHighlightedStructure.Add (theStructure);
|
||||||
|
|
||||||
// Highlight in all defined views
|
// Highlight in all defined views
|
||||||
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
|
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
|
||||||
{
|
{
|
||||||
aViewIt.Value()->Highlight (theStructure, theMethod);
|
aViewIt.Value()->Highlight (theStructure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public:
|
|||||||
Standard_EXPORT virtual void Erase (const Handle(Graphic3d_Structure)& theStructure);
|
Standard_EXPORT virtual void Erase (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
|
|
||||||
//! Highlights the structure.
|
//! Highlights the structure.
|
||||||
Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& theStructure, const Aspect_TypeOfHighlightMethod theMethod);
|
Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& theStructure);
|
||||||
|
|
||||||
//! Transforms the structure.
|
//! Transforms the structure.
|
||||||
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(Geom_Transformation)& theTrsf);
|
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(Geom_Transformation)& theTrsf);
|
||||||
|
@ -135,6 +135,9 @@ MeshVS_Mesh::MeshVS_Mesh (const Standard_Boolean theIsAllowOverlapped )
|
|||||||
myHilightDrawer->SetInteger ( MeshVS_DA_MarkerType, Aspect_TOM_STAR );
|
myHilightDrawer->SetInteger ( MeshVS_DA_MarkerType, Aspect_TOM_STAR );
|
||||||
myHilightDrawer->SetColor ( MeshVS_DA_MarkerColor, Quantity_NOC_GRAY80 );
|
myHilightDrawer->SetColor ( MeshVS_DA_MarkerColor, Quantity_NOC_GRAY80 );
|
||||||
myHilightDrawer->SetDouble ( MeshVS_DA_MarkerScale, 2.0 );
|
myHilightDrawer->SetDouble ( MeshVS_DA_MarkerScale, 2.0 );
|
||||||
|
|
||||||
|
HilightAttributes()->SetSelectionStyle
|
||||||
|
(new Graphic3d_HighlightStyle (Aspect_TOHM_COLOR, Quantity_NOC_GRAY80, 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
@ -951,8 +954,9 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager3d)&
|
|||||||
if (theOwners.Value (i) == GlobalSelOwner())
|
if (theOwners.Value (i) == GlobalSelOwner())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
|
const Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
|
||||||
const Quantity_NameOfColor aSelColor = GetContext().IsNull() ? Quantity_NOC_GRAY80 : GetContext()->SelectionColor();
|
const Handle(Graphic3d_HighlightStyle)& aSelStyle = GetContext().IsNull()
|
||||||
thePM->Color (this, aSelColor, aHiMode);
|
? HilightAttributes()->SelectionStyle() : GetContext()->SelectionStyle();
|
||||||
|
thePM->Color (this, aSelStyle, aHiMode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
anOwner = Handle (MeshVS_MeshEntityOwner)::DownCast ( theOwners.Value ( i ) );
|
anOwner = Handle (MeshVS_MeshEntityOwner)::DownCast ( theOwners.Value ( i ) );
|
||||||
@ -1059,17 +1063,18 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager3d)&
|
|||||||
// Function : HilightOwnerWithColor
|
// Function : HilightOwnerWithColor
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//================================================================
|
//================================================================
|
||||||
void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& PM,
|
void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor Color,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Handle(SelectMgr_EntityOwner)& Owner)
|
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||||
{
|
{
|
||||||
if (Owner.IsNull())
|
if (theOwner.IsNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Owner == GlobalSelOwner())
|
const Quantity_Color& aColor = theStyle->Color();
|
||||||
|
if (theOwner == GlobalSelOwner())
|
||||||
{
|
{
|
||||||
Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
|
Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
|
||||||
PM->Color (this, Color, aHiMode, NULL, Graphic3d_ZLayerId_Top);
|
thePM->Color (this, theStyle, aHiMode, NULL, Graphic3d_ZLayerId_Top);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1077,7 +1082,7 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Handle( Prs3d_Presentation ) aHilightPrs;
|
Handle( Prs3d_Presentation ) aHilightPrs;
|
||||||
aHilightPrs = GetHilightPresentation( PM );
|
aHilightPrs = GetHilightPresentation( thePM );
|
||||||
|
|
||||||
aHilightPrs->Clear();
|
aHilightPrs->Clear();
|
||||||
|
|
||||||
@ -1086,26 +1091,26 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
|
|||||||
aHilightPrs->SetTransformPersistence (Presentation()->TransformPersistence());
|
aHilightPrs->SetTransformPersistence (Presentation()->TransformPersistence());
|
||||||
//----------------
|
//----------------
|
||||||
|
|
||||||
const Standard_Boolean isMeshEntityOwner = Owner->IsKind ( STANDARD_TYPE ( MeshVS_MeshEntityOwner ) );
|
const Standard_Boolean isMeshEntityOwner = theOwner->IsKind ( STANDARD_TYPE ( MeshVS_MeshEntityOwner ) );
|
||||||
const Standard_Boolean isWholeMeshOwner =
|
const Standard_Boolean isWholeMeshOwner =
|
||||||
//agv !Owner.IsNull() && Owner==myWholeMeshOwner;
|
//agv !Owner.IsNull() && Owner==myWholeMeshOwner;
|
||||||
IsWholeMeshOwner (Owner);
|
IsWholeMeshOwner (theOwner);
|
||||||
|
|
||||||
Standard_Integer aDispMode = MeshVS_DMF_Shading;
|
Standard_Integer aDispMode = MeshVS_DMF_Shading;
|
||||||
if ( HasDisplayMode() && ( DisplayMode() & MeshVS_DMF_OCCMask ) > MeshVS_DMF_WireFrame )
|
if ( HasDisplayMode() && ( DisplayMode() & MeshVS_DMF_OCCMask ) > MeshVS_DMF_WireFrame )
|
||||||
aDispMode = ( DisplayMode() & MeshVS_DMF_OCCMask );
|
aDispMode = ( DisplayMode() & MeshVS_DMF_OCCMask );
|
||||||
//It because we draw hilighted owners only in shading or shrink (not in wireframe)
|
//It because we draw hilighted owners only in shading or shrink (not in wireframe)
|
||||||
|
|
||||||
myHilightDrawer->SetColor( MeshVS_DA_InteriorColor, Color );
|
myHilightDrawer->SetColor( MeshVS_DA_InteriorColor, aColor );
|
||||||
myHilightDrawer->SetColor( MeshVS_DA_BackInteriorColor, Color );
|
myHilightDrawer->SetColor( MeshVS_DA_BackInteriorColor, aColor );
|
||||||
myHilightDrawer->SetColor( MeshVS_DA_EdgeColor, Color );
|
myHilightDrawer->SetColor( MeshVS_DA_EdgeColor, aColor );
|
||||||
myHilightDrawer->SetColor( MeshVS_DA_BeamColor, Color );
|
myHilightDrawer->SetColor( MeshVS_DA_BeamColor, aColor );
|
||||||
myHilightDrawer->SetColor( MeshVS_DA_MarkerColor, Color );
|
myHilightDrawer->SetColor( MeshVS_DA_MarkerColor, aColor );
|
||||||
myHilighter->SetDrawer( myHilightDrawer );
|
myHilighter->SetDrawer( myHilightDrawer );
|
||||||
|
|
||||||
if( isMeshEntityOwner )
|
if( isMeshEntityOwner )
|
||||||
{
|
{
|
||||||
Handle ( MeshVS_MeshEntityOwner ) theAISOwner = Handle ( MeshVS_MeshEntityOwner )::DownCast ( Owner );
|
Handle ( MeshVS_MeshEntityOwner ) theAISOwner = Handle ( MeshVS_MeshEntityOwner )::DownCast ( theOwner );
|
||||||
MeshVS_EntityType aType = theAISOwner->Type();
|
MeshVS_EntityType aType = theAISOwner->Type();
|
||||||
Standard_Integer anID = theAISOwner->ID();
|
Standard_Integer anID = theAISOwner->ID();
|
||||||
|
|
||||||
@ -1136,7 +1141,7 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle(MeshVS_MeshOwner) aMeshOwner = Handle(MeshVS_MeshOwner)::DownCast ( Owner );
|
Handle(MeshVS_MeshOwner) aMeshOwner = Handle(MeshVS_MeshOwner)::DownCast ( theOwner );
|
||||||
if( !aMeshOwner.IsNull() )
|
if( !aMeshOwner.IsNull() )
|
||||||
{
|
{
|
||||||
Handle(TColStd_HPackedMapOfInteger) aNodes = aMeshOwner->GetDetectedNodes();
|
Handle(TColStd_HPackedMapOfInteger) aNodes = aMeshOwner->GetDetectedNodes();
|
||||||
@ -1159,9 +1164,9 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
|
|||||||
|
|
||||||
aHilightPrs->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
aHilightPrs->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||||
|
|
||||||
if (PM->IsImmediateModeOn())
|
if (thePM->IsImmediateModeOn())
|
||||||
{
|
{
|
||||||
PM->AddToImmediateList (aHilightPrs);
|
thePM->AddToImmediateList (aHilightPrs);
|
||||||
}
|
}
|
||||||
myHilighter->SetDrawer ( 0 );
|
myHilighter->SetDrawer ( 0 );
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,9 @@ public:
|
|||||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& PM, const SelectMgr_SequenceOfOwner& Owners) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& PM, const SelectMgr_SequenceOfOwner& Owners) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Draw hilighted owner presentation
|
//! Draw hilighted owner presentation
|
||||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& PM, const Quantity_NameOfColor Color, const Handle(SelectMgr_EntityOwner)& Owner) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theColor,
|
||||||
|
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Clears internal selection presentation
|
//! Clears internal selection presentation
|
||||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||||
|
@ -89,30 +89,13 @@ Standard_Boolean MeshVS_MeshEntityOwner::IsHilighted ( const Handle(PrsMgr_Prese
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
|
||||||
// Function : Hilight
|
|
||||||
// Purpose :
|
|
||||||
//================================================================
|
|
||||||
void MeshVS_MeshEntityOwner::Hilight ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================
|
|
||||||
// Function : Hilight
|
|
||||||
// Purpose :
|
|
||||||
//================================================================
|
|
||||||
void MeshVS_MeshEntityOwner::Hilight ( const Handle(PrsMgr_PresentationManager)&,
|
|
||||||
const Standard_Integer )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : HilightWithColor
|
// Function : HilightWithColor
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//================================================================
|
//================================================================
|
||||||
void MeshVS_MeshEntityOwner::HilightWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void MeshVS_MeshEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer /*theMode*/ )
|
const Standard_Integer /*theMode*/ )
|
||||||
{
|
{
|
||||||
Handle( SelectMgr_SelectableObject ) aSelObj;
|
Handle( SelectMgr_SelectableObject ) aSelObj;
|
||||||
if ( HasSelectable() )
|
if ( HasSelectable() )
|
||||||
@ -121,7 +104,7 @@ void MeshVS_MeshEntityOwner::HilightWithColor ( const Handle(PrsMgr_Presentation
|
|||||||
if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
|
if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
|
||||||
{
|
{
|
||||||
Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
|
Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
|
||||||
aMesh->HilightOwnerWithColor ( thePM, theColor, this );
|
aMesh->HilightOwnerWithColor ( thePM, theStyle, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,10 @@ public:
|
|||||||
//! Returns true if owner is hilighted
|
//! Returns true if owner is hilighted
|
||||||
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Hilights owner
|
|
||||||
Standard_EXPORT virtual void Hilight() Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Hilights owner
|
|
||||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Hilights owner with the certain color
|
//! Hilights owner with the certain color
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM, const Quantity_NameOfColor theColor, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Strip hilight of owner
|
//! Strip hilight of owner
|
||||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
||||||
|
@ -136,7 +136,7 @@ void MeshVS_MeshOwner::SetDetectedEntities (const Handle(TColStd_HPackedMapOfInt
|
|||||||
// Purpose :
|
// Purpose :
|
||||||
//================================================================
|
//================================================================
|
||||||
void MeshVS_MeshOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
void MeshVS_MeshOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer /*theMode*/)
|
const Standard_Integer /*theMode*/)
|
||||||
{
|
{
|
||||||
Handle( SelectMgr_SelectableObject ) aSelObj;
|
Handle( SelectMgr_SelectableObject ) aSelObj;
|
||||||
@ -167,7 +167,7 @@ void MeshVS_MeshOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager
|
|||||||
|
|
||||||
// hilight detected entities
|
// hilight detected entities
|
||||||
Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
|
Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
|
||||||
aMesh->HilightOwnerWithColor ( thePM, theColor, this );
|
aMesh->HilightOwnerWithColor ( thePM, theStyle, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,9 @@ public:
|
|||||||
//! Saves ids of hilighted mesh entities
|
//! Saves ids of hilighted mesh entities
|
||||||
Standard_EXPORT void SetDetectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems);
|
Standard_EXPORT void SetDetectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems);
|
||||||
|
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM, const Quantity_NameOfColor theColor, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& 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;
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
@ -2880,6 +2880,7 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
|||||||
if (theHighlightColor != NULL)
|
if (theHighlightColor != NULL)
|
||||||
{
|
{
|
||||||
aParams.SetColor (*theHighlightColor);
|
aParams.SetColor (*theHighlightColor);
|
||||||
|
aParams.Diffuse.a() = theHighlightColor->a();
|
||||||
}
|
}
|
||||||
|
|
||||||
myActiveProgram->SetUniform (this, aLoc, OpenGl_Material::NbOfVec4(),
|
myActiveProgram->SetUniform (this, aLoc, OpenGl_Material::NbOfVec4(),
|
||||||
|
@ -828,7 +828,36 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
||||||
? myBounds->Colors
|
? myBounds->Colors
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
|
const Standard_Boolean isHighlightWithTransparency = toHilight &&
|
||||||
|
myDrawMode > GL_LINE_STRIP &&
|
||||||
|
theWorkspace->InteriorColor().a() > 0.05f;
|
||||||
|
GLint aPrevBlendSrc = GL_SRC_ALPHA, aPrevBlendDst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
GLboolean wasBlendEnabled = GL_FALSE;
|
||||||
|
if (isHighlightWithTransparency)
|
||||||
|
{
|
||||||
|
wasBlendEnabled = glIsEnabled (GL_BLEND);
|
||||||
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
|
glGetIntegerv (GL_BLEND_SRC, &aPrevBlendSrc);
|
||||||
|
glGetIntegerv (GL_BLEND_DST, &aPrevBlendDst);
|
||||||
|
#endif
|
||||||
|
if (!wasBlendEnabled)
|
||||||
|
{
|
||||||
|
glEnable (GL_BLEND);
|
||||||
|
}
|
||||||
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
||||||
|
|
||||||
|
if (isHighlightWithTransparency)
|
||||||
|
{
|
||||||
|
glBlendFunc (aPrevBlendSrc, aPrevBlendDst);
|
||||||
|
if (!wasBlendEnabled)
|
||||||
|
{
|
||||||
|
glDisable (GL_BLEND);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myDrawMode <= GL_LINE_STRIP)
|
if (myDrawMode <= GL_LINE_STRIP)
|
||||||
|
@ -119,7 +119,6 @@ public:
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
|
OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
|
||||||
: Graphic3d_CStructure (theManager),
|
: Graphic3d_CStructure (theManager),
|
||||||
myHighlightColor (NULL),
|
|
||||||
myInstancedStructure (NULL),
|
myInstancedStructure (NULL),
|
||||||
myIsRaytracable (Standard_False),
|
myIsRaytracable (Standard_False),
|
||||||
myModificationState (0),
|
myModificationState (0),
|
||||||
@ -174,33 +173,13 @@ void OpenGl_Structure::clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : HighlightWithColor
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void OpenGl_Structure::HighlightWithColor (const Graphic3d_Vec3& theColor,
|
|
||||||
const Standard_Boolean theToCreate)
|
|
||||||
{
|
|
||||||
const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
|
|
||||||
if (theToCreate)
|
|
||||||
setHighlightColor (aContext, theColor);
|
|
||||||
else
|
|
||||||
clearHighlightColor (aContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : HighlightWithBndBox
|
// function : HighlightWithBndBox
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Structure::HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
void OpenGl_Structure::highlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct)
|
||||||
const Standard_Boolean theToCreate)
|
|
||||||
{
|
{
|
||||||
const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
|
const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
|
||||||
if (!theToCreate)
|
|
||||||
{
|
|
||||||
clearHighlightBox (aContext);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myHighlightBox.IsNull())
|
if (!myHighlightBox.IsNull())
|
||||||
{
|
{
|
||||||
@ -211,39 +190,43 @@ void OpenGl_Structure::HighlightWithBndBox (const Handle(Graphic3d_Structure)& t
|
|||||||
myHighlightBox = new OpenGl_Group (theStruct);
|
myHighlightBox = new OpenGl_Group (theStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
myHighlightBox->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (HighlightColor, Aspect_TOL_SOLID, 1.0));
|
myHighlightBox->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (myHighlightStyle->Color(), Aspect_TOL_SOLID, 1.0));
|
||||||
|
|
||||||
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (myBndBox);
|
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (myBndBox);
|
||||||
myHighlightBox->AddElement (aBndBoxPrs);
|
myHighlightBox->AddElement (aBndBoxPrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : setHighlightColor
|
// function : GraphicHighlight
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Structure::setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
void OpenGl_Structure::GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Graphic3d_Vec3& theColor)
|
const Handle(Graphic3d_Structure)& theStruct)
|
||||||
{
|
{
|
||||||
clearHighlightBox (theGlCtx);
|
myHighlightStyle = theStyle;
|
||||||
if (myHighlightColor == NULL)
|
|
||||||
|
highlight = 1;
|
||||||
|
if (myHighlightStyle->Method() == Aspect_TOHM_BOUNDBOX)
|
||||||
{
|
{
|
||||||
myHighlightColor = new OpenGl_Vec4 (theColor, 1.0f);
|
highlightWithBndBox (theStruct);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myHighlightColor->xyz() = theColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : clearHighlightColor
|
// function : GraphicUnhighlight
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Structure::clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx)
|
void OpenGl_Structure::GraphicUnhighlight()
|
||||||
{
|
{
|
||||||
clearHighlightBox(theGlCtx);
|
highlight = 0;
|
||||||
delete myHighlightColor;
|
|
||||||
myHighlightColor = NULL;
|
if (myHighlightStyle->Method() == Aspect_TOHM_BOUNDBOX)
|
||||||
|
{
|
||||||
|
const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
|
||||||
|
clearHighlightBox (aContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
myHighlightStyle.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -450,7 +433,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
|
|
||||||
// Render named status
|
// Render named status
|
||||||
if (highlight)
|
if (highlight && myHighlightBox.IsNull())
|
||||||
{
|
{
|
||||||
theWorkspace->SetHighlight (true);
|
theWorkspace->SetHighlight (true);
|
||||||
}
|
}
|
||||||
@ -521,8 +504,8 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
|
|
||||||
// Apply highlight color
|
// Apply highlight color
|
||||||
const OpenGl_Vec4* aHighlightColor = theWorkspace->HighlightColor;
|
const OpenGl_Vec4* aHighlightColor = theWorkspace->HighlightColor;
|
||||||
if (myHighlightColor)
|
if (!myHighlightStyle.IsNull())
|
||||||
theWorkspace->HighlightColor = myHighlightColor;
|
theWorkspace->HighlightColor = myHighlightStyle->ColorFltPtr();
|
||||||
|
|
||||||
// Collect clipping planes of structure scope
|
// Collect clipping planes of structure scope
|
||||||
aCtx->ChangeClipping().SetLocalPlanes (aCtx, myClipPlanes);
|
aCtx->ChangeClipping().SetLocalPlanes (aCtx, myClipPlanes);
|
||||||
@ -655,7 +638,8 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
{
|
{
|
||||||
// Release groups
|
// Release groups
|
||||||
Clear (theGlCtx);
|
Clear (theGlCtx);
|
||||||
clearHighlightColor (theGlCtx);
|
clearHighlightBox (theGlCtx);
|
||||||
|
myHighlightStyle.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -80,13 +80,13 @@ public:
|
|||||||
//! Synchronize structure transformation
|
//! Synchronize structure transformation
|
||||||
Standard_EXPORT virtual void SetTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
Standard_EXPORT virtual void SetTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Highlight entire structure with color
|
//! Highlights structure according to the given style and updates corresponding class fields
|
||||||
Standard_EXPORT virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
|
//! (highlight status and style)
|
||||||
const Standard_Boolean theToCreate) Standard_OVERRIDE;
|
Standard_EXPORT virtual void GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Handle(Graphic3d_Structure)& theStruct) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Highlight structure using boundary box
|
//! Unighlights structure and updates corresponding class fields (highlight status and style)
|
||||||
Standard_EXPORT virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
Standard_EXPORT virtual void GraphicUnhighlight() Standard_OVERRIDE;
|
||||||
const Standard_Boolean theToCreate) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Create shadow link to this structure
|
//! Create shadow link to this structure
|
||||||
Standard_EXPORT virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const Standard_OVERRIDE;
|
Standard_EXPORT virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const Standard_OVERRIDE;
|
||||||
@ -105,13 +105,6 @@ public:
|
|||||||
return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
|
return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
|
|
||||||
|
|
||||||
void setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
|
||||||
const Graphic3d_Vec3& theColor);
|
|
||||||
|
|
||||||
void clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
|
|
||||||
|
|
||||||
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
|
||||||
//! Renders the structure.
|
//! Renders the structure.
|
||||||
@ -181,10 +174,15 @@ protected:
|
|||||||
Standard_EXPORT void renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace,
|
Standard_EXPORT void renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
bool& theHasClosed) const;
|
bool& theHasClosed) const;
|
||||||
|
|
||||||
|
//! Highlight structure using boundary box
|
||||||
|
Standard_EXPORT void highlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct);
|
||||||
|
|
||||||
|
//! Invalidates highlight box and releases graphic resources it uses
|
||||||
|
Standard_EXPORT void clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Handle(OpenGl_Group) myHighlightBox;
|
Handle(OpenGl_Group) myHighlightBox;
|
||||||
OpenGl_Vec4* myHighlightColor;
|
|
||||||
|
|
||||||
OpenGl_Structure* myInstancedStructure;
|
OpenGl_Structure* myInstancedStructure;
|
||||||
|
|
||||||
|
@ -94,7 +94,10 @@ Prs3d_Drawer::Prs3d_Drawer()
|
|||||||
myHasOwnDimLengthModelUnits (Standard_False),
|
myHasOwnDimLengthModelUnits (Standard_False),
|
||||||
myHasOwnDimAngleModelUnits (Standard_False),
|
myHasOwnDimAngleModelUnits (Standard_False),
|
||||||
myHasOwnDimLengthDisplayUnits (Standard_False),
|
myHasOwnDimLengthDisplayUnits (Standard_False),
|
||||||
myHasOwnDimAngleDisplayUnits (Standard_False)
|
myHasOwnDimAngleDisplayUnits (Standard_False),
|
||||||
|
|
||||||
|
myHasOwnHighlightStyle (Standard_False),
|
||||||
|
myHasOwnSelectionStyle (Standard_False)
|
||||||
{
|
{
|
||||||
myDimensionModelUnits.SetLengthUnits ("m");
|
myDimensionModelUnits.SetLengthUnits ("m");
|
||||||
myDimensionModelUnits.SetAngleUnits ("rad");
|
myDimensionModelUnits.SetAngleUnits ("rad");
|
||||||
@ -1013,6 +1016,8 @@ void Prs3d_Drawer::ClearLocalAttributes()
|
|||||||
myDatumAspect.Nullify();
|
myDatumAspect.Nullify();
|
||||||
myDimensionAspect.Nullify();
|
myDimensionAspect.Nullify();
|
||||||
mySectionAspect.Nullify();
|
mySectionAspect.Nullify();
|
||||||
|
myHighlightStyle.Nullify();
|
||||||
|
mySelectionStyle.Nullify();
|
||||||
|
|
||||||
myHasOwnUIsoAspect = Standard_False;
|
myHasOwnUIsoAspect = Standard_False;
|
||||||
myHasOwnVIsoAspect = Standard_False;
|
myHasOwnVIsoAspect = Standard_False;
|
||||||
@ -1054,6 +1059,8 @@ void Prs3d_Drawer::ClearLocalAttributes()
|
|||||||
myHasOwnDimLengthDisplayUnits = Standard_False;
|
myHasOwnDimLengthDisplayUnits = Standard_False;
|
||||||
myHasOwnDimAngleModelUnits = Standard_False;
|
myHasOwnDimAngleModelUnits = Standard_False;
|
||||||
myHasOwnDimAngleDisplayUnits = Standard_False;
|
myHasOwnDimAngleDisplayUnits = Standard_False;
|
||||||
|
myHasOwnHighlightStyle = Standard_False;
|
||||||
|
myHasOwnSelectionStyle = Standard_False;
|
||||||
|
|
||||||
myVertexDrawMode = Prs3d_VDM_Inherited;
|
myVertexDrawMode = Prs3d_VDM_Inherited;
|
||||||
myTypeOfHLR = Prs3d_TOH_NotSet;
|
myTypeOfHLR = Prs3d_TOH_NotSet;
|
||||||
@ -1240,3 +1247,23 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <Quantity_Length.hxx>
|
#include <Quantity_Length.hxx>
|
||||||
#include <Aspect_TypeOfDeflection.hxx>
|
#include <Aspect_TypeOfDeflection.hxx>
|
||||||
#include <Graphic3d_GroupAspect.hxx>
|
#include <Graphic3d_GroupAspect.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <Graphic3d_ShaderProgram.hxx>
|
#include <Graphic3d_ShaderProgram.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
#include <Prs3d_VertexDrawMode.hxx>
|
#include <Prs3d_VertexDrawMode.hxx>
|
||||||
@ -823,6 +824,36 @@ public:
|
|||||||
//! that overrides the one in the link.
|
//! that overrides the one in the link.
|
||||||
Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
|
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.
|
//! Returns the drawer to which the current object references.
|
||||||
const Handle(Prs3d_Drawer)& Link() { return myLink; }
|
const Handle(Prs3d_Drawer)& Link() { return myLink; }
|
||||||
|
|
||||||
@ -937,6 +968,11 @@ protected:
|
|||||||
Standard_Boolean myHasOwnDimLengthDisplayUnits;
|
Standard_Boolean myHasOwnDimLengthDisplayUnits;
|
||||||
Standard_Boolean myHasOwnDimAngleDisplayUnits;
|
Standard_Boolean myHasOwnDimAngleDisplayUnits;
|
||||||
|
|
||||||
|
Handle(Graphic3d_HighlightStyle) myHighlightStyle;
|
||||||
|
Standard_Boolean myHasOwnHighlightStyle;
|
||||||
|
Handle(Graphic3d_HighlightStyle) mySelectionStyle;
|
||||||
|
Standard_Boolean myHasOwnSelectionStyle;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
|
DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <PrsMgr_Presentation.hxx>
|
#include <PrsMgr_Presentation.hxx>
|
||||||
|
|
||||||
#include <Geom_Transformation.hxx>
|
#include <Geom_Transformation.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <Graphic3d_DataStructureManager.hxx>
|
#include <Graphic3d_DataStructureManager.hxx>
|
||||||
#include <Graphic3d_Structure.hxx>
|
#include <Graphic3d_Structure.hxx>
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
@ -125,8 +126,7 @@ void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue)
|
|||||||
//function : Highlight
|
//function : Highlight
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void PrsMgr_Presentation::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
|
void PrsMgr_Presentation::Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
const Quantity_Color& theColor)
|
|
||||||
{
|
{
|
||||||
if (!IsHighlighted())
|
if (!IsHighlighted())
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ void PrsMgr_Presentation::Highlight (const Aspect_TypeOfHighlightMethod theMetho
|
|||||||
}
|
}
|
||||||
|
|
||||||
display (Standard_True);
|
display (Standard_True);
|
||||||
myStructure->Highlight (theMethod, theColor);
|
myStructure->Highlight (theStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -32,6 +32,7 @@ class PrsMgr_PresentableObject;
|
|||||||
class Quantity_Color;
|
class Quantity_Color;
|
||||||
class Geom_Transformation;
|
class Geom_Transformation;
|
||||||
class Prs3d_Presentation;
|
class Prs3d_Presentation;
|
||||||
|
class Graphic3d_HighlightStyle;
|
||||||
class Graphic3d_Structure;
|
class Graphic3d_Structure;
|
||||||
class Graphic3d_DataStructureManager;
|
class Graphic3d_DataStructureManager;
|
||||||
class Prs3d_Projector;
|
class Prs3d_Projector;
|
||||||
@ -85,7 +86,7 @@ private:
|
|||||||
|
|
||||||
Standard_EXPORT void SetVisible (const Standard_Boolean theValue);
|
Standard_EXPORT void SetVisible (const Standard_Boolean theValue);
|
||||||
|
|
||||||
Standard_EXPORT void Highlight (const Aspect_TypeOfHighlightMethod theMethod, const Quantity_Color& theColor);
|
Standard_EXPORT void Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle);
|
||||||
|
|
||||||
Standard_EXPORT void Unhighlight() const;
|
Standard_EXPORT void Unhighlight() const;
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentationManager,MMgt_TShared)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager)
|
PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager)
|
||||||
: myStructureManager (theStructureManager),
|
: myStructureManager (theStructureManager),
|
||||||
myImmediateModeOn (0),
|
myImmediateModeOn (0)
|
||||||
mySelectionColor (Quantity_NOC_GRAY99)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -157,40 +156,6 @@ void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableO
|
|||||||
Presentation (thePrsObj, theMode)->SetVisible (theValue);
|
Presentation (thePrsObj, theMode)->SetVisible (theValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Highlight
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
|
||||||
const Standard_Integer theMode)
|
|
||||||
{
|
|
||||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
|
||||||
{
|
|
||||||
Highlight (anIter.Value(), theMode);
|
|
||||||
}
|
|
||||||
if (!thePrsObj->HasOwnPresentations())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
|
||||||
if (aPrs->MustBeUpdated())
|
|
||||||
{
|
|
||||||
Update (thePrsObj, theMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myImmediateModeOn > 0)
|
|
||||||
{
|
|
||||||
Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
|
|
||||||
aShadow->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
|
||||||
AddToImmediateList (aShadow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aPrs->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Unhighlight
|
// function : Unhighlight
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -373,7 +338,7 @@ void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& the
|
|||||||
aShadowPrs->SetZLayer (aViewDepPrs->CStructure()->ZLayer());
|
aShadowPrs->SetZLayer (aViewDepPrs->CStructure()->ZLayer());
|
||||||
aShadowPrs->SetClipPlanes (aViewDepPrs->ClipPlanes());
|
aShadowPrs->SetClipPlanes (aViewDepPrs->ClipPlanes());
|
||||||
aShadowPrs->CStructure()->IsForHighlight = 1;
|
aShadowPrs->CStructure()->IsForHighlight = 1;
|
||||||
aShadowPrs->Highlight (Aspect_TOHM_COLOR, aPrs->HighlightColor());
|
aShadowPrs->Highlight (aPrs->HighlightStyle());
|
||||||
myViewDependentImmediateList.Append (aShadowPrs);
|
myViewDependentImmediateList.Append (aShadowPrs);
|
||||||
}
|
}
|
||||||
// handles custom highlight presentations which were defined in overridden
|
// handles custom highlight presentations which were defined in overridden
|
||||||
@ -602,14 +567,14 @@ void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObjec
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode,
|
const Standard_Integer theMode,
|
||||||
const Handle(PrsMgr_PresentableObject)& theSelObj,
|
const Handle(PrsMgr_PresentableObject)& theSelObj,
|
||||||
const Standard_Integer theImmediateStructLayerId)
|
const Standard_Integer theImmediateStructLayerId)
|
||||||
{
|
{
|
||||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
Color (anIter.Value(), theColor, theMode, NULL, theImmediateStructLayerId);
|
Color (anIter.Value(), theStyle, theMode, NULL, theImmediateStructLayerId);
|
||||||
}
|
}
|
||||||
if (!thePrsObj->HasOwnPresentations())
|
if (!thePrsObj->HasOwnPresentations())
|
||||||
{
|
{
|
||||||
@ -628,30 +593,15 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
|
|||||||
aShadow->SetZLayer (theImmediateStructLayerId);
|
aShadow->SetZLayer (theImmediateStructLayerId);
|
||||||
aShadow->SetClipPlanes (aPrs->Presentation()->ClipPlanes());
|
aShadow->SetClipPlanes (aPrs->Presentation()->ClipPlanes());
|
||||||
aShadow->CStructure()->IsForHighlight = 1;
|
aShadow->CStructure()->IsForHighlight = 1;
|
||||||
aShadow->Highlight (Aspect_TOHM_COLOR, theColor);
|
aShadow->Highlight (theStyle);
|
||||||
AddToImmediateList (aShadow);
|
AddToImmediateList (aShadow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPrs->Highlight (Aspect_TOHM_COLOR, theColor);
|
aPrs->Highlight (theStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : BoundBox
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObj,
|
|
||||||
const Standard_Integer theMode)
|
|
||||||
{
|
|
||||||
Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
|
|
||||||
if (aPrs->MustBeUpdated())
|
|
||||||
{
|
|
||||||
Update (thePrsObj, theMode);
|
|
||||||
}
|
|
||||||
aPrs->Highlight (Aspect_TOHM_BOUNDBOX, mySelectionColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -68,11 +68,7 @@ public:
|
|||||||
|
|
||||||
//! Sets the visibility of presentable object.
|
//! Sets the visibility of presentable object.
|
||||||
Standard_EXPORT void SetVisibility (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Boolean theValue);
|
Standard_EXPORT void SetVisibility (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Boolean theValue);
|
||||||
|
|
||||||
//! Highlights the presentation of the presentable object
|
|
||||||
//! thePrsObject in this framework with the display mode theMode.
|
|
||||||
Standard_EXPORT void Highlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
|
|
||||||
|
|
||||||
//! Removes highlighting from the presentation of the
|
//! Removes highlighting from the presentation of the
|
||||||
//! presentable object thePrsObject in this framework with the display mode theMode.
|
//! 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);
|
Standard_EXPORT void Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
|
||||||
@ -129,13 +125,10 @@ public:
|
|||||||
//! thePrsObject has the display mode theMode;
|
//! thePrsObject has the display mode theMode;
|
||||||
//! this has the default value of 0, that is, the wireframe display mode.
|
//! this has the default value of 0, that is, the wireframe display mode.
|
||||||
Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject,
|
||||||
const Quantity_NameOfColor theColor = Quantity_NOC_YELLOW,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode = 0,
|
const Standard_Integer theMode = 0,
|
||||||
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL,
|
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL,
|
||||||
const Graphic3d_ZLayerId theImmediateStructLayerId = Graphic3d_ZLayerId_Topmost);
|
const Graphic3d_ZLayerId theImmediateStructLayerId = Graphic3d_ZLayerId_Topmost);
|
||||||
|
|
||||||
//! highlights the boundbox of the presentation
|
|
||||||
Standard_EXPORT void BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
|
|
||||||
|
|
||||||
Standard_EXPORT void Connect (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(PrsMgr_PresentableObject)& theOtherObject, const Standard_Integer theMode = 0, const Standard_Integer theOtherMode = 0);
|
Standard_EXPORT void Connect (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(PrsMgr_PresentableObject)& theOtherObject, const Standard_Integer theMode = 0, const Standard_Integer theOtherMode = 0);
|
||||||
|
|
||||||
@ -179,7 +172,6 @@ protected:
|
|||||||
Standard_Integer myImmediateModeOn;
|
Standard_Integer myImmediateModeOn;
|
||||||
PrsMgr_ListOfPresentations myImmediateList;
|
PrsMgr_ListOfPresentations myImmediateList;
|
||||||
PrsMgr_ListOfPresentations myViewDependentImmediateList;
|
PrsMgr_ListOfPresentations myViewDependentImmediateList;
|
||||||
Quantity_Color mySelectionColor;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -156,7 +156,8 @@ static Standard_Integer BUC60814(Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
Handle(AIS_InteractiveObject) aCircle=new AIS_Circle(ahCircle);
|
Handle(AIS_InteractiveObject) aCircle=new AIS_Circle(ahCircle);
|
||||||
myAISContext->Display(aCircle);
|
myAISContext->Display(aCircle);
|
||||||
|
|
||||||
myAISContext->SelectionColor(Quantity_NOC_BLUE1);
|
Handle(Graphic3d_HighlightStyle)& aSelStyle = myAISContext->ChangeSelectionStyle();
|
||||||
|
aSelStyle->SetColor (Quantity_NOC_BLUE1);
|
||||||
|
|
||||||
myAISContext->AddOrRemoveSelected(aTrihedron);
|
myAISContext->AddOrRemoveSelected(aTrihedron);
|
||||||
myAISContext->AddOrRemoveSelected(aCircle);
|
myAISContext->AddOrRemoveSelected(aCircle);
|
||||||
|
@ -5271,6 +5271,45 @@ static Standard_Integer OCC27757 (Draw_Interpretor& /*theDI*/, Standard_Integer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
//function : OCC27818
|
||||||
|
//purpose : Creates three boxes and highlights one of them with own style
|
||||||
|
//========================================================================
|
||||||
|
static Standard_Integer OCC27818 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
|
||||||
|
{
|
||||||
|
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||||
|
if (aCtx.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(AIS_Shape) aBoxObjs[3];
|
||||||
|
for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20.0, 20.0, 20.0).Shape();
|
||||||
|
aBoxObjs[aBoxIdx] = new AIS_Shape (aBox);
|
||||||
|
gp_Trsf aTrsf;
|
||||||
|
aTrsf.SetTranslationPart (gp_Vec (30.0 * aBoxIdx, 30.0 * aBoxIdx, 0.0));
|
||||||
|
aBoxObjs[aBoxIdx]->SetLocalTransformation (aTrsf);
|
||||||
|
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));
|
||||||
|
|
||||||
|
for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
|
||||||
|
{
|
||||||
|
aCtx->Display (aBoxObjs[aBoxIdx], AIS_Shaded, 0, Standard_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
aCtx->UpdateCurrentViewer();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
//function : Commands_19
|
//function : Commands_19
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -5401,5 +5440,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add ("OCC27757",
|
theCommands.Add ("OCC27757",
|
||||||
"OCC27757: Creates a box that has a sphere as child object and displays it",
|
"OCC27757: Creates a box that has a sphere as child object and displays it",
|
||||||
__FILE__, OCC27757, group);
|
__FILE__, OCC27757, group);
|
||||||
|
theCommands.Add ("OCC27818",
|
||||||
|
"OCC27818: Creates three boxes and highlights one of them with own style",
|
||||||
|
__FILE__, OCC27818, group);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,25 +80,21 @@ Standard_Boolean SelectMgr_EntityOwner::IsHilighted(const Handle(PrsMgr_Presenta
|
|||||||
return PM->IsHighlighted(mySelectable,aMode);
|
return PM->IsHighlighted(mySelectable,aMode);
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
void SelectMgr_EntityOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
|
|
||||||
const Standard_Integer aMode)
|
|
||||||
{if(HasSelectable())
|
|
||||||
PM->Highlight(mySelectable,aMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectMgr_EntityOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
|
void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor aColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer aMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if( HasSelectable() ) {
|
if (HasSelectable())
|
||||||
if( IsAutoHilight() )
|
{
|
||||||
|
if (IsAutoHilight())
|
||||||
{
|
{
|
||||||
const Graphic3d_ZLayerId aLayerId = mySelectable->GlobalSelOwner().get() == this ?
|
const Graphic3d_ZLayerId aLayerId = mySelectable->GlobalSelOwner().get() == this ?
|
||||||
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
|
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
|
||||||
PM->Color(mySelectable,aColor,aMode, NULL, aLayerId);
|
thePM->Color (mySelectable, theStyle, theMode, NULL, aLayerId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mySelectable->HilightOwnerWithColor( PM, aColor, this );
|
mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,11 +111,6 @@ void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
|
|||||||
// nothing done on the selectable here...
|
// nothing done on the selectable here...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SelectMgr_EntityOwner::
|
|
||||||
Hilight(){}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : about Transformation
|
//function : about Transformation
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
#include <Standard_Integer.hxx>
|
#include <Standard_Integer.hxx>
|
||||||
#include <PrsMgr_PresentationManager3d.hxx>
|
#include <PrsMgr_PresentationManager3d.hxx>
|
||||||
#include <Quantity_NameOfColor.hxx>
|
#include <Quantity_NameOfColor.hxx>
|
||||||
|
#include <Graphic3d_HighlightStyle.hxx>
|
||||||
#include <Graphic3d_ZLayerId.hxx>
|
#include <Graphic3d_ZLayerId.hxx>
|
||||||
|
#include <SelectMgr_SelectableObject.hxx>
|
||||||
class Standard_NoSuchObject;
|
class Standard_NoSuchObject;
|
||||||
class SelectMgr_SelectableObject;
|
|
||||||
class PrsMgr_PresentationManager;
|
class PrsMgr_PresentationManager;
|
||||||
class TopLoc_Location;
|
class TopLoc_Location;
|
||||||
class V3d_Viewer;
|
class V3d_Viewer;
|
||||||
@ -69,23 +70,17 @@ public:
|
|||||||
//! second constructor above.
|
//! second constructor above.
|
||||||
Standard_EXPORT void Set (const Handle(SelectMgr_SelectableObject)& aSO);
|
Standard_EXPORT void Set (const Handle(SelectMgr_SelectableObject)& aSO);
|
||||||
|
|
||||||
//! Provides a framework to highlight any selectable
|
|
||||||
//! object found subsequently which can serve as an
|
|
||||||
//! owner of a sensitive primitive.
|
|
||||||
Standard_EXPORT virtual void Hilight();
|
|
||||||
|
|
||||||
//! Returns true if the presentation manager aPM
|
//! Returns true if the presentation manager aPM
|
||||||
//! highlights selections corresponding to the selection mode aMode.
|
//! 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;
|
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const;
|
||||||
|
|
||||||
//! Highlights the owner of a detected selectable object in
|
//! Highlights selectable object's presentation with mode theMode in presentation manager
|
||||||
//! the presentation manager aPM. This object could be
|
//! with given highlight style. Also a check for auto-highlight is performed - if
|
||||||
//! the owner of a sensitive primitive.
|
//! selectable object manages highlighting on its own, execution will be passed to
|
||||||
//! The display mode for the highlight is aMode; this has
|
//! SelectMgr_SelectableObject::HilightOwnerWithColor method
|
||||||
//! the default value of 0, that is, wireframe mode.
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode = 0);
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, const Quantity_NameOfColor aColor, const Standard_Integer aMode = 0);
|
|
||||||
|
|
||||||
//! Removes highlighting from the owner of a detected
|
//! Removes highlighting from the owner of a detected
|
||||||
//! selectable object in the presentation manager aPM.
|
//! selectable object in the presentation manager aPM.
|
||||||
@ -136,6 +131,12 @@ public:
|
|||||||
const Handle(PrsMgr_PresentationManager3d)& theManager,
|
const Handle(PrsMgr_PresentationManager3d)& theManager,
|
||||||
const Standard_Integer theDispMode);
|
const Standard_Integer theDispMode);
|
||||||
|
|
||||||
|
//! Returns true if pointer to selectable object of this owner is equal to the given one
|
||||||
|
Standard_Boolean IsSameSelectable (const Handle(SelectMgr_SelectableObject)& theOther) const
|
||||||
|
{
|
||||||
|
return mySelectable == theOther.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
|
DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
|
||||||
|
|
||||||
|
@ -318,10 +318,9 @@ void SelectMgr_SelectableObject::ClearSelected ()
|
|||||||
//function : HilightOwnerWithColor
|
//function : HilightOwnerWithColor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_SelectableObject::HilightOwnerWithColor
|
void SelectMgr_SelectableObject::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)&,
|
||||||
( const Handle(PrsMgr_PresentationManager3d)&,
|
const Handle(Graphic3d_HighlightStyle)&,
|
||||||
const Quantity_NameOfColor,
|
const Handle(SelectMgr_EntityOwner)&)
|
||||||
const Handle(SelectMgr_EntityOwner)&)
|
|
||||||
{
|
{
|
||||||
Standard_NotImplemented::Raise ("SelectMgr_SelectableObject::HilightOwnerWithColor");
|
Standard_NotImplemented::Raise ("SelectMgr_SelectableObject::HilightOwnerWithColor");
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,9 @@ public:
|
|||||||
|
|
||||||
//! Method which hilight an owner belonging to
|
//! Method which hilight an owner belonging to
|
||||||
//! this selectable object ( for fast presentation draw )
|
//! this selectable object ( for fast presentation draw )
|
||||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner);
|
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||||
|
|
||||||
//! If returns True, the old mechanism for highlighting
|
//! If returns True, the old mechanism for highlighting
|
||||||
//! selected objects is used (HilightSelected Method may be empty).
|
//! selected objects is used (HilightSelected Method may be empty).
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
#ifndef SelectMgr_SequenceOfOwner_HeaderFile
|
#ifndef SelectMgr_SequenceOfOwner_HeaderFile
|
||||||
#define SelectMgr_SequenceOfOwner_HeaderFile
|
#define SelectMgr_SequenceOfOwner_HeaderFile
|
||||||
|
|
||||||
#include <SelectMgr_EntityOwner.hxx>
|
|
||||||
#include <NCollection_Sequence.hxx>
|
#include <NCollection_Sequence.hxx>
|
||||||
|
|
||||||
|
class SelectMgr_EntityOwner;
|
||||||
|
|
||||||
typedef NCollection_Sequence<Handle(SelectMgr_EntityOwner)> SelectMgr_SequenceOfOwner;
|
typedef NCollection_Sequence<Handle(SelectMgr_EntityOwner)> SelectMgr_SequenceOfOwner;
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,71 +75,18 @@ IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Hilight/Unhilight Methods...
|
//function : HilightWithColor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void StdSelect_BRepOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
|
void StdSelect_BRepOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Standard_Integer aMode)
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
|
Standard_Integer M = (theMode < 0) ? myCurMode : theMode;
|
||||||
Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
|
|
||||||
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
|
||||||
if (myFromDecomposition)
|
|
||||||
{
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate new presentable shape
|
|
||||||
if (myPrsSh.IsNull())
|
|
||||||
{
|
|
||||||
myPrsSh = new StdSelect_Shape (myShape, aDrawer);
|
|
||||||
}
|
|
||||||
if (!aSel.IsNull())
|
|
||||||
{
|
|
||||||
myPrsSh->SetZLayer (aSel->ZLayer());
|
|
||||||
myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
|
|
||||||
}
|
|
||||||
|
|
||||||
// highlight and set layer
|
|
||||||
PM->Highlight (myPrsSh, M);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(myPrsSh.IsNull())
|
|
||||||
PM->Highlight(aSel,M);
|
|
||||||
else
|
|
||||||
PM->Highlight(myPrsSh,M);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void StdSelect_BRepOwner::Hilight()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
|
|
||||||
const Quantity_NameOfColor aCol,
|
|
||||||
const Standard_Integer aMode)
|
|
||||||
{
|
|
||||||
Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
|
|
||||||
Graphic3d_ZLayerId aHiLayer = this == Selectable()->GlobalSelOwner().get() ?
|
Graphic3d_ZLayerId aHiLayer = this == Selectable()->GlobalSelOwner().get() ?
|
||||||
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
|
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
|
||||||
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
Handle(SelectMgr_SelectableObject) aSel = Selectable();
|
||||||
|
|
||||||
if (myFromDecomposition)
|
if (myFromDecomposition)
|
||||||
{
|
{
|
||||||
// do the update flag check
|
// do the update flag check
|
||||||
@ -181,17 +128,17 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// highlight with color and set layer
|
// highlight with color and set layer
|
||||||
PM->Color (myPrsSh, aCol, M, aSel, aHiLayer);
|
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!myPrsSh.IsNull())
|
if (!myPrsSh.IsNull())
|
||||||
{
|
{
|
||||||
PM->Color (myPrsSh, aCol, M, aSel, aHiLayer);
|
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PM->Color (aSel, aCol, M, NULL, aHiLayer);
|
thePM->Color (aSel, theStyle, M, NULL, aHiLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,13 +107,9 @@ public:
|
|||||||
//! aMode is highlighted in the presentation manager aPM.
|
//! 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 Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual void Hilight() Standard_OVERRIDE;
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
//! Returns the selection mode aMode defining the type
|
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||||
//! of shape highlighted in the presentation manager aPM.
|
|
||||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, const Quantity_NameOfColor aCol, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Removes highlighting from the type of shape
|
//! Removes highlighting from the type of shape
|
||||||
//! identified the selection mode aMode in the presentation manager aPM.
|
//! identified the selection mode aMode in the presentation manager aPM.
|
||||||
|
@ -735,47 +735,6 @@ static int VDir (Draw_Interpretor& theDI,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
//function : VSelPrecision
|
|
||||||
//purpose : To set the selection tolerance value
|
|
||||||
//Draw arg : Selection tolerance value (real value determining the width and
|
|
||||||
// height of selecting frustum bases). Without arguments the function
|
|
||||||
// just prints current tolerance.
|
|
||||||
//==============================================================================
|
|
||||||
static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
|
||||||
{
|
|
||||||
if( argc > 2 )
|
|
||||||
{
|
|
||||||
di << "Wrong parameters! Must be: " << argv[0] << " [-unset] [tolerance]\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
|
||||||
if( aContext.IsNull() )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if( argc == 1 )
|
|
||||||
{
|
|
||||||
Standard_Real aPixelTolerance = aContext->PixelTolerance();
|
|
||||||
di << "Pixel tolerance : " << aPixelTolerance << "\n";
|
|
||||||
}
|
|
||||||
else if (argc == 2)
|
|
||||||
{
|
|
||||||
TCollection_AsciiString anArg = TCollection_AsciiString (argv[1]);
|
|
||||||
anArg.LowerCase();
|
|
||||||
if (anArg == "-unset")
|
|
||||||
{
|
|
||||||
aContext->SetPixelTolerance (-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aContext->SetPixelTolerance (anArg.IntegerValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Auxiliary enumeration
|
//! Auxiliary enumeration
|
||||||
enum ViewerTest_StereoPair
|
enum ViewerTest_StereoPair
|
||||||
{
|
{
|
||||||
@ -2918,32 +2877,33 @@ static int VDisplayAll (Draw_Interpretor& ,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Auxiliary method to find presentation
|
//! Auxiliary method to check if presentation exists
|
||||||
inline Handle(PrsMgr_Presentation) findPresentation (const Handle(AIS_InteractiveContext)& theCtx,
|
inline Standard_Integer checkMode (const Handle(AIS_InteractiveContext)& theCtx,
|
||||||
const Handle(AIS_InteractiveObject)& theIO,
|
const Handle(AIS_InteractiveObject)& theIO,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (theIO.IsNull())
|
if (theIO.IsNull() || theCtx.IsNull())
|
||||||
{
|
{
|
||||||
return Handle(PrsMgr_Presentation)();
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theMode != -1)
|
if (theMode != -1)
|
||||||
{
|
{
|
||||||
if (theCtx->MainPrsMgr()->HasPresentation (theIO, theMode))
|
if (theCtx->MainPrsMgr()->HasPresentation (theIO, theMode))
|
||||||
{
|
{
|
||||||
return theCtx->MainPrsMgr()->Presentation (theIO, theMode);
|
return theMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (theCtx->MainPrsMgr()->HasPresentation (theIO, theIO->DisplayMode()))
|
else if (theCtx->MainPrsMgr()->HasPresentation (theIO, theIO->DisplayMode()))
|
||||||
{
|
{
|
||||||
return theCtx->MainPrsMgr()->Presentation (theIO, theIO->DisplayMode());
|
return theIO->DisplayMode();
|
||||||
}
|
}
|
||||||
else if (theCtx->MainPrsMgr()->HasPresentation (theIO, theCtx->DisplayMode()))
|
else if (theCtx->MainPrsMgr()->HasPresentation (theIO, theCtx->DisplayMode()))
|
||||||
{
|
{
|
||||||
return theCtx->MainPrsMgr()->Presentation (theIO, theCtx->DisplayMode());
|
return theCtx->DisplayMode();
|
||||||
}
|
}
|
||||||
return Handle(PrsMgr_Presentation)();
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ViewerTest_BndAction
|
enum ViewerTest_BndAction
|
||||||
@ -2954,28 +2914,36 @@ enum ViewerTest_BndAction
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Auxiliary method to print bounding box of presentation
|
//! Auxiliary method to print bounding box of presentation
|
||||||
inline void bndPresentation (Draw_Interpretor& theDI,
|
inline void bndPresentation (Draw_Interpretor& theDI,
|
||||||
const Handle(PrsMgr_Presentation)& thePrs,
|
const Handle(PrsMgr_PresentationManager)& theMgr,
|
||||||
const TCollection_AsciiString& theName,
|
const Handle(AIS_InteractiveObject)& theObj,
|
||||||
const ViewerTest_BndAction theAction)
|
const Standard_Integer theDispMode,
|
||||||
|
const TCollection_AsciiString& theName,
|
||||||
|
const ViewerTest_BndAction theAction,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle)
|
||||||
{
|
{
|
||||||
switch (theAction)
|
switch (theAction)
|
||||||
{
|
{
|
||||||
case BndAction_Hide:
|
case BndAction_Hide:
|
||||||
{
|
{
|
||||||
thePrs->Presentation()->GraphicUnHighlight();
|
theMgr->Unhighlight (theObj, theDispMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BndAction_Show:
|
case BndAction_Show:
|
||||||
{
|
{
|
||||||
Handle(Graphic3d_Structure) aPrs (thePrs->Presentation());
|
theMgr->Color (theObj, theStyle, theDispMode);
|
||||||
aPrs->CStructure()->HighlightColor = Quantity_NOC_GRAY99;
|
|
||||||
aPrs->CStructure()->HighlightWithBndBox (aPrs, Standard_True);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BndAction_Print:
|
case BndAction_Print:
|
||||||
{
|
{
|
||||||
Bnd_Box aBox = thePrs->Presentation()->MinMaxValues();
|
Bnd_Box aBox;
|
||||||
|
for (PrsMgr_Presentations::Iterator aPrsIter (theObj->Presentations()); aPrsIter.More(); aPrsIter.Next())
|
||||||
|
{
|
||||||
|
if (aPrsIter.Value().Mode() != theDispMode)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aBox = aPrsIter.Value().Presentation()->Presentation()->MinMaxValues();
|
||||||
|
}
|
||||||
gp_Pnt aMin = aBox.CornerMin();
|
gp_Pnt aMin = aBox.CornerMin();
|
||||||
gp_Pnt aMax = aBox.CornerMax();
|
gp_Pnt aMax = aBox.CornerMax();
|
||||||
theDI << theName << "\n"
|
theDI << theName << "\n"
|
||||||
@ -3005,6 +2973,8 @@ int VBounding (Draw_Interpretor& theDI,
|
|||||||
ViewerTest_BndAction anAction = BndAction_Show;
|
ViewerTest_BndAction anAction = BndAction_Show;
|
||||||
Standard_Integer aMode = -1;
|
Standard_Integer aMode = -1;
|
||||||
|
|
||||||
|
Handle(Graphic3d_HighlightStyle) aStyle;
|
||||||
|
|
||||||
Standard_Integer anArgIter = 1;
|
Standard_Integer anArgIter = 1;
|
||||||
for (; anArgIter < theArgNb; ++anArgIter)
|
for (; anArgIter < theArgNb; ++anArgIter)
|
||||||
{
|
{
|
||||||
@ -3037,6 +3007,10 @@ int VBounding (Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (anAction == BndAction_Show)
|
||||||
|
aStyle = new Graphic3d_HighlightStyle (Aspect_TOHM_BOUNDBOX, Quantity_NOC_GRAY99, 0.0);
|
||||||
|
|
||||||
|
Standard_Integer aHighlightedMode = -1;
|
||||||
if (anArgIter < theArgNb)
|
if (anArgIter < theArgNb)
|
||||||
{
|
{
|
||||||
// has a list of names
|
// has a list of names
|
||||||
@ -3050,13 +3024,13 @@ int VBounding (Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
|
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
|
||||||
Handle(PrsMgr_Presentation) aPrs = findPresentation (aCtx, anIO, aMode);
|
aHighlightedMode = checkMode (aCtx, anIO, aMode);
|
||||||
if (aPrs.IsNull())
|
if (aHighlightedMode == -1)
|
||||||
{
|
{
|
||||||
std::cout << "Error: presentation " << aName << " does not exist\n";
|
std::cout << "Error: object " << aName << " has no presentation with mode " << aMode << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
bndPresentation (theDI, aPrs, aName, anAction);
|
bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode, aName, anAction, aStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aCtx->NbSelected() > 0)
|
else if (aCtx->NbSelected() > 0)
|
||||||
@ -3065,10 +3039,11 @@ int VBounding (Draw_Interpretor& theDI,
|
|||||||
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) anIO = aCtx->SelectedInteractive();
|
Handle(AIS_InteractiveObject) anIO = aCtx->SelectedInteractive();
|
||||||
Handle(PrsMgr_Presentation) aPrs = findPresentation (aCtx, anIO, aMode);
|
aHighlightedMode = checkMode (aCtx, anIO, aMode);
|
||||||
if (!aPrs.IsNull())
|
if (aHighlightedMode != -1)
|
||||||
{
|
{
|
||||||
bndPresentation (theDI, aPrs, GetMapOfAIS().IsBound1 (anIO) ? GetMapOfAIS().Find1 (anIO) : "", anAction);
|
bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode,
|
||||||
|
GetMapOfAIS().IsBound1 (anIO) ? GetMapOfAIS().Find1 (anIO) : "", anAction, aStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3079,10 +3054,10 @@ int VBounding (Draw_Interpretor& theDI,
|
|||||||
anIter.More(); anIter.Next())
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
|
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
|
||||||
Handle(PrsMgr_Presentation) aPrs = findPresentation (aCtx, anIO, aMode);
|
aHighlightedMode = checkMode (aCtx, anIO, aMode);
|
||||||
if (!aPrs.IsNull())
|
if (aHighlightedMode != -1)
|
||||||
{
|
{
|
||||||
bndPresentation (theDI, aPrs, anIter.Key2(), anAction);
|
bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode, anIter.Key2(), anAction, aStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5540,51 +5515,6 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
//function : VAutoActivateSelection
|
|
||||||
//purpose : Activates or deactivates auto computation of selection
|
|
||||||
//==============================================================================
|
|
||||||
static int VAutoActivateSelection (Draw_Interpretor& theDi,
|
|
||||||
Standard_Integer theArgNb,
|
|
||||||
const char** theArgVec)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (theArgNb > 2)
|
|
||||||
{
|
|
||||||
std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
|
|
||||||
if (aCtx.IsNull())
|
|
||||||
{
|
|
||||||
ViewerTest::ViewerInit();
|
|
||||||
aCtx = ViewerTest::GetAISContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theArgNb == 1)
|
|
||||||
{
|
|
||||||
TCollection_AsciiString aSelActivationString;
|
|
||||||
if (aCtx->GetAutoActivateSelection())
|
|
||||||
{
|
|
||||||
aSelActivationString.Copy ("ON");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aSelActivationString.Copy ("OFF");
|
|
||||||
}
|
|
||||||
|
|
||||||
theDi << "Auto activation of selection is: " << aSelActivationString << "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Standard_Boolean toActivate = Draw::Atoi (theArgVec[1]) != 0;
|
|
||||||
aCtx->SetAutoActivateSelection (toActivate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : ViewerTest::Commands
|
//function : ViewerTest::Commands
|
||||||
//purpose : Add all the viewer command in the Draw_Interpretor
|
//purpose : Add all the viewer command in the Draw_Interpretor
|
||||||
@ -5828,12 +5758,6 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
"vsensera : erase active entities",
|
"vsensera : erase active entities",
|
||||||
__FILE__,VClearSensi,group);
|
__FILE__,VClearSensi,group);
|
||||||
|
|
||||||
theCommands.Add("vselprecision",
|
|
||||||
"vselprecision [-unset] [tolerance_value]"
|
|
||||||
"\n\t\t Manages selection precision or prints current value if no parameter is passed."
|
|
||||||
"\n\t\t -unset - restores default selection tolerance behavior, based on individual entity tolerance",
|
|
||||||
__FILE__,VSelPrecision,group);
|
|
||||||
|
|
||||||
theCommands.Add("vperf",
|
theCommands.Add("vperf",
|
||||||
"vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)"
|
"vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)"
|
||||||
"\n\t\t: Tests the animation of an object along a predefined trajectory.",
|
"\n\t\t: Tests the animation of an object along a predefined trajectory.",
|
||||||
@ -5944,12 +5868,6 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: -local - open local context before selection computation",
|
"\n\t\t: -local - open local context before selection computation",
|
||||||
__FILE__, VLoadSelection, group);
|
__FILE__, VLoadSelection, group);
|
||||||
|
|
||||||
theCommands.Add ("vautoactivatesel",
|
|
||||||
"vautoactivatesel [0|1] : manage or display the option to automatically"
|
|
||||||
"\n\t\t: activate selection for newly displayed objects"
|
|
||||||
"\n\t\t: [0|1] - turn off | on auto activation of selection",
|
|
||||||
__FILE__, VAutoActivateSelection, group);
|
|
||||||
|
|
||||||
theCommands.Add("vbsdf", "vbsdf [name] [options]"
|
theCommands.Add("vbsdf", "vbsdf [name] [options]"
|
||||||
"\nAdjusts parameters of material BSDF:"
|
"\nAdjusts parameters of material BSDF:"
|
||||||
"\n -help : Shows this message"
|
"\n -help : Shows this message"
|
||||||
|
@ -95,7 +95,7 @@ void ViewerTest_CmdParser::Parse (Standard_Integer theArgsNb, const char** theAr
|
|||||||
|
|
||||||
for (Standard_Integer anIter = 1; anIter < theArgsNb; ++anIter)
|
for (Standard_Integer anIter = 1; anIter < theArgsNb; ++anIter)
|
||||||
{
|
{
|
||||||
if (theArgVec[anIter][0] == '-')
|
if (theArgVec[anIter][0] == '-' && !std::isdigit (theArgVec[anIter][1]))
|
||||||
{
|
{
|
||||||
std::string anOptionName (&theArgVec[anIter][1]);
|
std::string anOptionName (&theArgVec[anIter][1]);
|
||||||
std::transform (anOptionName.begin(), anOptionName.end(), anOptionName.begin(), ::tolower);
|
std::transform (anOptionName.begin(), anOptionName.end(), anOptionName.begin(), ::tolower);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Adds option to available option list. Several names may be provided if separated with '|'.
|
//! Adds option to available option list. Several names may be provided if separated with '|'.
|
||||||
void AddOption (const std::string& theOptionNames, const std::string& theOptionDescription);
|
void AddOption (const std::string& theOptionNames, const std::string& theOptionDescription = "");
|
||||||
|
|
||||||
//! Prints help message based on provided command and options descriptions.
|
//! Prints help message based on provided command and options descriptions.
|
||||||
void Help();
|
void Help();
|
||||||
|
@ -9025,6 +9025,133 @@ static int VManipulator (Draw_Interpretor& theDi,
|
|||||||
return 0;
|
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 :
|
||||||
|
//===============================================================================================
|
||||||
|
static int VSelectionProperties (Draw_Interpretor& theDi,
|
||||||
|
Standard_Integer theArgsNb,
|
||||||
|
const char** theArgVec)
|
||||||
|
{
|
||||||
|
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||||
|
if (aCtx.IsNull())
|
||||||
|
{
|
||||||
|
std::cerr << "No active viewer!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewerTest_CmdParser aCmd;
|
||||||
|
|
||||||
|
aCmd.AddOption ("autoActivate");
|
||||||
|
aCmd.AddOption ("pixTol");
|
||||||
|
|
||||||
|
aCmd.AddOption ("selColor");
|
||||||
|
aCmd.AddOption ("hiColor");
|
||||||
|
aCmd.AddOption ("selTransp");
|
||||||
|
aCmd.AddOption ("hiTransp");
|
||||||
|
|
||||||
|
aCmd.AddOption ("print");
|
||||||
|
|
||||||
|
aCmd.Parse (theArgsNb, theArgVec);
|
||||||
|
|
||||||
|
if (aCmd.HasOption ("help"))
|
||||||
|
{
|
||||||
|
theDi.PrintHelp (theArgVec[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aCmd.HasOption ("autoActivate", 1, Standard_False))
|
||||||
|
{
|
||||||
|
aCtx->SetAutoActivateSelection (aCmd.ArgBool ("autoActivate"));
|
||||||
|
}
|
||||||
|
if (aCmd.HasOption ("pixTol", 1, Standard_False))
|
||||||
|
{
|
||||||
|
aCtx->SetPixelTolerance (aCmd.ArgInt ("pixTol"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(Graphic3d_HighlightStyle)& aHiStyle = aCtx->ChangeHighlightStyle();
|
||||||
|
Handle(Graphic3d_HighlightStyle)& aSelStyle = aCtx->ChangeSelectionStyle();
|
||||||
|
Standard_Boolean toRedraw = Standard_False;
|
||||||
|
if (aCmd.HasOption ("selColor"))
|
||||||
|
{
|
||||||
|
Quantity_Color aNewColor;
|
||||||
|
if (!parseColor (aCmd, "selColor", aNewColor))
|
||||||
|
return 1;
|
||||||
|
aSelStyle->SetColor (aNewColor);
|
||||||
|
toRedraw = Standard_True;
|
||||||
|
}
|
||||||
|
if (aCmd.HasOption ("hiColor"))
|
||||||
|
{
|
||||||
|
Quantity_Color aNewColor;
|
||||||
|
if (!parseColor (aCmd, "hiColor", aNewColor))
|
||||||
|
return 1;
|
||||||
|
aHiStyle->SetColor (aNewColor);
|
||||||
|
}
|
||||||
|
if (aCmd.HasOption ("selTransp"))
|
||||||
|
{
|
||||||
|
aSelStyle->SetTransparency (aCmd.ArgFloat ("selTransp"));
|
||||||
|
toRedraw = Standard_True;
|
||||||
|
}
|
||||||
|
if (aCmd.HasOption ("hiTransp"))
|
||||||
|
{
|
||||||
|
aHiStyle->SetTransparency (aCmd.ArgFloat ("hiTransp"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aCmd.HasOption ("print") || theArgsNb == 1)
|
||||||
|
{
|
||||||
|
theDi << "Auto-activation : " << (aCtx->GetAutoActivateSelection() ? "On" : "Off") << "\n";
|
||||||
|
theDi << "Selection pixel tolerance : " << aCtx->MainSelector()->PixelTolerance() << "\n";
|
||||||
|
theDi << "Selection color : " << Quantity_Color::StringName (aCtx->SelectionStyle()->Color().Name()) << "\n";
|
||||||
|
theDi << "Dynamic highlight color : " << Quantity_Color::StringName (aCtx->HighlightStyle()->Color().Name()) << "\n";
|
||||||
|
theDi << "Selection transparency : " << aCtx->SelectionStyle()->Transparency() << "\n";
|
||||||
|
theDi << "Dynamic highlight transparency : " << aCtx->HighlightStyle()->Transparency() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aCtx->NbSelected() != 0 && toRedraw)
|
||||||
|
{
|
||||||
|
aCtx->HilightSelected (Standard_True);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ViewerCommands
|
//function : ViewerCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -9583,6 +9710,18 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
"\n '-zoomable {0|1}' - set zoom persistence",
|
"\n '-zoomable {0|1}' - set zoom persistence",
|
||||||
__FILE__, VManipulator, group);
|
__FILE__, VManipulator, group);
|
||||||
|
|
||||||
|
theCommands.Add("vselprops",
|
||||||
|
"\n vselprops [options]"
|
||||||
|
"\n Customizes selection and dynamic highlight parameters for the whole interactive context:"
|
||||||
|
"\n -autoActivate {0|1} : disables|enables default computation and activation of global selection mode"
|
||||||
|
"\n -pixTol value : sets up pixel tolerance"
|
||||||
|
"\n -selColor {name|r g b} : sets selection color"
|
||||||
|
"\n -hiColor {name|r g b} : sets dynamic highlight color"
|
||||||
|
"\n -selTransp value : sets transparency coefficient for selection"
|
||||||
|
"\n -hiTransp value : sets transparency coefficient for dynamic highlight"
|
||||||
|
"\n -print : prints current state of all mentioned parameters",
|
||||||
|
__FILE__, VSelectionProperties, group);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
theCommands.Add("vprogressive",
|
theCommands.Add("vprogressive",
|
||||||
"vprogressive",
|
"vprogressive",
|
||||||
|
@ -21,7 +21,7 @@ stepread [locate_data_file OCC23012-Sample_9.stp] b *
|
|||||||
vdisplay a_1 b_1
|
vdisplay a_1 b_1
|
||||||
vsetdispmode a_1 1
|
vsetdispmode a_1 1
|
||||||
vsetdispmode b_1 1
|
vsetdispmode b_1 1
|
||||||
vselprecision 0
|
vselprops -pixtol 0
|
||||||
|
|
||||||
set ColorBefore [vreadpixel ${x1} ${y1} rgb]
|
set ColorBefore [vreadpixel ${x1} ${y1} rgb]
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ vaxo
|
|||||||
vcaps -vbo 0
|
vcaps -vbo 0
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vdefaults absDefl=1.0
|
vdefaults absDefl=1.0
|
||||||
vautoactivatesel 0
|
vselprops -autoactivate 0
|
||||||
set aMemInit [meminfo h]
|
set aMemInit [meminfo h]
|
||||||
|
|
||||||
set aNb 1000
|
set aNb 1000
|
||||||
|
@ -19,5 +19,5 @@ vmoveto 58 324
|
|||||||
checkcolor 58 324 0 1 1
|
checkcolor 58 324 0 1 1
|
||||||
|
|
||||||
# to print tolerance in case of failure:
|
# to print tolerance in case of failure:
|
||||||
puts [vselprecision]
|
puts [vselprops -print]
|
||||||
vdump $imagedir/${casename}
|
vdump $imagedir/${casename}
|
||||||
|
@ -40,7 +40,7 @@ checkcolor ${x_on_edge} ${y_on_edge} 1 1 0
|
|||||||
|
|
||||||
vmoveto 0 0
|
vmoveto 0 0
|
||||||
# increase selection precision
|
# increase selection precision
|
||||||
vselprecision 8
|
vselprops -pixtol 8
|
||||||
|
|
||||||
# check precise selection of the edge
|
# check precise selection of the edge
|
||||||
vmoveto ${x_sel_precise} ${y_sel_precise}
|
vmoveto ${x_sel_precise} ${y_sel_precise}
|
||||||
@ -52,7 +52,7 @@ checkcolor ${x_on_edge} ${y_on_edge} 0 1 1
|
|||||||
|
|
||||||
# check that after precision reset selection works as usual
|
# check that after precision reset selection works as usual
|
||||||
vmoveto 0 0
|
vmoveto 0 0
|
||||||
vselprecision -1
|
vselprops -pixtol -1
|
||||||
vmoveto ${x_sel_precise} ${y_sel_precise}
|
vmoveto ${x_sel_precise} ${y_sel_precise}
|
||||||
checkcolor ${x_on_edge} ${y_on_edge} 0 1 1
|
checkcolor ${x_on_edge} ${y_on_edge} 0 1 1
|
||||||
vmoveto 0 0
|
vmoveto 0 0
|
||||||
@ -63,7 +63,7 @@ checkcolor ${x_on_edge} ${y_on_edge} 1 1 0
|
|||||||
# sensitive entities
|
# sensitive entities
|
||||||
vmoveto 0 0
|
vmoveto 0 0
|
||||||
vselmode b 1 1
|
vselmode b 1 1
|
||||||
vselprecision -1
|
vselprops -pixtol -1
|
||||||
|
|
||||||
vmoveto ${x_notol} ${y_notol}
|
vmoveto ${x_notol} ${y_notol}
|
||||||
# check that vertex is highlighted and edge is not
|
# check that vertex is highlighted and edge is not
|
||||||
@ -71,7 +71,7 @@ checkcolor ${x_on_edge} ${y_on_edge} 1 1 0
|
|||||||
checkcolor ${x_on_vert} ${y_on_vert} 0 1 1
|
checkcolor ${x_on_vert} ${y_on_vert} 0 1 1
|
||||||
|
|
||||||
vmoveto 0 0
|
vmoveto 0 0
|
||||||
vselprecision 8
|
vselprops -pixtol 8
|
||||||
vmoveto ${x_tol} ${y_tol}
|
vmoveto ${x_tol} ${y_tol}
|
||||||
# check that vertex is highlighted and edge is not
|
# check that vertex is highlighted and edge is not
|
||||||
checkcolor ${x_on_edge} ${y_on_edge} 1 1 0
|
checkcolor ${x_on_edge} ${y_on_edge} 1 1 0
|
||||||
|
44
tests/v3d/materials/bug27818_1
Normal file
44
tests/v3d/materials/bug27818_1
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27818_1"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
####################################################################################
|
||||||
|
# Visualization - provide an interface to define highlight presentation properties:
|
||||||
|
# test change of highlight properties for whole interactive context
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
pload VISUALIZATION MODELING
|
||||||
|
|
||||||
|
box b 10 20 30
|
||||||
|
pcone p 15 0 40
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vclear
|
||||||
|
|
||||||
|
vdisplay b -dispMode 1 -highMode 1
|
||||||
|
vdisplay p -dispMode 1 -highMode 1
|
||||||
|
vsetcolor b RED
|
||||||
|
vsetcolor p GREEN
|
||||||
|
|
||||||
|
vviewparams -scale 17.8 -proj 0.9 -0.3 0.3
|
||||||
|
vviewparams -up -0.2 0.4 0.9 -at 1.99 2.4 20.9
|
||||||
|
vviewparams -eye 56.1 -17.7 39.4
|
||||||
|
|
||||||
|
vselprops -hiTransp 0.1 -hiColor PALEGREEN2
|
||||||
|
|
||||||
|
vmoveto 167 263
|
||||||
|
set aPixelColor [vreadpixel 167 263 name rgba]
|
||||||
|
set aTransp [lindex [split $aPixelColor { }] 1]
|
||||||
|
if { $aTransp == 1 } {
|
||||||
|
puts "Error: highlighting of a cone is not transparent!"
|
||||||
|
}
|
||||||
|
|
||||||
|
vmoveto 285 212
|
||||||
|
set aPixelColor [vreadpixel 285 212 name rgba]
|
||||||
|
set aTransp [lindex [split $aPixelColor { }] 1]
|
||||||
|
if { $aTransp == 1 } {
|
||||||
|
puts "Error: highlighting of a box is not transparent!"
|
||||||
|
}
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}.png
|
36
tests/v3d/materials/bug27818_2
Normal file
36
tests/v3d/materials/bug27818_2
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27818_2"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
####################################################################################
|
||||||
|
# Visualization - provide an interface to define highlight presentation properties:
|
||||||
|
# test change of highlight and selection properties for particular objects
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
pload QAcommands VISUALIZATION
|
||||||
|
|
||||||
|
vinit
|
||||||
|
OCC27818
|
||||||
|
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vmoveto 200 200
|
||||||
|
set aPixelColor [vreadpixel 200 200 name rgba]
|
||||||
|
set aColor [lindex [split $aPixelColor { }] 0]
|
||||||
|
set aTrsp [lindex [split $aPixelColor { }] 1]
|
||||||
|
if {$aColor != "CHOCOLATE3" && abs($aTrsp - 1.0) < 0.1} {
|
||||||
|
puts "ERROR: dynamic highlight of 2nd box is displayed with wrong color!"
|
||||||
|
}
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_dyn.png
|
||||||
|
|
||||||
|
vselect 50 200 1
|
||||||
|
vselect 200 200 1
|
||||||
|
vselect 350 200 1
|
||||||
|
|
||||||
|
if {[vreadpixel 350 200 name rgba] != "RED3 1" || [vreadpixel 350 200 1 rgba] == [vreadpixel 200 200 1 rgba]} {
|
||||||
|
puts "ERROR: selection highlight of 3rd box is displayed with wrong color!"
|
||||||
|
}
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_sel.png
|
Loading…
x
Reference in New Issue
Block a user