1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Compare commits

..

103 Commits

Author SHA1 Message Date
aml
e9f48bc76b 0023914: Intersection algorithm produced too many intersection points
Second order next point computation added.
2015-02-11 09:37:47 +03:00
abv
2fe4f8f37b Fix compiler warning and adjust test cases for integration to master 2015-02-06 13:55:31 +03:00
mkv
a41fbc10b9 Update new testing cases after renaming DRAW command 2015-02-06 13:13:42 +03:00
abv
7a5f12021e 0024500: Sudden exit of DRAW after multiple execution of test in cycle
Test commands for #23952 refactored to:
- avoid interaction with Tcl interpreter from thread functions (fixes sudden crash)
- get shapes outside of the thread functions (keeping only code being tested inside)
- run 100 threads instead of 2 (increases chance for data race to exhibit if present)

Linux compilation problems fixed.
2015-02-05 18:09:12 +03:00
kgv
8d3aa19e69 0025768: Visualization, Graphic3d_Structure - do not use invalid bounding boxes of empty groups
Prs3d_WFShape::Add() - do not create empty group

Graphic3d_Structure::minMaxCoord() - do not use uninitialized bounding box

Added test case bugs/vis/bug25768
2015-02-05 18:06:21 +03:00
aml
15b54261a3 0022598: Approximation of p-curve by 2D line
Check whether p-curve being projected can be approximated by straight line is made before full-scale projection, to improve performance.
If straight, pcurve is created as Line only if this will lead to the same range parameterization as 3d curve, otherwise BSpline of degree 1 is created.
Re-approximation of line pcurves by bsplines removed from ShapeFix_Edge.

Test case updating to new behavior.

Added "static" keyword to the  fixPeriodictyTroubles() function.

Update of test-cases according new behavior
2015-02-05 18:02:16 +03:00
ibs
9ccea0c628 0025791: Impossibility to generate projects for Foundation Classes without TclTk/Freetype using CMake
unset redundant variables
2015-02-05 16:37:32 +03:00
ika
0769561063 0024601: Unwanted spheres shown after Step-Import
Add check for outer boundary before creating wire from Vertex Loop on spheres.
Test case for issue CR24601
2015-02-05 16:26:00 +03:00
emv
a4d5c9abcc 0025766: Exception in BRepAlgo_Section
class TopOpeBRep_FacesIntersector
method
static void MergeWLinesIfAllSegmentsAlongRestriction(IntPatch_SequenceOfLine&           theSlin,
						     const Handle(Adaptor3d_HSurface)&  theSurface1,
						     const Handle(Adaptor3d_TopolTool)& theDomain1,
						     const Handle(Adaptor3d_HSurface)&  theSurface2,
						     const Handle(Adaptor3d_TopolTool)& theDomain2,
						     const Standard_Real                theTolArc)
Protection from null wlines has been added.

Test-case for issue #25766
2015-02-05 16:22:29 +03:00
aml
e8746a262f 0025635: Wrong result of 2D-extrema between two ellipsis
Fixed Lipschitz constant evaluation in case co-parametrized objects.
Fixed 2dextrema output.
Testcase update to new behavior.

Test cases for issue CR25635

Correction of test cases for issue CR25635
2015-02-05 16:14:55 +03:00
aml
3f733bb126 0025708: GeomAPI_ExtremaCurveCurve does not return all intersection points in 6.8.0
Added expanding coefficients between neighboring indexes, changed local optimization starting condition.

Test case for issue CR25708
2015-02-05 16:03:36 +03:00
vpa
14a35e5d91 0025675: Visualization - Fix problems and inefficiencies with frustum culling
Removed unnecessary overlap check in traverse of layer items;
Slight optimization of calculations in overlap detection methods in OpenGl_BVHTreeSelector.
2015-02-05 15:54:23 +03:00
msv
c7b59798ca 0024826: Wrapping of parallelisation algorithms
Simple primitives to parallelize loops type "for" and "foreach" were implemented. The primitives encapsulates complete logic for creating and managing parallel context of loops. Moreover the primitives may be a wrapper for some primitives from 3rd-party library - TBB.

To use it is necessary to implement TBB like interface which is based on functors. For example:

Class Functor
{
public:
  void operator() ([proccesing instance]) const
  {
    //...
  }
};

In the body of the operator () should be implemented thread-safe logic of computations that can be performed in parallel context. If parallelized loop iterates on the collections with direct access by index (such as Vector, Array), it is more efficient to use the primitive ParallelFor (because it has no critical section).

All parts of  OCC code which are using tbb were changed on new primitives.

0024826: Wrapping of parallelisation algorithms

Small fix.
2015-02-05 15:51:05 +03:00
ink
a61133c8c7 0025780: checkshape raises an exception Standard_OutOfMemory.
Improved method BRepCheck_Wire::Propagate

Added test cases bugs/modalg_5/bug25780
2015-02-05 15:41:22 +03:00
kgv
298fdbfb18 0025790: Drop unimplemented method ShallowCopy() from TCollection_HSequence.cdl 2015-02-05 15:29:23 +03:00
akz
0bb1f1133c 0025740: VrmlData_Scene::WriteArrIndex() writes extra point indices.
Reason of bug: at the end of writing indices the "buf" was written double times.
Fix: At the end of operation skip one WriteLine.

Test case for issue CR25740
2015-02-05 15:27:45 +03:00
akz
f5fa6b335c 0025279: OCCT fails to read VRML file created by OCCT
1) Version of VRML format is added to VrmlAPI_Writer::Write() and VrmlAPI::Write() to allow use the both versions of the VRML by one writer.
2) Unification of the command to write VRML of both versions. Now "writevrml" command can write VRLM files of v1.0 and v2.0, with wireframe/shaded/both representations. Parameter "Deflection" was removed (next commit will remove meshing, so parameter will be useless).
3) Meshing is removed from writers of both (v1.0 and v2.0) versions. Shaded representation is skipped in case when a mesh does not exist.
Wireframe representation checks the existence of a mesh before. If the mesh exists, a deflected edges are taken from the mesh, otherwise - are generated with the default deflection.
4) Drawing of redundant edges is removed in wireframe representation of VRML version 1.0 (a grid on non-plane surfaces does not match a real edges of TopoDS_Shape and does not match representation in version 2.0).

Test case for issue CR25279
2015-02-05 15:02:52 +03:00
aml
31e0b8e84c 0025770: Possible "invalid memory access"
Memory problems fixed.
2015-02-05 14:56:43 +03:00
aba
0b0320e76e 0025475: Visualization, TKOpenGl - draw background using primitive arrays
Move background arrays to separate class OpenGl_BackgroundArray
for texture and gradient arrays.

Eliminated warnings on Linux
2015-02-05 14:49:28 +03:00
akz
843e15cd32 0025689: IGESCAFControl_Writer crash in constructor.
Cause of bug is that the IGESData_BasicEditor is created before an initialization of IGESControl_Controller::Init(). IGESData_BasicEditor cannot find template "iges", so the model is still empty after creation.

1) Added a default constructor to the IGESData_BasicEditor. Can be initialized via Init() method.
2) Added some null checks in the places, where are provided access to the model (IGESData_BasicEditor's member).
3) Initialization of the IGESData_BasicEditor was placed after initialization if the IGESControl_Controller.
2015-02-05 14:45:46 +03:00
akz
b9c1e44004 0025357: STL writer does not check the given shape for existing triangulation and remeshes shape using BRepMesh in force mode.
StlTransfer.cxx, function StlTransfer::BuildIncrementalMesh(...) fills the StlMesh_Mesh. Before this fix the StlTransfer always force meshing of the passed shape.

Now meshing is completely removed from the StlTransfer. StlWriter can return error status now, for example, if a mesh of the passed shape is empty. In this case file will be not created.

Added test case bugs/xde/bug25357

Avoid the warning on gcc compiler.
Test scripts were modified according to the fix.
     1) bug23192, bug22670, bug23193: removed "isParallel" flag from the command
         arguments. Manually meshing of the shape (as far as meshing was removed
         from STL writer).
     2) bug22898: before the fix writestl always remeshes the shape with a
         deflection, related to the boundery box of the shape. For "hammer" shape
         there is a 38.9076 deflection for mesh. Differences between before writing
         and after reading are dedicated to fact that stl writes triangulation as
         an elements of the spahe (like faces, edges etc.)
2015-02-05 14:40:24 +03:00
pkv
402bfe81c0 0025769: Replace BOPCol_Array1 with NCollection_Vector
New features:
1. class NCollection_BaseVector
    method:
    void SetIncrement(const Standard_Integer aIncrement)
    has been added.
    The method allows to set the size of increment dynamically
    [ not in constructor ].

2 class BOPCol_Array1
    has been removed.

Changes:
1. classes
BOPDS_DS
BOPDS_InterfFF
BOPDS_Iterator
BOPDS_VectorOfCurve
BOPDS_VectorOfFaceInfo
BOPDS_VectorOfIndexRange
BOPDS_VectorOfInterfEE
BOPDS_VectorOfInterfEF
BOPDS_VectorOfInterfEZ
BOPDS_VectorOfInterfFF
BOPDS_VectorOfInterfFZ
BOPDS_VectorOfInterfVE
BOPDS_VectorOfInterfVF
BOPDS_VectorOfInterfVV
BOPDS_VectorOfInterfVZ
BOPDS_VectorOfInterfZZ
BOPDS_VectorOfListOfPassKeyBoolean
BOPDS_VectorOfListOfPaveBlock
BOPDS_VectorOfPoint
BOPDS_VectorOfShapeInfo
BOPAlgo_PaveFiller
QANewModTopOpe_Tools
have been modified to take into account New features: 1 and 2

2. class BOPTest_Chronometer
has been modified to use the driver of the type
OSD_Timer instead OSD_Chronometer
2015-02-05 14:32:08 +03:00
dbp
b990e5579a 0025328: Visualization, TKOpenGl - support text rendering within built-in GLSL programs 2015-02-05 14:28:04 +03:00
ski
bcf50875e3 0025734: GCC warnings in Android build
Warnings were fixed.

Fixed wrong re-initialization.
2015-02-05 14:24:12 +03:00
ski
5fd3308acd 0023971: Possibility to extract all error messages from test log
It is possible now to extract all error messages from test log using key "-errors"

Conflicts:
	src/DrawResources/TestCommands.tcl
2015-02-05 14:14:54 +03:00
ski
433673e0dd 0023992: it's required to save log information of test command in (specified) file
It is possible now to save log information of test command in specified file.

Print information on count of found test cases before tests start

Sound signal at the end of the test

Used meminfo -h to control memory

Titles of differences in images produced by testdiff command were changed.
2015-02-05 14:12:11 +03:00
kgv
e3414ada99 0025758: Visualization, TKOpenGl - texture initialization fails on Intel HD 4600 in ray tracing test
Unbind global texture sampler right after its usage.
2015-02-05 13:53:35 +03:00
kgv
1e99558fbd 0025762: Visualization, TKOpenGl - fix debug assertion within OpenGl_Workspace::UploadRaytraceData() 2015-02-05 12:51:58 +03:00
pkv
34a0b4463a 0025735: Wrong solid is considered as valid by checkshape
Changes:
class BRepCheck_Solid
method:
   void BRepCheck_Solid::Minimum()
has been changed. The treatment of shells with INTERNAL faces has been added.

Added test case bugs/modalg_5/bug25735

Added TODOs in test cases according to issue 25735.
2015-02-05 12:50:14 +03:00
mkv
4e0311752a 0025632: IGES writer looses face orientation
Update new tensing cases for issue
2015-01-30 13:52:25 +03:00
aml
9bf0740bed 0025631: Bounding box is too big for the face.
Fixed start and finish indexes of poles in case of trimmed bspline surface.

Test case for issue CR25631
2015-01-29 15:10:41 +03:00
akz
4366363b04 0023328: Importing VRML files with "scaleOrientation" not possible
If-else blocks "scale" and "scaleOrientation" was swapped. Now the comparing and interpretation of these key-words is correct.

Added test case bugs/xde/bug23328
2015-01-29 14:24:31 +03:00
ika
2157cfd0ef 0025632: IGES writer looses face orientation
Adding reversing surfaces before writing for reversed faces

Test case for issue CR25632
2015-01-29 14:15:30 +03:00
abv
fd3ba7a1d9 0025717: Non reentrant (and hence non-thread-safe) math_RealRandom / _IntegerRandom
Classes math_IntegerRandom and math_RealRandom, and method Random2 in math_Recipes, removed. Class math_BullardGenerator is used instead.
2015-01-29 14:09:42 +03:00
vpa
0bb09048e2 0025679: Visualization, TKOpenGl - View frustum culling clips wrong objects
Corrected area calculation for degenerated AABBs in BVH_Box;
Test case for issue 25679.
2015-01-29 14:05:40 +03:00
imn
df515f16ce 0025743: Add FixMode parameter to DropSmallSolids operator 2015-01-29 14:03:06 +03:00
nbv
b2af2f567d 0025715: Intersection between cylinders produces excess vertices
1. Curve boundaries were more precised.
2. Some test cases were changed in accordance of their new behavior.
3. Code fragment for WLines joining was moved to higher level (for more universal using in the future).

Code was changed in accordance with the last remark.

Added test cases bugs/modalg_5/bug25715_1 bug25715_2 bug25715_3
2015-01-29 14:01:10 +03:00
Roman Lygin
a70f58235a 0025712: Non-deterministic behavior of ShapeFix_Solid
Test-case for issue #25712
2015-01-29 13:58:05 +03:00
jgv
c7806cb6e6 0025704: BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
Added test cases bugs/modalg_5/bug25704_1 - bug25704_6
2015-01-29 13:46:54 +03:00
azn
6da30ff153 0025622: CAST analysis: Avoid invocation of virtual Methods of the declared Class in a Constructor or Destructor
The Delete() methods have been deleted from the following classes:
- Adaptor2d_Curve2d
- Adaptor3d_Curve
- Adaptor3d_Surface
- AppBlend_Approx
- AppCont_Function
- AppParCurves_MultiCurve
- AppParCurves_MultiPoint
- ApproxInt_SvSurfaces
- BRepPrim_OneAxis
- BRepSweep_NumLinearRegularSweep
- BRepSweep_Translation
- BRepSweep_Trsf
- DBC_BaseArray
- GeomFill_Profiler
- HatchGen_PointOnHatching
- math_BFGS
- math_FunctionSet
- math_FunctionSetRoot
- math_FunctionWithDerivative
- math_MultipleVarFunction
- math_MultipleVarFunctionWithHessian
- math_MultipleVarFunctionWithGradient
- math_Powell
- math_NewtonMinimum
- math_NewtonFunctionSetRoot
- math_BissecNewton (just add virtual destructor)
- math_FRPR
- math_BrentMinimum (just add virtual destructor)
- OSD_Chronometer
- ProjLib_Projector

Virtual methods Delete() or Destroy() of the transient inheritors is not changed (-> separate issue).
Classes Graphic3d_DataStructureManager and PrsMgr_Presentation without changes.
2015-01-29 13:43:36 +03:00
ysn
e2b55410ff 0023640: Documentation for local sewing with BRepBuilderAPI_Sewing is missing
Fix for bug 23640.
Merging the rest of Technical Overview content into User's Guides.

-Correct UG sections concerning Sewing.
-Correct comments in the code referring to old location of sewing algorithm.
2015-01-29 13:23:12 +03:00
msv
07f1a2e68c 0025719: Boolean operations can crash
Suppress math_BFGS constructor that calls the method Perform that in its turn calls the virtual method IsSolutionReached.
2015-01-29 13:13:59 +03:00
abv
618617fe06 0023880: Integration of grid "ncl" into the new testing system
Function perf_sprint_all_meters added in OSD_PerfMeter.h to allow printing to string buffer rather than stdout. Macro PERF_PRINT_ALL converted to functional form.

Command dperf added in DRAW to print and conditionally reset all meters.
Description of these tools is added in Debug Hints.

Modified output of command QANTestNCollectionPerformance.
Added test case perf/ncollection/A1

Modified ratio of performance to check all platforms

Small correction of test-case for Windows platform
2015-01-29 13:10:14 +03:00
azv
76eeac70cf 0025582: SIGSEGV in thrusections of circle segments
Eliminating regressions

Fixed compilation warning ('di' : unreferenced formal parameter).

Added test bugs/modalg_5/bug25578
2015-01-29 12:55:54 +03:00
azv
52ba6031e8 0025706: SIGSEGV after making existing BSplineCurve rational
1. Eliminated exception after conversion non-rational B-spline to rational
2. Implemented DRAW command setweight to change weights of B-spline
3. Test cases were added
2015-01-29 12:54:52 +03:00
azv
0fe1715f01 0025582: SIGSEGV in thrusections of circle segments
1. Implemented using of trimmed circular curve
2. Added test case
2015-01-29 12:54:49 +03:00
azv
79186c39b3 0025578: SIGSEGV in BRepSweep_Rotation in case of singularities
Eliminating degenerated edges
2015-01-29 12:54:45 +03:00
azv
89bc1237a4 0025711: Get rid of static variable islambdadefined in AppParCurves_BSpGradient.gxx 2015-01-29 12:54:42 +03:00
apn
bdde45c38c 0025346: Wrong result of General Fuse operation
Added test cases bugs/modalg_5/bug25346_1 bug25346_2
2015-01-29 12:28:30 +03:00
István Csanády
dba608bb39 0025692: Boolean operations minor improvement
Method IntPolyh_MaillageAffinage::TriContact() improved so that local objects for detailed analysis are not created if algorithm exits by simple conditions checked at the beginning.
2015-01-29 12:26:39 +03:00
azv
27a6612865 0020040: Difference in treatment of closed curves in BRep_Builder::UpdateEdge
Test case was added

Modified test cases to extract the shell from the solid and check it for closeness.
2015-01-22 17:44:39 +03:00
azv
da72a17c80 0025656: Specification of semantic of Closed flag of an edge
1. Using of the "Closed" flag was unified:
  a) this flag is applicable for TopoDS_Wire and TopoDS_Shell only, because these entities may hedge an area in 2D space or a volume in 3D space correspondingly;
  b) other types of TopoDS shapes are passing over this flag;
  c) changing of this flag should be controlled by high-level algorithms (not BRep_Builder).
2. Implemented verification of the closedness of edges. An edge is closed if and only if its first and last vertices are the same.
3. Test cases were changed according to new behavior.
2015-01-22 17:37:32 +03:00
kgv
a195430212 0024394: Visualization - implement more general way for rendering of immediate objects
Move OpenGl_Structure::myZLayer to base class Graphic3d_CStructure.
Graphic3d_ZLayerId - introduce new pre-defined ZLayers.
Do not clear Depth buffer twice for default ZLayer.

AIS_InteractiveContext::Display() - add new argument AIS_DisplayStatus to specify displaying status.

Drop unused Graphic3d_CPick and related methods.
Drop OpenGl_Structure::myNamedStatus - use flags from parent class Graphic3d_CStructure directly.
OpenGl_LayerList ::ChangeLayer(), ::ChangePriority - fix structure remove from unexpected layer.
Merge class OpenGl_PriorityList into OpenGl_Layer.

PrsMgr_PresentationManager::mySelectionColor - store selection color as field of Presentation Manager.
PrsMgr_Presentation class - do not declare private methods as virtual.
PrsMgr_Presentation::Highlight() - extend method syntax and drop methods ::Color() and ::BoundBox().

PrsMgr_PresentableObject - store ZLayer in presentable object
to display object presentations in required layer directly
(without displaying it in wrong layer first).

test/mesh/end - force re-displaying the shape to compute mesh anew

Test-case for issue
2015-01-22 17:31:53 +03:00
emv
92e24f9d36 0025722: Wrong implementation of SetFuzzyValue method
The following methods
  void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz)
  void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz)
  void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz)
  void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz)
  void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz)
  void BRepAlgoAPI_Check::SetFuzzyValue(const Standard_Real theFuzz)
have been corrected.

Added test case bugs/modalg_5/bug25722
2015-01-22 17:26:52 +03:00
pkv
19dcfc1bdb 0025721: Wrong result obtained by Common operator.
Changes:
class BOPTools_Set
 method:
    void BOPTools_Set::Add(const TopoDS_Shape& theS,
                       const TopAbs_ShapeEnum theType)
  has been changed. The treatment of INTERNAL edges has been added.

Added test case bugs/modalg_5/bug25721
2015-01-22 17:21:30 +03:00
ski
8f7e78f4de 0025569: Tests 24959_1 and 24959_2 are not correct
Test cases were corrected to check triangulation deflection
2015-01-22 17:15:08 +03:00
nbv
99c5f9f045 0025697: Regression : Section obtained after command "bsection" in Test Harness is incorrect.
Interface of bopcurves DDRAW-command were extended. Now it is possible to obtain
a) only 3D-curves;
b) 3D-curves and 2D-curves on one of surfaces intersected (surface can be selected);
c) 3D-curves and 2D-curves on every surface intersected.

Use "help bopcurves" to see detail information.

Added test cases bugs/modalg_5/bug25697_1 bug25697_2

Small changes in test case bugs/modalg_5/bug25697_2
2015-01-22 17:12:26 +03:00
emv
1b7ae95146 0025597: Invalid curve on surface in the result of General Fuse operation
1. The tool of computing the max distance between 3D curve and its 2d representation on the face
has been moved from static methods in BOPTools_AlgoTools class to BRepLib_CheckCurveOnSurface class.
2. The tools has been applied to 2d curves built during Boolean Operation
and to some intersection curves.
3. The functions
  Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
    (const TopoDS_Face& theFace,
     const TopoDS_Edge& theEdge,
     Standard_Real& theMaxDist,
     Standard_Real& theMaxPar)
and
  Standard_Boolean IntTools_Tools::ComputeTolerance
    (const Handle(Geom_Curve)& theCurve3D,
     const Handle(Geom2d_Curve)& theCurve2D,
     const Handle(Geom_Surface)& theSurf,
     const Standard_Real theFirst,
     const Standard_Real theLast,
     Standard_Real& theMaxDist,
     Standard_Real& theMaxPar)
have been developed for easy access to BRepLib_CheckCurveOnSurface functionality.

class IntTools_FaceFace
method void IntTools_FaceFace::ComputeTolReached3d()
Case for Plane/BSpline intersection added for treatment.

Test case for issue CR25597

Fix for regression boolean bsection N7.

class BOPAlgo_PaveFiller
method
  void BOPAlgo_PaveFiller::UpdateFaceInfo
    (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME,
     const BOPCol_DataMapOfIntegerInteger& theDMV)
Updating Face Info information with new vertices created in PostTreatFF.

Correction boolean/bsection/N2

Updated test cases.
2015-01-22 17:02:30 +03:00
dbp
e2da917a1c 0025703: Visualization - Decrease number of samplers used in ray-tracing mode
This patch eliminates 3 samplers used in ray-tracing mode:

//! Texture buffer of data records of bottom-level BVH nodes.
Handle(OpenGl_TextureBufferArb) myObjectNodeInfoTexture;
//! Texture buffer of minimum points of bottom-level BVH nodes.
Handle(OpenGl_TextureBufferArb) myObjectMinPointTexture;
//! Texture buffer of maximum points of bottom-level BVH nodes.
Handle(OpenGl_TextureBufferArb) myObjectMaxPointTexture;

Serialized data contained in corresponding texture buffers were added to global scene buffers:

//! Texture buffer of data records of high-level BVH nodes.
Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
 //! Texture buffer of minimum points of high-level BVH nodes.
Handle(OpenGl_TextureBufferArb) mySceneMinPointTexture;
//! Texture buffer of maximum points of high-level BVH nodes.
Handle(OpenGl_TextureBufferArb) mySceneMaxPointTexture;

This modifications leads also to small performance improvement (~2%) due to higher texture cache efficiency. Some modifications in traversal function (GLSL code) also improve performance (~3%).
2015-01-22 16:47:52 +03:00
Roman Lygin
71595c2970 0025694: Change STEP exporter to use AP214 IS by default
Test-case for issue #25694
2015-01-22 16:44:51 +03:00
aml
55b05039a4 0025663: Expand math_PSO class description
math_PSO class description extended.
2015-01-16 17:35:54 +03:00
mkv
6b0e8bd1a9 Adjusting new testing cases 2015-01-16 13:32:55 +03:00
san
89cc29b0b5 0025661: Visualization - AIS_InteractiveContext::Load() is not symmetric to the local context method
Register theIObj in the selection manager to prepare further activation of selection
2015-01-15 18:33:37 +03:00
azn
cbff1e5531 0025621: CAST analysis - Avoid constructors not supplying an initial value for all non-static data members
The constructors of classes from following files have been fixed to ensure that all non-static fields are initialized:

    Adaptor2d_Line2d.cxx
    Adaptor3d_IsoCurve.cxx
    Adaptor3d_OffsetCurve.cxx
    AdvApp2Var_ApproxAFunc2Var.cxx
    AIS_Dimension.cxx
    AIS_InteractiveContext.cxx
    Aspect_DisplayConnection.cxx
    BiTgte_CurveOnEdge.cxx
    BiTgte_CurveOnVertex.cxx
    BRepAdaptor_CompCurve.cxx
    BRepMesh_Circle.hxx
    BRepMesh_Delaun.cxx
    BRepToIGES_BREntity.cxx
    ChFi2d_AnaFilletAlgo.cxx
    ChFi2d_ChamferAPI.cxx
    ChFi2d_FilletAlgo.cxx
    ChFi2d_FilletAlgo.hxx
    Extrema_ExtPExtS.cxx
    Font_FTFont.cxx
    GccEnt_QualifiedCirc.cxx
    Geom2dAdaptor_Curve.cxx
    IGESData_IGESEntity.cxx
    IGESData_DefSwitch.cxx
    IGESToBRep_CurveAndSurface.cxx
    LDOM_XmlReader.cxx
    math_TrigonometricFunctionRoots.cxx
    NCollection_ListNode.hxx
    ProjLib_CompProjectedCurve.cxx
    ProjLib_ComputeApproxOnPolarSurface.cxx
    Select3D_Box2d.hxx
    Select3D_PointData.hxx
2015-01-15 18:22:32 +03:00
aml
460f4f693a 0025662: Project command produce wrong 2dcurve
Concatenation algorithm fixed to work over periodic bspline surfaces.

Test case for issue CR25662
2015-01-15 15:41:26 +03:00
aml
edbf88ba99 0025649: crvtpoints command return wrong deflection in output.
Deflection computation algorithm changed to PSO+NewtonMinimum.

Correction of test case
2015-01-15 15:38:49 +03:00
aml
4f0d73a918 0025660: Project command produce wrong 2dcurve
Changed starting point of Newton optimization.

Test case for issue CR25660
2015-01-15 15:35:07 +03:00
aml
fa89e0828b 0025596: GCPnts_TangentialDeflection creates wrong point distribution for visualization
Added check to small step after adding new point to prevent possible jump over local splash. If check failed then old step restored.
2015-01-15 15:30:12 +03:00
kgv
cd0a63dd7b 0025466: Visualization - Impossible to change the display mode when a local context is opened
Remove irrelevant check from method AIS_InteractiveContext::SetDisplayMode().

Test case for issue CR25466
2015-01-15 15:26:51 +03:00
kgv
63d907e787 0025664: Visualization - dynamic highlighting should not be discarded on re-displaying independent object
Clear list of immediate presentations in proper place - in AIS_LocalContext::manageDetected()
instead of AIS_LocalContext::Unhilight().
2015-01-15 15:18:08 +03:00
pkv
43cb001124 0025700: Ensuring uniform control of the functionalities of the Boolean operations algorithm at the level of DRAW application
Changes:
1.
Class BOPTest_Chronometer
The class definition that depends on TBB has been removed

2.
For the following commands:
>bop s1 s2 [tol]
>bopcommon r s1 s2 [tol]
>bfuse r s1 s2 [tol]
>bcut s1 s2 [tol]
>btuc r s1 s2 [tol]
>bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]
>mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]
>bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]
>bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol]
>bfillds [-s -t] [tol]
the syntax has been changed. Parameter [tol] has been removed.

The value "tol"  (i.e. Fuzzy Value) is option for the algorithm.

If it is necessary, the value "tol" can be set by the command:
>bfuzzyvalue value

see
http://tracker.dev.opencascade.org/view.php?id=25614
for more details

3.
For the following commands:
>bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]
>bfillds [-s -t] [tol]
>bbuild r [-s -t]
>bbop r op [-s -t]
the syntax has been changed. Parameter [-s] has been removed.
Parameter [-s] was to provide the sequential mode of the computations.

The mode of the computations is option for the algorithm.

The mode of the computations can be set by the command:
 >brunparallel [0/1]
       1 -sets the parallel mode of the computations
       0 -sets the sequential mode of the computations

see
http://tracker.dev.opencascade.org/view.php?id=25614
for more details
2015-01-15 15:15:47 +03:00
kgv
49297cb6bd 0025691: Visualization, TKService - fix font corruption on FreeType 2.5.4 2015-01-15 15:12:15 +03:00
ski
c857a60abe 0023922: Systematic review of TODO tests
Small corrections for test cases with "TEST INCOMPLETE" result.

TODO statements with "TEST INCOMPLETE" were checked and corrected.
2015-01-15 15:08:27 +03:00
jgv
6504f8cd28 0025657: Bad result of Fillet operation
Comments have been precised.

Test case for issue CR25657

Fix of regression

Additional test case.
2015-01-15 15:05:06 +03:00
ski
97c44f4156 0023626: It's impossible to open files containing localisation characters in the name
Files containing localisation characters can be opened and saved now properly.
2015-01-15 14:59:40 +03:00
ink
bcf045cfdc 0025523: Fail to read back solid written to STEP
Fixed a exception occurred during reading step file

Test case for issue CR25523
2015-01-15 14:53:44 +03:00
vro
c31e0defd7 0025634: Checking of compliance of vertices and pcurve fails
A fix + a checkedge draw-command to check the fix.

Test case for issue CR25634
2015-01-15 14:48:31 +03:00
azn
6a38ff486c 0025616: Avoid Classes using "new" to allocate Instances but not defining a copy Constructor
The empty copy constructor, assignemnts operator, default constructors added to the following classes:
The following classes use “new” function without Handles:
- Select3D_PointData
- BSB_T3Bits
- IntPatch_InfoPD
- LDOM_StringElem
- BinomAllocator
- ProjLib_OnSurface
- Standard_MMgrFactory

Useless declaration of default constructor have been deleted.
2015-01-15 14:42:36 +03:00
dbp
c8be748cd4 0025532: Visualization - fix cross-references between AIS_ConnectedInteractive and connected presentation
New test case added.
2015-01-15 14:38:59 +03:00
dbp
df932fdfb2 0025222: Visualization - provide distance field builder in the Math/BVH package
A distance field is a representation where, at each point within the field, the distance from that point to the closest point on the object is specified.
In addition to distance, other properties may be derived from the distance field, such as the direction to the surface, and when the distance field is signed, we may also determine if the point is internal or external to objects within the domain.
The distance field has been found to be a useful construction within the areas of computer vision, physics, and computer graphics. In particular, distance fields can be used for generating realistic visual effects and collision detection.

Fix compilation warning when using GCC.
2015-01-15 14:34:57 +03:00
kgv
2195ab9699 0025629: Visualization, AIS_InteractiveContext - code clean up
Drop confusing method AIS_InteractiveContext::Clear() which is the same as ::Remove().
AIS_InteractiveContext::Display() - fix double viewer update on first display of presentation.
AIS_InteractiveContext::DisplayedObjects() - fix objects retrieval from local contexts.
AIS_InteractiveContext::Load() - do not bind object twice.

Drop code blocks for debug output.
Code clean up.
2015-01-15 14:04:57 +03:00
san
270675f51e 0025650: Visualization - AIS_Line::ComputeSelection() should not ignore the selection mode argument
Only selection mode 0 is supported from now on.
2015-01-15 14:01:47 +03:00
emv
bc88a67737 0025669: Unable to compile BOPTest package in WOK
package BOPTest
BOPTest_Chronometer.hxx has been added to FILES.
2014-12-27 08:18:30 +03:00
mkv
4cf9a9f0ea Cosmetic update testing cases. 2014-12-26 13:03:40 +03:00
abv
92ac0eb708 0025570: New Tcl sample scripts created for CAD Assistant
Three new sample scripts created during development of CAD Assistant for Android added in samples/tcl:

- Penrose.tcl: creation of Penrose triangle made of boxes resembling ones from OCC logo
- pencil.tcl: creation of colored pencil model
- snowflake.tcl: creation of 2d drawing of snowflake
2014-12-26 12:26:10 +03:00
msv
ee6bb37b7f 0025545: TopLoc_Location::Transformation() provokes data races
Get rid of postponed calculation of transformation.
Remove unused methods.
Add command OCC25545 to reproduce the bug with data races.

- Get rid of C++11 lambda construction
- make code compilable with no HAVE_TBB defined
- add test case bugs/fclasses/bug25545
2014-12-25 18:32:22 +03:00
dbp
312a4043c2 0025351: Visualization - provide pseudo random number generator in OCCT ray-tracing core 2014-12-25 18:24:26 +03:00
vpa
51023771f9 0025627: SelectedShape() and HasSelectedShape() of AIS_InteractiveContext class do not work as expected.
Location calculation in SelectedShape() was corrected;
Method HasSelectedShape() that does not take into account shape decomposition was added.

Test case for issue 25627
2014-12-25 18:22:21 +03:00
ibs
bbe97eddea 0025651: GL_LUMINANCE8 should be defined for android case
GL_LUMINANCE8 defined
2014-12-25 18:20:32 +03:00
oan
f43eff9ffe 0025612: Introduce possibility to disable adaptive reconfigutation of triangles in BRepMesh
Remarks from PDN: flag has been renamed to ControlSurfaceDeflection

Test-case for issue #25612
2014-12-25 18:19:02 +03:00
aml
fe79003598 0025489: GCPnts_TangentialDeflection gives incorrect distribution of points
Fixed last point handling: now we try to check interval with last point instead of adding it to output set of points.

Test case for issue CR25489

Correction of test case for issue CR25489
2014-12-25 18:12:23 +03:00
emv
b9f6147d75 0025600: Wrong result of Boolean FUSE operation
class BOPTools_AlgoTools
1. method Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
                                 const gp_Pnt& aP,
                                 gp_Dir& aDB,
                                 gp_Pnt& aPOut,
                                 Handle(IntTools_Context)& theContext,
                                 GeomAPI_ProjectPointOnSurf& aProjPL,
                                 const Standard_Real aDt,
                                 const Standard_Real aTolE)
Use different method of finding a point in the face if the start and projected points are close to each other.

2. method Standard_Real MinStep3D(const TopoDS_Edge& theE1,
                        const TopoDS_Face& theF1,
                        const BOPTools_ListOfCoupleOfShape& theLCS,
                        const gp_Pnt& aP)
The min 3D step has been increased for the spherical faces.

Test case for issue CR25600

Correction of test case for issue CR25600
2014-12-25 18:09:43 +03:00
nbv
7c32c7c41f 0025531: Difference in intersection result on Windows and Linux platform is very significant
1. Dump of WLine is shown with more precise.
2. Equation solving with more precise.
3. Dump of Multy-line.
4. Code optimization.

Some test cases were updated in accordance with their new behaviour.

Correction of test cases for issue CR25531
2014-12-25 18:06:15 +03:00
emv
ee5ee7db3b 0025625: Boolean COMMON cannot be built
class BOPTools_AlgoTools2D
method void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
                                   const TopoDS_Face& aF,
                                   Handle(Geom2d_Curve)& aC2D,
                                   Standard_Real& aFirst,
                                   Standard_Real& aLast,
                                   Standard_Real& aToler)

Perform projection with the tolerance of the edge.

Test case for issue CR25625
2014-12-25 18:01:31 +03:00
azv
8ac0cf5265 0024411: SplitShape produces shape with incorrectly parameterized periodic 3D curve
Implemented additional flag into Geom_TrimmedCurve to adjust or not the periodic curve inside the first period.

API of Geom2d_TrimmedCurve is changed according to Geom_TrimmedCurve.

Test-case for issue #24411
2014-12-25 17:58:45 +03:00
pkv
49b0c452e2 0025614: Provide API access to the new fuctionalities of Boolean Components
I. New features:
1.1. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.2. class BOPAlgo_Builder
method:
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.3. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theLS)
has been added to provide the setting tools through
TopTools_ListOfShape

1.4. class BRepAlgoAPI_BuilderAlgo
construcror:
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
  (const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

method:
void BRepAlgoAPI_BuilderAlgo::SetArguments
 (const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts

method:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
has been added to provide access to the argumemts

1.5. class BRepAlgoAPI_BooleanOperation
method:
void BRepAlgoAPI_BooleanOperation::SetTools
  (const TopTools_ListOfShape& theLS)
has been added to provide the setting tools

method:
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
has been added to provide access to the tools

1.6. class BRepAlgoAPI_Common
construcror:
BRepAlgoAPI_Common::BRepAlgoAPI_Common
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.7. class BRepAlgoAPI_Cut
construcror:
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.8. class BRepAlgoAPI_Fuse
construcror:
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.9. class BRepAlgoAPI_Section
construcror:
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.10. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

Commands:
 >bapibuild r
   performs General Fuse algorithm.
     r -the result of the operation

 >bapibop r type
   performs Boolean Operation agorithm
      r -the result of the operation
      type -type of the operation:
        0-common
        1-fuse
        2-cut
        3-cut21
        4-section

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

Commands:
 >boptions
   dump the state of current options

  >brunparallel [0/1]
   1 -sets the parallel mode of the computations
   0 -sets the sequential mode of the computations

  >bfuzzyvalue value
    sets the fuzzy value

-------------------------------------------------------------------------------------------------------------
II. Changes:
II.1. class BRepAlgoAPI_BuilderAlgo
methods:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
  (const TopoDS_Shape& aS)
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
has been redefined to provide access to the history

II.1. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

II.2. class BRepAlgoAPI
method:
void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
                           const TopoDS_Shape& theShape1,
                           const TopoDS_Shape& theShape2,
                           const TopoDS_Shape& theResult,
                           BOPAlgo_Operation theOperation,
                           Standard_Boolean isNonValidArgs)
has been removed. The contents has been shifted into the file:
BRepAlgoAPI_BooleanOperation.cxx

II.3. classes QANewModTopOpe_Glue, QANewModTopOpe_Intersection
the modifications have been done to provide the consistency with the
modifications in BRepAlgoAPI package [I].
-------------------------------------------------------------------------------------------------------------
III. Modified entities:
packages:
BOPAlgo
BRepAlgoAPI
BOPTest
QANewModTopOpe

Test cases for issue CR25614
2014-12-25 17:55:50 +03:00
azv
6219c44ce7 0025584: Wrong result obtained by PerformInfinitePoint Test
Implemented additional verification of periodicity of B-spline surfaces when calculating UV-bounds

Test case for issue CR25584
2014-12-25 17:53:21 +03:00
jgv
73d0a668b3 0025592: Bad result of Fillet operation
Comments have been added.

Test case for issue CR25592
2014-12-25 16:48:05 +03:00
azv
b7d2387022 0025591: Command mkshell produces wrong shell
The functionality to decide, whether the edge is degenerated, was shared via BRepLib_MakeFace. The verification of producing degenerated edges was added to BRepLib_MakeShell.

Test case for issue CR25591
2014-12-25 16:44:20 +03:00
kgv
656ec77a10 0025608: TKernel, NCollection_UtfIterator - fix iteration of surrogate pairs in UTF-16 2014-12-25 16:39:05 +03:00
nbv
2283570591 0025275: Diferent result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platform
Symbol SUB (ASCII-code 0x1A) should be considered as End-Of-File both on WINDOWS and LINUX (and on other) system.
2014-12-25 16:36:41 +03:00
kgv
032c140ff1 0025580: Visualization, TKOpenGl - create GLushort index buffer in OpenGl_Quadric::createArrays() when sufficient 2014-12-25 16:29:46 +03:00
eap
7c8996f49f 0025604: To provide info on what has been done by DropSmallSolids operator 2014-12-25 16:27:27 +03:00
933 changed files with 17397 additions and 11256 deletions

View File

@@ -86,8 +86,8 @@ if ("${3RDPARTY_DIR}" STREQUAL "")
set (3RDPARTY_DIR "$ENV{3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE)
elseif (EXISTS "${CMAKE_SOURCE_DIR}/../")
# in version 6.7.0 and above, occt parent directory contains 3rdparties
GET_FILENAME_COMPONENT(3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE)
SET(3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE)
get_filename_component (3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE)
set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE)
endif()
endif()
@@ -98,13 +98,8 @@ if ("${USE_TCL}" STREQUAL ON)
message (STATUS "Info: tcl is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tcl")
else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_TCL_DIR")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TCL_INCLUDE_DIR")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TCL_LIBRARY")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TCL_LIBRARY_DIR")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TK_INCLUDE_DIR")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TK_LIBRARY")
OCCT_CHECK_AND_UNSET ("3RDPARTY_TK_LIBRARY_DIR")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
endif()
# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
@@ -114,11 +109,9 @@ if ("${USE_FREETYPE}" STREQUAL ON)
message (STATUS "Info: freetype is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freetype")
else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_DIR")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_LIBRARY")
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_LIBRARY_DIR")
endif()
# VTK
@@ -167,7 +160,7 @@ endif()
# TBB
if (USE_TBB)
ADD_DEFINITIONS(-DHAVE_TBB)
add_definitions (-DHAVE_TBB)
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tbb")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")

