diff options
author | Denis Barbier <bouzim@gmail.com> | 2011-04-16 02:04:40 +0200 |
---|---|---|
committer | Denis Barbier <bouzim@gmail.com> | 2011-04-16 02:04:40 +0200 |
commit | 2c03b0d97c68ad5dad5d225436431b8108b40af7 (patch) | |
tree | 36f15f7cb194d51f71dc9adc250faef713955252 /src/HatchGen | |
parent | 2ce45865ffb91ec3db203835144255b78ec107a9 (diff) | |
download | oce-2c03b0d97c68ad5dad5d225436431b8108b40af7.tar.gz oce-2c03b0d97c68ad5dad5d225436431b8108b40af7.zip |
Get rid of the ros/ directory
Move all files and directories one level up.
Diffstat (limited to 'src/HatchGen')
-rw-r--r-- | src/HatchGen/HatchGen.cdl | 74 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_Domain.cdl | 151 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_Domain.cxx | 82 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_ElementGen.cdl | 74 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_ElementsGen.cdl | 142 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_Hatcher.cdl | 503 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_HatchingGen.cdl | 246 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_IntersectionPoint.cdl | 176 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_IntersectionPoint.cxx | 164 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_Intersector.cdl | 117 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_PointOnElement.cdl | 112 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_PointOnElement.cxx | 253 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_PointOnHatching.cdl | 169 | ||||
-rw-r--r-- | src/HatchGen/HatchGen_PointOnHatching.cxx | 220 |
14 files changed, 2483 insertions, 0 deletions
diff --git a/src/HatchGen/HatchGen.cdl b/src/HatchGen/HatchGen.cdl new file mode 100644 index 00000000..ddec9aa2 --- /dev/null +++ b/src/HatchGen/HatchGen.cdl @@ -0,0 +1,74 @@ +-- File: HatchGen.cdl +-- Created: Mon Oct 25 17:01:34 1993 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1993 + +package HatchGen + +uses + IntRes2d , + StdFail , + TopAbs , + TCollection , + TColStd, + gp, + TopClass + +is + + enumeration IntersectionType is + + ---Purpose: Intersection type between the hatching and the + -- element. + + TRUE , + TOUCH , + TANGENT , + UNDETERMINED + + end IntersectionType from HatchGen ; + + + enumeration ErrorStatus is + + ---Purpose: Error status. + + NoProblem , + TrimFailure , + TransitionFailure , + IncoherentParity , + IncompatibleStates + + end ErrorStatus from HatchGen ; + + + deferred generic class Intersector ; + + deferred class IntersectionPoint ; + + class PointOnHatching ; + class PointsOnHatching instantiates Sequence from TCollection + (PointOnHatching from HatchGen) ; + + class PointOnElement ; + class PointsOnElement instantiates Sequence from TCollection + (PointOnElement) ; + + class Domain ; + class Domains instantiates Sequence from TCollection + (Domain from HatchGen) ; + + generic class HatchingGen ; + generic class ElementGen ; + generic class ElementsGen,MapOfElements; + + generic class Hatcher , + Hatching , + Hatchings , + Element , + Elements, + Classifier; + + +end HatchGen ; diff --git a/src/HatchGen/HatchGen_Domain.cdl b/src/HatchGen/HatchGen_Domain.cdl new file mode 100644 index 00000000..d46398c9 --- /dev/null +++ b/src/HatchGen/HatchGen_Domain.cdl @@ -0,0 +1,151 @@ +-- File: HatchGen_Domain.cdl +-- Created: Fri Nov 5 18:15:21 1993 +-- Author: Jean Marc LACHAUME +-- <jml@sdsun1> +-- Copyright: Matra Datavision 1993 + +class Domain from HatchGen + +uses + PointOnHatching from HatchGen + +raises + DomainError from Standard + +is + + Create + + ---Purpose: Creates an infinite domain. + + returns Domain from HatchGen ; + + + Create (P1, P2 : PointOnHatching from HatchGen) + + ---Purpose: Creates a domain for the curve associated to a hatching. + + returns Domain from HatchGen ; + + + Create (P : PointOnHatching from HatchGen ; First : Boolean from Standard) + + ---Purpose: Creates a semi-infinite domain for the curve associated + -- to a hatching. The `First' flag means that the given + -- point is the first one. + + returns Domain from HatchGen ; + + + SetPoints (me : in out ; P1, P2 : PointOnHatching from HatchGen) + + ---Purpose: Sets the first and the second points of the domain. + + ---C++: inline + is static ; + + + SetPoints (me : in out) + + ---Purpose: Sets the first and the second points of the domain + -- as the infinite. + + ---C++: inline + is static ; + + + SetFirstPoint (me : in out ; P : PointOnHatching from HatchGen) + + ---Purpose: Sets the first point of the domain. + + ---C++: inline + is static ; + + + SetFirstPoint (me : in out) + + ---Purpose: Sets the first point of the domain at the + -- infinite. + + ---C++: inline + is static ; + + + SetSecondPoint (me : in out ; P : PointOnHatching from HatchGen) + + ---Purpose: Sets the second point of the domain. + + ---C++: inline + is static ; + + + SetSecondPoint (me : in out) + + ---Purpose: Sets the second point of the domain at the + -- infinite. + + ---C++: inline + is static ; + + + HasFirstPoint (me) + + ---Purpose: Returns True if the domain has a first point. + + ---C++: inline + returns Boolean from Standard + is static ; + + + FirstPoint (me) + + ---Purpose: Returns the first point of the domain. + -- The exception DomainError is raised if + -- HasFirstPoint returns False. + + ---C++: inline + ---C++: return const & + + returns PointOnHatching from HatchGen + raises DomainError from Standard + is static ; + + + HasSecondPoint (me) + + ---Purpose: Returns True if the domain has a second point. + + ---C++: inline + returns Boolean from Standard + is static ; + + + SecondPoint (me) + + ---Purpose: Returns the second point of the domain. + -- The exception DomainError is raised if + -- HasSecondPoint returns False. + + ---C++: inline + ---C++: return const & + + returns PointOnHatching from HatchGen + raises DomainError from Standard + is static ; + + + Dump (me; Index : Integer from Standard = 0) + + ---Purpose: Dump of the domain. + + is static ; + + +fields + + myHasFirstPoint : Boolean from Standard ; + myFirstPoint : PointOnHatching from HatchGen ; + myHasSecondPoint : Boolean from Standard ; + mySecondPoint : PointOnHatching from HatchGen ; + +end Domain from HatchGen ; diff --git a/src/HatchGen/HatchGen_Domain.cxx b/src/HatchGen/HatchGen_Domain.cxx new file mode 100644 index 00000000..fef06a4f --- /dev/null +++ b/src/HatchGen/HatchGen_Domain.cxx @@ -0,0 +1,82 @@ +// File: HatchGen_Domain.cxx +// Created: Wed Nov 10 15:33:27 1993 +// Author: Jean Marc LACHAUME +// <jml@sdsun1> + +#include <Standard_Stream.hxx> +#include <HatchGen_Domain.ixx> + +//======================================================================= +// Function : HatchGen_Domain +// Purpose : Constructor. +//======================================================================= + +HatchGen_Domain::HatchGen_Domain () : + myHasFirstPoint (Standard_False) , + myHasSecondPoint (Standard_False) +{ +} + +//======================================================================= +// Function : HatchGen_Domain +// Purpose : Constructor. +//======================================================================= + +HatchGen_Domain::HatchGen_Domain (const HatchGen_PointOnHatching& P1, + const HatchGen_PointOnHatching& P2) : + myHasFirstPoint (Standard_True) , + myFirstPoint (P1), + myHasSecondPoint (Standard_True) , + mySecondPoint (P2) +{ +} + +//======================================================================= +// Function : HatchGen_Domain +// Purpose : Constructor. +//======================================================================= + +HatchGen_Domain::HatchGen_Domain (const HatchGen_PointOnHatching& P, + const Standard_Boolean First) +{ + if (First) { + myHasFirstPoint = Standard_True ; + myHasSecondPoint = Standard_False ; + myFirstPoint = P ; + } else { + myHasFirstPoint = Standard_False ; + myHasSecondPoint = Standard_True ; + mySecondPoint = P ; + } +} + + +//======================================================================= +// Function : Dump +// Purpose : Dump of the domain. +//======================================================================= + +void HatchGen_Domain::Dump (const Standard_Integer Index) const +{ + cout << "=== Domain " ; + if (Index > 0) { + cout << "# " << setw(3) << Index << " " ; + } else { + cout << "======" ; + } + cout << "=============================" << endl ; + + if (myHasFirstPoint) { + myFirstPoint.Dump (1) ; + } else { + cout << " Has not a first point" << endl ; + } + + if (myHasSecondPoint) { + mySecondPoint.Dump (2) ; + } else { + cout << " Has not a second point" << endl ; + } + + cout << "==============================================" << endl ; +} diff --git a/src/HatchGen/HatchGen_ElementGen.cdl b/src/HatchGen/HatchGen_ElementGen.cdl new file mode 100644 index 00000000..94fe407b --- /dev/null +++ b/src/HatchGen/HatchGen_ElementGen.cdl @@ -0,0 +1,74 @@ +-- File: HatchGen_ElementGen.cdl +-- Created: Wed Nov 10 18:10:00 1993 +-- Author: Jean Marc LACHAUME +-- <jml@sdsun1> +-- Copyright: Matra Datavision 1993 + +generic class ElementGen from HatchGen (TheElementCurve as any) + +uses + Orientation from TopAbs + +is + + + Create + + returns ElementGen from HatchGen; + + Create (Other : ElementGen from HatchGen) + + ---Purpose: Magic constructor. + + returns ElementGen from HatchGen ; + + + Create (Curve : TheElementCurve ; + Orientation : Orientation from TopAbs = TopAbs_FORWARD) + + ---Purpose: Creates an element. + + returns ElementGen from HatchGen ; + + + Curve (me) + + ---Purpose: Returns the curve associated to the element. + + ---C++: return const & + + returns TheElementCurve + is static ; + + + ChangeCurve (me : in out) + + ---Purpose: Returns the curve associated to the element. + + ---C++: return & + + returns TheElementCurve + is static ; + + + Orientation (me : in out ; Orientation : Orientation from TopAbs) + + ---Purpose: Sets the orientation of the element. + + is static ; + + + Orientation (me) + + ---Purpose: Returns the orientation of the element. + + returns Orientation from TopAbs + is static ; + + +fields + + myCurve : TheElementCurve ; + myOrientation : Orientation from TopAbs ; + +end ElementGen from HatchGen ; diff --git a/src/HatchGen/HatchGen_ElementsGen.cdl b/src/HatchGen/HatchGen_ElementsGen.cdl new file mode 100644 index 00000000..8eaa5f82 --- /dev/null +++ b/src/HatchGen/HatchGen_ElementsGen.cdl @@ -0,0 +1,142 @@ +-- File: HatchGen_ElementsGen.cdl +-- Created: Fri Dec 16 11:01:56 1994 +-- Author: Laurent BUCHARD +-- <lbr@mastox> +---Copyright: Matra Datavision 1994 + +-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 + + +generic class ElementsGen from HatchGen + (TheKey as any; + TheItem as any; + TheHasher as any; + TheCurve as any) + + +uses + Orientation from TopAbs, + Lin2d from gp, + Pnt2d from gp + +raises + DomainError from Standard, + NoSuchObject from Standard + + +private class MapOfElements from HatchGen instantiates + DataMap from TCollection + (TheKey, + TheItem, + TheHasher); + + +is + + Create + returns ElementsGen from HatchGen; + + Create(Other : ElementsGen from HatchGen) + returns ElementsGen from HatchGen; + + + +---------------------------------------------------------------------- +-- E m u l a t i o n o f D a t a M a p +-- +-- f r o m T C o l l e c t i o n +---------------------------------------------------------------------- + Clear(me : in out) + ---C++: alias ~ + is static; + + Bind(me : in out; K : TheKey; I : TheItem) returns Boolean + is static; + + IsBound(me; K : TheKey) returns Boolean + is static; + + UnBind(me : in out; K : TheKey) returns Boolean + is static; + + Find(me; K : TheKey) returns any TheItem + raises NoSuchObject from Standard -- when <K> is not in the map. + ---C++: alias operator() + ---C++: return const & + is static; + + ChangeFind(me : in out; K : TheKey) returns any TheItem + raises NoSuchObject from Standard -- when <K> is not in the map. + ---C++: alias operator() + ---C++: return & + is static; + +---------------------------------------------------------------------- +-- M e t h o d s u s e d b y t h e C l a s s i f i e r +-- +-- see BRepClass_FaceExplorer for the Purposes +---------------------------------------------------------------------- + + Reject(me; P : Pnt2d from gp) + returns Boolean from Standard + is static; + +-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 Begin + Segment(me: in out; P : Pnt2d from gp; + L : out Lin2d from gp; + Par : out Real) + returns Boolean from Standard + is static; + + OtherSegment(me: in out; P : Pnt2d from gp; + L : out Lin2d from gp; + Par : out Real) + returns Boolean from Standard + is static; + +-- Modified by skv - Fri Jul 14 16:46:18 2006 OCC12627 End + + InitWires(me : in out) + is static; + + MoreWires(me) returns + Boolean from Standard + is static; + + NextWire(me : in out) + is static; + + RejectWire(me; L : Lin2d from gp; + Par : Real from Standard) + returns Boolean from Standard + is static; + + InitEdges(me : in out) + is static; + + MoreEdges(me) + returns Boolean from Standard + is static; + + NextEdge(me : in out) + is static; + + RejectEdge(me; L : Lin2d from gp; + Par : Real from Standard) + returns Boolean from Standard + is static; + + CurrentEdge(me; E : out TheCurve; + Or : out Orientation from TopAbs) + is static; + + +fields + + myMap : MapOfElements; + Iter : DataMapIteratorOfMapOfElements; + NumWire : Integer from Standard; + NumEdge : Integer from Standard; + myCurEdge: Integer from Standard; + +end ElementsGen from HatchGen; diff --git a/src/HatchGen/HatchGen_Hatcher.cdl b/src/HatchGen/HatchGen_Hatcher.cdl new file mode 100644 index 00000000..45082c8c --- /dev/null +++ b/src/HatchGen/HatchGen_Hatcher.cdl @@ -0,0 +1,503 @@ +-- File: HatchGen_Hatcher.cdl +-- Created: Mon Oct 25 17:01:45 1993 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1993 + +generic class Hatcher from HatchGen + (TheCurveE as any ; -- as Curve from Geom2dAdaptor + TheCurveH as any ; -- as Curve from Geom2dAdaptor + TheIntersector as any ) -- as Intersector from HatchGen + +uses + MapIntegerHasher from TColStd , + PointOnHatching from HatchGen , + Orientation from TopAbs , + State from TopAbs , + Domain from HatchGen , + ErrorStatus from HatchGen + +raises + NoSuchObject from Standard , + OutOfRange from Standard , + NotDone from StdFail + +---------------------------------------------------------------------- +-- Nested classes descriptions. +---------------------------------------------------------------------- + +class Element from HatchGen instantiates ElementGen from HatchGen + (TheCurveE) ; + +class Elements from HatchGen instantiates ElementsGen from HatchGen + (Integer from Standard, + Element from HatchGen, + MapIntegerHasher from TColStd , + TheCurveE ) ; + +class Hatching from HatchGen instantiates HatchingGen from HatchGen + (TheCurveH) ; + +class Hatchings from HatchGen instantiates DataMap from TCollection + (Integer from Standard, + Hatching from HatchGen, + MapIntegerHasher from TColStd) ; + +class Classifier from HatchGen instantiates FaceClassifier from TopClass + (Elements, + TheCurveE, + TheIntersector); + +---------------------------------------------------------------------- +-- class Hatcher description. +---------------------------------------------------------------------- + +is + +---Category: General use + + + Create (Intersector : TheIntersector ; + Confusion2d : Real from Standard ; + Confusion3d : Real from Standard ; + KeepPnt : Boolean from Standard = Standard_False ; + KeepSeg : Boolean from Standard = Standard_False) + + ---Purpose: Returns an empty hatcher. + + returns Hatcher from HatchGen ; + + + Intersector (me : in out ; Intersector : TheIntersector) + + ---Purpose: Sets the associated intersector. + is static ; + + + Intersector (me : in out) + + ---Purpose: Returns the associated intersector. + + ---C++: inline + ---C++: return const & + + returns TheIntersector + is static ; + + + ChangeIntersector (me : in out) + + ---Purpose: Returns the associated intersector. + + ---C++: inline + ---C++: return & + + returns TheIntersector + is static ; + + + Confusion2d (me : in out ; Confusion : Real from Standard) + + ---Purpose: Sets the confusion tolerance. + + is static ; + + + Confusion2d (me) + + ---Purpose: Returns the 2d confusion tolerance, i.e. the value under + -- which two points are considered identical in the + -- parametric space of the hatching. + + ---C++: inline + returns Real from Standard + is static ; + + + Confusion3d (me : in out ; Confusion : Real from Standard) + + ---Purpose: Sets the confusion tolerance. + + is static ; + + + Confusion3d (me) + + ---Purpose: Returns the 3d confusion tolerance, i.e. the value under + -- which two points are considered identical in the + -- 3d space of the hatching. + + ---C++: inline + returns Real from Standard + is static ; + + + KeepPoints (me : in out; Keep : Boolean from Standard) + + ---Purpose: Sets the above flag. + + is static ; + + + KeepPoints (me) + + ---Purpose: Returns the flag about the points consideration. + + ---C++: inline + returns Boolean from Standard + is static ; + + + KeepSegments (me : in out; Keep : Boolean from Standard) + + ---Purpose: Sets the above flag. + + is static ; + + + KeepSegments (me) + + ---Purpose: Returns the flag about the segments consideration. + + ---C++: inline + returns Boolean from Standard + is static ; + + + Clear (me : in out) + + ---Purpose: Removes all the hatchings and all the elements. + + ---C++: inline + is static ; + + +---Category: Element + + + Element (me : in out ; IndE : Integer from Standard) + + ---Purpose: Returns the IndE-th element. + + ---Category: Element + + ---C++: inline + ---C++: return & + + returns Element from HatchGen + raises NoSuchObject from Standard + is static protected ; + + + ElementCurve (me; IndE : Integer from Standard) + + ---Purpose: Returns the curve associated to the IndE-th element. + + ---Category: Element + + ---C++: inline + ---C++: return const & + + returns TheCurveE + raises NoSuchObject from Standard + is static ; + + + AddElement (me : in out ; Curve : TheCurveE ; + Orientation : Orientation from TopAbs = TopAbs_FORWARD) + + ---Purpose: Adds an element to the hatcher and returns its index. + + ---Category: Element + + returns Integer from Standard + is static ; + + + RemElement (me : in out ; IndE : Integer from Standard) + + ---Purpose: Removes the IndE-th element from the hatcher. + + ---Category: Element + + raises NoSuchObject from Standard + is static ; + + + ClrElements (me : in out) + + ---Purpose: Removes all the elements from the hatcher. + + ---Category: Element + + is static ; + + +---Category: Hatching + + + Hatching (me : in out ; IndH : Integer from Standard) + + ---Purpose: Returns the IndH-th hatching. + + ---Category: Hatching + + ---C++: inline + ---C++: return & + + returns Hatching from HatchGen + raises NoSuchObject from Standard + is static protected ; + + + HatchingCurve (me; IndH : Integer from Standard) + + ---Purpose: Returns the curve associated to the IndH-th hatching. + + ---Category: Hatching + + ---C++: inline + ---C++: return const & + + returns TheCurveH + raises NoSuchObject from Standard + is static ; + + + AddHatching (me : in out ; Curve : TheCurveH) + + ---Purpose: Adds a hatching to the hatcher and returns its index. + + ---Category: Hatching + + returns Integer from Standard + is static ; + + + RemHatching (me : in out ; IndH : Integer from Standard) + + ---Purpose: Removes the IndH-th hatching from the hatcher. + + ---Category: Hatching + + raises NoSuchObject from Standard + is static ; + + + ClrHatchings (me : in out) + + ---Purpose: Removes all the hatchings from the hatcher. + + ---Category: Hatching + + is static ; + + + NbPoints (me; IndH : Integer from Standard) + + ---Purpose: Returns the number of intersection points of + -- the IndH-th hatching. + + ---Category: Hatching - Test + + ---C++: inline + returns Integer from Standard + raises NoSuchObject from Standard + is static ; + + + Point (me; IndH, IndP : Integer from Standard) + + ---Purpose: Returns the IndP-th intersection point of the + -- IndH-th hatching. + + ---Category: Hatching - Test + + ---C++: inline + ---C++: return const & + + returns PointOnHatching from HatchGen + raises NoSuchObject from Standard, + OutOfRange from Standard + is static ; + + +---Category: Computation - Trimming + + Trim (me : in out) + + ---Purpose: Trims all the hatchings of the hatcher by all the + -- elements of the hatcher. + + is static ; + + + Trim (me : in out ; Curve : TheCurveH) + + ---Purpose: Adds a hatching to the hatcher and trims it by + -- the elements already given and returns its index. + + ---Category: Computation + + returns Integer from Standard + is static ; + + + Trim (me : in out ; IndH : Integer from Standard) + + ---Purpose: Trims the IndH-th hatching by the elements + -- already given. + + ---Category: Computation + + raises NoSuchObject from Standard + is static ; + + + Trim (me : in out ; IndH, IndE : Integer from Standard) + + ---Purpose: Trims the IndH-th hatching of the hatcher by the + -- IndE-th element. + + ---Category: Computation + + returns Boolean from Standard + is static private ; + + +---Category: Computation - Domains + + GlobalTransition (me : in out; Point : in out PointOnHatching from HatchGen) + + ---Purpose: Sets the global transition (the before and after + -- states and segment extremities flags) of the point. + + ---Category: Computation - Domains + + returns Boolean from Standard + is static private ; + + + ComputeDomains (me : in out) + + ---Purpose: Computes the domains of all the hatchings. + + ---Category: Computation - Domains + + is static ; + + + ComputeDomains (me : in out ; IndH : Integer from Standard) + + ---Purpose: Computes the domains of the IndH-th hatching. + + ---Category: Computation - Domains + + raises NoSuchObject from Standard + is static ; + + +---Category: Results + + TrimDone (me; IndH : Integer from Standard) + + ---Purpose: Returns the fact that the intersections were computed + -- for the IndH-th hatching. + + ---C++: inline + returns Boolean from Standard + raises NoSuchObject from Standard + is static ; + + + TrimFailed (me; IndH : Integer from Standard) + + ---Purpose: Returns the fact that the intersections failed + -- for the IndH-th hatching. + + ---C++: inline + returns Boolean from Standard + raises NoSuchObject from Standard + is static ; + + + IsDone (me) + + ---Purpose: Returns the fact that the domains were computed + -- for all the hatchings. + + ---C++: inline + returns Boolean from Standard + raises NoSuchObject from Standard + is static ; + + + IsDone (me; IndH : Integer from Standard) + + ---Purpose: Returns the fact that the domains were computed + -- for the IndH-th hatching. + + returns Boolean from Standard + raises NoSuchObject from Standard + is static ; + + + Status (me; IndH : Integer from Standard) + + ---Purpose: Returns the status about the IndH-th hatching. + + ---C++: inline + returns ErrorStatus from HatchGen + raises NoSuchObject from Standard + is static ; + + + NbDomains (me; IndH : Integer from Standard) + + ---Purpose: Returns the number of domains of the IndH-th hatching. + -- Only ONE "INFINITE" domain means that the hatching is + -- fully included in the contour defined by the elements. + + ---C++: inline + returns Integer from Standard + raises NoSuchObject from Standard , + NotDone from StdFail + is static ; + + + Domain (me; IndH : Integer from Standard ; + IDom : Integer from Standard ) + + ---Purpose: Returns the IDom-th domain of the IndH-th hatching. + + ---C++: return const & + + returns Domain from HatchGen + raises NoSuchObject from Standard , + NotDone from StdFail , + OutOfRange from Standard + is static ; + + +---Category: Dump + + Dump (me) + + ---Purpose: Dump the hatcher. + + is static ; + + +fields + + myIntersector : TheIntersector ; + myConfusion2d : Real from Standard ; + myConfusion3d : Real from Standard ; + myKeepPoints : Boolean from Standard ; + myKeepSegments : Boolean from Standard ; + myNbElements : Integer from Standard ; + myElements : Elements from HatchGen ; + myNbHatchings : Integer from Standard ; + myHatchings : Hatchings from HatchGen ; + +end Hatcher from HatchGen ; diff --git a/src/HatchGen/HatchGen_HatchingGen.cdl b/src/HatchGen/HatchGen_HatchingGen.cdl new file mode 100644 index 00000000..27012e04 --- /dev/null +++ b/src/HatchGen/HatchGen_HatchingGen.cdl @@ -0,0 +1,246 @@ +-- File: HatchGen_HatchingGen.cdl +-- Created: Wed Nov 10 18:10:00 1993 +-- Author: Jean Marc LACHAUME +-- <jml@sdsun1> +-- Copyright: Matra Datavision 1993 + +generic class HatchingGen from HatchGen (TheHatchingCurve as any) + +uses + ErrorStatus from HatchGen , + PointOnHatching from HatchGen , + PointsOnHatching from HatchGen , + Domain from HatchGen , + Domains from HatchGen , + Pnt2d from gp + +raises + OutOfRange from Standard + +is + + Create + + returns HatchingGen from HatchGen; + + + Create (Curve : TheHatchingCurve) + + ---Purpose: Creates a hatching. + + returns HatchingGen from HatchGen ; + + + Curve (me) + + ---Purpose: Returns the curve associated to the hatching. + + ---C++: return const & + + returns TheHatchingCurve + is static ; + + + ChangeCurve (me : in out) + + ---Purpose: Returns the curve associated to the hatching. + + ---C++: return & + + returns TheHatchingCurve + is static ; + + + TrimDone (me : in out ; Flag : Boolean from Standard) + + ---Purpose: Sets the flag about the trimming computations to the + -- given value. + + is static ; + + + TrimDone (me) + + ---Purpose: Returns the flag about the trimming computations. + + returns Boolean from Standard + is static ; + + + TrimFailed (me : in out ; Flag : Boolean from Standard) + + ---Purpose: Sets the flag about the trimming failure to the + -- given value. + + is static ; + + + TrimFailed (me) + + ---Purpose: Returns the flag about the trimming failure. + + returns Boolean from Standard + is static ; + + + IsDone (me : in out ; Flag : Boolean from Standard) + + ---Purpose: Sets the flag about the domains computation to the + -- given value. + + is static ; + + + IsDone (me) + + ---Purpose: Returns the flag about the domains computation. + + returns Boolean from Standard + is static ; + + + Status (me : in out ; Status : ErrorStatus from HatchGen) + + ---Purpose: Sets the error status. + + is static ; + + + Status (me) + + ---Purpose: Returns the error status. + + returns ErrorStatus from HatchGen + is static ; + + +---Category: Points on hatching. + + AddPoint (me : in out ; Point : PointOnHatching from HatchGen ; + Confusion : Real from Standard) + + ---Purpose: Adds an intersection point to the hatching. + + is static ; + + + NbPoints (me) + + ---Purpose: Returns the number of intersection points + -- of the hatching. + + returns Integer from Standard + is static ; + + + Point (me ; Index : Integer from Standard) + + ---Purpose: Returns the Index-th intersection point of the + -- hatching. + -- The exception OutOfRange is raised if + -- Index < 1 or Index > NbPoints. + + ---C++: return const & + + returns PointOnHatching from HatchGen + raises OutOfRange from Standard + is static ; + + + ChangePoint (me : in out ; Index : Integer from Standard) + + ---Purpose: Returns the Index-th intersection point of the + -- hatching. + -- The exception OutOfRange is raised if + -- Index < 1 or Index > NbPoints. + + ---C++: return & + + returns PointOnHatching from HatchGen + raises OutOfRange from Standard + is static ; + + + RemPoint (me : in out ; Index : Integer from Standard) + + ---Purpose: Removes the Index-th intersection point of the + -- hatching. + -- The exception OutOfRange is raised if + -- Index < 1 or Index > NbPoints. + + raises OutOfRange from Standard + is static ; + + + ClrPoints (me : in out) + + ---Purpose: Removes all the intersection points of the hatching. + + is static ; + + +---Category: Domains. + + + AddDomain (me : in out ; Domain : Domain from HatchGen) + + ---Purpose: Adds a domain to the hatching. + + is static ; + + + NbDomains (me) + + ---Purpose: Returns the number of domains of the hatching. + + returns Integer from Standard + is static ; + + + Domain (me ; Index : Integer from Standard) + + ---Purpose: Returns the Index-th domain of the hatching. + -- The exception OutOfRange is raised if + -- Index < 1 or Index > NbDomains. + + ---C++: return const & + + returns Domain from HatchGen + raises OutOfRange from Standard + is static ; + + + RemDomain (me : in out ; Index : Integer from Standard) + + ---Purpose: Removes the Index-th domain of the hatching. + -- The exception OutOfRange is raised if + -- Index < 1 or Index > NbDomains. + + raises OutOfRange from Standard + is static ; + + + ClrDomains (me : in out) + + ---Purpose: Removes all the domains of the hatching. + + is static ; + + + ClassificationPoint (me) + ---Purpose: Returns a point on the curve. + -- This point will be used for the classification. + returns Pnt2d from gp + is static; + +fields + + myCurve : TheHatchingCurve ; + myTrimDone : Boolean from Standard ; + myTrimFailed : Boolean from Standard ; + myPoints : PointsOnHatching from HatchGen ; + myIsDone : Boolean from Standard ; + myStatus : ErrorStatus from HatchGen ; + myDomains : Domains from HatchGen ; + +end HatchingGen from HatchGen ; diff --git a/src/HatchGen/HatchGen_IntersectionPoint.cdl b/src/HatchGen/HatchGen_IntersectionPoint.cdl new file mode 100644 index 00000000..b4947c97 --- /dev/null +++ b/src/HatchGen/HatchGen_IntersectionPoint.cdl @@ -0,0 +1,176 @@ +-- File: HatchGen_IntersectionPoint.cdl +-- Created: Fri Oct 29 15:21:47 1993 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1993 + +deferred class IntersectionPoint from HatchGen + +uses + Orientation from TopAbs , + State from TopAbs , + IntersectionPoint from IntRes2d + +is + + + Initialize + + ---Purpose: Creates an empty intersection point. + + ---Category: IntersectionPoint + + is protected ; + + + SetIndex (me : in out ; Index : Integer from Standard) + + ---Purpose: Sets the index of the supporting curve. + + ---Category: IntersectionPoint + + is static ; + + + Index (me) + + ---Purpose: Returns the index of the supporting curve. + + ---Category: IntersectionPoint + + returns Integer from Standard + is static ; + + + SetParameter (me : in out ; Parameter : Real from Standard) + + ---Purpose: Sets the parameter on the curve. + + ---Category: IntersectionPoint + + is static ; + + + Parameter (me) + + ---Purpose: Returns the parameter on the curve. + + ---Category: IntersectionPoint + + returns Real from Standard + is static ; + + + SetPosition (me : in out ; Position : Orientation from TopAbs) + + ---Purpose: Sets the position of the point on the curve. + + ---Category: IntersectionPoint + + is static ; + + + Position (me) + + ---Purpose: Returns the position of the point on the curve. + + ---Category: IntersectionPoint + + returns Orientation from TopAbs + is static ; + + + SetStateBefore (me : in out ; State : State from TopAbs) + + ---Purpose: Sets the transition state before the intersection. + + ---Category: IntersectionPoint + + is static ; + + + StateBefore (me) + + ---Purpose: Returns the transition state before the intersection. + + ---Category: IntersectionPoint + + returns State from TopAbs + is static ; + + + SetStateAfter (me : in out ; State : State from TopAbs) + + ---Purpose: Sets the transition state after the intersection. + + ---Category: IntersectionPoint + + is static ; + + + StateAfter (me) + + ---Purpose: Returns the transition state after of the intersection. + + ---Category: IntersectionPoint + + returns State from TopAbs + is static ; + + + SetSegmentBeginning (me : in out ; State : Boolean from Standard = Standard_True) + + ---Purpose: Sets the flag that the point is the beginning of a segment. + + ---Category: IntersectionPoint + + is static ; + + + SegmentBeginning (me) + + ---Purpose: Returns the flag that the point is the beginning of a segment. + + ---Category: IntersectionPoint + + returns Boolean from Standard + is static ; + + + SetSegmentEnd (me : in out ; State : Boolean from Standard = Standard_True) + + ---Purpose: Sets the flag that the point is the end of a segment. + + ---Category: IntersectionPoint + + is static ; + + + SegmentEnd (me) + + ---Purpose: Returns the flag that the point is the end of a segment. + + ---Category: IntersectionPoint + + returns Boolean from Standard + is static ; + + + Dump (me; Index : Integer from Standard = 0) + + ---Purpose: Dump of the point on element. + + is deferred ; + + +fields + + myIndex : Integer from Standard is protected ; + myParam : Real from Standard is protected ; + myPosit : Orientation from TopAbs is protected ; + myBefore : State from TopAbs is protected ; + myAfter : State from TopAbs is protected ; + mySegBeg : Boolean from Standard is protected ; + mySegEnd : Boolean from Standard is protected ; + +end IntersectionPoint from HatchGen ; diff --git a/src/HatchGen/HatchGen_IntersectionPoint.cxx b/src/HatchGen/HatchGen_IntersectionPoint.cxx new file mode 100644 index 00000000..d383118c --- /dev/null +++ b/src/HatchGen/HatchGen_IntersectionPoint.cxx @@ -0,0 +1,164 @@ +// File: HatchGen_IntersectionPoint.cxx +// Created: Fri Mar 18 11:06:43 1994 +// Author: Jean Marc LACHAUME +// <jml@phylox> + + +#include <HatchGen_IntersectionPoint.ixx> + +//======================================================================= +// Function : HatchGen_IntersectionPoint +// Purpose : Constructor +//======================================================================= + +HatchGen_IntersectionPoint::HatchGen_IntersectionPoint () : + myIndex (0) , + myParam (RealLast()) , + myPosit (TopAbs_INTERNAL) , + myBefore (TopAbs_UNKNOWN) , + myAfter (TopAbs_UNKNOWN) , + mySegBeg (Standard_False) , + mySegEnd (Standard_False) +{ +} + +//======================================================================= +// Function : SetIndex +// Purpose : Sets the index of the supporting curve. +//======================================================================= + +void HatchGen_IntersectionPoint::SetIndex (const Standard_Integer Index) +{ + myIndex = Index ; +} + +//======================================================================= +// Function : Index +// Purpose : Returns the index of the supporting curve. +//======================================================================= + +Standard_Integer HatchGen_IntersectionPoint::Index () const +{ + return myIndex ; +} + +//======================================================================= +// Function : SetParameter +// Purpose : Sets the parameter on the curve. +//======================================================================= + +void HatchGen_IntersectionPoint::SetParameter (const Standard_Real Parameter) +{ + myParam = Parameter ; +} + +//======================================================================= +// Function : Parameter +// Purpose : Returns the parameter on the curve. +//======================================================================= + +Standard_Real HatchGen_IntersectionPoint::Parameter () const +{ + return myParam ; +} + +//======================================================================= +// Function : SetPosition +// Purpose : Sets the position of the point on the curve. +//======================================================================= + +void HatchGen_IntersectionPoint::SetPosition (const TopAbs_Orientation Position) +{ + myPosit = Position ; +} + +//======================================================================= +// Function : Position +// Purpose : Returns the position of the point on the element. +//======================================================================= + +TopAbs_Orientation HatchGen_IntersectionPoint::Position () const +{ + return myPosit ; +} + +//======================================================================= +// Function : SetStateBefore +// Purpose : Sets the transition state before the intersection. +//======================================================================= + +void HatchGen_IntersectionPoint::SetStateBefore (const TopAbs_State State) +{ + myBefore = State ; +} + +//======================================================================= +// Function : StateBefore +// Purpose : Returns the transition state before the intersection. +//======================================================================= + +TopAbs_State HatchGen_IntersectionPoint::StateBefore () const +{ + return myBefore ; +} + +//======================================================================= +// Function : SetStateAfter +// Purpose : Sets the transition state after the intersection. +//======================================================================= + +void HatchGen_IntersectionPoint::SetStateAfter (const TopAbs_State State) +{ + myAfter = State ; +} + +//======================================================================= +// Function : StateAfter +// Purpose : Returns the transition state after the intersection. +//======================================================================= + +TopAbs_State HatchGen_IntersectionPoint::StateAfter () const +{ + return myAfter ; +} + +//======================================================================= +// Function : SetSegmentBeginning +// Purpose : Sets the flag that the point is the beginning of a segment. +//======================================================================= + +void HatchGen_IntersectionPoint::SetSegmentBeginning (const Standard_Boolean State) +{ + mySegBeg = State ; +} + +//======================================================================= +// Function : SegmentBeginning +// Purpose : Returns the flag that the point is the beginning of a +// segment. +//======================================================================= + +Standard_Boolean HatchGen_IntersectionPoint::SegmentBeginning () const +{ + return mySegBeg ; +} + +//======================================================================= +// Function : SetSegmentEnd +// Purpose : Sets the flag that the point is the end of a segment. +//======================================================================= + +void HatchGen_IntersectionPoint::SetSegmentEnd (const Standard_Boolean State) +{ + mySegEnd = State ; +} + +//======================================================================= +// Function : SegmentEnd +// Purpose : Returns the flag that the point is the end of a segment. +//======================================================================= + +Standard_Boolean HatchGen_IntersectionPoint::SegmentEnd () const +{ + return mySegEnd ; +} diff --git a/src/HatchGen/HatchGen_Intersector.cdl b/src/HatchGen/HatchGen_Intersector.cdl new file mode 100644 index 00000000..b33b1099 --- /dev/null +++ b/src/HatchGen/HatchGen_Intersector.cdl @@ -0,0 +1,117 @@ +-- File: HatchGen_Intersector.cdl +-- Created: Mon Mar 21 16:53:32 1994 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1994 + +deferred generic class Intersector from HatchGen + (TheCurveH as any ; -- as Curve from Geom2dAdaptor + TheCurveE as any ) -- as Curve from Geom2dAdaptor + + +inherits Intersection from IntRes2d + +uses + Lin2d from gp, + Dir2d from gp + + + + +is + + Initialize + + ---Purpose: Creates an empty intersector + + is protected ; + + + Initialize(Confusion : Real from Standard ; + Tangency : Real from Standard) + + ---Purpose: Creates an intersector. + is protected ; + + + ConfusionTolerance (me) + + ---Purpose: Returns the confusion tolerance of the + -- intersector. + + returns Real from Standard + is static ; + + + SetConfusionTolerance (me : in out ; + Confusion : Real from Standard) + + ---Purpose: Sets the confusion tolerance of the intersector. + + is static ; + + + TangencyTolerance (me) + + ---Purpose: Returns the tangency tolerance of the + -- intersector. + + returns Real from Standard + is static ; + + + SetTangencyTolerance (me : in out ; + Tangency : Real from Standard) + + ---Purpose: Sets the tangency tolerance of the intersector. + + is static ; + + + Intersect (me : in out ; C1 : in out TheCurveE ; + C2 : in out TheCurveH ) + + ---Purpose: Intersects the curves C1 and C2. + -- The results are retreived by the usual methods + -- described in IntRes2d_Intersection. + + is static ; + +------------------------------------------------------------------------- +---- M e t h o d s u s e d b y t h e C l a s s i f i e r 2 d --- +------------------------------------------------------------------------- + + + Perform(me : in out; + L : Lin2d from gp; + P : Real from Standard; + Tol : Real from Standard; + E : TheCurveE) + + ---Purpose: Performs the intersection between the 2d line + -- segment (<L>, <P>) and the Curve <E>. The line + -- segment is the part of the 2d line <L> of + -- parameter range [0, <P>] (P is positive and can be + -- RealLast()). Tol is the Tolerance on the segment. + -- The order is relevant, the first argument is the + -- segment, the second the Edge. + is static; + + LocalGeometry(me; + E : TheCurveE ; + U : Real from Standard; + T : out Dir2d from gp; + N : out Dir2d from gp; + C : out Real) + + ---Purpose: Returns in <T>, <N> and <C> the tangent, normal + -- and curvature of the edge <E> at parameter value + -- <U>. + is static; + + +end Intersector from HatchGen ; + + + + diff --git a/src/HatchGen/HatchGen_PointOnElement.cdl b/src/HatchGen/HatchGen_PointOnElement.cdl new file mode 100644 index 00000000..a4ecc2d9 --- /dev/null +++ b/src/HatchGen/HatchGen_PointOnElement.cdl @@ -0,0 +1,112 @@ +-- File: HatchGen_PointOnElement.cdl +-- Created: Fri Oct 29 15:21:47 1993 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1993 + +class PointOnElement from HatchGen + + +inherits IntersectionPoint from HatchGen + + +uses + IntersectionType from HatchGen , + IntersectionPoint from IntRes2d , + Orientation from TopAbs + + +is + + + Create + + ---Purpose; Creates an empty point on element + + ---Category: PointOnElement + + returns PointOnElement from HatchGen ; + + + Create (Point : PointOnElement from HatchGen) + + ---Purpose: Creates a point from an other. + + ---Category: PointOnElement + + returns PointOnElement from HatchGen ; + + + Create (Point : IntersectionPoint from IntRes2d) + + ---Purpose: Creates a point from an intersection point. + + ---Category: PointOnElement + + returns PointOnElement from HatchGen ; + + + SetIntersectionType (me : in out ; Type : IntersectionType from HatchGen) + + ---Purpose: Sets the intersection type at this point. + + ---Category: PointOnElement + ---C++: inline + is static ; + + + IntersectionType (me) + + ---Purpose: Returns the intersection type at this point. + + ---Category: PointOnElement + + ---C++: inline + returns IntersectionType from HatchGen + is static ; + + + IsIdentical (me; Point : PointOnElement from HatchGen ; + Confusion : Real from Standard) + + ---Purpose: Tests if the point is identical to an other. + -- That is to say : + -- P1.myIndex = P2.myIndex + -- Abs (P1.myParam - P2.myParam) <= Confusion + -- P1.myPosit = P2.myPosit + -- P1.myBefore = P2.myBefore + -- P1.myAfter = P2.myAfter + -- P1.mySegBeg = P2.mySegBeg + -- P1.mySegEnd = P2.mySegEnd + -- P1.myType = P2.myType + + ---Category: PointOnElement + + returns Boolean from Standard + is static ; + + + IsDifferent (me; Point : PointOnElement from HatchGen ; + Confusion : Real from Standard) + + + ---Purpose: Tests if the point is different from an other. + + ---Category: PointOnElement + + returns Boolean from Standard + is static ; + + + Dump (me; Index : Integer from Standard = 0) + + ---Purpose: Dump of the point on element. + + is static ; + + +fields + + myType : IntersectionType from HatchGen is protected ; + +end PointOnElement from HatchGen ; diff --git a/src/HatchGen/HatchGen_PointOnElement.cxx b/src/HatchGen/HatchGen_PointOnElement.cxx new file mode 100644 index 00000000..11d8374f --- /dev/null +++ b/src/HatchGen/HatchGen_PointOnElement.cxx @@ -0,0 +1,253 @@ +// File: HatchGen_PointOnElement.cdl +// Created: Fri Oct 29 15:21:47 1993 +// Author: Jean Marc LACHAUME +// <jml@phobox> + +#include <Standard_Stream.hxx> +#include <HatchGen_PointOnElement.ixx> + +//======================================================================= +// Function : HatchGen_PointOnElement +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnElement::HatchGen_PointOnElement () : + HatchGen_IntersectionPoint () , + myType (HatchGen_UNDETERMINED) +{ +} + +//======================================================================= +// Function : HatchGen_PointOnElement +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnElement::HatchGen_PointOnElement (const HatchGen_PointOnElement& Point) +{ + myIndex = Point.myIndex ; + myParam = Point.myParam ; + myPosit = Point.myPosit ; + myBefore = Point.myBefore ; + myAfter = Point.myAfter ; + mySegBeg = Point.mySegBeg ; + mySegEnd = Point.mySegEnd ; + myType = Point.myType ; +} + +//======================================================================= +// Function : HatchGen_PointOnElement +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnElement::HatchGen_PointOnElement (const IntRes2d_IntersectionPoint& Point) +{ + const IntRes2d_Transition& TrsH = Point.TransitionOfFirst() ; + const IntRes2d_Transition& TrsE = Point.TransitionOfSecond() ; + + myIndex = 0 ; + + myParam = Point.ParamOnSecond() ; + + switch (TrsE.PositionOnCurve()) { + case IntRes2d_Head : myPosit = TopAbs_FORWARD ; break ; + case IntRes2d_Middle : myPosit = TopAbs_INTERNAL ; break ; + case IntRes2d_End : myPosit = TopAbs_REVERSED ; break ; + } + + switch (TrsH.TransitionType()) { + case IntRes2d_In : { + myBefore = TopAbs_OUT ; + myAfter = TopAbs_IN ; + myType = (myPosit == TopAbs_INTERNAL) ? HatchGen_TRUE : HatchGen_TOUCH ; + break ; + } + case IntRes2d_Out : { + myBefore = TopAbs_IN ; + myAfter = TopAbs_OUT ; + myType = (myPosit == TopAbs_INTERNAL) ? HatchGen_TRUE : HatchGen_TOUCH ; + break ; + } +// Modified by Sergey KHROMOV - Fri Jan 5 12:07:34 2001 Begin + case IntRes2d_Touch : { + switch (TrsH.Situation()) { + case IntRes2d_Inside : { + myType = HatchGen_TANGENT ; + switch (myPosit) { + case TopAbs_FORWARD : { + if (TrsE.IsOpposite()) { + myBefore = TopAbs_IN; + myAfter = TopAbs_OUT; + } else { + myBefore = TopAbs_OUT; + myAfter = TopAbs_IN; + } + break ; + } + case TopAbs_INTERNAL : { + myBefore = TopAbs_IN ; + myAfter = TopAbs_IN ; + break ; + } + case TopAbs_REVERSED : { + if (TrsE.IsOpposite()) { + myBefore = TopAbs_OUT; + myAfter = TopAbs_IN; + } else { + myBefore = TopAbs_IN; + myAfter = TopAbs_OUT; + } + break ; + } + case TopAbs_EXTERNAL: + break ; + } + break ; + } + case IntRes2d_Outside : { + myType = HatchGen_TANGENT ; + switch (myPosit) { + case TopAbs_FORWARD : { + if (TrsE.IsOpposite()) { + myBefore = TopAbs_OUT; + myAfter = TopAbs_IN; + } else { + myBefore = TopAbs_IN; + myAfter = TopAbs_OUT; + } + break ; + } + case TopAbs_INTERNAL : { + myBefore = TopAbs_OUT ; + myAfter = TopAbs_OUT ; + break ; + } + case TopAbs_REVERSED : { + if (TrsE.IsOpposite()) { + myBefore = TopAbs_IN; + myAfter = TopAbs_OUT; + } else { + myBefore = TopAbs_OUT; + myAfter = TopAbs_IN; + } + break ; + } + case TopAbs_EXTERNAL: + break ; + } + break ; + } + case IntRes2d_Unknown : { + myBefore = TopAbs_UNKNOWN ; + myAfter = TopAbs_UNKNOWN ; + myType = HatchGen_TANGENT ; + break ; + } + } + break ; + } +// Modified by Sergey KHROMOV - Fri Jan 5 12:07:46 2001 End + case IntRes2d_Undecided : { + myBefore = TopAbs_UNKNOWN ; + myAfter = TopAbs_UNKNOWN ; + myType = HatchGen_UNDETERMINED ; + break ; + } + } + + mySegBeg = Standard_False ; + mySegEnd = Standard_False ; +} + + +//======================================================================= +// Function : IsIdentical +// Purpose : Tests if the point is identical to an other. +//======================================================================= + +Standard_Boolean HatchGen_PointOnElement::IsIdentical (const HatchGen_PointOnElement& Point, + const Standard_Real Confusion) const +{ + Standard_Real Delta = Abs (myParam - Point.myParam) ; + return ( (Delta <= Confusion) + && (myIndex == Point.myIndex) + && (myPosit == Point.myPosit) + && (myType == Point.myType) + && (myBefore == Point.myBefore) + && (myAfter == Point.myAfter) + && (mySegBeg == Point.mySegBeg) + && (mySegEnd == Point.mySegEnd)) ; +} + +//======================================================================= +// Function : IsDifferent +// Purpose : Tests if the point is different from an other. +//======================================================================= + +Standard_Boolean HatchGen_PointOnElement::IsDifferent (const HatchGen_PointOnElement& Point, + const Standard_Real Confusion) const +{ + Standard_Real Delta = Abs (myParam - Point.myParam) ; + return ( (Delta > Confusion) + || (myIndex != Point.myIndex) + || (myPosit != Point.myPosit) + || (myType != Point.myType) + || (myBefore != Point.myBefore) + || (myAfter != Point.myAfter) + || (mySegBeg != Point.mySegBeg) + || (mySegEnd != Point.mySegEnd)) ; +} + +//======================================================================= +// Function : Dump +// Purpose : Dump of the point on element +//======================================================================= + +void HatchGen_PointOnElement::Dump (const Standard_Integer Index) const +{ + cout << " --- Point on element " ; + if (Index > 0) { + cout << "# " << setw(3) << Index << " " ; + } else { + cout << "------" ; + } + cout << "---------------" << endl ; + + cout << " Index of the element = " << myIndex << endl ; + cout << " Parameter on element = " << myParam << endl ; + cout << " Position on element = " ; + switch (myPosit) { + case TopAbs_FORWARD : cout << "FORWARD (i.e. BEGIN )" ; break ; + case TopAbs_INTERNAL : cout << "INTERNAL (i.e. MIDDLE )" ; break ; + case TopAbs_REVERSED : cout << "REVERSED (i.e. END )" ; break ; + case TopAbs_EXTERNAL : cout << "EXTERNAL (i.e. UNKNOWN)" ; break ; + } + cout << endl ; + cout << " Intersection Type = " ; + switch (myType) { + case HatchGen_TRUE : cout << "TRUE" ; break ; + case HatchGen_TOUCH : cout << "TOUCH" ; break ; + case HatchGen_TANGENT : cout << "TANGENT" ; break ; + case HatchGen_UNDETERMINED : cout << "UNDETERMINED" ; break ; + } + cout << endl ; + cout << " State Before = " ; + switch (myBefore) { + case TopAbs_IN : cout << "IN" ; break ; + case TopAbs_OUT : cout << "OUT" ; break ; + case TopAbs_ON : cout << "ON" ; break ; + case TopAbs_UNKNOWN : cout << "UNKNOWN" ; break ; + } + cout << endl ; + cout << " State After = " ; + switch (myAfter) { + case TopAbs_IN : cout << "IN" ; break ; + case TopAbs_OUT : cout << "OUT" ; break ; + case TopAbs_ON : cout << "ON" ; break ; + case TopAbs_UNKNOWN : cout << "UNKNOWN" ; break ; + } + cout << endl ; + cout << " Beginning of segment = " << (mySegBeg ? "TRUE" : "FALSE") << endl ; + cout << " End of segment = " << (mySegEnd ? "TRUE" : "FALSE") << endl ; + + cout << " ------------------------------------------" << endl ; +} diff --git a/src/HatchGen/HatchGen_PointOnHatching.cdl b/src/HatchGen/HatchGen_PointOnHatching.cdl new file mode 100644 index 00000000..410e8c42 --- /dev/null +++ b/src/HatchGen/HatchGen_PointOnHatching.cdl @@ -0,0 +1,169 @@ +-- File: HatchGen_PointOnHatching.cdl +-- Created: Fri Oct 29 15:21:47 1993 +-- Author: Jean Marc LACHAUME +-- <jml@phobox> +-- Copyright: Matra Datavision 1993 + +class PointOnHatching from HatchGen + + +inherits IntersectionPoint from HatchGen + + +uses + PointOnElement from HatchGen , + PointsOnElement from HatchGen , + IntersectionPoint from IntRes2d + +raises + OutOfRange from Standard + + +is + + + Create + + ---Purpose: Creates an empty point. + + ---Category: PointOnHatching + + returns PointOnHatching from HatchGen ; + + + + Create (Point : PointOnHatching from HatchGen) + + ---Purpose: Creates a point from an other. + + ---Category: PointOnHatching + + returns PointOnHatching from HatchGen ; + + + Create (Point : IntersectionPoint from IntRes2d) + + ---Purpose: Creates a point from an intersection point. + + ---Category: PointOnHatching + + returns PointOnHatching from HatchGen ; + + + Delete (me : out) is virtual; + ---C++: alias "Standard_EXPORT virtual ~HatchGen_PointOnHatching(){Delete();}" + ---Purpose: linux porting + + AddPoint (me : in out ; Point : PointOnElement from HatchGen ; + Confusion : Real from Standard) + + ---Purpose: Adds a point on element to the point. + + ---Category: PointOnHatching + + is static ; + + + NbPoints (me) + + ---Purpose: Returns the number of elements intersecting the + -- hatching at this point. + + ---Category: PointOnHatching + + returns Integer from Standard + is static ; + + + Point (me; Index : Integer from Standard) + + ---Purpose: Returns the Index-th point on element of the point. + -- The exception OutOfRange is raised if + -- Index > NbPoints. + + ---Category: PointOnHatching + + ---C++: return const & + + returns PointOnElement from HatchGen + raises OutOfRange from Standard + is static ; + + + RemPoint (me : in out ; Index : Integer from Standard) + + ---Purpose: Removes the Index-th point on element of the point. + -- The exception OutOfRange is raised if + -- Index > NbPoints. + + ---Category: PointOnHatching + + raises OutOfRange from Standard + is static ; + + + ClrPoints (me : in out) + + ---Purpose: Removes all the points on element of the point. + + ---Category: PointOnHatching + + is static ; + + + IsLower (me; Point : PointOnHatching from HatchGen ; + Confusion : Real from Standard) + + ---Purpose: Tests if the point is lower than an other. + -- A point on hatching P1 is said to be lower than an + -- other P2 if : + -- P2.myParam - P1.myParam > Confusion + + ---Category: PointOnHatching + + returns Boolean from Standard + is static ; + + + IsEqual (me; Point : PointOnHatching from HatchGen ; + Confusion : Real from Standard) + + + ---Purpose: Tests if the point is equal to an other. + -- A point on hatching P1 is said to be equal to an + -- other P2 if : + -- | P2.myParam - P1.myParam | <= Confusion + + ---Category: PointOnHatching + + returns Boolean from Standard + is static ; + + + IsGreater (me; Point : PointOnHatching from HatchGen ; + Confusion : Real from Standard) + + + ---Purpose: Tests if the point is greater than an other. + -- A point on hatching P1 is said to be greater than an + -- other P2 if : + -- P1.myParam - P2.myParam > Confusion + + ---Category: PointOnHatching + + returns Boolean from Standard + is static ; + + + Dump (me; Index : Integer from Standard = 0) + + ---Purpose: Dump of the point. + + is static ; + + +fields + + myPoints : PointsOnElement from HatchGen is protected ; + +end PointOnHatching from HatchGen ; diff --git a/src/HatchGen/HatchGen_PointOnHatching.cxx b/src/HatchGen/HatchGen_PointOnHatching.cxx new file mode 100644 index 00000000..6560a121 --- /dev/null +++ b/src/HatchGen/HatchGen_PointOnHatching.cxx @@ -0,0 +1,220 @@ +// File: HatchGen_PointOnHatching.cdl +// Created: Fri Oct 29 15:21:47 1993 +// Author: Jean Marc LACHAUME +// <jml@phobox> + +#include <Standard_Stream.hxx> +#include <HatchGen_PointOnHatching.ixx> + +#define RAISE_IF_NOSUCHOBJECT 0 + +//======================================================================= +// Function : HatchGen_PointOnHatching +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnHatching::HatchGen_PointOnHatching () : + HatchGen_IntersectionPoint () , + myPoints () +{ +} + +//======================================================================= +// Function : HatchGen_PointOnHatching +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnHatching::HatchGen_PointOnHatching (const HatchGen_PointOnHatching& Point) +{ + myIndex = Point.myIndex ; + myParam = Point.myParam ; + myPosit = Point.myPosit ; + myBefore = Point.myBefore ; + myAfter = Point.myAfter ; + mySegBeg = Point.mySegBeg ; + mySegEnd = Point.mySegEnd ; + myPoints = Point.myPoints ; +} + +//======================================================================= +// Function : HatchGen_PointOnHatching +// Purpose : Constructor. +//======================================================================= + +HatchGen_PointOnHatching::HatchGen_PointOnHatching (const IntRes2d_IntersectionPoint& Point) +{ + myIndex = 0 ; + myParam = Point.ParamOnFirst() ; + switch (Point.TransitionOfFirst().PositionOnCurve()) { + case IntRes2d_Head : myPosit = TopAbs_FORWARD ; break ; + case IntRes2d_Middle : myPosit = TopAbs_INTERNAL ; break ; + case IntRes2d_End : myPosit = TopAbs_REVERSED ; break ; + } + myBefore = TopAbs_UNKNOWN ; + myAfter = TopAbs_UNKNOWN ; + mySegBeg = Standard_False ; + mySegEnd = Standard_False ; + myPoints.Clear() ; +} + +void HatchGen_PointOnHatching::Delete() +{} + +//======================================================================= +// Function : AddPoint +// Purpose : Adds a point on element to the point. +//======================================================================= + +void HatchGen_PointOnHatching::AddPoint (const HatchGen_PointOnElement& Point, + const Standard_Real Confusion) +{ + Standard_Integer NbPnt = myPoints.Length() ; + // for (Standard_Integer IPnt = 1 ; + Standard_Integer IPnt; + for ( IPnt = 1 ; + IPnt <= NbPnt && myPoints(IPnt).IsDifferent (Point, Confusion) ; + IPnt++) ; + if (IPnt > NbPnt) myPoints.Append (Point) ; +} + + +//======================================================================= +// Function : NbPoints +// Purpose : Returns the number of elements intersecting the hatching at +// this point. +//======================================================================= + +Standard_Integer HatchGen_PointOnHatching::NbPoints () const +{ + return myPoints.Length() ; +} + +//======================================================================= +// Function : Point +// Purpose : Returns the Index-th point on element of the point. +//======================================================================= + +const HatchGen_PointOnElement& HatchGen_PointOnHatching::Point (const Standard_Integer Index) const +{ +#if RAISE_IF_NOSUCHOBJECT + Standard_Integer NbPnt = myPoints.Length() ; + Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPnt, "") ; +#endif + const HatchGen_PointOnElement& Point = myPoints.Value (Index) ; + return Point ; +} + +//======================================================================= +// Function : RemPoint +// Purpose : Removes the Index-th point on element of the point.. +//======================================================================= + +void HatchGen_PointOnHatching::RemPoint (const Standard_Integer Index) +{ +#if RAISE_IF_NOSUCHOBJECT + Standard_Integer NbPnt = myPoints.Length() ; + Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPnt, "") ; +#endif + myPoints.Remove (Index) ; +} + +//======================================================================= +// Function : ClrPoints +// Purpose : Removes all the points on element of the point. +//======================================================================= + +void HatchGen_PointOnHatching::ClrPoints () +{ + myPoints.Clear() ; +} + +//======================================================================= +// Function : IsLower +// Purpose : Tests if the point is lower than an other. +//======================================================================= + +Standard_Boolean HatchGen_PointOnHatching::IsLower (const HatchGen_PointOnHatching& Point, + const Standard_Real Confusion) const +{ + return (Point.myParam - myParam > Confusion) ; +} + +//======================================================================= +// Function : IsEqual +// Purpose : Tests if the point is equal to an other. +//======================================================================= + +Standard_Boolean HatchGen_PointOnHatching::IsEqual (const HatchGen_PointOnHatching& Point, + const Standard_Real Confusion) const +{ + return (Abs (Point.myParam - myParam) <= Confusion) ; +} + +//======================================================================= +// Function : IsGreater +// Purpose : Tests if the point is greater than an other. +//======================================================================= + +Standard_Boolean HatchGen_PointOnHatching::IsGreater (const HatchGen_PointOnHatching& Point, + const Standard_Real Confusion) const +{ + return (myParam - Point.myParam > Confusion) ; +} + +//======================================================================= +// Function : Dump +// Purpose : Dump of the point. +//======================================================================= + +void HatchGen_PointOnHatching::Dump (const Standard_Integer Index) const +{ + cout << "--- Point on hatching " ; + if (Index > 0) { + cout << "# " << setw(3) << Index << " " ; + } else { + cout << "------" ; + } + cout << "------------------" << endl ; + + cout << " Index of the hatching = " << myIndex << endl ; + cout << " Parameter on hatching = " << myParam << endl ; + cout << " Position on hatching = " ; + switch (myPosit) { + case TopAbs_FORWARD : cout << "FORWARD (i.e. BEGIN )" ; break ; + case TopAbs_INTERNAL : cout << "INTERNAL (i.e. MIDDLE )" ; break ; + case TopAbs_REVERSED : cout << "REVERSED (i.e. END )" ; break ; + case TopAbs_EXTERNAL : cout << "EXTERNAL (i.e. UNKNOWN)" ; break ; + } + cout << endl ; + cout << " State Before = " ; + switch (myBefore) { + case TopAbs_IN : cout << "IN" ; break ; + case TopAbs_OUT : cout << "OUT" ; break ; + case TopAbs_ON : cout << "ON" ; break ; + case TopAbs_UNKNOWN : cout << "UNKNOWN" ; break ; + } + cout << endl ; + cout << " State After = " ; + switch (myAfter) { + case TopAbs_IN : cout << "IN" ; break ; + case TopAbs_OUT : cout << "OUT" ; break ; + case TopAbs_ON : cout << "ON" ; break ; + case TopAbs_UNKNOWN : cout << "UNKNOWN" ; break ; + } + cout << endl ; + cout << " Beginning of segment = " << (mySegBeg ? "TRUE" : "FALSE") << endl ; + cout << " End of segment = " << (mySegEnd ? "TRUE" : "FALSE") << endl ; + + Standard_Integer NbPnt = myPoints.Length () ; + if (NbPnt == 0) { + cout << " No points on element" << endl ; + } else { + cout << " Contains " << NbPnt << " points on element" << endl ; + for (Standard_Integer IPnt = 1 ; IPnt <= NbPnt ; IPnt++) { + const HatchGen_PointOnElement& Point = myPoints.Value (IPnt) ; + Point.Dump (IPnt) ; + } + } + + cout << "----------------------------------------------" << endl ; +} |