// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <AIS_Shape.hxx>
#include <AIS_GraphicTool.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_Shape.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
-static Standard_Boolean myFirstCompute;
-
static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
{
TColStd_ListIteratorOfListOfInteger It(LL);
myInitAng(0.)
{
Set (shap);
- myFirstCompute = Standard_True;
- SetHilightMode(0);
- myDrawer->SetShadingAspectGlobal(Standard_False);
}
//=======================================================================
//=======================================================================
void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPrs,
- const Standard_Integer aMode)
+ const Standard_Integer theMode)
{
- aPrs->Clear();
if(myshape.IsNull()) return;
// wire,edge,vertex -> pas de HLR + priorite display superieure
if (IsInfinite())
{
- aPrs->SetInfiniteState (Standard_True); //not taken in account duting FITALL
+ aPrs->SetInfiniteState (Standard_True); //not taken in account during FITALL
}
- switch (aMode)
+ switch (theMode)
{
case AIS_WireFrame:
{
+ StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
try
{
OCC_CATCH_SIGNALS
}
case AIS_Shaded:
{
- if (myDrawer->IsAutoTriangulation())
- {
- Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
- Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
- Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
- if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
- || (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
- {
- BRepTools::Clean (myshape);
- }
- }
-
+ StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
if ((Standard_Integer) myshape.ShapeType() > 4)
{
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
else
{
- myDrawer->SetShadingAspectGlobal (Standard_False);
if (IsInfinite())
{
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
return;
}
- static TopAbs_ShapeEnum TypOfSel;
- TypOfSel = AIS_Shape::SelectionType(aMode);
+ TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
TopoDS_Shape shape = myshape;
// POP protection against crash in low layers
StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
}
-Quantity_NameOfColor AIS_Shape::Color() const {
-Quantity_Color aColor;
- Color(aColor);
- return aColor.Name();
-}
-
void AIS_Shape::Color( Quantity_Color& aColor ) const {
aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
}
return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
}
-//=======================================================================
-//function : SetColor
-//purpose :
-//=======================================================================
-
-void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
-{
- SetColor(Quantity_Color(aCol));
-}
-
//=======================================================================
//function : setColor
//purpose :
// override color
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
- theDrawer->SetShadingAspectGlobal (Standard_False);
theDrawer->LineAspect()->SetColor (theColor);
theDrawer->WireAspect()->SetColor (theColor);
theDrawer->PointAspect()->SetColor (theColor);
void AIS_Shape::SetColor (const Quantity_Color& theColor)
{
setColor (myDrawer, theColor);
- myOwnColor = theColor;
+ myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
// modify shading presentation without re-computation
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
-
- // Set aspects for presentation
- aPrs->SetPrimitivesAspect (anAreaAspect);
- aPrs->SetPrimitivesAspect (aLineAspect);
- aPrs->SetPrimitivesAspect (aPointAspect);
-
- // Go through all groups to change color for all primitives
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (IsTransparent())
{
Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
- mat.SetTransparency (aTransp);
+ mat.SetTransparency (Standard_ShortReal(aTransp));
}
myDrawer->ShadingAspect()->SetMaterial (mat ,myCurrentFacingModel);
}
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
-
- aPrs->SetPrimitivesAspect (anAreaAsp);
- aPrs->SetPrimitivesAspect (aLineAsp);
-
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
}
}
-//=======================================================================
-//function : SetMaterial
-//purpose :
-//=======================================================================
-
-void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
-{
- SetMaterial(Graphic3d_MaterialAspect(aMat));
-}
-
//=======================================================================
//function : SetMaterial
//purpose :
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
- aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
}
if (HasColor())
{
- myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
- myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
}
}
else
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
- aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
void AIS_Shape::SetTransparency (const Standard_Real theValue)
{
setTransparency (myDrawer, theValue);
- myTransparency = theValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )theValue);
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
- aPrs->SetPrimitivesAspect (anAreaAsp);
- aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
void AIS_Shape::UnsetTransparency()
{
- myTransparency = 0.0;
+ myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
return;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
- aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
- aPrs->ResetDisplayPriority();
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update