};
-
-/* virtual private */ void ISession2D_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode)
-{
-}
-/* virtual private */ void ISession2D_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation)
-{
-}
-
void ISession2D_Shape::BuildAlgo()
{
myAlgo = new HLRBRep_Algo();
myPolyAlgo->Update();
}
-/* virtual private */ void ISession2D_Shape::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
- const Handle(Graphic2d_GraphicObject)& aGrObj,
- const Standard_Integer aMode)
+void ISession2D_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
{
- Standard_Integer TheMode = aMode;
-
+
+ Standard_Integer aMode = theMode;
Standard_Boolean DrawHiddenLine= Standard_True;
- if (TheMode >= 1000)
+ thePresentation->Clear();
+ if (aMode >= 1000)
{
DrawHiddenLine = Standard_False;
- TheMode -= 1000;
+ aMode -= 1000;
}
Standard_Boolean UsePolyAlgo= Standard_True;
- if (TheMode >= 100)
+ if (aMode >= 100)
{
UsePolyAlgo = Standard_False;
- TheMode -= 100;
+ aMode -= 100;
}
TopoDS_Shape VCompound;
TopoDS_Shape Rg1LineVCompound;
TopoDS_Shape RgNLineVCompound;
TopoDS_Shape OutLineVCompound;
- TopoDS_Shape IsoLineVCompound; // only fro Exact algo
+ TopoDS_Shape IsoLineVCompound; // only for Exact algo
TopoDS_Shape HCompound;
TopoDS_Shape Rg1LineHCompound;
TopoDS_Shape RgNLineHCompound;
TopoDS_Shape OutLineHCompound;
- TopoDS_Shape IsoLineHCompound; // only fro Exact algo
+ TopoDS_Shape IsoLineHCompound; // only for Exact algo
if (UsePolyAlgo)
- {
- if (myPolyAlgo.IsNull()) BuildPolyAlgo();
- HLRBRep_PolyHLRToShape aPolyHLRToShape;
- aPolyHLRToShape.Update(myPolyAlgo);
+ {
+ if (myPolyAlgo.IsNull()) BuildPolyAlgo();
+ HLRBRep_PolyHLRToShape aPolyHLRToShape;
+ aPolyHLRToShape.Update(myPolyAlgo);
+
+ VCompound = aPolyHLRToShape.VCompound();
+ Rg1LineVCompound = aPolyHLRToShape.Rg1LineVCompound();
+ RgNLineVCompound = aPolyHLRToShape.RgNLineVCompound();
+ OutLineVCompound = aPolyHLRToShape.OutLineVCompound();
+ HCompound = aPolyHLRToShape.HCompound();
+ Rg1LineHCompound = aPolyHLRToShape.Rg1LineHCompound();
+ RgNLineHCompound = aPolyHLRToShape.RgNLineHCompound();
+ OutLineHCompound = aPolyHLRToShape.OutLineHCompound();
+ }
+ else
+ {
+ if (myAlgo.IsNull()) BuildAlgo();
+ HLRBRep_HLRToShape aHLRToShape(myAlgo);
+
+ VCompound = aHLRToShape.VCompound();
+ Rg1LineVCompound = aHLRToShape.Rg1LineVCompound();
+ RgNLineVCompound = aHLRToShape.RgNLineVCompound();
+ OutLineVCompound = aHLRToShape.OutLineVCompound();
+ IsoLineVCompound = aHLRToShape.IsoLineVCompound();
+ HCompound = aHLRToShape.HCompound();
+ Rg1LineHCompound = aHLRToShape.Rg1LineHCompound();
+ RgNLineHCompound = aHLRToShape.RgNLineHCompound();
+ OutLineHCompound = aHLRToShape.OutLineHCompound();
+ IsoLineHCompound = aHLRToShape.IsoLineHCompound();
+ }
- VCompound = aPolyHLRToShape.VCompound();
- Rg1LineVCompound = aPolyHLRToShape.Rg1LineVCompound();
- RgNLineVCompound = aPolyHLRToShape.RgNLineVCompound();
- OutLineVCompound = aPolyHLRToShape.OutLineVCompound();
- HCompound = aPolyHLRToShape.HCompound();
- Rg1LineHCompound = aPolyHLRToShape.Rg1LineHCompound();
- RgNLineHCompound = aPolyHLRToShape.RgNLineHCompound();
- OutLineHCompound = aPolyHLRToShape.OutLineHCompound();
- }
- else
- {
- if (myAlgo.IsNull()) BuildAlgo();
- HLRBRep_HLRToShape aHLRToShape(myAlgo);
+ if (UsePolyAlgo)
+ {
+ Handle(Prs3d_LineAspect) aLineAspectHighlighted = new Prs3d_LineAspect(Quantity_NOC_ALICEBLUE,
+ Aspect_TOL_DOTDASH,1);
+ Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect(Quantity_NOC_WHITE,
+ Aspect_TOL_SOLID,1);
- VCompound = aHLRToShape.VCompound();
- Rg1LineVCompound = aHLRToShape.Rg1LineVCompound();
- RgNLineVCompound = aHLRToShape.RgNLineVCompound();
- OutLineVCompound = aHLRToShape.OutLineVCompound();
- IsoLineVCompound = aHLRToShape.IsoLineVCompound();
- HCompound = aHLRToShape.HCompound();
- Rg1LineHCompound = aHLRToShape.Rg1LineHCompound();
- RgNLineHCompound = aHLRToShape.RgNLineHCompound();
- OutLineHCompound = aHLRToShape.OutLineHCompound();
- IsoLineHCompound = aHLRToShape.IsoLineHCompound();
+
+ switch(aMode)
+ {
+ case (1):
+ {
+ DrawCompound(thePresentation, VCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (2):
+ {
+ DrawCompound(thePresentation, Rg1LineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (3):
+ {
+ DrawCompound(thePresentation, RgNLineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (4):
+ {
+ DrawCompound(thePresentation, OutLineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ default:
+ {
+ DrawCompound(thePresentation,VCompound, aLineAspect);
+ DrawCompound(thePresentation,Rg1LineVCompound, aLineAspect);
+ DrawCompound(thePresentation,RgNLineVCompound, aLineAspect);
+ DrawCompound(thePresentation,OutLineVCompound, aLineAspect);
+ }
}
- if (UsePolyAlgo)
+ if (DrawHiddenLine)
{
- Handle(Graphic2d_SetOfSegments) aSetOfVSegmentsHighLighted = new Graphic2d_SetOfSegments(aGrObj);
- Handle(Graphic2d_SetOfSegments) aSetOfVSegments = new Graphic2d_SetOfSegments(aGrObj);
-
- if (TheMode == 1) DrawCompound(VCompound , aSetOfVSegmentsHighLighted);
- else DrawCompound(VCompound , aSetOfVSegments);
- if (TheMode == 2) DrawCompound(Rg1LineVCompound , aSetOfVSegmentsHighLighted);
- else DrawCompound(Rg1LineVCompound , aSetOfVSegments);
- if (TheMode == 3) DrawCompound(RgNLineVCompound , aSetOfVSegmentsHighLighted);
- else DrawCompound(RgNLineVCompound , aSetOfVSegments);
- if (TheMode == 4) DrawCompound(OutLineVCompound , aSetOfVSegmentsHighLighted);
- else DrawCompound(OutLineVCompound , aSetOfVSegments);
+ Handle(Prs3d_LineAspect) aLineAspectHighlighted = new Prs3d_LineAspect(Quantity_NOC_RED,
+ Aspect_TOL_DOTDASH,2);
+ Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect(Quantity_NOC_BLUE1,
+ Aspect_TOL_DOTDASH,1);
- aSetOfVSegmentsHighLighted->SetColorIndex (1);
- aSetOfVSegmentsHighLighted->SetWidthIndex (1);
- aSetOfVSegmentsHighLighted->SetTypeIndex (1);
- aSetOfVSegments->SetColorIndex (2);
- aSetOfVSegments->SetWidthIndex (2);
- if (DrawHiddenLine)
+ switch(aMode)
{
- Handle(Graphic2d_SetOfSegments) aSetOfHSegmentsHighLighted = new Graphic2d_SetOfSegments(aGrObj);
- Handle(Graphic2d_SetOfSegments) aSetOfHSegments = new Graphic2d_SetOfSegments(aGrObj);
- if (TheMode == 6) DrawCompound(HCompound , aSetOfHSegmentsHighLighted);
- else DrawCompound(HCompound , aSetOfHSegments);
- if (TheMode == 7) DrawCompound(Rg1LineHCompound , aSetOfHSegmentsHighLighted);
- else DrawCompound(Rg1LineHCompound , aSetOfHSegments);
- if (TheMode == 8) DrawCompound(RgNLineHCompound , aSetOfHSegmentsHighLighted);
- else DrawCompound(RgNLineHCompound , aSetOfHSegments);
- if (TheMode == 9) DrawCompound(OutLineHCompound , aSetOfHSegmentsHighLighted);
- else DrawCompound(OutLineHCompound , aSetOfHSegments);
-
- aSetOfVSegments->SetTypeIndex (2);
- aSetOfHSegmentsHighLighted->SetColorIndex (3);
- aSetOfHSegmentsHighLighted->SetWidthIndex (3);
- aSetOfHSegmentsHighLighted->SetTypeIndex (3);
- aSetOfHSegments->SetColorIndex (4);
- aSetOfHSegments->SetWidthIndex (4);
- aSetOfHSegments->SetTypeIndex (4);
+ case (6):
+ {
+ DrawCompound(thePresentation, HCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (7):
+ {
+ DrawCompound(thePresentation, Rg1LineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (8):
+ {
+ DrawCompound(thePresentation, RgNLineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (9):
+ {
+ DrawCompound(thePresentation, OutLineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ default:
+ {
+ DrawCompound(thePresentation, HCompound, aLineAspect);
+ DrawCompound(thePresentation, Rg1LineHCompound, aLineAspect);
+ DrawCompound(thePresentation, RgNLineHCompound, aLineAspect);
+ DrawCompound(thePresentation, OutLineHCompound, aLineAspect);
+ }
}
+ }
}
else
{
- Handle(Graphic2d_SetOfCurves) aSetOfVCurvesHighLighted = new Graphic2d_SetOfCurves(aGrObj);
- Handle(Graphic2d_SetOfCurves) aSetOfVCurves = new Graphic2d_SetOfCurves(aGrObj);
+ Handle(Prs3d_LineAspect) aLineAspectHighlighted = new Prs3d_LineAspect(Quantity_NOC_RED,
+ Aspect_TOL_SOLID,2);
+ Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect(Quantity_NOC_WHITE,
+ Aspect_TOL_SOLID,1);
- if (TheMode == 1) DrawCompound(VCompound , aSetOfVCurvesHighLighted);
- else DrawCompound(VCompound , aSetOfVCurves);
- if (TheMode == 2) DrawCompound(Rg1LineVCompound , aSetOfVCurvesHighLighted);
- else DrawCompound(Rg1LineVCompound , aSetOfVCurves);
- if (TheMode == 3) DrawCompound(RgNLineVCompound , aSetOfVCurvesHighLighted);
- else DrawCompound(RgNLineVCompound , aSetOfVCurves);
- if (TheMode == 4) DrawCompound(OutLineVCompound , aSetOfVCurvesHighLighted);
- else DrawCompound(OutLineVCompound , aSetOfVCurves);
- if (TheMode == 5) DrawCompound(IsoLineVCompound , aSetOfVCurvesHighLighted);
- else DrawCompound(IsoLineVCompound , aSetOfVCurves);
- aSetOfVCurvesHighLighted->SetColorIndex (1);
- aSetOfVCurvesHighLighted->SetWidthIndex (1);
- aSetOfVCurvesHighLighted->SetTypeIndex (1);
- aSetOfVCurves->SetColorIndex (2);
- aSetOfVCurves->SetWidthIndex (2);
- aSetOfVCurves->SetTypeIndex (2);
-
- if (DrawHiddenLine)
+ switch (aMode)
+ {
+ case (1):
{
- Handle(Graphic2d_SetOfCurves) aSetOfHCurvesHighLighted = new Graphic2d_SetOfCurves(aGrObj);
- Handle(Graphic2d_SetOfCurves) aSetOfHCurves = new Graphic2d_SetOfCurves(aGrObj);
- if (TheMode == 6) DrawCompound(HCompound , aSetOfHCurvesHighLighted);
- else DrawCompound(HCompound , aSetOfHCurves);
- if (TheMode == 7) DrawCompound(Rg1LineHCompound , aSetOfHCurvesHighLighted);
- else DrawCompound(Rg1LineHCompound , aSetOfHCurves);
- if (TheMode == 8) DrawCompound(RgNLineHCompound , aSetOfHCurvesHighLighted);
- else DrawCompound(RgNLineHCompound , aSetOfHCurves);
- if (TheMode == 9) DrawCompound(OutLineHCompound , aSetOfHCurvesHighLighted);
- else DrawCompound(OutLineHCompound , aSetOfHCurves);
- if (TheMode == 10) DrawCompound(IsoLineHCompound , aSetOfHCurvesHighLighted);
- else DrawCompound(IsoLineHCompound , aSetOfHCurves);
-
- aSetOfHCurvesHighLighted->SetColorIndex (3);
- aSetOfHCurvesHighLighted->SetWidthIndex (3);
- aSetOfHCurvesHighLighted->SetTypeIndex (3);
- aSetOfHCurves->SetColorIndex (4);
- aSetOfHCurves->SetWidthIndex (4);
- aSetOfHCurves->SetTypeIndex (4);
+ DrawCompound(thePresentation, VCompound, aLineAspectHighlighted);
+ break;
}
- }
-}
-
+ case (2):
+ {
+ DrawCompound(thePresentation, Rg1LineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (3):
+ {
+ DrawCompound(thePresentation, RgNLineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (4):
+ {
+ DrawCompound(thePresentation, OutLineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (5):
+ {
+ DrawCompound(thePresentation, IsoLineVCompound, aLineAspectHighlighted);
+ break;
+ }
+ default:
+ {
+ DrawCompound(thePresentation, VCompound, aLineAspect);
+ DrawCompound(thePresentation, Rg1LineVCompound, aLineAspect);
+ DrawCompound(thePresentation, RgNLineVCompound, aLineAspect);
+ DrawCompound(thePresentation, OutLineVCompound, aLineAspect);
+ DrawCompound(thePresentation, IsoLineVCompound , aLineAspect);
+ }
+ }
-void ISession2D_Shape::DrawCompound(TopoDS_Shape& aCompound,const Handle(Graphic2d_SetOfSegments)& aSetOfSegments)
-{
- if (aCompound.IsNull())
- return;
+ if (DrawHiddenLine)
+ {
+ Handle(Prs3d_LineAspect) aLineAspectHighlighted = new Prs3d_LineAspect(Quantity_NOC_RED,
+ Aspect_TOL_DOT,2);
+ Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect(Quantity_NOC_ALICEBLUE,
+ Aspect_TOL_DOT,1);
- TopExp_Explorer ex(aCompound,TopAbs_EDGE);
- while (ex.More()) {
- const TopoDS_Edge& CurrentEdge = TopoDS::Edge(ex.Current());
- const TopoDS_Vertex& FirstVertex=TopExp::FirstVertex(CurrentEdge);
- const TopoDS_Vertex& LastVertex =TopExp::LastVertex(CurrentEdge);
- gp_Pnt FirstPoint = BRep_Tool::Pnt(FirstVertex);
- gp_Pnt LastPoint = BRep_Tool::Pnt(LastVertex);
- aSetOfSegments->Add(FirstPoint.X(),FirstPoint.Y(),LastPoint.X(),LastPoint.Y());
- ex.Next();
+ switch(aMode)
+ {
+ case (6):
+ {
+ DrawCompound(thePresentation, HCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (7):
+ {
+ DrawCompound(thePresentation, Rg1LineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (8):
+ {
+ DrawCompound(thePresentation, RgNLineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (9):
+ {
+ DrawCompound(thePresentation, OutLineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ case (10):
+ {
+ DrawCompound(thePresentation, IsoLineHCompound, aLineAspectHighlighted);
+ break;
+ }
+ default:
+ {
+ DrawCompound(thePresentation, HCompound, aLineAspect);
+ DrawCompound(thePresentation, Rg1LineHCompound, aLineAspect);
+ DrawCompound(thePresentation, RgNLineHCompound, aLineAspect);
+ DrawCompound(thePresentation, OutLineHCompound, aLineAspect);
+ DrawCompound(thePresentation, IsoLineHCompound, aLineAspect);
+ }
+ }
+ }
}
}
-void ISession2D_Shape::DrawCompound(TopoDS_Shape& aCompound,const Handle(Graphic2d_SetOfCurves)& aSetOfCurves)
+void ISession2D_Shape::DrawCompound(const Handle(Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theCompound,
+ const Handle(Prs3d_LineAspect) theAspect)
{
- if (aCompound.IsNull())
+ if (theCompound.IsNull())
return;
-
- TopExp_Explorer ex(aCompound,TopAbs_EDGE);
- Handle(Geom2d_Curve) aCurve;
- Handle(Geom_Surface) aSurface;
- TopLoc_Location L;
- Standard_Real f,l;
- while (ex.More()) {
- const TopoDS_Edge& CurrentEdge = TopoDS::Edge(ex.Current());
- ASSERT(CurrentEdge.Location().IsIdentity());
- BRep_Tool::CurveOnSurface(CurrentEdge,aCurve,aSurface,L,f,l);
- ASSERT(L.IsIdentity());
- Handle(Geom2d_TrimmedCurve) c= new Geom2d_TrimmedCurve(aCurve,f,l);
- ASSERT(!c.IsNull());
- aSetOfCurves->Add(c);
- ex.Next();
- }
+ myDrawer->SetWireAspect(theAspect);
+ StdPrs_WFDeflectionShape::Add(thePresentation,TopoDS_Shape(theCompound),myDrawer);
}
void ISession2D_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
-{
+{
+
}