1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0023442: Provide the access to the functionality of Geom2dHatch_Hacher via IntTools_Context

class IntTools_Context
- the method:
Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
has been added.
The method returns the reference to 2D hatcher for given face <aF>

class IntTools_Context
- the method: IntTools_Context::~IntTools_Context()
has been modified in terms of I.1.
This commit is contained in:
pkv 2012-10-05 13:45:23 +04:00
parent 5df3a117e1
commit 3f52476587
3 changed files with 165 additions and 69 deletions

View File

@ -47,7 +47,8 @@ uses
IntSurf,
BRepClass3d,
TColgp,
MMgt
MMgt,
Geom2dHatch
is

View File

@ -47,7 +47,8 @@ uses
IndexedDataMapOfTransientAddress from IntTools,
FClass2d from IntTools,
SurfaceRangeLocalizeData from IntTools,
Curve from IntTools
Curve from IntTools,
Hatcher from Geom2dHatch
--raises
@ -111,6 +112,18 @@ is
--- Returns a reference to solid classifier
--- for given solid
---
--modified by NIZNHY-PKV Mon Sep 24 07:52:54 2012f
Hatcher(me: mutable;
aF: Face from TopoDS)
returns Hatcher from Geom2dHatch;
---C++: return &
---Purpose:
--- Returns a reference to 2D hatcher
--- for given face
---
--modified by NIZNHY-PKV Mon Sep 24 07:52:54 2012t
--- API Block
---
@ -294,12 +307,13 @@ is
---
fields
myFClass2dMap : IndexedDataMapOfShapeAddress from TopTools;
myProjPSMap : IndexedDataMapOfShapeAddress from TopTools;
myProjPCMap : IndexedDataMapOfShapeAddress from TopTools;
myProjPTMap : IndexedDataMapOfTransientAddress from IntTools;
mySClassMap : IndexedDataMapOfShapeAddress from TopTools;
myProjSDataMap: IndexedDataMapOfShapeAddress from TopTools;
myFClass2dMap : IndexedDataMapOfShapeAddress from TopTools is protected;
myProjPSMap : IndexedDataMapOfShapeAddress from TopTools is protected;
myProjPCMap : IndexedDataMapOfShapeAddress from TopTools is protected;
myProjPTMap : IndexedDataMapOfTransientAddress from IntTools is protected;
mySClassMap : IndexedDataMapOfShapeAddress from TopTools is protected;
myProjSDataMap: IndexedDataMapOfShapeAddress from TopTools is protected;
myHatcherMap : IndexedDataMapOfShapeAddress from TopTools is protected;
end Context;

View File

@ -41,6 +41,14 @@
#include <Extrema_LocateExtPC.hxx>
#include <Geom2d_Curve.hxx>
//
#include <Geom2dHatch_Intersector.hxx>
#include <BRepTools.hxx>
#include <TopExp_Explorer.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Precision.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
//=======================================================================
//function :
@ -58,6 +66,18 @@ IntTools_Context::~IntTools_Context()
Standard_Address anAdr;
Standard_Integer i, aNb;
//
//modified by NIZNHY-PKV Mon Sep 24 08:01:03 2012f
Geom2dHatch_Hatcher* pHatcher;
aNb=myHatcherMap.Extent();
for (i=1; i<=aNb; ++i) {
anAdr=myHatcherMap(i);
pHatcher=(Geom2dHatch_Hatcher*)anAdr;
delete pHatcher;
}
myHatcherMap.Clear();
//
//modified by NIZNHY-PKV Mon Sep 24 08:01:07 2012t
//
IntTools_FClass2d* pFClass2d;
aNb=myFClass2dMap.Extent();
for (i=1; i<=aNb; ++i) {
@ -114,6 +134,73 @@ IntTools_Context::~IntTools_Context()
}
myProjSDataMap.Clear();
}
//modified by NIZNHY-PKV Mon Sep 24 07:56:45 2012f
//=======================================================================
//function : Hatcher
//purpose :
//=======================================================================
Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
{
Standard_Address anAdr;
Geom2dHatch_Hatcher* pHatcher;
//
anAdr=myHatcherMap.FindFromKey1(aF);
if (!anAdr) {
Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
Standard_Real aUMin, aUMax, aVMin, aVMax, aU1, aU2, aEpsT;
TopAbs_Orientation aOrE;
Handle(Geom_Surface) aS;
Handle(Geom2d_Curve) aC2D;
Handle(Geom2d_TrimmedCurve) aCT2D;
TopoDS_Face aFF;
TopExp_Explorer aExp;
//
aTolHatch2D=1.e-8;
aTolHatch3D=1.e-8;
aTolArcIntr=1.e-10;
aTolTangfIntr=1.e-10;
aEpsT=Precision::PConfusion();
//
Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
pHatcher=new Geom2dHatch_Hatcher(aIntr,
aTolHatch2D, aTolHatch3D,
Standard_True, Standard_False);
//
aFF=aF;
aFF.Orientation(TopAbs_FORWARD);
aS=BRep_Tool::Surface(aFF);
//BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
aExp.Init (aFF, TopAbs_EDGE);
for (; aExp.More() ; aExp.Next()) {
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
aOrE=aE.Orientation();
//
aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
if (aC2D.IsNull() ) {
continue;
}
if (fabs(aU1-aU2) < aEpsT) {
continue;
}
//
aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
pHatcher->AddElement(aCT2D, aOrE);
}// for (; aExp.More() ; aExp.Next()) {
//
anAdr=(Standard_Address)pHatcher;
myHatcherMap.Add(aFF, anAdr);
}// if (!anAdr) {
//
else {
Standard_Address *pAdr=(Standard_Address *)anAdr;
pHatcher=(Geom2dHatch_Hatcher*)*pAdr;
}
return *pHatcher;
}
//modified by NIZNHY-PKV Mon Sep 24 07:56:45 2012t
//=======================================================================
//function : FClass2d
//purpose :
@ -319,12 +406,6 @@ IntTools_Context::~IntTools_Context()
return -1;
}
//
//modified by NIZNHY-PKV Wed Jul 13 08:30:08 2011f
//if (!BRep_Tool::IsGeometric(aE2)) {
// return -2;
//}
//modified by NIZNHY-PKV Wed Jul 13 08:30:13 2011t
//
Standard_Real aTolV1, aTolE2, aTolSum, aTolVx;
Standard_Integer aNbProj;
gp_Pnt aP;