Removed excess mechanism for invalidating presentations AIS_InteractiveObject::myRecomputeEveryPrs.
PrsMgr_PresentableObject::Update() has been deprecated and replaced by PrsMgr_PresentableObject::UpdatePresentations()
recomputing only explicitly invalidated presentations.
aGroup->AddPrimitiveArray (aLines);
~~~~
+@subsection upgrade_740_prsupdate Presentation invalidation
+
+Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
+
+1. *AIS_InteractiveObject::SetToUpdate()*, marking existing presentation for update.
+ This is main invalidation API, which is expected to be followed by *AIS_InteractiveContext::Update()* call.
+2. *AIS_InteractiveObject::myToRecomputeModes* + *myRecomputeEveryPrs*.
+ This is auxiliary invalidation API, used internally by AIS_InteractiveContext::SetColor()/UnsetColor() and similar modification methods.
+
+The latter one has been removed to avoid confusion and unexpected behavior.
+In addition, two methods *AIS_InteractiveObject::Update()* have been deprecated in favor of new *AIS_InteractiveObject::UpdatePresentations()* recomputing only invalidated presentations.
+
+Custom presentations implementing interface methods *AIS_InteractiveObject::SetColor()* and others should be revised to use *AIS_InteractiveObject::SetToUpdate()*
+or updating presentation without recomputation (see *AIS_InteractiveObject::SynchronizeAspects()* and *AIS_InteractiveObject::replaceAspects()*).
+
@subsection upgrade_740_interiorstyles Interior styles
* *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
myListOfShape.Append(aShape);
myAlgo.Nullify();
myPolyAlgo.Nullify();
- Update(); // protected method used to specify that the presentation are not up to date
+ SetToUpdate();
+ UpdatePresentations();
}
void ISession2D_Shape::Remove (const TopoDS_Shape& theShape)
myProjector= aProjector;
myAlgo.Nullify();
myPolyAlgo.Nullify();
- Update(); // protected method used to specify that the presentation are not up to date
+ SetToUpdate();
+ UpdatePresentations();
};
void ISession2D_Shape::SetNbIsos(Standard_Integer& aNbIsos)
-{
- myNbIsos= aNbIsos;
- myAlgo.Nullify();
-
- // declare the mode 100 to 110 as non valid
- for (int i=100;i<=110;i++)
- Update(i,Standard_False); // protected method used to specify that the presentation are not up to date
-
- // declare the mode 1100 to 1110 as non valid
- for (int i=1100;i<=1110;i++)
- Update(i,Standard_False); // protected method used to specify that the presentation are not up to date
-
+{
+ myNbIsos= aNbIsos;
+ myAlgo.Nullify();
+ SetToUpdate();
+ UpdatePresentations();
};
void ISession2D_Shape::BuildAlgo()
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
-
+ SynchronizeAspects();
}
//=======================================================================
//=======================================================================
void AIS_Axis::SetWidth(const Standard_Real aValue)
{
-
if(aValue<0.0) return;
if(aValue==0) UnsetWidth();
DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue);
DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue);
DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue);
+ SynchronizeAspects();
}
//=======================================================================
void AIS_Axis::UnsetColor()
{
-
myDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
-
- hasOwnColor=Standard_False;
+ hasOwnColor = Standard_False;
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
+ SynchronizeAspects();
}
//=======================================================================
//function : UnsetWidth
void AIS_Axis::UnsetWidth()
{
- myOwnWidth = 0.0;
+ myOwnWidth = 0.0f;
myDrawer->LineAspect()->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.);
+ SynchronizeAspects();
}
-
AIS_InteractiveObject::SetColor (theColor);
myDrawer->ShadingAspect()->SetColor (theColor);
myDrawer->LineAspect()->SetColor (theColor);
+ SynchronizeAspects();
}
//=======================================================================
myDrawer->ShadingAspect()->SetColor (THE_DEFAULT_COLOR);
myDrawer->LineAspect()->SetColor (THE_DEFAULT_COLOR);
+ SynchronizeAspects();
}
//=======================================================================
{
myDrawer->ShadingAspect()->SetTransparency (0.0f);
myDrawer->SetTransparency (0.0f);
+ SynchronizeAspects();
}
//=======================================================================
}
+//=======================================================================
+//function : replaceWithNewLineAspect
+//purpose :
+//=======================================================================
+void AIS_Circle::replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
+{
+ if (!myDrawer->HasLink())
+ {
+ myDrawer->SetLineAspect (theAspect);
+ return;
+ }
+
+ const Handle(Graphic3d_AspectLine3d) anAspectOld = myDrawer->LineAspect()->Aspect();
+ const Handle(Graphic3d_AspectLine3d) anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->LineAspect()->Aspect();
+ if (anAspectNew != anAspectOld)
+ {
+ myDrawer->SetLineAspect (theAspect);
+ Graphic3d_MapOfAspectsToAspects aReplaceMap;
+ aReplaceMap.Bind (anAspectOld, anAspectNew);
+ replaceAspects (aReplaceMap);
+ }
+}
+
//=======================================================================
//function : SetColor
//purpose :
hasOwnColor=Standard_True;
myDrawer->SetColor (aCol);
- Standard_Real WW = HasWidth() ? myOwnWidth :
- myDrawer->HasLink() ?
- AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) :
- 1.;
-
- if (!myDrawer->HasOwnLineAspect ())
- myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
+ if (!myDrawer->HasOwnLineAspect())
+ {
+ Standard_Real WW = HasWidth() ? myOwnWidth :
+ myDrawer->HasLink() ?
+ AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) :
+ 1.;
+ replaceWithNewLineAspect (new Prs3d_LineAspect (aCol, Aspect_TOL_SOLID, WW));
+ }
else
+ {
myDrawer->LineAspect()->SetColor(aCol);
+ SynchronizeAspects();
+ }
}
-
-
//=======================================================================
//function : SetWidth
//purpose :
//=======================================================================
void AIS_Circle::SetWidth(const Standard_Real aValue)
{
- myOwnWidth=aValue;
+ myOwnWidth = (Standard_ShortReal )aValue;
- if (!myDrawer->HasOwnLineAspect ()) {
+ if (!myDrawer->HasOwnLineAspect())
+ {
Quantity_Color CC = Quantity_NOC_YELLOW;
if( HasColor() ) CC = myDrawer->Color();
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
- myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
- } else
+ replaceWithNewLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
+ }
+ else
+ {
myDrawer->LineAspect()->SetWidth(aValue);
+ SynchronizeAspects();
+ }
}
{
hasOwnColor = Standard_False;
- Handle(Prs3d_LineAspect) NullAsp;
-
- if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
- else{
+ if (!HasWidth())
+ {
+ replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
Quantity_Color CC = Quantity_NOC_YELLOW;;
if( HasColor() ) CC = myDrawer->Color();
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->LineAspect()->SetColor(CC);
myDrawer->SetColor (CC);
+ SynchronizeAspects();
}
}
//=======================================================================
void AIS_Circle::UnsetWidth()
{
- Handle(Prs3d_LineAspect) NullAsp;
-
- if (!HasColor()) myDrawer->SetLineAspect(NullAsp);
- else{
- Standard_Real WW = myDrawer->HasLink() ? AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.;
+ if (!HasColor())
+ {
+ replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
+ Standard_ShortReal WW = myDrawer->HasLink() ? (Standard_ShortReal )AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.0f;
myDrawer->LineAspect()->SetWidth(WW);
myOwnWidth = WW;
}
Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection);
+ //! Replace aspects of already computed groups with the new value.
+ void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
+
private:
Handle(Geom_Circle) myComponent;
{
aDrawer = new AIS_ColoredDrawer (myDrawer);
myShapeColors.Bind (theShape, aDrawer);
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
+ SetToUpdate();
}
return aDrawer;
}
return;
}
myShapeColors.Clear();
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
+ SetToUpdate();
}
//=======================================================================
return;
}
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
+ SetToUpdate();
if (theToUnregister)
{
myShapeColors.UnBind (theShape);
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
setColor (aDrawer, theColor);
aDrawer->SetOwnColor (theColor);
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
}
//=======================================================================
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
setTransparency (aDrawer, theTransparency);
aDrawer->SetOwnTransparency (theTransparency);
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
}
//=======================================================================
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
setWidth (aDrawer, theLineWidth);
aDrawer->SetOwnWidth (theLineWidth);
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
}
//=======================================================================
return;
}
- theIObj->Update (theAllModes);
+ theIObj->SetToUpdate();
+ theIObj->UpdatePresentations (theAllModes);
if (!theToUpdateViewer)
{
return;
return;
}
- TColStd_ListOfInteger aPrsModes;
- theIObj->ToBeUpdated (aPrsModes);
- for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
- {
- theIObj->Update (aPrsModesIt.Value(), Standard_False);
- }
-
+ theIObj->UpdatePresentations();
mgrSelector->Update(theIObj);
if (theUpdateViewer)
}
}
-//=======================================================================
-//function : redisplayPrsRecModes
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
- {
- for (TColStd_ListIteratorOfListOfInteger aModes (theIObj->ListOfRecomputeModes()); aModes.More(); aModes.Next())
- {
- theIObj->Update (aModes.Value(), Standard_False);
- }
- theIObj->UpdateSelection();
- theIObj->SetRecomputeOk();
- }
-
- if (theToUpdateViewer)
- {
- UpdateCurrentViewer();
- }
-}
-
-//=======================================================================
-//function : redisplayPrsModes
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
- {
- TColStd_ListOfInteger aModes;
- theIObj->ToBeUpdated (aModes);
- for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
- {
- theIObj->Update (aModeIter.Value(), Standard_False);
- }
- theIObj->SetRecomputeOk();
- }
-
- if (theToUpdateViewer)
- {
- UpdateCurrentViewer();
- }
-}
-
//=======================================================================
//function : SetColor
//purpose :
setContextToObject (theIObj);
theIObj->SetColor (theColor);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnDeviationCoefficient (theCoefficient);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnHLRDeviationCoefficient (theCoefficient);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnDeviationAngle (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetAngleAndDeviation (theAngle);
-
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
{
- Update (theIObj, theToUpdateViewer);
+ UpdateCurrentViewer();
}
}
}
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetHLRAngleAndDeviation (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnHLRDeviationAngle (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->UnsetColor();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
setContextToObject (theIObj);
theIObj->SetWidth (theWidth);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
{
if (myLastinMain->IsAutoHilight())
myLastinMain);
}
}
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->UnsetWidth();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
setContextToObject (theIObj);
theIObj->SetMaterial (theMaterial);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
return;
}
theIObj->UnsetMaterial();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->SetTransparency (theValue);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->UnsetTransparency();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Standard_EXPORT void InitAttributes();
Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
-
- //! UNKNOWN
- Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer);
-
- //! UNKNOWN
- Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer);
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
AIS_InteractiveObject::AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
: SelectMgr_SelectableObject (aTypeOfPresentation3d),
myCTXPtr (NULL),
- myOwnWidth (0.0),
+ myOwnWidth (0.0f),
myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
myInfiniteState (Standard_False),
hasOwnColor (Standard_False),
- hasOwnMaterial (Standard_False),
- myRecomputeEveryPrs (Standard_True)
+ hasOwnMaterial (Standard_False)
{
SetCurrentFacingModel();
}
Standard_Integer AIS_InteractiveObject::Signature() const
{return -1;}
-//=======================================================================
-//function : RecomputeEveryPrs
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
-{return myRecomputeEveryPrs;}
-
//=======================================================================
//function :
//purpose :
//=======================================================================
void AIS_InteractiveObject::SetWidth(const Standard_Real aValue)
{
- myOwnWidth = aValue;
+ myOwnWidth = (Standard_ShortReal )aValue;
}
//=======================================================================
//=======================================================================
void AIS_InteractiveObject::UnsetWidth()
{
- myOwnWidth = 0.;
+ myOwnWidth = 0.0f;
}
//=======================================================================
hasOwnColor = Standard_False;
hasOwnMaterial = Standard_False;
- myOwnWidth = 0.0;
+ myOwnWidth = 0.0f;
myDrawer->SetTransparency (0.0f);
}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-void AIS_InteractiveObject::MustRecomputePrs(const Standard_Integer ) const
-{}
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-const TColStd_ListOfInteger& AIS_InteractiveObject::ListOfRecomputeModes() const
-{return myToRecomputeModes;}
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-void AIS_InteractiveObject::SetRecomputeOk()
-{myToRecomputeModes.Clear();}
-
-
//=======================================================================
//function : AcceptDisplayMode
//purpose :
virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
//! Returns true if the Interactive Object has width.
- Standard_Boolean HasWidth() const { return myOwnWidth != 0.0; }
+ Standard_Boolean HasWidth() const { return myOwnWidth != 0.0f; }
//! Returns the width setting of the Interactive Object.
Standard_Real Width() const { return myOwnWidth; }
//! and then modify them directly followed by SynchronizeAspects() call.
Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
-private:
-
- Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;
-
- Standard_EXPORT void MustRecomputePrs (const Standard_Integer aMode) const;
-
- Standard_EXPORT const TColStd_ListOfInteger& ListOfRecomputeModes() const;
-
- Standard_EXPORT void SetRecomputeOk();
-
-protected:
-
//! The TypeOfPresention3d means that the interactive object
//! may have a presentation dependant of the view of Display.
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
-private:
+protected:
AIS_InteractiveContext* myCTXPtr;
Handle(Standard_Transient) myOwner;
-
-protected:
-
- TColStd_ListOfInteger myToRecomputeModes;
- Standard_Real myOwnWidth;
+ Standard_ShortReal myOwnWidth;
Aspect_TypeOfFacingModel myCurrentFacingModel;
Standard_Boolean myInfiniteState;
Standard_Boolean hasOwnColor;
Standard_Boolean hasOwnMaterial;
- Standard_Boolean myRecomputeEveryPrs;
};
IMPLEMENT_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject)
-//==================================================================
-// function: FindLimits
-// purpose:
-//==================================================================
-//unused
-/*#ifdef OCCT_DEBUG
-static void FindLimits(const Adaptor3d_Curve& aCurve,
- const Standard_Real aLimit,
- gp_Pnt& P1,
- gp_Pnt& P2)
-{
- Standard_Real First = aCurve.FirstParameter();
- Standard_Real Last = aCurve.LastParameter();
- Standard_Boolean firstInf = Precision::IsNegativeInfinite(First);
- Standard_Boolean lastInf = Precision::IsPositiveInfinite(Last);
- if (firstInf || lastInf) {
- Standard_Real delta = 1;
- if (firstInf && lastInf) {
- do {
- delta *= 2;
- First = - delta;
- Last = delta;
- aCurve.D0(First,P1);
- aCurve.D0(Last,P2);
- } while (P1.Distance(P2) < aLimit);
- }
- else if (firstInf) {
- aCurve.D0(Last,P2);
- do {
- delta *= 2;
- First = Last - delta;
- aCurve.D0(First,P1);
- } while (P1.Distance(P2) < aLimit);
- }
- else if (lastInf) {
- aCurve.D0(First,P1);
- do {
- delta *= 2;
- Last = First + delta;
- aCurve.D0(Last,P2);
- } while (P1.Distance(P2) < aLimit);
- }
- }
-}
-#endif
-*/
//=======================================================================
//function : AIS_Line
//purpose :
void AIS_Line::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
{
-// throw Standard_NotImplemented("AIS_Line::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
- PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
+ PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
}
//=======================================================================
}
}
+//=======================================================================
+//function : replaceWithNewLineAspect
+//purpose :
+//=======================================================================
+void AIS_Line::replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
+{
+ if (!myDrawer->HasLink())
+ {
+ myDrawer->SetLineAspect (theAspect);
+ return;
+ }
+
+ const Handle(Graphic3d_Aspects)& anAspectOld = myDrawer->LineAspect()->Aspect();
+ const Handle(Graphic3d_Aspects)& anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->LineAspect()->Aspect();
+ if (anAspectNew != anAspectOld)
+ {
+ myDrawer->SetLineAspect (theAspect);
+ Graphic3d_MapOfAspectsToAspects aReplaceMap;
+ aReplaceMap.Bind (anAspectOld, anAspectNew);
+ replaceAspects (aReplaceMap);
+ }
+}
+
//=======================================================================
//function : SetColor
//purpose :
myDrawer->HasLink() ?
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
- if (!myDrawer->HasOwnLineAspect ())
- myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
+ if (!myDrawer->HasOwnLineAspect())
+ {
+ replaceWithNewLineAspect (new Prs3d_LineAspect (aCol, Aspect_TOL_SOLID, WW));
+ }
else
- myDrawer->LineAspect()->SetColor(aCol);
+ {
+ myDrawer->LineAspect()->SetColor (aCol);
+ SynchronizeAspects();
+ }
}
{
hasOwnColor = Standard_False;
- Handle(Prs3d_LineAspect) NullAsp;
-
- if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
- else{
+ if (!HasWidth())
+ {
+ replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
Quantity_Color CC = Quantity_NOC_YELLOW;
if( HasColor() ) CC = myDrawer->Color();
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
myDrawer->LineAspect()->SetColor(CC);
myDrawer->SetColor (CC);
- }
+ SynchronizeAspects();
+ }
}
//=======================================================================
//=======================================================================
void AIS_Line::SetWidth(const Standard_Real aValue)
{
- myOwnWidth=aValue;
+ myOwnWidth = (Standard_ShortReal )aValue;
- if (!myDrawer->HasOwnLineAspect ()) {
+ if (!myDrawer->HasOwnLineAspect())
+ {
Quantity_Color CC = Quantity_NOC_YELLOW;
if( HasColor() ) CC = myDrawer->Color();
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
- myDrawer->SetLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
- } else
- myDrawer->LineAspect()->SetWidth(aValue);
+ replaceWithNewLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
+ }
+ else
+ {
+ myDrawer->LineAspect()->SetWidth (aValue);
+ SynchronizeAspects();
+ }
}
//=======================================================================
void AIS_Line::UnsetWidth()
{
- Handle(Prs3d_LineAspect) NullAsp;
-
- if (!HasColor()) myDrawer->SetLineAspect(NullAsp);
- else{
- Standard_Real WW = myDrawer->HasLink() ?
- AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
- myDrawer->LineAspect()->SetWidth(WW);
+ if (!HasColor())
+ {
+ replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
+ Standard_ShortReal WW = myDrawer->HasLink() ? (Standard_ShortReal )AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.0f;
+ myDrawer->LineAspect()->SetWidth (WW);
myOwnWidth = WW;
+ SynchronizeAspects();
}
}
Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
+ //! Replace aspects of already computed groups with the new value.
+ void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
+
private:
Handle(Geom_Line) myComponent;
myHasOwnSize = Standard_True;
- Update();
+ SetToUpdate();
+ UpdatePresentations();
UpdateSelection();
}
}
myHasOwnSize = Standard_False;
- Update();
+ SetToUpdate();
+ UpdatePresentations();
UpdateSelection();
}
myDrawer->SetColor (aCol);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
+ SynchronizeAspects();
}
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
//! Allows you to provide settings for the color aColor.
- Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
+ Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
void SetXLabel (const TCollection_AsciiString& theLabel) { myXLabel = theLabel; }
|| theMode == -99;
}
+//=======================================================================
+//function : replaceWithNewPointAspect
+//purpose :
+//=======================================================================
+void AIS_Point::replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
+{
+ if (!myDrawer->HasLink())
+ {
+ myDrawer->SetPointAspect (theAspect);
+ return;
+ }
+
+ const Handle(Graphic3d_AspectMarker3d) anAspectOld = myDrawer->PointAspect()->Aspect();
+ const Handle(Graphic3d_AspectMarker3d) anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->PointAspect()->Aspect();
+ if (anAspectNew != anAspectOld)
+ {
+ myDrawer->SetPointAspect (theAspect);
+ Graphic3d_MapOfAspectsToAspects aReplaceMap;
+ aReplaceMap.Bind (anAspectOld, anAspectNew);
+ replaceAspects (aReplaceMap);
+ }
+}
+
//=======================================================================
//function : UpdatePointValues
//purpose :
void AIS_Point::UpdatePointValues()
{
-
- if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM)
+ if (!hasOwnColor
+ && myOwnWidth == 0.0f
+ && !myHasTOM)
{
- myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
+ replaceWithNewPointAspect (Handle(Prs3d_PointAspect)());
return;
}
+
Quantity_Color aCol (Quantity_NOC_YELLOW);
Aspect_TypeOfMarker aTOM = Aspect_TOM_PLUS;
Standard_Real aScale = 1.0;
}
if(hasOwnColor) aCol = myDrawer->Color();
- if(myOwnWidth!=0.0) aScale = myOwnWidth;
+ if(myOwnWidth != 0.0f) aScale = myOwnWidth;
if(myHasTOM) aTOM = myTOM;
-
-
- if(myDrawer->HasOwnPointAspect()){
- // CLE
- // const Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
+
+ if(myDrawer->HasOwnPointAspect())
+ {
Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
- // ENDCLE
PA->SetColor(aCol);
PA->SetTypeOfMarker(aTOM);
PA->SetScale(aScale);
+ SynchronizeAspects();
}
else
- myDrawer->SetPointAspect(new Prs3d_PointAspect(aTOM,aCol,aScale));
+ {
+ replaceWithNewPointAspect (new Prs3d_PointAspect (aTOM, aCol, aScale));
+ }
}
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
//! Allows you to provide settings for the Color.
- Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
+ Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
//! Allows you to remove color settings.
- Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
+ Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Allows you to provide settings for a marker. These include
//! - type of marker,
Standard_EXPORT void UpdatePointValues();
+ //! Replace aspects of already computed groups with the new value.
+ void replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
+
private:
Handle(Geom_Point) myComponent;
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
-static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
-{
- TColStd_ListIteratorOfListOfInteger It(LL);
- for(;It.More();It.Next()){
- if(It.Value()==aMode)
- return Standard_True;}
- return Standard_False;
-}
-
// Auxiliary macros
#define replaceAspectWithDef(theMap, theAspect) \
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
{
void AIS_Shape::UnsetColor()
{
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!HasColor())
{
return;
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
{
- myOwnWidth = theLineWidth;
+ myOwnWidth = (Standard_ShortReal )theLineWidth;
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!setWidth (myDrawer, theLineWidth)
|| !myDrawer->HasLink())
{
void AIS_Shape::UnsetWidth()
{
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
- if (myOwnWidth == 0.0)
+ if (myOwnWidth == 0.0f)
{
return;
}
- myOwnWidth = 0.0;
+ myOwnWidth = 0.0f;
if (!HasColor())
{
Graphic3d_MapOfAspectsToAspects aReplaceMap;
setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
hasOwnMaterial = Standard_True;
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
{
void AIS_Shape::UnsetMaterial()
{
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!HasMaterial())
{
return;
setTransparency (myDrawer, theValue);
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
{
void AIS_Shape::UnsetTransparency()
{
- myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
- myToRecomputeModes.Clear();
-
myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
}
}
-//=======================================================================
-//function : LoadRecomputable
-//purpose :
-//=======================================================================
-
-void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
-{
- myRecomputeEveryPrs = Standard_False;
- if(!IsInList(myToRecomputeModes,TheMode))
- myToRecomputeModes.Append(TheMode);
-}
-
//=======================================================================
//function : BoundingBox
//purpose :
void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real aCoefficient )
{
myDrawer->SetDeviationCoefficient( aCoefficient );
- SetToUpdate(0) ; // WireFrame
- SetToUpdate(1) ; // Shadding
+ SetToUpdate();
}
//=======================================================================
//purpose :
//=======================================================================
-void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real anAngle )
+void AIS_Shape::SetOwnDeviationAngle (const Standard_Real theAngle)
{
-
- myDrawer->SetDeviationAngle(anAngle );
- SetToUpdate(0) ; // WireFrame
+ myDrawer->SetDeviationAngle (theAngle);
+ SetToUpdate (AIS_WireFrame);
}
//=======================================================================
//function : SetOwnDeviationAngle
SetOwnDeviationAngle(anAngle) ;
SetOwnDeviationCoefficient(OutDefl) ;
myInitAng = anAngle;
- SetToUpdate(0);
- SetToUpdate(1);
+ SetToUpdate();
}
//=======================================================================
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
- Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
-
//! Create own aspects (if they do not exist) and set color to them.
//! @return TRUE if new aspects have been created
Standard_EXPORT bool setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
hasOwnColor = Standard_True;
myDrawer->SetColor (theColor);
myDrawer->TextAspect()->SetColor (theColor);
+ SynchronizeAspects();
}
//=======================================================================
myDrawer->TextAspect()->Aspect()->SetColor (aTextColor);
myDrawer->TextAspect()->Aspect()->SetColorSubTitle (aSubColor);
myDrawer->SetTransparency (Standard_ShortReal(theValue));
+ SynchronizeAspects();
}
//=======================================================================
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
-
- myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
- myToRecomputeModes.Clear();
}
}
void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponent)
{
myComponent = theComponent;
- LoadRecomputable (AIS_WireFrame);
+ SetToUpdate();
}
//=======================================================================
setOwnDatumAspect();
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
- Update();
+ SetToUpdate();
+ UpdatePresentations();
UpdateSelection();
}
}
else
{
- Update();
+ SetToUpdate();
+ UpdatePresentations();
}
UpdateSelection();
}
}
}
-//=======================================================================
-//function : LoadRecomputable
-//purpose :
-//=======================================================================
-void AIS_Trihedron::LoadRecomputable (const Standard_Integer theMode)
-{
- myRecomputeEveryPrs = Standard_False;
- if (!myToRecomputeModes.Contains (theMode))
- {
- myToRecomputeModes.Append (theMode);
- }
-}
-
//=======================================================================
//function : SetColor
//purpose :
protected:
- Standard_EXPORT void LoadRecomputable (const Standard_Integer theMode);
-
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
const Handle(SelectBasics_EntityOwner)& theOwner) const;
}
//=======================================================================
-//function : Update
-//purpose :
+//function : ToBeUpdated
+//purpose :
//=======================================================================
-void PrsMgr_PresentableObject::Update (const Standard_Boolean AllModes) {
- Standard_Integer l = myPresentations.Length();
- Handle(PrsMgr_PresentationManager) PM;
- for (Standard_Integer i=1; i <= l; i++) {
- PM = myPresentations(i).Presentation()->PresentationManager();
- if(AllModes)
- PM->Update(this,myPresentations(i).Mode());
- else{
- if(PM->IsDisplayed(this,myPresentations(i).Mode()) ||
- PM->IsHighlighted(this,myPresentations(i).Mode())){
- PM->Update(this,myPresentations(i).Mode());
+Standard_Boolean PrsMgr_PresentableObject::ToBeUpdated (Standard_Boolean theToIncludeHidden) const
+{
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
+ {
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
+ if (aModedPrs.Presentation()->MustBeUpdated())
+ {
+ if (theToIncludeHidden)
+ {
+ return Standard_True;
+ }
+
+ Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs.Presentation()->PresentationManager();
+ if (aPrsMgr->IsDisplayed (this, aModedPrs.Mode())
+ || aPrsMgr->IsHighlighted(this, aModedPrs.Mode()))
+ {
+ return Standard_True;
}
- else
- SetToUpdate(myPresentations(i).Mode());
}
}
+ return Standard_False;
}
//=======================================================================
-//function : Update
-//purpose :
+//function : UpdatePresentations
+//purpose :
//=======================================================================
-void PrsMgr_PresentableObject::Update (const Standard_Integer aMode, const Standard_Boolean ClearOther) {
- Standard_Integer l = myPresentations.Length();
- for (Standard_Integer i=1; i <= l; i++) {
- if( myPresentations(i).Mode() == aMode){
- Handle(PrsMgr_PresentationManager) PM=
- myPresentations(i).Presentation()->PresentationManager();
-
- if(PM->IsDisplayed(this,aMode) ||
- PM->IsHighlighted(this,aMode)){
- PM->Update(this,aMode);
- myPresentations(i).Presentation()->SetUpdateStatus(Standard_False);
-
- }
- else
- SetToUpdate(myPresentations(i).Mode());
- }
-
- }
- if(ClearOther) {
- PrsMgr_Presentations save;
- save = myPresentations;
- myPresentations.Clear();
- for (Standard_Integer i=1; i <= l; i++) {
- if( save(i).Mode() == aMode) myPresentations.Append(save(i));
+Standard_Boolean PrsMgr_PresentableObject::UpdatePresentations (Standard_Boolean theToIncludeHidden)
+{
+ Standard_Boolean hasUpdates = Standard_False;
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
+ {
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
+ if (aModedPrs.Presentation()->MustBeUpdated())
+ {
+ Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs.Presentation()->PresentationManager();
+ if (theToIncludeHidden
+ || aPrsMgr->IsDisplayed (this, aModedPrs.Mode())
+ || aPrsMgr->IsHighlighted(this, aModedPrs.Mode()))
+ {
+ hasUpdates = Standard_True;
+ aPrsMgr->Update (this, aModedPrs.Mode());
+ }
}
}
-
+ return hasUpdates;
}
//=======================================================================
-//function : SetToUpdate
-//purpose :
+//function : Update
+//purpose :
//=======================================================================
-void PrsMgr_PresentableObject::SetToUpdate(const Standard_Integer aMode)
+void PrsMgr_PresentableObject::Update (Standard_Integer theMode, Standard_Boolean theToClearOther)
{
- for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
- if(myPresentations(IP).Mode()==aMode)
- myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True);
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More();)
+ {
+ if (aPrsIter.Value().Mode() == theMode)
+ {
+ Handle(PrsMgr_PresentationManager) aPrsMgr = aPrsIter.Value().Presentation()->PresentationManager();
+ if (aPrsMgr->IsDisplayed (this, theMode)
+ || aPrsMgr->IsHighlighted(this, theMode))
+ {
+ aPrsMgr->Update (this, theMode);
+ aPrsIter.Value().Presentation()->SetUpdateStatus (Standard_False);
+ }
+ else
+ {
+ SetToUpdate (aPrsIter.Value().Mode());
+ }
+ }
+ else if (theToClearOther)
+ {
+ myPresentations.Remove (aPrsIter);
+ continue;
+ }
+ aPrsIter.Next();
}
}
//=======================================================================
//function : SetToUpdate
-//purpose :
+//purpose :
//=======================================================================
-void PrsMgr_PresentableObject::SetToUpdate()
+void PrsMgr_PresentableObject::SetToUpdate (Standard_Integer theMode)
{
- for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
- myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True);
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
+ {
+ if (theMode == -1
+ || aPrsIter.Value().Mode() == theMode)
+ {
+ aPrsIter.ChangeValue().Presentation()->SetUpdateStatus(Standard_True);
+ }
}
}
//function : ToBeUpdated
//purpose : gets the list of modes to be updated
//=======================================================================
-void PrsMgr_PresentableObject::ToBeUpdated(TColStd_ListOfInteger& OutList) const
+void PrsMgr_PresentableObject::ToBeUpdated (TColStd_ListOfInteger& theOutList) const
{
- OutList.Clear();
- // on dimensionne les buckets a la taille de la seq.
+ theOutList.Clear();
TColStd_MapOfInteger MI(myPresentations.Length());
-
- for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
- const PrsMgr_ModedPresentation& MP = myPresentations(IP);
- if(MP.Presentation()->MustBeUpdated())
- if(!MI.Contains(MP.Mode())){
- OutList.Append(MP.Mode());
- MI.Add(MP.Mode());
- }
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
+ {
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
+ if (aModedPrs.Presentation()->MustBeUpdated()
+ && MI.Add (aModedPrs.Mode()))
+ {
+ theOutList.Append (aModedPrs.Mode());
+ }
}
}
void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType)
{
myTypeOfPresentation3d = theType;
- for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
+ const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value().Presentation();
aPrs->Presentation()->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant
? Graphic3d_TOS_COMPUTED
: Graphic3d_TOS_ALL);
myInvTransformation = myLocalTransformation->Trsf().Inverted();
}
- for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- myPresentations (aPrsIter).Presentation()->SetTransformation (myTransformation);
+ aPrsIter.ChangeValue().Presentation()->SetTransformation (myTransformation);
}
for (PrsMgr_ListOfPresentableObjectsIter aChildIter (myChildren); aChildIter.More(); aChildIter.Next())
//=======================================================================
void PrsMgr_PresentableObject::recomputeComputed() const
{
- for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
+ const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value().Presentation();
if (!aPrs3d.IsNull()
&& !aPrs3d->Presentation().IsNull())
{
void PrsMgr_PresentableObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
myTransformPersistence = theTrsfPers;
- for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
+ const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value().Presentation();
if (!aPrs3d.IsNull()
&& !aPrs3d->Presentation().IsNull())
{
}
myDrawer->SetZLayer (theLayerId);
- for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter);
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
if (aModedPrs.Presentation().IsNull()
|| aModedPrs.Presentation()->Presentation().IsNull())
{
// =======================================================================
void PrsMgr_PresentableObject::UpdateClipping()
{
- // affect generated structures
- for (Standard_Integer aPrsIt = 1; aPrsIt <= myPresentations.Length(); ++aPrsIt)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- // pass over presentation manager 3d mechanism right to the structures -
- // we do not interested in display mode collections.
- const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIt);
- if (aModedPrs.Presentation().IsNull()
- || aModedPrs.Presentation()->Presentation().IsNull())
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
+ if (!aModedPrs.Presentation().IsNull()
+ && !aModedPrs.Presentation()->Presentation().IsNull())
{
- continue;
+ aModedPrs.Presentation()->Presentation()->SetClipPlanes (myClipPlanes);
}
-
- aModedPrs.Presentation()->Presentation()->SetClipPlanes (myClipPlanes);
}
}
}
myIsMutable = theIsMutable;
- for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+ for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
- const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter);
- if (aModedPrs.Presentation().IsNull()
- || aModedPrs.Presentation()->Presentation().IsNull())
+ const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value();
+ if (!aModedPrs.Presentation().IsNull()
+ && !aModedPrs.Presentation()->Presentation().IsNull())
{
- continue;
+ aModedPrs.Presentation()->Presentation()->SetMutable (theIsMutable);
}
-
- aModedPrs.Presentation()->Presentation()->SetMutable (theIsMutable);
}
}
Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d aType);
- //! flags the Prs of mode <AMode> to be Updated.
- //! the Update will be done when needed.
- Standard_EXPORT void SetToUpdate (const Standard_Integer aMode);
-
+ //! Returns TRUE if any active presentation has invalidation flag.
+ //! @param theToIncludeHidden when TRUE, also checks hidden presentations
+ Standard_EXPORT Standard_Boolean ToBeUpdated (Standard_Boolean theToIncludeHidden = Standard_False) const;
+
+ //! Flags presentation to be updated; UpdatePresentations() will recompute these presentations.
+ //! @param theMode presentation (display mode) to invalidate, or -1 to invalidate them all
+ Standard_EXPORT void SetToUpdate (Standard_Integer theMode);
+
//! flags all the Presentations to be Updated.
- Standard_EXPORT void SetToUpdate();
-
+ void SetToUpdate() { SetToUpdate (-1); }
+
//! gives the list of modes which are flagged "to be updated".
+ Standard_DEPRECATED("This method is deprecated - UpdatePresentations() should be called instead")
Standard_EXPORT void ToBeUpdated (TColStd_ListOfInteger& ListOfMode) const;
//! Return the local transformation.
//! object before computation.
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation);
- //! recomputes all presentations of the object.
- Standard_EXPORT void Update (const Standard_Boolean AllModes = Standard_False);
-
+ //! Recomputes invalidated presentations of the object.
+ //! @param theToIncludeHidden if TRUE, then even hidden invalidated presentations will be updated
+ //! @return TRUE if some presentations were recomputed
+ Standard_EXPORT Standard_Boolean UpdatePresentations (Standard_Boolean theToIncludeHidden = Standard_False);
+
+ //! Recomputes all presentations of the object.
+ Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
+ void Update (Standard_Boolean theToIncludeHidden = Standard_False)
+ {
+ SetToUpdate();
+ UpdatePresentations (theToIncludeHidden);
+ }
+
//! Recomputes the presentation in the given mode.
- //! If ClearOther is true, other presentation will be cleared.
- Standard_EXPORT void Update (const Standard_Integer aMode, const Standard_Boolean ClearOther);
+ //! @param theMode presentation (display mode) to recompute
+ //! @param theToClearOther when TRUE, other presentations (display modes) will be removed
+ Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
+ Standard_EXPORT void Update (Standard_Integer theMode, Standard_Boolean theToClearOther);
//! High-level interface for controlling polygon offsets
Standard_EXPORT virtual void Fill (const Handle(PrsMgr_PresentationManager)& aPresentationManager, const Handle(PrsMgr_Presentation)& aPresentation, const Standard_Integer aMode);
}
// do the update flag check
- if (!myPrsSh.IsNull())
+ if (!myPrsSh.IsNull()
+ && myPrsSh->ToBeUpdated (true))
{
- TColStd_ListOfInteger aModesList;
- myPrsSh->ToBeUpdated (aModesList);
- if (!aModesList.IsEmpty())
- myPrsSh.Nullify();
+ myPrsSh.Nullify();
}
// generate new presentable shape
aShapeCur = aComp;
}
- Handle(AIS_ColoredDrawer) aDrawer = CustomAspects (aShapeCur);
+ Handle(AIS_ColoredDrawer) aDrawer = new AIS_ColoredDrawer (myDrawer);
+ myShapeColors.Bind (aShapeCur, aDrawer);
const XCAFPrs_Style& aStyle = aStyleGroupIter.Key();
aDrawer->SetHidden (!aStyle.IsVisible());