class OffsetPresentation;
- class DatumTool;
-
- class DatumPrs instantiates Datum from Prs3d(Ax2 from gp,
- DatumTool from DsgPrs);
class XYZAxisPresentation;
class XYZPlanePresentation;
class ShadedPlanePresentation;
+
+ imported DatumPrs;
ComputeSymbol(aPresentation: Presentation from Prs3d;
anAspect: AngleAspect from Prs3d;
-- special case flag SpecCase equal Standard_True if
-- radius of fillet circle = 0 or if anngle between
-- Vec1(Center, FirstPoint) and Vec2(Center,SecondPoint) equal 0 or PI
-
DistanceFromApex( elips : Elips from gp;
Apex : Pnt from gp;
par : Real from Standard)
returns Real from Standard;
- ---Purpose: computes length of ellipse arc in parametric units
+ ---Purpose: computes length of ellipse arc in parametric units
+
end DsgPrs;
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#include <DsgPrs_DatumPrs.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Ax2.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Prs3d_Arrow.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_DatumAspect.hxx>
+#include <Prs3d_TextAspect.hxx>
+#include <Prs3d_ArrowAspect.hxx>
+
+void DsgPrs_DatumPrs::Add (const Handle(Prs3d_Presentation)& thePresentation,
+ const gp_Ax2& theDatum,
+ const Handle(Prs3d_Drawer)& theDrawer)
+{
+ Handle(Prs3d_DatumAspect) aDatumAspect = theDrawer->DatumAspect();
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
+
+ Quantity_Color aColor;
+ Aspect_TypeOfLine aTypeOfLine;
+ Standard_Real aWidth;
+ aDatumAspect->FirstAxisAspect()->Aspect()->Values(aColor, aTypeOfLine, aWidth);
+
+ gp_Ax2 anAxis(theDatum);
+ gp_Pnt anOrigin = anAxis.Location();
+ gp_Dir aXDir = anAxis.XDirection();
+ gp_Dir aYDir = anAxis.YDirection();
+ gp_Dir aZDir = anAxis.Direction();
+
+ Quantity_Length anAxisLength;
+ Quantity_Length anArrowAngle = theDrawer->ArrowAspect()->Angle();
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims;
+ if (aDatumAspect->DrawFirstAndSecondAxis())
+ {
+ anAxisLength = aDatumAspect->FirstAxisLength();
+ const gp_Pnt aPoint1(anOrigin.XYZ() + aXDir.XYZ()*anAxisLength);
+
+ aGroup->SetPrimitivesAspect(aDatumAspect->FirstAxisAspect()->Aspect());
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(anOrigin);
+ aPrims->AddVertex(aPoint1);
+ aGroup->AddPrimitiveArray(aPrims);
+
+ aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
+ Prs3d_Arrow::Draw(thePresentation,aPoint1,aXDir,anArrowAngle,anAxisLength/10.);
+ aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
+ Graphic3d_Vertex aVertex1(aPoint1.X(),aPoint1.Y(),aPoint1.Z());
+ aGroup->Text(Standard_CString("X"), aVertex1,16.);
+
+ anAxisLength = aDatumAspect->SecondAxisLength();
+ const gp_Pnt aPoint2(anOrigin.XYZ() + aYDir.XYZ()*anAxisLength);
+
+ aGroup->SetPrimitivesAspect(aDatumAspect->SecondAxisAspect()->Aspect());
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(anOrigin);
+ aPrims->AddVertex(aPoint2);
+ aGroup->AddPrimitiveArray(aPrims);
+
+ aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
+ Prs3d_Arrow::Draw(thePresentation,aPoint2,aYDir,anArrowAngle,anAxisLength/10.);
+ aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
+ Graphic3d_Vertex aVertex2(aPoint2.X(),aPoint2.Y(),aPoint2.Z());
+ aGroup->Text(Standard_CString("Y"), aVertex2,16.);
+ }
+ if (aDatumAspect->DrawThirdAxis())
+ {
+ anAxisLength = aDatumAspect->ThirdAxisLength();
+ const gp_Pnt aPoint3(anOrigin.XYZ() + aZDir.XYZ()*anAxisLength);
+
+ aGroup->SetPrimitivesAspect(aDatumAspect->ThirdAxisAspect()->Aspect());
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(anOrigin);
+ aPrims->AddVertex(aPoint3);
+ aGroup->AddPrimitiveArray(aPrims);
+
+ aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
+ Prs3d_Arrow::Draw(thePresentation,aPoint3,aZDir,anArrowAngle,anAxisLength/10.);
+ aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
+ Graphic3d_Vertex aVertex3(aPoint3.X(),aPoint3.Y(),aPoint3.Z());
+ aGroup->Text(Standard_CString("Z"), aVertex3,16.);
+ }
+}
+
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+#ifndef _DsgPrs_DatumPrs_H__
+#define _DsgPrs_DatumPrs_H__
+
+#include <gp_Ax2.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+
+class DsgPrs_DatumPrs : public Prs3d_Root
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ Standard_EXPORT static void Add
+ (const Handle(Prs3d_Presentation)& thePresentation,
+ const gp_Ax2& theDatum,
+ const Handle(Prs3d_Drawer)& theDrawer);
+
+};
+#endif
+++ /dev/null
--- Created on: 1994-10-10
--- Created by: Arnaud BOUZY
--- Copyright (c) 1994-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-class DatumTool from DsgPrs
- ---Purpose: A generic framework for defining display of datums. Instantiates Prs3d_Datum.
-uses Ax2 from gp
-
-is
-
- Ax2 ( myclass; aDatum: Ax2 from gp ) returns Ax2 from gp;
-
-end DatumTool from DsgPrs;
-
-
+++ /dev/null
-// Created on: 1994-10-10
-// Created by: Arnaud BOUZY
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <DsgPrs_DatumTool.ixx>
-
-gp_Ax2 DsgPrs_DatumTool::Ax2(const gp_Ax2& ax)
-{
- return ax;
-}
--- /dev/null
+DsgPrs_DatumPrs.hxx
+DsgPrs_DatumPrs.cxx
\ No newline at end of file
Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx
Prs3d_NListOfSequenceOfPnt.hxx
+Prs3d_Point.hxx
+Prs3d_WFShape.hxx
\ No newline at end of file
-- display of dimensions, relations and trihedra.
uses
- Graphic3d,
- Aspect,
- Quantity,
- MMgt,
- Standard,
- Adaptor3d,
- BRepAdaptor,
- Geom,
- CPnts,
- GCPnts,
- TopAbs,
- TopLoc,
- TopoDS,
- TopTools,
- TopExp,
- HLRAlgo,
- TCollection,
- TColgp,
- Bnd,
- gp,
- Poly,
- TColStd
+ Graphic3d,
+ Aspect,
+ Quantity,
+ MMgt,
+ Standard,
+ Adaptor3d,
+ BRepAdaptor,
+ Geom,
+ CPnts,
+ GCPnts,
+ TopAbs,
+ TopLoc,
+ TopoDS,
+ TopTools,
+ TopExp,
+ HLRAlgo,
+ TCollection,
+ TColgp,
+ Bnd,
+ gp,
+ Poly,
+ TColStd
is
- exception InvalidAngle inherits RangeError from Standard;
-
- enumeration TypeOfLinePicking is TOLP_Point,
- TOLP_Segment
- end TypeOfLinePicking;
+ exception InvalidAngle inherits RangeError from Standard;
+
+ enumeration TypeOfLinePicking is TOLP_Point,
+ TOLP_Segment
+ end TypeOfLinePicking;
- enumeration TypeOfHLR is TOH_NotSet,
- TOH_PolyAlgo,
- TOH_Algo;
- ---Purpose: Declares types of hidden line removal algorithm.
- --TOH_Algo enables using of exact HLR algorithm.
- --TOH_PolyAlgo enables using of polygonal HLR algorithm.
- --TOH_NotSet is used by AIS_Drawer class, it means that the drawer should return the global value.
- --For more details see AIS_Drawer class, AIS_Shape::Compute() method and
- --HLRAlgo package from TKHLR toolkit.
-
- class Presentation;
- ---Purpose: defines the presentation object. This object can be
- -- displayed, highlighted, erased, etc... The output
- -- of the presentation algorithms are sent in a
- -- presentation object. A presentation object is attached
- -- to a given Viewer.
-
+ enumeration TypeOfHLR is TOH_NotSet,
+ TOH_PolyAlgo,
+ TOH_Algo;
+ ---Purpose: Declares types of hidden line removal algorithm.
+ -- TOH_Algo enables using of exact HLR algorithm.
+ -- TOH_PolyAlgo enables using of polygonal HLR algorithm.
+ -- TOH_NotSet is used by AIS_Drawer class, it means that the drawer should return the global value.
+ -- For more details see AIS_Drawer class, AIS_Shape::Compute() method and
+ -- HLRAlgo package from TKHLR toolkit.
+
+ class Presentation;
+ ---Purpose: defines the presentation object. This object can be
+ -- displayed, highlighted, erased, etc... The output
+ -- of the presentation algorithms are sent in a
+ -- presentation object. A presentation object is attached
+ -- to a given Viewer.
+
---Category: Aspect classes.
---Purpose: The aspect classes qualifies how to represent
-- a given kind of object.
--
-
- deferred class BasicAspect;
- class PointAspect;
- class LineAspect;
+ deferred class BasicAspect;
+ class PointAspect;
+ class LineAspect;
class ShadingAspect;
class TextAspect;
- deferred class CompositeAspect;
- class IsoAspect;
+ deferred class CompositeAspect;
+ class IsoAspect;
class PlaneAspect;
- class ArrowAspect;
+ class ArrowAspect;
class LengthAspect;
class AngleAspect;
class RadiusAspect;
class DatumAspect;
- class Drawer;
+ class Drawer;
---Purpose: qualifies how the presentation algorithms compute
-- the presentation of a specific kind of object.
-- This includes for example color, width and type
-- A drawer includes an instance of the Aspect classes
-- with particular default values.
- class Projector;
+ class Projector;
---Purpose: defines the projection parameters for the hidden
-- lines removal algorithm.
- class PlaneSet;
+ class PlaneSet;
---Purpose: defines a set of planes used for a presentation
-- by sections.
--
- deferred class Root;
+ deferred class Root;
---Purpose: defines the root of the presentation algorithms.
-
- generic class Point;
- ---Purpose: computes the presentation of objects to be
- -- seen as points.
-
- generic class Line;
- ---Purpose: computes the presentation of objects to be
- -- seen as broken lines.
-
- --generic class WFSectionShape;
- ---Purpose: computes the wireframe presentation of surfaces
- -- by displaying planar sections.
-
- generic class WFDeflectionRestrictedFace;
- ---Purpose: computes the wireframe presentation of faces with
- -- restrictions by displaying a given number of U and/or
- -- V isoparametric curves. The isoparametric curves are
- -- drawn with respect to a maximal chordial deviation.
- -- The presentation includes the restriction curves.
-
-
- generic class WFRestrictedFace;
- ---Purpose: computes the wireframe presentation of faces with
- -- restrictions by displaying a given number of U and/or
- -- V isoparametric curves. The isoparametric curves are
- -- drawn with a fixed number of points.
- -- The presentation includes the restriction curves.
-
-
- generic class WFShape;
- ---Purpose: computes the wireframe presentation of compound set
- -- of faces, edges and vertices by displaying a given
- -- number of U and/or V isoparametric curves.
-
+ ---Category: Basis construction elements.
-
- ---Category: Hidden lines removal algorithms.
-
- generic class HLRShape;
- ---Purpose: computes the presentation of objects with
- -- removal of their hidden lines for a specific
- -- projector.
- --
+ class LengthPresentation;
- ---Category: Shading algorithms.
-
- generic class SectionShapeTool;
-
- ---Category: Basis construction elements.
- generic class Vector;
- generic class Datum;
-
- class LengthPresentation;
-
class AnglePresentation;
-
- class Text;
-
-
- ---Category: Class signatures.
- --
- generic class PointTool;
- ---Purpose: describes the behaviour requested for a point presentation
- generic class LineTool;
- ---Purpose: describes the behaviour requested for a line presentation
+ class Text;
-
- generic class CurvePresentation;
-
- generic class RestrictionTool;
- ---Purpose: describes the behaviour requested for a restricted
- -- face presentation.
+ ---Category: Class signatures.
class ShapeTool;
---Purpose: describes the behaviour requested for a wireframe
-- shape presentation.
- generic class HLRShapeTool;
- ---Purpose: describes the behaviour requested for a shape
- -- presentation with hidden lines removal.
-
- deferred generic class VectorTool;
- ---Purpose: describes the behaviour requested for a vector
- -- presentation.
-
- deferred generic class DatumTool;
- ---Purpose: describes the behaviour requested for a datum
- -- presentation.
-
- class Arrow;
+ class Arrow;
---Purpose: draws an arrow at a given location, with respect
-- to a given direction.
-
- imported NListOfSequenceOfPnt;
- imported NListIteratorListOfSequenceOfPnt;
-
- MatchSegment(X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- p1,p2: Pnt from gp;
- dist: out Length from Quantity)
+
+ imported NListOfSequenceOfPnt;
+ imported NListIteratorListOfSequenceOfPnt;
+ imported Point;
+ imported WFShape;
+
+ MatchSegment(X,Y,Z: Length from Quantity;
+ aDistance: Length from Quantity;
+ p1,p2: Pnt from gp;
+ dist: out Length from Quantity)
returns Boolean from Standard;
end Prs3d;
-
-
+++ /dev/null
--- Created on: 1992-12-15
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-
-generic class CurvePresentation from Prs3d
- ( anyCurve as any;
- CurveTool as any) -- as CurveTool from Adaptor3d
-
-inherits Root from Prs3d
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d,
- Length from Quantity
-
-is
-
- --- Purpose:
- --
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve: anyCurve;
- aDrawer: Drawer from Prs3d);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve: anyCurve;
- U1,U2 : Real from Standard;
- aDrawer: Drawer from Prs3d);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve: anyCurve;
- aDeflection: Real from Standard);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve: anyCurve;
- U1,U2 : Real from Standard;
- aDeflection: Real from Standard);
-
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aCurve: anyCurve;
- aDrawer: Drawer from Prs3d)
- returns Boolean from Standard;
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aCurve: anyCurve;
- U1,U2 : Real from Standard;
- aDrawer: Drawer from Prs3d)
- returns Boolean from Standard;
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aCurve: anyCurve;
- aDeflection: Real from Standard)
- returns Boolean from Standard;
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aCurve: anyCurve;
- U1,U2 : Real from Standard;
- aDeflection: Real from Standard)
- returns Boolean from Standard;
-
-
-end CurvePresentation from Prs3d;
-
-
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-04-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class Datum from Prs3d
- (anyDatum as any;
- DatumTool as any) -- as DatumTool from Prs3d;
-
-inherits Root from Prs3d
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aDatum: anyDatum;
- aDrawer: Drawer from Prs3d);
-end Datum from Prs3d;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#define IMP120100 // YFR/GG 10/01/2000
-// Enable to compute the triedhron color texts and arrows.
-
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Prs3d_Arrow.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Ax2.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_DatumAspect.hxx>
-#include <Prs3d_TextAspect.hxx>
-#include <Prs3d_ArrowAspect.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation,
- const anyDatum& aDatum,
- const Handle(Prs3d_Drawer)& aDrawer )
-{
- Handle(Prs3d_DatumAspect) DA = aDrawer->DatumAspect();
- Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
-
- Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
- DA->FirstAxisAspect()->Aspect()->Values(Col,Tol,W);
-
- Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,.1);
-
- gp_Ax2 Axis = DatumTool::Ax2(aDatum);
- gp_Pnt Orig = Axis.Location();
- gp_Dir oX = Axis.XDirection();
- gp_Dir oY = Axis.YDirection();
- gp_Dir oZ = Axis.Direction();
-
-//
-// Trace d'une petite sphere au debut du vecteur:
-//
-
- Quantity_Length xo,yo,zo;
- Orig.Coord(xo,yo,zo);
- G->SetPrimitivesAspect(Asp);
- G->Marker(Graphic3d_Vertex (xo,yo,zo));
-
- Quantity_Length DS;
- Quantity_Length arrowAngle = aDrawer->ArrowAspect()->Angle();
- Quantity_Length textHeight = aDrawer->TextAspect()->Height();
-
- Handle(Graphic3d_ArrayOfSegments) aPrims;
- if (DA->DrawFirstAndSecondAxis())
- {
- DS = DA->FirstAxisLength();
- const gp_Pnt p1(Orig.XYZ() + oX.XYZ()*DS);
-
- G->SetPrimitivesAspect(DA->FirstAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(Orig);
- aPrims->AddVertex(p1);
- G->AddPrimitiveArray(aPrims);
-
- G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,p1,oX,arrowAngle,DS/10.);
- G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex v1(p1.X(),p1.Y(),p1.Z());
- G->Text(Standard_CString("X"),v1,16.);
-
- DS = DA->SecondAxisLength();
- const gp_Pnt p2(Orig.XYZ() + oY.XYZ()*DS);
-
- G->SetPrimitivesAspect(DA->SecondAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(Orig);
- aPrims->AddVertex(p2);
- G->AddPrimitiveArray(aPrims);
-
- G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,p2,oY,arrowAngle,DS/10.);
- G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex v2(p2.X(),p2.Y(),p2.Z());
- G->Text(Standard_CString("Y"),v2,16.);
- }
- if (DA->DrawThirdAxis())
- {
- DS = DA->ThirdAxisLength();
- const gp_Pnt p3(Orig.XYZ() + oZ.XYZ()*DS);
-
- G->SetPrimitivesAspect(DA->ThirdAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(Orig);
- aPrims->AddVertex(p3);
- G->AddPrimitiveArray(aPrims);
-
- G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,p3,oZ,arrowAngle,DS/10.);
- G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex v3(p3.X(),p3.Y(),p3.Z());
- G->Text(Standard_CString("Z"),v3,16.);
- }
-}
+++ /dev/null
--- Created on: 1993-04-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-deferred generic class DatumTool from Prs3d ( Datum as any)
-
-uses Ax2 from gp
-
-is
- Ax2 ( myclass; aDatum: Datum ) returns Ax2 from gp;
-
-end DatumTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-03-09
--- Created by: Jean-Louis Frenkel
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class HLRShape from Prs3d (anyShape as any;
- HLRShapeTool as any;
- anyCurve as any;
- CurvePresentation as any) -- as Curve from Prs3d
-
-inherits Root from Prs3d
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d,
- Projector from Prs3d
-
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aShape : anyShape;
- aDrawer : Drawer from Prs3d;
- aProjector : Projector from Prs3d);
-
-end HLRShape from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Graphic3d_Group.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-void Prs3d_HLRShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
- const anyShape& aShape,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Handle (Prs3d_Projector)& aProjector)
-{
- HLRShapeTool Tool(aShape,aProjector->Projector());
- Standard_Integer NbEdge = Tool.NbEdges();
- Standard_Integer i;
- Standard_Real U1,U2;
- anyCurve TheCurve;
- Standard_Real def = aDrawer->MaximalChordialDeviation();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
-
- aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
-
- Standard_Real anAngle = aDrawer->DeviationAngle();
- TColgp_SequenceOfPnt Points;
- for (i=1;i<=NbEdge;i++){
- for(Tool.InitVisible(i);Tool.MoreVisible();Tool.NextVisible()){
- Tool.Visible(TheCurve,U1,U2);
- CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
- }
- }
-
- if(aDrawer->DrawHiddenLine())
- {
- aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
-
- for (i=1;i<=NbEdge;i++){
- for(Tool.InitHidden(i);Tool.MoreHidden();Tool.NextHidden()){
- Tool.Hidden(TheCurve,U1,U2);
- CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
- }
- }
- }
-}
-
+++ /dev/null
--- Created on: 1993-03-09
--- Created by: Jean-Louis Frenkel
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class HLRShapeTool from Prs3d ( Shape as any ; Curve as any)
-uses
- Projector from HLRAlgo
-is
- Create (TheShape: Shape; TheProjector: Projector from HLRAlgo)
- returns HLRShapeTool from Prs3d;
- NbEdges(me) returns Integer from Standard;
- InitVisible(me; EdgeNumber: Integer from Standard);
- MoreVisible(me) returns Boolean from Standard;
- NextVisible(me);
- Visible(me; TheCurve: out Curve; U1,U2: out Real from Standard);
- InitHidden(me; EdgeNumber: Integer from Standard);
- MoreHidden(me) returns Boolean from Standard;
- NextHidden(me);
- Hidden(me; TheCurve: out Curve; U1,U2: out Real from Standard);
-
-end HLRShapeTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1992-12-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class Line from Prs3d
- (anyLine as any;
- LineTool as any) -- as LineTool from Prs3d
-inherits Root from Prs3d
-
----Purpose: draws a broken line.
---
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d,
- TypeOfLinePicking from Prs3d,
- Length from Quantity
-
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aLine: anyLine;
- aDrawer: Drawer from Prs3d);
-
- ---Purpose: adds to the presentation aPresentation the drawing of the
- -- broken line aLine.
- -- The aspect is defined by LineAspect in aDrawer.
-
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aLine: anyLine);
-
- ---Purpose: adds to the presentation aPresentation the drawing of the
- -- broken line aLine.
- -- The aspect is the current aspect.
-
-
-
- Pick(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aLine: anyLine;
- aDrawer: Drawer from Prs3d;
- TypeOfPicking: TypeOfLinePicking from Prs3d)
- returns Integer from Standard;
-
- ---Purpose: if TypeOfLinePicking is set to Prs3d_TOLP_Point
- -- returns the number of the point the most near of the
- -- point (X,Y,Z). The distance between the point and
- -- (X,Y,Z) must be less then aDistance. If no point corresponds,
- -- 0 is returned.
- -- if TypeOfLinePicking is set to Prs3d_TOLP_Segment returns
- -- the number of the segment the most near of the point (X,Y,Z).
- -- The distance between the segment and (X,Y,Z) must be less
- -- then aDistance. If no segment corresponds, 0 is returned.
-
-
-end Line;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Prs3d_Arrow.hxx>
-#include <Prs3d_ArrowAspect.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Dir.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d.hxx>
-
-static void DrawLine (const anyLine& aLine, const Handle(Graphic3d_Group)& aGroup)
-{
- Quantity_Length x,y,z;
-
- Standard_Integer i = LineTool::Lower(aLine);
- const Standard_Integer Upper = LineTool::Upper(aLine);
-
- Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(Upper-i+1);
- for (; i <= Upper; i++) {
- LineTool::Coord(aLine,i,x,y,z);
- aPrims->AddVertex((Standard_ShortReal)x,(Standard_ShortReal)y,(Standard_ShortReal)z);
- }
- aGroup->AddPrimitiveArray(aPrims);
-}
-
-void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const anyLine& aLine,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
- DrawLine(aLine,TheGroup);
- if (aDrawer->LineArrowDraw()) {
- Standard_Integer Lower = LineTool::Lower(aLine);
- Standard_Integer Upper = LineTool::Upper(aLine);
- if ( Upper > Lower ){
- Quantity_Length x1,y1,z1,x2,y2,z2;
- LineTool::Coord(aLine,Upper-1,x1,y1,z1);
- LineTool::Coord(aLine,Upper,x2,y2,z2);
-
- Prs3d_Arrow::Draw(aPresentation,
- gp_Pnt(x2,y2,z2),
- gp_Dir(x2-x1,y2-y1,z2-z1),
- aDrawer->ArrowAspect()->Angle(),
- aDrawer->ArrowAspect()->Length());
- }
- }
-}
-
-void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyLine& aLine)
-{
- DrawLine (aLine,Prs3d_Root::CurrentGroup(aPresentation));
-}
-
-Standard_Integer Prs3d_Line::Pick
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const anyLine& aLine,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Prs3d_TypeOfLinePicking TypeOfPicking)
-{
- Standard_Integer i = LineTool::Lower(aLine);
- const Standard_Integer Upper = LineTool::Upper(aLine);
-
- Standard_Integer num = 0;
- Quantity_Length X1,Y1,Z1,X2,Y2,Z2,dist;
-
- Standard_Real DistMin = RealLast();
-
- for (; i <= Upper; i++)
- {
- LineTool::Coord(aLine,i,X2,Y2,Z2);
- switch (TypeOfPicking) {
- case Prs3d_TOLP_Point: {
- dist = Abs(X-X2)+Abs(Y-Y2)+ Abs(Z-Z2);
- if(dist < aDistance) {
- if (dist < DistMin) {
- DistMin = dist;
- num = i;
- }
- }
- break;
- }
- case Prs3d_TOLP_Segment: {
- if (i > 1) {
- if (Prs3d::MatchSegment(X,Y,Z,aDistance,gp_Pnt(X1,Y1,Z1),gp_Pnt(X2,Y2,Z2),dist)) {
- if(dist < aDistance) {
- if (dist < DistMin) {
- DistMin = dist;
- num = i;
- }
- }
- }
- }
- X1=X2;Y1=Y2;Z1=Z2;
- break;
- }
- }
- }
- return num;
-}
+++ /dev/null
--- Created on: 1992-12-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class LineTool from Prs3d ( Line as any)
-uses
- Length from Quantity
-is
-
- Lower(myclass; aLine: Line) returns Integer from Standard;
- Upper(myclass; aLine: Line) returns Integer from Standard;
- Coord(myclass; aLine: Line;
- Index: Integer from Standard;
- X,Y,Z: out Length from Quantity);
-
-end LineTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1992-12-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class Point from Prs3d
- (anyPoint as any;
- PointTool as any) -- as PointTool from Prs3d;
-
-inherits Root from Prs3d
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d,
- Length from Quantity
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aPoint: anyPoint;
- aDrawer: Drawer from Prs3d);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aPoint: anyPoint);
-
- Match(myclass; aPoint: anyPoint;
- X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity)
- returns Boolean from Standard;
-
-end Point;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Graphic3d_Vertex.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Prs3d_PointAspect.hxx>
-
-static void DrawPoint (const anyPoint& aPoint,
- const Handle(Graphic3d_Group) aGroup)
-{
- Quantity_Length x,y,z;
- PointTool::Coord(aPoint,x,y,z);
- Graphic3d_Vertex Vertex(x,y,z);
- aGroup->Marker(Vertex);
-}
-
-void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const anyPoint& aPoint,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
- DrawPoint(aPoint,TheGroup);
-}
-
-void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyPoint& aPoint)
-{
- DrawPoint(aPoint,Prs3d_Root::CurrentGroup(aPresentation));
-}
-
-
-Standard_Boolean Prs3d_Point::Match (const anyPoint& aPoint,
- const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance)
-{
- Quantity_Length x,y,z;
- PointTool::Coord(aPoint,x,y,z);
- return Sqrt( (X-x)*(X-x) + (Y-y)*(Y-y) + (Z-z)*(Z-z) ) <= aDistance;
-}
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _Prs3d_Point_H__
+#define _Prs3d_Point_H__
+
+
+#include <Graphic3d_Vertex.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_Root.hxx>
+#include <Quantity_Length.hxx>
+
+template <class AnyPoint, class PointTool>
+class Prs3d_Point : Prs3d_Root
+{
+public:
+ DEFINE_STANDARD_ALLOC
+
+private:
+ Standard_EXPORT static void DrawPoint
+ (const AnyPoint& thePoint,
+ const Handle(Graphic3d_Group) theGroup)
+ {
+ Quantity_Length aX,aY,aZ;
+ PointTool::Coord(thePoint,aX,aY,aZ);
+ Graphic3d_Vertex aVertex(aX,aY,aZ);
+ theGroup->Marker(aVertex);
+ }
+
+public:
+ Standard_EXPORT static void Add
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const AnyPoint& thePoint,
+ const Handle (Prs3d_Drawer)& theDrawer)
+ {
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
+ DrawPoint(thePoint, aGroup);
+ }
+
+ Standard_EXPORT static Standard_Boolean Match
+ (const AnyPoint& thePoint,
+ const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance)
+ {
+ Quantity_Length aX,aY,aZ;
+ PointTool::Coord(thePoint, aX, aY, aZ);
+ return Sqrt((theX - aX)*(theX - aX) + (theY - aY)*(theY - aY)
+ + (theZ - aZ)*(theZ - aZ)) <= theDistance;
+ }
+};
+#endif
+++ /dev/null
--- Created on: 1992-12-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class PointTool from Prs3d ( Point as any)
-uses
- Length from Quantity
-is
- Coord( myclass; aPoint: Point; X,Y,Z: out Length from Quantity);
-
-end PointTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-02-15
--- Created by: Jean-Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class RestrictionTool from Prs3d ( Patch as any; Curve2d as any)
-
- uses
- Orientation from TopAbs
-is
-
- Create returns RestrictionTool;
- Create ( ThePatch: Patch ) returns RestrictionTool;
-
- IsOriented (me) returns Boolean from Standard;
-
- Init(me: in out);
-
- More(me) returns Boolean from Standard;
-
- Next(me: in out);
-
- Value(me) returns Curve2d;
-
- Orientation(me) returns Orientation from TopAbs;
-
-end RestrictionTool from Prs3d;
-
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-10-20
--- Created by: Jean-Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-
-generic class SectionShapeTool from Prs3d ( anyShape as any;
- anyEdge as any)
-
-uses
- Pln from gp
-is
-
- Create ( TheShape: anyShape ) returns SectionShapeTool from Prs3d;
- Load(me: in out; aPlane: Pln from gp);
-
- InitEdge (me);
- MoreEdge (me) returns Boolean from Standard;
- NextEdge (me);
- GetEdge(me) returns anyEdge;
-
-end SectionShapeTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-04-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class Vector from Prs3d
- (anyVector as any;
- VectorTool as any) -- as VectorTool from Prs3d;
-
-inherits Root from Prs3d
-
-uses
- Presentation from Prs3d,
- Drawer from Prs3d
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aVector: anyVector;
- aDrawer: Drawer from Prs3d);
-end Vector from Prs3d;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Prs3d_Arrow.hxx>
-#include <gp_Dir.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Pnt.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-
-void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
- const anyVector& aVector,
- const Handle(Prs3d_Drawer)& aDrawer )
-{
- gp_Pnt Pnt = VectorTool::Location(aVector);
- gp_Vec Vec = VectorTool::Vec(aVector);
- gp_Pnt Pnt2 = Pnt.Translated(Vec);
-
- Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
- G->SetPrimitivesAspect(aDrawer->VectorAspect()->Aspect());
-
- Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
- aDrawer->VectorAspect()->Aspect()->Values(Col,Tol,W);
-
-//
-// Trace d'une petite sphere au debut du vecteur:
-//
- Quantity_Length x1,y1,z1;
- Pnt.Coord(x1,y1,z1);
- Graphic3d_Vertex VTX(x1,y1,z1);
- Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,1.);
- G->SetPrimitivesAspect(Asp);
- G->Marker(VTX);
-
- Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(Pnt);
- aPrims->AddVertex(Pnt2);
- G->AddPrimitiveArray(aPrims);
-
- Prs3d_Arrow::Draw(aPresentation,Pnt2,gp_Dir(Vec),M_PI/180.*10.,Vec.Magnitude()/10.);
-}
+++ /dev/null
--- Created on: 1993-04-16
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-deferred generic class VectorTool from Prs3d ( Vector as any)
- --- template for drawing a vector.
-uses
- Vec from gp,
- Pnt from gp
-
-is
- Location (myclass; aVector: Vector) returns Pnt from gp;
- Vec ( myclass; aVector: Vector ) returns Vec from gp;
-
-end VectorTool from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+++ /dev/null
--- Created on: 1993-01-18
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1993-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-generic class WFDeflectionRestrictedFace from Prs3d
- (DrawFaceIso as any;
- RestrictionTool as any)
-
-inherits Root from Prs3d
-
-
- ---Purpose:
-
-uses
- HSurface from BRepAdaptor,
- Presentation from Prs3d,
- Drawer from Prs3d,
- Length from Quantity,
- NListOfSequenceOfPnt from Prs3d
-
-
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d);
-
- AddUIso(myclass; aPresentation: Presentation from Prs3d;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d);
-
- AddVIso(myclass; aPresentation: Presentation from Prs3d;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aFace : HSurface from BRepAdaptor;
- DrawUIso, DrawVIso: Boolean from Standard;
- Deflection : Length from Quantity;
- NBUiso,NBViso: Integer from Standard;
- aDrawer : Drawer from Prs3d;
- Curves : out NListOfSequenceOfPnt from Prs3d);
-
-
- Match(myclass; X,Y,Z : Length from Quantity;
- aDistance: Length from Quantity;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d)
- returns Boolean from Standard;
-
- MatchUIso(myclass; X,Y,Z : Length from Quantity;
- aDistance: Length from Quantity;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d)
- returns Boolean from Standard;
-
- MatchVIso(myclass; X,Y,Z : Length from Quantity;
- aDistance: Length from Quantity;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d)
- returns Boolean from Standard;
-
-
- Match(myclass;X,Y,Z : Length from Quantity;
- aDistance : Length from Quantity;
- aFace : HSurface from BRepAdaptor;
- aDrawer : Drawer from Prs3d;
- DrawUIso, DrawVIso: Boolean from Standard;
- aDeflection : Length from Quantity;
- NBUiso,NBViso: Integer from Standard)
-
- returns Boolean from Standard;
-
-end WFDeflectionRestrictedFace;
-
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Hatch_Hatcher.hxx>
-#include <Graphic3d_Group.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <Prs3d_IsoAspect.hxx>
-#include <Adaptor2d_Curve2d.hxx>
-#include <GCPnts_UniformDeflection.hxx>
-#include <Adaptor3d_IsoCurve.hxx>
-
-
-//=========================================================================
-// function: Add
-// purpose
-//=========================================================================
-void Prs3d_WFDeflectionRestrictedFace::Add
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Standard_Boolean DrawUIso,
- const Standard_Boolean DrawVIso,
- const Quantity_Length Deflection,
- const Standard_Integer NBUiso,
- const Standard_Integer NBViso,
- const Handle(Prs3d_Drawer)& aDrawer,
- Prs3d_NListOfSequenceOfPnt& Curves)
-{
- RestrictionTool ToolRst (aFace);
- Standard_Real aLimit = aDrawer->MaximalParameterValue();
-
- // compute bounds of the restriction
- Standard_Real UMin,UMax,VMin,VMax;
- Standard_Real u,v,step;
- Standard_Integer i,nbPoints = 10;
- UMin = VMin = RealLast();
- UMax = VMax = RealFirst();
- gp_Pnt2d P;
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- u = TheRCurve->FirstParameter();
- v = TheRCurve->LastParameter();
- if (TheRCurve->GetType() != GeomAbs_Line) {
- step = ( v - u) / nbPoints;
- for (i = 0; i <= nbPoints; i++) {
- TheRCurve->D0(u, P);
- if (P.X() < UMin) UMin = P.X();
- if (P.X() > UMax) UMax = P.X();
- if (P.Y() < VMin) VMin = P.Y();
- if (P.Y() > VMax) VMax = P.Y();
- u += step;
- }
- }
- else {
- TheRCurve->D0(u, P);
- if (P.X() < UMin) UMin = P.X();
- if (P.X() > UMax) UMax = P.X();
- if (P.Y() < VMin) VMin = P.Y();
- if (P.Y() > VMax) VMax = P.Y();
-
- TheRCurve->D0(v, P);
- if (P.X() < UMin) UMin = P.X();
- if (P.X() > UMax) UMax = P.X();
- if (P.Y() < VMin) VMin = P.Y();
- if (P.Y() > VMax) VMax = P.Y();
- }
- }
-
- // load the isos
- Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
- Standard_Boolean UClosed = aFace->IsUClosed();
- Standard_Boolean VClosed = aFace->IsVClosed();
-
- if ( ! UClosed ) {
- UMin = UMin + ( UMax - UMin) /1000.;
- UMax = UMax - ( UMax - UMin) /1000.;
- }
-
- if ( ! VClosed ) {
- VMin = VMin + ( VMax - VMin) /1000.;
- VMax = VMax - ( VMax - VMin) /1000.;
- }
-
- if (DrawUIso){
- if (NBUiso > 0) {
- UClosed = Standard_False; // En attendant un hatcher de course.
- Standard_Real du= UClosed ? (UMax-UMin)/NBUiso : (UMax-UMin)/(1+NBUiso);
- for (i=1; i<=NBUiso;i++){
- isobuild.AddXLine(UMin+du*i);
- }
- }
- }
- if (DrawVIso){
- if ( NBViso > 0) {
- VClosed = Standard_False;
- Standard_Real dv= VClosed ?(VMax-VMin)/NBViso : (VMax-VMin)/(1+NBViso);
- for (i=1; i<=NBViso;i++){
- isobuild.AddYLine(VMin+dv*i);
- }
- }
- }
-
- // trim the isos
- gp_Pnt2d P1,P2;
- Standard_Real U1, U2;
- gp_Pnt dummypnt;
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- TopAbs_Orientation Orient = ToolRst.Orientation();
- if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- if (TheRCurve->GetType() != GeomAbs_Line) {
- GCPnts_UniformDeflection UDP(*TheRCurve, Deflection, Standard_False);
- if (UDP.IsDone()) {
- Standard_Integer NumberOfPoints = UDP.NbPoints();
- if ( NumberOfPoints >= 2 ) {
- dummypnt = UDP.Value(1);
- P2.SetCoord(dummypnt.X(), dummypnt.Y());
- for (i = 2; i <= NumberOfPoints; i++) {
- P1 = P2;
- dummypnt = UDP.Value(i);
- P2.SetCoord(dummypnt.X(), dummypnt.Y());
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- }
- else {
- cout << "Cannot evaluate curve on surface"<<endl;
- }
- }
- else {
- U1 = TheRCurve->FirstParameter();
- U2 = TheRCurve->LastParameter();
- P1 = TheRCurve->Value(U1);
- P2 = TheRCurve->Value(U2);
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- }
-
- // draw the isos
- Adaptor3d_IsoCurve anIso;
- anIso.Load(aFace);
- Standard_Integer NumberOfLines = isobuild.NbLines();
-
- for (i = 1; i <= NumberOfLines; i++) {
- Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i);
- Standard_Real Coord = isobuild.Coordinate(i);
- for (Standard_Integer j = 1; j <= NumberOfIntervals; j++) {
- Standard_Real b1=isobuild.Start(i,j),b2=isobuild.End(i,j);
-
- b1 = b1 == RealFirst() ? - aLimit : b1;
- b2 = b2 == RealLast() ? aLimit : b2;
-
- if (isobuild.IsXLine(i))
- anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
- else
- anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
-
- DrawFaceIso::Add(aPresentation,anIso,Deflection, aLimit);
- }
- }
-}
-
-
-//=========================================================================
-// function: Match
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFDeflectionRestrictedFace::Match
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Boolean DrawUIso,
- const Standard_Boolean DrawVIso,
- const Quantity_Length Deflection,
- const Standard_Integer NBUiso,
- const Standard_Integer NBViso)
-{
-
- RestrictionTool ToolRst (aFace);
- const Standard_Real aLimit = aDrawer->MaximalParameterValue();
-
- // compute bounds of the restriction
- Standard_Real UMin,UMax,VMin,VMax;
- Standard_Real u,v,step;
- Standard_Integer i,nbPoints = 10;
- UMin = VMin = RealLast();
- UMax = VMax = RealFirst();
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- u = TheRCurve->FirstParameter();
- v = TheRCurve->LastParameter();
- step = ( v - u) / nbPoints;
- for (i = 0; i <= nbPoints; i++) {
- gp_Pnt2d P = TheRCurve->Value(u);
- if (P.X() < UMin) UMin = P.X();
- if (P.X() > UMax) UMax = P.X();
- if (P.Y() < VMin) VMin = P.Y();
- if (P.Y() > VMax) VMax = P.Y();
- u += step;
- }
- }
-
- // load the isos
- Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
- Standard_Boolean UClosed = aFace->IsUClosed();
- Standard_Boolean VClosed = aFace->IsVClosed();
-
- if ( ! UClosed ) {
- UMin = UMin + ( UMax - UMin) /1000.;
- UMax = UMax - ( UMax - UMin) /1000.;
- }
-
- if ( ! VClosed ) {
- VMin = VMin + ( VMax - VMin) /1000.;
- VMax = VMax - ( VMax - VMin) /1000.;
- }
-
- if (DrawUIso){
- if (NBUiso > 0) {
- UClosed = Standard_False; // En attendant un hatcher de course.
- Standard_Real du= UClosed ? (UMax-UMin)/NBUiso : (UMax-UMin)/(1+NBUiso);
- for (i=1; i<=NBUiso;i++){
- isobuild.AddXLine(UMin+du*i);
- }
- }
- }
- if (DrawVIso){
- if ( NBViso > 0) {
- VClosed = Standard_False;
- Standard_Real dv= VClosed ?(VMax-VMin)/NBViso : (VMax-VMin)/(1+NBViso);
- for (i=1; i<=NBViso;i++){
- isobuild.AddYLine(VMin+dv*i);
- }
- }
- }
-
- // trim the isos
- gp_Pnt2d P1,P2;
- gp_Pnt dummypnt;
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- TopAbs_Orientation Orient = ToolRst.Orientation();
- if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- GCPnts_UniformDeflection UDP(*TheRCurve, Deflection, Standard_False);
- if (UDP.IsDone()) {
- Standard_Integer NumberOfPoints = UDP.NbPoints();
- if ( NumberOfPoints >= 2 ) {
- dummypnt = UDP.Value(1);
- P2.SetCoord(dummypnt.X(), dummypnt.Y());
- for (i = 2; i <= NumberOfPoints; i++) {
- P1 = P2;
- dummypnt = UDP.Value(i);
- P2.SetCoord(dummypnt.X(), dummypnt.Y());
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- }
- else {
- cout << "Cannot evaluate curve on surface"<<endl;
- }
- }
- }
-
- // draw the isos
-
- Adaptor3d_IsoCurve anIso;
- anIso.Load(aFace);
- Standard_Integer NumberOfLines = isobuild.NbLines();
-
- for (i = 1; i <= NumberOfLines; i++) {
- Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i);
- Standard_Real Coord = isobuild.Coordinate(i);
- for (Standard_Integer j = 1; j <= NumberOfIntervals; j++) {
- Standard_Real b1=isobuild.Start(i,j),b2=isobuild.End(i,j);
-
- b1 = b1 == RealFirst() ? - aLimit : b1;
- b2 = b2 == RealLast() ? aLimit : b2;
-
- if (isobuild.IsXLine(i))
- anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
- else
- anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
-
- if (DrawFaceIso::Match(X,Y,Z,aDistance,anIso,Deflection, aLimit))
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
-
-//=========================================================================
-// function: Add
-// purpose
-//=========================================================================
-void Prs3d_WFDeflectionRestrictedFace::Add
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_WFDeflectionRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_True,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
-
-
-//=========================================================================
-// function: AddUIso
-// purpose
-//=========================================================================
-void Prs3d_WFDeflectionRestrictedFace::AddUIso
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_WFDeflectionRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_True,
- Standard_False,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
-
-
-//=========================================================================
-// function: AddVIso
-// purpose
-//=========================================================================
-void Prs3d_WFDeflectionRestrictedFace::AddVIso
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_WFDeflectionRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_False,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
-
-
-//=========================================================================
-// function: Match
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFDeflectionRestrictedFace::Match
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- return Prs3d_WFDeflectionRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number());
-}
-
-
-//=========================================================================
-// function: MatchUIso
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFDeflectionRestrictedFace::MatchUIso
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- return Prs3d_WFDeflectionRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_False,
- Deflection,
- finu,
- finv);
-}
-
-
-//=========================================================================
-// function: MatchVIso
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFDeflectionRestrictedFace::MatchVIso
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- return Prs3d_WFDeflectionRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_False,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number());
-}
+++ /dev/null
--- Created on: 1994-06-10
--- Created by: Laurent PAINNOT
--- Copyright (c) 1994-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-
-generic class WFRestrictedFace from Prs3d
- (DrawFaceIso as any;
- RestrictionTool as any)
-
-inherits Root from Prs3d
-
-
- ---Purpose:
-
-uses
- HSurface from BRepAdaptor,
- Presentation from Prs3d,
- Drawer from Prs3d,
- NListOfSequenceOfPnt from Prs3d,
- Length from Quantity
-
--- Description of the isoparametric curves:
---
-
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d);
-
- AddUIso(myclass; aPresentation: Presentation from Prs3d;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d);
-
- AddVIso(myclass; aPresentation: Presentation from Prs3d;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d);
-
- Add(myclass; aPresentation: Presentation from Prs3d;
- aFace: HSurface from BRepAdaptor;
- DrawUIso, DrawVIso: Boolean from Standard;
- Deflection: Length from Quantity;
- NBUiso,NBViso: Integer from Standard;
- aDrawer: Drawer from Prs3d;
- Curves: out NListOfSequenceOfPnt from Prs3d);
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d)
- returns Boolean from Standard;
-
- MatchUIso(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d)
- returns Boolean from Standard;
-
- MatchVIso(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aFace: HSurface from BRepAdaptor;
- aDrawer: Drawer from Prs3d)
- returns Boolean from Standard;
-
- Match(myclass; X,Y,Z: Length from Quantity;
- aDistance: Length from Quantity;
- aFace: HSurface from BRepAdaptor;
- DrawUIso, DrawVIso: Boolean from Standard;
- Deflection: Length from Quantity;
- NBUiso,NBViso: Integer from Standard;
- aDrawer: Drawer from Prs3d)
-
- returns Boolean from Standard;
-
-end WFRestrictedFace;
-
+++ /dev/null
-// Created on: 1994-06-10
-// Created by: Laurent PAINNOT
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#include <Hatch_Hatcher.hxx>
-#include <Graphic3d_Group.hxx>
-#include <gp_Pnt.hxx>
-#include <Prs3d_IsoAspect.hxx>
-#include <Adaptor3d_IsoCurve.hxx>
-#include <Bnd_Box2d.hxx>
-#include <BndLib_Add2dCurve.hxx>
-#include <Precision.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <Geom_Curve.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-#include <Geom_Surface.hxx>
-
-//=========================================================================
-// function: Add
-// purpose
-//=========================================================================
-void Prs3d_WFRestrictedFace::Add
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Standard_Boolean DrawUIso,
- const Standard_Boolean DrawVIso,
- const Quantity_Length aDeflection,
- const Standard_Integer NBUiso,
- const Standard_Integer NBViso,
- const Handle(Prs3d_Drawer)& aDrawer,
- Prs3d_NListOfSequenceOfPnt& Curves)
-{
- Standard_Real aLimit = aDrawer->MaximalParameterValue();
- Standard_Integer nbPoints = aDrawer->Discretisation();
-
- RestrictionTool ToolRst (aFace);
-
- // compute bounds of the restriction
- Standard_Real UMin,UMax,VMin,VMax;
-// Standard_Real u,v,step;
-// Standard_Integer i, nbp= 10;
- Standard_Integer i;
- gp_Pnt2d P1,P2;
- Bnd_Box2d B;
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- BndLib_Add2dCurve::Add(*TheRCurve, Precision::PConfusion(), B);
- }
- if ( ! B.IsVoid() )
- B.Get(UMin, VMin, UMax, VMax);
- else
- { // no pcurves -- take natural bounds
- UMin = aFace->Surface().FirstUParameter();
- VMin = aFace->Surface().FirstVParameter();
- UMax = aFace->Surface().LastUParameter();
- VMax = aFace->Surface().LastVParameter();
- }
-
- // load the isos
- Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
- Standard_Boolean UClosed = aFace->IsUClosed();
- Standard_Boolean VClosed = aFace->IsVClosed();
-
- if ( ! UClosed ) {
- UMin = UMin + ( UMax - UMin) /1000.;
- UMax = UMax - ( UMax - UMin) /1000.;
- }
-
- if ( ! VClosed ) {
- VMin = VMin + ( VMax - VMin) /1000.;
- VMax = VMax - ( VMax - VMin) /1000.;
- }
-
- if (DrawUIso){
- if (NBUiso > 0) {
- UClosed = Standard_False; // En attendant un hatcher de course.
- Standard_Real du= UClosed ? (UMax-UMin)/NBUiso : (UMax-UMin)/(1+NBUiso);
- for (i=1; i<=NBUiso;i++){
- isobuild.AddXLine(UMin+du*i);
- }
- }
- }
- if (DrawVIso){
- if ( NBViso > 0) {
- VClosed = Standard_False;
- Standard_Real dv= VClosed ?(VMax-VMin)/NBViso : (VMax-VMin)/(1+NBViso);
- for (i=1; i<=NBViso;i++){
- isobuild.AddYLine(VMin+dv*i);
- }
- }
- }
-
- // trim the isos
- Standard_Real U1, U2, U, DU;
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- TopAbs_Orientation Orient = ToolRst.Orientation();
- if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- U1 = TheRCurve->FirstParameter();
- U2 = TheRCurve->LastParameter();
- if (TheRCurve->GetType() != GeomAbs_Line) {
- DU = (U2-U1)/(nbPoints-1);
- P2 = TheRCurve->Value(U1);
- for (i = 2; i <= nbPoints; i++) {
- U = U1 + (i-1)*DU;
- P1 = P2;
- P2 = TheRCurve->Value(U);
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- else {
- P1 = TheRCurve->Value(U1);
- P2 = TheRCurve->Value(U2);
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- }
-
- // draw the isos
- Adaptor3d_IsoCurve anIso;
- anIso.Load(aFace);
- Handle(Geom_Curve) BC;
- const BRepAdaptor_Surface& BS = *(BRepAdaptor_Surface*)&(aFace->Surface());
- GeomAbs_SurfaceType thetype = aFace->GetType();
-
- Standard_Integer NumberOfLines = isobuild.NbLines();
- Handle(Geom_Surface) GB;
- if (thetype == GeomAbs_BezierSurface) {
- GB = BS.Bezier();
- }
- else if (thetype == GeomAbs_BSplineSurface){
- GB = BS.BSpline();
- }
-
- for (i = 1; i <= NumberOfLines; i++) {
- Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i);
- Standard_Real Coord = isobuild.Coordinate(i);
- for (Standard_Integer j = 1; j <= NumberOfIntervals; j++) {
- Standard_Real b1=isobuild.Start(i,j),b2=isobuild.End(i,j);
-
- if(b1 == RealFirst() || b2 == RealLast())
- continue;
- //b1 = b1 == RealFirst() ? - aLimit : b1;
- //b2 = b2 == RealLast() ? aLimit : b2;
-
- TColgp_SequenceOfPnt Pnts;
- if (!GB.IsNull()) {
- if (isobuild.IsXLine(i))
- BC = GB->UIso(Coord);
- else
- BC = GB->VIso(Coord);
- //Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
- //NbPoints = 30 - default parameter for computation of such curves
- DrawFaceIso::Add(aPresentation,GeomAdaptor_Curve(BC), b1, b2, aDeflection, Pnts, 30, Standard_False);
- Curves.Append(Pnts);
- }
- else {
- if (isobuild.IsXLine(i))
- anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
- else
- anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
- DrawFaceIso::Add(aPresentation,anIso, aDeflection, aDrawer, Pnts, Standard_False);
- Curves.Append(Pnts);
- }
- }
- }
-}
-
-
-//=========================================================================
-// function: Match
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFRestrictedFace::Match
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Standard_Boolean DrawUIso,
- const Standard_Boolean DrawVIso,
- const Quantity_Length aDeflection,
- const Standard_Integer NBUiso,
- const Standard_Integer NBViso,
- const Handle(Prs3d_Drawer)& aDrawer)
-{
- Standard_Real aLimit = aDrawer->MaximalParameterValue();
- Standard_Integer nbPoints = aDrawer->Discretisation();
- RestrictionTool ToolRst (aFace);
-
- // compute bounds of the restriction
- Standard_Real UMin,UMax,VMin,VMax;
- Standard_Real u,v,step;
- Standard_Integer i,nbP = 10;
- UMin = VMin = RealLast();
- UMax = VMax = RealFirst();
- gp_Pnt2d P1,P2;
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- u = TheRCurve->FirstParameter();
- v = TheRCurve->LastParameter();
- if (TheRCurve->GetType() != GeomAbs_Line) {
- step = ( v - u) / nbP;
- for (i = 0; i <= nbP; i++) {
- gp_Pnt2d P = TheRCurve->Value(u);
- if (P.X() < UMin) UMin = P.X();
- if (P.X() > UMax) UMax = P.X();
- if (P.Y() < VMin) VMin = P.Y();
- if (P.Y() > VMax) VMax = P.Y();
- u += step;
- }
- }
- else {
- P1 = TheRCurve->Value(u);
- if (P1.X() < UMin) UMin = P1.X();
- if (P1.X() > UMax) UMax = P1.X();
- if (P1.Y() < VMin) VMin = P1.Y();
- if (P1.Y() > VMax) VMax = P1.Y();
-
- P2 = TheRCurve->Value(v);
- if (P2.X() < UMin) UMin = P2.X();
- if (P2.X() > UMax) UMax = P2.X();
- if (P2.Y() < VMin) VMin = P2.Y();
- if (P2.Y() > VMax) VMax = P2.Y();
- }
- }
-
- // load the isos
- Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
- Standard_Boolean UClosed = aFace->IsUClosed();
- Standard_Boolean VClosed = aFace->IsVClosed();
-
- if ( ! UClosed ) {
- UMin = UMin + ( UMax - UMin) /1000.;
- UMax = UMax - ( UMax - UMin) /1000.;
- }
-
- if ( ! VClosed ) {
- VMin = VMin + ( VMax - VMin) /1000.;
- VMax = VMax - ( VMax - VMin) /1000.;
- }
-
- if (DrawUIso){
- if (NBUiso > 0) {
- UClosed = Standard_False; // En attendant un hatcher de course.
- Standard_Real du= UClosed ? (UMax-UMin)/NBUiso : (UMax-UMin)/(1+NBUiso);
- for (i=1; i<=NBUiso;i++){
- isobuild.AddXLine(UMin+du*i);
- }
- }
- }
- if (DrawVIso){
- if ( NBViso > 0) {
- VClosed = Standard_False;
- Standard_Real dv= VClosed ?(VMax-VMin)/NBViso : (VMax-VMin)/(1+NBViso);
- for (i=1; i<=NBViso;i++){
- isobuild.AddYLine(VMin+dv*i);
- }
- }
- }
-
- // trim the isos
- Standard_Real U1, U2, U, DU;
-
- for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
- TopAbs_Orientation Orient = ToolRst.Orientation();
- if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) {
- Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
- U1 = TheRCurve->FirstParameter();
- U2 = TheRCurve->LastParameter();
- if (TheRCurve->GetType() != GeomAbs_Line) {
- DU = (U2-U1)/(nbPoints-1);
- P2 = TheRCurve->Value(U1);
- for (i = 2; i <= nbPoints; i++) {
- U = U1 + (i-1)*DU;
- P1 = P2;
- P2 = TheRCurve->Value(U);
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- else {
- P1 = TheRCurve->Value(U1);
- P2 = TheRCurve->Value(U2);
- if(Orient == TopAbs_FORWARD )
- isobuild.Trim(P1,P2);
- else
- isobuild.Trim(P2,P1);
- }
- }
- }
-
- // draw the isos
-
- Adaptor3d_IsoCurve anIso;
- anIso.Load(aFace);
- Standard_Integer NumberOfLines = isobuild.NbLines();
-
- for (i = 1; i <= NumberOfLines; i++) {
- Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i);
- Standard_Real Coord = isobuild.Coordinate(i);
- for (Standard_Integer j = 1; j <= NumberOfIntervals; j++) {
- Standard_Real b1=isobuild.Start(i,j),b2=isobuild.End(i,j);
-
- b1 = b1 == RealFirst() ? - aLimit : b1;
- b2 = b2 == RealLast() ? aLimit : b2;
-
-
- if (isobuild.IsXLine(i))
- anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
- else
- anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
-
- if (DrawFaceIso::Match(X,Y,Z,aDistance,anIso,
- aDeflection, aLimit, nbPoints))
- return Standard_True;
-
-
- }
- }
- return Standard_False;
-}
-
-
-//=========================================================================
-// function: Add
-// purpose
-//=========================================================================
-void Prs3d_WFRestrictedFace::Add
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_NListOfSequenceOfPnt Curves;
- Prs3d_WFRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_True,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer,
- Curves);
-}
-
-
-//=========================================================================
-// function: AddUIso
-// purpose
-//=========================================================================
-void Prs3d_WFRestrictedFace::AddUIso
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_NListOfSequenceOfPnt Curves;
- Prs3d_WFRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_True,
- Standard_False,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer,
- Curves);
-}
-
-
-//=========================================================================
-// function: AddVIso
-// purpose
-//=========================================================================
-void Prs3d_WFRestrictedFace::AddVIso
- (const Handle (Prs3d_Presentation)& aPresentation,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Prs3d_NListOfSequenceOfPnt Curves;
- Prs3d_WFRestrictedFace::Add (
- aPresentation,
- aFace,
- Standard_False,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer,
- Curves);
-}
-
-
-//=========================================================================
-// function: Match
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFRestrictedFace::Match
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- return Prs3d_WFRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- Standard_True,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
-
-
-//=========================================================================
-// function: MatchUIso
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFRestrictedFace::MatchUIso
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- return Prs3d_WFRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- Standard_True,
- Standard_False,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
-
-
-//=========================================================================
-// function: MatchVIso
-// purpose
-//=========================================================================
-Standard_Boolean Prs3d_WFRestrictedFace::MatchVIso
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- return Prs3d_WFRestrictedFace::Match (
- X,Y,Z,aDistance,
- aFace,
- Standard_False,
- Standard_True,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->UIsoAspect()->Number(),
- aDrawer->VIsoAspect()->Number(),
- aDrawer);
-}
+++ /dev/null
--- Created on: 1992-12-15
--- Created by: Jean Louis FRENKEL
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-
-generic class WFShape from Prs3d
- (FacePresentation as any; -- as WFRestrictedFace from Prs3d
- CurvePresentation as any; -- as Curve from Prs3d
- PointPresentation as any) -- as Point from Prs3d
-
-inherits Root from Prs3d
-
-uses
- Shape from TopoDS,
- HSequenceOfShape from TopTools,
- Presentation from Prs3d,
- Drawer from Prs3d,
- Length from Quantity
-
-is
- Add(myclass; aPresentation: Presentation from Prs3d;
- aShape : Shape from TopoDS;
- aDrawer : Drawer from Prs3d);
-
-
- PickCurve(myclass; X,Y,Z : Length from Quantity;
- aDistance : Length from Quantity;
- aShape : Shape from TopoDS;
- aDrawer : Drawer from Prs3d)
- returns HSequenceOfShape from TopTools;
-
-
- PickPatch(myclass; X,Y,Z : Length from Quantity;
- aDistance : Length from Quantity;
- aShape : Shape from TopoDS;
- aDrawer : Drawer from Prs3d)
- returns HSequenceOfShape from TopTools;
-
-
-end WFShape from Prs3d;
+++ /dev/null
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <Standard_ErrorHandler.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Prs3d_IsoAspect.hxx>
-#include <Prs3d_PointAspect.hxx>
-#include <Bnd_Box.hxx>
-#include <gp_Pnt.hxx>
-#include <Poly_Triangulation.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <Poly_Polygon3D.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <Prs3d_ShapeTool.hxx>
-#include <BRepAdaptor_HSurface.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Poly_Connect.hxx>
-
-#include <BRepBndLib.hxx>
-#include <Precision.hxx>
-#include <GCPnts_TangentialDeflection.hxx>
-#include <GCPnts_UniformDeflection.hxx>
-#include <gp_Circ.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS.hxx>
-
-#include <Prs3d_NListOfSequenceOfPnt.hxx>
-#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
-
-static Standard_Boolean IsSame(const Handle(Graphic3d_AspectLine3d)& UAspect,
- const Handle(Graphic3d_AspectLine3d)& VAspect)
-{
- Standard_Boolean same = Standard_True;
-
- Quantity_Color CU, CV;
- Aspect_TypeOfLine TlU, TlV;
- Standard_Real WU, WV;
-
- UAspect->Values(CU, TlU, WU);
- VAspect->Values(CV, TlV, WV);
-
- if (CU != CV || TlU != TlV || WU != WV) {
- same = Standard_False;
- }
-
- return same;
-}
-
-
-static Standard_Boolean AddPolygon(const TopoDS_Edge& E,
- Handle(Graphic3d_Group)& TheGroup,
- const Standard_Real deflection,
- const Handle (Prs3d_Drawer)& ,
- TColgp_SequenceOfPnt& Pnts)
-{
- TopLoc_Location l;
- Standard_Real fi, la;
- Handle(Geom_Curve) CC3d = BRep_Tool::Curve(E, fi, la);
- Handle(Poly_Polygon3D) Polyg = BRep_Tool::Polygon3D(E, l);
-
- if (!Polyg.IsNull()) {
- if ((Polyg->Deflection() <= deflection) || CC3d.IsNull()) {
- const TColgp_Array1OfPnt& Points = Polyg->Nodes();
- Standard_Integer po = Points.Lower();
- if (l.IsIdentity()) {
- for (; po <= Points.Upper(); po++)
- Pnts.Append(Points.Value(po));
- }
- else {
- for (; po <= Points.Upper(); po++)
- Pnts.Append(Points.Value(po).Transformed(l));
- }
- return Standard_True;
- }
- }
-
- Handle(Poly_Triangulation) Tr;
- Handle(Poly_PolygonOnTriangulation) HIndices;
- BRep_Tool::PolygonOnTriangulation(E, HIndices, Tr, l);
- if (!HIndices.IsNull()) {
- if ((HIndices->Deflection() <= deflection) || CC3d.IsNull()) {
- const TColStd_Array1OfInteger& Indices = HIndices->Nodes();
- const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
-
- Standard_Integer po = Indices.Lower();
- if (l.IsIdentity()) {
- for (; po <= Indices.Upper(); po++)
- Pnts.Append(Nodes(Indices(po)));
- }
- else {
- for (; po <= Indices.Upper(); po++)
- Pnts.Append(Nodes(Indices(po)).Transformed(l));
- }
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
-
-//=========================================================================
-// function: Add
-// purpose
-//=========================================================================
-void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
- const TopoDS_Shape& aShape,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- if (aShape.IsNull()) return;
-
- Prs3d_ShapeTool Tool(aShape);
- TopTools_ListOfShape LFree, LUnFree, LWire;
- for (Tool.InitCurve();Tool.MoreCurve();Tool.NextCurve())
- {
- const TopoDS_Edge& E = Tool.GetCurve();
- switch (Tool.Neighbours())
- {
- case 0: LWire.Append(E); break;
- case 1: LFree.Append(E); break;
- default: LUnFree.Append(E);
- }
- }
-
- Standard_Real aDeflection;
- if (aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
- {
- // On calcule la fleche en fonction des min max globaux de la piece:
- Bnd_Box B;
- BRepBndLib::Add(aShape, B);
- if ( ! B.IsVoid() )
- {
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- aDeflection = Max (aXmax-aXmin, Max (aYmax-aYmin, aZmax-aZmin)) *
- aDrawer->DeviationCoefficient();
- }
- else
- aDeflection = aDrawer->MaximalChordialDeviation();
- }
- else
- aDeflection = aDrawer->MaximalChordialDeviation();
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
-
- Prs3d_NListOfSequenceOfPnt UIsoCurves;
- Prs3d_NListOfSequenceOfPnt VIsoCurves;
- Prs3d_NListOfSequenceOfPnt WireCurves;
- Prs3d_NListOfSequenceOfPnt FreeCurves;
- Prs3d_NListOfSequenceOfPnt UnFreeCurves;
- TColgp_SequenceOfPnt ShapePoints;
-
- if (IsSame(aDrawer->UIsoAspect()->Aspect(), aDrawer->VIsoAspect()->Aspect()))
- {
- const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
- const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
- if (isoU || isoV)
- {
- BRepAdaptor_Surface S;
- for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
- {
- if (Tool.HasSurface())
- {
- if (!Tool.IsPlanarFace() || aDrawer->IsoOnPlane())
- {
- S.Initialize(Tool.GetFace());
- Handle(BRepAdaptor_HSurface) HS = new BRepAdaptor_HSurface(S);
- try {
- OCC_CATCH_SIGNALS
- Prs3d_NListOfSequenceOfPnt CurUIsoCurves;
- FacePresentation::Add(aPresentation, HS,
- isoU, isoV,
- aDeflection,
- isoU, isoV,
- aDrawer,
- CurUIsoCurves);
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(CurUIsoCurves); It.More(); It.Next())
- UIsoCurves.Append(It.Value());
- }
- catch (Standard_Failure)
- {
- }
- }
- }
- }
- }
- }
- else
- {
- const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
- const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
- if (isoU)
- {
- BRepAdaptor_Surface S;
- for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
- {
- if (Tool.HasSurface())
- {
- if (!Tool.IsPlanarFace() || aDrawer->IsoOnPlane())
- {
- S.Initialize(Tool.GetFace());
- Handle(BRepAdaptor_HSurface) HS = new BRepAdaptor_HSurface(S);
- try
- {
- OCC_CATCH_SIGNALS
- Prs3d_NListOfSequenceOfPnt CurUIsoCurves;
- FacePresentation::Add(aPresentation, HS,
- isoU, Standard_False,
- aDeflection,
- isoU, 0,
- aDrawer,
- CurUIsoCurves);
- }
- catch (Standard_Failure)
- {
-#ifdef DEB
- const TopoDS_Face& FF = S.Face();
- cout <<"probleme pour les isos de la face "<< (void*) &(*(FF).TShape()) << endl;
-#endif
- }
- }
- }
- }
- }
- if (isoV)
- {
- BRepAdaptor_Surface S;
- for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
- {
- if (Tool.HasSurface())
- {
- if (!Tool.IsPlanarFace() || aDrawer->IsoOnPlane())
- {
- S.Initialize(Tool.GetFace());
- Handle(BRepAdaptor_HSurface) HS = new BRepAdaptor_HSurface(S);
- try
- {
- OCC_CATCH_SIGNALS
- Prs3d_NListOfSequenceOfPnt CurUIsoCurves;
- FacePresentation::Add(aPresentation, HS,
- Standard_False, isoV,
- aDeflection,
- 0, isoV,
- aDrawer,
- CurUIsoCurves);
- }
- catch (Standard_Failure)
- {
-#ifdef DEB
- const TopoDS_Face& FF = S.Face();
- cout <<"probleme pour les isos de la face "<< (void*) &(*(FF).TShape()) << endl;
-#endif
- }
- }
- }
- }
- }
- }
- Standard_Integer nbVertices = 0, nbBounds = 0;
-
- if(UIsoCurves.Size() > 0) {
- nbBounds = UIsoCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(UIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(UIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- UIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- UIsoArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->AddPrimitiveArray(UIsoArray);
- }
-
- if(VIsoCurves.Size() > 0) {
- nbBounds = VIsoCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(VIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(VIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- VIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- VIsoArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
- TheGroup->AddPrimitiveArray(VIsoArray);
- }
-
- gp_Pnt P;
- TopLoc_Location l;
- Graphic3d_Vertex V1, V2;
- Standard_Integer i, j, n[3];
-
- Standard_Boolean DispTriangles = Standard_False;
- const char* var = getenv("DEBUG_TRIANGLES");
- if (var != 0L) {
- DispTriangles = (atol(var) != 0);
- }
-
- TColgp_SequenceOfPnt SurfPnts;
- for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
- {
- if (!Tool.HasSurface() || DispTriangles)
- {
- Handle(Poly_Triangulation) T = Tool.CurrentTriangulation(l);
- if (!T.IsNull())
- {
- const TColgp_Array1OfPnt& Nodes = T->Nodes();
- // Build the connect tool
- Poly_Connect pc(T);
-
- Standard_Integer nFree, nInternal, nbTriangles = T->NbTriangles();
- Standard_Integer t[3];
-
- // count the free edges
- nFree = 0;
- for (i = 1; i <= nbTriangles; i++) {
- pc.Triangles(i,t[0],t[1],t[2]);
- for (j = 0; j < 3; j++)
- if (t[j] == 0) nFree++;
- }
-
- // allocate the arrays
- TColStd_Array1OfInteger Free(1,2*nFree);
- nInternal = (3*nbTriangles - nFree) / 2;
- TColStd_Array1OfInteger Internal(0,2*nInternal);
-
- Standard_Integer fr = 1, in = 1;
- const Poly_Array1OfTriangle& triangles = T->Triangles();
- for (i = 1; i <= nbTriangles; i++) {
- pc.Triangles(i,t[0],t[1],t[2]);
- triangles(i).Get(n[0],n[1],n[2]);
- for (j = 0; j < 3; j++) {
- Standard_Integer k = (j+1) % 3;
- if (t[j] == 0) {
- Free(fr) = n[j];
- Free(fr+1) = n[k];
- fr += 2;
- }
- // internal edge if this triangle has a lower index than the adjacent
- else if (i < t[j]) {
- Internal(in) = n[j];
- Internal(in+1) = n[k];
- in += 2;
- }
- }
- }
-
- if(!Tool.HasSurface()) {
- // free edges
- Standard_Integer nn;
- nn = Free.Length() / 2;
- for (i = 1; i <= nn; i++) {
- gp_Pnt P1 = Nodes(Free(2*i-1)).Transformed(l);
- gp_Pnt P2 = Nodes(Free(2*i)).Transformed(l);
- SurfPnts.Append(P1);
- SurfPnts.Append(P2);
- }
- }
- if(DispTriangles) {
- for (i = 1; i <= nInternal; i++) {
- gp_Pnt P1 = Nodes(Internal(2*i-1)).Transformed(l);
- gp_Pnt P2 = Nodes(Internal(2*i)).Transformed(l);
- SurfPnts.Append(P1);
- SurfPnts.Append(P2);
- }
- }
- }
- }
- }
- if(SurfPnts.Length()>0){
- nbVertices = SurfPnts.Length();
- nbBounds = (Standard_Integer)nbVertices / 2;
- Handle(Graphic3d_ArrayOfPolylines) SurfArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for(i=1; i<=nbVertices; i+=2) {
- SurfArray->AddBound(2);
- SurfArray->AddVertex(SurfPnts.Value(i));
- SurfArray->AddVertex(SurfPnts.Value(i+1));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- if(DispTriangles && Tool.HasSurface())
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- else
- TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- TheGroup->AddPrimitiveArray(SurfArray);
- }
- TopTools_ListIteratorOfListOfShape It;
-
- if (aDrawer->WireDraw())
- {
- // Wire (without any neighbour)
- TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
- for (It.Initialize(LWire); It.More(); It.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(It.Value());
- try
- {
- OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt Pnts;
- if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
- if (BRep_Tool::IsGeometric(E)) {
- BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
- WireCurves.Append(Pnts);
- }
- }
- else
- WireCurves.Append(Pnts);
- }
- catch(Standard_Failure)
- {
-#ifdef DEB
- cout <<"probleme sur l'edge "<< (void*) &(*(E).TShape()) << endl;
-#endif
- }
- }
- }
-
- if (aDrawer->FreeBoundaryDraw())
- {
- // Free boundaries;
- for (It.Initialize(LFree); It.More(); It.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(It.Value());
- if (!BRep_Tool::Degenerated(E)) {
- try {
- OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt Pnts;
- if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
- if (BRep_Tool::IsGeometric(E)) {
- BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
- FreeCurves.Append(Pnts);
- }
- }
- else
- FreeCurves.Append(Pnts);
- }
- catch(Standard_Failure)
- {
-#ifdef DEB
- cout <<"probleme sur l'edge "<< (void*) &(*(E).TShape()) << endl;
-#endif
- }
- }
- }
- }
-
- if (aDrawer->UnFreeBoundaryDraw()) {
-
-// Unfree boundaries;
-
- for (It.Initialize(LUnFree); It.More(); It.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(It.Value());
- try
- {
- OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt Pnts;
- if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
- if (BRep_Tool::IsGeometric(E)) {
- BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
- UnFreeCurves.Append(Pnts);
- }
- }
- else
- UnFreeCurves.Append(Pnts);
- }
- catch(Standard_Failure)
- {
-#ifdef DEB
- cout <<"probleme sur l'edge "<< (void*) &(*(E).TShape()) << endl;
-#endif
- }
- }
- }
-
- if(WireCurves.Size() > 0) {
- nbBounds = WireCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(WireCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) WireArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(WireCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- WireArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- WireArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
- TheGroup->AddPrimitiveArray(WireArray);
- }
- if(FreeCurves.Size() > 0) {
- nbBounds = FreeCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(FreeCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) FreeArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(FreeCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- FreeArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- FreeArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- TheGroup->AddPrimitiveArray(FreeArray);
- }
- if(UnFreeCurves.Size() > 0) {
- nbBounds = UnFreeCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(UnFreeCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) UnFreeArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(UnFreeCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- UnFreeArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- UnFreeArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
- TheGroup->AddPrimitiveArray(UnFreeArray);
- }
-
- // Points
- for(Tool.InitVertex();Tool.MoreVertex();Tool.NextVertex())
- ShapePoints.Append(BRep_Tool::Pnt(Tool.GetVertex()));
-
- nbVertices = ShapePoints.Length();
- if(nbVertices > 0) {
- Graphic3d_Array1OfVertex PointArray(1, nbVertices);
- for(i=1; i<=nbVertices; i++)
- PointArray.SetValue(i, Graphic3d_Vertex(ShapePoints.Value(i).X(), ShapePoints.Value(i).Y(), ShapePoints.Value(i).Z()));
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
- TheGroup->MarkerSet(PointArray);
- }
-}
-
-
-
-
-//=========================================================================
-// function: PickCurve
-// purpose
-//=========================================================================
-Handle(TopTools_HSequenceOfShape) Prs3d_WFShape::PickCurve
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const TopoDS_Shape& aShape,
- const Handle (Prs3d_Drawer)& aDrawer)
-{
- Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape;
- Prs3d_ShapeTool Tool(aShape);
- Standard_Integer i;
- Standard_Boolean contain;
-
- for(Tool.InitCurve();Tool.MoreCurve();Tool.NextCurve()){
- Bnd_Box B = Tool.CurveBound();
- B.Enlarge(aDistance);
- if ( ! B.IsOut(gp_Pnt(X,Y,Z))) {
- if(CurvePresentation::Match(X,Y,Z,aDistance,BRepAdaptor_Curve(Tool.GetCurve()),aDrawer)) {
- contain = Standard_False;
- for (i = 1; i <= aSeq->Length(); i++) {
- if (aSeq->Value(i) == (Tool.GetCurve())) {
- contain = Standard_True;
- break;
- }
- }
- if (!contain) aSeq->Append(Tool.GetCurve());
- }
- }
- }
- return aSeq;
-}
-
-
-//=========================================================================
-// function: PickPatch
-// purpose
-//=========================================================================
-Handle(TopTools_HSequenceOfShape) Prs3d_WFShape::PickPatch
- (const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const TopoDS_Shape& aShape,
- const Handle(Prs3d_Drawer)& aDrawer) {
-
- Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape;
- Prs3d_ShapeTool Tool(aShape);
-
- Standard_Boolean rba1 = aDrawer->UIsoAspect()->Number() != 0;
- Standard_Boolean rba2 = aDrawer->VIsoAspect()->Number() != 0;
- Standard_Integer i, j;
- Standard_Boolean contain;
-
- if ( rba1 || rba2 ) {
- BRepAdaptor_Surface S;
- for(Tool.InitFace();Tool.MoreFace();Tool.NextFace()){
- Bnd_Box B = Tool.FaceBound();
- B.Enlarge(aDistance);
- if ( ! B.IsOut(gp_Pnt(X,Y,Z))) {
- S.Initialize(Tool.GetFace());
- Handle(BRepAdaptor_HSurface) HS = new BRepAdaptor_HSurface(S);
- if(FacePresentation::Match
- (X,Y,Z,aDistance, HS, aDrawer)){
- contain = Standard_False;
- for (i = 1; i <= aSeq->Length(); i++) {
- if (aSeq->Value(i) == (Tool.GetFace())) {
- contain = Standard_True;
- break;
- }
- }
- if (!contain) aSeq->Append(Tool.GetFace());
- }
- }
- }
- }
-
- for(Tool.InitCurve();Tool.MoreCurve();Tool.NextCurve()){
- Bnd_Box B = Tool.CurveBound();
- B.Enlarge(aDistance);
- if ( ! B.IsOut(gp_Pnt(X,Y,Z))) {
- if(CurvePresentation::Match(X,Y,Z,aDistance,BRepAdaptor_Curve(Tool.GetCurve()),aDrawer)) {
- Handle(TopTools_HSequenceOfShape) aS = Tool.FacesOfEdge();
- for (i=1; i<= aS->Length(); i ++) {
- contain = Standard_False;
- for (j = 1; j <= aSeq->Length(); j++) {
- if (aSeq->Value(j) == (aS->Value(i))) {
- contain = Standard_True;
- break;
- }
- }
- if (!contain) aSeq->Append(aS->Value(i));
- }
- }
- }
- }
- return aSeq;
-}
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _Prs3d_WFShape_H__
+#define _Prs3d_WFShape_H__
+
+#include <Bnd_Box.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <BRepBndLib.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <GCPnts_TangentialDeflection.hxx>
+#include <GCPnts_UniformDeflection.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Pnt.hxx>
+#include <Poly_Connect.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Poly_Array1OfTriangle.hxx>
+#include <Poly_Polygon3D.hxx>
+#include <Poly_PolygonOnTriangulation.hxx>
+#include <Precision.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_NListOfSequenceOfPnt.hxx>
+#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
+#include <Prs3d_ShapeTool.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+template <class FacePresentation, class CurvePresentation, class PointPresentation>
+class Prs3d_WFShape : Prs3d_Root
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+private:
+
+ //=========================================================================
+// function: IsSame
+// purpose
+//=========================================================================
+
+Standard_EXPORT static Standard_Boolean IsSame (const Handle(Graphic3d_AspectLine3d)& theUAspect,
+ const Handle(Graphic3d_AspectLine3d)& theVAspect)
+{
+ Standard_Boolean isSame = Standard_True;
+ Quantity_Color aCU, aCV;
+ Aspect_TypeOfLine aTlU, aTlV;
+ Standard_Real aWU, aWV;
+
+ theUAspect->Values(aCU, aTlU, aWU);
+ theVAspect->Values(aCV, aTlV, aWV);
+
+ if (aCU != aCV || aTlU != aTlV || aWU != aWV)
+ {
+ isSame = Standard_False;
+ }
+
+ return isSame;
+}
+
+//=========================================================================
+// function: AddPolygon
+// purpose
+//=========================================================================
+
+Standard_EXPORT static Standard_Boolean AddPolygon (const TopoDS_Edge& theEdge,
+ Handle(Graphic3d_Group)& theGroup,
+ const Standard_Real theDeflection,
+ const Handle (Prs3d_Drawer)& ,
+ TColgp_SequenceOfPnt& thePoints)
+{
+ TopLoc_Location aLocation;
+ Standard_Real aFirst, aLast;
+ Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve(theEdge, aFirst, aLast);
+ Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D(theEdge, aLocation);
+
+ if (!aPolygon.IsNull())
+ {
+ if ((aPolygon->Deflection() <= theDeflection) || aCurve3d.IsNull())
+ {
+ const TColgp_Array1OfPnt& aPoints = aPolygon->Nodes();
+ Standard_Integer anIndex = aPoints.Lower();
+ if (aLocation.IsIdentity())
+ {
+ for (; anIndex <= aPoints.Upper(); anIndex++)
+ thePoints.Append(aPoints.Value(anIndex));
+ }
+ else
+ {
+ for (; anIndex <= aPoints.Upper(); anIndex++)
+ thePoints.Append(aPoints.Value(anIndex).Transformed(aLocation));
+ }
+ return Standard_True;
+ }
+ }
+
+ Handle(Poly_Triangulation) aTriangulation;
+ Handle(Poly_PolygonOnTriangulation) aHIndices;
+ BRep_Tool::PolygonOnTriangulation(theEdge, aHIndices, aTriangulation, aLocation);
+ if (!aHIndices.IsNull())
+ {
+ if ((aHIndices->Deflection() <= theDeflection) || aCurve3d.IsNull())
+ {
+ const TColStd_Array1OfInteger& anIndices = aHIndices->Nodes();
+ const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
+
+ Standard_Integer anIndex = anIndices.Lower();
+ if (aLocation.IsIdentity())
+ {
+ for (; anIndex <= anIndices.Upper(); anIndex++)
+ thePoints.Append(aNodes(anIndices(anIndex)));
+ }
+ else
+ {
+ for (; anIndex <= anIndices.Upper(); anIndex++)
+ thePoints.Append(aNodes(anIndices(anIndex)).Transformed(aLocation));
+ }
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+public:
+
+//=========================================================================
+// function: Add
+// purpose
+//=========================================================================
+
+Standard_EXPORT static void Add (const Handle (Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theShape,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ if (theShape.IsNull()) return;
+
+ Prs3d_ShapeTool aTool(theShape);
+ TopTools_ListOfShape aLFree, aLUnFree, aLWire;
+ for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
+ {
+ const TopoDS_Edge& anEdge = aTool.GetCurve();
+ switch (aTool.Neighbours())
+ {
+ case 0: aLWire.Append(anEdge); break;
+ case 1: aLFree.Append(anEdge); break;
+ default: aLUnFree.Append(anEdge);
+ }
+ }
+
+ Standard_Real aDeflection;
+ if (theDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
+ {
+ // The arrow calculation is based on the global min max
+ Bnd_Box aBndBox;
+ BRepBndLib::Add(theShape, aBndBox);
+ if (! aBndBox.IsVoid())
+ {
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ aBndBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ aDeflection = Max (aXmax-aXmin, Max (aYmax-aYmin, aZmax-aZmin)) *
+ theDrawer->DeviationCoefficient();
+ }
+ else
+ aDeflection = theDrawer->MaximalChordialDeviation();
+ }
+ else
+ aDeflection = theDrawer->MaximalChordialDeviation();
+
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
+
+ Prs3d_NListOfSequenceOfPnt anUIsoCurves;
+ Prs3d_NListOfSequenceOfPnt aVIsoCurves;
+ Prs3d_NListOfSequenceOfPnt aWireCurves;
+ Prs3d_NListOfSequenceOfPnt aFreeCurves;
+ Prs3d_NListOfSequenceOfPnt anUnFreeCurves;
+ TColgp_SequenceOfPnt aShapePoints;
+
+ if (IsSame(theDrawer->UIsoAspect()->Aspect(), theDrawer->VIsoAspect()->Aspect()))
+ {
+ const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
+ const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
+ if (anIsoU || anIsoV)
+ {
+ BRepAdaptor_Surface aSurface;
+ for (aTool.InitFace();aTool.MoreFace();aTool.NextFace())
+ {
+ if (aTool.HasSurface())
+ {
+ if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
+ {
+ aSurface.Initialize(aTool.GetFace());
+ Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface(aSurface);
+ try {
+ OCC_CATCH_SIGNALS
+ Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
+ FacePresentation::Add(thePresentation, aHSurface,
+ anIsoU, anIsoV,
+ aDeflection,
+ anIsoU, anIsoV,
+ theDrawer,
+ aCurUIsoCurves);
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(aCurUIsoCurves); anIt.More(); anIt.Next())
+ anUIsoCurves.Append(anIt.Value());
+ }
+ catch (Standard_Failure)
+ {
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
+ const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
+ if (anIsoU)
+ {
+ BRepAdaptor_Surface aSurface;
+ for (aTool.InitFace();aTool.MoreFace();aTool.NextFace())
+ {
+ if (aTool.HasSurface())
+ {
+ if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
+ {
+ aSurface.Initialize(aTool.GetFace());
+ Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface(aSurface);
+ try
+ {
+ OCC_CATCH_SIGNALS
+ Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
+ FacePresentation::Add(thePresentation, aHSurface,
+ anIsoU, Standard_False,
+ aDeflection,
+ anIsoU, 0,
+ theDrawer,
+ aCurUIsoCurves);
+ }
+ catch (Standard_Failure)
+ {
+#ifdef DEB
+ const TopoDS_Face& aFace = aSurface.Face();
+ cout <<"Problem with the face "<< (void*) &(*(aFace).TShape()) << endl;
+#endif
+ }
+ }
+ }
+ }
+ }
+ if (anIsoV)
+ {
+ BRepAdaptor_Surface aSurface;
+ for (aTool.InitFace();aTool.MoreFace();aTool.NextFace())
+ {
+ if (aTool.HasSurface())
+ {
+ if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
+ {
+ aSurface.Initialize(aTool.GetFace());
+ Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface(aSurface);
+ try
+ {
+ OCC_CATCH_SIGNALS
+ Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
+ FacePresentation::Add(thePresentation, aHSurface,
+ Standard_False, anIsoV,
+ aDeflection,
+ 0, anIsoV,
+ theDrawer,
+ aCurUIsoCurves);
+ }
+ catch (Standard_Failure)
+ {
+#ifdef DEB
+ const TopoDS_Face& aFace = aSurface.Face();
+ cout <<"Problem with the face "<< (void*) &(*(aFace).TShape()) << endl;
+#endif
+ }
+ }
+ }
+ }
+ }
+ }
+ Standard_Integer aNbVertices = 0, aNbBounds = 0;
+
+ if(anUIsoCurves.Size() > 0) {
+ aNbBounds = anUIsoCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(anUIsoCurves); anIt.More(); anIt.Next())
+ aNbVertices += anIt.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) anUIsoArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for( anIt.Init(anUIsoCurves); anIt.More(); anIt.Next()) {
+ TColgp_SequenceOfPnt aPoints;
+ aPoints.Assign(anIt.Value());
+ anUIsoArray->AddBound(aPoints.Length());
+ for(Standard_Integer anI = 1; anI <= aPoints.Length(); ++anI)
+ anUIsoArray->AddVertex(aPoints.Value(anI));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->UIsoAspect()->Aspect());
+ aGroup->AddPrimitiveArray(anUIsoArray);
+ }
+
+ if(aVIsoCurves.Size() > 0) {
+ aNbBounds = aVIsoCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(aVIsoCurves); anIt.More(); anIt.Next())
+ aNbVertices += anIt.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for( anIt.Init(aVIsoCurves); anIt.More(); anIt.Next()) {
+ TColgp_SequenceOfPnt aPoints;
+ aPoints.Assign(anIt.Value());
+ VIsoArray->AddBound(aPoints.Length());
+ for(int anI=1; anI<=aPoints.Length(); anI++)
+ VIsoArray->AddVertex(aPoints.Value(anI));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->VIsoAspect()->Aspect());
+ aGroup->AddPrimitiveArray(VIsoArray);
+ }
+
+ TopLoc_Location aLocation;
+ Standard_Integer anI, aJ, aN[3];
+
+ Standard_Boolean isDispTriangles = Standard_False;
+ const char* anEnvVar = getenv("DEBUG_TRIANGLES");
+ if (anEnvVar != 0L) {
+ isDispTriangles = (atol(anEnvVar) != 0);
+ }
+
+ TColgp_SequenceOfPnt aSurfPoints;
+ for (aTool.InitFace();aTool.MoreFace();aTool.NextFace())
+ {
+ if (!aTool.HasSurface() || isDispTriangles)
+ {
+ Handle(Poly_Triangulation) T = aTool.CurrentTriangulation(aLocation);
+ if (!T.IsNull())
+ {
+ const TColgp_Array1OfPnt& aNodes = T->Nodes();
+ // Build the connect tool
+ Poly_Connect aPolyConnect(T);
+
+ Standard_Integer aNbFree, aNbInternal, aNbTriangles = T->NbTriangles();
+ Standard_Integer aT[3];
+
+ // Count the free edges
+ aNbFree = 0;
+ for (anI = 1; anI <= aNbTriangles; anI++) {
+ aPolyConnect.Triangles(anI,aT[0],aT[1],aT[2]);
+ for (aJ = 0; aJ < 3; aJ++)
+ if (aT[aJ] == 0) aNbFree++;
+ }
+
+ // Allocate the arrays
+ TColStd_Array1OfInteger aFree(1,2*aNbFree);
+ aNbInternal = (3*aNbTriangles - aNbFree) / 2;
+ TColStd_Array1OfInteger anInternal(0,2*aNbInternal);
+
+ Standard_Integer aFreeIndex = 1, anIntIndex = 1;
+ const Poly_Array1OfTriangle& aTriangles = T->Triangles();
+ for (anI = 1; anI <= aNbTriangles; anI++) {
+ aPolyConnect.Triangles(anI,aT[0],aT[1],aT[2]);
+ aTriangles(anI).Get(aN[0],aN[1],aN[2]);
+ for (aJ = 0; aJ < 3; aJ++) {
+ Standard_Integer k = (aJ+1) % 3;
+ if (aT[aJ] == 0) {
+ aFree(aFreeIndex) = aN[aJ];
+ aFree(aFreeIndex+1) = aN[k];
+ aFreeIndex += 2;
+ }
+ // internal edge if this triangle has a lower index than the adjacent
+ else if (anI < aT[aJ]) {
+ anInternal(anIntIndex) = aN[aJ];
+ anInternal(anIntIndex+1) = aN[k];
+ anIntIndex += 2;
+ }
+ }
+ }
+
+ if(!aTool.HasSurface())
+ {
+ // free edges
+ Standard_Integer aFreeHalfNb = aFree.Length() / 2;
+ for (anI = 1; anI <= aFreeHalfNb; anI++) {
+ gp_Pnt aPoint1 = aNodes(aFree(2*anI-1)).Transformed(aLocation);
+ gp_Pnt aPoint2 = aNodes(aFree(2*anI)).Transformed(aLocation);
+ aSurfPoints.Append(aPoint1);
+ aSurfPoints.Append(aPoint2);
+ }
+ }
+ if(isDispTriangles)
+ {
+ for (anI = 1; anI <= aNbInternal; anI++) {
+ gp_Pnt aPoint1 = aNodes(anInternal(2*anI-1)).Transformed(aLocation);
+ gp_Pnt aPoint2 = aNodes(anInternal(2*anI)).Transformed(aLocation);
+ aSurfPoints.Append(aPoint1);
+ aSurfPoints.Append(aPoint2);
+ }
+ }
+ }
+ }
+ }
+ if(aSurfPoints.Length()>0){
+ aNbVertices = aSurfPoints.Length();
+ aNbBounds = (Standard_Integer)aNbVertices / 2;
+ Handle(Graphic3d_ArrayOfPolylines) aSurfArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for(anI=1; anI<=aNbVertices; anI+=2) {
+ aSurfArray->AddBound(2);
+ aSurfArray->AddVertex(aSurfPoints.Value(anI));
+ aSurfArray->AddVertex(aSurfPoints.Value(anI+1));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ if(isDispTriangles && aTool.HasSurface())
+ aGroup->SetPrimitivesAspect(theDrawer->UIsoAspect()->Aspect());
+ else
+ aGroup->SetPrimitivesAspect(theDrawer->FreeBoundaryAspect()->Aspect());
+ aGroup->AddPrimitiveArray(aSurfArray);
+ }
+ TopTools_ListIteratorOfListOfShape anIt;
+
+ if (theDrawer->WireDraw())
+ {
+ // Wire (without any neighbour)
+ aGroup->SetPrimitivesAspect(theDrawer->WireAspect()->Aspect());
+ for (anIt.Initialize(aLWire); anIt.More(); anIt.Next()) {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(anIt.Value());
+ try
+ {
+ OCC_CATCH_SIGNALS
+ TColgp_SequenceOfPnt aPoints;
+ if (!AddPolygon(anEdge, aGroup, aDeflection, theDrawer, aPoints))
+ {
+ if (BRep_Tool::IsGeometric(anEdge))
+ {
+ BRepAdaptor_Curve aCurve(anEdge);
+ CurvePresentation::Add(thePresentation, aCurve, aDeflection, theDrawer,
+ aPoints, Standard_False);
+ aWireCurves.Append(aPoints);
+ }
+ }
+ else
+ aWireCurves.Append(aPoints);
+ }
+ catch(Standard_Failure)
+ {
+#ifdef DEB
+ cout <<"probleme sur aLocation'edge "<< (void*) &(*(anEdge).TShape()) << endl;
+#endif
+ }
+ }
+ }
+
+ if (theDrawer->FreeBoundaryDraw())
+ {
+ // aFree boundaries;
+ for (anIt.Initialize(aLFree); anIt.More(); anIt.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(anIt.Value());
+ if (!BRep_Tool::Degenerated(anEdge))
+ {
+ try {
+ OCC_CATCH_SIGNALS
+ TColgp_SequenceOfPnt aPoints;
+ if (!AddPolygon(anEdge, aGroup, aDeflection, theDrawer, aPoints)) {
+ if (BRep_Tool::IsGeometric(anEdge)) {
+ BRepAdaptor_Curve aCurve(anEdge);
+ CurvePresentation::Add(thePresentation, aCurve, aDeflection, theDrawer,
+ aPoints, Standard_False);
+ aFreeCurves.Append(aPoints);
+ }
+ }
+ else
+ aFreeCurves.Append(aPoints);
+ }
+ catch(Standard_Failure)
+ {
+#ifdef DEB
+ cout <<"probleme sur aLocation'edge "<< (void*) &(*(anEdge).TShape()) << endl;
+#endif
+ }
+ }
+ }
+ }
+
+ if (theDrawer->UnFreeBoundaryDraw())
+ {
+ // Unfree boundaries;
+
+ for (anIt.Initialize(aLUnFree); anIt.More(); anIt.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(anIt.Value());
+ try
+ {
+ OCC_CATCH_SIGNALS
+ TColgp_SequenceOfPnt aPoints;
+ if (!AddPolygon(anEdge, aGroup, aDeflection, theDrawer, aPoints)) {
+ if (BRep_Tool::IsGeometric(anEdge)) {
+ BRepAdaptor_Curve aCurve(anEdge);
+ CurvePresentation::Add(thePresentation, aCurve, aDeflection, theDrawer, aPoints, Standard_False);
+ anUnFreeCurves.Append(aPoints);
+ }
+ }
+ else
+ anUnFreeCurves.Append(aPoints);
+ }
+ catch(Standard_Failure)
+ {
+#ifdef DEB
+ cout <<"probleme sur aLocation'edge "<< (void*) &(*(anEdge).TShape()) << endl;
+#endif
+ }
+ }
+ }
+
+ if(aWireCurves.Size() > 0)
+ {
+ aNbBounds = aWireCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(aWireCurves); anIt.More(); anIt.Next())
+ aNbVertices += anIt.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) WireArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for( anIt.Init(aWireCurves); anIt.More(); anIt.Next()) {
+ TColgp_SequenceOfPnt aPoints;
+ aPoints.Assign(anIt.Value());
+ WireArray->AddBound(aPoints.Length());
+ for(anI=1; anI<=aPoints.Length(); ++anI)
+ WireArray->AddVertex(aPoints.Value(anI));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->WireAspect()->Aspect());
+ aGroup->AddPrimitiveArray(WireArray);
+ }
+ if(aFreeCurves.Size() > 0) {
+ aNbBounds = aFreeCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(aFreeCurves); anIt.More(); anIt.Next())
+ aNbVertices += anIt.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) aFreeArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for( anIt.Init(aFreeCurves); anIt.More(); anIt.Next()) {
+ TColgp_SequenceOfPnt aPoints;
+ aPoints.Assign(anIt.Value());
+ aFreeArray->AddBound(aPoints.Length());
+ for(anI=1; anI<=aPoints.Length(); anI++)
+ aFreeArray->AddVertex(aPoints.Value(anI));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->FreeBoundaryAspect()->Aspect());
+ aGroup->AddPrimitiveArray(aFreeArray);
+ }
+ if(anUnFreeCurves.Size() > 0) {
+ aNbBounds = anUnFreeCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
+ for( anIt.Init(anUnFreeCurves); anIt.More(); anIt.Next())
+ aNbVertices += anIt.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray =
+ new Graphic3d_ArrayOfPolylines(aNbVertices,aNbBounds);
+ for( anIt.Init(anUnFreeCurves); anIt.More(); anIt.Next()) {
+ TColgp_SequenceOfPnt aPoints;
+ aPoints.Assign(anIt.Value());
+ anUnFreeArray->AddBound(aPoints.Length());
+ for(anI=1; anI<=aPoints.Length(); anI++)
+ anUnFreeArray->AddVertex(aPoints.Value(anI));
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->UnFreeBoundaryAspect()->Aspect());
+ aGroup->AddPrimitiveArray(anUnFreeArray);
+ }
+
+ // Points
+ for(aTool.InitVertex();aTool.MoreVertex();aTool.NextVertex())
+ aShapePoints.Append(BRep_Tool::Pnt(aTool.GetVertex()));
+
+ aNbVertices = aShapePoints.Length();
+ if(aNbVertices > 0) {
+ Graphic3d_Array1OfVertex aPointArray(1, aNbVertices);
+ for(anI=1; anI<=aNbVertices; anI++)
+ aPointArray.SetValue(anI, Graphic3d_Vertex(aShapePoints.Value(anI).X(), aShapePoints.Value(anI).Y(), aShapePoints.Value(anI).Z()));
+
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
+ aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
+ aGroup->MarkerSet(aPointArray);
+ }
+}
+
+//=========================================================================
+// function: PickCurve
+// purpose
+//=========================================================================
+
+Standard_EXPORT static Handle(TopTools_HSequenceOfShape) PickCurve
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const TopoDS_Shape& theShape,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape;
+ Prs3d_ShapeTool aTool(theShape);
+ Standard_Boolean isContain;
+
+ for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
+ {
+ Bnd_Box aBndBox = aTool.CurveBound();
+ aBndBox.Enlarge(theDistance);
+ if (! aBndBox.IsOut(gp_Pnt(theX, theY, theZ)))
+ {
+ if (CurvePresentation::Match(theX, theY, theZ, theDistance,
+ BRepAdaptor_Curve(aTool.GetCurve()), theDrawer))
+ {
+ isContain = Standard_False;
+ for (Standard_Integer anI = 1; anI <= aSeq->Length(); ++anI)
+ {
+ if (aSeq->Value(anI) == (aTool.GetCurve()))
+ {
+ isContain = Standard_True;
+ break;
+ }
+ }
+ if (!isContain) aSeq->Append(aTool.GetCurve());
+ }
+ }
+ }
+ return aSeq;
+}
+
+
+//=========================================================================
+// function: PickPatch
+// purpose
+//=========================================================================
+
+Standard_EXPORT static Handle(TopTools_HSequenceOfShape) PickPatch
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer)
+{
+
+ Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape;
+ Prs3d_ShapeTool aTool(theShape);
+
+ Standard_Boolean aRba1 = theDrawer->UIsoAspect()->Number() != 0;
+ Standard_Boolean aRba2 = theDrawer->VIsoAspect()->Number() != 0;
+ Standard_Boolean isContain;
+
+ if (aRba1 || aRba2)
+ {
+ BRepAdaptor_Surface aSurface;
+ for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
+ {
+ Bnd_Box aBndBox = aTool.FaceBound();
+ aBndBox.Enlarge(theDistance);
+ if (!aBndBox.IsOut(gp_Pnt(theX, theY, theZ)))
+ {
+ aSurface.Initialize(aTool.GetFace());
+ Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface(aSurface);
+ if (FacePresentation::Match(theX, theY, theZ, theDistance, aHSurface, theDrawer))
+ {
+ isContain = Standard_False;
+ for (Standard_Integer anI = 1; anI <= aSeq->Length(); ++anI)
+ {
+ if (aSeq->Value(anI) == (aTool.GetFace()))
+ {
+ isContain = Standard_True;
+ break;
+ }
+ }
+ if (!isContain)
+ aSeq->Append(aTool.GetFace());
+ }
+ }
+ }
+ }
+
+ for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
+ {
+ Bnd_Box aBndBox = aTool.CurveBound();
+ aBndBox.Enlarge(theDistance);
+ if (!aBndBox.IsOut(gp_Pnt(theX, theY, theZ)))
+ {
+ if(CurvePresentation::Match(theX, theY, theZ, theDistance,
+ BRepAdaptor_Curve(aTool.GetCurve()), theDrawer))
+ {
+ Handle(TopTools_HSequenceOfShape) aSurface = aTool.FacesOfEdge();
+ for (Standard_Integer anI = 1; anI <= aSurface->Length(); ++anI)
+ {
+ isContain = Standard_False;
+ for (Standard_Integer aJ = 1; aJ <= aSeq->Length(); ++aJ)
+ {
+ if (aSeq->Value(aJ) == (aSurface->Value(anI)))
+ {
+ isContain = Standard_True;
+ break;
+ }
+ }
+ if (!isContain)
+ aSeq->Append(aSurface->Value(anI));
+ }
+ }
+ }
+ }
+ return aSeq;
+}
+
+};
+
+#endif
--- /dev/null
+StdPrs_HLRShape.hxx
+StdPrs_HLRShape.cxx
+StdPrs_Point.hxx
+StdPrs_Vertex.hxx
+StdPrs_WFDeflectionShape.hxx
+StdPrs_WFRestrictedFace.hxx
+StdPrs_WFRestrictedFace.cxx
+StdPrs_WFShape.hxx
\ No newline at end of file
-- modes such as wireframe, shading or hidden line removal mode.
uses
- Prs3d,
+ Prs3d,
Geom,
Geom2d,
Adaptor3d,
Adaptor2d,
- GeomAdaptor,
+ GeomAdaptor,
Geom2dAdaptor,
- BRepAdaptor,
+ BRepAdaptor,
TopTools,
TopoDS,
TopExp,
- TopAbs,
+ TopAbs,
BRepTools,
Bnd,
- TColStd,
- HLRAlgo,
- HLRBRep,
- Quantity,
+ TColStd,
+ HLRAlgo,
+ HLRBRep,
+ Quantity,
BRepMesh,
gp,
TColgp,
class ToolVertex;
class ToolRFace;
class HLRToolShape;
- --class ToolSectionShape;
class ToolShadedShape;
class ShadedShape;
-
-
- class Point
- instantiates Point from Prs3d(Point from Geom, ToolPoint from StdPrs);
-
- class Vertex
- instantiates Point from Prs3d(Vertex from TopoDS, ToolVertex from StdPrs);
-
+
class PoleCurve;
---Purpose: computes the presentation of curves by drawing
-- a broken line linking the poles of the curve.
-----------------------------------------------
class WFDeflectionRestrictedFace;
-
-
- class WFDeflectionShape instantiates WFShape from Prs3d
- (WFDeflectionRestrictedFace from StdPrs,
- DeflectionCurve from StdPrs,
- Vertex from StdPrs);
-
+ ---Purpose: computes the wireframe presentation of faces with
+ -- restrictions by displaying a given number of U and/or
+ -- V isoparametric curves. The isoparametric curves are
+ -- drawn with respect to a maximal chordial deviation.
+ -- The presentation includes the restriction curves.
- -----------------------------------------------
- --- Instantiations whith no deflection drawing.
- -----------------------------------------------
-
class Curve;
---Purpose: computes the presentation of objects to be
-- seen as curves. The computation will be made
-- by displaying a given number of U and/or V isoparametric
--- curves. The isoparametric curves are drawn with respect
-- to a given number of points.
-
-
- class WFRestrictedFace instantiates WFRestrictedFace from Prs3d
- (Curve from StdPrs,
- ToolRFace from StdPrs);
-
-
- class WFShape instantiates WFShape from Prs3d
- (WFRestrictedFace from StdPrs,
- Curve from StdPrs,
- Vertex from StdPrs);
-
- class HLRShape instantiates HLRShape from Prs3d
- (Shape from TopoDS,
- HLRToolShape from StdPrs,
- Curve from BRepAdaptor,
- DeflectionCurve from StdPrs);
- class HLRPolyShape;
+
+ ---Category: Hidden lines removal algorithms.
+
+ class HLRPolyShape;
+ ---Purpose: computes the presentation of objects with
+ -- removal of their hidden lines for a specific
+ -- projector. The polygonal algorithm is used.
+
+ imported HLRShape;
+ ---Purpose: computes the presentation of objects with
+ -- removal of their hidden lines for a specific
+ -- projector. The exact algorithm is used.
- imported NListOfSequenceOfPnt from Prs3d;
- imported NListIteratorOfListOfSequenceOfPnt from Prs3d;
-
+ imported NListOfSequenceOfPnt from Prs3d;
+ imported NListIteratorOfListOfSequenceOfPnt from Prs3d;
+
+ imported WFShape;
+ imported WFDeflectionShape;
+ ---Purpose: computes the wireframe presentation of surfaces
+ -- by displaying planar sections.
+ imported Vertex;
+ imported Point;
+ ---Purpose: computes the presentation of objects to be
+ -- seen as points.
+ imported WFRestrictedFace;
+ ---Purpose: Computes the wireframe presentation of faces with
+ -- restrictions by displaying a given number of U and/or
+ -- V isoparametric curves. The isoparametric curves are
+ -- drawn with a fixed number of points.
+ -- The presentation includes the restriction curves.
end StdPrs;
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#include <BRepAdaptor_Curve.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <StdPrs_HLRShape.hxx>
+#include <StdPrs_HLRToolShape.hxx>
+#include <StdPrs_DeflectionCurve.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+
+void StdPrs_HLRShape::Add (const Handle(Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ const Handle(Prs3d_Projector)& theProjector)
+{
+ StdPrs_HLRToolShape aTool(theShape, theProjector->Projector());
+ Standard_Integer aNbEdges = aTool.NbEdges();
+ Standard_Integer anI;
+ Standard_Real anU1, anU2;
+ BRepAdaptor_Curve aCurve;
+ Standard_Real aDeviation = theDrawer->MaximalChordialDeviation();
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
+
+ aGroup->SetPrimitivesAspect(theDrawer->SeenLineAspect()->Aspect());
+
+ Standard_Real anAngle = theDrawer->DeviationAngle();
+ TColgp_SequenceOfPnt aPoints;
+ for (anI = 1; anI <= aNbEdges; ++anI)
+ {
+ for(aTool.InitVisible(anI); aTool.MoreVisible(); aTool.NextVisible())
+ {
+ aTool.Visible(aCurve, anU1, anU2);
+ StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
+ anU1, anU2, aDeviation, aPoints, anAngle);
+ }
+ }
+
+ if(theDrawer->DrawHiddenLine())
+ {
+ aGroup->SetPrimitivesAspect(theDrawer->HiddenLineAspect()->Aspect());
+
+ for (anI = 1; anI <= aNbEdges; ++anI)
+ {
+ for (aTool.InitHidden(anI); aTool.MoreHidden(); aTool.NextHidden())
+ {
+ aTool.Hidden(aCurve, anU1, anU2);
+ StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
+ anU1, anU2, aDeviation, aPoints, anAngle);
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+#ifndef _StdPrs_HLRFace_H__
+#define _StdPrs_HLRFace_H__
+
+#include <Prs3d_Root.hxx>
+#include <Handle_Prs3d_Presentation.hxx>
+#include <Handle_Prs3d_Drawer.hxx>
+#include <Handle_Prs3d_Projector.hxx>
+
+class StdPrs_HLRShape: public Prs3d_Root
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ Standard_EXPORT static void Add
+ (const Handle(Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ const Handle(Prs3d_Projector)& theProjector);
+
+};
+#endif
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _StdPrs_Point_H__
+#define _StdPrs_Point_H__
+
+#include <Geom_Point.hxx>
+#include <Prs3d_Point.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <StdPrs_ToolPoint.hxx>
+
+typedef Prs3d_Point<Handle(Geom_Point), StdPrs_ToolPoint> StdPrs_Point;
+#endif
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _StdPrs_Vertex_H__
+#define _StdPrs_Vertex_H__
+
+#include <Prs3d_Point.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <StdPrs_ToolVertex.hxx>
+#include <Prs3d_Presentation.hxx>
+
+typedef Prs3d_Point<TopoDS_Vertex, StdPrs_ToolVertex> StdPrs_Vertex;
+#endif
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _StdPrs_WFDeflectionShape_H__
+#define _StdPrs_WFDeflectionShape_H__
+
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_WFShape.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Root.hxx>
+#include <StdPrs_WFDeflectionRestrictedFace.hxx>
+#include <StdPrs_DeflectionCurve.hxx>
+#include <StdPrs_Vertex.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+
+typedef Prs3d_WFShape <StdPrs_WFDeflectionRestrictedFace, StdPrs_DeflectionCurve, StdPrs_Vertex> StdPrs_WFDeflectionShape;
+#endif
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <Hatch_Hatcher.hxx>
+#include <Graphic3d_Group.hxx>
+#include <gp_Pnt.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <Adaptor3d_IsoCurve.hxx>
+#include <Bnd_Box2d.hxx>
+#include <BndLib_Add2dCurve.hxx>
+#include <Precision.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <GeomAbs_SurfaceType.hxx>
+#include <Geom_Surface.hxx>
+#include <StdPrs_WFRestrictedFace.hxx>
+#include <StdPrs_ToolRFace.hxx>
+#include <StdPrs_Curve.hxx>
+#include <Prs3d_NListOfSequenceOfPnt.hxx>
+
+//=========================================================================
+// function: Add
+// purpose
+//=========================================================================
+
+void StdPrs_WFRestrictedFace::Add
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Standard_Boolean theDrawUIso,
+ const Standard_Boolean theDrawVIso,
+ const Quantity_Length theDeflection,
+ const Standard_Integer theNbUIso,
+ const Standard_Integer theNBVIso,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ Prs3d_NListOfSequenceOfPnt& theCurves)
+{
+ Standard_Real aLimit = theDrawer->MaximalParameterValue();
+ Standard_Integer aNbPoints = theDrawer->Discretisation();
+ StdPrs_ToolRFace aToolRst (theFace);
+
+ // Compute bounds of the restriction
+ Standard_Real aUMin,aUMax,aVMin,aVMax;
+ Standard_Integer anI;
+ gp_Pnt2d aPoint1,aPoint2;
+ Bnd_Box2d aBndBox;
+
+ for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
+ {
+ Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
+ BndLib_Add2dCurve::Add(*aRCurve, Precision::PConfusion(), aBndBox);
+ }
+ if (!aBndBox.IsVoid())
+ aBndBox.Get(aUMin, aVMin, aUMax, aVMax);
+ else
+ { // No pcurves -- take natural bounds
+ aUMin = theFace->Surface().FirstUParameter();
+ aVMin = theFace->Surface().FirstVParameter();
+ aUMax = theFace->Surface().LastUParameter();
+ aVMax = theFace->Surface().LastVParameter();
+ }
+
+ // Load the isos
+ Hatch_Hatcher anIsoBuild(1.e-5,aToolRst.IsOriented());
+ Standard_Boolean isFaceUClosed = theFace->IsUClosed();
+ Standard_Boolean isFaceVClosed = theFace->IsVClosed();
+
+ if (!isFaceUClosed)
+ {
+ aUMin = aUMin + ( aUMax - aUMin) /1000.;
+ aUMax = aUMax - ( aUMax - aUMin) /1000.;
+ }
+
+ if (!isFaceVClosed)
+ {
+ aVMin = aVMin + ( aVMax - aVMin) /1000.;
+ aVMax = aVMax - ( aVMax - aVMin) /1000.;
+ }
+
+ if (theDrawUIso)
+ {
+ if (theNbUIso > 0)
+ {
+ isFaceUClosed = Standard_False;
+ Standard_Real du= isFaceUClosed ? (aUMax-aUMin)/theNbUIso : (aUMax-aUMin)/(1+theNbUIso);
+ for (anI=1; anI<=theNbUIso;anI++)
+ {
+ anIsoBuild.AddXLine(aUMin+du*anI);
+ }
+ }
+ }
+ if (theDrawVIso)
+ {
+ if (theNBVIso > 0)
+ {
+ isFaceVClosed = Standard_False;
+ Standard_Real dv= isFaceVClosed ?(aVMax-aVMin)/theNBVIso : (aVMax-aVMin)/(1+theNBVIso);
+ for (anI=1; anI<=theNBVIso;anI++)
+ {
+ anIsoBuild.AddYLine(aVMin+dv*anI);
+ }
+ }
+ }
+
+ // Trim the isos
+ Standard_Real anU1, anU2, anU, aDU;
+
+ for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
+ {
+ TopAbs_Orientation anOrientation = aToolRst.Orientation();
+ if (anOrientation == TopAbs_FORWARD || anOrientation == TopAbs_REVERSED)
+ {
+ Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
+ anU1 = aRCurve->FirstParameter();
+ anU2 = aRCurve->LastParameter();
+ if (aRCurve->GetType() != GeomAbs_Line)
+ {
+ aDU = (anU2-anU1)/(aNbPoints-1);
+ aPoint2 = aRCurve->Value(anU1);
+ for (anI = 2; anI <= aNbPoints; ++anI)
+ {
+ anU = anU1 + (anI-1)*aDU;
+ aPoint1 = aPoint2;
+ aPoint2 = aRCurve->Value(anU);
+ if(anOrientation == TopAbs_FORWARD )
+ anIsoBuild.Trim(aPoint1,aPoint2);
+ else
+ anIsoBuild.Trim(aPoint2,aPoint1);
+ }
+ }
+ else {
+ aPoint1 = aRCurve->Value(anU1);
+ aPoint2 = aRCurve->Value(anU2);
+ if(anOrientation == TopAbs_FORWARD )
+ anIsoBuild.Trim(aPoint1,aPoint2);
+ else
+ anIsoBuild.Trim(aPoint2,aPoint1);
+ }
+ }
+ }
+
+ // Draw the isos
+ Adaptor3d_IsoCurve anIsoCurve;
+ anIsoCurve.Load(theFace);
+ Handle(Geom_Curve) aBCurve;
+ const BRepAdaptor_Surface& aBSurface = *(BRepAdaptor_Surface*)&(theFace->Surface());
+ GeomAbs_SurfaceType aFaceType = theFace->GetType();
+
+ Standard_Integer aNbLines = anIsoBuild.NbLines();
+ Handle(Geom_Surface) aGeomBSurface;
+ if (aFaceType == GeomAbs_BezierSurface)
+ {
+ aGeomBSurface = aBSurface.Bezier();
+ }
+ else if (aFaceType == GeomAbs_BSplineSurface)
+ {
+ aGeomBSurface = aBSurface.BSpline();
+ }
+
+ for (anI = 1; anI <= aNbLines; ++anI)
+ {
+ Standard_Integer NumberOfIntervals = anIsoBuild.NbIntervals(anI);
+ Standard_Real anIsoCoord = anIsoBuild.Coordinate(anI);
+ for (Standard_Integer aJ = 1; aJ <= NumberOfIntervals; aJ++)
+ {
+ Standard_Real b1=anIsoBuild.Start(anI,aJ),b2=anIsoBuild.End(anI,aJ);
+
+ if(b1 == RealFirst() || b2 == RealLast())
+ continue;
+
+ TColgp_SequenceOfPnt aPoints;
+ if (!aGeomBSurface.IsNull())
+ {
+ if (anIsoBuild.IsXLine(anI))
+ aBCurve = aGeomBSurface->UIso(anIsoCoord);
+ else
+ aBCurve = aGeomBSurface->VIso(anIsoCoord);
+
+ //Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
+ //NbPoints = 30 - default parameter for computation of such curves
+ StdPrs_Curve::Add(thePresentation,GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection, aPoints, 30, Standard_False);
+ theCurves.Append(aPoints);
+ }
+ else
+ {
+ if (anIsoBuild.IsXLine(anI))
+ anIsoCurve.Load(GeomAbs_IsoU,anIsoCoord,b1,b2);
+ else
+ anIsoCurve.Load(GeomAbs_IsoV,anIsoCoord,b1,b2);
+ StdPrs_Curve::Add(thePresentation,anIsoCurve, theDeflection, theDrawer, aPoints, Standard_False);
+ theCurves.Append(aPoints);
+ }
+ }
+ }
+}
+
+
+//=========================================================================
+// function: Match
+// purpose
+//=========================================================================
+
+Standard_Boolean StdPrs_WFRestrictedFace::Match
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Standard_Boolean theDrawUIso,
+ const Standard_Boolean theDrawVIso,
+ const Quantity_Length theDeflection,
+ const Standard_Integer theNbUIso,
+ const Standard_Integer theNBVIso,
+ const Handle(Prs3d_Drawer)& theDrawer)
+{
+ Standard_Real aLimit = theDrawer->MaximalParameterValue();
+ Standard_Integer aNbPoints = theDrawer->Discretisation();
+ StdPrs_ToolRFace aToolRst (theFace);
+
+ // Compute bounds of the restriction
+ Standard_Real anUMin,anUMax,aVMin,aVMax;
+ Standard_Real anU,aV,aStep;
+ Standard_Integer anI,anNbP = 10;
+ anUMin = aVMin = RealLast();
+ anUMax = aVMax = RealFirst();
+ gp_Pnt2d aPoint1,aPoint2;
+
+ for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
+ {
+ Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
+ anU = aRCurve->FirstParameter();
+ aV = aRCurve->LastParameter();
+ if (aRCurve->GetType() != GeomAbs_Line)
+ {
+ aStep = ( aV - anU) / anNbP;
+ for (anI = 0; anI <= anNbP; ++anI)
+ {
+ gp_Pnt2d aRCurvePoint = aRCurve->Value(anU);
+ if (aRCurvePoint.X() < anUMin) anUMin = aRCurvePoint.X();
+ if (aRCurvePoint.X() > anUMax) anUMax = aRCurvePoint.X();
+ if (aRCurvePoint.Y() < aVMin) aVMin = aRCurvePoint.Y();
+ if (aRCurvePoint.Y() > aVMax) aVMax = aRCurvePoint.Y();
+ anU += aStep;
+ }
+ }
+ else
+ {
+ aPoint1 = aRCurve->Value(anU);
+ if (aPoint1.X() < anUMin) anUMin = aPoint1.X();
+ if (aPoint1.X() > anUMax) anUMax = aPoint1.X();
+ if (aPoint1.Y() < aVMin) aVMin = aPoint1.Y();
+ if (aPoint1.Y() > aVMax) aVMax = aPoint1.Y();
+
+ aPoint2 = aRCurve->Value(aV);
+ if (aPoint2.X() < anUMin) anUMin = aPoint2.X();
+ if (aPoint2.X() > anUMax) anUMax = aPoint2.X();
+ if (aPoint2.Y() < aVMin) aVMin = aPoint2.Y();
+ if (aPoint2.Y() > aVMax) aVMax = aPoint2.Y();
+ }
+ }
+
+ // Load the isos
+ Hatch_Hatcher anIsoBuild(1.e-5,aToolRst.IsOriented());
+ Standard_Boolean anUClosed = theFace->IsUClosed();
+ Standard_Boolean aVClosed = theFace->IsVClosed();
+
+ if ( ! anUClosed )
+ {
+ anUMin = anUMin + ( anUMax - anUMin) /1000.;
+ anUMax = anUMax - ( anUMax - anUMin) /1000.;
+ }
+
+ if ( ! aVClosed )
+ {
+ aVMin = aVMin + ( aVMax - aVMin) /1000.;
+ aVMax = aVMax - ( aVMax - aVMin) /1000.;
+ }
+
+ if (theDrawUIso)
+ {
+ if (theNbUIso > 0)
+ {
+ anUClosed = Standard_False;
+ Standard_Real du= anUClosed ? (anUMax-anUMin)/theNbUIso : (anUMax-anUMin)/(1+theNbUIso);
+ for (anI=1; anI<=theNbUIso;anI++){
+ anIsoBuild.AddXLine(anUMin+du*anI);
+ }
+ }
+ }
+ if (theDrawVIso){
+ if ( theNBVIso > 0) {
+ aVClosed = Standard_False;
+ Standard_Real dv= aVClosed ?(aVMax-aVMin)/theNBVIso : (aVMax-aVMin)/(1+theNBVIso);
+ for (anI=1; anI<=theNBVIso;anI++){
+ anIsoBuild.AddYLine(aVMin+dv*anI);
+ }
+ }
+ }
+
+ // Trim the isos
+ Standard_Real anU1, anU2, aDU;
+
+ for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
+ {
+ TopAbs_Orientation Orient = aToolRst.Orientation();
+ if (Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED)
+ {
+ Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
+ anU1 = aRCurve->FirstParameter();
+ anU2 = aRCurve->LastParameter();
+ if (aRCurve->GetType() != GeomAbs_Line) {
+ aDU = (anU2-anU1)/(aNbPoints-1);
+ aPoint2 = aRCurve->Value(anU1);
+ for (anI = 2; anI <= aNbPoints; anI++) {
+ anU = anU1 + (anI-1)*aDU;
+ aPoint1 = aPoint2;
+ aPoint2 = aRCurve->Value(anU);
+ if(Orient == TopAbs_FORWARD )
+ anIsoBuild.Trim(aPoint1,aPoint2);
+ else
+ anIsoBuild.Trim(aPoint2,aPoint1);
+ }
+ }
+ else {
+ aPoint1 = aRCurve->Value(anU1);
+ aPoint2 = aRCurve->Value(anU2);
+ if(Orient == TopAbs_FORWARD )
+ anIsoBuild.Trim(aPoint1,aPoint2);
+ else
+ anIsoBuild.Trim(aPoint2,aPoint1);
+ }
+ }
+ }
+
+ // Draw the isos
+
+ Adaptor3d_IsoCurve anIso;
+ anIso.Load(theFace);
+ Standard_Integer aNbLines = anIsoBuild.NbLines();
+
+ for (anI = 1; anI <= aNbLines; anI++)
+ {
+ Standard_Integer aNbIntervals = anIsoBuild.NbIntervals(anI);
+ Standard_Real aCoord = anIsoBuild.Coordinate(anI);
+ for (Standard_Integer j = 1; j <= aNbIntervals; j++)
+ {
+ Standard_Real anIsoStart=anIsoBuild.Start(anI,j),anIsoEnd=anIsoBuild.End(anI,j);
+
+ anIsoStart = anIsoStart == RealFirst() ? - aLimit : anIsoStart;
+ anIsoEnd = anIsoEnd == RealLast() ? aLimit : anIsoEnd;
+
+
+ if (anIsoBuild.IsXLine(anI))
+ anIso.Load(GeomAbs_IsoU,aCoord,anIsoStart,anIsoEnd);
+ else
+ anIso.Load(GeomAbs_IsoV,aCoord,anIsoStart,anIsoEnd);
+
+ if (StdPrs_Curve::Match(theX,theY,theZ,theDistance,anIso,
+ theDeflection, aLimit, aNbPoints))
+ return Standard_True;
+
+
+ }
+ }
+ return Standard_False;
+}
+
+
+//=========================================================================
+// function: Add
+// purpose
+//=========================================================================
+
+void StdPrs_WFRestrictedFace::Add
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ Prs3d_NListOfSequenceOfPnt aCurves;
+ StdPrs_WFRestrictedFace::Add (thePresentation,
+ theFace,
+ Standard_True,
+ Standard_True,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer,
+ aCurves);
+}
+
+
+//=========================================================================
+// function: AddUIso
+// purpose
+//=========================================================================
+
+void StdPrs_WFRestrictedFace::AddUIso
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ Prs3d_NListOfSequenceOfPnt aCurves;
+ StdPrs_WFRestrictedFace::Add (thePresentation,
+ theFace,
+ Standard_True,
+ Standard_False,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer,
+ aCurves);
+}
+
+
+//=========================================================================
+// function: AddVIso
+// purpose
+//=========================================================================
+
+void StdPrs_WFRestrictedFace::AddVIso
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ Prs3d_NListOfSequenceOfPnt aCurves;
+ StdPrs_WFRestrictedFace::Add (thePresentation,
+ theFace,
+ Standard_False,
+ Standard_True,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer,
+ aCurves);
+}
+
+
+//=========================================================================
+// function: Match
+// purpose
+//=========================================================================
+
+Standard_Boolean StdPrs_WFRestrictedFace::Match
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ return StdPrs_WFRestrictedFace::Match (
+ theX, theY, theZ, theDistance,
+ theFace,
+ Standard_True,
+ Standard_True,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer);
+}
+
+
+//=========================================================================
+// function: MatchUIso
+// purpose
+//=========================================================================
+
+Standard_Boolean StdPrs_WFRestrictedFace::MatchUIso
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ return StdPrs_WFRestrictedFace::Match (
+ theX, theY, theZ,theDistance,
+ theFace,
+ Standard_True,
+ Standard_False,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer);
+}
+
+
+//=========================================================================
+// function: MatchVIso
+// purpose
+//=========================================================================
+
+Standard_Boolean StdPrs_WFRestrictedFace::MatchVIso
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer)
+{
+ return StdPrs_WFRestrictedFace::Match (
+ theX, theY, theZ, theDistance,
+ theFace,
+ Standard_False,
+ Standard_True,
+ theDrawer->MaximalChordialDeviation(),
+ theDrawer->UIsoAspect()->Number(),
+ theDrawer->VIsoAspect()->Number(),
+ theDrawer);
+}
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+#ifndef _StdPrs_WFRestrictedFace_H__
+#define _StdPrs_WFRestrictedFace_H__
+
+#include <BRepAdaptor_HSurface.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_NListOfSequenceOfPnt.hxx>
+
+class StdPrs_WFRestrictedFace : public Prs3d_Root
+{
+public:
+ DEFINE_STANDARD_ALLOC
+
+ Standard_EXPORT static void Add
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Standard_Boolean theDrawUIso,
+ const Standard_Boolean theDrawVIso,
+ const Quantity_Length theDeflection,
+ const Standard_Integer theNbUIso,
+ const Standard_Integer theNbVIso,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ Prs3d_NListOfSequenceOfPnt& theCurves);
+
+ Standard_EXPORT static void Add
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static Standard_Boolean Match
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Standard_Boolean theDrawUIso,
+ const Standard_Boolean theDrawVIso,
+ const Quantity_Length theDeflection,
+ const Standard_Integer theNbUIso,
+ const Standard_Integer theNbVIso,
+ const Handle(Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static Standard_Boolean Match
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static Standard_Boolean MatchUIso
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static Standard_Boolean MatchVIso
+ (const Quantity_Length theX,
+ const Quantity_Length theY,
+ const Quantity_Length theZ,
+ const Quantity_Length theDistance,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static void AddUIso
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+ Standard_EXPORT static void AddVIso
+ (const Handle (Prs3d_Presentation)& thePresentation,
+ const Handle(BRepAdaptor_HSurface)& theFace,
+ const Handle (Prs3d_Drawer)& theDrawer);
+
+};
+
+#endif
--- /dev/null
+// Copyright (c) 2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _StdPrs_WFShape_H__
+#define _StdPrs_WFShape_H__
+
+#include <Prs3d_Root.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <Quantity_Length.hxx>
+#include <Prs3d_WFShape.hxx>
+#include <StdPrs_WFRestrictedFace.hxx>
+#include <StdPrs_Curve.hxx>
+#include <StdPrs_Vertex.hxx>
+
+typedef Prs3d_WFShape <StdPrs_WFRestrictedFace, StdPrs_Curve, StdPrs_Vertex> StdPrs_WFShape;
+#endif
\ No newline at end of file