View File

@@ -269,4 +269,21 @@ Handle_TCollection_HAsciiString {
}
~~~~~
In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example.
In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example.
@section occt_debug_perf Performance measurement tools
It is recommended to use specialized performance analysis tools to profile OCCT and application code.
However, when such tools are not available or cannot be used for some reason, tools provided by OCD package can be used: see low-level C functions and macros defined OSD_PerfMeter.h, and OSD_PerfMeter class.
This tool maintains an array of 100 global performance counters that can be started and stopped independently.
Adding performance counter to a function of interest allows to get statistics on number of calls and total execution time of the function.
In C++ code, this can be achieved by creating local variable OSD_PerfMeter in each block of code to be measured.
In C or Fortran code, use functions perf_start_meter and perf_stop_meter to start and stop the counter.
Note that this instrumentation is intended to be removed when profiling is completed.
Macros provided in OSD_PerfMeter.h can be used to keep instrumentation code permanently, but enable it only when macro PERF_ENABLE_METERS is defined.
Each counter has its name shown when the collected statistics are printed.
In DRAW, use command dperf to prints all performance statistics.
Note that performance counters are not thread-safe.

View File

@@ -11,6 +11,22 @@ General Fuse Algorithm is also a basis of the Partition Algorithm (PA) implement
General Fuse Algorithm has a history-based architecture designed to allow using OCAF naming functionality.
The architecture of General Fuse Algorithm is expandable, that allows creating new algorithms basing on it.
@section occt_algorithms_1_1 Difference between Old and New Boolean Operations
In OCCT there exist two libraries providing Boolean Operations:
* Old Boolean Operations (BOA) provided by <i>BRepAlgo</i> package designed and developed in Open CASCADE 6x in 2000; its architecture and content are out of date.
* New Boolean Operations (NBOA) provided by <i>BRepAlgoAPI</i> package designed and developed in 2001 and completely revised in 2013.
New Boolean Operations provide the following major benefits:
* The NBOA have an expandable architecture of inner sub-algorithms, which allows to create specific algorithms for the Customers using existing inner sub-algorithms as root algorithms and to reduce the time for the development.
* The architecture of inner sub-algorithms of NBOA provides their reusability with maximal independence from the environment of NBOA. The fact allows to create specific algorithms for the Customers using these sub-algorithms as they are or as root classes and thus to reduce the time for the development.
* The architecture of NBOA is history-based. The implementation of NBOA internally sets up a correspondence between any sub-shape of the argument and its image in the result. The history is not imposed and thus it is not error-prone as it was in BOA. The fact allows direct and safely usage of the algorithm in parametric modeling.
* NBOA provide a general algorithm. It correctly processes without using the workarounds even the cases that cannot be properly processed by BOA.
* The implementation of NBOA is based on NCollection classes. The usage of opportunities given by local memory allocators ( <i> NCollection_IncAllocator</i>) allows improving memory management and saving memory resources.
* NBOA use modern algorithms of OCC as auxiliary tools. For e.g. the algorithm of unbalanced binary tree of overlapped bounding boxes <i> NCollection_UBTree</i>. The usage of the algorithm allows to improve the performance of NBOA if there is a big number of sub-shapes in the arguments.
@section occt_algorithms_2 Overview

View File

