1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

74
src/HatchGen/HatchGen.cdl Executable file
View File

@@ -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 ;

151
src/HatchGen/HatchGen_Domain.cdl Executable file
View File

@@ -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 ;

View File

@@ -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 ;
}

117
src/HatchGen/HatchGen_Domain.lxx Executable file
View File

@@ -0,0 +1,117 @@
// File: HatchGen_Domain.lxx
// Created: Tue Jan 3 10:27:32 1995
// Author: Laurent BUCHARD
// <lbr@mastox>
#include <Standard_DomainError.hxx>
//=======================================================================
// Function : SetPoints
// Purpose : Sets the first and the second points of the domain.
//=======================================================================
inline void HatchGen_Domain::SetPoints (const HatchGen_PointOnHatching& P1,
const HatchGen_PointOnHatching& P2)
{
myHasFirstPoint = Standard_True ;
myFirstPoint = P1 ;
myHasSecondPoint = Standard_True ;
mySecondPoint = P2 ;
}
//=======================================================================
// Function : SetPoints
// Purpose : Sets the first and the second points of the domain at the
// infinite.
//=======================================================================
inline void HatchGen_Domain::SetPoints ()
{
myHasFirstPoint = Standard_False ;
myHasSecondPoint = Standard_False ;
}
//=======================================================================
// Function : SetFirstPoint
// Purpose : Sets the first point of the domain.
//=======================================================================
inline void HatchGen_Domain::SetFirstPoint (const HatchGen_PointOnHatching& P)
{
myHasFirstPoint = Standard_True ;
myFirstPoint = P ;
}
//=======================================================================
// Function : SetFirstPoint
// Purpose : Sets the first point of the domain at the infinite.
//=======================================================================
inline void HatchGen_Domain::SetFirstPoint ()
{
myHasFirstPoint = Standard_False ;
}
//=======================================================================
// Function : SetSecondPoint
// Purpose : Sets the second point of the domain.
//=======================================================================
inline void HatchGen_Domain::SetSecondPoint (const HatchGen_PointOnHatching& P)
{
myHasSecondPoint = Standard_True ;
mySecondPoint = P ;
}
//=======================================================================
// Function : SetSecondPoint
// Purpose : Sets the second point of the domain at the infinite.
//=======================================================================
inline void HatchGen_Domain::SetSecondPoint ()
{
myHasSecondPoint = Standard_False ;
}
//=======================================================================
// Function : HasFirstPoint
// Purpose : Returns True if the domain has a first point.
//=======================================================================
inline Standard_Boolean HatchGen_Domain::HasFirstPoint () const
{
return myHasFirstPoint ;
}
//=======================================================================
// Function : FirstPoint
// Purpose : Returns the first point of the domain.
//=======================================================================
inline const HatchGen_PointOnHatching& HatchGen_Domain::FirstPoint () const
{
Standard_DomainError_Raise_if (!myHasFirstPoint, "HatchGen_Domain::FirstPoint") ;
return myFirstPoint ;
}
//=======================================================================
// Function : HasSecondPoint
// Purpose : Returns True if the domain has a second point.
//=======================================================================
inline Standard_Boolean HatchGen_Domain::HasSecondPoint () const
{
return myHasSecondPoint ;
}
//=======================================================================
// Function : SecondPoint
// Purpose : Returns the second of the domain.
//=======================================================================
inline const HatchGen_PointOnHatching& HatchGen_Domain::SecondPoint () const
{
Standard_DomainError_Raise_if (!myHasSecondPoint, "HatchGen_Domain::SecondPoint") ;
return mySecondPoint ;
}

View File

@@ -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 ;

View File

