#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
#include <BRepTools_ShapeSet.hxx>
-#include <Geom_Transformation.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
-#include <Prs3d_Projector.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
-#include <StdPrs_BndBox.hxx>
+#include <Prs3d_BndBox.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
-#include <PrsMgr_ModedPresentation.hxx>
#include <Quantity_Color.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <StdSelect.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_BRepSelectionTool.hxx>
-#include <StdSelect_DisplayMode.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopExp.hxx>
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()) \
}
catch (Standard_Failure const& anException)
{
- Message::DefaultMessenger()->Send (TCollection_AsciiString()
- + "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
- + anException.GetMessageString() + ")", Message_Fail);
+ Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() wireframe presentation builder has failed (")
+ + anException.GetMessageString() + ")");
}
break;
}
}
catch (Standard_Failure const& anException)
{
- Message::DefaultMessenger()->Send (TCollection_AsciiString()
- + "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
- + anException.GetMessageString() + ")", Message_Fail);
+ Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() shaded presentation builder has failed (")
+ + anException.GetMessageString() + ")");
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
}
else
{
- StdPrs_BndBox::Add (aPrs, BoundingBox(), myDrawer);
+ Prs3d_BndBox::Add (aPrs, BoundingBox(), myDrawer);
}
}
}
//function : computeHlrPresentation
//purpose :
//=======================================================================
-void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
+void AIS_Shape::computeHlrPresentation (const Handle(Graphic3d_Camera)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer)
switch (theDrawer->TypeOfHLR())
{
case Prs3d_TOH_Algo:
- StdPrs_HLRShape::Add (thePrs, theShape, theDrawer, theProjector);
+ {
+ StdPrs_HLRShape aBuilder;
+ aBuilder.ComputeHLR (thePrs, theShape, theDrawer, theProjector);
break;
+ }
case Prs3d_TOH_PolyAlgo:
- default:
- StdPrs_HLRPolyShape::Add (thePrs, theShape, theDrawer, theProjector);
+ case Prs3d_TOH_NotSet:
+ {
+ StdPrs_HLRPolyShape aBuilder;
+ aBuilder.ComputeHLR (thePrs, theShape, theDrawer, theProjector);
break;
+ }
}
}
catch (Standard_Failure const& anException)
{
- Message::DefaultMessenger()->Send (TCollection_AsciiString()
- + "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
- + anException.GetMessageString() + ")", Message_Fail);
+ Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() HLR Algorithm has failed (")
+ + anException.GetMessageString() + ")");
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
}
}
// POP protection against crash in low layers
- Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
+ Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection(shape, myDrawer);
try
{
OCC_CATCH_SIGNALS
shape,
TypOfSel,
aDeflection,
- myDrawer->HLRAngle(),
+ myDrawer->DeviationAngle(),
myDrawer->IsAutoTriangulation());
}
catch (Standard_Failure const& anException)
{
- Message::DefaultMessenger()->Send (TCollection_AsciiString()
- + "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
- + anException.GetMessageString() + ")", Message_Fail);
+ Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::ComputeSelection(") + aMode + ") has failed ("
+ + anException.GetMessageString() + ")");
if (aMode == 0)
{
aSelection->Clear();
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;
const Standard_Boolean theToKeepColor,
const Standard_Boolean theToKeepTransp) const
{
- const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
+ const Quantity_Color aColor = theDrawer->ShadingAspect()->Color (myCurrentFacingModel);
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
theDrawer->SetupOwnShadingAspect();
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
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 :
}
if(myCompBB) {
- BRepBndLib::AddClose(myshape, myBB);
+ BRepBndLib::Add (myshape, myBB, false);
myCompBB = Standard_False;
}
return myBB;
return itSet;
}
-//=======================================================================
-//function : SetHLROwnDeviationCoefficient
-//purpose : resets myhasOwnHLRDeviationCoefficient to Standard_False and
-// returns Standard_True if it change
-//=======================================================================
-
-Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient ()
-{
- Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationCoefficient();
- if(itSet) myDrawer->SetHLRDeviationCoefficient();
- return itSet;
-
-}
-
//=======================================================================
//function : SetOwnDeviationAngle
//purpose : resets myhasOwnDeviationAngle to Standard_False and
}
-//=======================================================================
-//function : SetOwnHLRDeviationAngle
-//purpose : resets myhasOwnHLRDeviationAngle to Standard_False and
-// returns Standard_True if it change
-//=======================================================================
-
-Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
-{
- Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationAngle();
- if(itSet) myDrawer->SetHLRAngle();
- return itSet;
-
-}
-//***** SetOwn
//=======================================================================
//function : SetOwnDeviationCoefficient
//purpose :
void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real aCoefficient )
{
myDrawer->SetDeviationCoefficient( aCoefficient );
- SetToUpdate(0) ; // WireFrame
- SetToUpdate(1) ; // Shadding
-}
-
-//=======================================================================
-//function : SetOwnHLRDeviationCoefficient
-//purpose :
-//=======================================================================
-
-void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real aCoefficient )
-{
- myDrawer->SetHLRDeviationCoefficient( aCoefficient );
-
+ 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();
}
//=======================================================================
return myInitAng ==0. ? GetContext()->DeviationAngle(): myInitAng;
}
-
-//=======================================================================
-//function : SetHLRAngleAndDeviation
-//purpose :
-//=======================================================================
-
-void AIS_Shape::SetHLRAngleAndDeviation ( const Standard_Real anAngle )
-{
- Standard_Real OutAngl,OutDefl;
- HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
- SetOwnHLRDeviationAngle( OutAngl );
- SetOwnHLRDeviationCoefficient(OutDefl);
-
-}
-//=======================================================================
-//function : SetOwnHLRDeviationAngle
-//purpose :
-//=======================================================================
-
-void AIS_Shape::SetOwnHLRDeviationAngle ( const Standard_Real anAngle )
-{
- myDrawer->SetHLRAngle( anAngle );
-}
-
-//***** GetOwn
//=======================================================================
//function : OwnDeviationCoefficient
//purpose :
return myDrawer->HasOwnDeviationCoefficient() ;
}
-//=======================================================================
-//function : OwnHLRDeviationCoefficient
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoefficient,
- Standard_Real & aPreviousCoefficient ) const
-{
- aCoefficient = myDrawer->HLRDeviationCoefficient();
- aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient ();
- return myDrawer->HasOwnHLRDeviationCoefficient();
-
-}
-
//=======================================================================
//function : OwnDeviationAngle
//purpose :
}
//=======================================================================
-//function : OwnHLRDeviationAngle
+//function : DumpJson
//purpose :
//=======================================================================
-
-Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle,
- Standard_Real & aPreviousAngle ) const
+void AIS_Shape::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
- anAngle = myDrawer->HLRAngle();
- aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
- return myDrawer->HasOwnHLRDeviationAngle();
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject)
+
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myshape)
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBB)
+
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myInitAng)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCompBB)
}