@@ -5,21 +5,21 @@ Foundation Classes {#occt_user_guides__foundation_classes}
@section occt_fcug_1 Introduction
@subsection occt_fcug_1_1 Foundation Classes Overview
This manual explains how to use Open CASCADE Technology (**OCCT**) Foundation Classes. It provides basic documentation on foundation classes. For advanced information on foundation classes and their applications, see the offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>.
Foundation Classes provide a variety of general-purpose services such as automated dynamic memory management (manipulation of objects by handle), collections, exception handling, genericity by down-casting and plug-in creation.
This manual explains how to use Open CASCADE Technology (**OCCT**) Foundation Classes. It provides basic documentation on foundation classes. For advanced information on foundation classes and their applications, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
Foundation Classes provide a variety of general-purpose services such as automated dynamic memory management (manipulation of objects by handle), collections, exception handling, genericity by downcasting and plug-in creation.
Foundation Classes include the following:
### Root Classes
Root classes are the basic data types and classes on which all the other classes are built. They provide:
* fundamental types such as Boolean, Character, Integer or Real,
* safe handling of dynamically created objects, ensuring automatic deletion of unreferenced objects (see the Standard_Transient class),
* safe handling of dynamically created objects, ensuring automatic deletion of unreferenced objects (see *Standard_Transient* class),
* configurable optimized memory manager increasing the performance of applications that intensively use dynamically created objects,
* extended run-time type information (RTTI) mechanism facilitating the creation of complex programs,
* management of exceptions,
* encapsulation of C++ streams.
Root classes are mainly implemented in the *Standard* and *MMgt* packages.
Root classes are mainly implemented in *Standard* and *MMgt* packages.
### Strings
Strings are classes that handle dynamically sized sequences of characters based on both ASCII (normal 8-bit character type) and Unicode (16-bit character type).
@@ -39,7 +39,6 @@ The *TColStd* package provides frequently used instantiations of generic classe
### Vectors and Matrices
These classes provide commonly used mathematical algorithms and basic calculations (addition, multiplication, transposition, inversion, etc.) involving vectors and matrices.
### Primitive Geometric Types
@@ -82,25 +81,27 @@ These are various classes supporting date and time information and fundamental
### Application services
Foundation Classes also include implementation of several low-level services that facilitate the creation of customizable and user-friendly applications with Open CASCADE Technology. These include:
* Unit conversion tools, providing a uniform mechanism for dealing with quantities and associated physical units: check unit compatibility, perform conversions of values between different units and so on (see package *UnitsAPI*).
* Basic interpreter of expressions that facilitates the creation of customized scripting tools, generic definition of expressions and so on (see package *ExprIntrp*)
* Tools for dealing with configuration resource files (see package *Resource*) and customizable message files (see package *Message*), making it easy to provide a multi-language support in applications
* Unit conversion tools, providing a uniform mechanism for dealing with quantities and associated physical units: check unit compatibility, perform conversions of values between different units and so on (see package *UnitsAPI*);
* Basic interpreter of expressions that facilitates the creation of customized scripting tools, generic definition of expressions and so on (see package *ExprIntrp*);
* Tools for dealing with configuration resource files (see package *Resource*) and customizable message files (see package *Message*), making it easy to provide a multi-language support in applications;
* Progress indication and user break interfaces, giving a possibility even for low-level algorithms to communicate with the user in a universal and convenient way.
@section occt_fcug_2 Basics
This chapter deals with basic services such as library organization, persistence, data types, memory management, programming with handles, exception handling, genericity by downcasting and plug-in creation.
@subsection occt_fcug_1_2 Fundamental Concepts
An object-oriented language structures a system around data types rather than around the actions carried out on this data. In this context, an **object** is an **instance** of a data type and its definition determines how it can be used. Each data type is implemented by one or more classes, which make up the basic elements of the system.
@subsection occt_fcug_2_a Library organization
In Open CASCADE Technology the classes are usually defined using CDL (CASCADE Definition Language) that provides a certain level of abstraction from pure C++ constructs and ensures a definite level of similarity in the implementation of classes. See *CDL Users Guide* for more details.
This chapter introduces some basic concepts, which are used not only in Foundation Classes, but throughout the whole OCCT library.
This chapter introduces some basic concepts most of which are directly supported by CDL and used not only in Foundation Classes, but throughout the whole OCCT library.
@subsubsection occt_fcug_2_a_1 Modules and toolkits
@subsubsection occt_fcug_1_2_1 Modules and toolkits
The whole OCCT library is organized in a set of modules. The first module, providing most basic services and used by all other modules, is called Foundation Classes and described by this manual.
Every module consists primarily of one or several toolkits (though it can also contain executables, resource units etc.). Physically a toolkit is represented by a shared library (e.g. .so or .dll). The toolkit is built from one or several packages.
@subsubsection occt_fcug_1_2_2 Packages
@subsubsection occt_fcug_2_a_2 Packages
A **package** groups together a number of classes which have semantic links. For example, a geometry package would contain Point, Line, and Circle classes. A package can also contain enumerations, exceptions and package methods (functions). In practice, a class name is prefixed with the name of its package e.g.
*Geom_Circle*.
Data types described in a package may include one or more of the following data types:
@@ -118,19 +119,18 @@ Inside a package, two data types cannot bear the same name.
* **Instance method** Operates on the instance which owns it.
* **Class method** Does not work on individual instances, only on the class itself.
@subsubsection occt_fcug_1_2_3 Classes
@subsubsection occt_fcug_2_a_3 Classes
The fundamental software component in object-oriented software development is the class. A class is the implementation of a **data type**. It defines its **behavior** (the services offered by its functions) and its **representation** (the data structure of the class the fields, which store its data).
#### Categories of Classes
Classes fall into three categories:
* Ordinary classes.
* Deferred classes. A **deferred class** cannot be instantiated. The purpose of having such classes is to have a given behavior shared by a hierarchy of classes and dependent on the implementation of the descendants. This is a way of guaranteeing a certain base of inherited behavior common to all the classes based on a particular deferred class. The C++ equivalent of a deferred CDL class is an abstract class.
* Generic classes. A **generic class** offers a set of functional behaviors to manipulate other data types. Instantiation of a generic class requires that a data type is given for its argument(s). The generic classes in CDL perform the same mission as template classes in C++.
* Ordinary classes.
* Deferred classes. A **deferred class** cannot be instantiated. The purpose of having such classes is to have a given behavior shared by a hierarchy of classes and dependent on the implementation of the descendants. This is a way of guaranteeing a certain base of inherited behavior common to all the classes based on a particular deferred class. The C++ equivalent of a deferred CDL class is an abstract class.
* Generic classes. A **generic class** offers a set of functional behaviors to manipulate other data types. Instantiation of a generic class requires that a data type is given for its argument(s). The generic classes in CDL perform the same mission as template classes in C++.
@subsubsection occt_fcug_1_2_4 Genericity
@subsubsection occt_fcug_2_a_4 Generic Classes
Generic classes are implemented in two steps. First you declare the generic class to establish the model, then you instantiate this class by giving information about the generic types.
#### Declaring a Generic Class
#### Declaring a Generic Class
The generic classes in Open CASCADE Technology are similar by their intent to C++ templates with explicit instantiation.
A generic class is declared in CDL as operating on data items of non-fixed types which are declared as arguments of the generic class. It is possible to put a restriction on these data types to be of subtype of some definite class. Definition of the generic class does not create new class type in C++ terms; it only defines a pattern for generation (instantiation) of the real classes.
@@ -157,15 +157,27 @@ class MapOfReal instantiates Map from TCollection (Real,MapRealHasher);
This declaration in *TColStd* defines not only class *TColStd_MapOfReal*, but also class *TColStd_MapIteratorOfMapOfReal*, which is instantiated from nested class *MapIterator* of the generic class *TCollection_Map*. Note that instantiation of the nested class is separate class, it is not nested class to the instantiation of the main class.
**Nested classes**, even though they are described as non-generic classes, are generic by construction being inside the class they are a member of.
@subsubsection occt_fcug_1_2_5 Inheritance
@subsubsection occt_fcug_2_a_5 Inheritance
The purpose of inheritance is to reduce the development workload. The inheritance mechanism allows a new class to be declared already containing the characteristics of an existing class. This new class can then be rapidly specialized for the task in hand. This avoids the necessity of developing each component “from scratch”.
For example, having already developed a class *BankAccount* you could quickly specialize new classes: *SavingsAccount, LongTermDepositAccount, MoneyMarketAccount, RevolvingCreditAccount*, etc....
The corollary of this is that when two or more classes inherit from a parent (or ancestor) class, all these classes guarantee as a minimum the behavior of their parent (or ancestor). For example, if the parent class BankAccount contains the method Print which tells it to print itself out, then all its descendent classes guarantee to offer the same service.
The corollary of this is that when two or more classes inherit from a parent (or ancestor) class, all these classes guarantee as a minimum the behavior of their parent (or ancestor). For example, if the parent class BankAccount contains the method Print which tells it to print itself out, then all its descendant classes guarantee to offer the same service.
One way of ensuring the use of inheritance is to declare classes at the top of a hierarchy as being **deferred**. In such classes, the methods are not implemented. This forces the user to create a new class which redefines the methods. This is a way of guaranteeing a certain minimum of behavior among descendent classes.
One way of ensuring the use of inheritance is to declare classes at the top of a hierarchy as being **deferred**. In such classes, the methods are not implemented. This forces the user to create a new class which redefines the methods. This is a way of guaranteeing a certain minimum of behavior among descendant classes.
@subsection occt_fcug_2_b Persistence and Data Schema
The data schema is the structure used by an application to store its data. Data schemas consist of persistent classes.
An object is called **persistent** if it can be permanently stored. Thus, the object can be reused at a later date by the application, which created it, or by another application.
In order for an object to be persistent for CDL, its type must be declared as inheriting from the class *Standard_Persistent* or have a parent class inheriting from the *Standard_Persistent* class. Note that classes inheriting from *Standard_Persistent* are handled by a reference.
Objects instantiated from classes which inherit from the Standard_Storable class cannot themselves be stored individually, but they can be stored as fields of an object which inherits from *Standard_Persistent*. Note that objects inheriting from *Standard_Storable* are handled by a value.
@subsection occt_fcug_2_1 Data Types
An object-oriented language structures a system around data types rather than around the actions carried out on this data. In this context, an **object** is an **instance** of a data type and its definition determines how it can be used. Each data type is implemented by one or more classes, which make up the basic elements of the system.
@subsubsection occt_fcug_1_2_6 Categories of Data Types
The data types in Open CASCADE Technology fall into two categories:
* Data types manipulated by handle (or reference)
* Data types manipulated by value
@@ -186,24 +198,10 @@ Handle(myClass) m = new myClass;
In Open CASCADE Technology, the Handles are specific classes that are used to safely manipulate objects allocated in the dynamic memory by reference, providing reference counting mechanism and automatic destruction of the object when it is not referenced.
@subsubsection occt_fcug_1_2_7 Exceptions
The behavior of any object is implemented by the methods, which were defined in its class declaration. The definition of these methods includes not only their signature (their programming interface) but also their domain of validity.
This domain is expressed by **exceptions**. Exceptions are raised under various error conditions. This mechanism is a safeguard of software quality.
@subsubsection occt_fcug_1_2_8 Persistence and Data Schema
The data schema is the structure used by an application to store its data. Data schemas consist of persistent classes.
An object is called **persistent** if it can be permanently stored. Thus, the object can be reused at a later date by the application, which created it, or by another application.
In order for an object to be persistent for CDL, its type must be declared as inheriting from the class *Standard_Persistent* or have a parent class inheriting from the *Standard_Persistent* class. Note that classes inheriting from *Standard_Persistent* are handled by a reference.
Objects instantiated from classes which inherit from the Standard_Storable class cannot themselves be stored individually, but they can be stored as fields of an object which inherits from *Standard_Persistent*. Note that objects inheriting from *Standard_Storable* are handled by a value.
@section occt_fcug_2 Basics
This chapter deals with basic services such as memory management, programming with handles, primitive types, exception handling, genericity by downcasting and plug-in creation.
@subsection occt_fcug_2_1 Data Types
@subsubsection occt_fcug_2_1_1 Primitive Types
The primitive types are predefined in the language and they are **manipulated by value**.
Some of these primitives inherit from the **Storable** class. This means they can be used in the implementation of persistent objects, either contained in entities declared within the methods of the object, or they form part of the internal representation of the object.
@@ -237,7 +235,6 @@ The table below presents the equivalence existing between C++ fundamental types
\* The types with asterisk are pointers.
**Reminder of the classes listed above:**
* **Standard_Integer** : fundamental type representing 32-bit integers yielding negative, positive or null values. *Integer* is implemented as a *typedef* of the C++ *int* fundamental type. As such, the algebraic operations +, -, *, / as well as the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on it.
@@ -270,7 +267,7 @@ There are two categories of types which are manipulated by handle:
@image html /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@image latex /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@subsubsection occt_fcug_2_1_4 Summary of properties
@subsubsection occt_fcug_2_1_4 When is it necessary to use a handle?
The following table summarizes how various data types are handled and stored.
@@ -279,9 +276,26 @@ The following table summarizes how various data types are handled and stored.
| storable | Persistent | Primitive, Storable (if nested in a persistent class)|
|temporary | Transient | Other |
When you design an object, it can be difficult to choose how to manipulate that
object: by value or by handle. The following ideas can help you to make up your mind:
* If your object may have a long lifetime within the application and you want to make multiple
references to it, it would be preferable to manipulate this object with a handle. The memory for the
object will be allocated on the heap. The handle which points to that memory is a light object which
can be rapidly passed in argument. This avoids the penalty of copying a large object.
* If your object will have a limited lifetime, for example, used within a single algorithm, it would
be preferable to manipulate this object by value, non-regarding its size, because this object is
allocated on the stack and the allocation and de-allocation of memory is extremely rapid, which
avoids the implicit calls to *new* and *delete* occasioned by allocation on the heap.
* Finally, if an object will be created only once during, but will exist throughout the lifetime of
the application, the best choice may be a class manipulated by handle or a value declared as a
global variable.
@subsection occt_fcug_2_2 Programming with Handles
@subsubsection occt_fcug_2_2_1 Handle Definition
A handle may be compared with a C++ pointer. Several handles can reference the same object. Also, a single handle may reference several objects, but only one at a time. To have access to the object it refers to, the handle must be de-referenced just as with a C++ pointer.
Transient and Persistent classes may be manipulated either with handles or with values. Handles which reference non-persistent objects are called non-storable handles; therefore, a persistent object cannot contain a non-storable handle.
@@ -315,10 +329,8 @@ To initialize a handle, either a new object should be created or the value of a
@subsubsection occt_fcug_2_2_2 Type Management
#### General
Open CASCADE Technology provides a means to describe the hierarchy of data types in a generic way, with a possibility to check the exact type of the given object at run-time (similarly to C++ RTTI). For every class type derived from *Standard_Transient*, CDL extractor creates a code instantiating single instance of the class *Standard_Type* (type descriptor) that holds information on that type: its name and list of ancestor types.
That instance (actually, a handle on it) is returned by the virtual method *DynamicType()* of the class derived from *Standard_Transient*. The other virtual method *IsKind()* provides a means to check whether a given object has specified type or inherits it.
In order to refer to the type descriptor object for a given class type, use macros *STANDARD_TYPE()* with argument being a name of the class.
@@ -341,7 +353,6 @@ The compiler sees p1 as a handle to *Point* though the actual object referenced
#### Explicit Type Conversion
According to the rule of type conformity, it is always possible to go up the class hierarchy through successive assignments of handles. On the other hand, assignment does not authorize you to go down the hierarchy. Consequently, an explicit type conversion of handles is required.
A handle can be converted explicitly into one of its sub-types if the actual type of the referenced object is a descendant of the object used to cast the handle. If this is not the case, the handle is nullified (explicit type conversion is sometimes called a “safe cast”). Consider the example below.
@@ -396,6 +407,7 @@ else {
~~~~~
@subsubsection occt_fcug_2_2_3 Using Handles to Create Objects
To create an object which is manipulated by handle, declare the handle and initialize it with the standard C++ **new** operator, immediately followed by a call to the constructor. The constructor can be any of those specified in the source of the class from which the object is instanced.
~~~~~
@@ -444,7 +456,8 @@ n = Geom_BezierCurve::MaxDegree();
~~~~~
@subsubsection occt_fcug_2_2_5 Handle deallocation
Before you delete an object, you must ensure it is no longer referenced. To reduce the programming load related to this management of object life, the delete function in Open CASCADE Technology is secured by a **reference counter** of classes manipulated by handle. A handle automatically deletes an object when it is no longer referenced. Normally you never call the delete operator explicitly on instances of subclasses of *Standard_Transient*.
Before you delete an object, you must ensure it is no longer referenced. To reduce the programming load related to this management of object life, the delete function in Open CASCADE Technology is secured by a **reference counter** of classes manipulated by handle. A handle automatically deletes an object when it is no longer referenced. Normally you never call the delete operator explicitly on instances of subclasses of *Standard_Transient*.
When a new handle to the same object is created, the reference counter is incremented. When the handle is destroyed, nullified, or reassigned to another object, that counter is decremented. The object is automatically deleted by the handle when reference counter becomes 0.
@@ -471,25 +484,38 @@ Handle (TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger;
// Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted.
~~~~~
#### Cycles
You can easily cast a reference to the handle object to <i> void* </i> by defining the following:
Cycles appear if two or more objects reference each other by handles (stored as fields). In this condition automatic destruction will not work.
~~~~
void *pointer;
Handle(Some_class) aHandle;
// Here only a pointer will be copied
Pointer = &aHandle;
// Here the Handle object will be copied
aHandle = * (Handle(Some_Class) *)pointer;
~~~~
@subsubsection occt_fcug_2_2_6 Cycles
Cycles appear if two or more objects reference each other by handles (stored as fields). In this condition automatic destruction will not work.
Consider for example a graph, whose objects (primitives) have to know the graph object to which they belong, i.e. a primitive must have a reference to complete graph object. If both primitives and the graph are manipulated by handle and they refer to each other by keeping a handle as a field, the cycle appears.
The graph object will not be deleted when the last handle to it is destructed in the application, since there are handles to it stored inside its own data structure (primitives).
There are two approaches how to avoid such situation:
* Use C++ pointer for one kind of references, e.g. from a primitive to the graph
* Nullify one set of handles (e.g. handles to a graph in primitives) when a graph object needs to be destroyed
@subsubsection occt_fcug_2_2_6 Creating Transient Classes without CDL
@subsubsection occt_fcug_2_2_7 Creating Transient Classes without CDL
Though generation of Handle class and related C++ code is normally performed by CDL extractor, it is also possible to define a class managed by handle without CDL. To facilitate that, several macros are provided in the file Standard_DefineHandle.hxx:
* **DEFINE_STANDARD_HANDLE(class_name,ancestor_name)** - declares Handle class for a class *class_name* that inherits class *ancestor_name* (for instance, *Standard_Transient*). This macro should be put in a header file; the declaration of the handle to a base class must be available (usually put before or after the declaration of the class *class_name*, or into a separate header file).
* **IMPLEMENT_STANDARD_HANDLE(class_name,ancestor_name)** - implements method *DownCast()* of the *Handle* class. Should be located in a C++ file (normally the file where methods of the class *class_name* are implemented).
* **DEFINE_STANDARD_RTTI(class_name)** - declares methods required for RTTI in the class *class_name* declaration; should be in public: section.
* **IMPLEMENT_STANDARD_RTTIEXT(class_name,ancestor_name)** - implements above methods. Usually put into the C++ file implementing class class_name.
* **IMPLEMENT_STANDARD_RTTIEXT(class_name,ancestor_name)** - implements above methods. Usually put into the C++ file implementing class *class_name*.
Note that it is important to ensure correctness of macro arguments, especially the ancestor name, otherwise the definition may be inconsistent (no compiler warnings will be issued in case of mistake).
In *Appli_ExtSurface.hxx* file:
@@ -511,21 +537,118 @@ IMPLEMENT_STANDARD_HANDLE(Appli_ExtSurface,Geom_Surface)
IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
~~~~~
#### Example
@subsection occt_fcug_2_3 Memory Management in Open CASCADE Technology
In the course of a work session, geometric modeling applications create and delete a considerable number of C++ objects allocated in the dynamic memory (heap). In this context, performance of standard functions for allocating and deallocating memory may be not sufficient. For this reason, Open CASCADE Technology employs a specialized memory manager implemented in the Standard package.
The following example shows how to define a class <i> SamplePoint </i> manipulated by handle.
@subsubsection occt_fcug_2_3_1. Usage
To use the Open CASCADE Technology memory manager to allocate memory in a C code, just use method *Standard::Allocate()* instead of *malloc()* and method *Standard::Free()* instead of *free()*. In addition, method *Standard::Reallocate()* is provided to replace C function *realloc()*.
First you need to define *Sample_Point.hxx* :
~~~~
#ifndef _Sample_Point_HeaderFile
#define _Sample_Point_HeaderFile
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <MMgt_TShared.hxx>
#include <Standard_DefineHandle.hxx>
// Handle definition
//
DEFINE_STANDARD_HANDLE(Sample_Point,MMgt_TShared)
class Sample_Point: public MMgt_TShared {
public:
Sample_Point();
Sample_Point(const Standard_Real, const
Standard_Real);
void SetX(const Standard_Real x) {
myX = x;
}
void SetY(const Standard_Real y) {
myY = y;
}
Standard_Real X() const {
return myX;
}
Standard_Real Y() const {
return myY;
}
// some methods like DynamicType() or
IsKind()
//
DEFINE_STANDARD_RTTI(Sample_Point)
private:
Standard_Real myX;
Standard_Real myY;
};
#endif
~~~~
Then you need to define *Sample_Point.cxx* :
~~~~
#include <Sample_Point.hxx>
// Implementation of Handle and type mgt
IMPLEMENT_STANDARD_HANDLE(Sample_Point,MMgt_TShared)
IMPLEMENT_STANDARD_RTTI(Sample_Point,MMgt_TShared)
// For ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and
// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
// We must respect the order: from the direct ancestor class to the base class.
IMPLEMENT_STANDARD_TYPE(Sample_Point)
IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
IMPLEMENT_STANDARD_TYPE_END(Sample_Point)
// Constructors implementation
Sample_Point::Sample_Point(const
Standard_Real x, const Standard_Real y)
{
myX = x;
myY = y;
}
Sample_Point::Sample_Point()
{
myX = 0.0;
myY = 0.0;
}
~~~~
@subsection occt_fcug_2_3 Memory Management
In a work session, geometric modeling applications create and delete a considerable number of C++ objects allocated in the dynamic memory (heap). In this context, performance of standard functions for allocating and deallocating memory may be not sufficient. For this reason, Open CASCADE Technology employs a specialized memory manager implemented in the *Standard* package.
The Memory Manager is based on the following principles:
* small memory arrays are grouped into clusters and then recycled (clusters are never released to the system),
* large arrays are allocated and de-allocated through the standard functions of the system (the arrays are released to system when they are no longer used).
As a general rule, it is advisable to allocate memory through significant blocks. In this way, the user can work with blocks of contiguous data and it facilitates memory page manager processing.
@subsubsection occt_fcug_2_3_1 Usage of Memory Manager
To allocate memory in a C code with Open CASCADE Technology memory manager, simply use method *Standard::Allocate()* instead of *malloc()* and method *Standard::Free()* instead of *free()*. In addition, method *Standard::Reallocate()* is provided to replace C function *realloc()*.
In C++, operators *new()* and *delete()* for a class may be defined so as to allocate memory using *Standard::Allocate()* and free it using *Standard::Free()*. In that case all objects of that class and all inherited classes will be allocated using the OCCT memory manager.
CDL extractor defines *new()* and *delete()* in this way for all classes declared with CDL. Thus all OCCT classes (apart from a few exceptions) are allocated using the OCCT memory manager.
Since operators *new()* and *delete()* are inherited, this is also true for any class derived from an OCCT class, for instance, for all classes derived from *Standard_Transient*.
**Note** that it is possible (though not recommended unless really unavoidable) to redefine *new()* and *delete()* functions for some class inheriting Standard_Transient. If that is done, the method *Delete()* should be also redefined to apply operator *delete* to *this* pointer. This will ensure that appropriate *delete()* function will be called, even if the object is manipulated by a handle to a base class.
**Note** that it is possible (though not recommended unless really unavoidable) to redefine *new()* and *delete()* functions for a class inheriting *Standard_Transient*. If that is done, the method *Delete()* should be also redefined to apply operator *delete* to this pointer. This will ensure that appropriate *delete()* function will be called, even if the object is manipulated by a handle to a base class.
@subsubsection occt_fcug_2_3_2 How to configure the Memory Manager
@subsubsection occt_fcug_2_3_2 Configuring the memory manager
The OCCT memory manager may be configured to apply different optimization techniques to different memory blocks (depending on their size), or even to avoid any optimization and use C functions *malloc()* and *free()* directly.
The configuration is defined by numeric values of the following environment variables:
* *MMGT_OPT*: if set to 0 (default) every memory block is allocated in C memory heap directly (via *malloc()* and *free()* functions). In this case, all other options except for *MMGT_CLEAR* are ignored; if set to 1 the memory manager performs optimizations as described below; if set to 2, Intel ® TBB optimized memory manager is used.
@@ -535,7 +658,8 @@ The configuration is defined by numeric values of the following environment var
* *MMGT_THRESHOLD*: defines the maximal size of blocks that are recycled internally instead of being returned to the heap. Default is 40000.
* *MMGT_MMAP*: when set to 1 (default), large memory blocks are allocated using memory mapping functions of the operating system; if set to 0, they will be allocated in the C heap by *malloc()*.
@subsubsection occt_fcug_2_3_3 Implementation details
@subsubsection occt_fcug_2_3_3 Optimization Techniques
When *MMGT_OPT* is set to 1, the following optimization techniques are used:
* Small blocks with a size less than *MMGT_CELLSIZE*, are not allocated separately. Instead, a large pools of memory are allocated (the size of each pool is *MMGT_NBPAGES* pages). Every new memory block is arranged in a spare place of the current pool. When the current memory pool is completely occupied, the next one is allocated, and so on.
@@ -547,15 +671,15 @@ However, unlike small blocks, the recycled medium blocks contained in the free
* Large blocks with a size greater than *MMGT_THRESHOLD*, including memory pools used for small blocks, are allocated depending on the value of *MMGT_MMAP*: if it is 0, these blocks are allocated in the C heap; otherwise they are allocated using operating-system specific functions managing memory mapped files. Large blocks are returned to the system immediately when *Standard::Free()* is called.
#### Benefits and drawbacks
@subsubsection occt_fcug_2_3_4 Benefits and drawbacks
The major benefit of the OCCT memory manager is explained by its recycling of small and medium blocks that makes an application work much faster when it constantly allocates and frees multiple memory blocks of similar sizes. In practical situations, the real gain on the application performance may be up to 50%.
The associated drawback is that recycled memory is not returned to the operating system during program execution. This may lead to considerable memory consumption and even be misinterpreted as a memory leak. To minimize this effect, the method Standard::Purge() shall be called after the completion of memory-intensive operations.
The associated drawback is that recycled memory is not returned to the operating system during program execution. This may lead to considerable memory consumption and even be misinterpreted as a memory leak. To minimize this effect it is necessary to call the method *Standard::Purge* after the completion of memory-intensive operations.
The overhead expenses induced by the OCCT memory manager are:
* size of every allocated memory block is rounded up to 8 bytes (when MMGT_OPT is 0 (default), the rounding is defined by the CRT; the typical value for 32-bit platforms is 4 bytes)
* additional 4 bytes (or 8 on 64-bit platforms) are allocated in the beginning of every memory block to hold its size (or address of the next free memory block when recycled in free list) only when MMGT_OPT is 1
* size of every allocated memory block is rounded up to 8 bytes (when *MMGT_OPT* is 0 (default), the rounding is defined by the CRT; the typical value for 32-bit platforms is 4 bytes)
* additional 4 bytes (or 8 on 64-bit platforms) are allocated in the beginning of every memory block to hold its size (or address of the next free memory block when recycled in free list) only when *MMGT_OPT* is 1.
Note that these overheads may be greater or less than overheads induced by the C heap memory manager, so overall memory consumption may be greater in either optimized or standard modes, depending on circumstances.
@@ -564,12 +688,19 @@ As a general rule, it is advisable to allocate memory through significant block
OCCT memory manager uses mutex to lock access to free lists, therefore it may have less performance than non-optimized mode in situations when different threads often make simultaneous calls to the memory manager.
The reason is that modern implementations of *malloc()* and *free()* employ several allocation arenas and thus avoid delays waiting mutex release, which are possible in such situations.
@subsection occt_fcug_2_4 Exception Handling
@subsection occt_fcug_2_4 Exceptions
@subsubsection occt_fcug_2_4_1 Introduction
The behavior of any object is implemented by the methods, which were defined in its class declaration. The definition of these methods includes not only their signature (their programming interface) but also their domain of validity.
This domain is expressed by **exceptions**. Exceptions are raised under various error conditions to protect software quality.
Exception handling provides a means of transferring control from a given point in a program being executed to an **exception handler** associated with another point previously executed.
A method may raise an exception which interrupts its normal execution and transfers control to the handler catching this exception.
Open CASCADE Technology provides a hierarchy of exception classes with a root class being class Standard_Failure from the Standard package. The CDL extractor generates exception classes with standardized interface.
A hierarchy of commonly used exception classes is provided. The root class is *Standard_Failure* from the *Standard* package. So each exception inherits from *Standard_Failure* either directly or by inheriting from another exception. Exception classes list all exceptions, which can be raised by any OCCT function.
Open CASCADE Technology also provides support for converting system signals (such as access violation or division by zero) to exceptions, so that such situations can be safely handled with the same uniform approach.
@@ -577,7 +708,7 @@ However, in order to support this functionality on various platforms, some spec
The following paragraphs describe recommended approaches for using exceptions when working with Open CASCADE Technology.
@subsubsection occt_fcug_2_4_1 Raising an Exception
@subsubsection occt_fcug_2_4_2 Raising an Exception
#### “C++ like” Syntax
@@ -648,7 +779,7 @@ Item TCollection_Array1::Value (const Standard_Integer&index) const
}
~~~~~
@subsubsection occt_fcug_2_4_2 Handling an Exception
@subsubsection occt_fcug_2_4_3 Handling an Exception
When an exception is raised, control is transferred to the nearest handler of a given type in the call stack, that is:
* the handler whose try block was most recently entered and not yet exited,
@@ -736,31 +867,31 @@ Normally this method is called in the beginning of the main() function. It inst
In order to actually convert signals to exceptions, macro *OCC_CATCH_SIGNALS* needs to be inserted in the source code. The typical place where this macro is put is beginning of the *try{}* block which catches such exceptions.
@subsubsection occt_fcug_2_4_3 Implementation details
@subsubsection occt_fcug_2_4_4 Implementation on various platforms.
The exception handling mechanism in Open CASCADE Technology is implemented in different ways depending on the preprocessor macros *NO_CXX_EXCEPTIONS* and *OCC_CONVERT_SIGNALS*, which shall be consistently defined by compilation procedures for both Open CASCADE Technology and user applications:
1. On Windows and DEC, these macros are not defined by default, and normal C++ exceptions are used in all cases, including throwing from signal handler. Thus the behavior is as expected in C++.
1. On Windows, these macros are not defined by default, and normal C++ exceptions are used in all cases, including throwing from signal handler. Thus the behavior is as expected in C++.
2. On SUN and Linux, macro *OCC_CONVERT_SIGNALS* is defined by default. The C++ exception mechanism is used for catching exceptions and for throwing them from normal code. Since it is not possible to throw C++ exception from system signal handler function, that function makes a long jump to the nearest (in the execution stack) invocation of macro *OCC_CATCH_SIGNALS*, and only there the C++ exception gets actually thrown. The macro *OCC_CATCH_SIGNALS* is defined in the file *Standard_ErrorHandler.hxx*. Therefore, including this file is necessary for successful compilation of a code containing this macro.
2. On Linux, macro *OCC_CONVERT_SIGNALS* is defined by default. The C++ exception mechanism is used for catching exceptions and for throwing them from normal code. Since it is not possible to throw C++ exception from system signal handler function, that function makes a long jump to the nearest (in the execution stack) invocation of macro *OCC_CATCH_SIGNALS*, and only there the C++ exception gets actually thrown. The macro *OCC_CATCH_SIGNALS* is defined in the file *Standard_ErrorHandler.hxx*. Therefore, including this file is necessary for successful compilation of a code containing this macro.
This mode differs from standard C++ exception handling only for signals:
* macro *OCC_CATCH_SIGNALS* is necessary (besides call to *OSD::SetSignal()* described above) for conversion of signals into exceptions;
* the destructors for automatic C++ objects created in the code after that macro and till the place where signal is raised will not be called in case of signal, since no C++ stack unwinding is performed by long jump.
3. On SUN and Linux Open CASCADE Technology can also be compiled in compatibility mode (which was default till Open CASCADE Technology 6.1.0). In that case macro *NO_CXX_EXCEPTIONS* is defined and the C++ exceptions are simulated with C long jumps. As a consequence, the behavior is slightly different from that expected in the C++ standard.
3. On Linux Open CASCADE Technology can also be compiled in compatibility mode. In that case macro *NO_CXX_EXCEPTIONS* is defined and the C++ exceptions are simulated with C long jumps. As a consequence, the behavior is slightly different from that expected in the C++ standard.
While exception handling with NO_CXX_EXCEPTIONS is very similar to C++ by syntax, it has a number of peculiarities that should be taken into account:
While exception handling with *NO_CXX_EXCEPTIONS* is very similar to C++ by syntax, it has a number of peculiarities that should be taken into account:
* try and catch are actually macros defined in the file *Standard_ErrorHandler.hxx*. Therefore, including this file is necessary for handling OCCT exceptions;
* due to being a macro, catch cannot contain a declaration of the exception object after its type; only type is allowed in the catch statement. Use method *Standard_Failure::Caught()* to access an exception object;
* catch macro may conflict with some STL classes that might use catch(...) statements in their header files. So STL headers should not be included after *Standard_ErrorHandler.hxx*;
* Open CASCADE Technology try/catch block will not handle normal C++ exceptions; however this can be achieved using special workarounds;
* the try macro defines a C++ object that holds an entry point in the exception handler. Therefore if exception is raised by code located immediately after the try/catch block but on the same nesting level as *try*, it may be handled by that *catch*. This may lead to unexpected behavior, including infinite loop. To avoid that, always surround the try/catch block in \{\} braces;
* the destructors of the C++ objects allocated on the stack after handler initialization are not called by exception raising.
* the try macro defines a C++ object that holds an entry point in the exception handler. Therefore if exception is raised by code located immediately after the try/catch block but on the same nesting level as *try*, it may be handled by that *catch*. This may lead to unexpected behavior, including infinite loop. To avoid that, always surround the try/catch block with curved brackets;
* the destructors of C++ objects allocated on the stack after handler initialization are not called by exception raising.
In general, for writing platform-independent code it is recommended to insert macros *OCC_CATCH_SIGNALS* in try \{\} blocks or other code where signals may happen. For compatibility with previous versions of Open CASCADE Technology the limitations described above for *NO_CXX_EXCEPTIONS* shall be assumed.
In general, for writing platform-independent code it is recommended to insert macros *OCC_CATCH_SIGNALS* in try {} blocks or other code where signals may happen. For compatibility with previous versions of Open CASCADE Technology the limitations described above for *NO_CXX_EXCEPTIONS* shall be assumed.
@subsection occt_fcug_2_5 Plug-In Management
@@ -780,9 +911,9 @@ Once it has been loaded, the call to the services provided by the plug-in is di
#### C++ Plug-In Implementation
The C++ plug-in implements a service as an object with functions defined in an abstract class (this abstract class and its parent classes with the GUID are the only information about the plug-in implemented in the client application). The plug-in consists of a sharable library including a method named Factory which creates the C++ object (the client cannot instantiate this object because the plug-in implementation is not visible).
Foundation classes provide in the package **Plugin** a method named Load(), which enables the client to access the required service through a library.
Foundation classes provide in the package *Plugin* a method named *Load()*, which enables the client to access the required service through a library.
That method reads the information regarding available plug-ins and their locations from the resource file Plugin found by environment variable CSF_PluginDefaults:
That method reads the information regarding available plug-ins and their locations from the resource file *Plugin* found by environment variable *CSF_PluginDefaults*:
~~~~~
$CSF_PluginDefaults/.Plugin
@@ -904,7 +1035,7 @@ Handle(Standard_Transient) FAFactory::Factory(const Standard_GUID& aGUID)
#### Without using the Software Factory
To create a factory without using the Software Factory, define a *dll* project under Windows or a library under UNIX by using a source file as specified above. The *FAFactory* class is implemented as follows:
To create a factory without using the Software Factory, define a *dll* project under Windows or a library under UNIX by using a source file as specified above. The *FAFactory* class is implemented as follows:
~~~~~
#include <Handle_Standard_Transient.hxx>
@@ -920,7 +1051,7 @@ public:
~~~~~
@section occt_fcug_3 Collections, Strings and Unit Conversion
@section occt_fcug_3 Collections, Strings, Quantities and Unit Conversion
@subsection occt_fcug_3_1 Collections
@@ -928,18 +1059,35 @@ public:
The **Collections** component contains the classes that handle dynamically sized aggregates of data. They include a wide range of collections such as arrays, lists and maps.
Collections classes are *generic*, that is, they can hold a variety of objects which do not necessarily inherit from a unique root class. When you need to use a collection of a given type of object you must *instantiate* it for this specific type of element. Once this declaration is compiled, all the functions available on the generic collection are available on your *instantiated class*.
Collections classes are *generic* (C++ template-like), that is, they define a structure and algorithms allowing to hold a variety of objects which do not necessarily inherit from a unique root class (similarly to C++ templates).
When you need to use a collection of a given type of object you must *instantiate* it for this specific type of element. Once this declaration is compiled, all the functions available on the generic collection are available on your *instantiated class*.
However, note that:
* Each collection directly used as an argument in OCCT public syntax is instantiated in an OCCT component.
* The *TColStd* package (**Collections of Standard Objects** component) provides numerous instantiations of these generic collections with objects from the **Standard** package or from the **Strings** component.
The **Collections** component provides a wide range of generic collections:
* **Arrays** are generally used for a quick access to the item, however an array is a fixed sized aggregate.
* **Sequences** are variable-sized structures, they avoid the use of large and quasi-empty arrays. A sequence item is longer to access than an array item: only an exploration in sequence is effective (but sequences are not adapted for numerous explorations). Arrays and sequences are commonly used as data structures for more complex objects.
* On the other hand, **maps** are dynamic structures where the size is constantly adapted to the number of inserted items and the access time for an item is effective. Maps structures are commonly used in cases of numerous explorations: they are typically internal data structures for complex algorithms. **Sets** generate the same results as maps but computation time is considerable.
* **Lists, queues** and **stacks** are minor structures similar to sequences but with other exploration algorithms.
* **Maps** are dynamic structures, where the size is constantly adapted to the number of inserted items and access to an item is the fastest. Maps structures are commonly used in cases of numerous explorations: they are typically internal data structures for complex algorithms.
* **Lists** are similar to sequences but have different algorithms to explore them.
* Specific iterators for sequences and maps.
Most collections follow value semantics: their instances are the actual collections, not **handles** to a collection. Only arrays and sequences may also be manipulated by handle, and therefore shared.
Each collection directly used as an argument in Open CASCADE Technology public syntax
is instantiated in an OCCT component using the corresponding generic class in package
<i> TCollection</i>, by means of compiling the CDL declaration of the instance.
Thus OCCT generic classes require compilation of definitions in the CDL language and therefore
can only be instantiated in WOK.
If you do not use CDL in your project (CDL compilation under WOK is necessary
to instantiate any generic Collection from package <i>TCollection</i>), then you should
use the Collections defined in <i> NCollection</i> package. It contains definitions of the
same generic collection classes described above, but in a form of C++ templates.
Therefore, to instantiate any collection type no additional support is required beyond
the ANSI C++ compiler.
@subsubsection occt_fcug_3_1_2 Generic general-purpose Aggregates
#### TCollection_Array1
@@ -1059,7 +1207,6 @@ Maps are dynamically extended data structures where data is quickly accessed wi
#### General properties of maps
Map items may contain complex non-unitary data, thus it can be difficult to manage them with an array. The map allows a data structure to be indexed by complex data.
The size of a map is dynamically extended. So a map may be first dimensioned for a little number of items. Maps avoid the use of large and quasi-empty arrays.
@@ -1583,9 +1730,15 @@ As one possible choice, the class *NCollection_IncAllocator* is included. Unlike
@subsection occt_fcug_3_4 Strings
The **Strings** component provides services to manipulate character strings.
**Strings** are classes that handle dynamically sized sequences of characters based on both ASCII (normal 8-bit character type) and Unicode (16-bit character type). They provide editing operations with built-in memory management which make the relative objects easier to use than ordinary character arrays.
*Strings* may also be manipulated by *handle*, and therefore shared.
Strings are classes that handle dynamically sized sequences of characters based on
ASCII/Unicode UTF-8 (normal 8-bit character type) and UTF-16/UCS-2 (16-bit character type). They provide editing operations with built-in memory management which make the relative objects easier to use than ordinary character arrays.
String classes provide the following services to manipulate character strings:
* Editing operations on string objects, using a built-in string manager
* Handling of dynamically-sized sequences of characters
* Conversion from/to ASCII and UTF-8 strings.
Strings may also be manipulated by handles and therefore shared.
@subsubsection occt_fcug_3_4_1 Examples
@@ -1620,7 +1773,27 @@ A variable-length sequence of extended; (UNICODE) characters (16-bit character
*Resource_Unicode* provides functions to convert a non-ASCII *C string* given in ANSI, EUC, GB or SJIS format, to a Unicode string of extended characters, and vice versa.
@subsection occt_fcug_3_5 Unit Conversion
@subsection occt_fcug_3_5 Quantities
Quantities are various classes supporting date and time information and fundamental types representing most physical quantities such as length, area, volume, mass, density, weight, temperature, pressure etc.
Quantity classes provide the following services:
* Definition of primitive types representing most of mathematical and physical quantities;
* Unit conversion tools providing a uniform mechanism for dealing with quantities and associated physical units: check unit compatibility, perform conversions of values between different units, etc. (see package *UnitsAPI*)
* Resources to manage time information such as dates and time periods
* Resources to manage color definition
A mathematical quantity is characterized by the name and the value (real).
A physical quantity is characterized by the name, the value (real) and the unit. The unit may be either an international unit complying with the International Unit System (SI) or a user defined unit. The unit is managed by the physical quantity user.
The fact that both physical and mathematical quantities are manipulated as real values means that :
* They are defined as aliases of real values, so all functions provided by the <i>Standard_Real</i> class are available on each quantity.
* It is possible to mix several physical quantities in a mathematical or physical formula involving real values.
<i>Quantity</i> package includes all commonly used basic physical quantities.
@subsection occt_fcug_3_6 Unit Conversion
The *UnitsAPI* global functions are used to convert a value from any unit into another unit. Conversion is executed among three unit systems:
* the **SI System**,
@@ -1636,15 +1809,32 @@ A physical quantity is defined by a string (example: LENGTH).
@section occt_occt_fcug_4 Math Primitives and Algorithms
@subsection occt_occt_fcug_4_1 Overview
Math primitives and algorithms available in Open CASCADE Technology include:
* Vectors and matrices
* Geometric primitives
* Math algorithms
@subsection occt_occt_fcug_4_2 Vectors and Matrices
The Vectors and Matrices component provides a C++ implementation of the fundamental types Matrix and Vector, currently used to define more complex data structures. The Vector and Matrix classes support vectors and matrices of real values with standard operations such as addition, multiplication, transposition, inversion etc.
Vectors and matrices have arbitrary ranges which must be defined at declaration time and cannot be changed after declaration.
The Vectors and Matrices component provides a C++ implementation of the fundamental types *Vector* and *Matrix*, which are regularly used to define more complex data structures.
The <i> Vector</i> and <i> Matrix </i> classes provide commonly used mathematical algorithms which
include:
* Basic calculations involving vectors and matrices;
* Computation of eigenvalues and eigenvectors of a square matrix;
* Solvers for a set of linear algebraic equations;
* Algorithms to find the roots of a set of non-linear equations;
* Algorithms to find the minimum function of one or more independent variables.
These classes also provide a data structure to represent any expression,
relation, or function used in mathematics, including the assignment of variables.
Vectors and matrices have arbitrary ranges which must be defined at declaration time
and cannot be changed after declaration.
~~~~~
math_Vector v(1, 3);
@@ -1694,26 +1884,38 @@ v1(0) = 2.0;
~~~~~~
@subsection occt_occt_fcug_4_3 Primitive Geometric Types
Before creating a geometric object, you must decide whether you are in a 2d or in a 3d context and how you want to handle the object.
The *gp* package offers classes for both 2d and 3d objects which are handled by value rather than by reference. When this sort of object is copied, it is copied entirely. Changes in one instance will not be reflected in another.
Open CASCADE Technology primitive geometric types are a STEP-compliant implementation of basic geometric and algebraic entities.
They provide:
* Descriptions of primitive geometric shapes, such as:
* Points;
* Vectors;
* Lines;
* Circles and conics;
* Planes and elementary surfaces;
* Positioning of these shapes in space or in a plane by means of an axis or a coordinate system;
* Definition and application of geometric transformations to these shapes:
* Translations;
* Rotations;
* Symmetries;
* Scaling transformations;
* Composed transformations;
* Tools (coordinates and matrices) for algebraic computation.
All these functions are provided by geometric processor package <i> gp</i>. Its classes for 2d and 3d objects are handled by value rather than by reference. When this sort of object is copied, it is copied entirely. Changes in one instance will not be reflected in another.
The *gp* package defines the basic non-persistent geometric entities used for algebraic calculation and basic analytical geometry in 2d & 3d space. It also provides basic transformations such as identity, rotation, translation, mirroring, scale transformations, combinations of transformations, etc. Entities are handled by value.
The available geometric entities are:
* 2d & 3d Cartesian coordinates (x, y, z)
* Matrices
* Cartesian points
* Vector
* Direction
* Axis
* Line
* Circle
* Ellipse
* Hyperbola
* Parabola
* Plane
* Infinite cylindrical surface
* Spherical surface
* Toroidal surface
* Conical surface.
Please, note that <i> gp</i> curves and surfaces are analytic: there is no parameterization and no orientation on <i>gp</i> entities, i.e. these entities do not provide functions which work with these properties.
If you need, you may use more evolved data structures provided by <i> Geom</i> (in 3D space) and <i> Geom2d</i> (in the plane). However, the definition of <i> gp</i> entities is identical to the one of equivalent <i> Geom</i> and <i> Geom2d</i> entities, and they are located in the plane or in space with the same kind of positioning systems. They implicitly contain the orientation, which they express on the <i> Geom </i> and <i> Geom2d </i> entities, and they induce the definition of their parameterization.
Therefore, it is easy to give an implicit parameterization to <i> gp</i> curves and surfaces, which is the parametrization of the equivalent <i> Geom</i> or <i> Geom2d</i> entity. This property is particularly useful when computing projections or intersections, or for operations involving complex algorithms where it is particularly important to manipulate the simplest data structures, i.e. those of <i> gp</i>. Thus, <i> ElCLib</i> and <i> ElSLib</i> packages provide functions to compute:
* the point of parameter u on a 2D or 3D gp curve,
* the point of parameter (u,v) on a gp elementary surface, and
* any derivative vector at this point.
Note: the <i> gp</i> entities cannot be shared when they are inside more complex data structures.
@subsection occt_occt_fcug_4_4 Collections of Primitive Geometric Types

View File

@@ -5,10 +5,19 @@ IGES Support {#occt_user_guides__iges}
@section occt_iges_1 Introduction
The IGES interface reads IGES files and translates them to Open CASCADE Technology models. The interface is able to translate one entity, a group of entities or a whole file. Before beginning a translation, you can set a range of parameters to manage the translation process. If you like, you can also check file consistency before translation. The IGES interface also translates OCCT models to IGES files.
This manual explains how to convert an IGES file to an Open CASCADE Technology (**OCCT**) shape and vice versa. It provides basic documentation on conversion. For advanced information on conversion, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
Other kinds of data such as colors and names can be read or written with the help of XDE tools <i> IGESCAFControl_Reader</i> and <i> IGESCAFControl_Writer</i>.
IGES files up to and including IGES version 5.3 can be read. IGES files that are produced by this interface conform to IGES version 5.3 (Initial Graphics Exchange Specification, IGES 5.3. ANS US PRO/IPO-100-1996).
Please, note:
* an IGES model is an IGES file that has been loaded into memory.
* an IGES entity is an entity in the IGES normal sense.
* a root entity is the highest level entity of any given type, e.g. type 144 for surfaces and type 186 for solids. Roots are not referenced by other entities.
This manual mainly explains how to convert an IGES file to an Open CASCADE Technology (**OCCT**) shape and vice versa. It provides basic documentation on conversion. For advanced information on conversion, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
IGES files produced in accordance with IGES standard versions up to and including version 5.3 can be read. IGES files that are produced by this interface conform to IGES version 5.3 (Initial Graphics Exchange Specification, IGES 5.3. ANS US PRO/IPO-100-1996).
This manual principally deals with two OCCT classes:
* The Reader class, which loads IGES files and translates their contents to OCCT shapes,
@@ -18,6 +27,8 @@ File translation is performed in the programming mode, via C++ calls, and the r
All definitions in IGES version 5.3 are recognized but only 3D geometric entities are translated. When the processor encounters data, which is not translated, it ignores it and writes a message identifying the types of data, which was not handled. This message can be written either to a log file or to screen output.
@ref occt_user_guides__shape_healing "Shape Healing" toolkit provides tools to heal various problems, which may be encountered in translated shapes, and to make them valid in Open CASCADE. The Shape Healing is smoothly connected to IGES translator using the same API, only the names of API packages change.
@section occt_iges_2 Reading IGES
@subsection occt_iges_2_1 Procedure
You can translate an IGES file to an OCCT shape by following the steps below:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -5,24 +5,37 @@ Modeling Data {#occt_user_guides__modeling_data}
@section occt_modat_0 Introduction
Modeling Data supplies data structures to represent 2D and 3D geometric models. This manual explains how to use Modeling Data. For advanced information on modeling data, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
Modeling Data supplies data structures to represent 2D and 3D geometric models.
This manual explains how to use Modeling Data. For advanced information on modeling data, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>.
@section occt_modat_1 Geometry Utilities
Geometry Utilities provide the following services:
* Creation of shapes by interpolation and approximation
* Direct construction of shapes
* Conversion of curves and surfaces to Bspline curves and surfaces
* Conversion of curves and surfaces to BSpline curves and surfaces
* Computation of the coordinates of points on 2D and 3D curves
* Calculation of extrema between shapes.
@subsection occt_modat_1_1 Interpolations and Approximations
In modeling, it is often required to approximate or interpolate points into curves and surfaces. In interpolation, the process is complete when the curve or surface passes through all the points; in approximation, when it is as close to these points as possible. This component provides both high and low level services to approximate or interpolate points into curves and surfaces. The lower level services allow performing parallel approximation of groups of points into groups of Bezier or B-spline curves.
In modeling, it is often required to approximate or interpolate points into curves and surfaces. In interpolation, the process is complete when the curve or surface passes through all the points; in approximation, when it is as close to these points as possible.
Approximation of Curves and Surfaces groups together a variety of functions used in 2D and 3D geometry for:
* the interpolation of a set of 2D points using a 2D BSpline or Bezier curve;
* the approximation of a set of 2D points using a 2D BSpline or Bezier curve;
* the interpolation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface;
* the approximation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface.
You can program approximations in two ways:
* Using high-level functions, designed to provide a simple method for obtaining approximations with minimal programming,
* Using low-level functions, designed for users requiring more control over the approximations.
@subsubsection occt_modat_1_1_1 Analysis of a set of points
The class *PEquation* from *GProp* package allows analyzng a collection or cloud of points and verifying if they are coincident, collinear or coplanar within a given precision. If they are, the algorithm computes the mean point, the mean line or the mean plane of the points. If they are not, the algorithm computes the minimal box, which includes all the points.
The class *PEquation* from *GProp* package allows analyzing a collection or cloud of points and verifying if they are coincident, collinear or coplanar within a given precision. If they are, the algorithm computes the mean point, the mean line or the mean plane of the points. If they are not, the algorithm computes the minimal box, which includes all the points.
@subsubsection occt_modat_1_1_2 Basic Interpolation and Approximation
@@ -78,6 +91,15 @@ The class **PointsToBSplineSurface** from GeomAPI package allows building a BSpl
Packages *AppDef* and *AppParCurves* provide low-level functions, allowing more control over the approximations.
The low-level functions provide a second API with functions to:
* Define compulsory tangents for an approximation. These tangents have origins and extremities.
* Approximate a set of curves in parallel to respect identical parameterization.
* Smooth approximations. This is to produce a faired curve.
You can also find functions to compute:
* The minimal box which includes a set of points
* The mean plane, line or point of a set of coplanar, collinear or coincident points.
#### Approximation by multiple point constraints
*AppDef* package provides low-level tools to allow parallel approximation of groups of points into Bezier or B-Spline curves using multiple point constraints.
@@ -86,7 +108,7 @@ The following low level services are provided:
* Definition of an array of point constraints:
The class *MultiLine* allows defining a given number of multipoint constraints in order to build the multi-line, multiple lines passing through ordered multiple point constraints.
The class *MultiLine* allows defining a given number of multi-point constraints in order to build the multi-line, multiple lines passing through ordered multiple point constraints.
@image html /user_guides/modeling_data/images/modeling_data_image004.png "Definition of a MultiLine using Multiple Point Constraints"
@image latex /user_guides/modeling_data/images/modeling_data_image004.png "Definition of a MultiLine using Multiple Point Constraints"
@@ -98,7 +120,7 @@ The following low level services are provided:
* Definition of a set of point constraints:
The class **MultiPointConstraint** allows defining a multiple point constraint and computing the approximation of sets of points to several curves.
The class *MultiPointConstraint* allows defining a multiple point constraint and computing the approximation of sets of points to several curves.
* Computation of an approximation of a Bezier curve from a set of points:
@@ -106,7 +128,7 @@ The following low level services are provided:
* Computation of an approximation of a BSpline curve from a set of points:
The class **BSplineCompute** allows making an approximation of a set of points to a BSpline curve.
The class *BSplineCompute* allows making an approximation of a set of points to a BSpline curve.
* Definition of Variational Criteria:
@@ -138,13 +160,48 @@ The class *MultiBSpCurve* allows defining the approximation of a multi-line made
* Definition of points making up a set of point constraints
The class *MultiPoint* allows defining groups of 2D or 3D points making up a multi-line.
#### Example: How to approximate a curve with respect to tangency
To approximate a curve with respect to tangency, follow these steps:
1. Create an object of type <i> AppDef_MultiPointConstraints</i> from the set of points to approximate and use the method <i> SetTang </i>to set the tangency vectors.
2. Create an object of type <i> AppDef_MultiLine </i>from the <i> AppDef_MultiPointConstraint</i>.
3. Use <i> AppDef_BSplineCompute</i>, which instantiates <i>Approx_BSplineComputeLine</i> to perform the approximation.
@subsection occt_modat_1_2 Direct Construction
Direct Construction methods from *gce*, *GC* and *GCE2d* packages provide simplified algorithms to build elementary geometric entities such as lines, circles and curves. They complement the reference definitions provided by the *gp*, *Geom* and *Geom2d* packages.
The algorithms implemented by <i> gce</i>, <i> GCE2d</i> and <i> GC</i> packages are simple: there is no creation of objects defined by advanced positional constraints (for more information on this subject, see *Geom2dGcc* and *GccAna*, which describe geometry by constraints).
For example, to construct a circle from a point and a radius using the *gp* package, it is necessary to construct axis *Ax2d* before creating the circle. If *gce* package is used, and *Ox* is taken for the axis, it is possible to create a circle directly from a point and a radius.
Another example is the class <i>gce_MakeCirc</i> providing a framework for defining eight problems encountered in the geometric construction of circles and implementing the eight related construction algorithms.
The object created (or implemented) is an algorithm which can be consulted to find out, in particular:
* its result, which is a <i>gp_Circ</i>, and
* its status. Here, the status indicates whether or not the construction was successful.
If it was unsuccessful, the status gives the reason for the failure.
~~~~
gp_Pnt P1 (0.,0.,0.);
gp_Pnt P2 (0.,10.,0.);
gp_Pnt P3 (10.,0.,0.);
gce_MakeCirc MC (P1,P2,P3);
if (MC.IsDone()) {
const gp_Circ& C = MC.Value();
}
~~~~
In addition, <i> gce</i>, <i> GCE2d</i> and <i> GC</i> each have a <i>Root</i> class. This class is the root of all classes in the package, which return a status. The returned status (successful
construction or construction error) is described by the enumeration <i>gce_ErrorType</i>.
Note, that classes, which construct geometric transformations do not return a status, and therefore do not inherit from *Root*.
@subsubsection occt_modat_1_2_1 Non-persistent entities
The following algorithms used to build entities from non-persistent *gp* entities are provided by *gce* package.
@@ -245,16 +302,52 @@ The following classes return objects of type *TrimmedCurve* from *Geom*:
@subsection occt_modat_1_3 Conversion to and from BSplines
The following algorithms to convert geometric curves or surfaces into their BSpline or Bezier equivalents are provided by *GeomConvert*, *Geom2dConvert* and *Convert* packages:
- Conversion of a conic into a rational BSpline.
- Conversion of an elementary surface into a rational Bspline.
- Conversion of a BSpline or Bezier curve into two or more Bezier curves or surfaces.
- Conversion of a BSpline curve or surface into two or more BSplinecurves or surfaces with constraints on continuity.
- Conversion of a set of joining Bezier curves into a BSplinecurve.
- Conversion of a polynomial representation into a BSpline curve.
The Conversion to and from BSplines component has two distinct purposes:
* Firstly, it provides a homogeneous formulation which can be used to describe any curve or surface.
This is useful for writing algorithms for a single data structure model.
The BSpline formulation can be used to represent most basic geometric objects provided
by the components which describe geometric data structures ("Fundamental Geometry Types", "2D Geometry Types" and "3D Geometry Types" components).
* Secondly, it can be used to divide a BSpline curve or surface into a series of curves or surfaces,
thereby providing a higher degree of continuity. This is useful for writing algorithms
which require a specific degree of continuity in the objects to which they are applied.
Discontinuities are situated on the boundaries of objects only.
The "Conversion to and from BSplines" component is composed of three packages.
The <i> Convert </i> package provides algorithms to convert the following into a BSpline curve or surface:
* a bounded curve based on an elementary 2D curve (line, circle or conic) from the <i> gp </i> package,
* a bounded surface based on an elementary surface (cylinder, cone, sphere or torus) from the <i> gp</i> package,
* a series of adjacent 2D or 3D Bezier curves defined by their poles.
These algorithms compute the data needed to define the resulting BSpline curve or surface.
This elementary data (degrees, periodic characteristics, poles and weights, knots and multiplicities)
may then be used directly in an algorithm, or can be used to construct the curve or the surface
by calling the appropriate constructor provided by the classes <i>Geom2d_BSplineCurve, Geom_BSplineCurve </i> or <i>Geom_BSplineSurface</i>.
The <i>Geom2dConvert</i> package provides the following:
* a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package,
* a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
* global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve,
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves.
The <i> GeomConvert</i> package also provides the following:
* a global function used to construct a BSpline curve from a bounded curve based on a curve from the Geom package,
* a splitting algorithm, which computes the points at which a BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
* global functions to construct BSpline curves created by this splitting algorithm, or by other types of BSpline curve segmentation,
* an algorithm, which converts a BSpline curve into a series of adjacent Bezier curves,
* a global function to construct a BSpline surface from a bounded surface based on a surface from the Geom package,
* a splitting algorithm, which determines the curves along which a BSpline surface should be cut in order to obtain patches with the same degree of continuity,
* global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
* an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
@subsection occt_modat_1_4 Points on Curves
The Points on Curves component comprises high level functions providing an API for complex algorithms that compute points on a 2D or 3D curve.
The following characteristic points exist on parameterized curves in 3d space:
- points equally spaced on a curve,
- points distributed along a curve with equal chords,
@@ -267,7 +360,6 @@ The following characteristic points exist on parameterized curves in 3d space:
### Example: Visualizing a curve.
Let us take an adapted curve **C**, i.e. an object which is an interface between the services provided by either a 2D curve from the package Geom2d (in case of an Adaptor_Curve2d curve) or a 3D curve from the package Geom (in case of an Adaptor_Curve curve), and the services required on the curve by the computation algorithm. The adapted curve is created in the following way:
**2D case :**
@@ -312,23 +404,30 @@ These packages calculate the extrema of distance between:
- a curve and a surface,
- two surfaces.
@subsubsection occt_modat_1_5_1 Extrema between Curves
### Extrema between Curves
The *Geom2dAPI_ExtremaCurveCurve* class allows calculation of all extrema between two 2D geometric curves. Extrema are the lengths of the segments orthogonal to two curves.
The *GeomAPI_ExtremaCurveCurve* class allows calculation of all extrema between two 3D geometric curves. Extrema are the lengths of the segments orthogonal to two curves.
@subsubsection occt_modat_1_5_2 Extrema between Curve and Surface
### Extrema between Curve and Surface
The *GeomAPI_ExtremaCurveSurface* class allows calculation of all extrema between a 3D curve and a surface. Extrema are the lengths of the segments orthogonal to the curve and the surface.
@subsubsection occt_modat_1_5_3 Extrema between Surfaces
### Extrema between Surfaces
The *GeomAPI_ExtremaSurfaceSurface* class allows calculation of all extrema between two surfaces. Extrema are the lengths of the segments orthogonal to two surfaces.
@section occt_modat_2 2D Geometry
*Geom2d* package defines geometric objects in 2dspace. All geometric entities are STEP processed. The objects are non-persistent and are handled by reference. The following objects are available:
*Geom2d* package defines geometric objects in 2dspace. All geometric entities are STEP processed. The objects are non-persistent and are handled by reference.
In particular, <i>Geom2d</i> package provides classes for:
* description of points, vectors and curves,
* their positioning in the plane using coordinate systems,
* their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof.
The following objects are available:
- point,
- Cartesian point,
- vector,
@@ -337,9 +436,9 @@ The *GeomAPI_ExtremaSurfaceSurface* class allows calculation of all extrema betw
- axis,
- curve,
- line,
- conic: circle, ellipse, hyperbola, pparabola,
- rounded curve: trimmed curve, NURBS curve, Bezier curve.
- offset curve
- conic: circle, ellipse, hyperbola, parabola,
- rounded curve: trimmed curve, NURBS curve, Bezier curve,
- offset curve.
Before creating a geometric object, it is necessary to decide how the object is handled.
The objects provided by *Geom2d* package are handled by reference rather than by value. Copying an instance copies the handle, not the object, so that a change to one instance is reflected in each occurrence of it.
@@ -347,9 +446,45 @@ If a set of object instances is needed rather than a single object instance, *
- handled by reference and
- handled by value.
The key characteristic of <i> Geom2d </i> curves is that they are parameterized.
Each class provides functions to work with the parametric equation of the curve,
and, in particular, to compute the point of parameter u on a curve and the derivative vectors of order 1, 2.., N at this point.
As a consequence of the parameterization, a <i> Geom2d </i> curve is naturally oriented.
Parameterization and orientation differentiate elementary <i>Geom2d </i>curves from their
equivalent as provided by <i> gp</i> package. <i> Geom2d</i> package provides conversion
functions to transform a <i> Geom2d</i> object into a <i> gp</i> object, and vice-versa, when this is possible.
Moreover, <i> Geom2d</i> package provides more complex curves, including Bezier curves,
BSpline curves, trimmed curves and offset curves.
<i> Geom2d </i> objects are organized according to an inheritance structure over several levels.
Thus, an ellipse (specific class <i> Geom2d_Ellipse</i>) is also a conical curve and inherits from the abstract class <i> Geom2d_Conic</i>, while a Bezier curve (concrete class <i> Geom2d_BezierCurve</i>) is also a bounded curve and inherits from the abstract class <i> Geom2d_BoundedCurve</i>; both these examples are also curves (abstract class <i>Geom2d_Curve</i>). Curves, points and vectors inherit from the abstract class <i> Geom2d_Geometry,</i> which describes the properties common to any geometric object from the <i>Geom2d</i> package.
This inheritance structure is open and it is possible to describe new objects, which inherit from those provided in the <i>Geom2d</i> package, provided that they respect the behavior of the classes from which they are to inherit.
Finally, <i> Geom2d</i> objects can be shared within more complex data structures. This is why they are used within topological data structures, for example.
<i>Geom2d</i>package uses the services of the <i> gp</i> package to:
* implement elementary algebraic calculus and basic analytic geometry,
* describe geometric transformations which can be applied to <i> Geom2d</i> objects,
* describe the elementary data structures of <i>Geom2d</i> objects.
However, the <i> Geom2d</i> package essentially provides data structures and not algorithms.
You can refer to the <i> GCE2d </i> package to find more evolved construction algorithms for <i> Geom2d </i> objects.
@section occt_modat_3 3D Geometry
The *Geom* package defines geometric objects in 3d space and contains all basic geometric transformations, such as identity, rotation, translation, mirroring, scale transformations, combinations of transformations, etc. as well as special functions depending on the reference definition of the geometric object (e.g. addition of a control point on a B-Spline curve,modification of a curve, etc.). All geometrical entities are STEP processed. The following non-persistent and reference-handled objects are available:
The *Geom* package defines geometric objects in 3d space and contains all basic geometric transformations, such as identity, rotation, translation, mirroring, scale transformations, combinations of transformations, etc. as well as special functions depending on the reference definition of the geometric object (e.g. addition of a control point on a B-Spline curve,modification of a curve, etc.). All geometrical entities are STEP processed.
In particular, it provides classes for:
* description of points, vectors, curves and surfaces,
* their positioning in 3D space using axis or coordinate systems, and
* their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof.
The following non-persistent and reference-handled objects are available:
- Point
- Cartesian point
- Vector
@@ -366,13 +501,125 @@ The *Geom* package defines geometric objects in 3d space and contains all basic
- Swept surface: surface of linear extrusion, surface of revolution
- Offset surface.
The key characteristic of *Geom* curves and surfaces is that they are parameterized.
Each class provides functions to work with the parametric equation of the curve or
surface, and, in particular, to compute:
* the point of parameter u on a curve, or
* the point of parameters (u, v) on a surface.
together with the derivative vectors of order 1, 2, ... N at this point.
As a consequence of this parameterization, a Geom curve or surface is naturally oriented.
Parameterization and orientation differentiate elementary Geom curves and surfaces from the classes of the same (or similar) names found in <i> gp</i> package.
<i>Geom</i> package also provides conversion functions to transform a Geom object into a <i> gp</i> object, and vice-versa, when such transformation is possible.
Moreover, <i> Geom </i>package provides more complex curves and surfaces, including:
* Bezier and BSpline curves and surfaces,
* swept surfaces, for example surfaces of revolution and surfaces of linear extrusion,
* trimmed curves and surfaces, and
* offset curves and surfaces.
Geom objects are organized according to an inheritance structure over several levels.
Thus, a sphere (concrete class <i> Geom_SphericalSurface</i>) is also an elementary surface and inherits from the abstract class <i> Geom_ElementarySurface</i>, while a Bezier surface (concrete class <i> Geom_BezierSurface</i>) is also a bounded surface and inherits from the abstract class <i> Geom_BoundedSurface</i>; both these examples are also surfaces (abstract class <i> Geom_Surface</i>). Curves, points and vectors inherit from the abstract class <i> Geom_Geometry,</i> which describes the properties common to any geometric object from the <i>Geom</i> package.
This inheritance structure is open and it is possible to describe new objects, which inherit from those provided in the Geom package, on the condition that they respect the behavior of the classes from which they are to inherit.
Finally, Geom objects can be shared within more complex data structures. This is why they are used within topological data structures, for example.
If a set of object instances is needed rather than a single object instance, *TColGeom* package can be used. This package provides instantiations of one- and two-dimensional arrays and sequences for curves from *Geom* package. All objects are available in two versions:
- handled by reference and
- handled by value.
@subsection occt_modat_4 Local Properties of Curves and Surfaces
The <i> Geom</i> package uses the services of the <i> gp</i> package to:
* implement elementary algebraic calculus and basic analytic geometry,
* describe geometric transformations which can be applied to Geom objects,
* describe the elementary data structures of Geom objects.
Packages **GeomLProp**, **Geom2dLProp** provide algorithms calculating the local properties of curves and surfaces
However, the Geom package essentially provides data structures, not algorithms.
You can refer to the <i> GC</i> package to find more evolved construction algorithms for
Geom objects.
@section occt_modat_4 Properties of Shapes
@subsection occt_modat_4_1 Local Properties of Shapes
<i>BRepLProp</i> package provides the Local Properties of Shapes component,
which contains algorithms computing various local properties on edges and faces in a BRep model.
The local properties which may be queried are:
* for a point of parameter u on a curve which supports an edge :
* the point,
* the derivative vectors, up to the third degree,
* the tangent vector,
* the normal,
* the curvature, and the center of curvature;
* for a point of parameter (u, v) on a surface which supports a face :
* the point,
* the derivative vectors, up to the second degree,
* the tangent vectors to the u and v isoparametric curves,
* the normal vector,
* the minimum or maximum curvature, and the corresponding directions of curvature;
* the degree of continuity of a curve which supports an edge, built by the concatenation of two other edges, at their junction point.
Analyzed edges and faces are described as <i> BRepAdaptor</i> curves and surfaces,
which provide shapes with an interface for the description of their geometric support.
The base point for local properties is defined by its u parameter value on a curve, or its (u, v) parameter values on a surface.
@subsection occt_modat_4_2 Local Properties of Curves and Surfaces
The "Local Properties of Curves and Surfaces" component provides algorithms for computing various local properties on a Geom curve (in 2D or 3D space) or a surface. It is composed of:
* <i> Geom2dLProp</i> package, which allows computing Derivative and Tangent vectors (normal and curvature) of a parametric point on a 2D curve;
* <i> GeomLProp </i> package, which provides local properties on 3D curves and surfaces
* <i> LProp </i> package, which provides an enumeration used to characterize a particular point on a 2D curve.
Curves are either <i> Geom_Curve </i> curves (in 3D space) or <i> Geom2d_Curve </i> curves (in the plane).
Surfaces are <i> Geom_Surface </i> surfaces. The point on which local properties are calculated
is defined by its u parameter value on a curve, and its (u,v) parameter values on a surface.
It is possible to query the same local properties for points as mentioned above, and additionally for 2D curves:
* the points corresponding to a minimum or a maximum of curvature;
* the inflection points.
#### Example: How to check the surface concavity
To check the concavity of a surface, proceed as follows:
1. Sample the surface and compute at each point the Gaussian curvature.
2. If the value of the curvature changes of sign, the surface is concave or convex depending on the point of view.
3. To compute a Gaussian curvature, use the class <i> SLprops</i> from <i> GeomLProp</i>, which instantiates the generic class <i> SLProps </i>from <i> LProp</i> and use the method <i> GaussianCurvature</i>.
@subsection occt_modat_4_3 Global Properties of Shapes
The Global Properties of Shapes component provides algorithms for computing the global
properties of a composite geometric system in 3D space, and frameworks to query the computed results.
The global properties computed for a system are :
* mass,
* mass center,
* matrix of inertia,
* moment about an axis,
* radius of gyration about an axis,
* principal properties of inertia such as principal axis, principal moments, and principal radius of gyration.
Geometric systems are generally defined as shapes. Depending on the way they are analyzed, these shapes will give properties of:
* lines induced from the edges of the shape,
* surfaces induced from the faces of the shape, or
* volumes induced from the solid bounded by the shape.
The global properties of several systems may be brought together to give the global properties of the system composed of the sum of all individual systems.
The Global Properties of Shapes component is composed of:
* seven functions for computing global properties of a shape: one function for lines, two functions for surfaces and four functions for volumes. The choice of functions depends on input parameters and algorithms used for computation (<i>BRepGProp</i> global functions),
* a framework for computing global properties for a set of points (<i>GProp_PGProps</i>),
* a general framework to bring together the global properties retained by several more elementary frameworks, and provide a general programming interface to consult computed global properties.
Packages *GeomLProp* and *Geom2dLProp* provide algorithms calculating the local properties of curves and surfaces
A curve (for one parameter) has the following local properties:
- Point
@@ -401,24 +648,77 @@ The following methods are available:
Note that the B-spline curve and surface are accepted but they are not cut into pieces of the desired continuity. It is the global continuity, which is seen.
@subsection occt_modat_5 Adaptors for Curves and Surfaces
Some Open CASCADE Technology general algorithms may work theoretically on numerous types of curves or surfaces.
To do this, they simply get the services required of the analyzed curve or surface through an interface so as to a single API, whatever the type of curve or surface. These interfaces are called adaptors.
For example, <i> Adaptor3d_Curve </i> is the abstract class which provides the required services by an algorithm which uses any 3d curve.
<i> GeomAdaptor </i> package provides interfaces:
* On a Geom curve;
* On a curve lying on a Geom surface;
* On a Geom surface;
<i> Geom2dAdaptor</i> package provides interfaces :
* On a <i>Geom2d</i> curve.
<i> BRepAdaptor </i> package provides interfaces:
* On a Face
* On an Edge
When you write an algorithm which operates on geometric objects, use <i> Adaptor3d</i> (or <i> Adaptor2d</i>) objects.
As a result, you can use the algorithm with any kind of object, if you provide for this object an interface derived from *Adaptor3d* or *Adaptor2d*.
These interfaces are easy to use: simply create an adapted curve or surface from a *Geom2d* curve, and then use this adapted curve as an argument for the algorithm? which requires it.
@section occt_modat_5 Topology
Open CASCADE Technology Topology allows accessing and manipulating objects data without dealing with their 2D or 3D representations. Whereas OCCT Geometry provides a description of objects in terms of coordinates or parametric values, Topology describes data structures of objects in parametric space. These descriptions use location in and restriction of parts of this space.
OCCT Topology allows accessing and manipulating data of objects without dealing with their 2D or 3D representations. Whereas OCCT Geometry provides a description of objects in terms of coordinates or parametric values, Topology describes data structures of objects in parametric space. These descriptions use location in and restriction of parts of this space.
To provide its descriptions, OCCT abstract topology offers the following services:
- Keeping track of Location of shapes
- Naming shapes, sub-shapes, their orientations and states
- Manipulating shapes and sub-shapes
- Exploring topological data structures
- Using lists and maps of shapes
Topological library allows you to build pure topological data structures. Topology defines relationships between simple geometric entities. In this way, you can model complex shapes as assemblies of simpler entities. Due to a built-in non-manifold (or mixed-dimensional) feature, you can build models mixing:
* 0D entities such as points;
* 1D entities such as curves;
* 2D entities such as surfaces;
* 3D entities such as volumes.
You can, for example, represent a single object made of several distinct bodies containing embedded curves and surfaces connected or non-connected to an outer boundary.
Abstract topological data structure describes a basic entity - a shape, which can be divided into the following component topologies:
* Vertex - a zero-dimensional shape corresponding to a point in geometry;
* Edge - a shape corresponding to a curve, and bound by a vertex at each extremity;
* Wire - a sequence of edges connected by their vertices;
* Face - part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a closed wire;
* Shell - a collection of faces connected by some edges of their wire boundaries;
* Solid - a part of 3D space bound by a shell;
* Compound solid - a collection of solids.
The wire and the solid can be either infinite or closed.
A face with 3D underlying geometry may also refer to a collection of connected triangles that approximate the underlying surface. The surfaces can be undefined leaving the faces represented by triangles only. If so, the model is purely polyhedral.
Topology defines the relationship between simple geometric entities, which can thus be linked together to represent complex shapes.
Abstract Topology is provided by six packages.
The first three packages describe the topological data structure used in Open CASCADE Technology:
* <i> TopAbs</i> package provides general resources for topology-driven applications. It contains enumerations that are used to describe basic topological notions: topological shape, orientation and state. It also provides methods to manage these enumerations.
* <i> TopLoc </i>package provides resources to handle 3D local coordinate systems: <i> Datum3D</i>and <i> Location</i>. <i> Datum3D</i> describes an elementary coordinate system, while <i> Location</i> comprises a series of elementary coordinate systems.
* <i> TopoDS</i> package describes classes to model and build data structures that are purely topological.
Three additional packages provide tools to access and manipulate this abstract topology:
* <i> TopTools</i> package provides basic tools to use on topological data structures.
* <i> TopExp</i> package provides classes to explore and manipulate the topological data structures described in the TopoDS package.
* <i> BRepTools </i> package provides classes to explore, manipulate, read and write BRep data structures. These more complex data structures combine topological descriptions with additional geometric information, and include rules for evaluating equivalence of different possible representations of the same object, for example, a point.
@subsection occt_modat_5_1 Shape Location
A local coordinate system can be viewed as either of the following:
- A right-handed trihedron with an origin and three orthonormal vectors. The **gp_Ax2** package corresponds to this definition.
- A transformation of a +1 determinant, allowing the transformation of coordinates between local and global references frames. This corresponds to the **gp_Trsf**.
- A right-handed trihedron with an origin and three orthonormal vectors. The *gp_Ax2* package corresponds to this definition.
- A transformation of a +1 determinant, allowing the transformation of coordinates between local and global references frames. This corresponds to the *gp_Trsf*.
*TopLoc* package distinguishes two notions:
- *TopLoc_Datum3D* class provides the elementary reference coordinate, represented by a right-handed orthonormal system of axes or by a right-handed unitary transformation.
@@ -439,21 +739,19 @@ C4 = R1 * C2
**NOTE** C3 and C4 are equal because they are both R1 * R2 * R3.
The TopLoc package is chiefly targeted at the topological data structure, but it can be used for other purposes.
The *TopLoc* package is chiefly targeted at the topological data structure, but it can be used for other purposes.
Change of coordinates
---------------------
*TopLoc_Datum3D* class represents a change of elementary coordinates. Such changes must be shared so this class inherits from *MMgt_TShared*. The coordinate is represented by a transformation *gp_Trsfpackage*. This transformation has no scaling factor.
@subsection occt_modat_5_2 Naming shapes, sub-shapes, their orientation and state
The **TopAbs** package provides general enumerations describing the basic concepts of topology and methods to handle these enumerations. It contains no classes. This package has been separated from the rest of the topology because the notions it contains are sufficiently general to be used by all topological tools. This avoids redefinition of enumerations by remaining independent of modeling resources. The TopAbs package defines three notions:
- Topological type (TopAbs_ShapeEnum)
- Orietation (TopAbs_Orientation)
- StateTopAbs_State)
- **Type** *TopAbs_ShapeEnum*;
- **Orientation** *TopAbs_Orientation* ;
- **State** *StateTopAbs_State*
@subsubsection occt_modat_5_2_1 Topological types
@@ -920,7 +1218,7 @@ Below is the auxiliary function, which copies the element of rank *i* from the m
@subsubsection occt_modat_5_5_1 Wire Explorer
BRepTools_WireExplorer class can access edges of a wire in their order of connection.
*BRepTools_WireExplorer* class can access edges of a wire in their order of connection.
For example, in the wire in the image we want to recuperate the edges in the order {e1, e2, e3,e4, e5} :
@@ -937,4 +1235,6 @@ For example, in the wire in the image we want to recuperate the edges in the ord
ProcessTheVertexConnectingTheCurrentEdgeToThePrevious
One(Ex.CurrentVertex());
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -145,7 +145,6 @@ Documents offer access to the data framework and manage the following items:
@subsubsection occt_ocaf_2_3_2 Shape attribute
The shape attribute implements the functionality of the OCCT topology manipulation:
* reference to the shapes
* tracking of shape evolution
@@ -164,6 +163,7 @@ Where the document manages the notification of changes, a function manages propa
@image html /user_guides/ocaf/images/ocaf_image008.png "Document structure"
@image latex /user_guides/ocaf/images/ocaf_image008.png "Document structure"
@section occt_ocaf_3 Data Framework Services
@subsection occt_ocaf_3_1 Overview
@@ -416,11 +416,11 @@ If you use a standard file format and you want your new attributes to be stored
If you use the XML format, do the following:
1. Create a new package with the name Xml[package name] (for example *XmlMyAttributePackage*) containing class *XmlMyAttributePackage_MyAttributeDriver*. The new class inherits *XmlMDF_ADriver* class and contains the translation functionality: from transient to persistent and vice versa (see the realization of the standard attributes in the packages *XmlMDataStd*, for example). Add package method AddDrivers which adds your class to a driver table (see below).
2. Create a new package (or do it in the current one) with two package methods:
* Factory, which loads the document storage and retrieval drivers; and
* AttributeDrivers, which calls the methods AddDrivers for all packages responsible for persistence of the document.
* *Factory*, which loads the document storage and retrieval drivers; and
* *AttributeDrivers*, which calls the methods AddDrivers for all packages responsible for persistence of the document.
3. Create a plug-in implemented as an executable (see example *XmlPlugin*). It calls a macro PLUGIN with the package name where you implemented the method Factory.
If you use the binary format, do the following:
1. Create a new package with name Bin[package name] (for example *BinMyAttributePackage*) containing a class *BinMyAttributePackage_MyAttributeDriver*. The new class inherits *BinMDF_ADriver* class and contains the translation functionality: from transient to persistent and vice versa (see the realization of the standard attributes in the packages *BinMDataStd*, for example). Add package method *AddDrivers*, which adds your class to a driver table (see below).
1. Create a new package with name <i> Bin[package name] </i> (for example *BinMyAttributePackage*) containing a class *BinMyAttributePackage_MyAttributeDriver*. The new class inherits *BinMDF_ADriver* class and contains the translation functionality: from transient to persistent and vice versa (see the realization of the standard attributes in the packages *BinMDataStd*, for example). Add package method *AddDrivers*, which adds your class to a driver table.
2. Create a new package (or do it in the current one) with two package methods:
* Factory, which loads the document storage and retrieval drivers; and
* AttributeDrivers, which calls the methods AddDrivers for all packages responsible for persistence of the document.
@@ -439,23 +439,23 @@ Lets study the implementation of the same data type in both ways by the examp
1. The first way: creation of a new attribute. The implementation of the transformation by creation of a new attribute is represented in the <a href="#occt_ocaf_11">Samples</a>.
2. The second way: creation of a new data type by means of combination of standard attributes. Depending on the type of transformation it may be kept in data framework by different standard attributes. For example, a translation is defined by two points. Therefore the data tree for translation looks like this:
* Type of transformation (gp_Translation) as TDataStd_Integer;
* First point as TDataStd_RealArray (three values: X1, Y1 and Z1);
* Second point as TDataStd_RealArray (three values: X2, Y2 and Z2).
* Type of transformation <i>(gp_Translation)</i> as *TDataStd_Integer*;
* First point as *TDataStd_RealArray* (three values: X1, Y1 and Z1);
* Second point as *TDataStd_RealArray* (three values: X2, Y2 and Z2).
@image html /user_guides/ocaf/images/ocaf_image010.png "Data tree for translation"
@image latex /user_guides/ocaf/images/ocaf_image010.png "Data tree for translation"
If the type of transformation is changed to rotation, the data tree looks like this:
* Type of transformation (gp_Rotation) as TDataStd_Integer;
* Point of axis of rotation as TDataStd_RealArray (three values: X, Y and Z);
* Axis of rotation as TDataStd_RealArray (three values: DX, DY and DZ);
* Angle of rotation as TDataStd_Real.
* Type of transformation <i>(gp_Rotation)</i> as *TDataStd_Integer*;
* Point of axis of rotation as *TDataStd_RealArray* (three values: X, Y and Z);
* Axis of rotation as *TDataStd_RealArray* (three values: DX, DY and DZ);
* Angle of rotation as *TDataStd_Real*.
@image html /user_guides/ocaf/images/ocaf_image011.png "Data tree for rotation"
@image latex /user_guides/ocaf/images/ocaf_image011.png "Data tree for rotation"
The attribute TDataStd_UAttribute with the chosen unique GUID identifies the data type. The interface class initialized by the label of this attribute allows access to the data container (type of transformation and the data of transformation according to the type).
The attribute *TDataStd_UAttribute* with the chosen unique GUID identifies the data type. The interface class initialized by the label of this attribute allows access to the data container (type of transformation and the data of transformation according to the type).
@section occt_ocaf_4_ Standard Document Services
@@ -464,7 +464,7 @@ The attribute TDataStd_UAttribute with the chosen unique GUID identifies the dat
Standard documents offer ready-to-use documents containing a TDF-based data framework. Each document can contain only one framework.
The documents themselves are contained in the instantiation of a class inheriting from TDocStd_Application. This application manages the creation, storage and retrieval of documents.
The documents themselves are contained in the instantiation of a class inheriting from *TDocStd_Application*. This application manages the creation, storage and retrieval of documents.
You can implement undo and redo in your document, and refer from the data framework of one document to that of another one. This is done by means of external link attributes, which store the path and the entry of external links.
@@ -577,21 +577,58 @@ setenv CSF_NewFormatDefaults MyApplicationPath/MyResources
Once these steps are taken you may run your application, create documents and Save/Open them. These resource files already exist in the OCAF (format "Standard").
If you use your specific attributes from packages, for example, P-, M- and TMyAttributePackage, see "Specific attribute creation" on page 20; you must take some additional steps for the new plugin implementation:
If you use your specific attributes from packages, for example, <i>P-, M-</i> and *TMyAttributePackage* (see @ref occt_ocaf_3_4_6 "Specific attribute creation") you must take some additional steps for the new plugin implementation:
1. Add our "P" package to the standard schema. You can get an already existing (in Open CASCADE Technology sources) schema from StdSchema unit and add your package string to the cdl-file: "package PMyAttributePackage".
2. Next step consists of implementation of an executable, which will connect our documents to our application and open/save them. Copy the package PAppStdPlugin and change its name to MyTheBestApplicationPlugin. In the PLUGIN macros type the name of your factory which will be defined in the next step.
3. Factory is a method, which returns drivers (standard drivers and our defined drivers from the "M" package) by a GUID. Copy the package where the standard factory is defined (it is PAppStd in the OCAF sources). Change its name to MyTheBestSchemaLocation. The Factory() method of the PappStd package checks the GUID set as its argument and returns the corresponding table of drivers. Set two new GUIDs for your determined storage and retrieval drivers. Append two "if" declarations inside the Factory() method which should check whether the set GUID coincides with GUIDs defined by the Factory() method as far as our storage and retrieval drivers are concerned. If the GUID coincides with one of them, the method should return a table of storage or retrieval drivers respectively.
4. Recompile all. Add the strings with GUIDs in accordance with your plugin library GUID - to the "Plugin" file.
1. Add our *P* package to the standard schema. You can get an already existing (in Open CASCADE Technology sources) schema from *StdSchema* unit and add your package string to the cdl-file: package *PMyAttributePackage*.
2. The next step consists in the implementation of an executable, which will connect our documents to our application and open/save them. Copy the package *PAppStdPlugin* and change its name to *MyTheBestApplicationPlugin*. In the *PLUGIN* macros type the name of your factory, which will be defined at the next step.
3. *Factory* is a method, which returns drivers (standard drivers and our defined drivers from the *M* package) by a GUID. Copy the package to the location, where the standard factory is defined (it is PAppStd in the OCAF sources). Change its name to *MyTheBestSchemaLocation*. The *Factory()* method of the *PappStd* package checks the GUID set as its argument and returns the corresponding table of drivers. Set two new GUIDs for your determined storage and retrieval drivers. Append two *if* declarations inside the *Factory()* method, which should check whether the set GUID coincides with GUIDs defined by the *Factory()* method as far as our storage and retrieval drivers are concerned. If the GUID coincides with one of them, the method should return a table of storage or retrieval drivers respectively.
4. Recompile all and add the strings with GUIDs to the *Plugin* file in accordance with your plugin library GUID.
@subsubsection occt_ocaf_4_3_4 Opening the document from a file
To open the document from a file where it has been previously saved, you use TDocStd_Application::Open as in the example below. The arguments are the path of the file and the document saved in this file.
To open the document from a file where it has been previously saved, you can use *TDocStd_Application::Open* as in the example below. The arguments are the path of the file and the document saved in this file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
app->Open("/tmp/example.caf", doc);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_ocaf_4_3_5 Cutting, copying and pasting inside a document
To cut, copy and paste inside a document, use the class *TDF_CopyLabel*.
In fact, you must define a *Label*, which contains the temporary value of a cut or
copy operation (say, in <i> Lab_Clipboard</i>). You must also define two other labels:
* The data container (e.g. <i> Lab_source</i>)
* The destination of the copy (e.g. <i> Lab_ Target</i> )
~~~~
Copy = copy (Lab_Source => Lab_Clipboard)
Cut = copy + Lab_Source.ForgetAll() // command clear the contents of LabelSource.
Paste = copy (Lab_Clipboard => Lab_target)
~~~~
So we need a tool to copy all (or a part) of the content of a label and its sub-label,
to another place defined by a label.
~~~~
TDF_CopyLabel aCopy;
TDF_IDFilter aFilter (Standard_False);
//Don't copy TDataStd_TreeNode attribute
aFilter.Ignore(TDataStd_TreeNode::GetDefaultTreeID());
aCopy.Load(aSource, aTarget); aCopy.UseFilter(aFilter); aCopy.Perform();
// copy the data structure to clipboard
return aCopy.IsDone(); }
~~~~
The filter is used to forbid copying a specified type of attribute.
You can also have a look at the class *TDF_Closure*, which can be useful to determine the dependencies of the part you want to cut from the document.
@subsection occt_ocaf_4_4 External Links
External links refer from one document to another. They allow you to update the copy of data framework later on.
@@ -605,7 +642,7 @@ Note that documents can be copied with or without a possibility of updating an e
#### With the possibility of updating it later
To copy a document with a possibility of updating it later, you use TDocStd_XLinkTool::CopyWithLink.
To copy a document with a possibility of updating it later, you use *TDocStd_XLinkTool::CopyWithLink*.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
Handle(TDocStd_Document) doc1;
@@ -620,7 +657,7 @@ XLinkTool.CopyWithLink(target,source);
Now the target document has a copy of the source document. The copy also has a link in order to update the content of the copy if the original changes.
In the example below, something has changed in the source document. As a result, you need to update the copy in the target document. This copy is passed to TDocStd_XLinkTool::UpdateLink as the argument *target*.
In the example below, something has changed in the source document. As a result, you need to update the copy in the target document. This copy is passed to *TDocStd_XLinkTool::UpdateLink* as the argument *target*.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
XLinkTool.UpdateLink(target);
@@ -628,7 +665,7 @@ XLinkTool.UpdateLink(target);
#### Without any link between the copy and the original
You can also create a copy of the document with no link between the original and the copy. The syntax to use this option is TDocStd_XLinkTool::Copy; the copied document is again represented by the argument *target*, and the original by *source.*
You can also create a copy of the document with no link between the original and the copy. The syntax to use this option is *TDocStd_XLinkTool::Copy*. The copied document is again represented by the argument *target*, and the original by *source.*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
XLinkTool.Copy(target, source);
@@ -639,24 +676,27 @@ XLinkTool.Copy(target, source);
@section occt_ocaf_5_ OCAF Shape Attributes
@subsection occt_ocaf_5_1 Overview
OCAF shape attributes are used for topology objects and their evolution access. All topological objects are stored in one TNaming_UsedShapes attribute at the root label of the data framework. This attribute contains a map with all topological shapes used in a given document.
A topological attribute can be seen as a hook into the topological structure. It is possible to attach data to define references to it.
The user can add the TNaming_NamedShape attribute to other labels. This attribute contains references (hooks) to shapes from the TNaming_UsedShapes attribute and an evolution of these shapes. The TNaming_NamedShape attribute contains a set of pairs of hooks: to the *Old* shape and to a *New* shape (see the following figure). It allows not only to get the topological shapes by the labels, but also to trace the evolution of the shapes and to correctly update dependent shapes by the changed one.
OCAF shape attributes are used for topology objects and their evolution access. All topological objects are stored in one *TNaming_UsedShapes* attribute at the root label of the data framework. This attribute contains a map with all topological shapes used in a given document.
The user can add the *TNaming_NamedShape* attribute to other labels. This attribute contains references (hooks) to shapes from the *TNaming_UsedShapes* attribute and an evolution of these shapes. The *TNaming_NamedShape* attribute contains a set of pairs of hooks: to the *Old* shape and to a *New* shape (see the following figure). It allows not only to get the topological shapes by the labels, but also to trace the evolution of the shapes and to correctly update dependent shapes by the changed one.
If a shape is newly created, then the old shape of a corresponding named shape is an empty shape. If a shape is deleted, then the new shape in this named shape is empty.
@image html /user_guides/ocaf/images/ocaf_image013.png
@image latex /user_guides/ocaf/images/ocaf_image013.png
### Shape attributes in data framework.
Different algorithms may dispose sub-shapes of the result shape at the individual labels depending on whether it is necessary to do so:
* If a sub-shape must have some extra attributes (material of each face or color of each edge). In this case a specific sub-shape is placed to a separate label (usually to a sub-label of the result shape label) with all attributes of this sub-shape.
* If the topological naming algorithm is needed, a necessary and sufficient set of sub-shapes is placed to child labels of the result shape label. As usual, for a basic solid and closed shells, all faces of the shape are disposed.
*TNaming_NamedShape* may contain a few pairs of hooks with the same evolution. In this case the topology shape, which belongs to the named shape is a compound of new shapes.
TNaming_NamedShape may contain a few pairs of hooks with the same evolution. In this case the topology shape, which belongs to the named shape is a compound of new shapes.
Consider the following example. Two boxes (solids) are fused into one solid (the result one). Initially each box was placed to the result label as a named shape, which has evolution PRIMITIVE and refers to the corresponding shape of the TNaming_UsedShapes map. The box result label has a material attribute and six child labels containing named shapes of Box faces.
Consider the following example. Two boxes (solids) are fused into one solid (the result one). Initially each box was placed to the result label as a named shape, which has evolution PRIMITIVE and refers to the corresponding shape of the *TNaming_UsedShapes* map. The box result label has a material attribute and six child labels containing named shapes of Box faces.
@image html /user_guides/ocaf/images/ocaf_image014.png "Resulting box"
@image latex /user_guides/ocaf/images/ocaf_image014.png "Resulting box"
@@ -670,8 +710,8 @@ Named shapes, which contain information about modified faces, belong to the fuse
This is necessary and sufficient information for the functionality of the right naming mechanism: any sub-shape of the result can be identified unambiguously by name type and set of labels, which contain named shapes:
* face F1 as a modification of F11 face
* face F1 as generation of F12 face
* face F1 as a modification of face F11
* face F1 as generation of face F12
* edges as an intersection of two contiguous faces
* vertices as an intersection of three contiguous faces
@@ -684,19 +724,18 @@ After any modification of source boxes the application must automatically rebuil
When using TNaming_NamedShape to create attributes, the following fields of an attribute are filled:
* A list of shapes called the "old" and the "new" shapes A new shape is recomputed as the value of the named shape. The meaning of this pair depends on the type of evolution.
* The type of evolution: a term of the TNaming_Evolution enumeration:
* PRIMITIVE newly created topology, with no previous history
* GENERATED as usual, this evolution of a named shape means, that the new shape is created from a low-level old shape ( a prism face from an edge, for example )
* MODIFY the new shape is a modified old shape
* DELETE the new shape is empty; the named shape with this evolution just indicates that the old shape topology is deleted from the model
* SELECTED a named shape with this evolution has no effect on the history of the topology; it is
used for the selected shapes that are placed to the separate label
* The type of evolution, which is a term of the *TNaming_Evolution* enumeration used for the selected shapes that are placed to the separate label:
* PRIMITIVE newly created topology, with no previous history;
* GENERATED as usual, this evolution of a named shape means, that the new shape is created from a low-level old shape ( a prism face from an edge, for example );
* MODIFY the new shape is a modified old shape;
* DELETE the new shape is empty; the named shape with this evolution just indicates that the old shape topology is deleted from the model;
* SELECTED a named shape with this evolution has no effect on the history of the topology.
Only pairs of shapes with equal evolution can be stored in one named shape.
@subsubsection occt_ocaf_5_2_2 Using naming resources
The class TNaming_Builder allows you to create a named shape attribute. It has a label of a future attribute as an argument of the constructor. Respective methods are used for the evolution and setting of shape pairs. If for the same TNaming_Builder object a lot of pairs of shapes with the same evolution are given, then these pairs would be placed in the resulting named shape. After the creation of a new object of the TNaming_Builder class, an empty named shape is created at the given label.
The class *TNaming_Builder* allows you to create a named shape attribute. It has a label of a future attribute as an argument of the constructor. Respective methods are used for the evolution and setting of shape pairs. If for the same TNaming_Builder object a lot of pairs of shapes with the same evolution are given, then these pairs would be placed in the resulting named shape. After the creation of a new object of the TNaming_Builder class, an empty named shape is created at the given label.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
// a new empty named shape is created at "label"
@@ -710,15 +749,14 @@ Handle(TNaming_NamedShape) ns = builder.NamedShape();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_ocaf_5_2_3 Reading the contents of a named shape attribute
You can use TNaming_NamedShape class to get evolution of this named shape (method TNaming_NamedShape::Evolution()) and "value" of the named shape compound of new shapes of all pairs of this named shape (method TNaming_NamedShape::Get()).
You can use the method <i>TNaming_NamedShape::Evolution()</i> to get the evolution of this named shape and the method <i>TNaming_NamedShape::Get()</i> to get a compound of new shapes of all pairs of this named shape.
More detailed information about the contents of the named shape or about the modification history of a topology can be obtained with the following:
* TNaming_Tool provides a common high-level functionality for access to the named shapes contents:
* GetShape(Handle(TNaming_NamedShape)) method returns a compound of new shapes of the given named shape
* CurrentShape(Handle(TNaming_NamedShape)) method returns a compound of the shapes last modifications ( latest versions ) of the shapes from the given named shape
* NamedShape(TopoDS_Shape,TDF_Label) method returns a named shape, which contains a given shape as a new shape. Given label is any label from the data framework it just gives access to it
* TNaming_Iterator given access to the named shape hooks pairs.
* *TNaming_Tool* provides a common high-level functionality for access to the named shapes contents:
* The method <i>GetShape(Handle(TNaming_NamedShape)) </i> returns a compound of new shapes of the given named shape;
* The method <i>CurrentShape(Handle(TNaming_NamedShape))</i> returns a compound of the shapes, which are latest versions of the shapes from the given named shape;
* The method <i>NamedShape(TopoDS_Shape,TDF_Label) </i> returns a named shape, which contains a given shape as a new shape. A given label is any label from the data framework it just gives access to it.
* *TNaming_Iterator* gives access to the named shape and hooks pairs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
// create an iterator for a named shape
@@ -739,7 +777,7 @@ iter.Next();
@subsubsection occt_ocaf_5_2_4 Selection Mechanism
One of user interfaces for topological naming resources is the TNaming_Selector class. You can use this class to:
One of user interfaces for topological naming resources is the *TNaming_Selector* class. You can use this class to:
* Store a selected shape on a label
* Access the named shape
@@ -747,13 +785,13 @@ One of user interfaces for topological naming resources is the TNaming_Selector
Selector places a new named shape with evolution SELECTED to the given label. By the given context shape (main shape, which contains a selected sub-shape), its evolution and naming structure the selector creates a "name" of the selected shape unique description how to find a selected topology.
After any modification of a context shape and updating of the corresponding naming structure, you must call the TNaming_Selector::Solve method. If the naming structure is right, then the selector automatically updates the selected shape in the corresponding named shape, else it fails.
After any modification of a context shape and updating of the corresponding naming structure, you must call the method *TNaming_Selector::Solve*. If the naming structure is correct, the selector automatically updates the selected shape in the corresponding named shape, else it fails.
@subsubsection occt_ocaf_5_2_5 Exploring shape evolution
The class TNaming_Tool provides a toolkit to read current data contained in the attribute.
The class *TNaming_Tool* provides a toolkit to read current data contained in the attribute.
If you need to create a topological attribute for existing data, use the method NamedShape.
If you need to create a topological attribute for existing data, use the method *NamedShape*.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
class MyPkg_MyClass
@@ -773,65 +811,62 @@ Standard_Boolean CafTest_MyClass::SameEdge (const Handle(CafTest_Line)& L1, cons
@subsection occt_ocaf_6_1 Overview
There are several ready-to-use attributes, which allow creating and modifying attributes for many basic data types. They are available in the packages TDataStd, TDataXtd and TDF. Each attribute belongs to one of four types:
Standard attributes are ready-to-use attributes, which allow creating and modifying attributes for many basic data types. They are available in the packages *TDataStd, TDataXtd* and *TDF*. Each attribute belongs to one of four types:
* Geometric attributes
* General attributes
* Relationship attributes
* Auxiliary attributes
* Geometric attributes;
* General attributes;
* Relationship attributes;
* Auxiliary attributes.
### Geometric attributes
* Axis simply identifies, that the concerned TNaming_NamedShape attribute with an axis shape inside belongs to the same label
* Constraint contains information about a constraint between geometries: used geometry attributes, type, value (if exists), plane (if exists), "is reversed", "is inverted" and "is verified" flags
* Geometry simply identifies, that the concerned TNaming_NamedShape attribute with a specified-type geometry belongs to the same label
* Plane simply identifies, that the concerned TNaming_NamedShape attribute with a plane shape inside belongs to the same label
* Point simply identifies, that the concerned TNaming_NamedShape attribute with a point shape inside belongs to the same label
* Shape simply identifies, that the concerned TNaming_NamedShape attribute belongs to the same label
* PatternStd identifies one of five available pattern models (linear, circular, rectangular, circular rectangular and mirror)
* Position identifies the position in 3d global space
* **Axis** simply identifies, that the concerned *TNaming_NamedShape* attribute with an axis shape inside belongs to the same label;
* **Constraint** contains information about a constraint between geometries: used geometry attributes, type, value (if exists), plane (if exists), "is reversed", "is inverted" and "is verified" flags;
* **Geometry** simply identifies, that the concerned *TNaming_NamedShape* attribute with a specified-type geometry belongs to the same label;
* **Plane** simply identifies, that the concerned *TNaming_NamedShape* attribute with a plane shape inside belongs to the same label;
* **Point** simply identifies, that the concerned *TNaming_NamedShape* attribute with a point shape inside belongs to the same label;
* **Shape** simply identifies, that the concerned *TNaming_NamedShape* attribute belongs to the same label;
* **PatternStd** identifies one of five available pattern models (linear, circular, rectangular, circular rectangular and mirror);
* **Position** identifies the position in 3d global space.
### General attributes
* AsciiString contains AsciiString value
* BooleanArray contains an array of Boolean
* BooleanList contains a list of Boolean
* ByteArray contains an array of Byte (unsigned char) values
* Comment contains a string some comment for a given label (or attribute)
* Expression contains an expression string and a list of used variables attributes
* ExtStringArray contains an array of ExtendedString values
* ExtStringList contains a list of ExtendedString values
* Integer contains an integer value
* IntegerArray contains an array of integer values
* IntegerList contains a list of integer values
* IntPackedMap contains a packed map of integers
* Name contains a string some name of a given label (or attribute)
* NamedData may contain up to 6 of the following named data sets (vocabularies): DataMapOfStringInteger, DataMapOfStringReal, DataMapOfStringString, DataMapOfStringByte, DataMapOfStringHArray1OfInteger, DataMapOfStringHArray1OfReal
* NoteBook contains a NoteBook object attribute
* Real contains a real value
* RealArray contains an array of real values
* RealList contains a list of real values
* Relation contains a relation string and a list of used variables attributes
* Tick defines a boolean attribute
* Variable simply identifies, that a variable belongs to this label; contains the "is constraint" flag and a string of used units ("mm", "m"...)
* UAttribute attribute with a user-defined GUID. As a rule, this attribute is used as a marker, which is independent of attributes at the same label (note, that attributes with the same GUIDs can not belong to the same label)
* **AsciiString** contains AsciiString value;
* **BooleanArray** contains an array of Boolean;
* **BooleanList** contains a list of Boolean;
* **ByteArray** contains an array of Byte (unsigned char) values;
* **Comment** contains a string some comment for a given label (or attribute);
* **Expression** contains an expression string and a list of used variables attributes;
* **ExtStringArray** contains an array of *ExtendedString* values;
* **ExtStringList** contains a list of *ExtendedString* values;
* **Integer** contains an integer value;
* **IntegerArray** contains an array of integer values;
* **IntegerList** contains a list of integer values;
* **IntPackedMap** contains a packed map of integers;
* **Name** contains a string some name of a given label (or attribute);
* **NamedData** may contain up to 6 of the following named data sets (vocabularies): *DataMapOfStringInteger, DataMapOfStringReal, DataMapOfStringString, DataMapOfStringByte, DataMapOfStringHArray1OfInteger* or *DataMapOfStringHArray1OfReal*;
* **NoteBook** contains a *NoteBook* object attribute;
* **Real** contains a real value;
* **RealArray** contains an array of real values;
* **RealList** contains a list of real values;
* **Relation** contains a relation string and a list of used variables attributes;
* **Tick** defines a boolean attribute;
* **Variable** simply identifies, that a variable belongs to this label; contains the flag *is constraint* and a string of used units ("mm", "m"...);
* **UAttribute** attribute with a user-defined GUID. As a rule, this attribute is used as a marker, which is independent of attributes at the same label (note, that attributes with the same GUIDs can not belong to the same label).
### Relationship attributes
* Reference contains reference to the label of its own data framework
* ReferenceArray contains an array of references
* ReferenceList contains a list of references
* TreeNode this attribute allows to create an internal tree in the data framework; this tree consists of nodes with the specified tree ID; each node contains references to the father, previous brother, next brother, first child nodes and tree ID.
* **Reference** contains reference to the label of its own data framework;
* **ReferenceArray** contains an array of references;
* **ReferenceList** contains a list of references;
* **TreeNode** this attribute allows to create an internal tree in the data framework; this tree consists of nodes with the specified tree ID; each node contains references to the father, previous brother, next brother, first child nodes and tree ID.
### Auxiliary attributes
* Directory hi-level tool attribute for sub-labels management
* TagSource this attribute is used for creation of new children: it stores the tag of the last-created child of the label and gives access to the new child label creation functionality.
* **Directory** high-level tool attribute for sub-labels management;
* **TagSource** this attribute is used for creation of new children: it stores the tag of the last-created child of the label and gives access to the new child label creation functionality.
All of these attributes inherit class TDF_Attribute, so, each attribute has its own GUID and standard methods for attribute creation, manipulation, getting access to the data framework.
All attributes inherit class *TDF_Attribute*, so, each attribute has its own GUID and standard methods for attribute creation, manipulation, getting access to the data framework.
@subsection occt_ocaf_6_2 Services common to all attributes
@@ -839,9 +874,15 @@ All of these attributes inherit class TDF_Attribute, so, each attribute has its
@subsubsection occt_ocaf_6_2_1 Accessing GUIDs
To access the GUID of an attribute, you can use two methods:
* Method *GetID* is the static method of a class. It returns the GUID of any attribute, which is an object of a specified class (for example, TDataStd_Integer returns the GUID of an integer attribute). Only two classes from the list of standard attributes do not support these methods: TDataStd_TreeNode and TDataStd_Uattribute, because the GUIDs of these attributes are variable.
* Method *GetID* is the static method of a class. It returns the GUID of any attribute, which is an object of a specified class (for example, *TDataStd_Integer* returns the GUID of an integer attribute). Only two classes from the list of standard attributes do not support these methods: *TDataStd_TreeNode* and *TDataStd_Uattribute*, because the GUIDs of these attributes are variable.
* Method *ID* is the method of an object of an attribute class. It returns the GUID of this attribute. Absolutely all attributes have this method: only by this identifier you can discern the type of an attribute.
To find an attribute attached to a specific label, you use the GUID of the attribute type you are looking for. This information can be found using the method <i> GetID</i> and the method <i> Find</i> for the label as follows:
~~~~
Standard_GUID anID = MyAttributeClass::GetID();
Standard_Boolean HasAttribute = aLabel.Find(anID,anAttribute);
~~~~
@subsubsection occt_ocaf_6_2_2 Conventional Interface of Standard Attributes
@@ -855,15 +896,15 @@ It is usual to create standard named methods for the attributes:
@subsection occt_ocaf_7_1 Overview
Standard visualization attributes implement the Application Interactive Services (see Open CASCADE Technology Visualization Users Guide) in the context of Open CASCADE Technology Application Framework. Standard visualization attributes are AISViewer and Presentation and belong to the TPrsStd package.
Standard visualization attributes implement the Application Interactive Services (see @ref occt_user_guides__visualization "Visualization User's Guide"). in the context of Open CASCADE Technology Application Framework. Standard visualization attributes are AISViewer and Presentation and belong to the TPrsStd package.
@subsection occt_ocaf_7_2 Services provided
@subsubsection occt_ocaf_7_2_1 Defining an interactive viewer attribute
The class TPrsStd_AISViewer allows you to define an interactive viewer attribute. There may be only one such attribute per one data framework and it is always placed to the root label. So, it could be set or found by any label ("access label") of the data framework. Nevertheless the default architecture can be easily extended and the user can manage several Viewers per one framework by himself.
The class *TPrsStd_AISViewer* allows you to define an interactive viewer attribute. There may be only one such attribute per one data framework and it is always placed to the root label. So, it could be set or found by any label ("access label") of the data framework. Nevertheless the default architecture can be easily extended and the user can manage several Viewers per one framework by himself.
To initialize the AIS viewer as in the example below, use method Find.
To initialize the AIS viewer as in the example below, use method *Find*.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
// "access" is any label of the data framework
@@ -872,13 +913,13 @@ Handle(TPrsStd_AISViewer) viewer = TPrsStd_AISViewer::Find(access)
@subsection occt_ocaf_7_2_2 Defining a presentation attribute
The class TPrsStd_AISPresentation allows you to define the visual presentation of document labels contents. In addition to various visual fields (color, material, transparency, "isDisplayed", etc.), this attribute contains its driver GUID. This GUID defines the functionality, which will update the presentation every time when needed.
The class *TPrsStd_AISPresentation* allows you to define the visual presentation of document labels contents. In addition to various visual fields (color, material, transparency, *isDisplayed*, etc.), this attribute contains its driver GUID. This GUID defines the functionality, which will update the presentation every time when needed.
@subsubsection occt_ocaf_7_2_3 Creating your own driver
The abstract class TPrsStd_Driver allows you to define your own driver classes. Simply redefine the Update method in your new class, which will rebuild the presentation.
If your driver is placed to the driver table with the unique driver GUID, then every time the viewer updates presentations with a GUID identical to your drivers GUID, the Update method of your driver for these presentations must be called:
If your driver is placed to the driver table with the unique driver GUID, then every time the viewer updates presentations with a GUID identical to your drivers GUID, the *Update* method of your driver for these presentations must be called:
@image html /user_guides/ocaf/images/ocaf_image016.png
@image latex /user_guides/ocaf/images/ocaf_image016.png
@@ -886,9 +927,9 @@ As usual, the GUID of a driver and the GUID of a displayed attribute are the sam
@subsubsection occt_ocaf_7_2_4 Using a container for drivers
You frequently need a container for different presentation drivers. The class TPrsStd_DriverTable provides this service. You can add a driver to the table, see if one is successfully added, and fill it with standard drivers.
You frequently need a container for different presentation drivers. The class *TPrsStd_DriverTable* provides this service. You can add a driver to the table, see if one is successfully added, and fill it with standard drivers.
To fill a driver table with standard drivers, first initialize the AIS viewer as in the example above, and then pass the return value of the method InitStandardDrivers to the driver table returned by the method Get. Then attach a TNaming_NamedShape to a label and set the named shape in the presentation attribute using the method Set. Then attach the presentation attribute to the named shape attribute, and the AIS_InteractiveObject, which the presentation attribute contains, will initialize its drivers for the named shape. This can be seen in the example below.
To fill a driver table with standard drivers, first initialize the AIS viewer as in the example above, and then pass the return value of the method *InitStandardDrivers* to the driver table returned by the method *Get*. Then attach a *TNaming_NamedShape* to a label and set the named shape in the presentation attribute using the method *Set*. Then attach the presentation attribute to the named shape attribute, and the *AIS_InteractiveObject*, which the presentation attribute contains, will initialize its drivers for the named shape. This can be seen in the example below.
**Example**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
@@ -906,21 +947,23 @@ When you edit any application model, you have to regenerate the model by propaga
Take, for example, the case of a modeling sequence made up of a box with the application of a fillet on one of its edges. If you change the height of the box, the fillet will need to be regenerated as well.
See the white paper @ref occt_user_guides__ocaf_functionmechanism_wp "Application Framework Function Mechanism" for more information.
@subsection occt_ocaf_8_1 Finding functions, their owners and roots
The class TFunction_Function is an attribute, which stores a link to a function driver in the data framework. In the static table TFunction_DriverTable correspondence links between function attributes and drivers are stored.
The class *TFunction_Function* is an attribute, which stores a link to a function driver in the data framework. In the static table *TFunction_DriverTable* correspondence links between function attributes and drivers are stored.
You can write your function attribute, a driver for such attribute (which updates the function result in accordance to a given map of changed labels), and set your driver with the GUID to the driver table.
You can write your function attribute, a driver for such attribute, which updates the function result in accordance to a given map of changed labels, and set your driver with the GUID to the driver table.
Then the solver algorithm of a data model can find the Function attribute on a corresponding label and call the Execute driver method to update the result of the function.
Then the solver algorithm of a data model can find the *Function* attribute on a corresponding label and call the *Execute* driver method to update the result of the function.
@subsection occt_ocaf_8_2 Storing and accessing information about function status
For updating algorithm optimization, each function driver has access to the TFunction_Logbook object that is a container for a set of touched, impacted and valid labels. Using this object a driver gets to know which arguments of the function were modified.
For updating algorithm optimization, each function driver has access to the *TFunction_Logbook* object that is a container for a set of touched, impacted and valid labels. Using this object a driver gets to know which arguments of the function were modified.
@subsection occt_ocaf_8_3 Propagating modifications
An application must implement its functions, function drivers and the common solver for parametric model creation. For example, check the following model (see the following illustration):
An application must implement its functions, function drivers and the common solver for parametric model creation. For example, check the following model:
@image html /user_guides/ocaf/images/ocaf_image017.png
@image latex /user_guides/ocaf/images/ocaf_image017.png
@@ -948,29 +991,29 @@ Writing and reading XML files in OCCT is provided by LDOM package, which constit
of XML OCAF persistence, which is the optional component provided on top of Open CASCADE Technology.
The Light DOM (LDOM) package contains classes maintaining a data structure whose main principles conform to W3C DOM Level 1 Recommendations. The purpose of these classes as required by XML OCAF persistence schema is to:
* Maintain a tree structure of objects in memory representing the XML document. The root of the structure is an object of the LDOM_Document type. This object contains all the data corresponding to a given XML document and contains one object of the LDOM_Element type named "document element". The document element contains other LDOM_Element objects forming a tree. Other types of nodes (LDOM_Attr, LDOM_Text, LDOM_Comment, LDOM_CDATASection) represent the corresponding XML types and serve as branches of the tree of elements.
* Provide class LDOM_Parser to read XML files and convert them to LDOM_Document objects.
* Provide class LDOM_XmlWriter to convert LDOM_Document to a character stream in XML format and store it in file.
* Maintain a tree structure of objects in memory representing the XML document. The root of the structure is an object of the *LDOM_Document* type. This object contains all the data corresponding to a given XML document and contains one object of the *LDOM_Element* type named "document element". The document element contains other *LDOM_Element* objects forming a tree. Other types of nodes: *LDOM_Attr, LDOM_Text, LDOM_Comment* and *LDOM_CDATASection* - represent the corresponding XML types and serve as branches of the tree of elements.
* Provide class *LDOM_Parser* to read XML files and convert them to *LDOM_Document* objects.
* Provide class *LDOM_XmlWriter* to convert *LDOM_Document* to a character stream in XML format and store it in file.
This package covers the functionality provided by numerous products known as "DOM parsers". Unlike most of them, LDOM was specifically developed to meet the following requirements:
* To minimize the virtual memory allocated by DOM data structures. In average, the amount of memory of LDOM is the same as the XML file size (UTF-8).
* To minimize the time required for parsing and formatting XML, as well as for access to DOM data structures.
Both these requirements are important when XML files are processed by applications if these files are relatively large (occupying megabytes and even hundreds of megabytes). To meet the requirements, some limitations were imposed on the DOM Level 1 specification; these limitations are insignificant in applications like OCAF. Some of these limitations can be overridden in the course of future developments. The main limitations are:
* No Unicode support as well as various other encodings; only ASCII strings are used in DOM/XML. Note: There is a data type TCollection_ExtendedString for wide character data. This type is supported by LDOM_String as a sequence of numbers.
* Some superfluous methods are deleted: getPreviousSibling, getParentNode, etc.
* No Unicode support as well as various other encodings; only ASCII strings are used in DOM/XML. Note: There is a data type *TCollection_ExtendedString* for wide character data. This type is supported by *LDOM_String* as a sequence of numbers.
* Some superfluous methods are deleted: *getPreviousSibling, getParentNode,* etc.
* No resolution of XML Entities of any kind
* No support for DTD: the parser just checks for observance of general XML rules and never validates documents.
* Only 5 available types of DOM nodes: LDOM_Element, LDOM_Attr, LDOM_Text, LDOM_Comment, LDOM_CDATASection.
* Only 5 available types of DOM nodes: *LDOM_Element, LDOM_Attr, LDOM_Text, LDOM_Comment* and *LDOM_CDATASection*.
* No support of Namespaces; prefixed names are used instead of qualified names.
* No support of the interface DOMException (no exception when attempting to remove a non-existing node).
* No support of the interface *DOMException* (no exception when attempting to remove a non-existing node).
LDOM is dependent on Kernel OCCT classes only. Therefore, it can be used outside OCAF persistence in various algorithms where DOM/XML support may be required.
@subsection occt_ocaf_9_1 Document Drivers
The drivers for document storage and retrieval manage conversion between a transient OCAF
Document in memory and its persistent reflection in a container (disk, memory, network ...). For XML Persistence, they are defined in the package XmlDrivers.
Document in memory and its persistent reflection in a container (disk, memory, network). For XML Persistence, they are defined in the package XmlDrivers.
The main methods (entry points) of these drivers are:
* *Write()* - for a storage driver;
@@ -1089,15 +1132,14 @@ Both the XML format and the XML OCAF persistence code are extensible in the sens
* **Child** - a label created from another label, which by definition, is the father label.
* **Compound document** - a set of interdependent documents, linked to each other by means of external references. These references provide the associativity of data.
* **Data framework** - a tree-like data structure which in OCAF, is a tree of labels with data attached to them in the form of attributes. This tree of labels is accessible through the services of the *TDocStd_Document* class.
* *Document* - a container for a data framework which grants access to the data, and is, in its turn, contained by an application. A document also allows you to:
* **Document** - a container for a data framework which grants access to the data, and is, in its turn, contained by an application. A document also allows you to:
* Manage modifications, providing Undo and Redo functions
* Manage command transactions
* Update external links
* Manage save and restore options
* Store the names of software extensions.
* **Driver** - an abstract class, which defines the communications protocol with a system.
* **Entry** - an ASCII character string containing the tag list of a label.
* **Entry** - an ASCII character string containing the tag list of a label. For example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
0:3:24:7:2:7
@@ -1113,7 +1155,7 @@ To store these references properly, a label must also contain an external link a
In C++, the application behavior is implemented in virtual functions redefined in these derived classes. This is known as overriding.
* **GUID** - Global Universal ID. A string of 37 characters intended to uniquely identify an object.
* **GUID** - Global Universal ID. A string of 37 characters intended to uniquely identify an object. For example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
2a96b602-ec8b-11d0-bee7-080009dc3333

View File

@@ -25,6 +25,15 @@ OCAF White-Paper {#occt_user_guides__ocaf_wp}
By providing architectural guidance and ready-to-use solutions to these issues,
OCAF helps you to develop your application significantly faster: you concentrate on the application's functionality.
As you use the architecture provided by OCAF, the design of your application is made easy: as the application developer you can concentrate on the functionality instead of the underlying mechanisms required to support it.
Also, thanks to the coupling with the other Open CASCADE Technology modules,
your application can rapidly be prototyped. In addition, the final application
can be developed by industrializing the prototype — you don't need to restart the development from scratch.
Last but not least, you base your application on an Open Source component:
this guarantees the long-term usefulness of your development.
@subsection ocaf_wp_1_2 Overview of the Architecture
@@ -73,7 +82,7 @@ OCAF uses other modules of Open CASCADE Technology — the Shape attribute is im
If you need application specific data not provided with OCAF, for example,
to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh,
and you include its persistent homolog in a new file format.
and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure
according to your specification, OCAF provides you, without any additional programming:
@@ -91,19 +100,99 @@ OCAF uses other modules of Open CASCADE Technology — the Shape attribute is im
You can also implement the user interface in the Java language using
the Swing-based Java Application Desktop component (JAD) provided with OCAF.
@subsection ocaf_wp_1_4 Benefits of OCAF
@subsection ocaf_wp_1_4 An example of OCAF usage
As you use the architecture provided by OCAF, the design of your application is made easy:
the application developer concentrates on the functionality
instead of the underlying mechanisms required to support this functionality.
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i> Formats</i> and <i> ResourcesName</i>
In the <i> Formats </i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
For example:
~~~~
void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
{
Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));
}
~~~~
In the <i> ResourcesName</i> method, you only define the name of the resource file. This
file contains several definitions for the saving and opening mechanisms associated
with each format and calling of the plug-in file.
~~~~
Standard_CString myApplication::ResourcesName()
{
return Standard_CString ("Resources");
}
~~~~
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i> CSF_PluginDefaults</i>, which defines the path of the plug-in file, and <i> CSF_ResourcesDefault</i>, which defines the resource file:
~~~~
SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory);
SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory);
~~~~
The plugin and the resource files of the application will be located in <i> myDirector</i>.
The name of the plugin file must be <i>Plugin</i>.
### Resource File
The resource file describes the documents (type and extension) and
the type of data that the application can manipulate
by identifying the storage and retrieval drivers appropriate for this data.
Each driver is unique and identified by a GUID generated, for example, with the <i> uuidgen </i> tool in Windows.
Five drivers are required to use all standard attributes provided within OCAF:
* the schema driver (ad696002-5b34-11d1-b5ba-00a0c9064368)
* the document storage driver (ad696000-5b34-11d1-b5ba-00a0c9064368)
* the document retrieval driver (ad696001-5b34-11d1-b5ba-00a0c9064368)
* the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368)
* the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368)
These drivers are provided as plug-ins and are located in the <i> PappStdPlugin</i> library.
For example, this is a resource file, which declares a new model document OCAF-MyApplication:
~~~~
formatlist:OCAF-MyApplication
OCAF-MyApplication.Description: MyApplication Document Version 1.0
OCAF-MyApplication.FileExtension: sta
OCAF-MyApplication.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
OCAF-MyApplication.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368
OCAF-MyApplicationSchema: ad696002-5b34-11d1-b5ba-00a0c9064368
OCAF-MyApplication.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368
OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368
~~~~
Also, thanks to the coupling with the other Open CASCADE Technology modules,
your application can rapidly be prototyped. In addition, the final application
can be developed by industrializing the prototype — you don't need to restart the development from scratch.
Last but not least, you base your application on an Open Source component:
this guarantees the long-term usefulness of your development.
### Plugin File
The plugin file describes the list of required plug-ins to run the application and the
libraries in which plug-ins are located.
You need at least the <i> FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
The syntax of each item is <i> Identification.Location Library_Name, </i> where:
* Identification is GUID.
* Location defines the location of the Identification (where its definition is found).
* Library_Name is the name (and path to) the library, where the plug-in is located.
For example, this is a Plugin file:
~~~~
a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin
! base document drivers plugin
ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
~~~~
@section ocaf_wp_2 A Look Inside OCAF
@@ -290,27 +379,17 @@ OCAF uses other modules of Open CASCADE Technology — the Shape attribute is im
@subsection ocaf_wp_2_3 Persistent Data Storage
In OCAF, persistence, that is, the mechanism used to save a document in a file,
is based on an explicit formal description of the data saved.
@subsubsection ocaf_wp_2_3_1 Introduction
In OCAF, persistence, that is, the mechanism used to save a document in a file, is based on an explicit formal description of the data saved.
When you open a document, the application reads the corresponding file
and first creates a memory representation of it.
This representation is then converted to the application data model —
the OCAF-based data structure the application operates on.
The file's memory representation consists of objects defined by classes known as persistent.
The persistent classes needed by an application to save its documents make the application's data schema.
This schema defines the way the data are organized in the file — the format of the data.
In other words, the file is simply an ASCII dump of the persistent data defined by the schema,
the persistent data being created from the application data model during the save process.
Only canonical information is saved. As a matter of fact,
the application data model usually contains additional data to optimize processing.
For example, the persistent Bézier curve is defined by its poles, whereas
its data model equivalent also contains coefficients used to compute a point at a given parameter.
The additional data is calculated when the document is opened.
The major advantages of this approach are the following:
When you open a document, the application reads the corresponding file and first creates a memory representation of it. This representation is then converted to the application data model — the OCAF-based data structure the application operates on. The file's memory representation consists of objects defined by classes known as persistent.
The persistent classes needed by an application to save its documents make the application's data schema. This schema defines the way the data are organized in the file — the format of the data. In other words, the file is simply an ASCII dump of the persistent data defined by the schema, the persistent data being created from the application data model during the save process.
Only canonical information is saved. As a matter of fact, the application data model usually contains additional data to optimize processing. For example, the persistent Bézier curve is defined by its poles, whereas its data model equivalent also contains coefficients used to compute a point at a given parameter. The additional data is calculated when the document is opened.
The major advantages of this approach are the following:
* Providing that the data format is published, files created by OCAF-based applications
can be read without needing a runtime of the application (openness)
* Although the persistence approach makes the data format more stable,
@@ -329,4 +408,214 @@ Applications using compound documents extensively (saving data in many files lin
In order to ease the delegation of document management to a data management application, OCAF encapsulates the file management functions in a driver (the meta-data driver). You have to implement this driver for your application to communicate with the data management system of your choice.
@subsubsection ocaf_wp_2_3_2 Schemes of Persistence
There are three schemes of persistence, which you can use to store and retrieve OCAF data (documents):
* <i> Standard</i> persistence schema, compatible with previous OCAF applications
* <i> XmlOcaf</i> persistence, allowing the storage of all OCAF data in XML form
* <i> BinOcaf</i> persistence, allowing the storage of all OCAF data in binary format form
All schemes are independent of each other, but they guarantee that the standard OCAF
attributes stored and retrieved by one schema will be storable and retrievable by
the other. Therefore in any OCAF application you can use any persistence schema or
even all three of them. The choice is made depending on the *Format* string of stored OCAF documents
or automatically by the file header data - on retrieval.
Persistent data storage in OCAF using the <i> Standard</i> package is presented in:
* Basic Data Storage
* Persistent Collections
Persistent storage of shapes is presented in the following chapters:
* Persistent Geometry
* Persistent Topology
Finally, information about opening and saving persistent data is presented in Standard
Documents.
@subsubsection ocaf_wp_2_3_3 Basic Data Storage
Normally, all data structures provided by Open CASCADE Technology are run-time structures,
in other words, transient data. As transient data, they exist only while an application
is running and are not stored permanently. However, the Data Storage module provides
resources, which enable an application to store data on disk as persistent data.
Data storage services also provide libraries of persistent classes and translation
functions needed to translate data from transient to persistent state and vice-versa.
#### Libraries of persistent classes
Libraries of persistent classes are extensible libraries of elementary classes you
use to define the database schema of your application. They include:
* Unicode (8-bit or 16-bit character type) strings
* Collections of any kind of persistent data such as arrays.
All persistent classes are derived from the \b Persistent base class, which defines
a unique way of creating and handling persistent objects. You create new persistent
classes by inheriting from this base class.
#### Translation Functions
Translation functions allow you to convert persistent objects to transient ones and
vice-versa. These translation functions are used to build Storage and Retrieval drivers
of an application.
For each class of 2D and 3D geometric types, and for the general shape class in the
topological data structure library, there are corresponding persistent class libraries,
which allow you to translate your data with ease.
#### Creation of Persistent Classes
If you use Unix platforms as well as WOK and CDL, you can create your own persistent
classes. In this case, data storage is achieved by implementing *Storage* and *Retrieval*
drivers.
The <i> Storage </i> package is used to write and read persistent objects.
These objects are read and written by a retrieval or storage algorithm
(<i> Storage_Schema </i>object) in a container (disk, memory, network ...).
Drivers (<i> FSD_File</i> objects) assign a physical container for data to be stored or retrieved.
The standard procedure for an application in reading a container is as follows:
* open the driver in reading mode,
* call the Read function from the schema, setting the driver as a parameter. This function returns an instance of the <i> Storage_Data </i> class which contains the data being read,
* close the driver.
The standard procedure for an application in writing a container is as follows:
* open the driver in writing mode,
* create an instance of the <i> Storage_Data </i> class, then add the persistent data to write with the function <i> AddRoot</i>,
* call the function <i> Write </i> from the schema, setting the driver and the <i> Storage_Data </i> instance as parameters,
* close the driver.
@subsubsection ocaf_wp_2_3_4 Persistent Collections
Persistent collections are classes which handle dynamically sized collections of data that can be stored in the database. These collections provide three categories of service:
* persistent strings,
* generic arrays of data,
* commonly used instantiations of arrays.
Persistent strings are concrete classes that handle sequences of characters based
on both ASCII (normal 8-bit) and Unicode (16-bit) character sets.
Arrays are generic classes, that is, they can hold a variety of objects not necessarily inheriting from a unique root class. These arrays can be instantiated with any kind of storable or persistent object, and then inserted into the persistent data model of a user application.
The purpose of these data collections is simply to convert transient data into its persistent equivalent so that it can be stored in the database. To this end, the collections are used to create the persistent data model and assure the link with the database. They do not provide editing or query capabilities because it is more efficient, within the operative data model of the application, to work with transient data structures (from the <i> TCollection</i> package).
For this reason:
* the persistent strings only provide constructors and functions to convert between transient and persistent strings, and
* the persistent data collections are limited to arrays. In other words, <i> PCollection</i> does not include sequences, lists, and so on (unlike <i> TCollection</i>).
Persistent string and array classes are found in the <i> PCollection</i> package. In addition, <i> PColStd</i> package provides standard, and frequently used, instantiations of persistent arrays, for very simple objects.
@subsubsection ocaf_wp_2_3_5 Persistent Geometry
The Persistent Geometry component describes geometric data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world".
Persistent Geometry consists of a set of atomic data models parallel to the geometric data structures described in the geometry packages. Geometric data models, independent of each other, can appear within the data model of any application. The system provides the means to convert each atomic transient data model into a persistent one, but it does not provide a way for these data models to share data.
Consequently, you can create a data model using these components, store data in, and retrieve it from a file or a database, using the geometric components provided in the transient and persistent "worlds". In other words, you customize the system by declaring your own objects, and the conversion of the geometric components from persistent to transient and vice versa is automatically managed for you by the system.
However, these simple objects cannot be shared within a more complex data model. To allow data to be shared, you must provide additional tools.
Persistent Geometry is provided by several packages.
The <i> PGeom</i> package describes geometric persistent objects in 3D space, such as points,
vectors, positioning systems, curves and surfaces.
These objects are persistent versions of those provided by the <i> Geom</i> package: for
each type of transient object provided by Geom there is a corresponding type of persistent
object in the <i>PGeom</i> package. In particular the inheritance structure is parallel.
However the <i> PGeom </i>package does not provide any functions to construct, edit or access
the persistent objects. Instead the objects are manipulated as follows:
* Persistent objects are constructed by converting the equivalent transient <i> Geom </i> objects. To do this you use the <i>MgtGeom::Translate</i> function.
* Persistent objects created in this way are used to build persistent data structures that are then stored in a file or database.
* When these objects are retrieved from the file or database, they are converted back into the corresponding transient objects from the Geom package. To do this, you use <i>MgtGeom::Translate</i> function.
In other words, you always edit or query transient data structures within the transient
data model supplied by the session.
Consequently, the documentation for the <i> PGeom </i> package consists simply of a list of available objects.
The <i> PGeom2d </i> package describes persistent geometric objects in 2D space, such as points,
vectors, positioning systems and curves. This package provides the same type of services
as the <i> PGeom</i> package, but for the 2D geometric objects provided by the <i> Geom2d</i> package.
Conversions are provided by the <i>MgtGeom::Translate</i> function.
~~~~
//Create a coordinate system
Handle(Geom_Axis2Placement) aSys;
//Create a persistent coordinate PTopoDS_HShape.cdlsystem
Handle(PGeom_Axis2placement)
aPSys = MgtGeom::Translate(aSys);
//Restore a transient coordinate system
Handle(PGeom_Axis2Placement) aPSys;
Handle(Geom_Axis2Placement)
aSys = MgtGeom::Translate(aPSys);
~~~~
@subsubsection ocaf_wp_2_3_6 Persistent Topology
The Persistent Topology component describes topological data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world".
Persistent Topology is based on the BRep concrete data model provided by the topology packages. Unlike the components of the Persistent Geometry package, topological components can be fully shared within a single model, as well as between several models.
Each topological component is considered to be a shape: a <i> TopoDS_Shape</i> object. The system's capacity to convert a transient shape into a persistent shape and vice-versa applies to all objects, irrespective of their complexity: vertex, edge, wire, face, shell, solid, and so on.
When a user creates a data model using BRep shapes, he uses the conversion functions that the system provides to store the data in, and retrieve it from the database. The data can also be shared.
Persistent Topology is provided by several packages.
The <i> PTopoDS</i> package describes the persistent data model associated with any BRep shape; it is the persistent version of any shape of type <i> TopoDS_Shape</i>. As is the case for persistent geometric models, this data structure is never edited or queried, it is simply stored in or retrieved from the database. It is created or converted by the <i>MgtBRep::Translate</i> function.
The <i> MgtBRepAbs</i> and <i> PTColStd </i> packages provide tools used by the conversion functions of topological objects.
~~~~
//Create a shape
TopoDS_Shape aShape;
//Create a persistent shape
PtColStd_DoubleTransientPersistentMap aMap;
Handle(PTopoDS_HShape) aPShape =
aMap.Bind2(MgtBRep::Translate
aShape,aMap,MgtBRepAbs_WithTriangle));
aPShape.Nullify();
//Restore a transient shape
Handle(PTopoDS_HShape) aPShape;
Handle(TopoDS_HShape) aShape =
aMap.Bind1(MgtBRep::Translate
(aPShape,aMap,MgtBRepAbs_WithTriangle));
aShape.Nullify();
~~~~
@subsubsection ocaf_wp_2_3_7 Standard Documents
Standard documents offer you a ready-to-use document containing a TDF-based data
structure. The documents themselves are contained in a class inheriting from <i> TDocStd_Application</i>
which manages creation, storage and retrieval of documents.
You can implement undo and redo in your document, and refer from the data framework
of one document to that of another one. This is done by means of external link attributes,
which store the path and the entry of external links. To sum up, standard documents
alone provide access to the data framework. They also allow you to:
* Update external links;
* Manage the saving and opening of data;
* Manage undo/redo functionality.