@@ -0,0 +1,76 @@
// File: HatchGen_ElementGen.gxx
// Created: Wed Nov 3 17:08:32 1993
// Author: Jean Marc LACHAUME
// <jml@phylox>
//=======================================================================
// Function : HatchGen_ElementGen
// Purpose : Magic Constructor.
//=======================================================================
HatchGen_ElementGen::HatchGen_ElementGen (const HatchGen_ElementGen& Other)
: myCurve(Other.myCurve), myOrientation(Other.myOrientation) {
}
//=======================================================================
// Function : HatchGen_ElementGen
// Purpose : Empty Constructor.
//=======================================================================
HatchGen_ElementGen::HatchGen_ElementGen () {
}
//=======================================================================
// Function : HatchGen_ElementGen
// Purpose : Constructor.
//=======================================================================
HatchGen_ElementGen::HatchGen_ElementGen (const TheElementCurve& Curve,
const TopAbs_Orientation Orientation) :
myCurve (Curve),
myOrientation (Orientation)
{
}
//=======================================================================
// Function : Curve
// Purpose : Returns the curve associated to the hatching.
//=======================================================================
const TheElementCurve& HatchGen_ElementGen::Curve () const
{
return myCurve ;
}
//=======================================================================
// Function : ChangeCurve
// Purpose : Returns the curve associated to the hatching.
//=======================================================================
TheElementCurve& HatchGen_ElementGen::ChangeCurve ()
{
return myCurve ;
}
//=======================================================================
// Function : Orientation
// Purpose : Sets the orientation of the element.
//=======================================================================
void HatchGen_ElementGen::Orientation (const TopAbs_Orientation Orientation)
{
myOrientation = Orientation ;
}
//=======================================================================
// Function : Orientation
// Purpose : Returns the orientation of the element.
//=======================================================================
TopAbs_Orientation HatchGen_ElementGen::Orientation () const
{
return myOrientation ;
}

View File

@@ -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;

View File

