#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
-#include <gp_Pnt2d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_Texture2Dmanual.hxx>
#include <Precision.hxx>
-#include <Prs3d.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_ShadingAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
-#include <Standard_ErrorHandler.hxx>
+#include <PrsMgr_PresentationManager.hxx>
#include <StdSelect_BRepSelectionTool.hxx>
#include <StdPrs_ShadedShape.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
{
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);
}
//=======================================================================
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
{
- setColor (myDrawer, theColor);
- myDrawer->SetColor (theColor);
- hasOwnColor = Standard_True;
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
}
}
+ AIS_Shape::SetColor (theColor);
}
//=======================================================================
void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
{
- setWidth (myDrawer, theLineWidth);
- myOwnWidth = theLineWidth;
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
}
}
+ AIS_Shape::SetWidth (theLineWidth);
+}
+
+//=======================================================================
+//function : UnsetWidth
+//purpose :
+//=======================================================================
+void AIS_ColoredShape::UnsetWidth()
+{
+ SetWidth (1.0f);
}
//=======================================================================
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
{
- setTransparency (myDrawer, theValue);
- myDrawer->SetTransparency ((Standard_ShortReal )theValue);
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
}
}
+ AIS_Shape::SetTransparency (theValue);
}
//=======================================================================
//=======================================================================
void AIS_ColoredShape::UnsetTransparency()
{
- myDrawer->SetTransparency (0.0f);
- if (myDrawer->HasOwnShadingAspect())
- {
- myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
- if (!HasColor()
- && !HasMaterial()
- && !myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
- {
- myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
- }
- }
-
- for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
- {
- const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
- if (aDrawer->HasOwnShadingAspect())
- {
- aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
- }
- }
- SynchronizeAspects();
+ SetTransparency (0.0f);
}
//=======================================================================
void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
{
- setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
- //myOwnMaterial = theMaterial;
- hasOwnMaterial = Standard_True;
- LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
- //if (aDrawer->HasOwnMaterial()) continue;
+ if (aDrawer->HasOwnMaterial())
+ {
+ continue;
+ }
+
if (aDrawer->HasOwnShadingAspect())
{
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
}
}
+ AIS_Shape::SetMaterial (theMaterial);
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
-void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
- const Handle(Prs3d_Presentation)& thePrs,
- const Standard_Integer theMode)
+void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const Standard_Integer theMode)
{
if (myshape.IsNull())
{
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
- Prs3d::GetDeflection (myshape, myDrawer);
+ StdPrs_ToolTriangulatedShape::GetDeflection (myshape, myDrawer);
break;
}
case AIS_Shaded:
}
const TopAbs_ShapeEnum aTypOfSel = AIS_Shape::SelectionType (theMode);
- const Standard_Real aDeflection = Prs3d::GetDeflection (myshape, myDrawer);
- const Standard_Real aDeviationAngle = myDrawer->HLRAngle();
+ const Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (myshape, myDrawer);
+ const Standard_Real aDeviationAngle = myDrawer->DeviationAngle();
const Standard_Integer aPriority = StdSelect_BRepSelectionTool::GetStandardPriority (myshape, aTypOfSel);
if (myDrawer->IsAutoTriangulation()
&& !BRepTools::Triangulation (myshape, Precision::Infinite()))
Handle(SelectMgr_SelectableObject) aThis (this);
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
- anOwner->Set (aThis);
+ const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
+ anOwner->SetSelectable (aThis);
}
-
- StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
}
//=======================================================================
const DataMapOfDrawerCompd& theDrawerClosedFaces,
const Standard_Integer theMode)
{
- Handle(Graphic3d_Group) anOpenGroup, aClosedGroup;
+ Handle(Graphic3d_Group) anOpenGroup, aClosedGroup, anEdgesGroup;
for (size_t aShType = 0; aShType <= (size_t )TopAbs_SHAPE; ++aShType)
{
const Standard_Boolean isClosed = aShType == TopAbs_SHAPE;
{
if (aShadedGroup.IsNull())
{
- aShadedGroup = Prs3d_Root::NewGroup (thePrs);
+ aShadedGroup = thePrs->NewGroup();
aShadedGroup->SetClosed (isClosed);
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
if (aDrawer->FaceBoundaryDraw())
{
- Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw);
- if (!aBndSegments.IsNull())
+ if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw, aDrawer->FaceBoundaryUpperContinuity()))
{
- if (aShadedGroup.IsNull())
+ if (anEdgesGroup.IsNull())
{
- aShadedGroup = Prs3d_Root::NewGroup (thePrs);
- aShadedGroup->SetClosed (isClosed);
+ anEdgesGroup = thePrs->NewGroup();
}
- Handle(Graphic3d_AspectLine3d) aBoundaryAspect = aDrawer->FaceBoundaryAspect()->Aspect();
- aShadedGroup->SetPrimitivesAspect (aBoundaryAspect);
- aShadedGroup->AddPrimitiveArray (aBndSegments);
+ anEdgesGroup->SetPrimitivesAspect (aDrawer->FaceBoundaryAspect()->Aspect());
+ anEdgesGroup->AddPrimitiveArray (aBndSegments);
}
}
}