View File

@@ -5,9 +5,35 @@ Shape Healing {#occt_user_guides__shape_healing}
@section occt_shg_1 Overview
@subsection occt_shg_1_1 Introduction
This manual explains how to use Shape Healing. It provides basic documentation on its operation. For advanced information on Shape Healing and its applications, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
The **Shape Healing** toolkit provides a set of tools to work on the geometry and topology of Open CASCADE Technology (**OCCT**) shapes. Shape Healing adapts shapes so as to make them as appropriate for use by Open CASCADE Technology as possible.
@subsection occt_shg_1_2 Examples of use
Here are a few examples of typical problems with illustrations of how Shape Healing deals with them:
#### Face with missing seam edge
The problem: Face on a periodical surface is limited by wires which make a full trip around the surface. These wires are closed in 3d but not closed in parametric space of the surface. This is not valid in Open CASCADE.
The solution: Shape Healing fixes this face by inserting seam edge which combines two open wires and thus closes the parametric space. Note that internal wires are processed correctly.
#### Wrong orientation of wires
The problem: Wires on face have incorrect orientation, so that interior and outer parts of the face are mixed.
The solution: Shape Healing recovers correct orientation of wires.
#### Self-intersecting wire
The problem: Face is invalid because its boundary wire has self-intersection (on two adjacent edges)
The solution: Shape Healing cuts intersecting edges at intersection points thus making boundary valid.
#### Lacking edge
The problem: There is a gap between two edges in the wire, so that wire is not closed
The solution: Shape Healing closes a gap by inserting lacking edge.
@subsection occt_shg_1_3 Toolkit Structure
**Shape Healing** currently includes several packages that are designed to help you to:
* analyze shape characteristics and, in particular, identify shapes that do not comply with Open CASCADE Technology validity rules
* fix some of the problems shapes may have
@@ -28,7 +54,7 @@ Message management is used for creating messages, filling them with various para
Tools responsible for analysis, fixing and upgrading of shapes can give the information about how these operations were performed. This information can be obtained by the user with the help of mechanism of status querying.
@subsection occt_shg_1_1 Querying the statuses
@subsection occt_shg_1_4 Querying the statuses
Each fixing and upgrading tool has its own status, which is reset when their methods are called. The status can contain several flags, which give the information about how the method was performed. For exploring the statuses, a set of methods named *Status...()* is provided. These methods accept enumeration *ShapeExtend_Status* and return True if the status has the corresponding flag set. The meaning of flags for each method is described below.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -3,16 +3,70 @@ STEP processor {#occt_user_guides__step}
@tableofcontents
@section occt_step_1 Overview
@section occt_step_1 Introduction
This manual is intended to provide technical documentation on the Open CASCADE Technology (**OCCT**) STEP processor and to help Open CASCADE Technology users with the use of the STEP processor (to read and write STEP files). STEP files conforming to AP 214, AP 203 and partially AP 209 can be read. STEP files that are produced by this interface conform to STEP AP 214 or AP 203, according to the user option.
STEP is more and more widely used to exchange data between various software, involved in CAD, PDM, Analysis, etc... STEP is far more than an "exchange standard" : it provides a technology and a set of methodologies to describe the data to exchange in a modular and upgradeable way. Regarding OCCT, this mostly applies to CAD data but it is not a limitation, other kinds of data for specific applications can be addressed too.
@figure{/user_guides/step/images/step_image002.png, "Image imported from STEP"}
Open Cascade allows its users to employ STEP in the following domains:
* Exchange of data for technical applications, following the state-of-the-art definitions and rules;
* Extension of case coverage, according to specific needs or to the evolution of general business uses;
* Expertise in data architecture of an application, to get experience from STEP definitions and make easier the mapping to them, for a better interoperability with outer world.
This manual is intended to provide technical documentation on the Open CASCADE Technology (**OCCT**) STEP processor and to help Open CASCADE Technology users with the use of the STEP processor (to read and write STEP files).
Only geometrical, topological STEP entities (shapes) and assembly structures are translated by the basic translator described in sections 2 to 6. Data that cannot be translated on this level are also loaded from a STEP file and can be translated later. XDE STEP translator (see section 7 <a href="#occt_step_7">Reading from and writing to XDE</a>) translates names, colors, layers, validation properties and other data associated with shapes and assemblies into XDE document.
File translation is performed in the programming mode, via C++ calls.
@ref occt_user_guides__shape_healing "Shape Healing" toolkit provides tools to heal various problems, which may be encountered in translated shapes, and to make them valid in Open CASCADE. The Shape Healing is smoothly connected to STEP translator using the same API, only the names of API packages change.
For testing the STEP component in DRAW Test Harness, a set of commands for reading and writing STEP files and analysis of relevant data are provided by the *TKXSDRAW* plugin.
See also: our web site at <a href="http://www.opencascade.org/support/training/">E-learning and Training</a>.
@subsection occt_step_1_1 STEP Exchanges in Open Cascade technology
Beyond the upper level API, which is fitted for an easy end-use, the STEP exchange functions enter in the general frame of Exchanges in Open Cascade, adapted for STEP:
* Specific packages for Data definition and checking;
* Physical Access supported by Drivers (Part 21 file access is embedded);
* Conversion to/from Open Cascade or applicative data supported by drivers (OCC-BREP and XDE ard basically provided);
* Tools for analysis, filtering, etc... including DRAW commands.
These modules share common architecture and capabilities with other exchange modules of Open Cascade, like Shape Healing. Also, built-in Viewer and Converter (as Plugin for Netscape, Internet Explorer ..), are based on the same technology.
In addition, Open Cascade provides tools to process models described using STEP: to reflect EXPRESS descriptions, to read, write and check data, to analyze the whole models ... Their key features are:
* Modularity by sets of data types, which can be hierarchized to reflect the original modularity describing the resources and application protocols;
* Implementation as CDL/C++ classes, providing comprehensive access to their members;
* Early binding is basically used, providing good performance, easy installation and use as well as the capability to support non-compiled descriptions.
This provides a natural way to deal with non-supported protocols when they share common definitions, as for geometry, which can then be exploited. The common frame, as the already supported data types, give a good foundation to go towards new uses of STEP, either on data definition (protocols from ISO or from industrial consortia) or on mapping with applicative data.
@subsection occt_step_1_2 STEP Interface
The STEP interface reads STEP files produced in accordance with STEP Application Protocol 214 (Conformance Class 2 both CD and DIS versions of schema) and translates them to Open CASCADE Technology models. STEP Application Protocol 203 is also supported.
The STEP interface also translates OCCT models to STEP files. STEP files that are produced by this interface conform to STEP AP 203 or AP 214 (Conformance Class 2, either CD or DIS version of the schema) depending on the user's option.
Basic interface reads and writes geometrical, topological STEP data and assembly structures.
The interface is able to translate one entity, a group of entities or a whole file.
Other kinds of data such as colors, validation properties, layers, names and the structure of assemblies can be read or written with the help of XDE tools - <i> STEPCAFControl_Reader</i> and <i> STEPCAFControl_Writer</i>.
To choose a translation mode when exporting to a STEP format, use <i> STEPControl_STEPModelType</i>.
There is a set of parameters that concern the translation and can be set before the beginning of the translation.
Please, note:
* a STEP model is a STEP file that has been loaded into memory;
* all references to shapes indicate OCCT shapes unless otherwise explicitly stated;
* a root entity is the highest level entity of any given type, i.e. an entity that is not referenced by any other one.
@section occt_step_2 Reading STEP
@subsection occt_step_2_1 Procedure
You can translate a STEP file into an OCCT shape in the following steps:

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -3,37 +3,29 @@
@tableofcontents
@section occt_xde_1_ Introduction
@subsection occt_xde_1_1 Overview of the Extended Data Exchange (XDE)
@section occt_xde_1 Introduction
This manual explains how to use the Extended Data Exchange (XDE). It provides basic documentation on setting up and using XDE. For advanced information on XDE and its applications, see our offerings at <a href="http://www.opencascade.com/services/support/">on our web site</a>.
Based on document architecture, XDE allows processing of various types of data to and from external files.
The Extended Data Exchange (XDE) module allows extending the scope of exchange by translating additional data attached to geometric BREP data, thereby improving the interoperability with external software.
XDE is available for users of Open CASCADE Technology on all supported platforms (Linux, Windows).
@subsubsection occt_xde_1_1_1 Prerequisite
The Extended Data Exchange (XDE) component requires Advanced Shape Healing for operation.
Data types such as colors, layers, assembly descriptions and validation properties (i.e. center of gravity, etc.) are supported. These data are stored together with shapes in an XCAF document. It is also possible to add a new types of data taking the existing tools as prototypes.
Finally, the XDE provides reader and writer tools for reading and writing the data supported by XCAF to and from IGES and STEP files.
@figure{/user_guides/xde/images/646_xde_11_400.png,"Shape imported using XDE"}
The XDE component requires @ref occt_user_guides__shape_healing "Shape Healing" toolkit for operation.
@subsection occt_xde_1_1 Basic terms
@subsubsection occt_xde_1_1_2 Environment variables
To use XDE you have to set the environment variables properly. Make sure that two important environment variables are set as follows:
* *CSF_PluginDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
* *CSF_XCAFDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
@subsubsection occt_xde_1_1_3 Basic terms
For better understanding of XDE, certain key terms are defined:
* **Shape** - a standalone shape, which does not belong to the assembly structure.
* **Instance** - a replication of another shape with a location that can be the same location or a different one.
* **Assembly** - a construction that is either a root or a sub-assembly.
@subsubsection occt_xde_1_1_4 XDE Data Types
The following types of data are currently supported:
* assemblies
* validation properties
* names
* colors
* layers
It is also possible to add new types of data by using tools as prototypes. This makes XDE a basically extensible framework.
In addition, XDE provides reading and writing tools to read and write the data supported by STEP and IGES files.
@subsubsection occt_xde_1_1_5 XDE Organization
@subsection occt_xde_1_2 XDE Organization
The basis of XDE, called XCAF, is a framework based on OCAF (Open CASCADE Technology Application Framework) and is intended to be used with assemblies and with various kinds of attached data (attributes). Attributes can be Individual attributes for a shape, specifying some characteristics of a shape, or they can be Grouping attributes, specifying that a shape belongs to a given group whose definition is specified apart from the shapes.
XDE works in an OCAF document with a specific organization defined in a dedicated XCAF module. This organization is used by various functions of XDE to exchange standardized data other than shapes and geometry.
@@ -43,7 +35,7 @@ The Assembly Structure and attributes assigned to shapes are stored in the OCAF
Basic elements used by XDE are introduced in the XCAF sub-module by the package XCAFDoc. These elements consist in descriptions of commonly used data structures (apart from the shapes themselves) in normalized data exchanges. They are not attached to specific applications and do not bring specific semantics, but are structured according to the use and needs of data exchanges.
The Document used by XDE usually starts as a *TDocStd_Document*.
@subsubsection occt_xde_1_1_6 Assemblies
@subsection occt_xde_1_3 Assemblies
XDE supports assemblies by separating shape definitions and their locations. Shapes are simple OCAF objects without a location definition. An assembly consists of several components. Each of these components references one and the same specified shape with different locations. All this provides an increased flexibility in working on multi-level assemblies.
For example, a mechanical assembly can be defined as follows:
@@ -57,9 +49,9 @@ For example, a mechanical assembly can be defined as follows:
XDE defines the specific organization of the assembly content. Shapes are stored on sub-labels of label 0:1:1. There can be one or more roots (called free shapes) whether they are true trees or simple shapes. A shape can be considered to be an Assembly (such as AS1 under 0:1:1:1 in Figure1) if it is defined with Components (sub-shapes, located or not).
*XCAFDoc_ShapeTool* is a tool that allows you to manage the Shape section of the XCAF document. This tool is implemented as an attribute and located at the root label of the shape section.
*XCAFDoc_ShapeTool* is a tool that allows managing the Shape section of the XCAF document. This tool is implemented as an attribute and located at the root label of the shape section.
@subsubsection occt_xde_1_1_7 Validation Properties
@subsection occt_xde_1_4 Validation Properties
Validation properties are geometric characteristics of Shapes (volume, centroid, surface area) written to STEP files by the sending system. These characteristics are read by the receiving system to validate the quality of the translation. This is done by comparing the values computed by the original system with the same values computed by the receiving system on the resulting model.
Advanced Data Exchange supports both reading and writing of validation properties, and provides a tool to check them.
@@ -67,8 +59,6 @@ Advanced Data Exchange supports both reading and writing of validation propertie
@image html /user_guides/xde/images/xde_image005.png "Validation Property Descriptions"
@image latex /user_guides/xde/images/xde_image005.png "Validation Property Descriptions"
Check logs contain deviations of computed values from the values stored in a STEP file. A typical example appears as follows:
| Label | Area defect | Volume defect | dX | dY | DZ | Name |
@@ -90,31 +80,41 @@ Check logs contain deviations of computed values from the values stored in a STE
In our example, it can be seen that no errors were detected for either area, volume or positioning data.
@subsubsection occt_xde_1_1_8 Names
@subsection occt_xde_1_5 Names
XDE supports reading and writing the names of shapes to and from IGES and STEP file formats. This functionality can be switched off if you do not need this type of data, thereby reducing the size of the document.
@subsubsection occt_xde_1_1_9 Colors and Layers
@figure{/user_guides/xde/images/614_xde_04_400.png, "Instance Names"}
@subsection occt_xde_1_6 Colors and Layers
XDE can read and write colors and layers assigned to shapes or their subparts (down to the level of faces and edges) to and from both IGES and STEP formats. Three types of colors are defined in the enumeration *XCAFDoc_ColorType*:
* generic color <i>(XCAFDoc_ColorGen)</i>
* surface color <i>(XCAFDoc_ColorSurf)</i>
* curve color <i>(XCAFDoc_ColorCurv)</i>
@image html /user_guides/xde/images/xde_image006.png "Colors and Layers"
@image latex /user_guides/xde/images/xde_image006.png "Colors and Layers"
@figure{/user_guides/xde/images/xde_image006.png, "Colors and Layers"}
@section occt_xde_2 Working with XDE
@subsection occt_xde_2_1 Getting started
@section occt_xde_2_ Basic Concepts
@subsection occt_xde_2_1 Overview
As explained in the last chapter, XDE uses *TDocStd_Documents* as a starting point. The general purpose of XDE is:
* Checking if an existing document is fit for XDE
* Getting an application and initialized document
* Initializing a document to fit it for XDE
* Adding, setting and finding data
* Querying and managing shapes
* Attaching properties to shapes
The Document used by XDE usually starts as a TDocStd_Document.
* Checking if an existing document is fit for XDE;
* Getting an application and initialized document;
* Initializing a document to fit it for XDE;
* Adding, setting and finding data;
* Querying and managing shapes;
* Attaching properties to shapes.
The Document used by XDE usually starts as a *TDocStd_Document*.
@subsubsection occt_xde_2_1_1 General Check
@subsubsection occt_xde_2_1_1 Environment variables
To use XDE you have to set the environment variables properly. Make sure that two important environment variables are set as follows:
* *CSF_PluginDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
* *CSF_XCAFDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
@subsubsection occt_xde_2_1_2 General Check
Before working with shapes, properties, and other types of information, the global organization of an XDE Document can be queried or completed to determine if an existing Document is actually structured for use with XDE.
To find out if an existing *TDocStd_Document* is suitable for XDE, use:
@@ -124,13 +124,14 @@ if ( XCAFDoc_DocumentTool::IsXCAFDocument (doc) ) { .. yes .. }
~~~~~
If the Document is suitable for XDE, you can perform operations and queries explained in this guide. However, if a Document is not fully structured for XDE, it must be initialized.
@subsubsection occt_xde_2_1_2 Get an Application or an Initialized Document
@subsubsection occt_xde_2_1_3 Get an Application or an Initialized Document
If you want to retrieve an existing application or an existing document (known to be correctly structured for XDE), use:
~~~~~
Handle(TDocStd_Document) aDoc;
Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
anApp->NewDocument(;MDTV-XCAF;,aDoc);
~~~~~
@subsection occt_xde_2_2 Shapes and Assemblies
@subsubsection occt_xde_2_2_1 Initialize an XDE Document (Shapes)
@@ -478,10 +479,21 @@ Standard_Real volume ...;
// value previously computed for the volume
XCAFDoc_Volume::Set ( aLabel, volume );
~~~~~
@subsection occt_xde_2_6 Colors
@subsection occt_xde_2_6 Colors and Layers
XDE can read and write colors and layers assigned to shapes or their subparts (down to level of faces and edges) to and from both IGES and STEP formats.
@figure{/user_guides/xde/images/239_xde_12_400.png,"Motor Head"}
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
Colors are stored in a child of the starting document label: it is the second level (0.1.2), while Shapes are at the first level. Each color then corresponds to a dedicated label, the property itself is a Quantity_Color, which has a name and value for Red, Green, Blue. A Color may be attached to Surfaces (flat colors) or to Curves (wireframe colors), or to both. A Color may be attached to a sub-shape. In such a case, the sub-shape (and its own sub-shapes) takes its own Color as a priority.
Colors are stored in a child of the starting document label: it is the second level (0.1.2), while Shapes are at the first level. Each color then corresponds to a dedicated label, the property itself is a Quantity_Color, which has a name and value for Red, Green, Blue. A Color may be attached to Surfaces (flat colors) or to Curves (wireframe colors), or to both. A Color may be attached to a sub-shape. In such a case, the sub-shape (and its own sub-shapes) takes its own Color as a priority.
Layers are handled using the same principles as Colors. In all operations described below you can simply replace **Color** with **Layer** when dealing with Layers. Layers are supported by the class *XCAFDoc_LayerTool*.
The class of the property is *XCAFDoc_Layer*, sub-class of *TDF_Attribute* while its definition is a *TCollection_ExtendedString*. Integers are generally used when dealing with Layers. The general cases are:
* IGES has *LevelList* as a list of Layer Numbers (not often used)
* STEP identifies a Layer (not by a Number, but by a String), to be more general.
Colors and Shapes are related to by Tree Nodes.
@@ -595,11 +607,7 @@ To remove a Color and all the references to it (so that the related shapes will
~~~~~
myColors->RemoveColor(ColLabel);
~~~~~
@subsection occt_xde_2_7 Layers
Layers are handled using the same principles as for Colors. Simply replace **Color** with **Layer** when dealing with Layers. Layers are supported by the class *XCAFDoc_LayerTool*.
The class of the property is *XCAFDoc_Layer*, sub-class of *TDF_Attribute* while its definition is a *TCollection_ExtendedString*. Integers are generally used when dealing with Layers. The general cases are:
* IGES has *LevelList* as a list of Layer Numbers (not often used)
* STEP identifies a Layer (not by a Number, but by a String), to be more general.
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
Note that saving and restoring the document itself are standard OCAF operations. As the various previously described definitions enter into this frame, they will not be explained any further.

85
samples/tcl/Penrose.tcl Normal file
View File

@@ -0,0 +1,85 @@
# Generate set of boxes resembling OCC logo and arranged in the shape of
# Penrose triangle on perspective view.
# The sample shows how the viewer can be manipulated to produce required
# visual effect
#Category: Visualization
#Title: Penrose triangle on perspective view
pload MODELING VISUALIZATION
# procedure to define box dimensions
set scale 1.
set ratio 0.94
proc defbox {} {
global scale ratio
set scale [expr $scale * $ratio]
return [list 1.8*$scale 1.8*$scale 1.3*$scale]
}
# make set of boxes
eval box b1 0 0 0 [defbox]
eval box b2 2 0 0 [defbox]
eval box b3 4 0 0 [defbox]
eval box b4 6 0 0 [defbox]
eval box b5 6 -1.5 0 [defbox]
eval box b6 6 -3 0 [defbox]
eval box b7 6 -4.5 0 [defbox]
eval box b8 6 -6 0 [defbox]
eval box b9 6 -6 1 [defbox]
eval box b10 6 -6 2 [defbox]
# cut last box by prisms created from the first two to make impression
# that it is overlapped by these on selected view (see vviewparams below)
explode b1 f
explode b2 f
prism p0 b1_5 12.3 -14 6.8
bcut bx b10 p0
prism p1 b2_3 12 -14 6.8
bcut bxx bx p1
tcopy bxx b10
# make some boxes hollow
for {set i 1} {$i <= 1} {incr i} {
set dim [boundingstr b$i]
set dx [expr [lindex $dim 3] - [lindex $dim 0]]
set x1 [expr [lindex $dim 0] + 0.1 * $dx]
set x2 [expr [lindex $dim 1] + 0.1 * $dx]
set x3 [expr [lindex $dim 2] + 0.1 * $dx]
box bc $x1 $x2 $x3 0.8*$dx 0.8*$dx $dx
bcut bb b$i bc
tcopy bb b$i
}
# prepare a view
vinit Penrose w=1024 h=512
vsetcolorbg 255 255 255
vrenderparams -rayTrace -fsaa on -reflections off -shadows off
# set camera position and adjust lights
vcamera -persp -fovy 25
vviewparams -eye 14 -14 6.8 -up 0 0 1 -at 4 -4 0 -scale 70
vsetdispmode 1
vlight def
vlight add directional direction 1 -2 -10 head 1 color white
vlight add directional direction 0 -10 0 head 1 color white
# display boxes
vdisplay b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
# set colors like in boxes of on OCC logo
vsetcolor b1 0.8671875 0 0.16015625
vsetcolor b2 0.96484375 0.8671875 0
vsetcolor b3 0.609375 0.97734375 0.09375
vsetcolor b4 0.90234375 0 0.48046875
vsetcolor b5 0 0.48046875 0.73828125
vsetcolor b6 0.578125 0 0.48046875
vsetcolor b7 0.93359375 0.609375 0
vsetcolor b8 0 0.70703125 0.9296875
vsetcolor b9 0 0.64453125 0.48046875
vsetcolor b10 0 0.48046875 0.73828125
# set material to plastic for better look
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
vdrawtext "Which\nbox\nis\ncloser\nto\nyou?" 0 -6 -2 0 0 0 left top 0 0 40 Bold

64
samples/tcl/pencil.tcl Normal file
View File

@@ -0,0 +1,64 @@
# Sample demonstrating assignment of colors to faces in XDE
#Category: Data Exchange
#Title: Assignment of colors to faces
pload MODELING VISUALIZATION OCAF XDE
box b 0 -20 -10 100 40 20
compound b b b a
explode a
trotate a_1 0 0 0 1 0 0 60
trotate a_2 0 0 0 1 0 0 -60
bcommon b a a_1
bcommon b b a_2
pcylinder c 4 100
trotate c 0 0 0 0 1 0 90
psphere s 1.4
ttranslate s 99.2 0 0
bfuse cx c s
pcone e 60 0.5 101
trotate e 0 0 0 0 1 0 90
bcommon body b e
bcut body body c
bcommon core cx e
text2brep text "CAD Assistant" Times 10
ttranslate text 10 -4 10
prism tr text 0 0 -1
bfuse body body tr
donly body core
#vdisplay body core
#vsetcolor body yellow
#vsetcolor core red
explode body so
explode body_1 f
explode core so
NewDocument D
XAddShape D body_1
XAddShape D core_1
#XSetColor D body_1 0. 0. 1.
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i 0. 0. 1.}
XSetColor D body_1_1 0.9 0.5 0.4
XSetColor D body_1_9 0.9 0.5 0.4
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 0.6 0.7 0.0}
XSetColor D core_1 0.1 0.1 1.
foreach ff [explode core_1 f] { XSetColor D $ff 0.1 0.1 1. ; puts "set color $ff" }
XShow D
vfit
vsetdispmode 1
vsetcolorbg 255 255 255
#param write.iges.brep.mode 1
#WriteIges D d:/pencil3.igs

130
samples/tcl/snowflake.tcl Normal file
View File

@@ -0,0 +1,130 @@
# Creation of 2d drawing
#Category: Modeling
#Title: Snowflake - creation of 2d geometry
pload MODELING AISV
# make circular elements
circle c11 5 5 0 5
circle c12 5 5 0 3
circle c21 18 7 0 7
circle c22 18 7 0 5
circle c31 28.5 5 0 5
circle c32 28.5 5 0 3
trim c21 c21 pi/4 -pi/4
trim c22 c22 pi/4 -pi/4
trim c31 c31 pi/4 -pi/4
trim c32 c32 pi/4 -pi/4
line l21 18 7 0 1 1 0
line l22 18 7 0 1 -1 0
line l31 28.5 5 0 1 1 0
line l32 28.5 5 0 1 -1 0
trim l21 l21 5 7
trim l22 l22 5 7
trim l31 l31 3 5
trim l32 l32 3 5
line l1 -6 0 0 0.86602540378443864 0.5 0
line l2 -6 1 0 1 0 0
trim l1 l1 0 30
trim l2 l2 0 45
mkedge c11 c11
mkedge c12 c12
mkedge c21 c21
mkedge c22 c22
mkedge c31 c31
mkedge c32 c32
mkedge l21 l21
mkedge l22 l22
mkedge l31 l31
mkedge l32 l32
mkedge l1 l1
mkedge l2 l2
wire b11 c11
wire b12 c12
orientation b12 R
# build one ray
plane p -6 0 0 0 0 1
mkface f1 p b11
add b12 f1
wire b2 c21 l21 c22 l22
mkface f2 p b2
wire b3 c31 l31 c32 l32
mkface f3 p b3
prism f5 l1 -5 8.6602540378443864 0
prism f4 l2 0 -1 0
compound f1 f2 f3 bc
bfuse r bc f4
explode r Sh
renamevar r_1 r
bcut r r f5
explode r Sh
renamevar r_1 r
explode r e
wire w r_4 r_1 r_7 r_8 r_9 r_10 r_11 r_12 r_13 r_14 r_22 r_23 r_24 r_25 r_19 r_20 r_21 r_26 r_35 r_31 r_32 r_33 r_34 r_36 r_37
tcopy w w1
tmirror w1 -6 0 0 0 1 0
wire w w w1
mkface w p w
donly w
# construct complete snowflake
tcopy w w1
tcopy w w2
tcopy w w3
tcopy w w4
tcopy w w5
trotate w1 -6 0 0 0 0 1 60
trotate w2 -6 0 0 0 0 1 120
trotate w3 -6 0 0 0 0 1 180
trotate w4 -6 0 0 0 0 1 240
trotate w5 -6 0 0 0 0 1 300
bfuse w w w1
bfuse w w w2
bfuse w w w3
bfuse w w w4
bfuse w w w5
unifysamedom r w
# keep only wires in compound
eval compound [explode r w] snowflake
tscale snowflake -6 0 0 1.5
# draw frame loosely following GOST 2.104-68
polyline frame -100 -100 0 172 -100 0 172 100 0 -100 100 0 -100 -100 0
polyline t1 52 -100 0 52 -45 0 172 -45 0
polyline t2 52 -60 0 172 -60 0
polyline t3 52 -85 0 172 -85 0
polyline t4 122 -100 0 122 -60 0
polyline t5 122 -80 0 172 -80 0
polyline t6 122 -65 0 172 -65 0
polyline t7 142 -80 0 142 -85 0
polyline t8 137 -80 0 137 -60 0
polyline t9 154 -80 0 154 -60 0
compound frame t1 t2 t3 t4 t5 t6 t7 t8 t9 lines
# add text
text2brep sample "SAMPLE" Arial 10 x=90 y=-55 bolditalic
text2brep occ "Open CASCADE" Times 6 x=125 y=-95
text2brep name "Snowflake" Courier 7 x=65 y=-75 italic
text2brep material "Ice" Courier 7 x=75 y=-95 italic
text2brep sheets "Sheets 1" Courier 3.5 x=145 y=-83 italic
text2brep scale "Scale\n\n1:100" Courier 3.5 x=157 y=-63 italic
text2brep mass "Mass\n\n1 mg" Courier 3.5 x=140 y=-63 italic
eval compound [explode sample w] sample
eval compound [explode occ w] occ
eval compound [explode name w] name
eval compound [explode material w] material
eval compound [explode sheets w] sheets
eval compound [explode scale w] scale
eval compound [explode mass w] mass
compound sample occ name material sheets scale mass text
compound snowflake frame text drawing
# display in 3d view
vinit Driver1/Viewer1/View1 w=1024 h=768
vdisplay snowflake lines text
vtop
vfit

View File

@@ -180,22 +180,21 @@ is
TOI_IsoV,
TOI_Both;
---Purpose: Declares the type of isoparameter displayed.
enumeration DisplayStatus is
DS_Displayed,
DS_Erased,
DS_Temporary,
DS_DispImmediate,
DS_None;
---Purpose:
-- To give the display status of an Interactive Object.
-- This will be one of the following:
-- - DS_Displayed: the Interactive Object is displayed in the main viewer;
-- - DS_Erased: the Interactive Object is hidden in main viewer;
-- - DS_Temporary: temporarily displayed (in local context);
-- - DS_DispImmediate: displayed in the list of immediate presentations (highly interactive);
-- - DS_None: nowhere displayed.
enumeration DisplayStatus is
DS_Displayed,
DS_Erased,
DS_Temporary,
DS_None;
---Purpose:
-- To give the display status of an Interactive Object.
-- This will be one of the following:
-- - DS_Displayed: the Interactive Object is
-- displayed in the main viewer;
-- - DS_Erased: the Interactive Object is hidden in main viewer;
-- - DS_Temporary: the Interactive Object is temporarily displayed;
-- - DS_None: the Interactive Object is nowhere displayed.
enumeration SelectStatus is
SS_Added,
SS_Removed,

View File

@@ -96,8 +96,6 @@ void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& the
{
myTypeOfPresentation3d = myReference->TypeOfPresentation3d();
}
theAnotherObj->AddChild (this);
}
//=======================================================================