@@ -0,0 +1,216 @@
// File: HatchGen_ElementsGen.gxx
// Created: Fri Dec 16 16:26:12 1994
// Author: Laurent BUCHARD
// <lbr@mastox>
// Modified by skv - Fri Jul 14 17:03:47 2006 OCC12627
#include <TopAbs_Orientation.hxx>
#include <gp.hxx>
#include <gp_Vec2d.hxx>
//HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& Other) {
HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& ) {
cout<<" Magic Constructor in HatchGen_ElementsGen:: "<<endl;
}
HatchGen_ElementsGen::HatchGen_ElementsGen() {
NumWire = 0;
NumEdge = 0;
myCurEdge = 1;
}
void HatchGen_ElementsGen::Clear() {
myMap.Clear();
}
Standard_Boolean HatchGen_ElementsGen::IsBound(const TheKey& K) const {
return(myMap.IsBound(K));
}
Standard_Boolean HatchGen_ElementsGen::UnBind(const TheKey& K) {
return(myMap.UnBind(K));
}
Standard_Boolean HatchGen_ElementsGen::Bind(const TheKey& K,const TheItem& I) {
return(myMap.Bind(K,I));
}
const TheItem& HatchGen_ElementsGen::Find(const TheKey& K) const {
return(myMap.Find(K));
}
TheItem& HatchGen_ElementsGen::ChangeFind(const TheKey& K) {
return(myMap.ChangeFind(K));
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::Reject(const gp_Pnt2d&) const {
return Standard_False;
}
//=======================================================================
//function : Segment
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::Segment(const gp_Pnt2d& P,
gp_Lin2d& L,
Standard_Real& Par)
{
myCurEdge = 1;
return OtherSegment(P, L, Par);
}
//=======================================================================
//function : Segment
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::OtherSegment(const gp_Pnt2d& P,
gp_Lin2d& L,
Standard_Real& Par)
{
HatchGen_DataMapIteratorOfMapOfElements Itertemp;
Standard_Integer i;
for( Itertemp.Initialize(myMap), i = 1; Itertemp.More(); Itertemp.Next(), i++) {
if (i < myCurEdge)
continue;
void *ptrmyMap = (void *)(&myMap);
TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Itertemp.Key());
TheCurve& E = Item.ChangeCurve();
TopAbs_Orientation Or= Item.Orientation();
gp_Pnt2d P2 = E.Value
((E.FirstParameter() + E.LastParameter()) *0.5);
if ((Or == TopAbs_FORWARD) ||
(Or == TopAbs_REVERSED)) {
gp_Vec2d V(P,P2);
Par = V.Magnitude();
if (Par >= gp::Resolution()) {
L = gp_Lin2d(P,V);
myCurEdge++;
return Standard_True;
}
}
}
if (i == myCurEdge + 1) {
Par = RealLast();
L = gp_Lin2d(P,gp_Dir2d(1,0));
myCurEdge++;
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : InitWires
//purpose :
//=======================================================================
void HatchGen_ElementsGen::InitWires() {
NumWire = 0;
}
//=======================================================================
//function : RejectWire NYI
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::RejectWire(const gp_Lin2d& ,
const Standard_Real) const
{
return Standard_False;
}
//=======================================================================
//function : InitEdges
//purpose :
//=======================================================================
void HatchGen_ElementsGen::InitEdges() {
NumEdge = 0;
Iter.Initialize(myMap);
}
//=======================================================================
//function : RejectEdge NYI
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::RejectEdge(const gp_Lin2d& ,
const Standard_Real ) const
{
return Standard_False;
}
//=======================================================================
//function : CurrentEdge
//purpose :
//=======================================================================
void HatchGen_ElementsGen::CurrentEdge(TheCurve& E,
TopAbs_Orientation& Or) const
{
void *ptrmyMap = (void *)(&myMap);
TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Iter.Key());
E = Item.ChangeCurve();
Or= Item.Orientation();
#if 0
E.Edge() = TopoDS::Edge(myEExplorer.Current());
E.Face() = myFace;
Or = E.Edge().Orientation();
#endif
}
//=======================================================================
//function : MoreWires
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::MoreWires() const
{
return (NumWire == 0);
}
//=======================================================================
//function : NextWire
//purpose :
//=======================================================================
void HatchGen_ElementsGen::NextWire() {
NumWire++;
}
//=======================================================================
//function : MoreEdges
//purpose :
//=======================================================================
Standard_Boolean HatchGen_ElementsGen::MoreEdges() const {
return(Iter.More());
}
//=======================================================================
//function : NextEdge
//purpose :
//=======================================================================
void HatchGen_ElementsGen::NextEdge() {
Iter.Next();
}

503
src/HatchGen/HatchGen_Hatcher.cdl Executable file
View File

@@ -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 ;

1531
src/HatchGen/HatchGen_Hatcher.gxx Executable file

File diff suppressed because it is too large Load Diff

251
src/HatchGen/HatchGen_Hatcher.lxx Executable file
View File

@@ -0,0 +1,251 @@
// File: HatchGen_Hatcher.lxx
// Created: Tue Jan 3 10:12:02 1995
// Author: Laurent BUCHARD
// <lbr@mastox>
#define RAISE_IF_NOSUCHOBJECT 0
#define TRACE 0
#include <StdFail_NotDone.hxx>
#include HatchGen_Element_hxx
#include HatchGen_Elements_hxx
#include TheIntersector_hxx
#include TheCurveE_hxx
#include HatchGen_Hatching_hxx
//=======================================================================
// Function : Intersector
// Purpose : Returns the associated intersector.
//=======================================================================
inline const TheIntersector& HatchGen_Hatcher::Intersector ()
{
return myIntersector ;
}
//=======================================================================
// Function : ChangeIntersector
// Purpose : Returns the associated intersector.
//=======================================================================
inline TheIntersector& HatchGen_Hatcher::ChangeIntersector ()
{
return myIntersector ;
}
//=======================================================================
// Function : Confusion2d
// Purpose : Returns the 2d confusion tolerance.
//=======================================================================
inline Standard_Real HatchGen_Hatcher::Confusion2d () const
{
return myConfusion2d ;
}
//=======================================================================
// Function : Confusion3d
// Purpose : Returns the 3d confusion tolerance.
//=======================================================================
inline Standard_Real HatchGen_Hatcher::Confusion3d () const
{
return myConfusion3d ;
}
//=======================================================================
// Function : KeepPoints
// Purpose : Returns the flag about the points consideration.
//=======================================================================
inline Standard_Boolean HatchGen_Hatcher::KeepPoints () const
{
return myKeepPoints ;
}
//=======================================================================
// Function : KeepSegments
// Purpose : Returns the flag about the segments consideration.
//=======================================================================
inline Standard_Boolean HatchGen_Hatcher::KeepSegments () const
{
return myKeepSegments ;
}
//=======================================================================
// Function : Clear
// Purpose : Removes all the hatchings and all the elements.
//=======================================================================
inline void HatchGen_Hatcher::Clear ()
{
if (myNbHatchings != 0) ClrHatchings () ;
if (myNbElements != 0) ClrElements () ;
}
//=======================================================================
// Function : Element
// Purpose : Returns the IndE-th element.
//=======================================================================
inline HatchGen_Element& HatchGen_Hatcher::Element (const Standard_Integer IndE)
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
#endif
HatchGen_Element& Element = myElements.ChangeFind (IndE) ;
return Element ;
}
//=======================================================================
// Function : ElementCurve
// Purpose : Returns the curve associated to the IndE-th element.
//=======================================================================
inline const TheCurveE& HatchGen_Hatcher::ElementCurve (const Standard_Integer IndE) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
#endif
const HatchGen_Element& Element = myElements.Find (IndE) ;
return Element.Curve() ;
}
//=======================================================================
// Function : Hatching
// Purpose : Returns the IndH-th hatching.
//=======================================================================
inline HatchGen_Hatching& HatchGen_Hatcher::Hatching (const Standard_Integer IndH)
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
return Hatching ;
}
//=======================================================================
// Function : HatchingCurve
// Purpose : Returns the curve associated to the IndH-th hatching.
//=======================================================================
inline const TheCurveH& HatchGen_Hatcher::HatchingCurve (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.Curve() ;
}
//=======================================================================
// Function : NbPoints
// Purpose : Returns the number of intersection points of the IndH-th
// hatching.
//=======================================================================
inline Standard_Integer HatchGen_Hatcher::NbPoints (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.NbPoints() ;
}
//=======================================================================
// Function : Point
// Purpose : Returns the IndP-th intersection point of the IndH-th
// hatching.
//=======================================================================
inline const HatchGen_PointOnHatching& HatchGen_Hatcher::Point (const Standard_Integer IndH,
const Standard_Integer IndP) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
#if RAISE_IF_NOSUCHOBJECT
Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ;
#endif
const HatchGen_PointOnHatching& PntH = Hatching.Point (IndP) ;
return PntH ;
}
//=======================================================================
// Function : TrimDone
// Purpose : Returns the fact that all the intersections were computed
// for the IndH-th hatching.
//=======================================================================
inline Standard_Boolean HatchGen_Hatcher::TrimDone (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.TrimDone() ;
}
//=======================================================================
// Function : TrimFailed
// Purpose : Returns the fact that all the intersections failed
// for the IndH-th hatching.
//=======================================================================
inline Standard_Boolean HatchGen_Hatcher::TrimFailed (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.TrimFailed() ;
}
//=======================================================================
// Function : IsDone
// Purpose : Returns the fact that all the domains were computed
// for the IndH-th hatching.
//=======================================================================
inline Standard_Boolean HatchGen_Hatcher::IsDone (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.IsDone() ;
}
//=======================================================================
// Function : Status
// Purpose : Returns the status about the IndH-th hatching.
//=======================================================================
inline HatchGen_ErrorStatus HatchGen_Hatcher::Status (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
return Hatching.Status() ;
}
//=======================================================================
// Function : NbDomains
// Purpose : Returns the number of domains of the IndH-th hatching.
//=======================================================================
inline Standard_Integer HatchGen_Hatcher::NbDomains (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::NbDomains") ;
return Hatching.NbDomains() ;
}