View File

@@ -98,16 +98,18 @@ namespace
//purpose :
//=======================================================================
AIS_Dimension::AIS_Dimension (const AIS_KindOfDimension theType)
: AIS_InteractiveObject(),
myCustomValue (0.0),
myIsValueCustom (Standard_False),
mySpecialSymbol (' '),
: AIS_InteractiveObject (),
mySelToleranceForText2d(0.0),
myCustomValue (0.0),
myIsValueCustom (Standard_False),
myIsTextPositionFixed (Standard_False),
mySpecialSymbol (' '),
myDisplaySpecialSymbol (AIS_DSS_No),
myGeometryType (GeometryType_UndefShapes),
myIsPlaneCustom (Standard_False),
myFlyout (0.0),
myIsGeometryValid (Standard_False),
myKindOfDimension (theType)
myGeometryType (GeometryType_UndefShapes),
myIsPlaneCustom (Standard_False),
myFlyout (0.0),
myIsGeometryValid (Standard_False),
myKindOfDimension (theType)
{
}

View File

@@ -346,22 +346,14 @@ is
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
---Purpose: Set Z layer id for interactive object.
-- The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
-- The ids for Z layers are generated by V3d_Viewer.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
Redisplay(me : mutable;
aniobj : InteractiveObject from AIS;
@@ -2031,19 +2023,6 @@ is
---Purpose: returns if possible,
-- the first local context where the object is seen
SetViewAffinity (me : mutable;
theIObj : InteractiveObject from AIS;
theView : View from V3d;
theIsVisible : Boolean from Standard) is static;
---Purpose: setup object visibility in specified view,
-- has no effect if object is not disaplyed in this context.
ObjectsForView (me;
theListOfIO : in out ListOfInteractive from AIS;
theView : View from V3d;
theIsVisibleInView : Boolean from Standard;
theStatus : DisplayStatus from AIS = AIS_DS_None) is static;
---Purpose: Query objects visible or hidden in specified view due to affinity mask.
InitAttributes(me:mutable) is static private;

View File

@@ -79,7 +79,10 @@ mgrSelector(new SelectMgr_SelectionManager()),
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myToHilightSelected( Standard_True ),
myWasLastMain(Standard_False),
myCurrentTouched(Standard_False),
mySelectedTouched(Standard_False),
myToHilightSelected(Standard_True),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myDefaultColor(Quantity_NOC_GOLDENROD),
@@ -89,6 +92,7 @@ myPreselectionColor(Quantity_NOC_GREEN),
mySubIntensity(Quantity_NOC_GRAY40),
myDisplayMode(0),
myCurLocalIndex(0),
myAISCurDetected(0),
myZDetectionFlag(0),
myIsAutoActivateSelMode( Standard_True )
{
@@ -318,35 +322,6 @@ void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive& theListO
}
}
//=======================================================================
//function : ObjectsForView
//purpose :
//=======================================================================
void AIS_InteractiveContext::ObjectsForView (AIS_ListOfInteractive& theListOfIO,
const Handle(V3d_View)& theView,
const Standard_Boolean theIsVisibleInView,
const AIS_DisplayStatus theStatus) const
{
const Graphic3d_CView* aCView = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
const Standard_Integer aViewId = aCView->ViewId;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (theStatus != AIS_DS_None
&& anObjIter.Value()->GraphicStatus() != theStatus)
{
theListOfIO.Append (anObjIter.Key());
continue;
}
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (anObjIter.Key());
const Standard_Boolean isVisible = anAffinity->IsVisible (aViewId);
if (isVisible == theIsVisibleInView)
{
theListOfIO.Append (anObjIter.Key());
}
}
}
//=======================================================================
//function : Display
//purpose :
@@ -366,33 +341,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
theToUpdateViewer, theIObj->AcceptShapeDecomposition());
}
//=======================================================================
//function : SetViewAffinity
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj,
const Handle(V3d_View)& theView,
const Standard_Boolean theIsVisible)
{
if (theIObj.IsNull()
|| !myObjects.IsBound (theIObj))
{
return;
}
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (theIObj);
const Graphic3d_CView* aCView = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
anAffinity->SetVisible (aCView->ViewId, theIsVisible == Standard_True);
if (theIsVisible)
{
theView->View()->ChangeHiddenObjects()->Remove (theIObj);
}
else
{
theView->View()->ChangeHiddenObjects()->Add (theIObj);
}
}
//=======================================================================
//function : Display
//purpose :
@@ -440,28 +388,11 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
}
}
const AIS_DisplayStatus aDispStatus = theDispStatus != AIS_DS_None ? theDispStatus : AIS_DS_Displayed;
if (!myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (aDispStatus, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->RegisterObject (theIObj);
switch (aDispStatus)
{
case AIS_DS_Displayed:
{
myMainPM->Display (theIObj, theDispMode, Standard_False);
break;
}
case AIS_DS_DispImmediate:
{
myMainPM->Display (theIObj, theDispMode, Standard_True);
break;
}
default: break;
}
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
if (!mgrSelector->Contains (theIObj))
@@ -507,8 +438,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
aStatus->AddDisplayMode (theDispMode);
}
myMainPM->Display (theIObj, theDispMode, aDispStatus == AIS_DS_DispImmediate);
aStatus->SetGraphicStatus (aDispStatus);
myMainPM->Display (theIObj, theDispMode);
aStatus->SetGraphicStatus (AIS_DS_Displayed);
if (aStatus->IsHilighted())
{
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
@@ -928,8 +859,7 @@ void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIO
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
aStatus->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
myMainPM->Highlight (theIObj, aHilightMode);
@@ -965,8 +895,7 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Color (anIObj, aCol, aHilightMode);
@@ -997,8 +926,7 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightColor(Quantity_NOC_WHITE);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Unhighlight (anIObj, aHilightMode);
@@ -1532,10 +1460,9 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
}
aStatus->AddDisplayMode (theMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Display (anObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->Display (anObj, theMode);
if (aStatus->IsSubIntensityOn())
{
myMainPM->Color (anObj, mySubIntensity, theMode);
@@ -1564,11 +1491,6 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
theIObj->SetContext(this);
}
if (HasOpenedContext())
{
return;
}
if (!myObjects.IsBound (theIObj))
{
theIObj->SetDisplayMode (theMode);
@@ -1580,8 +1502,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
}
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() != AIS_DS_Displayed
&& aStatus->GraphicStatus() != AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() != AIS_DS_Displayed)
{
theIObj->SetDisplayMode (theMode);
return;
@@ -1613,7 +1534,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
aStatus->AddDisplayMode (theMode);
}
myMainPM->Display (theIObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->Display (theIObj, theMode);
Standard_Integer aDispMode, aHiMode, aSelMode;
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
if (aStatus->IsHilighted())
@@ -1664,15 +1585,14 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
aStatus->AddDisplayMode (myDisplayMode);
}
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
if (myMainPM->IsHighlighted (theIObj, anOldMode))
{
myMainPM->Unhighlight (theIObj, anOldMode);
}
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
myMainPM->Display (theIObj, myDisplayMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->Display (theIObj, myDisplayMode);
Standard_Integer aDispMode, aHiMode, aSelMode;
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
@@ -2435,11 +2355,6 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
mgrSelector->Remove (theIObj);
myObjects.UnBind (theIObj);
myMainVwr->Viewer()->UnregisterObject (theIObj);
for (myMainVwr->InitDefinedViews(); myMainVwr->MoreDefinedViews(); myMainVwr->NextDefinedViews())
{
myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj);
}
if (theToUpdateviewer
&& aStatus->GraphicStatus() == AIS_DS_Displayed)
@@ -2843,17 +2758,7 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
if (theIObj.IsNull())
return;
if (myObjects.IsBound (theIObj))
{
if (myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed || myObjects (theIObj)->GraphicStatus() == AIS_DS_Erased)
{
theIObj->SetZLayer (myMainPM, theLayerId);
}
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetZLayer (theIObj, theLayerId);
}
theIObj->SetZLayer (theLayerId);
}
//=======================================================================
@@ -2862,17 +2767,7 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
//=======================================================================
Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
if (theIObj.IsNull())
return -1;
if (myObjects.IsBound (theIObj))
{
return theIObj->GetZLayer (myMainPM);
}
else if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
}
return -1;
return !theIObj.IsNull()
? theIObj->ZLayer()
: Graphic3d_ZLayerId_UNKNOWN;
}