View File

@@ -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 ;

View File

@@ -0,0 +1,321 @@
// File: HatchGen_HatchingGen.gxx
// Created: Wed Nov 3 17:08:32 1993
// Author: Jean Marc LACHAUME
// <jml@phylox>
#include <HatchGen_PointOnElement.hxx>
#define RAISE_IF_NOSUCHOBJECT 0
#include <Precision.hxx>
//=======================================================================
// Function : HatchGen_HatchingGen
// Purpose : Constructor.
//=======================================================================
HatchGen_HatchingGen::HatchGen_HatchingGen () {
}
//=======================================================================
// Function : HatchGen_HatchingGen
// Purpose : Constructor.
//=======================================================================
HatchGen_HatchingGen::HatchGen_HatchingGen (const TheHatchingCurve& Curve) :
myCurve (Curve),
myTrimDone (Standard_False),
myTrimFailed (Standard_False),
myIsDone (Standard_False),
myStatus (HatchGen_NoProblem)
{
}
//=======================================================================
// Function : Curve
// Purpose : Returns the curve associated to the hatching.
//=======================================================================
const TheHatchingCurve& HatchGen_HatchingGen::Curve () const
{
return myCurve ;
}
//=======================================================================
// Function : ChangeCurve
// Purpose : Returns the curve associated to the hatching.
//=======================================================================
TheHatchingCurve& HatchGen_HatchingGen::ChangeCurve ()
{
return myCurve ;
}
//=======================================================================
// Function : TrimDone
// Purpose : Sets the flag about the trimmings computation to the given
// value.
//=======================================================================
void HatchGen_HatchingGen::TrimDone (const Standard_Boolean Flag)
{
myTrimDone = Flag ;
}
//=======================================================================
// Function : TrimDone
// Purpose : Returns the flag about the trimmings computation.
//=======================================================================
Standard_Boolean HatchGen_HatchingGen::TrimDone () const
{
return myTrimDone ;
}
//=======================================================================
// Function : TrimFailed
// Purpose : Sets the flag about the trimmings failure to the given
// value.
//=======================================================================
void HatchGen_HatchingGen::TrimFailed (const Standard_Boolean Flag)
{
myTrimFailed = Flag ;
if (myTrimFailed) myStatus = HatchGen_TrimFailure ;
}
//=======================================================================
// Function : TrimFailed
// Purpose : Returns the flag about the trimmings failure.
//=======================================================================
Standard_Boolean HatchGen_HatchingGen::TrimFailed () const
{
return myTrimFailed ;
}
//=======================================================================
// Function : IsDone
// Purpose : Sets the flag about the domains computation to the given
// value.
//=======================================================================
void HatchGen_HatchingGen::IsDone (const Standard_Boolean Flag)
{
myIsDone = Flag ;
}
//=======================================================================
// Function : IsDone
// Purpose : Returns the flag about the domains computation.
//=======================================================================
Standard_Boolean HatchGen_HatchingGen::IsDone () const
{
return myIsDone ;
}
//=======================================================================
// Function : SetStatus
// Purpose : Sets the error status.
//=======================================================================
void HatchGen_HatchingGen::Status (const HatchGen_ErrorStatus Status)
{
myStatus = Status ;
}
//=======================================================================
// Function : Status
// Purpose : Returns the error status.
//=======================================================================
HatchGen_ErrorStatus HatchGen_HatchingGen::Status () const
{
return myStatus ;
}
//=======================================================================
// Function : AddPoint
// Purpose : Adds an intersection point to the hatching.
//=======================================================================
void HatchGen_HatchingGen::AddPoint (const HatchGen_PointOnHatching& Point,
const Standard_Real Confusion)
{
Standard_Integer NbPoints = myPoints.Length () ;
//for (Standard_Integer IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
Standard_Integer IPntH;
for (IPntH = 1 ; IPntH <= NbPoints ; IPntH++) {
const HatchGen_PointOnHatching& PntH = myPoints.Value (IPntH) ;
if (!PntH.IsLower (Point, Confusion)) break ;
}
if (IPntH > NbPoints) {
myPoints.Append (Point) ;
} else {
HatchGen_PointOnHatching& PntH = myPoints.ChangeValue (IPntH) ;
if (PntH.IsGreater (Point, Confusion)) {
myPoints.InsertBefore (IPntH, Point) ;
} else {
for (Standard_Integer IPntE = 1 ; IPntE <= Point.NbPoints() ; IPntE++) {
const HatchGen_PointOnElement& PntE = Point.Point (IPntE) ;
PntH.AddPoint (PntE, Confusion) ;
}
}
}
if (myIsDone) ClrDomains() ;
}
//=======================================================================
// Function : NbPoints
// Purpose : Returns the number of intersection points on the hatching.
//=======================================================================
Standard_Integer HatchGen_HatchingGen::NbPoints () const
{
return myPoints.Length () ;
}
//=======================================================================
// Function : Point
// Purpose : Returns the Index-th intersection point on the hatching.
//=======================================================================
const HatchGen_PointOnHatching& HatchGen_HatchingGen::Point (const Standard_Integer Index) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_Integer NbPoints = myPoints.Length () ;
Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
#endif
const HatchGen_PointOnHatching& Point = myPoints.Value (Index) ;
return Point ;
}
//=======================================================================
// Function : ChangePoint
// Purpose : Returns the Index-th intersection point on the hatching.
//=======================================================================
HatchGen_PointOnHatching& HatchGen_HatchingGen::ChangePoint (const Standard_Integer Index)
{
#if RAISE_IF_NOSUCHOBJECT
Standard_Integer NbPoints = myPoints.Length () ;
Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
#endif
HatchGen_PointOnHatching& Point = myPoints.ChangeValue (Index) ;
return Point ;
}
//=======================================================================
// Function : RemPoint
// Purpose : Removes the Index-th intersection point of the hatching.
//=======================================================================
void HatchGen_HatchingGen::RemPoint (const Standard_Integer Index)
{
#if RAISE_IF_NOSUCHOBJECT
Standard_Integer NbPoints = myPoints.Length () ;
Standard_OutOfRange_Raise_if (Index < 1 || Index > NbPoints, "") ;
#endif
if (myIsDone) ClrDomains() ;
myPoints.Remove (Index) ;
}
//=======================================================================
// Function : ClrPoints
// Purpose : Removes all the intersection points of the hatching.
//=======================================================================
void HatchGen_HatchingGen::ClrPoints ()
{
if (myIsDone) ClrDomains() ;
for (Standard_Integer IPntH = 1 ; IPntH <= myPoints.Length() ; IPntH++) {
HatchGen_PointOnHatching& Point = myPoints.ChangeValue (IPntH) ;
Point.ClrPoints() ;
}
myPoints.Clear () ;
myTrimDone = Standard_False ;
myTrimFailed = Standard_False ;
}
//=======================================================================
// Function : AddDomain
// Purpose : Adds a domain to the hatching.
//=======================================================================
void HatchGen_HatchingGen::AddDomain (const HatchGen_Domain& Domain)
{
myDomains.Append (Domain) ;
}
//=======================================================================
// Function : NbDomains
// Purpose : Returns the number of domains on the hatching.
//=======================================================================
Standard_Integer HatchGen_HatchingGen::NbDomains () const
{
return myDomains.Length () ;
}
//=======================================================================
// Function : Domain
// Purpose : Returns the Index-th domain on the hatching.
//=======================================================================
const HatchGen_Domain& HatchGen_HatchingGen::Domain (const Standard_Integer Index) const
{
#if RAISE_IF_NOSUCHOBJECT
Standard_Integer NbDomains = myDomains.Length () ;
Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
#endif
const HatchGen_Domain& Domain = myDomains.Value (Index) ;
return Domain ;
}
//=======================================================================
// Function : RemDomain
// Purpose : Removes the Index-th domain of the hatching.
//=======================================================================
void HatchGen_HatchingGen::RemDomain (const Standard_Integer Index)
{
#if RAISE_IF_NOSUCHOBJECT
Standard_Integer NbDomains = myDomains.Length () ;
Standard_OutOfRange_Raise_if (Index < 1 || Index > NbDomains, "") ;
#endif
myDomains.Remove (Index) ;
}
//=======================================================================
// Function : ClrDomains
// Purpose : Removes all the domains of the hatching.
//=======================================================================
void HatchGen_HatchingGen::ClrDomains ()
{
myDomains.Clear () ;
myIsDone = Standard_False ;
}
//=======================================================================
// Function : ClassificationPoint
// Purpose : returns a 2d point on the curve
//=======================================================================
gp_Pnt2d HatchGen_HatchingGen::ClassificationPoint () const {
Standard_Real t,a,b;
a = myCurve.FirstParameter();
b = myCurve.LastParameter();
if(b >= Precision::Infinite()) {
if(a <= -Precision::Infinite()) {
t=0;
}
else {
t = a;
}
}
else {
t = b;
}
return(myCurve.Value(t));
}

View File

@@ -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 ;

View File

@@ -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 ;
}

View File

@@ -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 ;

View File

View File

@@ -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 ;

View File

@@ -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 ;
}

View File

@@ -0,0 +1,25 @@
// File: HatchGen_PointOnElement.lxx
// Created: Tue Jan 3 10:32:44 1995
// Author: Laurent BUCHARD
// <lbr@mastox>
//=======================================================================
// Function : SetIntersectionType
// Purpose : Sets the intersection type at this point.
//=======================================================================
inline void HatchGen_PointOnElement::SetIntersectionType (const HatchGen_IntersectionType Type)
{
myType = Type ;
}
//=======================================================================
// Function : IntersectionType
// Purpose : Returns the intersection type at this point.
//=======================================================================
inline HatchGen_IntersectionType HatchGen_PointOnElement::IntersectionType () const
{
return myType ;
}

View File

@@ -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 ;

View File

@@ -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 ;
}