View File

@@ -43,7 +43,6 @@
#include <V3d_SpotLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx>
#include <Visual3d_View.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <SelectMgr_Selection.hxx>
@@ -85,7 +84,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
// allonzy
myMainSel->Pick (theXPix, theYPix, theView);
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
@@ -1047,9 +1046,7 @@ Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
#endif
return Standard_False;
}
return myLocalContexts(myCurLocalIndex)->HasShape();
return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
}
//=======================================================================
@@ -1065,7 +1062,9 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
if (!aShape.IsNull())
{
aResShape = aShape->Shape().Located (TopLoc_Location (SelectedInteractive()->Transformation()) * aShape->Shape().Location());
TopLoc_Location aLocTrsf = SelectedInteractive()->Transformation().Form() == gp_Identity ?
TopLoc_Location() : TopLoc_Location (SelectedInteractive()->Transformation());
aResShape = aShape->Shape().Located (aLocTrsf * aShape->Shape().Location());
}
return aResShape;
@@ -1089,6 +1088,8 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::Interactive() const
Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() const
{
if(!HasOpenedContext()){
if (AIS_Selection::Selection(myCurrentName.ToCString())->Extent() == 0)
return NULL;
Handle(Standard_Transient) TR =AIS_Selection::Selection(myCurrentName.ToCString())->Value();
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR);
return IO;}

View File

@@ -388,6 +388,11 @@ is
HasShape(me) returns Boolean from Standard;
---Purpose: returns TRUE if the detected entity is a shape
-- coming from a Decomposition of an element.
HasSelectedShape(me) returns Boolean from Standard;
---Purpose: returns true if current selection is not empty
-- and the owner of selected object contains a shape.
-- This method does not take into account decomposition
-- status of detected shape.
SelectedShape(me) returns Shape from TopoDS;
SelectedOwner(me) returns EntityOwner from SelectMgr;
@@ -411,26 +416,6 @@ is
anObject: InteractiveObject from AIS;
Prior : Integer from Standard);
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
returns Integer from Standard;

View File

@@ -1219,34 +1219,3 @@ Standard_Integer AIS_LocalContext::PixelTolerance() const {
return myMainVS->PixelTolerance();
}
//=======================================================================
//function : SetZLayer
//purpose :
//=======================================================================
void AIS_LocalContext::SetZLayer (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theLayerId)
{
if (!myActiveObjects.IsBound (theIObj))
return;
const Handle(AIS_LocalStatus)& aStatus = myActiveObjects (theIObj);
if (aStatus->DisplayMode () == -1)
return;
theIObj->SetZLayer (myMainPM, theLayerId);
}
//=======================================================================
//function : GetZLayer
//purpose :
//=======================================================================
Standard_Integer AIS_LocalContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
if (!myActiveObjects.IsBound (theIObj))
return -1;
return theIObj->GetZLayer (myMainPM);
}

View File

@@ -87,7 +87,6 @@
#include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
#include <Visual3d_View.hxx>
#ifdef OCC9026
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
@@ -129,7 +128,6 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
myCurDetected = 0;
myDetectedSeq.Clear();
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
myMainVS->Pick (theXpix, theYpix, theView);
const Standard_Integer aDetectedNb = myMainVS->NbPicked();
@@ -155,6 +153,7 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
{
if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
{
myMainPM->ClearImmediateDraw();
Unhilight (myMapOfOwner (mylastindex), theView);
if (theToRedrawImmediate)
{
@@ -378,6 +377,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateV
if(myAutoHilight)
{
myMainPM->ClearImmediateDraw();
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
{
@@ -547,7 +547,6 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
return;
}
myMainPM->ClearImmediateDraw();
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
if (IsSelected (theOwner))
{
@@ -568,8 +567,6 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
//=======================================================================
void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
{
Standard_Boolean updMain(Standard_False);
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
#ifdef BUC60765
if( Sel.IsNull() ) return;
@@ -602,13 +599,8 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
IO = *((Handle(AIS_InteractiveObject)*)&SO);
updMain = Standard_True;
}
else
updMain = Standard_True;
}
else
updMain = Standard_True;
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
Standard_Integer HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO));
if ( Ownr->IsAutoHilight() )
@@ -643,8 +635,6 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
{
myMainPM->ClearImmediateDraw();
Standard_Boolean updMain(Standard_False);
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
#ifdef BUC60765
if( Sel.IsNull() ) return;
@@ -681,10 +671,7 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO);
HM = GetHiMod(IO);
#endif
updMain = Standard_True;
}
else
updMain = Standard_True;
}
Ownr->Unhilight(PM,HM);
}
@@ -697,14 +684,8 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
anIter1.Key()->ClearSelected();
}
if(updateviewer){
#ifdef BUC60774
if(updateviewer)
myCTX->CurrentViewer()->Update();
#else
if(updMain) myCTX->CurrentViewer()->Update();
#endif
}
}
//=======================================================================
@@ -774,6 +755,28 @@ HasShape() const
return (hasshape&&comes);
}
//================================================================
// Function : HasSelectedShape
// Purpose : Checks if there is a selected shape regardless of its decomposition status
//================================================================
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
{
if (AIS_Selection::CurrentSelection()->Extent() == 0)
return Standard_False;
Handle(Standard_Transient) aCurSelection = AIS_Selection::CurrentSelection()->Value();
if (aCurSelection.IsNull())
return Standard_False;
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aCurSelection);
Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
if (aBrepOwner.IsNull())
{
return Standard_False;
}
return aBrepOwner->HasShape();
}
//==================================================
// Function:
// Purpose :
@@ -787,6 +790,7 @@ TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
return TopoDS_Shape();
}
return aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
}
@@ -1046,6 +1050,10 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
myMapOfOwner.Clear();
myMapOfOwner.Assign (anOwnersToKeep);
mylastindex = myMapOfOwner.FindIndex (aLastPicked);
if (!IsValidIndex (mylastindex))
{
myMainPM->ClearImmediateDraw();
}
if (!isAISRemainsDetected)
{
@@ -1199,6 +1207,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
{
if (thePickOwner.IsNull())
{
myMainPM->ClearImmediateDraw();
if (theToRedrawImmediate)
{
theView->RedrawImmediate();
@@ -1250,6 +1259,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
if (aNewIndex != mylastindex
|| thePickOwner->IsForcedHilight())
{
myMainPM->ClearImmediateDraw();
if (mylastindex != 0
&& mylastindex <= myMapOfOwner.Extent())
{
@@ -1272,7 +1282,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
mylastindex = aNewIndex;
}
if (mylastindex)
if (mylastindex != 0)
{
mylastgood = mylastindex;
}

View File

@@ -52,9 +52,6 @@ is
-- Global methods - Apply to the whole curve.
--
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~Adaptor2d_Curve2d(){Delete();}"
FirstParameter(me) returns Real
is virtual;
@@ -229,6 +226,8 @@ is
raises
NoSuchObject from Standard
is virtual;
---C++: alias " Standard_EXPORT virtual ~Adaptor2d_Curve2d();"
end Curve2d;

View File

@@ -17,8 +17,15 @@
#include <Adaptor2d_Curve2d.ixx>
#include <Standard_NotImplemented.hxx>
void Adaptor2d_Curve2d::Delete()
{}
//=======================================================================
//function : ~Adaptor2d_Curve2d
//purpose : Destructor
//=======================================================================
Adaptor2d_Curve2d::~Adaptor2d_Curve2d()
{
}
//=======================================================================
//function : FirstParameter

View File

@@ -25,6 +25,7 @@
//=======================================================================
Adaptor2d_Line2d::Adaptor2d_Line2d()
: myUfirst(0.0), myUlast (0.0)
{
}
@@ -33,10 +34,11 @@ Adaptor2d_Line2d::Adaptor2d_Line2d()
//purpose :
//=======================================================================
Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d& P, const gp_Dir2d& D,
const Standard_Real UFirst,
const Standard_Real ULast):
myUfirst(UFirst),myUlast(ULast),myAx2d(P,D)
Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d& P,
const gp_Dir2d& D,
const Standard_Real UFirst,
const Standard_Real ULast)
: myUfirst(UFirst), myUlast(ULast), myAx2d(P,D)
{
}

View File

@@ -54,9 +54,6 @@ is
-- Global methods - Apply to the whole curve.
--
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~Adaptor3d_Curve(){Delete();}"
FirstParameter(me) returns Real
is virtual;
@@ -245,6 +242,8 @@ is
raises
NoSuchObject from Standard
is virtual;
---C++: alias " Standard_EXPORT virtual ~Adaptor3d_Curve();"
end Curve;

View File

@@ -17,8 +17,14 @@
#include <Adaptor3d_Curve.ixx>
#include <Standard_NotImplemented.hxx>
void Adaptor3d_Curve::Delete()
{}
//=======================================================================
//function : ~Adaptor3d_Curve
//purpose : Destructor
//=======================================================================
Adaptor3d_Curve::~Adaptor3d_Curve()
{
}
//=======================================================================
//function : FirstParameter

View File

@@ -35,24 +35,26 @@
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve() :
myIso(GeomAbs_NoneIso),
myFirst ( 0. ),
myLast ( 0. ),
myParameter ( 0. )
{}
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve()
: myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
{
}
//=======================================================================
//function : Adaptor3d_IsoCurve
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S) :
myFirst ( 0. ),
myLast ( 0. ),
myParameter ( 0. )
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S)
: mySurface (S),
myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
{
Load(S);
}
//=======================================================================
@@ -61,11 +63,15 @@ Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S) :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
const GeomAbs_IsoType Iso,
const Standard_Real Param)
const GeomAbs_IsoType theIso,
const Standard_Real theParam)
: mySurface (S),
myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
{
Load(S);
Load(Iso,Param);
Load(theIso, theParam);
}
//=======================================================================
@@ -73,14 +79,18 @@ Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
const GeomAbs_IsoType Iso,
const Standard_Real Param,
const Standard_Real WFirst,
const Standard_Real WLast)
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& theS,
const GeomAbs_IsoType theIso,
const Standard_Real theParam,
const Standard_Real theWFirst,
const Standard_Real theWLast)
: mySurface (theS),
myIso (theIso),
myFirst (theWFirst),
myLast (theWLast),
myParameter(theParam)
{
Load(S);
Load(Iso,Param,WFirst,WLast);
Load(theIso, theParam, theWFirst, theWLast);
}
//=======================================================================

View File

@@ -28,22 +28,11 @@
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve() :
myOffset( 0.),
myFirst ( 0.),
myLast ( 0.)
{}
//=======================================================================
//function : Adaptor3d_OffsetCurve
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C) :
myFirst ( 0.),
myLast ( 0.)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve()
: myOffset(0.0),
myFirst (0.0),
myLast (0.0)
{
Load(C);
}
//=======================================================================
@@ -51,13 +40,12 @@ Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real Offset) :
myFirst ( 0.),
myLast ( 0.)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& theCurve)
: myCurve (theCurve),
myOffset(0.0),
myFirst (0.0),
myLast (0.0)
{
Load(C);
Load(Offset);
}
//=======================================================================
@@ -65,13 +53,30 @@ Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real Offset,
const Standard_Real WFirst,
const Standard_Real WLast)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve
(const Handle(Adaptor2d_HCurve2d)& theCurve, const Standard_Real theOffset)
: myCurve (theCurve),
myOffset(theOffset),
myFirst (theCurve->FirstParameter()),
myLast (theCurve->LastParameter())
{
}
//=======================================================================
//function : Adaptor3d_OffsetCurve
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(
const Handle(Adaptor2d_HCurve2d)& theCurve,
const Standard_Real theOffset,
const Standard_Real theWFirst,
const Standard_Real theWLast )
: myCurve (theCurve),
myOffset(theOffset),
myFirst (theWFirst),
myLast (theWLast)
{
Load(C);
Load(Offset,WFirst,WLast);
}
//=======================================================================
@@ -104,8 +109,8 @@ void Adaptor3d_OffsetCurve::Load( const Standard_Real Offset)
//=======================================================================
void Adaptor3d_OffsetCurve::Load(const Standard_Real Offset,
const Standard_Real WFirst,
const Standard_Real WLast)
const Standard_Real WFirst,
const Standard_Real WLast)
{
myOffset = Offset;
myFirst = WFirst;

View File

@@ -62,9 +62,6 @@ is
-- Global methods - Apply to the whole surface.
--
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~Adaptor3d_Surface(){Delete();}"
FirstUParameter(me) returns Real
is virtual;
@@ -315,6 +312,8 @@ is
raises
NoSuchObject from Standard -- only for Offset Surface
is virtual;
---C++: alias " Standard_EXPORT virtual ~Adaptor3d_Surface();"
end Surface;

View File

@@ -17,8 +17,14 @@
#include <Adaptor3d_Surface.ixx>
#include <Standard_NotImplemented.hxx>
void Adaptor3d_Surface::Delete()
{}
//=======================================================================
//function : ~Adaptor3d_Surface
//purpose : Destructor
//=======================================================================
Adaptor3d_Surface::~Adaptor3d_Surface()
{
}
//=======================================================================
//function : FirstUParameter

View File

@@ -48,54 +48,57 @@
//purpose :
//=======================================================================
AdvApp2Var_ApproxAFunc2Var::
AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice) :
my1DTolerances(OneDTol),
my2DTolerances(TwoDTol),
my3DTolerances(ThreeDTol),
my1DTolOnFront(OneDTolFr),
my2DTolOnFront(TwoDTolFr),
my3DTolOnFront(ThreeDTolFr),
myFirstParInU(FirstInU),
myLastParInU(LastInU),
myFirstParInV(FirstInV),
myLastParInV(LastInV),
myFavoriteIso(FavorIso),
myContInU(ContInU),
myContInV(ContInV),
myPrecisionCode(PrecisCode),
myMaxDegInU(MaxDegInU),
myMaxDegInV(MaxDegInV),
myMaxPatches(MaxPatch),
myDone(Standard_False),
myHasResult(Standard_False),
myCriterionError(0.)
AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(
const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice)
: my1DTolerances (OneDTol),
my2DTolerances (TwoDTol),
my3DTolerances (ThreeDTol),
my1DTolOnFront (OneDTolFr),
my2DTolOnFront (TwoDTolFr),
my3DTolOnFront (ThreeDTolFr),
myFirstParInU (FirstInU),
myLastParInU (LastInU),
myFirstParInV (FirstInV),
myLastParInV (LastInV),
myFavoriteIso (FavorIso),
myContInU (ContInU),
myContInV (ContInV),
myPrecisionCode (PrecisCode),
myMaxDegInU (MaxDegInU),
myMaxDegInV (MaxDegInV),
myMaxPatches (MaxPatch),
myDone (Standard_False),
myHasResult (Standard_False),
myDegreeInU (0),
myDegreeInV (0),
myCriterionError(0.0)
{
myNumSubSpaces[0] = Num1DSS;
myNumSubSpaces[1] = Num2DSS;
myNumSubSpaces[2] = Num3DSS;
Init();
Perform(UChoice, VChoice, Func);
ConvertBS();
@@ -106,54 +109,58 @@ myCriterionError(0.)
//purpose :
//=======================================================================
AdvApp2Var_ApproxAFunc2Var::
AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
const AdvApp2Var_Criterion& Crit,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice) :
my1DTolerances(OneDTol),
my2DTolerances(TwoDTol),
my3DTolerances(ThreeDTol),
my1DTolOnFront(OneDTolFr),
my2DTolOnFront(TwoDTolFr),
my3DTolOnFront(ThreeDTolFr),
myFirstParInU(FirstInU),
myLastParInU(LastInU),
myFirstParInV(FirstInV),
myLastParInV(LastInV),
myFavoriteIso(FavorIso),
myContInU(ContInU),
myContInV(ContInV),
myPrecisionCode(PrecisCode),
myMaxDegInU(MaxDegInU),
myMaxDegInV(MaxDegInV),
myMaxPatches(MaxPatch),
myDone(Standard_False),
myHasResult(Standard_False)
AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(
const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
const AdvApp2Var_Criterion& Crit,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice)
: my1DTolerances (OneDTol),
my2DTolerances (TwoDTol),
my3DTolerances (ThreeDTol),
my1DTolOnFront (OneDTolFr),
my2DTolOnFront (TwoDTolFr),
my3DTolOnFront (ThreeDTolFr),
myFirstParInU (FirstInU),
myLastParInU (LastInU),
myFirstParInV (FirstInV),
myLastParInV (LastInV),
myFavoriteIso (FavorIso),
myContInU (ContInU),
myContInV (ContInV),
myPrecisionCode (PrecisCode),
myMaxDegInU (MaxDegInU),
myMaxDegInV (MaxDegInV),
myMaxPatches (MaxPatch),
myDone (Standard_False),
myHasResult (Standard_False),
myDegreeInU (0),
myDegreeInV (0),
myCriterionError(0.0)
{
myNumSubSpaces[0] = Num1DSS;
myNumSubSpaces[1] = Num2DSS;
myNumSubSpaces[2] = Num3DSS;
Init();
Perform(UChoice, VChoice, Func, Crit);
ConvertBS();

View File

@@ -35,13 +35,6 @@ raises NotDone from StdFail,
is
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~AppBlend_Approx(){Delete() ; }"
IsDone(me)
returns Boolean from Standard
is deferred;
@@ -204,5 +197,6 @@ is
raises NotDone from StdFail
is deferred;
---C++: alias " Standard_EXPORT virtual ~AppBlend_Approx();"
end Approx;

View File

@@ -16,5 +16,10 @@
#include <AppBlend_Approx.ixx>
void AppBlend_Approx::Delete()
{}
//=======================================================================
//function : AppBlend_Approx
//purpose : Destructor
//=======================================================================
AppBlend_Approx::~AppBlend_Approx()
{
}

View File

@@ -54,6 +54,7 @@ public:
return myNbPnt2d;
}
//! Destructor
Standard_EXPORT virtual ~AppCont_Function() {}
//! Returns the first parameter of the function.

View File

@@ -179,6 +179,7 @@ MError3d: Real;
MError2d: Real;
mylambda1: Real;
mylambda2: Real;
myIsLambdaDefined: Boolean;
Done: Boolean;
end BSpGradient from AppParCurves;

View File

@@ -43,9 +43,6 @@
static OSD_Chronometer chr1;
static Standard_Boolean islambdadefined = Standard_False;
static AppParCurves_Constraint FirstConstraint
(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
@@ -104,7 +101,10 @@ AppParCurves_BSpGradient::
const Standard_Real Tol3d,
const Standard_Real Tol2d,
const Standard_Integer NbIterations):
ParError(FirstPoint, LastPoint,0.0)
ParError(FirstPoint, LastPoint,0.0),
mylambda1(0.0),
mylambda2(0.0),
myIsLambdaDefined(Standard_False)
{
Perform(SSP, FirstPoint, LastPoint, TheConstraints, Parameters,
Knots, Mults, Deg, Tol3d, Tol2d, NbIterations);
@@ -125,11 +125,11 @@ AppParCurves_BSpGradient::
const Standard_Integer NbIterations,
const Standard_Real lambda1,
const Standard_Real lambda2):
ParError(FirstPoint, LastPoint,0.0)
ParError(FirstPoint, LastPoint,0.0),
mylambda1(lambda1),
mylambda2(lambda2),
myIsLambdaDefined(Standard_True)
{
mylambda1 = lambda1;
mylambda2 = lambda2;
islambdadefined = Standard_True;
Perform(SSP, FirstPoint, LastPoint, TheConstraints, Parameters,
Knots, Mults, Deg, Tol3d, Tol2d, NbIterations);
}
@@ -207,7 +207,7 @@ void AppParCurves_BSpGradient::
if (FirstCons >= AppParCurves_TangencyPoint ||
LastCons >= AppParCurves_TangencyPoint) {
if (!islambdadefined) {
if (!myIsLambdaDefined) {
AppParCurves_BSpParLeastSquare thefitt(SSP, Knots, Mults, FirstPoint,
LastPoint, FirstCons, LastCons,
Parameters, nbpoles);

View File

@@ -23,7 +23,7 @@ AppParCurves_BSpGradient_BFGS::AppParCurves_BSpGradient_BFGS(math_MultipleVarFun
const Standard_Real Tolerance2d,
const Standard_Real Eps,
const Standard_Integer NbIterations):
math_BFGS(F, Eps, NbIterations, Eps),
math_BFGS(F.NbVariables(), Eps, NbIterations, Eps),
myTol3d(Tolerance3d),
myTol2d(Tolerance2d)
{

View File

@@ -24,7 +24,7 @@ AppParCurves_Gradient_BFGS::AppParCurves_Gradient_BFGS(math_MultipleVarFunctionW
const Standard_Real Tolerance2d,
const Standard_Real Eps,
const Standard_Integer NbIterations ):
math_BFGS(F, Eps, NbIterations, Eps),
math_BFGS(F.NbVariables(), Eps, NbIterations, Eps),
myTol3d(Tolerance3d),
myTol2d(Tolerance2d)
{

View File

@@ -80,11 +80,9 @@ is
returns MultiCurve from AppParCurves
raises ConstructionError from Standard;
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~AppParCurves_MultiCurve(){Delete();}"
---C++: alias " Standard_EXPORT virtual ~AppParCurves_MultiCurve();"
SetNbPoles(me: in out; nbPoles: Integer)
---Purpose: The number of poles of the MultiCurve
-- will be set to <nbPoles>.

View File

@@ -40,8 +40,9 @@ AppParCurves_MultiCurve::AppParCurves_MultiCurve (const AppParCurves_Array1OfMul
}
void AppParCurves_MultiCurve::Delete()
{}
AppParCurves_MultiCurve::~AppParCurves_MultiCurve()
{
}
Standard_Integer AppParCurves_MultiCurve::Dimension (const Standard_Integer Index) const {
Standard_Integer Lo = tabPoint->Lower();

View File

@@ -74,10 +74,8 @@ is
-- NbPoints is the total number of Points.
returns MultiPoint from AppParCurves;
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~AppParCurves_MultiPoint(){Delete();}"
---C++: alias " Standard_EXPORT virtual ~AppParCurves_MultiPoint();"
SetPoint(me: in out; Index: Integer; Point: Pnt)
---Purpose: the 3d Point of range Index of this MultiPoint is

View File

@@ -99,8 +99,9 @@ AppParCurves_MultiPoint::AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tab
}
}
void AppParCurves_MultiPoint::Delete()
{}
AppParCurves_MultiPoint::~AppParCurves_MultiPoint()
{
}
void AppParCurves_MultiPoint::Transform(const Standard_Integer CuIndex,
const Standard_Real x,

View File

@@ -75,7 +75,6 @@ AppParCurves_ResolConstraint::
Standard_Integer myindex, Def = SCurv.NbPoles()-1;
Standard_Integer nb3d, nb2d, Npol= Def+1, Npol2 = 2*Npol;
Standard_Real T1 = 0., T2 = 0., T3, Tmax, Daij;
Standard_Boolean Ok;
gp_Vec V;
gp_Vec2d V2d;
gp_Pnt Poi;
@@ -281,13 +280,13 @@ AppParCurves_ResolConstraint::
case 1: //T1 ~ T1x
{
if (k <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
T1 = V.X();
IP = 3 * Npol;
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k-nb3d);
T1 = V2d.X();
IP = 2 * Npol;
@@ -298,12 +297,12 @@ AppParCurves_ResolConstraint::
case 2: //T1 ~ T1y
{
if (k <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
IP = 3 * Npol;
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k-nb3d);
T1 = V2d.Y();
IP = 2 * Npol;
@@ -313,7 +312,7 @@ AppParCurves_ResolConstraint::
}
case 3: //T1 ~ T1z
{
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
T1 = V.Z();
IP = 3 * Npol;
@@ -328,12 +327,12 @@ AppParCurves_ResolConstraint::
case 1: //T2 ~ T2x
{
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.X();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1-nb3d);
T2 = V2d.X();
}
@@ -343,12 +342,12 @@ AppParCurves_ResolConstraint::
case 2: //T2 ~ T2y
{
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.Y();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1-nb3d);
T2 = V2d.Y();
}
@@ -357,7 +356,7 @@ AppParCurves_ResolConstraint::
}
case 3: //T2 ~ T2z
{
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.Z();
addIndex_2 = 2 * Npol;
@@ -554,7 +553,6 @@ const math_Matrix& AppParCurves_ResolConstraint::
Standard_Integer IP;
Standard_Real Daij;
Npol = Deg+1; Npol2 = 2*Npol;
Standard_Boolean Ok;
TColStd_Array2OfInteger Ibont(1, NbCu, 1, IncTan);
math_Matrix DeCInit(1, IncPass, 1, Npol);
math_Vector DDA(1, Npol);
@@ -601,7 +599,7 @@ const math_Matrix& AppParCurves_ResolConstraint::
Npt = ITan(i);
// MultiPoint MPoint = ToolLine::Value(SSP, Npt);
// choix du maximum de tangence pour exprimer la colinearite:
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
V.Coord(T1, T2, T3);
Tmax = Abs(T1);
@@ -650,7 +648,7 @@ const math_Matrix& AppParCurves_ResolConstraint::
for (i = 1; i <= IncTan; i++) {
Npt = ITan(i);
AppParCurves::SecondDerivativeBernstein(Parameters(Npt), DDA);
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k);
V2d.Coord(T1, T2);
Tmax = Abs(T1);
@@ -682,25 +680,25 @@ const math_Matrix& AppParCurves_ResolConstraint::
Inc3 = Inc3 + 1;
if (Ibont(k, i) == 1) {
if (k <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
T1 = V.X();
IP = 3*Npol;
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k);
T1 = V2d.X();
IP = 2*Npol;
}
if (Ibont(k+1, i) == 1) { // Relations entre T1x et T2x:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.X();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.X();
}
@@ -713,12 +711,12 @@ const math_Matrix& AppParCurves_ResolConstraint::
}
else if (Ibont(k+1, i) == 2) { // Relations entre T1x et T2y:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.Y();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.Y();
}
@@ -743,25 +741,25 @@ const math_Matrix& AppParCurves_ResolConstraint::
}
else if (Ibont(k,i) == 2) {
if (k <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
T1 = V.Y();
IP = 3*Npol;
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k);
T1 = V2d.Y();
IP = 2*Npol;
}
if (Ibont(k+1, i) == 1) { // Relations entre T1y et T2x:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.X();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.X();
}
@@ -775,12 +773,12 @@ const math_Matrix& AppParCurves_ResolConstraint::
}
else if (Ibont(k+1, i) == 2) { // Relations entre T1y et T2y:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.Y();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.Y();
}
@@ -806,18 +804,18 @@ const math_Matrix& AppParCurves_ResolConstraint::
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k);
T1 = V.Z();
IP = 3*Npol;
if (Ibont(k+1, i) == 1) { // Relations entre T1z et T2x:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.X();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.X();
}
@@ -831,12 +829,12 @@ const math_Matrix& AppParCurves_ResolConstraint::
else if (Ibont(k+1, i) == 2) { // Relations entre T1z et T2y:
if ((k+1) <= nb3d) {
Ok = ToolLine::Tangency(SSP, Npt, tabV);
ToolLine::Tangency(SSP, Npt, tabV);
V = tabV(k+1);
T2 = V.Y();
}
else {
Ok = ToolLine::Tangency(SSP, Npt, tabV2d);
ToolLine::Tangency(SSP, Npt, tabV2d);
V2d = tabV2d(k+1);
T2 = V2d.Y();
}

View File

@@ -481,8 +481,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
new_par.Append(lcons);
New_NCONTROL = new_par.Length() - 1;
//simple protection if New_NCONTROL > allocated elements in array
if (New_NCONTROL > aMaxArraySize) {
// Simple protection if New_NCONTROL > allocated elements in array but one
// aMaxArraySize - 1 index may be filled after projection.
if (New_NCONTROL > aMaxArraySize - 1) {
mySameParameter = Standard_False;
return;
}

View File

@@ -936,7 +936,6 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
ApproxInt_TheImpPrmSvSurfaces myImpPrmSvSurfaces(ISurf,PSurf);
Standard_Integer nbpntbez = indicemax-indicemin;
Standard_Address ptrsvsurf = NULL;
Standard_Boolean cut = Standard_True;
if(nbpntbez < LimRajout)
myApproxBez = Standard_False;
@@ -947,7 +946,7 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
cut = Standard_False;
//-- cout<<" ApproxInt : Nb de points = "<<nbpntbez<<" Pas de rajout "<<endl;
}
ptrsvsurf = &myImpPrmSvSurfaces;
Standard_Address ptrsvsurf = &myImpPrmSvSurfaces;
if(nbpntbez < LimRajout) myApproxBez = Standard_False;
@@ -1057,6 +1056,11 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
imax);
if(myApproxBez) {
myComputeLineBezier.Perform(myMultiLine);
#ifdef OCCT_DEBUG
//myMultiLine.Dump();
#endif
if (myComputeLineBezier.NbMultiCurves() == 0)
return;
myTolReached&=myComputeLineBezier.IsToleranceReached();

View File

@@ -116,6 +116,9 @@ is
MakeMLBetween(me; Low,High,NbPointsToInsert: Integer from Standard)
returns MultiLine from ApproxInt is static;
Dump(me);
---Purpose: Dump of the current multi-line.
--------------------------------------------------------------------------------

View File

@@ -613,3 +613,16 @@ const {
}
//======================================================================
void ApproxInt_MultiLine::Dump() const
{
TColgp_Array1OfPnt anArr1(1, 1);
TColgp_Array1OfPnt2d anArr2(1, 2);
for(Standard_Integer ind = FirstPoint(); ind <= LastPoint(); ind++)
{
Value(ind, anArr1, anArr2);
printf("%4d [%+10.20f %+10.20f %+10.20f] [%+10.20f %+10.20f] [%+10.20f %+10.20f]\n",
ind, anArr1(1).X(), anArr1(1).Y(), anArr1(1).Z(), anArr2(1).X(),anArr2(1).Y(),anArr2(2).X(),anArr2(2).Y());
}
}

View File

@@ -127,5 +127,8 @@ is
---C++:inline
returns Status from Approx;
Dump(myclass; ML: TheMultiLine);
---Purpose: Dump of the current multi-line.
end MultiLineTool;

View File

@@ -115,4 +115,9 @@ inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& M
return(ML.MakeMLBetween(I1,I2,NbPMin));
}
inline void ApproxInt_MultiLineTool::Dump(const TheMultiLine& ML)
{
ML.Dump();
}
//================================================================================

View File

@@ -24,9 +24,6 @@ uses
is
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~ApproxInt_SvSurfaces(){Delete() ; }"
Compute(me: in out;
u1,v1,u2,v2: in out Real from Standard;
Pt: out Pnt from gp;
@@ -52,7 +49,9 @@ is
TangencyOnSurf2(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is deferred;
returns Boolean from Standard is deferred;
---C++: alias " Standard_EXPORT virtual ~ApproxInt_SvSurfaces();"
end SvSurfaces;

View File

@@ -14,5 +14,10 @@
#include <ApproxInt_SvSurfaces.ixx>
void ApproxInt_SvSurfaces::Delete()
{}
//=======================================================================
//function : ~ApproxInt_SvSurfaces
//purpose : Destructor
//=======================================================================
ApproxInt_SvSurfaces::~ApproxInt_SvSurfaces()
{
}

View File

@@ -67,9 +67,7 @@ inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode()
//=======================================================================
inline void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue

View File

@@ -49,8 +49,16 @@ is
AddTool (me:out;
theShape: Shape from TopoDS)
---Purpose: Adds Tool argument of the operation
is virtual;
SetTools (me:out;
theShapes: ListOfShape from TopTools)
is virtual;
SetTools (me:out;
theShapes: ListOfShape from BOPCol)
is virtual;
SetOperation(me:out;
theOperation: Operation from BOPAlgo);

View File

@@ -43,6 +43,7 @@
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
typedef NCollection_DataMap
<BOPTools_Set,
@@ -129,6 +130,36 @@ void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theShapes)
{
TopTools_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================

View File

@@ -59,15 +59,18 @@ is
returns PDS from BOPDS;
AddArgument (me:out;
theShape: Shape from TopoDS)
is virtual;
theShape: Shape from TopoDS)
is virtual;
SetArguments(me:out;
theLS:ListOfShape from TopTools);
SetArguments (me:out;
theShapes: ListOfShape from BOPCol)
is virtual;
theLS: ListOfShape from BOPCol)
is virtual;
Arguments(me)
returns ListOfShape from BOPCol;
returns ListOfShape from BOPCol;
---C++: return const &

View File

@@ -26,6 +26,7 @@
#include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function :
@@ -106,10 +107,28 @@ void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theShapes)
{
TopTools_ListIteratorOfListOfShape aIt;
//
myArguments.Clear();
//
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddArgument(aS);
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetArguments(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myArguments.Clear();
//
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
@@ -179,9 +198,7 @@ BOPDS_PDS BOPAlgo_Builder::PDS()
//=======================================================================
void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue

View File

@@ -62,7 +62,7 @@
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <BOPTools.hxx>
#include <BOPTools_CoupleOfShape.hxx>
@@ -247,13 +247,13 @@ class BOPAlgo_FaceSolid : public BOPAlgo_Algo {
typedef BOPCol_NCVector
<BOPAlgo_FaceSolid> BOPAlgo_VectorOfFaceSolid;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_FaceSolid,
BOPAlgo_VectorOfFaceSolid,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_FaceSolidFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_FaceSolidFunctor,
BOPAlgo_VectorOfFaceSolid,
Handle(IntTools_Context)> BOPAlgo_FaceSolidCnt;
@@ -480,7 +480,6 @@ void BOPAlgo_BuilderSolid::PerformLoops()
//=================================================
//
// 2. Post Treatment
Standard_Integer aNbFA;
BRep_Builder aBB;
BOPCol_MapOfOrientedShape AddedFacesMap;
BOPCol_IndexedDataMapOfShapeListOfShape aEFMap;
@@ -520,8 +519,6 @@ void BOPAlgo_BuilderSolid::PerformLoops()
aEFMap.Clear();
AddedFacesMap.Clear();
//
aNbFA=myShapesToAvoid.Extent();
//
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aFF=aItM.Key();
@@ -570,7 +567,7 @@ void BOPAlgo_BuilderSolid::PerformLoops()
void BOPAlgo_BuilderSolid::PerformAreas()
{
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k,aNbHoles;
Standard_Integer k;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPCol_ListOfShape aNewSolids, aHoleShells;
@@ -669,7 +666,7 @@ void BOPAlgo_BuilderSolid::PerformAreas()
aSelector.Clear();
aSelector.SetBox(aBoxSolid);
//
aNbHoles=aBBTree.Select(aSelector);
aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
@@ -767,7 +764,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
}
//
Standard_Boolean bIsInternalFace;
Standard_Integer k, aNbVFS, aNbSLF, aNbVFP, aNbF, aNbA;
Standard_Integer k, aNbVFS, aNbSLF, aNbVFP, aNbA;
BRep_Builder aBB;
TopoDS_Iterator aIt;
TopExp_Explorer aExp;
@@ -856,7 +853,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
aSelector.Clear();
aSelector.SetBox(aBox);
//
aNbF=aBBTree.Select(aSelector);
aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
aItLI.Initialize(aLI);

View File

@@ -36,7 +36,7 @@
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <IntTools_Context.hxx>
//
@@ -138,13 +138,13 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo {
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_PairOfShapeBoolean,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context),
IntTools_Context> BOPCol_BuilderSDFaceFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPCol_BuilderSDFaceFunctor,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context)> BOPAlgo_BuilderSDFaceCnt;
@@ -154,11 +154,11 @@ typedef BOPCol_TBBContextCnt
//
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_BuilderFace,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_BuilderFaceFunctor,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
//
@@ -223,13 +223,13 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
//
typedef BOPCol_NCVector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_VFI,
BOPAlgo_VectorOfVFI,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VFIFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_VFIFunctor,
BOPAlgo_VectorOfVFI,
Handle(IntTools_Context)> BOPAlgo_VFICnt;

View File

@@ -52,7 +52,7 @@
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <IntTools_Context.hxx>
//
@@ -84,11 +84,11 @@ static
typedef BOPCol_NCVector
<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_BuilderSolid,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_BuilderSolidFunctor,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidCnt;
//

View File

@@ -24,7 +24,9 @@ uses
ShapeEnum from TopAbs,
Vertex from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Edge from TopoDS,
ListOfShape from TopTools,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
@@ -81,10 +83,15 @@ is
returns PIterator from BOPDS;
---C++:return const &
SetArguments(me:out;
theLS:ListOfShape from BOPCol);
SetArguments(me:out;
theLS:ListOfShape from TopTools);
Arguments(me)
returns ListOfShape from BOPCol;
---C++: return const &
---C++: alias "Standard_EXPORT void SetArguments(const BOPCol_ListOfShape& theLS);"
Context(me:out)
returns Context from IntTools;
@@ -127,7 +134,6 @@ is
PerformFF(me:out)
is virtual protected;
--modified by NIZNHY-PKV Fri Sep 12 07:05:37 2014f
PerformVZ(me:out)
is virtual protected;
--Purpose: Computes Vertex/Solid interferences
@@ -142,7 +148,6 @@ is
PerformZZ(me:out)
is virtual protected;
--Purpose: Computes Solid/Solid interferences
--modified by NIZNHY-PKV Fri Sep 12 07:05:45 2014t
TreatVerticesEE(me:out)
is protected;
@@ -413,7 +418,8 @@ is
-- state information
UpdateFaceInfo(me:out;
theDME:out DataMapOfPaveBlockListOfPaveBlock from BOPDS)
theDME:out DataMapOfPaveBlockListOfPaveBlock from BOPDS;
theDMV: DataMapOfIntegerInteger from BOPCol)
is protected;
---Purpose:
-- Updates the information about faces

View File

@@ -25,6 +25,7 @@
#include <IntTools_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
@@ -112,6 +113,21 @@ void BOPAlgo_PaveFiller::SetSectionAttribute
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
{
TopTools_ListIteratorOfListOfShape aItLS;
//
myArguments.Clear();
aItLS.Initialize(theLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
myArguments.Append(aS);
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
@@ -130,9 +146,7 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
//=======================================================================
void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue

View File

@@ -44,7 +44,7 @@
void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Boolean bWithSubShape;
Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, iX, k, aNbBlocks;
Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
Handle(NCollection_IncAllocator) aAllocator;
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
@@ -62,9 +62,7 @@
aSIn.SetShapeType(TopAbs_VERTEX);
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
aVVs.SetStartSize(aSize);
aVVs.SetIncrement(aSize);
aVVs.Init();
//
//-----------------------------------------------------scope f
aAllocator=new NCollection_IncAllocator();
@@ -123,8 +121,8 @@
n2=aItLI2.Value();
//
myDS->AddInterf(n1, n2);
iX=aVVs.Append()-1;
BOPDS_InterfVV& aVV=aVVs(iX);
BOPDS_InterfVV& aVV=aVVs.Append1();
//
aVV.SetIndices(n1, n2);
aVV.SetIndexNew(n);
}

View File

@@ -39,7 +39,7 @@
void BOPAlgo_PaveFiller::PerformVZ()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nZ, i;
Standard_Integer iSize, nV, nZ;
Standard_Real aTol;
gp_Pnt aPV;
TopAbs_State aState;
@@ -53,9 +53,7 @@ void BOPAlgo_PaveFiller::PerformVZ()
}
//
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
aVZs.SetStartSize(iSize);
aVZs.SetIncrement(iSize);
aVZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nZ, bJustAdd);
@@ -78,8 +76,7 @@ void BOPAlgo_PaveFiller::PerformVZ()
//
aState=aSC.State();
if (aState==TopAbs_IN) {
i=aVZs.Append()-1;
BOPDS_InterfVZ& aVZ=aVZs(i);
BOPDS_InterfVZ& aVZ=aVZs.Append1();
aVZ.SetIndices(nV, nZ);
//
myDS->AddInterf(nV, nZ);
@@ -92,8 +89,8 @@ void BOPAlgo_PaveFiller::PerformVZ()
//=======================================================================
void BOPAlgo_PaveFiller::PerformEZ()
{
Standard_Boolean bJustAdd, bHasInterf;
Standard_Integer iSize, nE, nZ, i;
Standard_Boolean bJustAdd, bHasInterf;
Standard_Integer iSize, nE, nZ;
//
myErrorStatus=0;
//
@@ -104,9 +101,7 @@ void BOPAlgo_PaveFiller::PerformEZ()
}
//
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
aEZs.SetStartSize(iSize);
aEZs.SetIncrement(iSize);
aEZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nZ, bJustAdd);
@@ -124,8 +119,7 @@ void BOPAlgo_PaveFiller::PerformEZ()
continue;
}
//
i=aEZs.Append()-1;
BOPDS_InterfEZ& aEZ=aEZs(i);
BOPDS_InterfEZ& aEZ=aEZs.Append1();
aEZ.SetIndices(nE, nZ);
//
myDS->AddInterf(nE, nZ);
@@ -138,7 +132,7 @@ void BOPAlgo_PaveFiller::PerformEZ()
void BOPAlgo_PaveFiller::PerformFZ()
{
Standard_Boolean bJustAdd, bHasInterf;
Standard_Integer iSize, nF, nZ, i;
Standard_Integer iSize, nF, nZ;
//
myErrorStatus=0;
//
@@ -149,9 +143,7 @@ void BOPAlgo_PaveFiller::PerformFZ()
}
//
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
aFZs.SetStartSize(iSize);
aFZs.SetIncrement(iSize);
aFZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF, nZ, bJustAdd);
@@ -169,8 +161,7 @@ void BOPAlgo_PaveFiller::PerformFZ()
continue;
}
//
i=aFZs.Append()-1;
BOPDS_InterfFZ& aFZ=aFZs(i);
BOPDS_InterfFZ& aFZ=aFZs.Append1();
aFZ.SetIndices(nF, nZ);
//
myDS->AddInterf(nF, nZ);
@@ -183,7 +174,7 @@ void BOPAlgo_PaveFiller::PerformFZ()
void BOPAlgo_PaveFiller::PerformZZ()
{
Standard_Boolean bJustAdd, bHasInterf, bFlag;
Standard_Integer iSize, nZ1, nZ, i;
Standard_Integer iSize, nZ1, nZ;
//
myErrorStatus=0;
//
@@ -194,9 +185,7 @@ void BOPAlgo_PaveFiller::PerformZZ()
}
//
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
aZZs.SetStartSize(iSize);
aZZs.SetIncrement(iSize);
aZZs.Init();
//
bFlag=Standard_False;
//
@@ -214,8 +203,7 @@ void BOPAlgo_PaveFiller::PerformZZ()
continue;
}
//
i=aZZs.Append()-1;
BOPDS_InterfZZ& aZZ=aZZs(i);
BOPDS_InterfZZ& aZZ=aZZs.Append1();
aZZ.SetIndices(nZ1, nZ);
//
myDS->AddInterf(nZ1, nZ);

View File

@@ -22,7 +22,7 @@
#include <BRep_Tool.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <IntTools_Context.hxx>
@@ -118,13 +118,13 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
typedef BOPCol_NCVector
<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_VertexEdge,
BOPAlgo_VectorOfVertexEdge,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexEdgeFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_VertexEdgeFunctor,
BOPAlgo_VectorOfVertexEdge,
Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
@@ -136,7 +136,7 @@ typedef BOPCol_TBBContextCnt
void BOPAlgo_PaveFiller::PerformVE()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i, k, aNbVE;;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
Standard_Real aT, aTolE, aTolV;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
@@ -153,9 +153,7 @@ void BOPAlgo_PaveFiller::PerformVE()
}
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aVEs.SetStartSize(iSize);
aVEs.SetIncrement(iSize);
aVEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nE, bJustAdd);
@@ -213,8 +211,7 @@ void BOPAlgo_PaveFiller::PerformVE()
const TopoDS_Vertex& aV=aVESolver.Vertex();
const TopoDS_Edge& aE=aVESolver.Edge();
// 1
i=aVEs.Append()-1;
BOPDS_InterfVE& aVE=aVEs(i);
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2

View File

@@ -47,7 +47,7 @@
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <IntTools_Context.hxx>
#include <IntTools_ShrunkRange.hxx>
@@ -116,11 +116,11 @@ class BOPAlgo_EdgeEdge :
typedef BOPCol_NCVector
<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_EdgeEdge,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_EdgeEdgeFunctor,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
//
@@ -163,11 +163,11 @@ class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
typedef BOPCol_NCVector
<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_TNV,
BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_TNVFunctor,
BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
/////////////////////////////////////////////////////////////////////////
@@ -254,13 +254,13 @@ class BOPAlgo_PVE {
typedef BOPCol_NCVector
<BOPAlgo_PVE> BOPAlgo_VectorOfPVE;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_PVE,
BOPAlgo_VectorOfPVE,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_PVEFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_PVEFunctor,
BOPAlgo_VectorOfPVE,
Handle(IntTools_Context)> BOPAlgo_PVECnt;
@@ -298,9 +298,7 @@ void BOPAlgo_PaveFiller::PerformEE()
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aEEs.SetStartSize(iSize);
aEEs.SetIncrement(iSize);
aEEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE1, nE2, bJustAdd);
@@ -489,10 +487,10 @@ void BOPAlgo_PaveFiller::PerformEE()
continue;
}
}
//
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
BOPDS_InterfEE& aEE=aEEs.Append1();
iX=aEEs.Extent()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
@@ -517,8 +515,8 @@ void BOPAlgo_PaveFiller::PerformEE()
break;
}
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
BOPDS_InterfEE& aEE=aEEs.Append1();
iX=aEEs.Extent()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
@@ -911,7 +909,7 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
aNbPnt = aProjector.NbPoints();
if (aNbPnt) {
Standard_Real aT, aDist;
Standard_Integer i;
//Standard_Integer i;
BRep_Builder aBB;
BOPDS_Pave aPave;
//
@@ -919,12 +917,7 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
aT=aProjector.LowerDistanceParameter();
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
if (aVEs.Extent() == 0) {
aVEs.Init();
}
//
i=aVEs.Append()-1;
BOPDS_InterfVE& aVE=aVEs(i);
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
//

View File

@@ -27,7 +27,7 @@
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <IntTools_Context.hxx>
//
@@ -125,13 +125,13 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
typedef BOPCol_NCVector<BOPAlgo_VertexFace>
BOPAlgo_VectorOfVertexFace;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_VertexFace,
BOPAlgo_VectorOfVertexFace,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexFaceFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_VertexFaceFunctor,
BOPAlgo_VectorOfVertexFace,
Handle(IntTools_Context)> BOPAlgo_VertexFaceCnt;
@@ -143,7 +143,7 @@ typedef BOPCol_TBBContextCnt
void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i, aNbVF, k;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB;
BOPAlgo_VectorOfVertexFace aVVF;
@@ -155,9 +155,7 @@ void BOPAlgo_PaveFiller::PerformVF()
if (iSize) {
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
aVFs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
@@ -214,8 +212,7 @@ void BOPAlgo_PaveFiller::PerformVF()
const TopoDS_Vertex& aV=aVertexFace.Vertex();
const TopoDS_Face& aF=aVertexFace.Face();
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
@@ -238,9 +235,7 @@ void BOPAlgo_PaveFiller::PerformVF()
else {
iSize=10;
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
aVFs.Init();
}
//
TreatVerticesEE();
@@ -251,7 +246,7 @@ void BOPAlgo_PaveFiller::PerformVF()
//=======================================================================
void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
Standard_Integer i, aNbS,aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2;
BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_IncAllocator) aAllocator;
@@ -315,8 +310,8 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
if (!iFlag) {
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
BOPDS_InterfVF& aVF=aVFs.Append1();
i=aVFs.Extent()-1;
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2

View File

@@ -38,7 +38,7 @@
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
//
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
@@ -119,13 +119,13 @@ class BOPAlgo_EdgeFace :
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_EdgeFace,
BOPAlgo_VectorOfEdgeFace,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_EdgeFaceFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_EdgeFaceFunctor,
BOPAlgo_VectorOfEdgeFace,
Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
@@ -169,9 +169,7 @@ void BOPAlgo_PaveFiller::PerformEF()
aDeflection=0.01;
//
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
aEFs.SetStartSize(iSize);
aEFs.SetIncrement(iSize);
aEFs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nF, bJustAdd);
@@ -297,10 +295,10 @@ void BOPAlgo_PaveFiller::PerformEF()
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
bV[1]=CheckFacePaves(nV[1], aMIFOn, aMIFIn);
if (bV[0] && bV[1]) {
iX=aEFs.Append()-1;
IntTools_CommonPrt aCP = aCPart;
aCP.SetType(TopAbs_EDGE);
BOPDS_InterfEF& aEF=aEFs(iX);
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCP);
myDS->AddInterf(nE, nF);
@@ -344,8 +342,8 @@ void BOPAlgo_PaveFiller::PerformEF()
//
aMIEFC.Add(nF);
// 1
iX=aEFs.Append()-1;
BOPDS_InterfEF& aEF=aEFs(iX);
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCPart);
// 2
@@ -363,8 +361,8 @@ void BOPAlgo_PaveFiller::PerformEF()
aMIEFC.Add(nF);
//
// 1
iX=aEFs.Append()-1;
BOPDS_InterfEF& aEF=aEFs(iX);
BOPDS_InterfEF& aEF=aEFs.Append1();
iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
//
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
@@ -637,16 +635,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
gp_Pnt2d aP2d(U, V);
bRet = myContext->IsPointInFace (aF, aP2d);
if (bRet) {
Standard_Integer i;
//Standard_Integer i;
BRep_Builder aBB;
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
if (aVFs.Extent() == 0) {
aVFs.Init();
}
//
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
//

View File

@@ -32,11 +32,14 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
@@ -48,7 +51,10 @@
#include <IntTools_SequenceOfPntOn2Faces.hxx>
#include <IntTools_Curve.hxx>
#include <IntTools_PntOn2Faces.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_EdgeFace.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <IntSurf_PntOn2S.hxx>
@@ -63,10 +69,7 @@
#include <BOPCol_IndexedMapOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerReal.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
@@ -85,12 +88,9 @@
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BOPDS_FaceInfo.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
static void ToleranceFF(const BRepAdaptor_Surface& aBAS1,
const BRepAdaptor_Surface& aBAS2,
@@ -168,11 +168,11 @@ class BOPAlgo_FaceFace :
typedef BOPCol_NCVector
<BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_FaceFace,
BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_FaceFaceFunctor,
BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceCnt;
/////////////////////////////////////////////////////////////////////////
@@ -195,7 +195,7 @@ void BOPAlgo_PaveFiller::PerformFF()
//
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit, bTangentFaces;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
Standard_Integer aNbFaceFace, k;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
BRepAdaptor_Surface aBAS1, aBAS2;
@@ -203,9 +203,7 @@ void BOPAlgo_PaveFiller::PerformFF()
BOPAlgo_VectorOfFaceFace aVFaceFace;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aFFs.SetStartSize(iSize);
aFFs.SetIncrement(iSize);
aFFs.Init();
//
bApp=mySectionAttribute.Approximation();
bCompC2D1=mySectionAttribute.PCurveOnS1();
@@ -241,8 +239,7 @@ void BOPAlgo_PaveFiller::PerformFF()
bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
myDS->AddInterf(nF1, nF2);
iX=aFFs.Append()-1;
BOPDS_InterfFF& aFF=aFFs(iX);
BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.Init(0, 0);
continue;
@@ -304,8 +301,7 @@ void BOPAlgo_PaveFiller::PerformFF()
myDS->AddInterf(nF1, nF2);
}
//
iX=aFFs.Append()-1;
BOPDS_InterfFF& aFF=aFFs(iX);
BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
//
aFF.SetTolR3D(aTolR3D);
@@ -324,8 +320,7 @@ void BOPAlgo_PaveFiller::PerformFF()
const Handle(Geom_Curve)& aC3D= aIC.Curve();
bValid=IntTools_Tools::CheckCurve(aC3D, aTolR3D, aBox);
if (bValid) {
iC=aVNC.Append()-1;
BOPDS_Curve& aNC=aVNC(iC);
BOPDS_Curve& aNC=aVNC.Append1();
aNC.SetCurve(aIC);
aNC.SetBox(aBox);
}
@@ -337,15 +332,13 @@ void BOPAlgo_PaveFiller::PerformFF()
const IntTools_PntOn2Faces& aPi=aPntsX(i);
const gp_Pnt& aP=aPi.P1().Pnt();
//
iP=aVNP.Append()-1;
BOPDS_Point& aNP=aVNP(iP);
BOPDS_Point& aNP=aVNP.Append1();
aNP.SetPnt(aP);
}
//}// if (aNbCs || aNbPs)
}// if (bIsDone) {
else {// 904/L1
iX=aFFs.Append()-1;
BOPDS_InterfFF& aFF=aFFs(iX);
BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aNbCurves=0;
aNbPoints=0;
@@ -597,7 +590,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
}
//
// update face info
UpdateFaceInfo(aDMExEdges);
UpdateFaceInfo(aDMExEdges, aDMI);
//Update all pave blocks
UpdatePaveBlocks(aDMI);
//-----------------------------------------------------scope t
@@ -754,7 +747,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
if (!bHasPaveBlocks) {
if (bOld) {
aDMExEdges.ChangeFind(aPB1).Append(aPB1);
} else {
}
else {
aSI.SetShapeType(aType);
aSI.SetShape(aSx);
iE=myDS->Append(aSI);
@@ -894,12 +888,13 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateFaceInfo
(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME,
const BOPCol_DataMapOfIntegerInteger& theDMV)
{
Standard_Integer i, j, nV1, nF1, nF2,
aNbFF, aNbC, aNbP, aNbS, aNbPBIn;
BOPDS_IndexedMapOfPaveBlock aMPBCopy;
aNbFF, aNbC, aNbP;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMF;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
@@ -912,6 +907,7 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
//
// 1.1. Section edges
BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
aNbC=aVNC.Extent();
for (j=0; j<aNbC; ++j) {
@@ -919,21 +915,24 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
aItLPB.Initialize(aLPBC);
//
// Treat existing pave blocks
if (aItLPB.More() && theDME.IsBound(aLPBC.First())) {
const Handle(BOPDS_PaveBlock)& aPB=aLPBC.First();
BOPDS_ListOfPaveBlock& aLPB = theDME.ChangeFind(aPB);
BOPDS_ListOfPaveBlock& aLPB=theDME.ChangeFind(aPB);
UpdateExistingPaveBlocks(aPB, aLPB, nF1, nF2);
aLPBC.Clear();
continue;
}
//
for(; aItLPB.More(); aItLPB.Next()) {
// Add section edges to face info
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
aFI1.ChangePaveBlocksSc().Add(aPB);
aFI2.ChangePaveBlocksSc().Add(aPB);
}
}
// VerticesSc
//
// 1.2. Section vertices
const BOPDS_VectorOfPoint& aVNP=aFF.Points();
aNbP=aVNP.Extent();
for (j=0; j<aNbP; ++j) {
@@ -945,43 +944,81 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
aFI1.ChangeVerticesSc().Add(nV1);
aFI2.ChangeVerticesSc().Add(nV1);
}
//
aMF.Add(nF1);
aMF.Add(nF2);
}
//
//2. PaveBlocksIn
if (theDME.IsEmpty()) {
Standard_Boolean bVerts, bEdges;
//
bVerts = theDMV.Extent() > 0;
bEdges = theDME.Extent() > 0;
//
if (!bVerts && !bEdges) {
return;
}
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
if (aSI.ShapeType()!=TopAbs_FACE) {
continue;
}
if(!myDS->HasFaceInfo(i)) {
continue;
}
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(i);
// 2. Update Face Info information with new vertices and new
// pave blocks created in PostTreatFF from existing ones
Standard_Integer nV2, aNbPB;
BOPCol_MapIteratorOfMapOfInteger aItMF;
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItMV;
//
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
nF1 = aItMF.Value();
//
BOPDS_IndexedMapOfPaveBlock& aMPBIn=aFI.ChangePaveBlocksIn();
aMPBCopy.Assign(aMPBIn);
aMPBIn.Clear();
BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(nF1);
//
aNbPBIn=aMPBCopy.Extent();
for (j=1; j<=aNbPBIn; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j);
if (theDME.IsBound(aPB)) {
const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value();
aMPBIn.Add(aPB1);
// 2.1. Update information about vertices
if (bVerts) {
BOPCol_MapOfInteger& aMVOn = aFI.ChangeVerticesOn();
BOPCol_MapOfInteger& aMVIn = aFI.ChangeVerticesIn();
//
aItMV.Initialize(theDMV);
for (; aItMV.More(); aItMV.Next()) {
nV1 = aItMV.Key();
nV2 = aItMV.Value();
//
if (aMVOn.Remove(nV1)) {
aMVOn.Add(nV2);
}
} else {
aMPBIn.Add(aPB);
}
}//for (j=1; j<=aNbPBIn; ++j) {
}//for (i=0; i<aNbS; ++i) {
//
if (aMVIn.Remove(nV1)) {
aMVIn.Add(nV2);
}
} // for (; aItMV.More(); aItMV.Next()) {
} // if (bVerts) {
//
// 2.2. Update information about pave blocks
if (bEdges) {
BOPDS_IndexedMapOfPaveBlock& aMPBOn = aFI.ChangePaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn = aFI.ChangePaveBlocksIn();
//
BOPDS_IndexedMapOfPaveBlock aMPBCopy;
for (i = 0; i < 2; ++i) {
BOPDS_IndexedMapOfPaveBlock& aMPBOnIn = !i ? aMPBOn : aMPBIn;
aMPBCopy = aMPBOnIn;
aMPBOnIn.Clear();
//
aNbPB = aMPBCopy.Extent();
for (j = 1; j <= aNbPB; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j);
if (theDME.IsBound(aPB)) {
const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value();
aMPBOnIn.Add(aPB1);
}
}
else {
aMPBOnIn.Add(aPB);
}
} // for (j = 1; j <= aNbPB; ++j) {
} // for (i = 0; i < 2; ++i) {
} // if (bEdges) {
}
}
//=======================================================================
//function : IsExistingVertex
@@ -1511,20 +1548,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
return;
}
//
GeomAbs_SurfaceType aType1, aType2;
Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
Handle(Geom_Surface) aS2=BRep_Tool::Surface(aF2);
GeomAdaptor_Surface aGAS1(aS1);
GeomAdaptor_Surface aGAS2(aS2);
//
aType1=aGAS1.GetType();
aType2=aGAS2.GetType();
//
//if (aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
GeomAbs_CurveType aTypeC;
//
const IntTools_Curve& aIC=aNC.Curve();
aTypeC=aIC.Type();
//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
Handle(Geom2d_Curve) aC2D[2];
//
@@ -1807,9 +1834,8 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
Handle(BOPDS_PaveBlock) aPB, aPB1, aPB2, aPB2n;
Handle(BOPDS_CommonBlock) aCB;
BOPDS_ListIteratorOfListOfPaveBlock aIt, aIt1, aIt2;
BOPDS_IndexedMapOfPaveBlock aMPB;
//
//remove micro edges from aLPB
// 1. Remove micro edges from aLPB
aIt.Initialize(aLPB);
for (; aIt.More();) {
aPB = aIt.Value();
@@ -1824,10 +1850,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
if (!aLPB.Extent()) {
return;
}
//update face info
myDS->UpdateFaceInfoOn(nF1);
//
myDS->UpdateFaceInfoOn(nF2);
//
BOPDS_FaceInfo& aFI1 = myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2 = myDS->ChangeFaceInfo(nF2);
@@ -1837,7 +1859,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
BOPDS_IndexedMapOfPaveBlock& aMPBOn2 = aFI2.ChangePaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
//
// remove old pave blocks
// 2. Remove old pave blocks
const Handle(BOPDS_CommonBlock)& aCB1 = myDS->CommonBlock(aPBf);
bCB = !aCB1.IsNull();
BOPDS_ListOfPaveBlock aLPB1;
@@ -1863,8 +1885,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
}
}
//
// 3. Update pave blocks
if (bCB) {
//create new pave blocks
//create new common blocks
const BOPCol_ListOfInteger& aFaces = aCB1->Faces();
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
@@ -1891,55 +1914,66 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
aPB=aCB->PaveBlocks().First();
}
}
//
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aIt.ChangeValue();
nE = aPB->OriginalEdge();
//
Standard_Integer nF = (aMPBOn1.Contains(aPBf) ||
aMPBIn1.Contains(aPBf)) ? nF2 : nF1;
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
IntTools_Range aShrR(aPB->Pave1().Parameter(),
aPB->Pave2().Parameter());
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
//
Standard_Boolean bCom =
BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
aCB->AddFace(nF);
} else {
aCB = new BOPDS_CommonBlock;
aCB->AddPaveBlock(aPB);
aCB->AddFace(nF1);
aCB->AddFace(nF2);
//
myDS->SetCommonBlock(aPB, aCB);
}
aMPB.Add(aPB);
}
if (!bCB) {
myDS->ChangePaveBlocks(nE).Append(aPB);
else {
nE = aPBf->OriginalEdge();
BOPDS_ListOfPaveBlock& aLPBE = myDS->ChangePaveBlocks(nE);
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
aPB = aIt.Value();
aLPBE.Append(aPB);
}
}
//
Standard_Integer i, aNbPB;
Standard_Boolean bIn1, bIn2;
//
bIn1 = aMPBOn1.Contains(aPBf) || aMPBIn1.Contains(aPBf);
bIn2 = aMPBOn2.Contains(aPBf) || aMPBIn2.Contains(aPBf);
//
aNbPB=aMPB.Extent();
for (i=1; i<=aNbPB; ++i) {
aPB = aMPB(i);
if (!bIn1) {
aMPBIn1.Add(aPB);
}
if (bIn1 && bIn2) {
return;
}
//
// 4. Check new pave blocks for coincidence
// with the opposite face.
// In case of coincidence create common blocks
Standard_Integer nF;
Standard_Real aTolE, aTolF;
//
nF = bIn1 ? nF2 : nF1;
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
BOPDS_IndexedMapOfPaveBlock& aMPBIn = bIn1 ? aMPBIn2 : aMPBIn1;
aTolF = BRep_Tool::Tolerance(aF);
//
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aIt.ChangeValue();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
aTolE = BRep_Tool::Tolerance(aE);
//
if (!bIn2) {
aMPBIn2.Add(aPB);
IntTools_EdgeFace anEF;
anEF.SetEdge(aE);
anEF.SetFace(aF);
anEF.SetTolE(aTolE);
anEF.SetTolF(aTolF);
anEF.SetRange(aPB->Pave1().Parameter(), aPB->Pave2().Parameter());
anEF.SetContext(myContext);
anEF.Perform();
//
const IntTools_SequenceOfCommonPrts& aCPrts=anEF.CommonParts();
if (aCPrts.Length() == 1) {
Standard_Boolean bCoinc = (aCPrts(1).Type() == TopAbs_EDGE);
if (bCoinc) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
} else {
aCB = new BOPDS_CommonBlock;
aCB->AddPaveBlock(aPB);
myDS->SetCommonBlock(aPB, aCB);
}
aCB->AddFace(nF);
//
aMPBIn.Add(aPB);
}
}
}
}
@@ -2009,9 +2043,10 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_VectorOfCurve& aVC)
{
Standard_Integer nV1, nV2;
Standard_Integer nV1, nV2, iC;
//
Standard_Integer iC=aVC.Append()-1;
aVC.Append1();
iC=aVC.Extent()-1;
BOPDS_ListOfPaveBlock& aLPBC = aVC(iC).ChangePaveBlocks();
aLPBC.Append(aPB);
//

View File

@@ -41,7 +41,7 @@
#include <Geom2d_Curve.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
@@ -153,11 +153,11 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
typedef BOPCol_NCVector
<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_SplitEdge,
BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_SplitEdgeFunctor,
BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeCnt;
//
@@ -220,11 +220,11 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
typedef BOPCol_NCVector
<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_MPC,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_MPCFunctor,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCCnt;
//
@@ -260,11 +260,11 @@ class BOPAlgo_BPC {
typedef BOPCol_NCVector
<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_BPC,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_BPCFunctor,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCCnt;
//

View File

@@ -21,7 +21,7 @@
#include <BOPCol_NCVector.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -75,13 +75,13 @@ class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
typedef BOPCol_NCVector
<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
//
typedef BOPCol_TBBContextFunctor
typedef BOPCol_ContextFunctor
<BOPAlgo_ShrunkRange,
BOPAlgo_VectorOfShrunkRange,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
//
typedef BOPCol_TBBContextCnt
typedef BOPCol_ContextCnt
<BOPAlgo_ShrunkRangeFunctor,
BOPAlgo_VectorOfShrunkRange,
Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;

View File

@@ -25,7 +25,7 @@
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
//
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_MapOfOrientedShape.hxx>
@@ -77,11 +77,11 @@ class BOPAlgo_CBK {
typedef BOPCol_NCVector
<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
//
typedef BOPCol_TBBFunctor
typedef BOPCol_Functor
<BOPAlgo_CBK,
BOPAlgo_VectorOfCBK> BOPAlgo_CBKFunctor;
//
typedef BOPCol_TBBCnt
typedef BOPCol_Cnt
<BOPAlgo_CBKFunctor,
BOPAlgo_VectorOfCBK> BOPAlgo_CBKCnt;
//

View File

@@ -28,7 +28,7 @@
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPTools.hxx>
@@ -262,56 +262,47 @@ typedef BOPCol_NCVector<BOPTools_ConnexityBlock> \
//class : WireSplitterFunctor
//purpose :
//=======================================================================
class BOPAlgo_WireSplitterFunctor {
protected:
class BOPAlgo_WireSplitterFunctor
{
protected:
TopoDS_Face myFace;
BOPTools_VectorOfConnexityBlock* myPVCB;
//
public:
public:
//
BOPAlgo_WireSplitterFunctor(const TopoDS_Face& aF,
BOPTools_VectorOfConnexityBlock& aVCB)
: myFace(aF), myPVCB(&aVCB) {
BOPTools_VectorOfConnexityBlock& aVCB)
: myFace(aF), myPVCB(&aVCB)
{
}
//
void operator()( const flexible_range<Standard_Size>& aBR ) const{
Standard_Size i, iBeg, iEnd;
//
BOPTools_VectorOfConnexityBlock& aVCB=*myPVCB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPTools_ConnexityBlock& aCB=aVCB((Standard_Integer)i);
//
BOPAlgo_WireSplitter::SplitBlock(myFace, aCB);
}
void operator()( const Standard_Integer& theIndex ) const
{
BOPTools_VectorOfConnexityBlock& aVCB = *myPVCB;
BOPTools_ConnexityBlock& aCB = aVCB(theIndex);
BOPAlgo_WireSplitter::SplitBlock(myFace, aCB);
}
};
//=======================================================================
//class : BOPAlgo_WireSplitterCnt
//purpose :
//=======================================================================
class BOPAlgo_WireSplitterCnt {
public:
class BOPAlgo_WireSplitterCnt
{
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
const TopoDS_Face& aF,
BOPTools_VectorOfConnexityBlock& aVCB) {
static void Perform(const Standard_Boolean bRunParallel,
const TopoDS_Face& aF,
BOPTools_VectorOfConnexityBlock& aVCB)
{
//
BOPAlgo_WireSplitterFunctor aWSF(aF, aVCB);
Standard_Size aNbVCB=aVCB.Extent();
Standard_Integer aNbVCB = aVCB.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Size>(0,aNbVCB), aWSF);
}
else {
aWSF.operator()(flexible_range<Standard_Size>(0,aNbVCB));
}
OSD_Parallel::For(0, aNbVCB, aWSF, !bRunParallel);
}
//
};
//=======================================================================
//function : MakeWires

View File

@@ -14,10 +14,10 @@
package BOPCol
---Purpose:
-- The package contains collection classes
-- that are used by
-- partition and boolean operation algorithms
---Purpose:
-- The package contains collection classes
-- that are used by
-- partition and boolean operation algorithms
uses
TCollection
@@ -37,7 +37,6 @@ is
imported DataMapOfShapeAddress from BOPCol;
imported DataMapOfTransientAddress from BOPCol;
imported PListOfInteger from BOPCol;
imported VectorOfInteger from BOPCol;
imported MapOfShape from BOPCol;
imported DataMapOfShapeShape from BOPCol;
imported DataMapOfShapeListOfShape from BOPCol;

View File

@@ -1,427 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BOPCol_Array1_HeaderFile
#define BOPCol_Array1_HeaderFile
#include <NCollection_List.hxx>
#include <Standard.hxx>
#include <NCollection_BaseAllocator.hxx>
/**
* Class BOPCol_Array1 (dynamic array of objects)
*
* 1. The Array1 uses the allocator (in terms of NCollection_BaseAllocator)
* to allocate the memory.
* 2. The memory is allocated as a list of memory blocks. The size of the first
* block is myStartSize. The size of the other blocks is myIncrement
* 3 The Array1 is created with 0 length.
* 4. The Array1 must be initiated by invoke the method Init().
* Init() allocates the memory block for initial myStartSize elements.
* 5. The elements can be added by the method Append(theElement). the method
* Append(theElement) arranges theElement in
* a) previously allocated memory block (if it is possible)
* b) new allocated memory block (otherwise). The size of new blocks to
* allocate can be set [once only] by the method SetIncrement(theSize).
* 6. The contents of the element with index "i" can be queried or modified
* by the methods
* SetValue(i, theElement), Value(i), ChangeValue(i), operator()(i)
*/
//=======================================================================
//class : MemBlock
//
//=======================================================================
template <class Type> class BOPCol_MemBlock {
public:
// Ctor
BOPCol_MemBlock(const Handle(NCollection_BaseAllocator)& theAllocator) {
myI1=0;
myI2=0;
mySize=0;
myData=NULL;
myAllocator=theAllocator;
myNext=NULL;
}
// ~
~BOPCol_MemBlock(){
Clear();
}
// Clear
void Clear() {
if (myData) {
//Standard_Integer i;
Standard_Size i;
//
for (i=0; i<mySize; ++i) {
myData[i].~Type();
}
myAllocator->Free(myData);
//
myData=NULL;
mySize=0;
myNext=NULL;
}
}
// Allocate
void Allocate(const Standard_Size theSize) {
//Standard_Integer i;
Standard_Size i;
//
Clear();
mySize=theSize;
myData=(Type*)myAllocator->Allocate(theSize*sizeof(Type));
for (i=0; i<mySize; ++i) {
#ifdef BOPCol_Array1_Use_Allocator
new (myData+i) Type (myAllocator);
#else
new (myData+i) Type;
#endif
}
}
// SetRange
void SetRange(const Standard_Integer theI1,
const Standard_Integer theI2) {
myI1=theI1;
myI2=theI2;
}
// Range
void Range(Standard_Integer& theI1,
Standard_Integer& theI2) const {
theI1=myI1;
theI2=myI2;
}
// Contains
Standard_Boolean Contains(const Standard_Integer theIndex)const {
return (theIndex>=myI1 && theIndex<=myI2);
}
// SetValue
void SetValue(const Standard_Integer theIndex,
const Type& theValue) {
*(myData+theIndex-myI1)=theValue;
}
// Value
const Type& Value(const Standard_Integer theIndex)const {
return *(myData+theIndex-myI1);
}
// ChangeValue
Type& ChangeValue(const Standard_Integer theIndex) {
return *(myData+theIndex-myI1);
}
// SetNext
void SetNext(BOPCol_MemBlock<Type>* pNext) {
myNext=pNext;
}
// Next
BOPCol_MemBlock<Type>* Next() {
return myNext;
}
//
public:
BOPCol_MemBlock<Type>* myNext;
protected:
Standard_Integer myI1;
Standard_Integer myI2;
Standard_Size mySize;
Type *myData;
Handle(NCollection_BaseAllocator) myAllocator;
};
//=======================================================================
//class : BOPCol_Array1
//
//=======================================================================
template <class Type> class BOPCol_Array1 {
public:
typedef BOPCol_MemBlock<Type>* BOPCol_PMemBlock;
typedef BOPCol_MemBlock<Type> BOPCol_XMemBlock;
//=========
// Ctor
BOPCol_Array1(const Handle(NCollection_BaseAllocator)& theAllocator=0L) {
myStartSize=32;
myIncrement=8;
myExtent=0;
myPBlock=NULL;
myPBlock1=NULL;
//
if (theAllocator.IsNull()) {
myAllocator = NCollection_BaseAllocator::CommonBaseAllocator();
}
else {
myAllocator=theAllocator;
}
}
// ~
~BOPCol_Array1() {
Clear();
}
//===========
// Clear
void Clear() {
BOPCol_PMemBlock pBlock, pNext;
//
pBlock=myPBlock1;
while(pBlock) {
pNext=pBlock->Next();
//
pBlock->~BOPCol_XMemBlock();
myAllocator->Free(pBlock);
//
pBlock=pNext;
}
myPBlock1=NULL;
myPBlock=NULL;
myExtent=0;
}
// SetStartSize
void SetStartSize(const Standard_Integer theSize) {
if (theSize>0) {
myStartSize=theSize;
}
}
// SetIncrement
void SetIncrement(const Standard_Integer theSize){
if (theSize>0) {
myIncrement=theSize;
}
}
// Increment
Standard_Integer Increment()const {
return myIncrement;
}
// Extent
Standard_Integer Extent()const {
return myExtent;
}
// Size
Standard_Integer Size()const {
return myExtent;
}
// Size
Standard_Integer Length()const {
return myExtent;
}
// Init
void Init();
// Append(const Type& theValue)
Standard_Integer Append(const Type& theValue);
// Append()
Standard_Integer Append();
// SetValue
void SetValue(const Standard_Integer theIndex,
const Type& theValue);
// Value
const Type& operator()(const Standard_Integer theIndex)const;
//
const Type& Value(const Standard_Integer theIndex)const;
// ChangeValue
Type& operator()(const Standard_Integer theIndex);
//
Type& ChangeValue(const Standard_Integer theIndex);
//
// protected
protected:
//===========
//FindBlock
Standard_Boolean FindBlock(const Standard_Integer theIndex)const ;
//Copy ctor
BOPCol_Array1(const BOPCol_Array1&);
//Assign operator
BOPCol_Array1& operator =(const BOPCol_Array1& theOther);
//==========
// fields
protected:
Standard_Integer myStartSize;
Standard_Integer myIncrement;
Standard_Integer myExtent;
Type myDfltItem;
BOPCol_MemBlock<Type> * myPBlock;
BOPCol_MemBlock<Type> * myPBlock1;
Handle(NCollection_BaseAllocator) myAllocator;
};
//
//=======================================================================
//function : Init
//purpose :
//=======================================================================
template <class Type>
void BOPCol_Array1<Type>::Init() {
BOPCol_PMemBlock pBlock;
//
pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
//
pBlock->Allocate(myStartSize);
pBlock->SetRange(0, myStartSize-1);
myPBlock1=pBlock;
myPBlock=pBlock;
}
//=======================================================================
//function : Append
//purpose :
//=======================================================================
template <class Type>
Standard_Integer BOPCol_Array1<Type>::Append(const Type& theValue) {
BOPCol_PMemBlock pBlock, pNext;
//
pBlock=myPBlock1;
for(;;) {
pNext=pBlock->myNext;
if(!pNext) {
myPBlock=pBlock;
break;
}
pBlock=pNext;
}
//
if (!myPBlock->Contains(myExtent)) {
//
pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
//
pBlock->Allocate(myIncrement);
pBlock->SetRange(myExtent, myExtent+myIncrement-1);
//
myPBlock->myNext=pBlock;
//
myPBlock=pBlock;
}
//
myPBlock->SetValue(myExtent, theValue);
//
++myExtent;
//
return myExtent;
}
//=======================================================================
//function : Append
//purpose :
//=======================================================================
template <class Type>
Standard_Integer BOPCol_Array1<Type>::Append() {
BOPCol_PMemBlock pBlock, pNext;
//
pBlock=myPBlock1;
for(;;) {
pNext=pBlock->myNext;
if(!pNext) {
myPBlock=pBlock;
break;
}
pBlock=pNext;
}
//
if (!myPBlock->Contains(myExtent)) {
//
pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
//
pBlock->Allocate(myIncrement);
pBlock->SetRange(myExtent, myExtent+myIncrement-1);
//
myPBlock->myNext=pBlock;
//
myPBlock=pBlock;
}
++myExtent;
//
return myExtent;
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
template <class Type>
void BOPCol_Array1<Type>::SetValue(const Standard_Integer theIndex,
const Type& theValue) {
if (FindBlock(theIndex)) {
myPBlock->SetValue(theIndex, theValue);
}
}
//=======================================================================
//function : operator()
//purpose :
//=======================================================================
template <class Type>
const Type& BOPCol_Array1<Type>::operator()(const Standard_Integer theIndex)const {
if (FindBlock(theIndex)) {
return myPBlock->Value(theIndex);
}
return myDfltItem;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
template <class Type>
const Type& BOPCol_Array1<Type>::Value(const Standard_Integer theIndex)const {
return operator()(theIndex);
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
template <class Type>
Type& BOPCol_Array1<Type>::operator()(const Standard_Integer theIndex) {
if (FindBlock(theIndex)) {
return myPBlock->ChangeValue(theIndex);
}
return myDfltItem;
}
//=======================================================================
//function : ChangeValue
//purpose :
//=======================================================================
template <class Type>
Type& BOPCol_Array1<Type>::ChangeValue(const Standard_Integer theIndex) {
return operator()(theIndex);
}
//=======================================================================
//function : FindBlock
//purpose :
//=======================================================================
template <class Type>
Standard_Boolean BOPCol_Array1<Type>::FindBlock(const Standard_Integer theIndex)const {
Standard_Boolean bRet;
//
bRet=myPBlock->Contains(theIndex);
if(bRet) {
return bRet;
}
//
Standard_Integer i1, i2;
BOPCol_PMemBlock pBlock, *xPBlock;
//
xPBlock=(BOPCol_PMemBlock*)&myPBlock;
pBlock=myPBlock1;
//
i1=0;
i2=myStartSize-1;
do {
if (theIndex>=i1 && theIndex<=i2) {
*xPBlock=pBlock;
return !bRet;
}
//
i1=i2+1;
i2=i1+myIncrement-1;
pBlock=pBlock->myNext;
} while(pBlock);
//
return bRet;
}
#endif

View File

@@ -0,0 +1,174 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPDS_Col_HeaderFile
#define _BOPDS_Col_HeaderFile
#include <Standard_Macro.hxx>
#include <Standard_NotImplemented.hxx>
#include <OSD_Parallel.hxx>
#include <NCollection_DataMap.hxx>
//
// 1. Implementation of Functors/Starters
//
// 1.1. Pure version
//
//=======================================================================
//class : BOPCol_Functor
//purpose :
//=======================================================================
template <class TypeSolver, class TypeSolverVector>
class BOPCol_Functor
{
public:
//! Constructor.
explicit BOPCol_Functor(TypeSolverVector& theSolverVec)
: mySolvers(theSolverVec) {}
//! Defines functor interface.
void operator() (const Standard_Integer theIndex) const
{
TypeSolver& aSolver = mySolvers(theIndex);
aSolver.Perform();
}
private:
BOPCol_Functor(const BOPCol_Functor&);
BOPCol_Functor& operator= (const BOPCol_Functor&);
private:
TypeSolverVector& mySolvers;
};
//=======================================================================
//class : BOPCol_Cnt
//purpose :
//=======================================================================
template <class TypeFunctor, class TypeSolverVector>
class BOPCol_Cnt
{
public:
static void Perform( const Standard_Boolean isRunParallel,
TypeSolverVector& theSolverVector )
{
TypeFunctor aFunctor(theSolverVector);
OSD_Parallel::For(0, theSolverVector.Extent(), aFunctor, !isRunParallel);
}
};
//
// 1.2. Context dependent version
//
//=======================================================================
//class : BOPCol_ContextFunctor
//purpose :
//=======================================================================
template <class TypeSolver, class TypeSolverVector,
class TypeContext, typename TN>
class BOPCol_ContextFunctor
{
//! Auxiliary thread ID hasher.
struct Hasher
{
static Standard_Integer HashCode(const Standard_ThreadId theKey,
const Standard_Integer Upper)
{
return ::HashCode(reinterpret_cast<Standard_Address>(theKey), Upper);
}
static Standard_Boolean IsEqual(const Standard_ThreadId theKey1,
const Standard_ThreadId theKey2)
{
return theKey1 == theKey2;
}
};
typedef NCollection_DataMap<Standard_ThreadId, TypeContext, Hasher> ContextMap;
public:
//! Constructor
explicit BOPCol_ContextFunctor( TypeSolverVector& theVector )
: mySolverVector(theVector) {}
//! Binds main thread context
void SetContext( TypeContext& theContext )
{
myContexts.Bind(OSD_Thread::Current(), theContext);
}
//! Returns current thread context
TypeContext& GetThreadContext() const
{
const Standard_ThreadId aThreadID = OSD_Thread::Current();
if ( myContexts.IsBound(aThreadID) )
{
TypeContext& aContext = myContexts(aThreadID);
if ( aContext.IsNull() == Standard_False )
return aContext;
}
// Create new context
TypeContext aContext = new TN
( NCollection_BaseAllocator::CommonBaseAllocator() );
Standard_Mutex::Sentry aLocker(myMutex);
myContexts.Bind(aThreadID, aContext);
return myContexts(aThreadID);
}
//! Defines functor interface
void operator()( const Standard_Integer theIndex ) const
{
TypeContext& aContext = GetThreadContext();
TypeSolver& aSolver = mySolverVector(theIndex);
aSolver.SetContext(aContext);
aSolver.Perform();
}
private:
BOPCol_ContextFunctor(const BOPCol_ContextFunctor&);
BOPCol_ContextFunctor& operator= (const BOPCol_ContextFunctor&);
private:
TypeSolverVector& mySolverVector;
mutable ContextMap myContexts;
mutable Standard_Mutex myMutex;
};
//=======================================================================
//class : BOPCol_ContextCnt
//purpose :
//=======================================================================
template <class TypeFunctor, class TypeSolverVector, class TypeContext>
class BOPCol_ContextCnt
{
public:
static void Perform( const Standard_Boolean isRunParallel,
TypeSolverVector& theSolverVector,
TypeContext& theContext )
{
TypeFunctor aFunctor(theSolverVector);
aFunctor.SetContext(theContext);
OSD_Parallel::For(0, theSolverVector.Extent(), aFunctor, !isRunParallel);
}
};
#endif

View File

@@ -1,248 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPDS_Col_HeaderFile
#define _BOPDS_Col_HeaderFile
#include <Standard_Macro.hxx>
#include <Standard_NotImplemented.hxx>
#ifdef HAVE_TBB
// On Windows, function TryEnterCriticalSection has appeared in Windows NT
// and is surrounded by #ifdef in MS VC++ 7.1 headers.
// Thus to use it we need to define appropriate macro saying that we wil
// run on Windows NT 4.0 at least
#if ((defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN32_WINNT))
#define _WIN32_WINNT 0x0501
#endif
#include <tbb/tbb.h>
using namespace tbb;
#define flexible_range blocked_range
#define flexible_for parallel_for
#else // not HAVE_TBB
#define flexible_range serial_range
#define flexible_for serial_for
//=======================================================================
//class : serial_range
//purpose :
//=======================================================================
template <class Type> class serial_range {
public:
serial_range(const Type& aBegin,
const Type& aEnd)
: myBegin(aBegin), myEnd(aEnd) {
}
//
~serial_range() {
}
//
const Type& begin() const{
return myBegin;
}
//
const Type& end() const{
return myEnd;
};
//
protected:
Type myBegin;
Type myEnd;
};
//=======================================================================
//function : serial_for
//purpose :
//=======================================================================
template<typename Range, typename Body>
static void serial_for( const Range& range, const Body& body ) {
body.operator()(range);
};
#endif // not HAVE_TBB
//
// 2. Implementation of Functors/Starters
//
// 2.1. Pure version
//
//=======================================================================
//class : BOPCol_TBBFunctor
//purpose :
//=======================================================================
template <class TypeSolver,
class TypeSolverVector> class BOPCol_TBBFunctor {
public:
BOPCol_TBBFunctor(TypeSolverVector& aV)
: myPV(&aV) {
}
//
~BOPCol_TBBFunctor() {
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
//
TypeSolverVector& aV=*myPV;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
TypeSolver& aSolver=aV(i);
//
aSolver.Perform();
}
}
//
protected:
TypeSolverVector* myPV;
};
//=======================================================================
//class : BOPCol_TBBCnt
//purpose :
//=======================================================================
template <class TypeFunctor,
class TypeSolverVector> class BOPCol_TBBCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
TypeSolverVector& aV) {
//
TypeFunctor aFunctor(aV);
Standard_Integer aNb=aV.Extent();
//
if (bRunParallel) {
#ifdef HAVE_TBB
try {
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
}
//
catch( captured_exception& ) {
Standard_NotImplemented::Raise("");
}
catch( ... ) {
Standard_NotImplemented::Raise("");
}
#else // not HAVE_TBB
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
#endif
}
else {
aFunctor.operator()(flexible_range<Standard_Integer>(0,aNb));
}
}
};
//
// 2.2. Context dependent version
//
//=======================================================================
//class : BOPCol_TBBContextFunctor
//purpose :
//=======================================================================
template <class TypeSolver,
class TypeSolverVector,
class TypeContext,
typename TN> class BOPCol_TBBContextFunctor {
public:
BOPCol_TBBContextFunctor(TypeSolverVector& aV)
: myPV(&aV) {
}
//
~BOPCol_TBBContextFunctor() {
}
//
void SetContext(TypeContext& aCtx) {
myContext=aCtx;
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
TypeContext aCtx;
//
if (myContext.IsNull()) {
aCtx=new TN
(NCollection_BaseAllocator::CommonBaseAllocator());
}
else {
aCtx=myContext;
}
//
TypeSolverVector& aV=*myPV;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
TypeSolver& aSolver=aV(i);
//
aSolver.SetContext(aCtx);
aSolver.Perform();
}
}
//
protected:
TypeSolverVector* myPV;
TypeContext myContext;
//
};
//=======================================================================
//class : BOPCol_TBBContextCnt
//purpose :
//=======================================================================
template <class TypeFunctor,
class TypeSolverVector,
class TypeContext> class BOPCol_TBBContextCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
TypeSolverVector& aV,
TypeContext& aCtx) {
//
TypeFunctor aFunctor(aV);
Standard_Integer aNb=aV.Extent();
//
if (bRunParallel) {
#ifdef HAVE_TBB
try {
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
}
//
catch(captured_exception& ) {
//cout<<" captured_exception: " << ex.what() << endl;
Standard_NotImplemented::Raise("");
}
catch( ... ) {
Standard_NotImplemented::Raise("");
}
#else // not HAVE_TBB
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
#endif
}
else {
aFunctor.SetContext(aCtx);
aFunctor.operator()(flexible_range<Standard_Integer>(0,aNb));
}
}
};
#endif

View File

@@ -1,4 +1,3 @@
BOPCol_Array1.hxx
BOPCol_DataMapOfShapeInteger.hxx
BOPCol_DataMapOfShapeReal.hxx
BOPCol_MapOfInteger.hxx
@@ -14,7 +13,6 @@ BOPCol_ListOfShape.hxx
BOPCol_DataMapOfShapeAddress.hxx
BOPCol_DataMapOfTransientAddress.hxx
BOPCol_PListOfInteger.hxx
BOPCol_VectorOfInteger.hxx
BOPCol_MapOfShape.hxx
BOPCol_DataMapOfShapeShape.hxx
BOPCol_DataMapOfShapeListOfShape.hxx
@@ -30,7 +28,7 @@ BOPCol_SequenceOfReal.hxx
BOPCol_DataMapOfIntegerShape.hxx
BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx
BOPCol_IndexedDataMapOfShapeInteger.hxx
BOPCol_TBB.hxx
BOPCol_Parallel.hxx
BOPCol_NCVector.hxx
BOPCol_BoxBndTree.hxx

View File

@@ -91,24 +91,24 @@ BOPDS_DS::BOPDS_DS()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myArguments(myAllocator),
myRanges(myAllocator),
myLines(myAllocator),
myRanges(0,myAllocator),
myLines(0, myAllocator),
myMapShapeIndex(100, myAllocator),
myPaveBlocksPool(myAllocator),
myPaveBlocksPool(0,myAllocator),
myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
myInterfFF(myAllocator),
myInterfVZ(myAllocator),
myInterfEZ(myAllocator),
myInterfFZ(myAllocator),
myInterfZZ(myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myInterfVF(0, myAllocator),
myInterfEE(0, myAllocator),
myInterfEF(0, myAllocator),
myInterfFF(0, myAllocator),
myInterfVZ(0, myAllocator),
myInterfEZ(0, myAllocator),
myInterfFZ(0, myAllocator),
myInterfZZ(0, myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
{
@@ -123,24 +123,24 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myArguments(myAllocator),
myRanges(myAllocator),
myLines(myAllocator),
myRanges(0, myAllocator),
myLines(0, myAllocator),
myMapShapeIndex(100, myAllocator),
myPaveBlocksPool(myAllocator),
myPaveBlocksPool(0, myAllocator),
myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
myInterfFF(myAllocator),
myInterfVZ(myAllocator),
myInterfEZ(myAllocator),
myInterfFZ(myAllocator),
myInterfZZ(myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myInterfVF(0, myAllocator),
myInterfEE(0, myAllocator),
myInterfEF(0, myAllocator),
myInterfFF(0, myAllocator),
myInterfVZ(0, myAllocator),
myInterfEZ(0, myAllocator),
myInterfFZ(0, myAllocator),
myInterfZZ(0, myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
{
@@ -277,8 +277,9 @@ Standard_Integer BOPDS_DS::Append(const BOPDS_ShapeInfo& theSI)
{
Standard_Integer iX;
//
iX=myLines.Append()-1;
myLines(iX)=theSI;
myLines.Append1()=theSI;
iX=myLines.Extent()-1;
//
return iX;
}
//=======================================================================
@@ -289,8 +290,8 @@ Standard_Integer BOPDS_DS::Append(const TopoDS_Shape& theS)
{
Standard_Integer iX;
//
iX=myLines.Append()-1;
myLines(iX).SetShape(theS);
myLines.Append1().SetShape(theS);
iX=myLines.Extent()-1;
return iX;
}
//=======================================================================
@@ -320,6 +321,7 @@ BOPDS_ShapeInfo& BOPDS_DS::ChangeShapeInfo(const Standard_Integer theI)
//=======================================================================
const TopoDS_Shape& BOPDS_DS::Shape(const Standard_Integer theI)const
{
const TopoDS_Shape& aS=ShapeInfo(theI).Shape();
return aS;
}
@@ -360,8 +362,7 @@ void BOPDS_DS::Init()
return;
}
//
myRanges.SetStartSize(aNb);
myRanges.Init();
myRanges.SetIncrement(aNb);
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
@@ -379,10 +380,7 @@ void BOPDS_DS::Init()
aNbS=aNbS+aNbSx;
}
//
myLines.SetStartSize(2*aNbS);
myLines.SetIncrement(aNbS);
myLines.Init();
//
myLines.SetIncrement(2*aNbS);
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator();
//
@@ -651,17 +649,10 @@ void BOPDS_DS::Init()
aMI.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
//
// 3 myPaveBlocksPool
myPaveBlocksPool.SetStartSize(aNbE);
myPaveBlocksPool.SetIncrement(aNbE);
myPaveBlocksPool.Init();
//
// 4. myFaceInfoPool
myFaceInfoPool.SetStartSize(aNbF);
myPaveBlocksPool.SetIncrement(aNbE);
myFaceInfoPool.SetIncrement(aNbF);
myFaceInfoPool.Init();
//
}
//=======================================================================
//function : InitShape
@@ -934,8 +925,8 @@ void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
}
}
//
iRef = myPaveBlocksPool.Append() - 1;
BOPDS_ListOfPaveBlock &aLPB=myPaveBlocksPool(iRef);
BOPDS_ListOfPaveBlock &aLPB=myPaveBlocksPool.Append1();
iRef=myPaveBlocksPool.Extent()-1;
//
aPB->Update(aLPB, Standard_False);
aSI.SetReference(iRef);
@@ -1265,8 +1256,8 @@ void BOPDS_DS::InitFaceInfo(const Standard_Integer theI)
Standard_Integer iRef;
//
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(theI);
iRef=myFaceInfoPool.Append()-1;
BOPDS_FaceInfo &aFI=myFaceInfoPool(iRef);
BOPDS_FaceInfo &aFI=myFaceInfoPool.Append1();
iRef=myFaceInfoPool.Extent()-1;
aSI.SetReference(iRef);
//
aFI.SetIndex(theI);

View File

@@ -139,9 +139,7 @@ inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const
//=======================================================================
inline void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue

View File

@@ -496,27 +496,11 @@ class BOPDS_InterfFF : public BOPDS_Interf {
myTangentFaces(Standard_False),
myTolR3D(1.e-7),
myTolR2D(1.e-7),
myCurves(myAllocator),
myPoints(myAllocator) {
myCurves(0, myAllocator),
myPoints(0, myAllocator)
{
}
//
/**
* Constructor
* @param theAllocator
* allocator to manage the memory
*/
/*
BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPDS_Interf(theAllocator),
myTangentFaces(Standard_False),
myTolR3D(1.e-7),
myTolR2D(1.e-7),
myCurves(myAllocator),
myPoints(myAllocator) {
}
*/
//
/**
* Destructor
*/
@@ -530,8 +514,17 @@ class BOPDS_InterfFF : public BOPDS_Interf {
* @param theNbPoints
* number of intersection points
*/
void Init(const Standard_Integer theNbCurves,
const Standard_Integer theNbPoints) {
//modified by NIZNHY-PKV Mon Jan 26 09:01:06 2015f
if (theNbCurves>0) {
myCurves.SetIncrement(theNbCurves);
}
if (theNbPoints>0) {
myPoints.SetIncrement(theNbPoints);
}
/*
if (theNbCurves>0) {
myCurves.SetStartSize(theNbCurves);
myCurves.SetIncrement(theNbCurves);
@@ -542,6 +535,8 @@ class BOPDS_InterfFF : public BOPDS_Interf {
myPoints.SetIncrement(theNbPoints);
myPoints.Init();
}
*/
//modified by NIZNHY-PKV Mon Jan 26 09:01:12 2015t
}
/**
* Modifier

View File

@@ -25,7 +25,7 @@
#include <TopoDS_Shape.hxx>
//
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPCol_BoxBndTree.hxx>
//
#include <BOPDS_IndexRange.hxx>
@@ -70,8 +70,8 @@ class BOPDS_TSR : public BOPCol_BoxBndTreeSelector{
//
//=======================================================================
typedef BOPCol_NCVector <BOPDS_TSR> BOPDS_VectorOfTSR;
typedef BOPCol_TBBFunctor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
typedef BOPCol_TBBCnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
typedef BOPCol_Functor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
typedef BOPCol_Cnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
/////////////////////////////////////////////////////////////////////////
@@ -84,11 +84,16 @@ BOPDS_Iterator::BOPDS_Iterator()
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myRunParallel(Standard_False)
{
Standard_Integer i, aNb;
//
myDS=NULL;
myLength=0;
//
myLists.SetStartSize(BOPDS_DS::NbInterfTypes());
myLists.Init();
aNb=BOPDS_DS::NbInterfTypes();
myLists.SetIncrement(aNb);
for (i=0; i<aNb; ++i) {
myLists.Append1();
}
}
//=======================================================================
//function :
@@ -98,14 +103,19 @@ BOPDS_Iterator::BOPDS_Iterator
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myLists(theAllocator),
myLists(0, theAllocator),
myRunParallel(Standard_False)
{
Standard_Integer i, aNb;
//
myDS=NULL;
myLength=0;
//
myLists.SetStartSize(BOPDS_DS::NbInterfTypes());
myLists.Init();
aNb=BOPDS_DS::NbInterfTypes();
myLists.SetIncrement(aNb);
for (i=0; i<aNb; ++i) {
myLists.Append1();
}
}
//=======================================================================
//function : ~

View File

@@ -15,14 +15,9 @@
#ifndef BOPDS_VectorOfCurve_HeaderFile
#define BOPDS_VectorOfCurve_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_Curve.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_Curve> BOPDS_VectorOfCurve;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_Curve> BOPDS_VectorOfCurve;
#endif

View File

@@ -15,13 +15,9 @@
#ifndef BOPDS_VectorOfFaceInfo_HeaderFile
#define BOPDS_VectorOfFaceInfo_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_FaceInfo.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_FaceInfo> BOPDS_VectorOfFaceInfo;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_FaceInfo> BOPDS_VectorOfFaceInfo;
#endif

View File

@@ -15,9 +15,9 @@
#ifndef BOPDS_VectorOfIndexRange_HeaderFile
#define BOPDS_VectorOfIndexRange_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_IndexRange.hxx>
typedef BOPCol_Array1<BOPDS_IndexRange> BOPDS_VectorOfIndexRange;
typedef BOPCol_NCVector<BOPDS_IndexRange> BOPDS_VectorOfIndexRange;
#endif

View File

@@ -15,11 +15,9 @@
#ifndef BOPDS_VectorOfInterfEE_HeaderFile
#define BOPDS_VectorOfInterfEE_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_InterfEE> BOPDS_VectorOfInterfEE;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_InterfEE> BOPDS_VectorOfInterfEE;
#endif

View File

@@ -15,12 +15,9 @@
#ifndef BOPDS_VectorOfInterfEF_HeaderFile
#define BOPDS_VectorOfInterfEF_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_InterfEF> BOPDS_VectorOfInterfEF;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_InterfEF> BOPDS_VectorOfInterfEF;
#endif

View File

@@ -16,11 +16,9 @@
#ifndef BOPDS_VectorOfInterfEZ_HeaderFile
#define BOPDS_VectorOfInterfEZ_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_InterfEZ> BOPDS_VectorOfInterfEZ;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_InterfEZ> BOPDS_VectorOfInterfEZ;
#endif

View File

@@ -15,12 +15,9 @@
#ifndef BOPDS_VectorOfInterfFF_HeaderFile
#define BOPDS_VectorOfInterfFF_HeaderFile
#include <BOPCol_Array1.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
#define BOPCol_Array1_Use_Allocator
typedef BOPCol_Array1<BOPDS_InterfFF> BOPDS_VectorOfInterfFF;
#undef BOPCol_Array1_Use_Allocator
typedef BOPCol_NCVector<BOPDS_InterfFF> BOPDS_VectorOfInterfFF;
#endif

Some files were not shown because too many files have changed in this diff Show More