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

Compare commits

..

74 Commits

Author SHA1 Message Date
myn
2c57ab72bc 0027558: Restore support for legacy XCAF persistence format 2016-06-08 14:10:23 +03:00
msv
77887d30d8 0027492: Change error messages highlighting to make them readable in HTML report 2016-05-30 14:20:10 +03:00
gka
b94d48585b 0027520: Operation "splitshape" in the Test Harness give invalid result on the attached case.
The new method has been added in the class BRepFeat_SplitShape for addition of the sequence of the splitting edges or wires for the whole initial shape without specification of the edge->face, edge->edge mapping.
The procedure of collecting wires has been corrected so as not to take into account the distance in 2D space between adjacent edges having a common vertex.
New category of tests "bugs/splitshape" has been added to non-regression data base.

Test cases for issue CR27520

Remove compilation warnings.

Add dependence of TKFeat on TKShHealing in EXTERNLIB in order to build with genproj.
2016-05-27 15:35:51 +03:00
duv
50d06d8fcf 0027374: Visualization - optimize management of the scene bounding box
OpenGl_View now caches bounding boxes per Z-layer (instead of bounding box of entire scene in Graphic3d_CView).
Redundant invalidation of cached scene bounding box is now avoided in case
when new presentation attributes are assigned to the graphic structure.

Add a new methods ConsiderZoomPersistenceObjects() and considerZoomPersistenceObjects() in the Graphic3d_CView, OpenGl_View and OpenGl_Layer classes.
Call ConsiderZoomPersistenceObjects() in the V3d_View::FitMinMax method.

std::numeric_limits<T>::lowest() fix
2016-05-27 11:57:55 +03:00
aml
5ae6e53dec 0027341: Incorrect exact HLR results
- removal of excess interferences in case of simple hiding face
- correct processing of boundary edges coinciding with outlines
- change of API for testing Draw Command
- correction of Draw command "build3d"
- test cases are added.

Linux reference data is changed.

Partially fixed 0027340: Insufficient exact HLR speed

Number of samples in PolyPoly intersection algorithm tuned in each instance of generic class.
Default number of the samples in Geom2dAdaptor is changed according to the Adaptor2d_Curve2d class.
Minimal number of points in case of B-Spline is changed.
Minimal number of samples support is added in intersection algorithms.
2016-05-27 11:57:50 +03:00
vpa
41e08b4df8 0027317: Some visualisation tests failed because of exceptions generated by FP signals.
- missing implementation of CenterOfGeometry method was added in MeshVS_CommonSensitiveEntity;
- a check to prevent float overflow was added to OpenGl_BVHClipPrimitiveSet::Center.
2016-05-27 11:57:44 +03:00
msv
a002d297f7 0027541: ShapeFix_ComposeShell allows usage of uninitialized value of the field myInvertEdgeStatus
Initialize all fields of the class in the constructor.
2016-05-27 11:57:41 +03:00
mgn
f2b6318110 0027538: Visualization, AIS_InteractiveContext::Display() - do not erase previous display mode.
AIS_InteractiveContext::Display() does not erases old presentation modes of interactive object anymore giving us performance benefit AIS_InteractiveContext::Display() is used. Instead, the method marks them hidden in the same way as AIS_InteractiveContext::SetDisplayMode() and ::UnsetDisplayMode().
2016-05-27 11:57:38 +03:00
vpa
7d46a9ed8b 0027477: Visualization - Select3D_SensitiveCircle always return infinite depth value in boundary mode
- unnecessary re-initialization of pick result was removed from Select3D_SensitiveCircle;
- test case for issue #27477
2016-05-27 11:57:35 +03:00
ski
88d533be65 0026512: Build fails with VTK 6.2 and OpenGL2 Rendering Backend
Support of VTK with OpenGL2 Rendering Backend was added.
2016-05-27 11:57:31 +03:00
aml
6b52f1253e 0025623: Some tests become worse after 22598 fix
Tolerance of line / line analytical intersection is fixed.
Test cases are updated to the new behavior.

Update of test case according to the current behavior
2016-05-27 11:57:26 +03:00
msv
38c2acd423 0027521: Standard_ConstructionError when trying to use unifySameDom into a shape
Correct the algorithm in the function MergeEdges in ShapeUpgrade_UnifySameDomain.cxx so as to take into account the orientation of the next edge added to the chain.

Test cases for issue CR27521
2016-05-26 12:19:26 +03:00
kgv
55fb31dae4 0027458: Configuration, genproj.tcl - add -rpath-link option to linker in Code::Blocks project 2016-05-19 15:09:52 +03:00
aml
882e1d11aa 0026938: Boolean operations fail between two ellipsoids
Treatment for single singular point is added.
Test cases are updated to the new behavior.
New test cases are added,
Message of "bad" state is corrected.
2016-05-19 15:07:44 +03:00
aml
871776ea38 0027194: Possible division by zero in IntPatch_WLineTool
Correct handling for division by zero is added. This prevents exception when FPE is enabled
2016-05-19 15:04:28 +03:00
kgv
09eca2b5b3 0027499: Configuration, CMake - add option INSTALL_NAME_DIR on OS X 2016-05-19 15:02:13 +03:00
kgv
5501f9a946 0027510: Visualization, OpenGl_Window - do not ignore backing store resize on OS X 2016-05-19 14:01:30 +03:00
aml
e64622331f 0027493: [Regression relative to OCCT 7.0.0] Extrema_ExtCC does not set flag "IsParallel" equal to true for the overlapped curves
Check for infinite solutions now starts from two solutions.
Test case is added.
2016-05-19 13:23:34 +03:00
kgv
264abd72f2 0027505: Visualization, Font_FontMgr - do not look for fonts.dir on OS X
Font_FontMgr::InitFontDataBase() now uses the same approach on OS X as on Android
ignoring fonts.dir files which are non used on these systems.
2016-05-19 13:21:25 +03:00
msv
e5260e1dfa 0027466: The algorithm Extrema_GenLocateExtPS gives incorrect result
Euclidean distance criteria is added for local point / surface extrema.
Classes representing objective criteria are renamed to be consistent.
Local extrema usage is updated according to new behavior.
Test case is added.

Misprint correction.
2016-05-19 13:17:18 +03:00
msv
e1c1b6b9f4 0027490: BRepMesh: Reduce number of memory allocations
1) Reduce the number of calls to malloc by grouping requests to larger blocks. To achieve this goal, the following ways are used:

- Containers of types sequence, list and map are initialized with an instance of NCollection_IncAllocator, at this taking care of the time of life of allocated objects, so that not to occupy huge amount of memory.

- Allocation of several arrays having the same and short life time is changed so that to allocate a buffer array of necessary size and to place arrays in this buffer.

2) In BRepMesh_FastDiscretFace, optimize the function filterParameters so that to avoid excess memory allocations.

3) In NCollection_CellFilter, change declaration of the method Reset to accept array by reference rather than by value.

4) Add Allocator() method in map, sequence and vector collection classes by analogy with list collection.

5) Correct the size of block for IncAllocator for x64 platform. In order free-ed block to be returned to the system its size should be at least 1024K on x64 and 512K on x86. This allows to retain free virtual space almost to the state before algorithm run.

6) Decrease amount of memory zeroed by calloc. For that, reduce theIncrement parameter of the embedded vectors of the classes NCollection_UBTreeFiller and BRepMesh_VertexInspector to default value 256.

7) Avoid computing bounding box when not necessary (if no relative deflection is used)

8) Cycles by wires of face using TopExp_Explorer are converted to use TopoDS_Iterator instead.

9) BRepMesh_FastDiscret::Add optimized to avoid storing sequences of faces and edges

10) The tests "mesh standard_* W7" are corrected to accept the new behavior. Earlier the following error took place:
Not connected mesh inside face 9
{12 13}
Now this error was replaced with another one:
free nodes (in pairs: face / node):
{9 12}
Actually it is not a regression, rather improvement, if we look at the snapshot.

11) Change other test cases to their actual state.
2016-05-13 19:04:34 +03:00
bugmaster
f02e43eb35 Adjusting testing cases for current state of OCCT 2016-05-13 12:37:53 +03:00
gka
0911d065ff 0027169: Suspitious behavior of importing names during STEP import
In order to avoid using empty strings in the names of the assemblies in the XCAF document after reading step file for cases when description or name is defined by only 1 space character method TCollection_AsciiString::Length()
was replaced on the method TCollection_AsciiString::UsefullLength().

Test case for issue CR27169

Eliminating warning
2016-05-12 18:12:22 +03:00
abv
3d370858dd 0027432: Null Handle Access When Creating AIS_Trihedron
Debug-only "RaiseIf" is replaced by simple "if" to have exceptional situation handled correctly in Release mode.

Mention mandatory variable CSF_ShadersDirectory in porting notes for OCCT 6.9.0

Test cases for issue CR27432

Deleting test cases for issue CR27432
2016-05-12 12:08:24 +03:00
ssv
3e6a4cd02a 0027463: BRepTools_ReShape ends up with empty shapes
Add check on empty topological containers.

Add empty shapes to the replacement map.

Add Draw command for Re-Shape.

Add a test grid for reshape with a single use case for starters.
2016-05-12 12:02:49 +03:00
anv
38f24151f6 0027476: Code alignment for ShapeFix_ComposeShell 2016-05-12 11:59:35 +03:00
anv
4613a51fd4 0027331: Not valid result on translating the file
Added processing of a short segments of a seam edge.

Test case added.
2016-05-12 11:59:31 +03:00
aml
aa1b48c7dd 0027475: Incomplete direction for Powell method in math_GlobOptMin
Directions are changed to be valid orthogonal set.
2016-05-12 11:52:05 +03:00
msv
18151f1aa1 0027454: Application hangs while opening a non-OCAF XML file
1) Add protection against accessing null pointer in PCDM_ReadWriter::FileFormat.

2) In LDOM_XmlReader::ReadRecord, take into account that the character '>' can have no special meaning (e.g., in a text), and we must read the data behind this character to complete the current tag reading. This treatment concerns the mode of work when myTagPerStep is true.

3) Create a test case of reading of XML file not related to OCAF document.

Test case was added.
2016-05-12 11:09:15 +03:00
aml
15a954deb5 0027467: Modeling Algorithms - class Extrema_ExtCC2d does not find extremum between two intersecting lines
Line / line analytic treatment is added for 2d case.
Test case is added.
2016-05-12 10:53:29 +03:00
kgv
8d0b864941 0027460: Data Exchange - restore method XSControl_WorkSession::MapReader() 2016-05-12 10:49:53 +03:00
apn
c9de149dec 0027463: Checkprops can not be used with several properties
Added possibility to use several properties in one checkprops command

Modified test cases according to changes in checkprops command
2016-05-12 10:46:21 +03:00
Benjamin Bihler
a1530ab1b8 0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
Modified Load(...) method of Resource_Manager.cxx to print file names correctly.

Removed appending (empty) file name to directory name, since this is not
necessary and leads to a Standard_OutOfRange failure in TCollection_AsciiString.

Appending file name is done, but only if the name is not empty.

Added test case
2016-05-12 10:37:11 +03:00
jgv
c59fcd1186 0027468: Incorrect processing of some cases by HLR algorithm
Incorrect work of HLR algorithm caused by usage of wrong tolerances, wrong sampling of 2d curve and some other bugs are fixed.

Test cases for issue CR27341
2016-05-12 10:33:35 +03:00
ika
b7b2f85ac1 0027455: Implementation of connection points
Add Import/Export connection points.
Make some improvements in STEP reading in collections shapes, to which dimension is attached.
Update tests.
2016-05-12 10:30:09 +03:00
oan
8e509b0ba1 0027442: Rotation sweep can't be rendered in 3D
Do not insert internal nodes for Cylinder in case if it is less than DefFace value or in case of long cylinder with small radius due to protection against overflow during casting to integer.

Small correction of shape name in test case for issue CR27442
2016-05-12 10:17:38 +03:00
kgv
a9b51f4977 0027424: Configuration, genconf.tcl - add missing option to enable TKD3DHost in configurator 2016-05-11 17:11:07 +03:00
kgv
5951a08873 0026846: Configuration, genproj.tcl - create hardlinks instead for header redirection
Build guides updated accordingly

Update genconf screenshot for Linux
2016-05-11 17:11:02 +03:00
Benjamin Bihler
5950d7816e 0027478: Configuration - avoid inclusion of Xlib.h within Graphic3d_GraphicDriver.hxx
Replace Aspect_DisplayConnection.hxx inclusion by forward declaration.
2016-05-10 20:59:55 +03:00
oan
7856b126b0 0027384: BRepMesh_IncrementalMesh does not take angular deflection into account for spun/elementary surfaces
Check deviation of normals at vertices of triangles for complex surface types different from Bezier and BSpline.
Modified test cased according to changes in BRepMesh.
Do not remove more intermediate parameters than N - 3 in order to have at least one parameter related to surface internals.
Check angle for angular deflection before removement of intermediate parameters.
Unify computation of internal vertices for complex surfaces.
Discretization points of edges are taken into account during computation of step of mesh grid.
Remove parameters only if they fit the constrains along the whole surface.
Do not add random internal parameters in case if their number is just 2.
Force freezing parameters both for U and V in case of significant control point.

Modified test cases

Warnings elimination in vc14.
2016-04-29 11:48:33 +03:00
dbp
3a507ddb47 0027368: Finding objects in vicinity of a ray
In frames of this issue, radix sort functionality from BVH_LinearBuilder was generalized and implemented as separate classes in BVH package. The basic API of sorting class is given in BVH_Sorter class, while BVH_QuickSorter and BVH_RadixSorter provide quck sroting and radix sorting algorithms respectivly.
2016-04-28 17:44:36 +03:00
nbv
79997052f1 0027310: Huge tolerance obtained in the result of intersection of two cylindrical faces
Sometimes start point of the intersection line is in the surface boundary strictly. I.e. the parameter of this point in the surface can be equal to both 0 or 2*PI equivalently. It is important to chose correct parameter value.

The algorithm of prediction is based on monotonicity property (see CylCylMonotonicity(...) function in IntPatch_ImpImpIntersection_4.gxx). Now, this function is used wrongly. The fix improves this situation.

Small optimization in the code.
Creation of test cases .

The logic of returning value by the method BoundariesComputing() has been corrected.
2016-04-28 17:04:58 +03:00
nbv
b55bd02353 0027269: Intersection algorithm produces null-length curve
Restriction line can correspond to a degenerated edge. In this case we shall return null-curve (instead of Null-length curve).
2016-04-28 14:21:40 +03:00
aml
246c7a7554 0027371: Regression: BRepExtrema works too much slower in 691 (from 670)
I
Lipschitz constant tuning.
Shubert estimation for minimal value is added.

II
Math_GlobOptMin Refactoring.

III
Test case is added.

class NCollection_CellFilter_Inspector moved into math_GlobOptMin class.
2016-04-28 14:03:59 +03:00
ski
4b5857d330 0027435: Compilation error on Linux platfrom in Debug mode with enabled OCCT_DEBUG definition
Error was fixed.
2016-04-27 13:31:29 +03:00
ski
04cd0c6dda 0027195: Configuration, CMake - data and samples/tcl folders are installed with DRAW executable only
Installation of data and samples/tcl folders was binded with DRAWEXE
2016-04-27 13:23:36 +03:00
ski
e13e5f39c5 0027212: Make cmake configurator flexible concerning option BUILD_WITH_DEBUG
Added flexible behaviour for option BUILD_WITH_DEBUG.
2016-04-27 13:21:14 +03:00
Benjamin Bihler
a139a35380 0027417: Coose a Better Default Release Optimization Parameter for MinGW-w64
Forcing CMAKE_CXX_FLAGS_RELEASE to -O2 -DNDEBUG, if the compiler is MinGW-w64.

Switched to replacing optimization parameter instead of overwriting
CMAKE_CXX_FLAGS_RELEASE string
2016-04-27 13:11:44 +03:00
Benjamin Bihler
eaffb01e7e 0027402: Fix Compilation with MinGw and Additional Libraries
Setting CSF_GL2PS in occt_csf.cmake in the same way as CSF_FREETYPE is set.

Added MinGw library suffix to a in 3rdparty_macro.cmake, freetype.cmake and tbb.cmake.

Removed redundant CSF_GL2PS definition for non-Win32 configurations
2016-04-27 13:09:09 +03:00
anv
3e64931da5 0027427: Exception on loading a DE package to Draw 2016-04-25 15:31:58 +03:00
emv
92788bf4bb 0027425: Unable to build AIS package with OCCT_DEBUG enabled in current master
The usage of the removed field mySelName of the AIS_LocalContext class has also been removed.
2016-04-25 08:56:22 +03:00
bugmaster
360f800be8 Update of testing cases for current state of OCCT 2016-04-22 15:22:16 +03:00
anv
7f56eba8cd 0027349: XtControl_Reader is not thread-safe
Support of profiles for norms is removed
Getting rid of thread-unsafe static variables.
Sequence is not thread-safe. Replacing it with Vector.
Updating samples due to previous changes.
Resolving conflict with system environment.
2016-04-22 15:22:10 +03:00
duv
299e0ab98f 0026809: Visualization, TKOpenGl - handle point arrays with per-vertex color within built-in GLSL programs
Shader rendering of point sprites with per-vertex colors and shading have been fixed.

Material state was removed from OpenGl_ShaderManager.
Material properties now should be modified trough OpenGl_Context::SetShadingMaterial().
2016-04-22 15:22:03 +03:00
nbv
b8f67cc236 0027302: Invalid curves number in intersection result
1. In frame of the fix for #27282 issue, we have obtained several prolonged curves, which have common point(s). Fix for this issue joins these curves if it is possible.

2. ElCLib::InPeriod(...) method has been improved. Now it has become more faster (in general cases) and more reliable (in frame of  FLT_OVERFLOW and DIVISION_BY_ZERO cases processing).

Creation of test case for issue #27302
Test case tests\bugs\modalg_6\bug27282_2 has been adjusted in accordance with its new behavior.
2016-04-22 15:21:57 +03:00
kgv
8b9a309b48 0027202: Visualization - add sensitivity Select3D_SensitivePrimitiveArray for Graphic3d_Buffer
New class Select3D_SensitivePrimitiveArray can be initialized directly from
presentation data structures Graphic3d_Buffer defining triangulation or point set.

This class also can combine several elements into patches
to reduce BVH initialization time in at the expense of slower detection time.

AIS_PointCloud::ComputeSelection() - selection is now computed on point set using Select3D_SensitivePrimitiveArray by default.
PrsMgr_PresentableObject::Compute() - redundant default argument value has been dropped.
BVH - store BVH_Set size in local variable to simplify debugging.
2016-04-22 15:21:51 +03:00
aba
3f1eb0abf9 0027359: Visualization - add support of flipping for textured text
Added option for OpenGl_Text to use previous model-view state.
Added interface to enable this option in Prs3d_Text
Added option to enable flipping in AIS_NameLabel

Eliminated warning
2016-04-22 15:21:45 +03:00
mpa
016e595986 0026886: Visualization, TKV3d - eliminate global variables
- AIS_InteractiveContext - create new dummy class field to have an empty TopoDS_Shape object.
- AIS_Point, PrsMgr_PresentableObject - rename static variables to local function variables.
- AIS_Shape, SelectMgr_SelectableObject - remove unused static variables.
- Graphic3d_MaterialAspect, V3d_Viewer - make global static variables as constant.
- V3d_View - move global variable zRotation to class field.
- Move a variable theCurrentSelection as a field of AIS_InteractiveContext and AIS_LocalContext classes. Multiple selection is not used now, so each Context have an own selection.
- Move myStructGenId from Graphic3d_StructureManager to Graphic3d_GraphicDriver for identifying the structures in the driver.
- Move default variable (no shading light) from static value to the class field of OpenGL_View.
Porting note:
- Static methods of AIS_Selection is not used now. Methods of
  AIS_InteractiveContext::InitSelected(),::MoreSelected(),::NextSelected()
  should be used instead of static methods of AIS_Selection.
2016-04-22 15:21:39 +03:00
isk
83da37b115 0026434: Visualization - Textured objects should have priority over the environment mapping.
Add handle on environment texture in OpenGl_Workspace.
Add a new parameter UseEnvironmentTexture to the Graphic3d_ZLayerSettings.
OSD layers don't use environment texture by default.
zbuffertrihedron doesn't use environment texture.
vzlayer can enable/disable environment texture mappping.
Delete unnecessary files Graphic3d_TypeOfSurfaceDetail.hxx and V3d_TypeOfSurface.hxx.
Delete functions SurfaceDetailType and SetSurfaceDetailType functions from Graphic3d_CView.
Delete functions SurfaceDetailState and UpdateSurfaceDetailStateTo from OpenGl_ShaderManager.
Delete class OpenGl_SurfaceDetailState.
Delete functions SurfaceDetailType and SetSurfaceDetailType from OpenGl_View.
Delete functions SetSurfaceDetail and SurfaceDetail() from V3d_View.
Delete functions SetDefaultSurfaceDetail and DefaultSurfaceDetail from V3d_Viewer.
Delete draw command VSetTextureMode.
Add description in dox.
2016-04-22 15:21:32 +03:00
aml
6143f12f36 0027275: Unused formal parameter in BSplCLib::EvalBsplineBasis
Unused formal parameter is deleted.
2016-04-22 15:21:24 +03:00
abv
9a9a3edfd8 0027234: Code duplication: Convert_CompBezierCurvesToBSplineCurve* in ShapeConstruct
Classes from ShapeConstruct duplicating the ones from Convert package are removed.
Protection against joining segments when degree is 1 is introduced in Convert classes.
Optimization previously made in Convert_CompBezierCurvesToBSplineCurve class (within #25256) is applied to 2d equivalent.

Data for automatic upgrade procedure are extended to replace removed classes by their duplicates from Convert.

// cout disabled unless OCCT_DEBUG is defined
2016-04-22 15:21:19 +03:00
ika
02fd709bbb 0026930: ShapeConstruct_ProjectCurveOnSurface returns a B-Spline instead of line (again)
Upgrade check of closeness of 2dcurve to line during projection:
  For C1 and more surfaces check distance to normal, not to surface, for C0 surfaces update tolerance formula.
  Add check for possible period jump in some inner point.
Update some test cases.

Add cache saving for lines,
update fixPeriodicTroubles() function, using parameters from cashe.

Small correction of test cases for issue #26930

fix processing of points from cache.

Update of test cases according to the new behavior

Fix behavior of fixPeriodicityTroubles() on different isolines,
fix copy/paste mistake.
Update test cases:
iges_2 C4 - return to master values
step_3 E6 - improvement.
2016-04-21 11:37:32 +03:00
abv
4680293609 0027385: assertion in static initializer in a Windows GUI application
Useless global pointer to cerr is removed from OSD_Error, along with methods supporting its customization (Windows-only).
Global accessors to environment variables are replaced by locals in UnitsAPI.cxx.
2016-04-15 16:07:57 +03:00
gka
a0bb29e79e 0027272: FixMissingSeam function creates G1 seam curves
Method BRepLib::EncodeRegularity() is improved to set regularity GeomAbs_CN for edges lying on the same-domain surfaces (where derivatives on both surfaces are equal in all points).

DRAW command getedgeregularity is added to query regularity of the edge on specified faces.
DRAW command edgeregul is removed (this functionality is provided by command encoderegularity).

Added tests: bugs modalg_6 bug27272, bug27383_1, bug27383_2

Correction of shape name in test case for issue CR27272
2016-04-15 10:59:52 +03:00
ski
46bd680a25 0027351: Custom OCCT DLL name suffixes
Added generation of libraries with postfix.
2016-04-14 13:13:05 +03:00
ski
3321f6847d 0027380: cmake should not try to link against 3rd-party libs when configuring a static OCCT build
Linking against 3rd-party libs when configuring a static OCCT build is eliminated.

math library is not linked if build is static

also: an info message is expanded by several words describing using of only header files of 3rdparties

Removed unnecessary for static build CMake gui variables
2016-04-14 12:57:53 +03:00
apn
f7ac9097ee 0027369: Assistance building Parasolid importer
OpenCASCADE${OCCT_MODULE}Targets are generated for all dependent toolkits.
2016-04-14 12:55:20 +03:00
jgv
601b1c8d56 0027280: HLR algorithms taking seam edges into account
Interface of HLRAppli_ReflectLines has been modified.
New Draw command "hlrin3d" has been added.
2016-04-14 12:45:56 +03:00
nbv
309bad284d 0026918: GeomLib_CheckCurveOnSurface cannot compute distance if 3D-curve is periodic
Creation of test case for this issue.
2016-04-14 12:43:02 +03:00
nbv
79981d14cc 0027124: Invalid curve on surface in the result of General Fuse operation
Creation of test cases for issues #27124 and #27129.
2016-04-14 12:32:40 +03:00
ika
f0bf70e8cc 0027372: Import/Export dimension text position
Modify Import/Export STEP.
Add Draw commands to set and get orientation and position of dimension text.
Add Draw commands to set and get presentation.
Add test.
2016-04-14 11:53:06 +03:00
ifv
8f8398f6e4 0027322: geom/revolution_00/A1: Incorrect pcurve creation
ProjLib_Cone.cxx - correction wrong calculation of projection line on cone
GeomInt_IntSS_1.cxx - modification of method BuildPCurves(...) - adjusting first or last knots of 2d Curve
ProjLib_ComputeApprox.cxx - modification of method Function_SetUVBounds(...) for case projecting line on cone.
Modification of tests - removing first TODO

Test case for issue #27322
2016-04-14 11:50:33 +03:00
emv
94074ec660 0027379: Unable to build TKXDESTEP using WOK (wgenproj command) in current master
The dependency on TKShHealing has been added.
2016-04-13 10:31:59 +03:00
ibs
9d034c3730 0027321: Configuration, CMake - check for doxygen during the first configuration and turn on overview building if doxygen is found 2016-04-11 10:46:18 +03:00
604 changed files with 14479 additions and 13167 deletions

1
.gitignore vendored
View File

@@ -49,6 +49,7 @@ Release
/*.m4
/*.ac
/*.sh
/codeblocks.bat
/custom.bat
/autom4te.cache
/build_configure

View File

@@ -24,8 +24,14 @@ endif()
if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
set (BUILD_SHARED_LIBS ON)
if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX)
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
endif()
else()
unset (BUILD_SHARED_LIBS)
message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
endif()
# the name of the project
@@ -59,9 +65,16 @@ if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration ge
endif()
# enable extended messages of many OCCT algorithms
set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}")
if ((SINGLE_GENERATOR AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR NOT SINGLE_GENERATOR)
if (NOT BUILD_WITH_DEBUG)
set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}")
endif()
else()
OCCT_CHECK_AND_UNSET (BUILD_WITH_DEBUG)
endif()
if (BUILD_WITH_DEBUG)
add_definitions (-DOCCT_DEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
endif()
# copy samples to install directory
@@ -281,6 +294,10 @@ else()
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}")
endif()
if(APPLE)
set (INSTALL_NAME_DIR "" CACHE STRING "install_name library suffix on OS X (e.g. @executable_path/../Frameworks)")
endif()
# a directory recognized as a 'patch' for OCCT
set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}")
@@ -316,7 +333,17 @@ if (ANDROID AND BUILD_MODULE_Draw)
endif()
# Overview
set (BUILD_DOC_Overview OFF CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
if (NOT DEFINED BUILD_DOC_Overview)
set (DO_ONLY_CHECK_FOR_DOXYGEN ON)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
set (DO_ONLY_CHECK_FOR_DOXYGEN OFF)
if (CAN_DOXYGEN_BE_USED)
message (STATUS "Info. Overview building is turned on")
endif()
set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
endif()
if (NOT USE_D3D)
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
@@ -569,7 +596,7 @@ endif()
# include <cmake binary folder>/inc
include_directories (${CMAKE_BINARY_DIR}/inc)
if (3RDPARTY_LIBRARY_DIRS)
if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS)
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
@@ -613,7 +640,11 @@ COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}"
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}")
list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX)
if (${DRAWEXE_INDEX} GREATER -1)
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}")
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
endif()
if (WIN32)
set (SCRIPT_EXT bat)
@@ -641,8 +672,6 @@ if (INSTALL_SAMPLES)
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}")
endif()
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
if (INSTALL_TEST_CASES)
OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR}/${INSTALL_DIR_TESTS}")
endif()
@@ -713,6 +742,11 @@ foreach(RESOURCE ${RESOURCES})
endif()
endforeach()
# patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed
if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
OCCT_UPDATE_DRAW_DEFAULT_FILE()
endif()
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
@@ -791,7 +825,14 @@ foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE})
set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n")
endif()
# sort enabled modules for correct work of OpenCASCADE config file
list(FIND OCCT_MODULES_ENABLED "${OCCT_MODULE}" OCCT_MODULE_INDEX)
if (NOT ${OCCT_MODULE_INDEX} EQUAL -1)
list (APPEND OCCT_MODULES_ENABLED_SORTED ${OCCT_MODULE})
endif()
endforeach()
set (OCCT_MODULES_ENABLED ${OCCT_MODULES_ENABLED_SORTED})
# Add all targets to the build-tree export set
export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake")
@@ -835,10 +876,8 @@ write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.c
install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}")
# Install the export set for use with the install-tree for each configuration
foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE})
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
endif()
foreach (OCCT_MODULE ${OCCT_MODULES_ENABLED})
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
endforeach()
# Update generated OpenCASCADETargets-*.cmake files

View File

@@ -363,6 +363,8 @@ n XCAFApp
n XCAFDimTolObjects
n XCAFDoc
n XCAFPrs
n XCAFDrivers
n XCAFPersistent
n XSAlgo
n XSControl
n XmlMXCAFDoc

View File

@@ -8,7 +8,7 @@ set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
if (NOT DEFINED INSTALL_${PRODUCT_NAME})
if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
endif()
@@ -37,47 +37,50 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE PATH "the path of ${HEADER_NAME}")
endif()
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
endif()
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
endif()
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
endif()
endif()
endif()
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
endif()
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
endif()
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
endif()
endif()
endif()
endif()
@@ -109,156 +112,158 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE)
endif()
# library
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
if (BUILD_SHARED_LIBS)
# library
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
if (ANDROID)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
endif()
set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
if (ANDROID)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
endif()
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
else()
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
endif()
endif()
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
endif()
# shared library
if (WIN32)
if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME}
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
PATH_SUFFIXES bin
NO_DEFAULT_PATH)
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
else()
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
endif()
endif()
if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
endif()
endif()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
if (INSTALL_${PRODUCT_NAME})
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
# shared library
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME}
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
PATH_SUFFIXES bin
NO_DEFAULT_PATH)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${FREEIMLIB}.3)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${FREEIMLIB}.3)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${FREEIMLIB}.3)
find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
endif()
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
else()
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
endif()
endif()
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${GL2PSLIB}.1)
endif()
if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
endif()
endif()
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
else()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
endif()
endif()
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
if (INSTALL_${PRODUCT_NAME})
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${FREEIMLIB}.3)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${FREEIMLIB}.3)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${FREEIMLIB}.3)
endif()
endif()
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${GL2PSLIB}.1)
endif()
endif()
endif()
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
else()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
endif()
endif()
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
endif()
endmacro()
macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
@@ -272,48 +277,52 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
endif()
# library dir
if (BUILD_SHARED_LIBS)
# library dir
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
endif()
# shared library dir
if (WIN32)
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
endif()
endif()
endif()
endif()
if (BUILD_SHARED_LIBS)
# check library
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
endif()
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
endif()
# shared library dir
# check shared library
if (WIN32)
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
endif()
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
endif()
endif()
endif()
# check library
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
endif()
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
endif()
# check shared library
if (WIN32)
set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
endif()
endif()
if (NOT DOES_PATH_CONTAIN)
set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
endif()
endif()
endmacro()

View File

@@ -1,45 +1,57 @@
# doxygen
set (3RDPARTY_DOT_EXECUTABLE_DESCR "The path to the 'dot' tool producing layered drawings of directed graphs.\nThis tool used by doxygen")
set (3RDPARTY_DOXYGEN_EXECUTABLE_DESCR "The path to the doxygen command")
if (NOT DEFINED 3RDPARTY_DOXYGEN_EXECUTABLE)
set (3RDPARTY_DOXYGEN_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DOT_EXECUTABLE)
set (3RDPARTY_DOT_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_SKIP_DOT_EXECUTABLE)
set (3RDPARTY_SKIP_DOT_EXECUTABLE OFF CACHE BOOL "Skip trying to find Dot")
endif()
if (3RDPARTY_SKIP_DOT_EXECUTABLE)
OCCT_CHECK_AND_UNSET (3RDPARTY_DOT_EXECUTABLE)
endif()
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE))
set (DOXYGEN_SKIP_DOT ${3RDPARTY_SKIP_DOT_EXECUTABLE})
if (DO_ONLY_CHECK_FOR_DOXYGEN)
message (STATUS "Info. Detecting doxygen")
set (DOXYGEN_SKIP_DOT ON)
find_package (Doxygen)
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE AND DOXYGEN_EXECUTABLE)
set (3RDPARTY_DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}" FORCE)
endif()
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE AND DOXYGEN_DOT_EXECUTABLE)
set (3RDPARTY_DOT_EXECUTABLE "${DOXYGEN_DOT_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}" FORCE)
endif()
endif()
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOXYGEN_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOXYGEN_EXECUTABLE)
endif()
set (CAN_DOXYGEN_BE_USED OFF)
if (DOXYGEN_EXECUTABLE)
set (CAN_DOXYGEN_BE_USED ON)
message (STATUS "Info. Doxygen is found and can be used")
endif()
else()
set (3RDPARTY_DOT_EXECUTABLE_DESCR "The path to the 'dot' tool producing layered drawings of directed graphs.\nThis tool used by doxygen")
set (3RDPARTY_DOXYGEN_EXECUTABLE_DESCR "The path to the doxygen command")
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE)
if (NOT 3RDPARTY_DOT_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOT_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOT_EXECUTABLE)
if (NOT DEFINED 3RDPARTY_DOXYGEN_EXECUTABLE)
set (3RDPARTY_DOXYGEN_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DOT_EXECUTABLE)
set (3RDPARTY_DOT_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_SKIP_DOT_EXECUTABLE)
set (3RDPARTY_SKIP_DOT_EXECUTABLE ON CACHE BOOL "Skip trying to find Dot")
endif()
if (3RDPARTY_SKIP_DOT_EXECUTABLE)
OCCT_CHECK_AND_UNSET (3RDPARTY_DOT_EXECUTABLE)
endif()
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE))
set (DOXYGEN_SKIP_DOT ${3RDPARTY_SKIP_DOT_EXECUTABLE})
find_package (Doxygen)
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE AND DOXYGEN_EXECUTABLE)
set (3RDPARTY_DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}" FORCE)
endif()
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE AND DOXYGEN_DOT_EXECUTABLE)
set (3RDPARTY_DOT_EXECUTABLE "${DOXYGEN_DOT_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}" FORCE)
endif()
endif()
if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOXYGEN_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOXYGEN_EXECUTABLE)
endif()
if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE)
if (NOT 3RDPARTY_DOT_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOT_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOT_EXECUTABLE)
endif()
endif()
endif()

View File

@@ -1,6 +1,6 @@
# freetype
if (NOT DEFINED INSTALL_FREETYPE)
if (NOT DEFINED INSTALL_FREETYPE AND BUILD_SHARED_LIBS)
set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}")
endif()
@@ -37,23 +37,25 @@ if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
endif()
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
endif()
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library")
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
endif()
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library")
endif()
endif()
endif()
@@ -61,24 +63,25 @@ endif()
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
endif()
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
endif()
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
endif()
endif()
endif()
endif()
@@ -118,7 +121,9 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
endif()
endif()
# assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
@@ -134,17 +139,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
endif()
endif()
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
endif()
endif()
endif()
@@ -211,131 +218,132 @@ else()
endif()
# freetype library
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (FREETYPE_PATH_SUFFIXES lib)
if (ANDROID)
set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
endif()
set (FREETYPE_PATH_SUFFIXES lib)
if (ANDROID)
set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
endif()
# set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
endif()
endif()
if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
endif()
# freetype shared library
if (WIN32)
if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
# set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
# set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
find_library (3RDPARTY_FREETYPE_DLL freetype
PATHS "${3RDPARTY_FREETYPE_DIR}"
PATH_SUFFIXES bin
NO_DEFAULT_PATH)
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_FREETYPE_DLL freetype
PATH_SUFFIXES bin)
find_library (3RDPARTY_FREETYPE_LIBRARY freetype
PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
endif()
endif()
if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
endif()
endif()
# install instructions
if (INSTALL_FREETYPE)
OCCT_MAKE_OS_WITH_BITNESS()
# freetype shared library
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
# set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
find_library (3RDPARTY_FREETYPE_DLL freetype
PATHS "${3RDPARTY_FREETYPE_DIR}"
PATH_SUFFIXES bin
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_FREETYPE_DLL freetype
PATH_SUFFIXES bin)
endif()
if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
else()
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
endif()
endif()
if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
else()
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
endif()
endif()
set (USED_3RDPARTY_FREETYPE_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
# install instructions
if (INSTALL_FREETYPE)
OCCT_MAKE_OS_WITH_BITNESS()
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES "${3RDPARTY_FREETYPE_DLL}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
else()
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
endif()
endif()
set (USED_3RDPARTY_FREETYPE_DIR "")
else()
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
else()
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
endif()
endif()
endif()
@@ -344,4 +352,12 @@ OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
if (BUILD_SHARED_LIBS)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
else()
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL_DIR)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET(INSTALL_FREETYPE)
endif()

View File

@@ -10,7 +10,7 @@ if (NOT DEFINED USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
endif()
if (USE_TCL)
if (USE_TCL AND BUILD_SHARED_LIBS)
if ("${3RDPARTY_TCL_LIBRARY_VERSION}" STREQUAL "")
message (STATUS "Warning: TCL version has not been specified by CSF_TclLibs defining thus it will be used as 8.6")
set (3RDPARTY_TCL_LIBRARY_VERSION "8.6")
@@ -44,6 +44,12 @@ if (WIN32)
set (CSF_FREETYPE)
endif()
if (USE_GL2PS)
set (CSF_GL2PS "gl2ps.lib")
else()
set (CSF_GL2PS)
endif()
if (USE_FREEIMAGE)
set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib")
else()

View File

@@ -104,14 +104,20 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
elseif(NOT WIN32)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
else()
if (NOT ANDROID AND NOT MINGW)
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
endif()
endif()
endif()
if(MINGW)
# Set default release optimization option to O2 instead of O3, since in
# some OCCT related examples, this gives significantly smaller binaries
# at comparable performace with MinGW-w64.
string (REGEX MATCH "-O3" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
if (IS_O3_CXX)
string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
else()
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
add_definitions(-D_WIN32_WINNT=0x0501)
# workaround bugs in mingw with vtable export

View File

@@ -576,3 +576,26 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
set (OCCT_INSTALL_BIN_LETTER \"d\")
endif()")
endmacro()
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
install(CODE "cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
endforeach()
cmake_policy(POP)")
endmacro()
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
if (NOT WIN32)
install (CODE "if (EXISTS \"${LIBRARY_NAME}\")
execute_process (COMMAND ln -s \"${LIBRARY_NAME}\" \"${LINK_NAME}\")
endif()
")
endif()
endmacro()

View File

@@ -152,16 +152,35 @@ else()
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
endif()
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
install (TARGETS ${PROJECT_NAME}
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
set (LINK_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}")
set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
endif()
endif()
endif()
if (CURRENT_MODULE)
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
if (APPLE)
if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
endif()
endif()
endif()
get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
@@ -216,4 +235,21 @@ if (APPLE)
endif()
endif()
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
# Add VTK_OPENGL2_BACKEND definition.
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
add_definitions(-DVTK_OPENGL2_BACKEND)
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
endif()
endif()
endforeach()
endif()
if (BUILD_SHARED_LIBS)
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
endif()

View File

@@ -1,6 +1,6 @@
# tbb
if (NOT DEFINED INSTALL_TBB)
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
@@ -9,7 +9,7 @@ if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (MSVC)
if (MSVC AND BUILD_SHARED_LIBS)
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
endif()
@@ -129,7 +129,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
# tbb/tbbmalloc library
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME})
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
@@ -275,18 +275,18 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
endmacro()
if (BUILD_SHARED_LIBS)
TBB_PRODUCT_SEARCH (TBB)
TBB_PRODUCT_SEARCH (TBBMALLOC)
TBB_PRODUCT_SEARCH (TBB)
TBB_PRODUCT_SEARCH (TBBMALLOC)
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif()
endif()
endif()

View File

@@ -1,6 +1,6 @@
# tcl
if (NOT DEFINED INSTALL_TCL)
if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
endif()
@@ -14,26 +14,28 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
endif()
# tcl library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
endif()
# tcl library directory
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
endif()
# tcl shared library (with absolute path)
if (WIN32)
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
if (BUILD_SHARED_LIBS)
# tcl library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
endif()
endif()
# tcl shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
# tcl library directory
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
endif()
# tcl shared library (with absolute path)
if (WIN32)
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
endif()
endif()
# tcl shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
endif()
endif()
# search for tcl in user defined directory
@@ -62,199 +64,203 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
endif()
endif()
# tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
if (BUILD_SHARED_LIBS)
# tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif()
endif()
endif()
endif()
if (WIN32)
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
if (WIN32)
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
elseif (3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
elseif (3RDPARTY_TCL_LIBRARY_DIR)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif()
endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
# tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
NO_DEFAULT_PATH)
if (BUILD_SHARED_LIBS)
# tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
NO_DEFAULT_PATH)
# search in another place if previous search doesn't find anything
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
PATHS "${3RDPARTY_TCL_DIR}/lib"
NO_DEFAULT_PATH)
# search in another place if previous search doesn't find anything
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
PATHS "${3RDPARTY_TCL_DIR}/lib"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
endif()
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif()
endif()
set (3RDPARTY_TCL_LIBRARY_VERSION "")
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TCL version isn't found")
endif()
endif()
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TCL_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
endif()
if (WIN32)
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
else()
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
endif()
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif()
endif()
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
set (3RDPARTY_TCL_LIBRARY_VERSION "")
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TCL version isn't found")
endif()
endif()
endif()
# include found paths to common variables
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
endif()
if (WIN32)
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TCL_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
endif()
endif()
# install tcl
if (INSTALL_TCL)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
# collect and install all dlls from tcl dll dirs
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TCL_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
elseif (3RDPARTY_TCL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
else()
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
endif()
if (SINGLE_GENERATOR)
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES ${TCL_DLLS}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES ${TCL_DLLS}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES ${TCL_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
endif()
endif()
else()
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
endif()
endif()
if (TCL_TCLSH_VERSION)
# tcl is required to install in lib folder (without)
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
# include found paths to common variables
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
else()
message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
endif()
set (USED_3RDPARTY_TCL_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
else()
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
endif()
endif()
endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
# install tcl
if (INSTALL_TCL)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
# tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
# collect and install all dlls from tcl dll dirs
file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
if (SINGLE_GENERATOR)
install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES ${TCL_DLLS}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES ${TCL_DLLS}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES ${TCL_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
endif()
endif()
if (TCL_TCLSH_VERSION)
# tcl is required to install in lib folder (without)
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
endif()
set (USED_3RDPARTY_TCL_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
else()
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
endif()
endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
endif()
if (TK_FOUND AND 3RDPARTY_TCL_DIR)
@@ -278,3 +284,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
OCCT_CHECK_AND_UNSET (TK_LIBRARY)
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
OCCT_CHECK_AND_UNSET (TK_WISH)
if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
endif()

View File

@@ -1,6 +1,6 @@
# tk
if (NOT DEFINED INSTALL_TK)
if (NOT DEFINED INSTALL_TK AND BUILD_SHARED_LIBS)
set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}")
endif()
@@ -18,26 +18,28 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
endif()
# tk library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
endif()
# tk library directory
if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
endif()
# tk shared library (with absolute path)
if (WIN32)
if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
if (BUILD_SHARED_LIBS)
# tk library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
endif()
endif()
# tk shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
# tk library directory
if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
endif()
# tk shared library (with absolute path)
if (WIN32)
if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
endif()
endif()
# tk shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
endif()
endif()
# search for tk in user defined directory
@@ -66,21 +68,89 @@ if (NOT 3RDPARTY_TK_INCLUDE_DIR)
endif()
endif()
# tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
if (BUILD_SHARED_LIBS)
# tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
if (NOT 3RDPARTY_TK_LIBRARY_DIR)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
if (NOT 3RDPARTY_TK_LIBRARY_DIR)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
endif()
endif()
endif()
if (WIN32)
if (NOT 3RDPARTY_TK_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TK_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
elseif (3RDPARTY_TK_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
elseif (3RDPARTY_TK_LIBRARY_DIR)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
endif()
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif()
endif()
endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
if (WIN32)
if (NOT 3RDPARTY_TK_DLL)
if (BUILD_SHARED_LIBS)
# tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
NO_DEFAULT_PATH)
# search in another place if previous search doesn't find anything
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
PATHS "${3RDPARTY_TK_DIR}/lib"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
endif()
if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
endif()
endif()
set (3RDPARTY_TK_LIBRARY_VERSION "")
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TK version isn't found")
endif()
endif()
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TK_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
endif()
if (WIN32)
if (NOT 3RDPARTY_TK_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
set (DLL_FOLDER_FOR_SEARCH "")
@@ -88,89 +158,25 @@ if (WIN32)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
elseif (3RDPARTY_TK_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
elseif (3RDPARTY_TK_LIBRARY_DIR)
else()
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
endif()
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
endif()
endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
# tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
NO_DEFAULT_PATH)
# search in another place if previous search doesn't find anything
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
PATHS "${3RDPARTY_TK_DIR}/lib"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
endif()
if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
endif()
endif()
set (3RDPARTY_TK_LIBRARY_VERSION "")
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TK version isn't found")
endif()
endif()
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TK_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
endif()
if (WIN32)
if (NOT 3RDPARTY_TK_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
set (DLL_FOLDER_FOR_SEARCH "")
if (3RDPARTY_TK_DLL_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
elseif (3RDPARTY_TK_DIR)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
else()
get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
endif()
endif()
set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH)
if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
endif()
endif()
if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
endif()
endif()
# include found paths to common variables
@@ -180,85 +186,87 @@ else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR)
endif()
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
endif()
if (WIN32)
if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
if (BUILD_SHARED_LIBS)
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
endif()
endif()
# install tk
if (INSTALL_TK)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
# tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
# collect and install all dlls from tk dll dirs
file (GLOB TK_DLLS "${3RDPARTY_TK_DLL_DIR}/*.dll")
if (SINGLE_GENERATOR)
install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
else()
install (FILES ${TK_DLLS}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES ${TK_DLLS}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES ${TK_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
endif()
endif()
if (TCL_TCLSH_VERSION)
# tk is required to install in lib folder (without)
install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
# install tk
if (INSTALL_TK)
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
# tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
# collect and install all dlls from tk dll dirs
file (GLOB TK_DLLS "${3RDPARTY_TK_DLL_DIR}/*.dll")
if (SINGLE_GENERATOR)
install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
install (FILES ${TK_DLLS}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
install (FILES ${TK_DLLS}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
install (FILES ${TK_DLLS}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
endif()
endif()
if (TCL_TCLSH_VERSION)
# tk is required to install in lib folder (without)
install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
endif()
set (USED_3RDPARTY_TK_DIR "")
else()
message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
else()
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
endif()
endif()
set (USED_3RDPARTY_TK_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
else()
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
endif()
mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
endif()
mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
# unset all redundant variables
#TCL
OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
@@ -268,3 +276,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
OCCT_CHECK_AND_UNSET (TK_LIBRARY)
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
OCCT_CHECK_AND_UNSET (TK_WISH)
if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TK)
endif()

View File

@@ -19,8 +19,12 @@ ExprIntrp functionality are generated automatically with Flex/Bison. Checking th
leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files")
set (BUILD_WITH_DEBUG_DESCR
"Enables extended messages of many OCCT algorithms, usually printed to cout.
These include messages on internal errors and special cases encountered, timing etc")
"Enables extended messages of many OCCT algorithms, usually printed to cout.
These include messages on internal errors and special cases encountered, timing etc.
Applies only for Debug configuration.")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries")
# install variables
set (INSTALL_DIR_DESCR

View File

@@ -31,23 +31,27 @@ if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK")
endif()
# vtk library directory
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
endif()
if (BUILD_SHARED_LIBS)
# vtk library directory
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
endif()
# vtk dll directory
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
# vtk dll directory
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
endif()
endif()
# check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_INCLUDE_DIR PATH "The directory containing headers of VTK")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
endif()
endif()
endif()
@@ -70,8 +74,11 @@ if (VTK_FOUND)
if (VTK_LIBRARIES)
set (3RDPARTY_VTK_INCLUDE_DIRS)
set (3RDPARTY_VTK_LIBRARY_DIRS)
set (3RDPARTY_VTK_DLL_DIRS)
if (BUILD_SHARED_LIBS)
set (3RDPARTY_VTK_LIBRARY_DIRS)
set (3RDPARTY_VTK_DLL_DIRS)
endif()
foreach (VTK_LIBRARY ${VTK_LIBRARIES})
string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY})
@@ -81,70 +88,71 @@ if (VTK_FOUND)
list (APPEND 3RDPARTY_VTK_INCLUDE_DIRS "${${VTK_LIBRARY}_INCLUDE_DIRS}")
endif()
if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
endif()
if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
if (NOT WIN32)
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
endif()
endif()
# get paths from corresponding properties
get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
if (TARGET_VTK_IMPORT_CONFS)
list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
# todo: choose configuration in connection with the build type
#if (CMAKE_BUILD_TYPE)
# foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
# endforeach()
#endif()
# Work-around against link failure in case if VTK contains dependency
# on DirectX: its run-time is always present on Windows, but SDK can
# be absent on current workstation, while not actually needed for
# OCCT linking.
# VTK 6.1 for VC 10
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
if (HARDCODED_D3D9_LIB)
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
endif()
endif()
# VTK 6.1 for VC 12, 14
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
if (HARDCODED_D3D9_LIB)
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
endif()
if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
endif()
get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
if (NOT WIN32)
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
endif()
endif()
get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
# get paths from corresponding properties
get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
if (WIN32)
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
else()
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
if (TARGET_VTK_IMPORT_CONFS)
list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
# todo: choose configuration in connection with the build type
#if (CMAKE_BUILD_TYPE)
# foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
# endforeach()
#endif()
# Work-around against link failure in case if VTK contains dependency
# on DirectX: its run-time is always present on Windows, but SDK can
# be absent on current workstation, while not actually needed for
# OCCT linking.
# VTK 6.1 for VC 10
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
if (HARDCODED_D3D9_LIB)
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
endif()
endif()
# VTK 6.1 for VC 12, 14
get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
if (HARDCODED_D3D9_LIB)
message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
endif()
endif()
get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
endif()
get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
if (WIN32)
list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
else()
list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
endif()
endif()
endif()
endif()
@@ -160,24 +168,25 @@ if (VTK_FOUND)
set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE)
endif()
if (3RDPARTY_VTK_LIBRARY_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
if (BUILD_SHARED_LIBS)
if (3RDPARTY_VTK_LIBRARY_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
endif()
list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
endif()
if (WIN32)
if (3RDPARTY_VTK_DLL_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
if (WIN32)
if (3RDPARTY_VTK_DLL_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
endif()
endif()
endif()
endif()
if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR})
@@ -185,17 +194,19 @@ else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
endif()
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
endif()
if (WIN32)
if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
if (BUILD_SHARED_LIBS)
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
endif()
if (WIN32)
if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
endif()
endif()
endif()

View File

@@ -371,8 +371,8 @@ entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
#
checkbutton .myFrame.myHxxChecks.myScutsCheck -offvalue "false" -onvalue "true" -variable SHORTCUT_HEADERS
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Create short-cuts to headers in inc folder instead of copying"
ttk::combobox .myFrame.myHxxChecks.myScutsCombo -values { {ShortCut} {Copy} {HardLink} } -textvariable SHORTCUT_HEADERS -state readonly -width 12
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling headers folder inc:"
#
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
@@ -384,6 +384,10 @@ checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
if { "$::tcl_platform(platform)" == "windows" } {
checkbutton .myFrame.myChecks.myD3dCheck -offvalue "false" -onvalue "true" -variable HAVE_D3D -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myD3dLbl -text "Use Direct3D"
}
#checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList
#ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
@@ -465,8 +469,8 @@ if { "$tcl_platform(platform)" == "windows" } {
#
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsCombo -row 0 -column 1
incr aRowIter
#
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
@@ -483,6 +487,10 @@ grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 5 -sticky w
if { "$::tcl_platform(platform)" == "windows" } {
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 7 -sticky w
}
#grid .myFrame.myChecks.myOpenClCheck -row $aCheckRowIter -column 6 -sticky e
#grid .myFrame.myChecks.myOpenClLbl -row $aCheckRowIter -column 7 -sticky w
incr aCheckRowIter

View File

@@ -41,11 +41,12 @@ if { "$tcl_platform(platform)" == "unix" } {
set VCVARS ""
}
set SHORTCUT_HEADERS "true"
set SHORTCUT_HEADERS "ShortCut"
set HAVE_FREEIMAGE "false"
set HAVE_GL2PS "false"
set HAVE_TBB "false"
set HAVE_D3D "false"
set HAVE_OPENCL "false"
set HAVE_VTK "false"
set MACOSX_USE_GLX "false"
@@ -72,6 +73,9 @@ if { [info exists ::env(VCVARS)] } {
}
if { [info exists ::env(SHORTCUT_HEADERS)] } {
set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
if { $SHORTCUT_HEADERS == "true" } {
set SHORTCUT_HEADERS "ShortCut"
}
}
if { [info exists ::env(HAVE_FREEIMAGE)] } {
set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
@@ -82,6 +86,9 @@ if { [info exists ::env(HAVE_GL2PS)] } {
if { [info exists ::env(HAVE_TBB)] } {
set HAVE_TBB "$::env(HAVE_TBB)"
}
if { [info exists ::env(HAVE_D3D)] } {
set HAVE_D3D "$::env(HAVE_D3D)"
}
if { [info exists ::env(HAVE_OPENCL)] } {
set HAVE_OPENCL "$::env(HAVE_OPENCL)"
}
@@ -949,6 +956,7 @@ proc wokdep:SaveCustom {} {
puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
puts $aFile "set HAVE_TBB=$::HAVE_TBB"
puts $aFile "set HAVE_D3D=$::HAVE_D3D"
puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
puts $aFile "set HAVE_VTK=$::HAVE_VTK"
puts $aFile "set CHECK_QT4=$::CHECK_QT4"

View File

@@ -639,16 +639,27 @@ proc osutils:collectinc {theModules theIncPath} {
}
}
}
lsort -unique $anUsedToolKits
set anUsedToolKits [lsort -unique $anUsedToolKits]
set anUnits {}
foreach anUsedToolKit $anUsedToolKits {
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit]]
}
lsort -unique $anUnits
set anUnits [lsort -unique $anUnits]
if { [info exists ::env(SHORTCUT_HEADERS)] &&
$::env(SHORTCUT_HEADERS) == "true" } {
# define copying style
set aCopyType "copy"
if { [info exists ::env(SHORTCUT_HEADERS)] } {
if { [string equal -nocase $::env(SHORTCUT_HEADERS) "hard"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "hardlink"] } {
set aCopyType "hardlink"
} elseif { [string equal -nocase $::env(SHORTCUT_HEADERS) "true"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "shortcut"] } {
set aCopyType "shortcut"
}
}
if { $aCopyType == "shortcut" } {
# template preparation
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
@@ -683,6 +694,7 @@ proc osutils:collectinc {theModules theIncPath} {
continue
}
}
file delete -force "$theIncPath/$aHeaderFileName"
}
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
@@ -690,7 +702,7 @@ proc osutils:collectinc {theModules theIncPath} {
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
close $aShortCutHeaderFile
}
}
}
} else {
set nbcopied 0
foreach anUnit $anUnits {
@@ -700,14 +712,20 @@ proc osutils:collectinc {theModules theIncPath} {
# copy file only if target does not exist or is older than original
set torig [file mtime $aHeaderFile]
if { ! [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy 0
} else {
set tcopy 0
if { [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy [file mtime $anIncPath/$aHeaderFileName]
}
if { $tcopy < $torig } {
incr nbcopied
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
if { $aCopyType == "hardlink" } {
if { $tcopy != 0 } {
file delete -force "$theIncPath/$aHeaderFileName"
}
file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
} else {
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
}
} elseif { $tcopy != $torig } {
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
}
@@ -2136,6 +2154,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
if { "$aWokStation" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/lib\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"
@@ -2183,6 +2204,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
if { "$aWokStation" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/libd\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"

View File

@@ -1,5 +1,7 @@
[rename]
BRepExtrema_OverlappedSubShapes BRepExtrema_MapOfIntegerPackedMapOfInteger
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d Convert_CompBezierCurves2dToBSplineCurve2d
ShapeConstruct_CompBezierCurves2dToBSplineCurve Convert_CompBezierCurves2dToBSplineCurve
[tcollection]
AdvApp2Var_SequenceOfNode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -20,7 +20,10 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false

View File

@@ -30,13 +30,16 @@ If you have Visual Studio projects already available (pre-installed or generated
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
* *SHORTCUT_HEADERS* -- if set to "true", folder *inc* will be populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
That tool will analyze your environment and propose you to choose available options:
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*)
* Option to use short-cuts to header files in folder *inc* (enabled by default).
* Method to populate folder *inc* (short-cuts by default).
* Location of third-party libraries (usually downloaded from OCCT web site, see above).
* Path to common directory where third-party libraries are located (optional)
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).

View File

@@ -21,7 +21,10 @@ The environment is defined in the file *custom.sh* which can be edited directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false

View File

@@ -247,6 +247,10 @@ The class *Select3D_Projector* now supports both orientation and projection tran
Porting of user applications from an earlier OCCT version to version 6.9.0 requires taking into account the following major changes.
@subsection upgrade_690_shaders 3D Viewer initialization
3D Viewer now uses GLSL programs for managing frame buffer and stereoscopic output.
For proper initialization, application should configure **CSF_ShadersDirectory** environment variable pointing to a folder with GLSL resources - files from folder **CASROOT**/src/Shaders.
@subsection upgrade_690_selection Changes in Selection
@@ -971,3 +975,9 @@ Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* f
* Transformation matrix utilities from *OpenGl_Utils* namespace have been moved to *Graphic3d_TransformUtils* and *Graphic3d_TransformUtils.hxx* header respectively.
* Matrix stack utilities from *OpenGl_Utils* namespace have been moved to *OpenGl_MatrixStack* class and *OpenGl_MatrixStack.hxx* header respectively.
* *OpenGl_View* methods *Begin/EndTransformPersistence* have been removed. Please, use *Graphic3d_TransformPers::Apply()* instead to apply persistence to perspective and world-view projection matrices.
@subsection Correction of texture mapping of objects
Interaction of texture and environment texture is fixed. Textured objects have priority over the environment mapping.
Redundant enumerations V3d_TypeOfSurface and Graphic3d_TypeOfSurface, class OpenGl_SurfaceDetailState, corresponding methods from Graphic3d_CView, OpenGl_ShaderManager, OpenGl_View, V3d_View, V3d_Viewer are deleted.
Draw command VSetTextureMode is deleted.

View File

@@ -84,7 +84,6 @@ void Textures_Presentation::Init()
// initialize v3d_view so it displays textures well
getViewer()->InitActiveViews();
Handle(V3d_View) aView = getViewer()->ActiveView();
aView->SetSurfaceDetail(V3d_TEX_ALL);
aView->SetSize(ZVIEW_SIZE);
setResultTitle("Textured Shape");
@@ -120,11 +119,7 @@ void Textures_Presentation::Init()
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
" // other modes will display the \"normal\", non-textured shape," EOL
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
" aTShape->SetDisplayMode(3); " EOL
"" EOL
" // V3d_TEX_ALL constant must be set as surface detail" EOL
" // for current view to see AIS_TexturedShape" EOL
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
" aTShape->SetDisplayMode(3); " EOL);
}
//////////////////////////////////////////////////////////////////////

View File

@@ -71,7 +71,6 @@ void TexturesExt_Presentation::Init()
// initialize v3d_view so it displays TexturesExt well
getViewer()->InitActiveViews();
Handle(V3d_View) aView = getViewer()->ActiveView();
aView->SetSurfaceDetail(V3d_TEX_ALL);
aView->SetSize(ZVIEW_SIZE);
setResultTitle("Textured Shape");
@@ -107,11 +106,7 @@ void TexturesExt_Presentation::Init()
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
" // other modes will display the \"normal\", non-textured shape," EOL
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
" aTShape->SetDisplayMode(3); " EOL
"" EOL
" // V3d_TEX_ALL constant must be set as surface detail" EOL
" // for current view to see AIS_TexturedShape" EOL
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
" aTShape->SetDisplayMode(3); " EOL);
}
//////////////////////////////////////////////////////////////////////

View File

@@ -70,7 +70,6 @@ void TexturesExt_Presentation::Init()
// initialize v3d_view so it displays TexturesExt well
getViewer()->InitActiveViews();
Handle(V3d_View) aView = getViewer()->ActiveView();
aView->SetSurfaceDetail(V3d_TEX_ALL);
aView->SetSize(ZVIEW_SIZE);
// getDocument()->UpdateResultMessageDlg("Textured Shape",
@@ -106,11 +105,7 @@ void TexturesExt_Presentation::Init()
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
" // other modes will display the \"normal\", non-textured shape," EOL
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
" aTShape->SetDisplayMode(3); " EOL
"" EOL
" // V3d_TEX_ALL constant must be set as surface detail" EOL
" // for current view to see AIS_TexturedShape" EOL
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
" aTShape->SetDisplayMode(3); " EOL);
// CString text(Message.ToCString());
getDocument()->ClearDialog();
getDocument()->SetDialogTitle("Change face color");

View File

@@ -11,11 +11,9 @@
#include "RadiusParamsPage.h"
#include "ParamsFacesPage.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_Selection.hxx>
#include <Quantity_Color.hxx>
BEGIN_MESSAGE_MAP(CDimensionDlg, CDialog)
@@ -763,11 +761,3 @@ void CDimensionDlg::OnClose()
}
CDialog::OnClose();
}
TopoDS_Shape CDimensionDlg::SelectedShape()
{
Handle(Standard_Transient) aSelection = AIS_Selection::CurrentSelection()->Value();
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelection);
Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
return aBrepOwner->Shape().Located (aBrepOwner->Location() * aBrepOwner->Shape().Location());
}

View File

@@ -37,12 +37,6 @@ public:
const TCollection_AsciiString GetUnits() const;
const Quantity_Color GetDimensionColor() const;
public:
// Workaround: AIS_LocalContext::SelectedShape() doesn't take into account local location of selected TopoDS shape,
// and operates with selected interactive object transformation only.
static TopoDS_Shape SelectedShape();
public:
// Dialog Data
enum { IDD = IDD_Dimension };

View File

@@ -35,6 +35,7 @@
#include <VrmlData_ShapeNode.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferReader.hxx>
#include <STEPConstruct_Styles.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <STEPConstruct.hxx>
@@ -430,7 +431,7 @@ IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName,
if (status != IFSelect_RetDone)
return status;
aReader.WS()->MapReader()->SetTraceLevel(2); // increase default trace level
aReader.WS()->TransferReader()->TransientProcess()->SetTraceLevel(2); // increase default trace level
Standard_Boolean failsonly = Standard_False;
aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);

View File

@@ -60,7 +60,6 @@ CButton* CLengthParamsEdgePage::GetButton()
return (CButton*)GetDlgItem (IDC_ChooseEdgeBtn);
}
#include <AIS_Selection.hxx>
//=======================================================================
//function : OnBnClickedChooseEdgeBtn
//purpose :
@@ -76,9 +75,7 @@ void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn()
return;
}
// Workaround for AIS_LocalContext::SelectedShape()
//TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape();
TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape();
TopoDS_Shape aSelShape = myAISContext->SelectedShape();
const TopoDS_Edge& anEdge = TopoDS::Edge (aSelShape);
myAISContext->LocalContext()->ClearSelected();

View File

@@ -78,9 +78,7 @@ void CLengthParamsEdgesPage::OnBnClickedEdge1Btn()
return;
}
// Workaround for AIS_LocalContext::SelectedShape()
myFirstEdge = TopoDS::Edge (CDimensionDlg::SelectedShape());
//myFirstEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
myFirstEdge = TopoDS::Edge (myAISContext->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
@@ -100,9 +98,7 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
return;
}
// Workaround for AIS_LocalContext::SelectedShape()
mySecondEdge = TopoDS::Edge (CDimensionDlg::SelectedShape());
//mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
mySecondEdge = TopoDS::Edge (myAISContext->SelectedShape());
myAISContext->LocalContext()->ClearSelected();

View File

@@ -100,7 +100,6 @@ void OCC_2dView::OnInitialUpdate()
myV2dView =((OCC_2dDoc*)GetDocument())->GetViewer2D()->CreateView();
myV2dView->SetWindow(aWNTWindow);
myV2dView->SetZClippingType(V3d_OFF);
myV2dView->SetSurfaceDetail(V3d_TEX_ALL);
// initialize the grids dialogs
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);

View File

@@ -51,9 +51,7 @@ void CParamsFacesPage::OnBnClickedFacesbtn1()
return;
}
// Workaround for AIS_LocalContext::SelectedShape()
myFirstFace = TopoDS::Face (CDimensionDlg::SelectedShape());
//myFirstFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
myFirstFace = TopoDS::Face (myAISContext->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
@@ -69,9 +67,8 @@ void CParamsFacesPage::OnBnClickedFacesbtn2()
return;
}
// Workaround for AIS_LocalContext::SelectedShape()
mySecondFace = TopoDS::Face (CDimensionDlg::SelectedShape());
//mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
mySecondFace = TopoDS::Face (myAISContext->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner());

View File

@@ -69,9 +69,7 @@ void CRadiusParamsPage::OnBnClickedObjectBtn()
Standard_Boolean isAttachPoint = Standard_False;
Standard_Real aFirstPar = 0, aLastPar = 0;
// Workaround for AIS_LocalContext::SelectedShape()
TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape();
//TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape();
TopoDS_Shape aSelShape = myAISContext->SelectedShape();
if (aSelShape.ShapeType() != TopAbs_EDGE &&
aSelShape.ShapeType() != TopAbs_FACE &&

View File

@@ -47,8 +47,7 @@ Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString theName,
V3d_GOURAUD,
V3d_WAIT,
theComputedMode,
theDefaultComputedMode,
V3d_TEX_NONE);
theDefaultComputedMode);
}
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )

View File

@@ -1015,11 +1015,10 @@ void View::onEnvironmentMap()
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
myView->SetTextureEnv (aTexture);
myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);
}
else
{
myView->SetSurfaceDetail (V3d_TEX_NONE);
myView->SetTextureEnv (Handle(Graphic3d_TextureEnv)());
}
myView->Redraw();

View File

@@ -86,7 +86,6 @@ vclipplane change pb capping on
vclipplane change pb capping color 1.0 0.8 0.0
vclipplane set pb object b
vsettexturemode Driver1/Viewer1/View1 2
vclipplane change pa capping texname $aHatch
vclipplane change pa capping texscale 0.05 -0.05
vclipplane change pb capping texname $aHatch

View File

@@ -27,7 +27,6 @@
#include <AIS_LocalStatus.hxx>
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <AIS_MultipleConnectedInteractive.hxx>
#include <AIS_Selection.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Trihedron.hxx>
#include <Geom_Axis2Placement.hxx>
@@ -67,21 +66,6 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
//#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
namespace
{
static volatile Standard_Integer THE_AIS_INDEX_SEL = 0;
static volatile Standard_Integer THE_AIS_INDEX_CUR = 0;
static TCollection_AsciiString AIS_Context_NewSelName()
{
return TCollection_AsciiString ("AIS_SelContext_")
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_SEL));
}
static TCollection_AsciiString AIS_Context_NewCurName()
{
return TCollection_AsciiString ("AIS_CurContext_")
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_CUR));
}
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
}
@@ -102,6 +86,7 @@ mySelectedTouched(Standard_False),
myToHilightSelected(Standard_True),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
mySelection(new AIS_Selection()),
myDefaultColor(Quantity_NOC_GOLDENROD),
myHilightColor(Quantity_NOC_CYAN1),
mySelectionColor(Quantity_NOC_GRAY80),
@@ -111,27 +96,15 @@ myDisplayMode(0),
myCurLocalIndex(0),
myAISCurDetected(0),
myZDetectionFlag(0),
myIsAutoActivateSelMode( Standard_True )
myIsAutoActivateSelMode(Standard_True)
{
InitAttributes();
}
void AIS_InteractiveContext::Delete() const
{
// clear the static current selection
AIS_Selection::ClearCurrentSelection();
// to avoid an exception
if (AIS_Selection::Find (mySelectionName.ToCString()))
{
AIS_Selection::Remove (mySelectionName.ToCString());
}
// to avoid an exception
if (AIS_Selection::Find (myCurrentName.ToCString()))
{
AIS_Selection::Remove (myCurrentName.ToCString());
}
// clear the current selection
mySelection->Select();
// let's remove one reference explicitly. this operation's supposed to
// be performed when mgrSelector will be destroyed but anyway...
@@ -151,20 +124,6 @@ void AIS_InteractiveContext::Delete() const
MMgt_TShared::Delete();
}
//=======================================================================
//function : AIS_SelectionName
//purpose :
//=======================================================================
const TCollection_AsciiString& AIS_InteractiveContext::SelectionName() const
{
if(!HasOpenedContext())
return mySelectionName;
return myLocalContexts(myCurLocalIndex)->SelectionName();
}
//=======================================================================
//function : UpdateCurrentViewer
//purpose :
@@ -490,7 +449,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
return;
}
// Erase presentations for all display modes different from aDispMode.
// Mark the presentation modes hidden of interactive object different from aDispMode.
// Then make sure aDispMode is displayed and maybe highlighted.
// Finally, activate selection mode <SelMode> if not yet activated.
TColStd_ListOfInteger aModesToRemove;
@@ -504,7 +463,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
myMainPM->Unhighlight (theIObj, anOldMode);
}
myMainPM->Erase (theIObj, anOldMode);
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
}
@@ -697,10 +656,9 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
}
Standard_Boolean isFound = Standard_False;
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
Display (anObj, Standard_False);
isFound = Standard_True;
}
@@ -723,18 +681,16 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
}
Standard_Boolean isFound = Standard_False;
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection(myCurrentName.ToCString());
aSelIter->Init();
while (aSelIter->More())
mySelection->Init();
while (mySelection->More())
{
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelIter->Value());
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Erase (anObj, Standard_False);
isFound = Standard_True;
aSelIter->Init();
mySelection->Init();
}
if (isFound && theToUpdateViewer)
@@ -2285,16 +2241,14 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)&
}
Standard_Boolean isFound = Standard_False;
Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
isFound = Standard_True;
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
anObj->SetAspect (theAspect, theIsGlobalChange);
}
if (isFound
&& theToUpdateViewer)
if (isFound && theToUpdateViewer)
{
myMainVwr->Update();
}
@@ -2481,22 +2435,21 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
{
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
aSel->Init();
while (aSel->More())
mySelection->Init();
while (mySelection->More())
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner->Selectable() == theObject)
{
if (anOwner->IsSelected())
{
AddOrRemoveSelected (anOwner, Standard_False);
aSel->Init();
mySelection->Init();
continue;
}
}
aSel->Next();
mySelection->Next();
}
}
@@ -2801,11 +2754,6 @@ Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_Interactive
void AIS_InteractiveContext::InitAttributes()
{
mgrSelector->Add (myMainSel);
myCurrentName = AIS_Context_NewCurName();
mySelectionName = AIS_Context_NewSelName();
AIS_Selection::CreateSelection (mySelectionName.ToCString());
AIS_Selection::CreateSelection (myCurrentName.ToCString());
myDefaultDrawer->SetShadingAspectGlobal (Standard_False);
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
@@ -2974,13 +2922,11 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
Standard_CString aSelName = HasOpenedContext() ?
myLocalContexts (myCurLocalIndex)->SelectionName().ToCString()
: myCurrentName.ToCString();
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
Bnd_Box aBndSelected;
const Handle(AIS_Selection)& aSelection = AIS_Selection::Selection (aSelName);
AIS_MapOfObjectOwners anObjectOwnerMap;
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{

View File

@@ -49,6 +49,7 @@
#include <SelectMgr_ListOfFilter.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <Standard_CString.hxx>
#include <AIS_Selection.hxx>
class SelectMgr_SelectionManager;
class V3d_Viewer;
class AIS_InteractiveObject;
@@ -60,7 +61,6 @@ class Quantity_Color;
class TCollection_ExtendedString;
class Prs3d_LineAspect;
class Prs3d_BasicAspect;
class TopoDS_Shape;
class SelectMgr_EntityOwner;
class Standard_Transient;
class SelectMgr_Filter;
@@ -882,6 +882,9 @@ public:
//! Same as previous methods in reverse direction...
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
//! Adds object in the selection.
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
//! Selects everything found in the bounding rectangle
//! defined by the pixel minima and maxima, XPMin,
//! YPMin, XPMax, and YPMax in the view, aView
@@ -1489,21 +1492,6 @@ public:
//! Returns true if there is an open context.
Standard_Boolean HasOpenedContext() const;
//! Returns the name of the current selected entity in Neutral Point.
//! Objects selected when there is no open local context
//! are called current objects; those selected in open
//! local context, selected objects.
const TCollection_AsciiString& CurrentName() const;
//! Returns the name of the current selected entity in
//! open local context.
//! Objects selected when there is no open local context
//! are called current objects; those selected in open
//! local context, selected objects.
Standard_EXPORT const TCollection_AsciiString& SelectionName() const;
//! Returns the domain name of the main viewer.
Standard_EXPORT Standard_CString DomainOfMainViewer() const;
@@ -1623,8 +1611,6 @@ private:
Handle(PrsMgr_PresentationManager3d) myMainPM;
Handle(V3d_Viewer) myMainVwr;
Handle(StdSelect_ViewerSelector3d) myMainSel;
TCollection_AsciiString mySelectionName;
TCollection_AsciiString myCurrentName;
Handle(SelectMgr_EntityOwner) myLastPicked;
Handle(SelectMgr_EntityOwner) myLastinMain;
Standard_Boolean myWasLastMain;
@@ -1633,6 +1619,7 @@ private:
Standard_Boolean myToHilightSelected;
Handle(SelectMgr_OrFilter) myFilters;
Handle(Prs3d_Drawer) myDefaultDrawer;
Handle(AIS_Selection) mySelection;
Quantity_NameOfColor myDefaultColor;
Quantity_NameOfColor myHilightColor;
Quantity_NameOfColor mySelectionColor;

View File

@@ -79,9 +79,6 @@ inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const
inline Handle(AIS_LocalContext) AIS_InteractiveContext::LocalContext() const
{ return (myCurLocalIndex > 0) ? myLocalContexts(myCurLocalIndex) : NULL; }
inline const TCollection_AsciiString& AIS_InteractiveContext::CurrentName() const
{return myCurrentName;}
inline Standard_Boolean AIS_InteractiveContext::WasCurrentTouched() const
{return myCurrentTouched;}

View File

@@ -44,7 +44,6 @@
#include <TCollection_ExtendedString.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_Shape.hxx>
#include <V3d_AmbientLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_Light.hxx>
@@ -55,6 +54,11 @@
typedef NCollection_DataMap<Handle(AIS_InteractiveObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > AIS_MapOfObjSelectedOwners;
namespace
{
TopoDS_Shape AIS_myDummyShape;
}
//=======================================================================
//function : highlightWithColor
//purpose :
@@ -89,13 +93,11 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
if (!theOwner->IsAutoHilight())
{
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
const Handle(AIS_Selection)& aCurSel = AIS_Selection::CurrentSelection();
SelectMgr_SequenceOfOwner aSeq;
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) aSelOwnr =
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (aSelOwnr->Selectable() != anObj)
continue;
aSeq.Append (aSelOwnr);
@@ -114,13 +116,11 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
//=======================================================================
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
{
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable())
continue;
@@ -304,6 +304,24 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
return aStatus;
}
//=======================================================================
//function : AddSelect
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(Standard_Transient)& theObject)
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->AddSelect (theObject);
}
mySelection->AddSelect (theObject);
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
}
//=======================================================================
//function : Select
//purpose :
@@ -336,7 +354,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
@@ -344,7 +361,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
continue;
AIS_Selection::Select (aCurOwner);
mySelection->Select (aCurOwner);
aCurOwner->State (1);
}
@@ -385,7 +402,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
}
aSelector->Pick (thePolyline, theView);
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
@@ -393,7 +409,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
anOwner->State (1);
}
@@ -442,7 +458,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
{
unhighlightSelected (Standard_True);
AIS_Selection::Select();
mySelection->Select();
if (toUpdateViewer && myWasLastMain)
{
UpdateCurrentViewer();
@@ -523,14 +539,13 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
anOwner->State (aState);
}
@@ -574,14 +589,13 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
aSelector->Pick (thePolyline, theView);
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
anOwner->State (aState);
}
@@ -751,13 +765,11 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
// In case of selection without using local context
myMainPM->ClearImmediateDraw();
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
AIS_MapOfObjSelectedOwners anObjOwnerMap;
for (aSel->Init(); aSel->More(); aSel->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (!anOwner.IsNull() && anOwner->HasSelectable())
{
const Handle(AIS_InteractiveObject) anObj =
@@ -815,12 +827,10 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
}
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
for (aSel->Init(); aSel->More(); aSel->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (!anOwner.IsNull() && anOwner->HasSelectable())
{
const Handle(AIS_InteractiveObject) anObj =
@@ -854,7 +864,7 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
unhighlightSelected();
AIS_Selection::Select();
mySelection->Select();
myMainPM->ClearImmediateDraw();
if (theToUpdateViewer)
@@ -908,12 +918,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
return;
}
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
@@ -934,7 +942,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
aSel->Init();
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
AIS_Selection::ClearAndSelect (anOwner);
mySelection->ClearAndSelect (anOwner);
anOwner->State (1);
if (anOwner == theObject->GlobalSelOwner())
{
@@ -993,7 +1001,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
unhighlightSelected();
AIS_Selection::ClearAndSelect (theOwner);
mySelection->ClearAndSelect (theOwner);
theOwner->State (1);
Quantity_NameOfColor aCustomColor;
Standard_Boolean isCustomColorSet;
@@ -1076,10 +1084,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (theOwner.IsNull() || !theOwner->HasSelectable())
return;
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
AIS_SelectStatus aSelStat = AIS_Selection::Select (theOwner);
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
theOwner->State (aState);
@@ -1168,7 +1173,7 @@ void AIS_InteractiveContext::InitSelected()
return;
}
AIS_Selection::Selection (myCurrentName.ToCString())->Init();
mySelection->Init();
}
//=======================================================================
@@ -1180,7 +1185,7 @@ Standard_Boolean AIS_InteractiveContext::MoreSelected() const
if (HasOpenedContext())
return myLocalContexts (myCurLocalIndex)->MoreSelected();
return AIS_Selection::Selection (myCurrentName.ToCString())->More();
return mySelection->More();
}
//=======================================================================
@@ -1195,7 +1200,7 @@ void AIS_InteractiveContext::NextSelected()
return;
}
AIS_Selection::Selection (myCurrentName.ToCString())->Next();
mySelection->Next();
}
//=======================================================================
@@ -1224,11 +1229,11 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
return myLocalContexts (myCurLocalIndex)->SelectedShape();
}
if (AIS_Selection::Selection (myCurrentName.ToCString())->Extent() == 0)
if (mySelection->Extent() == 0)
return TopoDS_Shape();
const Handle(StdSelect_BRepOwner) anOwner =
Handle(StdSelect_BRepOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
if (!anOwner->HasSelectable())
return TopoDS_Shape();
@@ -1247,7 +1252,7 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() cons
}
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable())
return NULL;
@@ -1264,10 +1269,8 @@ Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::SelectedOwner() const
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
}
Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
return aCurSel->Extent() > 0 ?
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value()) : NULL;
return mySelection->Extent() > 0 ?
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value()) : NULL;
}
//=======================================================================
@@ -1501,13 +1504,11 @@ const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
}
static TopoDS_Shape aDummyShape;
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
if (aCurrentShape.IsNull())
{
return aDummyShape;
return AIS_myDummyShape;
}
return aCurrentShape->Shape();

View File

@@ -419,7 +419,7 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
if(AIS_Selection::IsSelected(anIObj))
if(mySelection->IsSelected(anIObj))
myMainPM->Highlight(anIObj,HM);
if(updateviewer){

View File

@@ -23,7 +23,6 @@
#include <AIS_ListOfInteractive.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LocalStatus.hxx>
#include <AIS_Selection.hxx>
#include <AIS_Shape.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Graphic3d_Structure.hxx>
@@ -51,17 +50,6 @@
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalContext,MMgt_TShared)
static TCollection_AsciiString AIS_Local_SelName(const Standard_Address address,
const Standard_Integer anIndex)
{
// TCollection_AsciiString SelName;
char string[100];
sprintf(string,"%p_%d", address, anIndex); // works under any system
TCollection_AsciiString SelName(string);
return SelName;
}
//=======================================================================
//function : AIS_LocalContext
//purpose :
@@ -85,6 +73,7 @@ myMainVS(aCtx->MainSelector()),
myFilters(new SelectMgr_OrFilter()),
myAutoHilight(Standard_True),
myMapOfOwner (new SelectMgr_IndexedMapOfOwner()),
mySelection(new AIS_Selection()),
mylastindex(0),
mylastgood(0),
myCurDetected(0),
@@ -98,8 +87,6 @@ myAISCurDetected(0)
myMainVS->ResetSelectionActivationStatus();
myMainPM = aCtx->MainPrsMgr();
mySelName = AIS_Local_SelName(this, Index);
AIS_Selection::CreateSelection(mySelName.ToCString());
mySM->Add(myMainVS);
if(myLoadDisplayed) LoadContextObjects();
@@ -626,18 +613,13 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
// clear the selector...
myMainVS->Clear();
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
Handle(AIS_Selection) S = AIS_Selection::CurrentSelection();
Handle(Standard_Transient) Tr;
for(S->Init();S->More();S->Next()){
Tr = S->Value();
for (mySelection->Init(); mySelection->More(); mySelection->Next()){
Tr = mySelection->Value();
Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False);
}
AIS_Selection::Select();
AIS_Selection::Remove(mySelName.ToCString());
mySelection->Select();
Handle(V3d_View) aDummyView;
myMainVS->ClearSensitive (aDummyView);

View File

@@ -40,6 +40,7 @@
#include <TColStd_MapOfTransient.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Standard_Real.hxx>
#include <AIS_Selection.hxx>
class AIS_InteractiveContext;
class SelectMgr_SelectionManager;
class SelectMgr_OrFilter;
@@ -91,7 +92,7 @@ public:
Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
const TCollection_AsciiString& SelectionName() const;
const Handle(AIS_Selection) Selection() const;
Standard_EXPORT void Terminate (const Standard_Boolean updateviewer = Standard_True);
@@ -166,6 +167,8 @@ public:
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
//! returns the number of selected
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
@@ -411,7 +414,6 @@ private:
Handle(SelectMgr_SelectionManager) mySM;
Handle(StdSelect_ViewerSelector3d) myMainVS;
Handle(PrsMgr_PresentationManager3d) myMainPM;
TCollection_AsciiString mySelName;
Handle(StdSelect_ViewerSelector3d) myCollVS;
AIS_DataMapOfSelStat myActiveObjects;
Handle(SelectMgr_OrFilter) myFilters;
@@ -419,6 +421,7 @@ private:
Handle(SelectMgr_Filter) myStdFilters[9];
Standard_Boolean myAutoHilight;
Handle(SelectMgr_IndexedMapOfOwner) myMapOfOwner;
Handle(AIS_Selection) mySelection;
Standard_Integer mylastindex;
Standard_Integer mylastgood;
Standard_Integer myCurrentOwner;

View File

@@ -18,9 +18,8 @@
#include <SelectMgr_OrFilter.hxx>
inline const TCollection_AsciiString& AIS_LocalContext::
SelectionName() const
{return mySelName;}
inline const Handle(AIS_Selection) AIS_LocalContext::Selection() const
{return mySelection;}
inline void AIS_LocalContext::SetAutomaticHilight(const Standard_Boolean aStatus)
{myAutoHilight = aStatus;}

View File

@@ -50,9 +50,13 @@
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TopoDS_Shape.hxx>
#include <V3d_View.hxx>
namespace
{
TopoDS_Shape AIS_myDummyShape;
}
static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
{
return IO->HasHilightMode() ? IO->HilightMode():0;
@@ -135,6 +139,20 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
}
}
//=======================================================================
//function : AddSelect
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(Standard_Transient)& theObject)
{
mySelection->AddSelect (theObject);
Standard_Integer aSelNum = mySelection->Extent();
return (aSelNum == 1) ? AIS_SOP_OneSelected
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
: AIS_SOP_Error;
}
//=======================================================================
//function : Select
//purpose :
@@ -146,13 +164,11 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
UnhilightPicked (Standard_False);
}
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aDetIndex = DetectedIndex();
if (aDetIndex <= 0)
{
ClearSelected (toUpdateViewer);
return (AIS_Selection::Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
return (mySelection->Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
}
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
@@ -162,7 +178,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
if (!anOwner->IsSelected()) // anOwner is not selected
{
anOwner->SetSelected (Standard_True);
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
}
if (myAutoHilight)
@@ -186,7 +202,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
}
}
return (AIS_Selection::Extent() == 1) ? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected;
return (mySelection->Extent() == 1) ? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected;
}
//=======================================================================
@@ -208,8 +224,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
UnhilightPicked (Standard_False);
}
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
myMainVS->Init();
if (!myMainVS->More())
@@ -230,7 +245,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
if (!anOwner->IsSelected())
{
anOwner->SetSelected (Standard_True);
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
}
}
}
@@ -241,7 +256,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
}
}
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
return (aSelNum == 1) ? AIS_SOP_OneSelected
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
@@ -260,9 +275,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
{
myMainVS->Pick (thePolyline, theView);
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aLastSelNum = AIS_Selection::Extent();
Standard_Integer aLastSelNum = mySelection->Extent();
myMainVS->Init();
if (!myMainVS->More())
{
@@ -290,7 +303,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
// it can be helpful to classify this owner immediately...
if (!anOwner->IsSelected())
{
AIS_Selection::AddSelect (anOwner);
mySelection->AddSelect (anOwner);
anOwner->SetSelected (Standard_True);
}
}
@@ -302,7 +315,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
}
}
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
return (aSelNum == 1) ? AIS_SOP_OneSelected
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
: AIS_SOP_Error;
@@ -315,15 +328,13 @@ AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyli
AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
{
Standard_Integer aDetIndex = DetectedIndex();
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
if(aDetIndex > 0)
{
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
anOwner->SetSelected (toSelect);
if(myAutoHilight)
@@ -348,7 +359,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateV
}
}
Standard_Integer NS = AIS_Selection::Extent();
Standard_Integer NS = mySelection->Extent();
if( NS == 1 ) return AIS_SOP_OneSelected;
else if( NS > 1 ) return AIS_SOP_SeveralSelected;
return aSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
@@ -373,8 +384,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
{
myMainVS->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aLastSelNum = AIS_Selection::Extent();
Standard_Integer aLastSelNum = mySelection->Extent();
myMainVS->Init();
if (!myMainVS->More())
@@ -396,7 +406,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
if(myFilters->IsOk (anOwner))
{
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
anOwner->SetSelected (toSelect);
}
}
@@ -407,7 +417,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin
}
}
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
return (aSelNum == 1) ? AIS_SOP_OneSelected
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
@@ -426,9 +436,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
{
myMainVS->Pick (thePolyline, theView);
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aLastSelNum = AIS_Selection::Extent();
Standard_Integer aLastSelNum = mySelection->Extent();
myMainVS->Init();
if(!myMainVS->More())
{
@@ -449,7 +457,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
if (myFilters->IsOk (anOwner))
{
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
AIS_Selection::Select (anOwner);
mySelection->Select (anOwner);
anOwner->SetSelected (toSelect);
}
}
@@ -459,7 +467,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& theP
}
}
Standard_Integer aSelNum = AIS_Selection::Extent();
Standard_Integer aSelNum = mySelection->Extent();
return (aSelNum == 1) ? AIS_SOP_OneSelected
: (aSelNum > 1) ? AIS_SOP_SeveralSelected
@@ -516,16 +524,15 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
//=======================================================================
void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
{
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
if( Sel.IsNull() ) return;
if( mySelection.IsNull() ) return;
typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > SelectMgr_DataMapOfObjectOwners;
SelectMgr_DataMapOfObjectOwners aMap;
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
// to avoid problems when there is a loop searching for selected objects...
const AIS_NListTransient& Obj = Sel->Objects();
const AIS_NListTransient& Obj = mySelection->Objects();
AIS_NListTransient::Iterator anIter( Obj );
for(; anIter.More(); anIter.Next())
{
@@ -575,12 +582,11 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
{
myMainPM->ClearImmediateDraw();
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
if( Sel.IsNull() ) return;
if( mySelection.IsNull() ) return;
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
const AIS_NListTransient& Obj = Sel->Objects();
const AIS_NListTransient& Obj = mySelection->Objects();
AIS_NListTransient::Iterator anIter( Obj );
for(; anIter.More(); anIter.Next()){
const Handle(Standard_Transient)& Tr = anIter.Value();
@@ -639,8 +645,7 @@ Standard_Boolean AIS_LocalContext::IsSelected (const Handle(SelectMgr_EntityOwne
void AIS_LocalContext::
InitSelected()
{
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
AIS_Selection::CurrentSelection()->Init();
mySelection->Init();
}
//==================================================
@@ -650,7 +655,7 @@ InitSelected()
Standard_Boolean AIS_LocalContext::
MoreSelected() const
{
return AIS_Selection::CurrentSelection()->More();
return mySelection->More();
}
//==================================================
@@ -660,7 +665,7 @@ MoreSelected() const
void AIS_LocalContext::
NextSelected()
{
AIS_Selection::CurrentSelection()->Next();
mySelection->Next();
}
//==================================================
@@ -670,7 +675,7 @@ NextSelected()
Standard_Boolean AIS_LocalContext::
HasShape() const
{
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
Handle(Standard_Transient) Tr = mySelection->Value();
if( Tr.IsNull() ) return Standard_False;
Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
Handle(StdSelect_BRepOwner) BRO = Handle(StdSelect_BRepOwner)::DownCast(EO);
@@ -686,10 +691,10 @@ HasShape() const
//================================================================
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
{
if (AIS_Selection::CurrentSelection()->Extent() == 0)
if (mySelection->Extent() == 0)
return Standard_False;
Handle(Standard_Transient) aCurSelection = AIS_Selection::CurrentSelection()->Value();
Handle(Standard_Transient) aCurSelection = mySelection->Value();
if (aCurSelection.IsNull())
return Standard_False;
@@ -708,7 +713,7 @@ Standard_Boolean AIS_LocalContext::HasSelectedShape() const
//==================================================
TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
Handle(Standard_Transient) aTr = AIS_Selection::CurrentSelection()->Value();
Handle(Standard_Transient) aTr = mySelection->Value();
Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr);
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO);
if( aBRO.IsNull() )
@@ -727,7 +732,7 @@ Handle(AIS_InteractiveObject) AIS_LocalContext::
SelectedInteractive() const
{
Handle(AIS_InteractiveObject) IO;
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
Handle(Standard_Transient) Tr = mySelection->Value();
if( !Tr.IsNull() ) {
Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
Handle(SelectMgr_SelectableObject) SO;
@@ -746,7 +751,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::
SelectedOwner() const
{
Handle(SelectMgr_EntityOwner) EO;
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
Handle(Standard_Transient) Tr = mySelection->Value();
if( !Tr.IsNull() )
EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
return EO;
@@ -797,12 +802,9 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
if (anobj.IsNull() || anobj->IsAutoHilight())
return;
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
Handle(AIS_Selection) Sel = AIS_Selection::CurrentSelection();
SelectMgr_SequenceOfOwner aSeq;
for ( Sel->Init(); Sel->More(); Sel->Next() ){
Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(Sel->Value());
for (mySelection->Init(); mySelection->More(); mySelection->Next() ){
Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(mySelection->Value());
if ( !aOwner.IsNull() && aOwner->HasSelectable() && aOwner->Selectable() == anobj )
aSeq.Append( aOwner );
@@ -825,10 +827,8 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
{
UnhilightPicked(updateviewer);
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
Handle(AIS_Selection) Sel = AIS_Selection::CurrentSelection();
const AIS_NListTransient& Obj = Sel->Objects();
const AIS_NListTransient& Obj = mySelection->Objects();
AIS_NListTransient::Iterator anIter( Obj );
for(; anIter.More(); anIter.Next()){
const Handle(Standard_Transient)& Tr = anIter.Value();
@@ -837,7 +837,7 @@ void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
(*((const Handle(SelectMgr_EntityOwner)*)&Tr))->SetSelected (Standard_False);
}
}
AIS_Selection::Select();
mySelection->Select();
mylastindex = 0;
}
@@ -918,8 +918,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
// 3. AIS_Selection : remove entity owners from AIS_Selection
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
Handle(AIS_Selection) aSelection = AIS_Selection::Selection (mySelName.ToCString());
AIS_NListTransient::Iterator anIter (aSelection->Objects());
AIS_NListTransient::Iterator anIter (mySelection->Objects());
AIS_NListTransient aRemoveEntites;
for (; anIter.More(); anIter.Next())
{
@@ -946,7 +945,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
AIS_NListTransient::Iterator anIterRemove (aRemoveEntites);
for (; anIterRemove.More(); anIterRemove.Next())
{
aSelection->Select (anIterRemove.Value());
mySelection->Select (anIterRemove.Value());
}
// 4. AIS_LocalContext - myMapOfOwner : remove entity owners from myMapOfOwner
@@ -1045,8 +1044,6 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
//1st case, owner already <anIObj> as owner
// and not separated is found...
Handle(AIS_Selection) sel = AIS_Selection::Selection(mySelName.ToCString());
//Standard_Boolean found(Standard_False);
Handle(Standard_Transient) Tr;
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
if(EO.IsNull()){
@@ -1065,7 +1062,7 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
ClearSelected(Standard_False);
AIS_Selection::Select(EO);
mySelection->Select(EO);
EO->SetSelected (Standard_True);
HilightPicked(updateviewer);
@@ -1102,13 +1099,10 @@ void AIS_LocalContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)&
EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
}
}
// cout<<"AIS_LocalContext::AddOrRemoveSelected : Selection = "<<mySelName<<endl;
const Handle(AIS_Selection)& S = AIS_Selection::Selection(mySelName.ToCString());
if (!S.IsNull())
if (!mySelection.IsNull())
{
AIS_SelectStatus aStatus = S->Select(EO);
AIS_SelectStatus aStatus = mySelection->Select(EO);
EO->SetSelected (aStatus == AIS_SS_Added);
}
@@ -1126,7 +1120,7 @@ void AIS_LocalContext::AddOrRemoveSelected(const TopoDS_Shape& Sh,
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromShape(Sh);
if (!EO.IsNull())
{
AIS_Selection::Selection(mySelName.ToCString())->Select(EO);
mySelection->Select(EO);
EO->SetSelected (Standard_True);
}
HilightPicked (updateviewer);
@@ -1142,7 +1136,7 @@ void AIS_LocalContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)&
Standard_Boolean toSelect = theOwner->IsSelected() ? Standard_False : Standard_True;
AIS_Selection::Selection (mySelName.ToCString())->Select (theOwner);
mySelection->Select(theOwner);
theOwner->SetSelected (toSelect);
if(myAutoHilight)
@@ -1261,14 +1255,13 @@ Standard_Boolean AIS_LocalContext::HasDetectedShape() const
const TopoDS_Shape&
AIS_LocalContext::DetectedShape() const
{
static TopoDS_Shape bidsh;
if(mylastindex != 0)
{
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey (mylastindex));
if(BROwnr.IsNull()) return bidsh;
if(BROwnr.IsNull()) return AIS_myDummyShape;
return BROwnr->Shape();
}
return bidsh;
return AIS_myDummyShape;
}
//=======================================================================
@@ -1446,16 +1439,11 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO
Handle(SelectMgr_EntityOwner) EO,bid;
if (anIObj.IsNull()) return EO;
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
if(Sel.IsNull()) {
#ifdef OCCT_DEBUG
cout<<"\t\tAIS_LocalCOntext::FindSelectedOwnerFromShape : Selection "
<<mySelName<<" Nulle "<<endl;
#endif
if(mySelection.IsNull()) {
return EO;
}
Standard_Boolean found(Standard_False);
const AIS_NListTransient& Obj = Sel->Objects();
const AIS_NListTransient& Obj = mySelection->Objects();
AIS_NListTransient::Iterator anIter( Obj );
for(; anIter.More(); anIter.Next()){
const Handle(Standard_Transient)& Tr = anIter.Value();
@@ -1485,11 +1473,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
Handle(SelectMgr_EntityOwner) EO, bid;
if (sh.IsNull()) return EO;
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
if(Sel.IsNull()) {
#ifdef OCCT_DEBUG
cout<<"\t\tAIS_LocalCOntext::FindSelectedOwnerFromShape : Selection "<<mySelName<<" Nulle "<<endl;
#endif
if(mySelection.IsNull()) {
return EO;
}
@@ -1546,13 +1530,11 @@ void AIS_LocalContext::NextDetected()
//=======================================================================
const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const
{
static TopoDS_Shape aDummyShape;
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
if (aCurrentShape.IsNull())
{
return aDummyShape;
return AIS_myDummyShape;
}
return aCurrentShape->Shape();

View File

@@ -87,9 +87,7 @@ void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
else if (aMode== -99)
{
// Beeurk.. a revoir - rob-25/04/97
static Handle(Graphic3d_AspectMarker3d) PtA =
new Graphic3d_AspectMarker3d ();
Handle(Graphic3d_AspectMarker3d) PtA = new Graphic3d_AspectMarker3d ();
PtA->SetType(Aspect_TOM_PLUS);
PtA->SetScale(3.);
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);

View File

@@ -27,6 +27,7 @@
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_Presentations.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitivePrimitiveArray.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <StdPrs_BndBox.hxx>
@@ -461,15 +462,41 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
//purpose :
//=======================================================================
void AIS_PointCloud::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer /*theMode*/)
const Standard_Integer theMode)
{
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
switch (theMode)
{
case SM_Points:
{
const Handle(Graphic3d_ArrayOfPoints) aPoints = GetPoints();
if (!aPoints.IsNull()
&& !aPoints->Attributes().IsNull())
{
Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
aSensitive->SetSensitivityFactor (8);
aSensitive->InitPoints (aPoints->Attributes(), aPoints->Indices(), TopLoc_Location());
aSensitive->BVH();
theSelection->Add (aSensitive);
return;
}
break;
}
case SM_BndBox:
{
break;
}
default:
{
return;
}
}
Bnd_Box aBndBox = GetBoundingBox();
if (aBndBox.IsVoid())
{
return;
}
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBndBox);
theSelection->Add (aSensBox);
}

View File

@@ -53,6 +53,13 @@ public:
DM_BndBox = 2 //!< display as bounding box, default for highlighting
};
//! Selection modes supported by this Point Cloud object
enum SelectionMode
{
SM_Points = 0, //!< detected by points
SM_BndBox = 2 //!< detected by bounding box
};
public:
//! Constructor.

View File

@@ -21,147 +21,50 @@
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_SequenceOfTransient.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
#define MaxSizeOfResult 100000
//current selection (handle)
static Handle(AIS_Selection) theCurrentSelection;
static void AIS_Sel_CurrentSelection (Handle(AIS_Selection)& InputSel)
{
if(!InputSel.IsNull())
theCurrentSelection = InputSel;
else
InputSel = theCurrentSelection;
}
static TColStd_SequenceOfTransient& AIS_Sel_GetSelections()
{
static TColStd_SequenceOfTransient Selections;
return Selections;
}
//=======================================================================
//function : AIS_Selection
//purpose :
//=======================================================================
AIS_Selection::AIS_Selection(const Standard_CString aName) :
myName(TCollection_AsciiString(aName)),
AIS_Selection::AIS_Selection() :
myNb(0)
{
myResultMap.ReSize( MaxSizeOfResult ); // for maximum performnace on medium selections ( < 100000 objects )
}
//=======================================================================
//function : CreateSelection
//purpose :
//=======================================================================
Standard_Boolean AIS_Selection::CreateSelection(const Standard_CString aName)
{
Handle(AIS_Selection) S = AIS_Selection::Selection(aName);
if(!S.IsNull())
return Standard_False;
S = new AIS_Selection(aName);
AIS_Sel_GetSelections().Prepend(S);
AIS_Sel_CurrentSelection(S);
return Standard_True;
}
//=======================================================================
//function : Selection
//purpose :
//=======================================================================
Handle(AIS_Selection) AIS_Selection::Selection(const Standard_CString aName)
{
Handle(AIS_Selection) S;
if(AIS_Sel_GetSelections().IsEmpty()) return S;
Handle(Standard_Transient) curobj;
Handle(AIS_Selection) Sel;
// Standard_Boolean found(Standard_False);
for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){
curobj = AIS_Sel_GetSelections().Value(I);
Sel = Handle(AIS_Selection)::DownCast (curobj);
if(Sel->myName.IsEqual(aName))
return Sel;
}
return S;
}
//=======================================================================
//function : Find
//purpose :
//=======================================================================
Standard_Boolean AIS_Selection::Find(const Standard_CString aName)
{
Handle(AIS_Selection) S = AIS_Selection::Selection(aName);
return !S.IsNull();
}
//=======================================================================
//function : SetCurrentSelection
//purpose :
//=======================================================================
Standard_Boolean AIS_Selection::SetCurrentSelection (const Standard_CString aName)
{
AIS_Selection::CreateSelection(aName);
Handle(AIS_Selection) anAISSelection = AIS_Selection::Selection(aName) ;
AIS_Sel_CurrentSelection ( anAISSelection ) ;
return Standard_True;
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
void AIS_Selection::Select()
{
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if(!S.IsNull()){
S->myNb=0;
S->myresult.Clear();
S->myResultMap.Clear();
}
myNb=0;
myresult.Clear();
myResultMap.Clear();
}
//=======================================================================
//function : CurrentSelection
//purpose :
//=======================================================================
Handle(AIS_Selection) AIS_Selection::CurrentSelection() {
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
return S;
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObject)
{
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if(S.IsNull()) return AIS_SS_NotDone;
Handle(AIS_InteractiveObject) anAISObj;
Handle(SelectMgr_EntityOwner) owner = Handle(SelectMgr_EntityOwner)::DownCast( anObject );
if ( owner.IsNull() )
anAISObj = Handle(AIS_InteractiveObject)::DownCast( anObject );
if ( S->myResultMap.IsBound( anObject ) ){
AIS_NListTransient::Iterator aListIter = S->myResultMap.Find( anObject );
if ( myResultMap.IsBound( anObject ) ){
AIS_NListTransient::Iterator aListIter = myResultMap.Find( anObject );
//skt-----------------------------------------------------------------
if( S->myIterator == aListIter ) {
if( S->myIterator.More() )
S->myIterator.Next();
if( myIterator == aListIter ) {
if( myIterator.More() )
myIterator.Next();
else
S->myIterator = AIS_NListTransient::Iterator();
myIterator = AIS_NListTransient::Iterator();
}
//--------------------------------------------------------------------
// In the mode of advanced mesh selection only one owner is created
@@ -170,16 +73,16 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
// the same as previous selected (IsForcedHilight call)
if( !anAISObj.IsNull() || ( !owner.IsNull() && !owner->IsForcedHilight() ) )
{
S->myresult.Remove( aListIter );
S->myResultMap.UnBind( anObject );
myresult.Remove( aListIter );
myResultMap.UnBind( anObject );
// update list iterator for next object in <myresult> list if any
if ( aListIter.More() ){
const Handle(Standard_Transient)& aNextObject = aListIter.Value();
if ( S->myResultMap.IsBound( aNextObject ) )
S->myResultMap( aNextObject ) = aListIter;
if ( myResultMap.IsBound( aNextObject ) )
myResultMap( aNextObject ) = aListIter;
else
S->myResultMap.Bind( aNextObject, aListIter );
myResultMap.Bind( aNextObject, aListIter );
}
return AIS_SS_Removed;
}
@@ -188,8 +91,8 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
}
AIS_NListTransient::Iterator aListIter;
S->myresult.Append( anObject, aListIter );
S->myResultMap.Bind( anObject, aListIter );
myresult.Append( anObject, aListIter );
myResultMap.Bind( anObject, aListIter );
return AIS_SS_Added;
}
@@ -199,16 +102,12 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
//=======================================================================
AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anObject)
{
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if(S.IsNull()) return AIS_SS_NotDone;
if ( S->myResultMap.IsBound( anObject ) )
if ( myResultMap.IsBound( anObject ) )
return AIS_SS_NotDone;
AIS_NListTransient::Iterator aListIter;
S->myresult.Append( anObject, aListIter );
S->myResultMap.Bind( anObject, aListIter );
myresult.Append( anObject, aListIter );
myResultMap.Bind( anObject, aListIter );
return AIS_SS_Added;
}
@@ -218,14 +117,10 @@ AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anOb
//purpose :
//=======================================================================
void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject) {
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if(S.IsNull()) return;
void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject)
{
Select();
Select(anObject);
}
@@ -233,14 +128,9 @@ void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject) {
//function : Extent
//purpose :
//=======================================================================
Standard_Integer AIS_Selection::Extent() {
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if (S.IsNull())
return 0;
return S->myresult.Extent();
Standard_Integer AIS_Selection::Extent() const
{
return myresult.Extent();
}
//=======================================================================
@@ -249,63 +139,16 @@ Standard_Integer AIS_Selection::Extent() {
//=======================================================================
Handle(Standard_Transient) AIS_Selection::Single()
{
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if (S.IsNull())
return Handle(Standard_Transient)();
S->Init();
return S->Value();
Init();
return Value();
}
//=======================================================================
//function : IsSelected
//purpose :
//=======================================================================
Standard_Boolean AIS_Selection::IsSelected(const Handle(Standard_Transient)& anObject)
Standard_Boolean AIS_Selection::IsSelected(const Handle(Standard_Transient)& anObject) const
{
Handle(AIS_Selection) S;
AIS_Sel_CurrentSelection (S);
if(S.IsNull()) return Standard_False;
return S->myResultMap.IsBound( anObject );
return myResultMap.IsBound( anObject );
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer AIS_Selection::Index(const Standard_CString aName)
{
Handle (Standard_Transient) curobj;
for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){
curobj = AIS_Sel_GetSelections().Value(I);
if(Handle(AIS_Selection)::DownCast (curobj)->myName.IsEqual(aName))
return I;
}
return 0;
}
//=======================================================================
//function : Remove
//purpose :
//=======================================================================
void AIS_Selection::Remove(const Standard_CString aName)
{
Standard_Integer I = AIS_Selection::Index(aName);
if(I!=0) {
Handle(AIS_Selection) selection = Handle(AIS_Selection)::DownCast( AIS_Sel_GetSelections().Value(I) );
Standard_Integer stored = selection->NbStored();
if ( stored )
selection->Select();
AIS_Sel_GetSelections().Remove(I);
}
}
// clean the static current selection handle
void AIS_Selection::ClearCurrentSelection()
{
theCurrentSelection.Nullify();
}

View File

@@ -20,7 +20,6 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <AIS_NListTransient.hxx>
#include <AIS_NListIteratorOfListTransient.hxx>
#include <AIS_NDataMapOfTransientIteratorOfListTransient.hxx>
@@ -45,80 +44,45 @@ class AIS_Selection : public MMgt_TShared
public:
//! creates a new selection and make it current in the session.
//! the selection will be accessible later through its name
//! to make it again current.
//!
//! Note that if a session has been created, a session with
//! the name "default" is created.
//!
//! In this case, the is always a current selection which
//! is the last one created until SetCurrentSelection is used.
//!
//! The class methods deals with the current selection.
//!
//! Warning : Better Call AIS_Selection::CreateSelection.
Standard_EXPORT AIS_Selection(const Standard_CString aName);
//! creates a new selection.
Standard_EXPORT AIS_Selection();
Standard_EXPORT static void Remove (const Standard_CString aName);
//! removes all the object of the selection.
Standard_EXPORT void Select();
//! returns True if a selection having this name exsits.
Standard_EXPORT static Standard_Boolean Find (const Standard_CString aName);
//! calls the private constructor and puts the new Selection
//! in the list of existing selections.
//! returns False if the selection exists.
Standard_EXPORT static Standard_Boolean CreateSelection (const Standard_CString aName);
Standard_EXPORT static Handle(AIS_Selection) Selection (const Standard_CString aName);
//! returns False if There is no selection of name <aName>
Standard_EXPORT static Standard_Boolean SetCurrentSelection (const Standard_CString aName);
Standard_EXPORT static Handle(AIS_Selection) CurrentSelection();
//! Clears selection.
Standard_EXPORT static void ClearCurrentSelection();
//! removes all the object of the currentselection.
Standard_EXPORT static void Select();
//! if the object is not yet in the current selection, it will be added.
//! if the object is already in the current selection, it will be removed.
Standard_EXPORT static AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
//! if the object is not yet in the selection, it will be added.
//! if the object is already in the selection, it will be removed.
Standard_EXPORT AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
//! the object is always add int the selection.
//! faster when the number of objects selected is great.
Standard_EXPORT static AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
//! clears the selection and adds the object in the selection.
Standard_EXPORT static void ClearAndSelect (const Handle(Standard_Transient)& anObject);
Standard_EXPORT static Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject);
Standard_EXPORT void ClearAndSelect (const Handle(Standard_Transient)& anObject);
//! checks if the object is in the selection.
Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
//! returns the number of objects selected.
Standard_EXPORT static Standard_Integer Extent();
Standard_EXPORT Standard_Integer Extent() const;
//! returns the single object selected.
//! Warning: raises TypeMismatch from Standard if Extent is not equal to 1.
Standard_EXPORT static Handle(Standard_Transient) Single();
Standard_EXPORT Handle(Standard_Transient) Single();
void Init();
void Init();
Standard_Boolean More() const;
Standard_Boolean More() const;
void Next();
void Next();
const Handle(Standard_Transient)& Value() const;
const Handle(Standard_Transient)& Value() const;
Standard_Integer NbStored() const;
Standard_Integer NbStored() const;
const AIS_NListTransient& Objects() const;
Standard_EXPORT static Standard_Integer Index (const Standard_CString aName);
const AIS_NListTransient& Objects() const;
DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
@@ -129,8 +93,6 @@ protected:
private:
TCollection_AsciiString myName;
AIS_NListTransient myresult;
AIS_NListIteratorOfListTransient myIterator;
AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;

View File

@@ -70,8 +70,6 @@
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
static Standard_Boolean myFirstCompute;
static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
{
TColStd_ListIteratorOfListOfInteger It(LL);
@@ -92,7 +90,6 @@ AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant),
myInitAng(0.)
{
Set (shap);
myFirstCompute = Standard_True;
SetHilightMode(0);
myDrawer->SetShadingAspectGlobal(Standard_False);
}
@@ -398,8 +395,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
return;
}
static TopAbs_ShapeEnum TypOfSel;
TypOfSel = AIS_Shape::SelectionType(aMode);
TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
TopoDS_Shape shape = myshape;
// POP protection against crash in low layers

View File

@@ -14,7 +14,12 @@
#include <AIS_TextLabel.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Font_FTFont.hxx>
#include <Font_FontMgr.hxx>
#include <Font_Rect.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
@@ -23,6 +28,8 @@
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <V3d_Viewer.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
@@ -34,7 +41,8 @@ AIS_TextLabel::AIS_TextLabel()
: myText ("?"),
myFont ("Courier"),
myFontAspect (Font_FA_Regular),
myHasOrientation3D (Standard_False)
myHasOrientation3D (Standard_False),
myHasFlipping (Standard_False)
{
myDrawer->SetTextAspect (new Prs3d_TextAspect());
@@ -181,7 +189,7 @@ const gp_Ax2& AIS_TextLabel::Orientation3D() const
}
//=======================================================================
//function : HasOrientation3D()
//function : HasOrientation3D
//purpose :
//=======================================================================
Standard_Boolean AIS_TextLabel::HasOrientation3D() const
@@ -189,6 +197,24 @@ Standard_Boolean AIS_TextLabel::HasOrientation3D() const
return myHasOrientation3D;
}
//=======================================================================
//function : SetFlipping
//purpose :
//=======================================================================
void AIS_TextLabel::SetFlipping (const Standard_Boolean theIsFlipping)
{
myHasFlipping = theIsFlipping;
}
//=======================================================================
//function : HasFlipping
//purpose :
//=======================================================================
Standard_Boolean AIS_TextLabel::HasFlipping() const
{
return myHasFlipping;
}
//=======================================================================
//function : SetDisplayType
//purpose :
@@ -207,6 +233,7 @@ void AIS_TextLabel::SetColorSubTitle (const Quantity_Color& theColor)
myDrawer->TextAspect()->Aspect()->SetColorSubTitle(theColor);
}
#include <Graphic3d_ArrayOfPoints.hxx>
//=======================================================================
//function : Compute
//purpose :
@@ -220,10 +247,67 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
case 0:
{
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
gp_Pnt aPosition = Position();
if (myHasOrientation3D)
{
Prs3d_Text::Draw (thePrs, anAsp, myText, myOrientation3D);
Standard_Boolean isInit = Standard_False;
if (myHasFlipping)
{
// Get width and height of text
Font_FTFont aFont;
Quantity_Color aColor;
Standard_CString aName;
Standard_Real anExpFactor;
Standard_Real aSpace;
anAsp->Aspect()->Values (aColor, aName, anExpFactor, aSpace);
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
if (aFont.Init (aName, anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
{
isInit = Standard_True;
const NCollection_String aText ((Standard_Utf16Char* )myText.ToExtString());
Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
Standard_Real aWidth = Abs (aBndBox.Width());
Standard_Real aHeight = Abs (aBndBox.Height());
gp_Pnt aCenterOfLabel = aPosition;
if (anAsp->VerticalJustification() == Graphic3d_VTA_BOTTOM)
{
aCenterOfLabel.ChangeCoord() += myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
}
else if (anAsp->VerticalJustification() == Graphic3d_VTA_TOP)
{
aCenterOfLabel.ChangeCoord() -= myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
}
if (anAsp->HorizontalJustification() == Graphic3d_HTA_LEFT)
{
aCenterOfLabel.ChangeCoord() += myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
}
else if (anAsp->HorizontalJustification() == Graphic3d_HTA_RIGHT)
{
aCenterOfLabel.ChangeCoord() -= myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
}
if (!anAsp->Aspect()->GetTextZoomable())
{
anAsp->Aspect()->SetTextZoomable (Standard_True);
SetTransformPersistence (GetTransformPersistenceMode() | Graphic3d_TMF_ZoomPers, aPosition);
aPosition = gp::Origin();
}
gp_Ax2 aFlippingAxes (aCenterOfLabel, myOrientation3D.Direction(), myOrientation3D.XDirection());
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_True, aFlippingAxes);
}
}
gp_Ax2 anOrientation = myOrientation3D;
anOrientation.SetLocation (aPosition);
Prs3d_Text::Draw (thePrs, anAsp, myText, myOrientation3D, !myHasFlipping);
if (myHasFlipping && isInit)
{
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
}
}
else
{

View File

@@ -80,6 +80,10 @@ public:
//! Returns true if the current text placement mode uses text orientation in the model 3D space.
Standard_EXPORT Standard_Boolean HasOrientation3D() const;
Standard_EXPORT void SetFlipping (const Standard_Boolean theIsFlipping);
Standard_EXPORT Standard_Boolean HasFlipping() const;
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
@@ -111,6 +115,7 @@ protected:
Font_FontAspect myFontAspect;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;
Standard_Boolean myHasFlipping;
public:

View File

@@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
Standard_Integer nu,nv,nc;
nu=mySurface->NbUIntervals(S);
nv=mySurface->NbVIntervals(S);
nc=myCurve->NbIntervals(S);
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
TColStd_Array1OfReal TabU(1,nu+1);
TColStd_Array1OfReal TabV(1,nv+1);
Standard_Integer NbSample = 20;
Standard_Real U,V,Tdeb,Tfin;
Tdeb=myCurve->FirstParameter();
Tfin=myCurve->LastParameter();
nc=myCurve->NbIntervals(S);
TColStd_Array1OfReal TabC(1,nc+1);
myCurve->Intervals(TabC,S);
Standard_Real Tol= Precision::PConfusion()/10;

View File

@@ -23,7 +23,6 @@
#include <BRepBuilderAPI.hxx>
#include <BRepFeat.hxx>
#include <BRepLib_MakeFace.hxx>
#include <BRepLProp.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <ElSLib.hxx>

View File

@@ -25,6 +25,8 @@
#include <BRepBuilderAPI_MakeShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
class LocOpe_WiresOnShape;
class StdFail_NotDone;
class Standard_ConstructionError;
@@ -60,7 +62,12 @@ public:
BRepFeat_SplitShape();
//! Creates the process with the shape <S>.
BRepFeat_SplitShape(const TopoDS_Shape& S);
BRepFeat_SplitShape(const TopoDS_Shape& S);
//! Add splitting edges or wires for whole initial shape
//! withot additional specification edge->face, edge->edge
//! This method puts edge on the corresponding faces from initial shape
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
//! Initializes the process on the shape <S>.
void Init (const TopoDS_Shape& S);

View File

@@ -38,6 +38,14 @@ inline BRepFeat_SplitShape::BRepFeat_SplitShape (const TopoDS_Shape& S) :
myWOnShape = new LocOpe_WiresOnShape(S);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline Standard_Boolean BRepFeat_SplitShape::Add(const TopTools_SequenceOfShape& theEdges)
{
return myWOnShape->Add(theEdges);
}
//=======================================================================
//function : Init

View File

@@ -88,6 +88,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TShort_HArray1OfShortReal.hxx>
#include <TColgp_Array1OfXY.hxx>
// TODO - not thread-safe static variables
static Standard_Real thePrecision = Precision::Confusion();
@@ -1580,17 +1581,15 @@ Standard_Boolean BRepLib::OrientClosedSolid(TopoDS_Solid& solid)
return Standard_True;
}
//=======================================================================
//function : tgtfaces
//purpose : check the angle at the border between two squares.
// Two shares should have a shared front edge.
//=======================================================================
static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
const Standard_Real ta,
const Standard_Real theAngleTol,
const Standard_Boolean couture)
{
// Check if pcurves exist on both faces of edge
@@ -1598,20 +1597,31 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
Handle(Geom2d_Curve) aCurve;
aCurve = BRep_Tool::CurveOnSurface(Ed,F1,aFirst,aLast);
if(aCurve.IsNull())
return Standard_False;
return GeomAbs_C0;
aCurve = BRep_Tool::CurveOnSurface(Ed,F2,aFirst,aLast);
if(aCurve.IsNull())
return Standard_False;
return GeomAbs_C0;
Standard_Real u;
TopoDS_Edge E = Ed;
BRepAdaptor_Surface aBAS1(F1,Standard_False);
BRepAdaptor_Surface aBAS2(F2,Standard_False);
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface(aBAS1);
// seam edge on elementary surface is always CN
Standard_Boolean isElementary =
(aBAS1.Surface().Surface()->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
aBAS1.Surface().Surface()->IsKind(STANDARD_TYPE(Geom_ElementarySurface)));
if (couture && isElementary)
{
return GeomAbs_CN;
}
Handle(BRepAdaptor_HSurface) HS1 = new BRepAdaptor_HSurface (aBAS1);
Handle(BRepAdaptor_HSurface) HS2;
if(couture) HS2 = HS1;
else HS2 = new BRepAdaptor_HSurface(aBAS2);
//case when edge lies on the one face
E.Orientation(TopAbs_FORWARD);
Handle(BRepAdaptor_HCurve2d) HC2d1 = new BRepAdaptor_HCurve2d();
HC2d1->ChangeCurve2d().Initialize(E,F1);
@@ -1623,8 +1633,7 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
Standard_Boolean rev1 = (F1.Orientation() == TopAbs_REVERSED);
Standard_Boolean rev2 = (F2.Orientation() == TopAbs_REVERSED);
Standard_Real f,l,eps, angmax = -M_PI;
Standard_Real ang =0.;
Standard_Real f,l,eps;
BRep_Tool::Range(E,f,l);
Extrema_LocateExtPC ext;
Standard_Boolean IsInitialized = Standard_False;
@@ -1634,34 +1643,55 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
l -= eps; // points of pointed squares.
gp_Pnt2d p;
gp_Pnt pp1,pp2;//,PP;
gp_Vec du,dv;
gp_Vec du1, dv1, d2u1, d2v1, d2uv1;
gp_Vec du2, dv2, d2u2, d2v2, d2uv2;
gp_Vec d1,d2;
Standard_Real uu, vv, norm;
Standard_Integer i;
Standard_Boolean Nok;
for(i = 0; (i<= 20) && (angmax<=ta) ; i++){
GeomAbs_Shape aCont = (isElementary ? GeomAbs_CN : GeomAbs_C2);
for(i = 0; i<= 20 && aCont > GeomAbs_C0; i++)
{
// First suppose that this is sameParameter
Nok = Standard_True;
u = f + (l-f)*i/20;
// take derivatives of surfaces at the same u, and compute normals
HC2d1->D0(u,p);
HS1->D1(p.X(),p.Y(),pp1,du,dv);
d1 = (du.Crossed(dv));
HS1->D2 (p.X(), p.Y(), pp1, du1, dv1, d2u1, d2v1, d2uv1);
d1 = (du1.Crossed(dv1));
norm = d1.Magnitude();
if (norm > 1.e-12) d1 /= norm;
else Nok=Standard_False;
else continue; // skip degenerated point
if(rev1) d1.Reverse();
HC2d2->D0(u,p);
HS2->D1(p.X(), p.Y(), pp2, du, dv);
d2 = (du.Crossed(dv));
HS2->D2 (p.X(), p.Y(), pp2, du2, dv2, d2u2, d2v2, d2uv2);
d2 = (du2.Crossed(dv2));
norm = d2.Magnitude();
if (norm> 1.e-12) d2 /= norm;
else Nok=Standard_False;
if (norm > 1.e-12) d2 /= norm;
else continue; // skip degenerated point
if(rev2) d2.Reverse();
if (Nok) ang = d1.Angle(d2);
if (Nok &&(ang > ta)) { // Refine by projection
// check
Standard_Real ang = d1.Angle(d2);
// check special case of precise equality of derivatives,
// occurring when edge connects two faces built on equally
// defined surfaces (e.g. seam-like edges on periodic surfaces,
// or planar faces on the same plane)
if (aCont >= GeomAbs_C2 && ang < Precision::Angular() &&
d2u1 .IsEqual (d2u2, Precision::PConfusion(), Precision::Angular()) &&
d2v1 .IsEqual (d2v2, Precision::PConfusion(), Precision::Angular()) &&
d2uv1.IsEqual (d2uv2, Precision::PConfusion(), Precision::Angular()))
{
continue;
}
aCont = GeomAbs_G1;
// Refine by projection
if (ang > theAngleTol)
{
if (! IsInitialized ) {
ext.Initialize(C2,f,l,Precision::PConfusion());
IsInitialized = Standard_True;
@@ -1673,20 +1703,20 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
HC2d2->D0(v,p);
p.Coord(uu,vv);
HS2->D1(p.X(), p.Y(), pp2, du, dv);
d2 = (du.Crossed(dv));
HS2->D1(p.X(), p.Y(), pp2, du2, dv2);
d2 = (du2.Crossed(dv2));
norm = d2.Magnitude();
if (norm> 1.e-12) d2 /= norm;
else Nok = Standard_False;
else continue; // degenerated point
if(rev2) d2.Reverse();
if (Nok) ang = d1.Angle(d2);
ang = d1.Angle(d2);
}
if (ang > theAngleTol)
return GeomAbs_C0;
}
if(ang >= angmax) angmax = ang;
}
return (angmax<=ta);
return aCont;
}
@@ -1735,9 +1765,8 @@ void BRepLib::EncodeRegularity(const TopoDS_Shape& S,
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
try {
if(tgtfaces(E, F1, F2, TolAng, couture)){
B.Continuity(E,F1,F2,GeomAbs_G1);
}
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng, couture);
B.Continuity(E,F1,F2,aCont);
}
catch(Standard_Failure)
{
@@ -1760,9 +1789,9 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
BRep_Builder B;
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
try {
if( tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2))) {
B.Continuity(E,F1,F2,GeomAbs_G1);
}
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2));
B.Continuity(E,F1,F2,aCont);
}
catch(Standard_Failure)
{
@@ -1977,18 +2006,17 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
TopTools_ListOfShape& LF)
{
LF.Clear();
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
// Use the allocator of the result LF for intermediate results
TopTools_ListOfShape LTri(LF.Allocator()), LPlan(LF.Allocator()),
LCyl(LF.Allocator()), LCon(LF.Allocator()), LSphere(LF.Allocator()),
LTor(LF.Allocator()), LOther(LF.Allocator());
TopExp_Explorer exp(Sh,TopAbs_FACE);
TopLoc_Location l;
Handle(Geom_Surface) S;
for (; exp.More(); exp.Next()) {
const TopoDS_Face& F = TopoDS::Face(exp.Current());
S = BRep_Tool::Surface(F, l);
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
if (!S.IsNull()) {
if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
}
GeomAdaptor_Surface AS(S);
switch (AS.GetType()) {
case GeomAbs_Plane:

View File

@@ -56,8 +56,16 @@ class BRepMesh_VertexTool;
namespace BRepMesh
{
//! Default size for memory block allocated by IncAllocator.
//! Default size for memory block allocated by IncAllocator.
/**
* The idea here is that blocks of the given size are returned to the system
* rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
*/
#ifdef _WIN64
const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
#else
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
#endif
//! Structure keeping parameters of segment.
struct Segment
@@ -92,6 +100,7 @@ namespace BRepMesh
typedef NCollection_List<Standard_Integer> ListOfInteger;
//! Maps
typedef NCollection_Map<Standard_Real> MapOfReal;
typedef NCollection_Map<Standard_Integer> MapOfInteger;
typedef NCollection_DataMap<Handle(Poly_Triangulation), Standard_Boolean> DMapOfTriangulationBool;
typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> MapOfShape;

View File

@@ -35,7 +35,8 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
const Handle(NCollection_IncAllocator)& theAllocator,
const Standard_Integer theReservedNodeSize)
: myAllocator (theAllocator),
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, myAllocator)),
myNodes (new BRepMesh_VertexTool(myAllocator)),
myNodeLinks (theReservedNodeSize * 3, myAllocator),
myLinks (theReservedNodeSize * 3, myAllocator),
myDelLinks (myAllocator),
myElements (theReservedNodeSize * 2, myAllocator),

View File

@@ -429,8 +429,6 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
Standard_Real aTolU, aTolV;
myMeshData->Data()->GetTolerance(aTolU, aTolV);
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
@@ -442,8 +440,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
Standard_Integer anUpper = theVertexIndexes.Upper();
for( ; anIndex <= anUpper; ++anIndex )
{
aLoopEdges.Clear();
aAllocator->Reset(Standard_False);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
@@ -598,6 +596,7 @@ void BRepMesh_Delaun::cleanupMesh()
for(;;)
{
aAllocator->Reset(Standard_False);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
@@ -679,7 +678,6 @@ void BRepMesh_Delaun::cleanupMesh()
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
}
aAllocator->Reset(Standard_False);
if ( aDeletedTrianglesNb == 0 )
break;
}
@@ -2173,7 +2171,8 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
const BRepMesh_DegreeOfFreedom theEdgeType ) const
{
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
for ( ; anEdgeIt.More(); anEdgeIt.Next() )

View File

@@ -25,7 +25,6 @@
#include <TopoDS_Iterator.hxx>
#include <BRep_Tool.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
//=======================================================================
@@ -141,14 +140,12 @@ void BRepMesh_FaceAttribute::init()
// between vertices
myMinStep = RealLast();
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
{
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
if (BRep_Tool::IsClosed(anEdge))
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
continue;
// Get end points on 2d curve

View File

@@ -47,6 +47,7 @@
#include <Extrema_LocateExtPC.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfCharacter.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColGeom2d_SequenceOfCurve.hxx>
@@ -82,6 +83,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret,Standard_Transient)
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
const BRepMesh_FastDiscret::Parameters& theParams)
:
myMapdefle(1000, new NCollection_IncAllocator()),
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
myParameters(theParams),
@@ -195,7 +197,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
resetDataStructure();
Standard_Real defedge;
Standard_Real defedge = myParameters.Deflection;
Standard_Integer nbEdge = 0;
Standard_Real savangle = myParameters.Angle;
Standard_Real cdef;
@@ -205,18 +207,14 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
if (!myParameters.Relative)
defface = Max(myParameters.Deflection, maxdef);
NCollection_Sequence<EdgePCurve> aPCurves;
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
const TopoDS_Face& aFace = myAttribute->Face();
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
for (; aWireIt.More(); aWireIt.Next())
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
{
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
{
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
if (aEdge.IsNull())
continue;
if (!myMapdefle.IsBound(aEdge))
{
if (myParameters.Relative)
@@ -265,8 +263,6 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
aPCurves.Append(aPCurve);
aFaceEdges.Append(aEdge);
add(aEdge, aPCurve, defedge);
myParameters.Angle = savangle;
@@ -293,6 +289,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
TopLoc_Location aLoc;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
if ( aTriangulation.IsNull() )
{
@@ -401,16 +398,29 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
++nbmaill;
resetDataStructure();
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
{
const TopoDS_Edge& anEdge = aFaceEdges(j);
if (myEdges.IsBound(anEdge))
myEdges.UnBind(anEdge);
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Value());
if (anEdge.IsNull())
continue;
if (myEdges.IsBound(anEdge))
myEdges.UnBind(anEdge);
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
myMapdefle.Bind(anEdge, defedge);
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
myMapdefle.Bind(anEdge, defedge);
add(anEdge, aPCurves(j), defedge);
Standard_Real aFirstParam, aLastParam;
Handle(Geom2d_Curve) aCurve2d =
BRep_Tool::CurveOnSurface(anEdge, aFace, aFirstParam, aLastParam);
if (aCurve2d.IsNull())
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
add(anEdge, aPCurve, defedge);
}
}
aDFaceChecker.ReCompute(aClassifier);
@@ -806,18 +816,13 @@ void BRepMesh_FastDiscret::update(
Handle(Poly_PolygonOnTriangulation) P1, P2;
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
{
const Standard_Integer aNodesNb = 2;
TColStd_Array1OfInteger aNewNodes (1, aNodesNb);
TColStd_Array1OfInteger aNewNodInStruct(1, aNodesNb);
TColStd_Array1OfReal aNewParams (1, aNodesNb);
aNewNodInStruct(1) = ipf;
aNewNodes (1) = isvf;
aNewParams (1) = aEAttr.FirstParam;
aNewNodInStruct(aNodesNb) = ipl;
aNewNodes (aNodesNb) = isvl;
aNewParams (aNodesNb) = aEAttr.LastParam;
// two nodes
Standard_Integer aNewNodesArr[] = {isvf, isvl};
Standard_Integer aNewNodInStructArr[] = {ipf, ipl};
Standard_Real aNewParamsArr[] = {aEAttr.FirstParam, aEAttr.LastParam};
TColStd_Array1OfInteger aNewNodes (aNewNodesArr[0], 1, 2);
TColStd_Array1OfInteger aNewNodInStruct(aNewNodInStructArr[0], 1, 2);
TColStd_Array1OfReal aNewParams (aNewParamsArr[0], 1, 2);
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
@@ -825,9 +830,15 @@ void BRepMesh_FastDiscret::update(
else
{
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
TColStd_Array1OfReal aNewParamsVec (1, aNodesNb);
// Allocate the memory for arrays aNewNodesVec, aNewNodesInStructVec, aNewParamsVec
// only once using the buffer aBuf.
TColStd_Array1OfCharacter aBuf(1, aNodesNb * (2*sizeof(Standard_Integer) + sizeof(Standard_Real)));
TColStd_Array1OfInteger aNewNodesVec(*reinterpret_cast<const Standard_Integer*>
(&aBuf(1)), 1, aNodesNb);
TColStd_Array1OfInteger aNewNodesInStructVec(*reinterpret_cast<const Standard_Integer*>
(&aBuf(1 + aNodesNb*sizeof(Standard_Integer))), 1, aNodesNb);
TColStd_Array1OfReal aNewParamsVec(*reinterpret_cast<const Standard_Real*>
(&aBuf(1 + aNodesNb*2*sizeof(Standard_Integer))), 1, aNodesNb);
Standard_Integer aNodesCount = 1;
aNewNodesInStructVec(aNodesCount) = ipf;

View File

@@ -92,6 +92,29 @@ static Standard_Real FUN_CalcAverageDUV(TColStd_Array1OfReal& P, const Standard_
namespace
{
Standard_Real deflectionOfSegment (
const gp_Pnt& theFirstPoint,
const gp_Pnt& theLastPoint,
const gp_Pnt& theMidPoint)
{
// 23.03.2010 skl for OCC21645 - change precision for comparison
if (theFirstPoint.SquareDistance (theLastPoint) > Precision::SquareConfusion ())
{
gp_Lin aLin (theFirstPoint, gp_Dir (gp_Vec (theFirstPoint, theLastPoint)));
return aLin.Distance (theMidPoint);
}
return theFirstPoint.Distance (theMidPoint);
}
Standard_Boolean IsCompexSurface (const GeomAbs_SurfaceType theType)
{
return (
theType != GeomAbs_Sphere &&
theType != GeomAbs_Cylinder &&
theType != GeomAbs_Cone &&
theType != GeomAbs_Torus);
}
//! Auxiliary class used to extract geometrical parameters of fixed TopoDS_Vertex.
class FixedVExplorer
@@ -184,18 +207,18 @@ void BRepMesh_FastDiscretFace::initDataStructure()
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
myAttribute->ChangeStructure() = myStructure;
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt(1, aAllocator);
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
// Check the necessity to fill the map of parameters
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
GeomAbs_SurfaceType thetype = gFace->GetType();
const Standard_Boolean isBSpline = (thetype == GeomAbs_BezierSurface ||
thetype == GeomAbs_BSplineSurface);
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus ||isBSpline);
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
myUParam.Clear();
myVParam.Clear();
myUParam.Clear(aAllocator);
myVParam.Clear(aAllocator);
// essai de determination de la longueur vraie:
// akm (bug OCC16) : We must calculate these measures in non-singular
@@ -370,7 +393,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
Standard_Real aDef = -1;
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
{
BRepMesh::ListOfVertex aNewVertices;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::ListOfVertex aNewVertices(anAlloc);
if (!rajout)
{
aDef = control(aNewVertices, trigu, Standard_True);
@@ -440,8 +464,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
BRepMesh::SequenceOfReal& theResult)
{
// Sort sequence of parameters
BRepMesh::SequenceOfReal aParamTmp;
Standard_Integer aParamLength = 1;
const Standard_Integer anInitLen = theParams.Extent();
TColStd_Array1OfReal aParamArray(1, anInitLen);
@@ -452,37 +474,26 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
std::sort (aParamArray.begin(), aParamArray.end());
// mandatory pre-filtering using the first (minimal) filter value
Standard_Real aP1, aP2;
aP1 = aParamArray(1);
aParamTmp.Append(aP1);
Standard_Integer aParamLength = 1;
for (j = 2; j <= anInitLen; j++)
{
aP2 = aParamArray(j);
if ((aP2-aP1) > theMinDist)
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
{
aParamTmp.Append(aP2);
aP1 = aP2;
aParamLength++;
if (++aParamLength < j)
aParamArray(aParamLength) = aParamArray(j);
}
}
//add last point if required
if(aParamArray(anInitLen)-theParams(aParamLength) > theMinDist)
{
aParamTmp.Append(aParamArray(anInitLen));
aParamLength++;
}
//perform filtering on series
Standard_Real aLastAdded, aLastCandidate;
Standard_Boolean isCandidateDefined = Standard_False;
aLastAdded = aParamTmp.First();
aLastAdded = aParamArray(1);
aLastCandidate = aLastAdded;
theResult.Append(aParamTmp.First());
theResult.Append(aLastAdded);
for(j=2;j<aParamTmp.Length();j++)
for(j=2; j < aParamLength; j++)
{
Standard_Real aVal = aParamTmp.Value(j);
Standard_Real aVal = aParamArray(j);
if(aVal-aLastAdded > theFilterDist)
{
//adds the parameter
@@ -502,29 +513,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
aLastCandidate = aVal;
isCandidateDefined = Standard_True;
}
theResult.Append(aParamTmp.Last());
if( theResult.Length() == 2 )
{
Standard_Real dist = theResult.Last() - theResult.First();
Standard_Integer nbint = (Standard_Integer)((dist / theFilterDist) + 0.5);
if( nbint > 1 )
{
//Five points more is maximum
if( nbint > 5 )
{
nbint = 5;
}
Standard_Integer i;
Standard_Real dU = dist / nbint;
for( i = 1; i < nbint; i++ )
{
theResult.InsertAfter(i, theResult.First()+i*dU);
}
}
}
theResult.Append(aParamArray(aParamLength));
}
void BRepMesh_FastDiscretFace::insertInternalVertices(
@@ -550,11 +539,6 @@ void BRepMesh_FastDiscretFace::insertInternalVertices(
insertInternalVerticesTorus(theNewVertices);
break;
case GeomAbs_BezierSurface:
case GeomAbs_BSplineSurface:
insertInternalVerticesBSpline(theNewVertices);
break;
default:
insertInternalVerticesOther(theNewVertices);
break;
@@ -621,19 +605,29 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(
gp_Cylinder aCylinder = myAttribute->Surface()->Cylinder();
const Standard_Real aRadius = aCylinder.Radius();
// Calculate parameters for iteration in U direction
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
aRadius, myAttribute->GetDefFace(), myAngle, myMinSize);
Standard_Integer nbU = 0;
Standard_Integer nbV = 0;
const Standard_Real su = umax - umin;
const Standard_Integer nbU = (Standard_Integer)(su / Du);
Du = su / (nbU + 1);
// Calculate parameters for iteration in V direction
const Standard_Real sv = vmax - vmin;
Standard_Integer nbV = (Standard_Integer)(nbU*sv / (su*aRadius));
nbV = Min(nbV, 100 * nbU);
Standard_Real Dv = sv / (nbV + 1);
const Standard_Real aArcLen = su * aRadius;
if (aArcLen > myAttribute->GetDefFace ())
{
// Calculate parameters for iteration in U direction
const Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep (
aRadius, myAttribute->GetDefFace (), myAngle, myMinSize);
nbU = (Standard_Integer)(su / Du);
// Calculate parameters for iteration in V direction
const Standard_Real aDv = nbU*sv / aArcLen;
// Protection against overflow during casting to int in case
// of long cylinder with small radius.
nbV = aDv > static_cast<Standard_Real> (IntegerLast ()) ?
0 : (Standard_Integer)(aDv);
nbV = Min (nbV, 100 * nbU);
}
const Standard_Real Du = su / (nbU + 1);
const Standard_Real Dv = sv / (nbV + 1);
Standard_Real pasu, pasv, pasvmax = vmax - Dv*0.5, pasumax = umax - Du*0.5;
for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv)
@@ -817,10 +811,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesTorus(
}
//=======================================================================
//function : insertInternalVerticesBSpline
//function : insertInternalVerticesOther
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
BRepMesh::ListOfVertex& theNewVertices)
{
const Standard_Real aRange[2][2] = {
@@ -836,7 +830,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
const Standard_Real aDefFace = myAttribute->GetDefFace();
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
BRepMesh::SequenceOfReal aParams[2];
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
BRepMesh::SequenceOfReal(anAlloc) };
for (Standard_Integer i = 0; i < 2; ++i)
{
Standard_Boolean isU = (i == 0);
@@ -859,22 +855,21 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
}
// check intermediate isolines
Handle(Geom_Surface) aBSpline;
GeomAbs_SurfaceType aSurfType = gFace->GetType();
if (aSurfType == GeomAbs_BezierSurface)
aBSpline = gFace->Bezier();
else if (aSurfType == GeomAbs_BSplineSurface)
aBSpline = gFace->BSpline();
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
// precision for compare square distances
const Standard_Real aPrecision = Precision::Confusion();
const Standard_Real aSqPrecision = aPrecision * aPrecision;
const Standard_Real aPrecision = Precision::Confusion();
for (Standard_Integer k = 0; k < 2; ++k)
{
const Standard_Integer aOtherIndex = (k + 1) % 2;
BRepMesh::SequenceOfReal& aParams1 = aParams[k];
BRepMesh::SequenceOfReal& aParams2 = aParams[(k + 1) % 2];
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherIndex];
const Standard_Boolean isU = (k == 0);
Standard_Integer aStartIndex, aEndIndex;
if (isU)
@@ -888,31 +883,30 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
aEndIndex = aParams1.Length() - 1;
}
BRepMesh::MapOfReal& aToRemove2 = aParamsToRemove[aOtherIndex];
BRepMesh::MapOfReal& aForbiddenToRemove1 = aParamsForbiddenToRemove[k];
BRepMesh::MapOfReal& aForbiddenToRemove2 = aParamsForbiddenToRemove[aOtherIndex];
for (Standard_Integer i = aStartIndex; i <= aEndIndex; ++i)
{
const Standard_Real aParam1 = aParams1(i);
GeomAdaptor_Curve aIso(isU ?
aBSpline->UIso(aParam1) : aBSpline->VIso(aParam1));
aSurface->UIso (aParam1) : aSurface->VIso (aParam1));
Standard_Real aPrevParam2 = aParams2(1);
gp_Pnt aPrevPnt2 = aIso.Value(aPrevParam2);
gp_Pnt aPrevPnt2;
gp_Vec aPrevVec2;
aIso.D1 (aPrevParam2, aPrevPnt2, aPrevVec2);
for (Standard_Integer j = 2; j <= aParams2.Length();)
{
Standard_Real aParam2 = aParams2(j);
gp_Pnt aPnt2 = aIso.Value(aParam2);
gp_Pnt aPnt2;
gp_Vec aVec2;
aIso.D1 (aParam2, aPnt2, aVec2);
Standard_Real aMidParam = 0.5 * (aPrevParam2 + aParam2);
gp_Pnt aMidPnt = aIso.Value(aMidParam);
// 23.03.2010 skl for OCC21645 - change precision for comparison
Standard_Real aDist;
if (aPrevPnt2.SquareDistance(aPnt2) > aSqPrecision)
{
gp_Lin aLin(aPrevPnt2, gp_Dir(gp_Vec(aPrevPnt2, aPnt2)));
aDist = aLin.Distance(aMidPnt);
}
else
aDist = aPrevPnt2.Distance(aMidPnt);
Standard_Real aDist = deflectionOfSegment (aPrevPnt2, aPnt2, aMidPnt);
if (aDist > aDefFace && aDist > myMinSize)
{
// insertion
@@ -934,14 +928,14 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
}
gp_Dir N1(0, 0, 1), N2(0, 0, 1);
Standard_Boolean aSt1 = GeomLib::NormEstim(aBSpline, aStPnt1, aPrecision, N1);
Standard_Boolean aSt2 = GeomLib::NormEstim(aBSpline, aStPnt2, aPrecision, N2);
Standard_Boolean aSt1 = GeomLib::NormEstim (aSurface, aStPnt1, aPrecision, N1);
Standard_Boolean aSt2 = GeomLib::NormEstim (aSurface, aStPnt2, aPrecision, N2);
Standard_Real aAngle = N2.Angle(N1);
const Standard_Real aAngle = N2.Angle(N1);
if (aSt1 < 1 && aSt2 < 1 && aAngle > myAngle)
{
Standard_Real aLen = GCPnts_AbscissaPoint::Length(aIso,
aPrevParam2, aMidParam, aDefFace);
const Standard_Real aLen = GCPnts_AbscissaPoint::Length (
aIso, aPrevParam2, aMidParam, aDefFace);
if (aLen > myMinSize)
{
@@ -951,8 +945,51 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
}
}
// Here we should leave at least 3 parameters as far as
// we must have at least one parameter related to surface
// internals in order to prevent movement of triangle body
// outside the surface in case of highly curved ones, e.g.
// BSpline springs.
if (aDist < aDefFace &&
aParams2.Length () > 3 &&
j < aParams2.Length ())
{
// Remove too dense points
const Standard_Real aTmpParam = aParams2 (j + 1);
gp_Pnt aTmpPnt;
gp_Vec aTmpVec;
aIso.D1 (aTmpParam, aTmpPnt, aTmpVec);
Standard_Real aTmpMidParam = 0.5 * (aPrevParam2 + aTmpParam);
gp_Pnt aTmpMidPnt = aIso.Value (aTmpMidParam);
// Lets check next parameter.
// If it also fits deflection, we can remove previous parameter.
aDist = deflectionOfSegment (aPrevPnt2, aTmpPnt, aTmpMidPnt);
if (aDist < aDefFace)
{
// Lets check parameters for angular deflection.
if (aPrevVec2.Angle (aTmpVec) < myAngle)
{
// For current Iso line we can remove this parameter.
aToRemove2.Add (aParam2);
aParam2 = aTmpParam;
aPnt2 = aTmpPnt;
aVec2 = aTmpVec;
++j;
}
else {
// We have found a place on the surface refusing
// removement of this parameter.
aForbiddenToRemove1.Add (aParam1);
aForbiddenToRemove2.Add (aParam2);
}
}
}
aPrevParam2 = aParam2;
aPrevPnt2 = aPnt2;
aPrevVec2 = aVec2;
++j;
}
@@ -963,10 +1000,17 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
// insert nodes of the regular grid
for (Standard_Integer i = 1; i <= aParams[0].Length(); ++i)
{
const Standard_Real aParam1 = aParams[0].Value(i);
const Standard_Real aParam1 = aParams[0].Value (i);
if (aParamsToRemove[0].Contains (aParam1) && !aParamsForbiddenToRemove[0].Contains (aParam1))
continue;
for (Standard_Integer j = 1; j <= aParams[1].Length(); ++j)
{
gp_Pnt2d aPnt2d(aParam1, aParams[1].Value(j));
const Standard_Real aParam2 = aParams[1].Value (j);
if (aParamsToRemove[1].Contains (aParam2) && !aParamsForbiddenToRemove[1].Contains (aParam2))
continue;
gp_Pnt2d aPnt2d(aParam1, aParam2);
// Classify intersection point
if (aClassifier->Perform(aPnt2d) == TopAbs_IN)
@@ -979,87 +1023,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
}
}
//=======================================================================
//function : insertInternalVerticesOther
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
BRepMesh::ListOfVertex& theNewVertices)
{
const Standard_Real aAngle = myAngle;//0.35;
const Standard_Real aRange[2][2] = {
{ myAttribute->GetUMax(), myAttribute->GetUMin() },
{ myAttribute->GetVMax(), myAttribute->GetVMin() }
};
const Standard_Real aDefFace = myAttribute->GetDefFace();
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
BRepMesh::SequenceOfReal aParams[2];
const Standard_Integer aIsoPointsNb = 11;
for (Standard_Integer k = 0; k < 2; ++k)
{
const Standard_Boolean isU = (k == 0);
const GeomAbs_IsoType aIsoType = isU ? GeomAbs_IsoU : GeomAbs_IsoV;
const Standard_Integer aOtherParamsIndex = (k + 1) % 2;
const Standard_Real (&aRange1)[2] = aRange[k];
const Standard_Real (&aRange2)[2] = aRange[aOtherParamsIndex];
GCPnts_TangentialDeflection aDiscretIso[aIsoPointsNb];
const Standard_Real aStepWidth = (aRange1[0] - aRange1[1]) / aIsoPointsNb;
// Find the most curved Iso.
Standard_Integer aMaxIndex = 1, aMaxPointsNb = 0;
for (Standard_Integer aIsoIt = 0; aIsoIt < aIsoPointsNb; ++aIsoIt)
{
Standard_Real aParam = aRange1[1] + aIsoIt * aStepWidth;
Adaptor3d_IsoCurve aIso(gFace, aIsoType, aParam);
Standard_Real aFirstParam = Max(aRange2[1], aIso.FirstParameter());
Standard_Real aLastParam = Min(aRange2[0], aIso.LastParameter());
aDiscretIso[aIsoIt].Initialize(aIso, aFirstParam, aLastParam,
aAngle, 0.7 * aDefFace, 2, Precision::PConfusion(), myMinSize);
const Standard_Integer aPointsNb = aDiscretIso[aIsoIt].NbPoints();
if (aPointsNb > aMaxPointsNb)
{
aMaxPointsNb = aPointsNb;
aMaxIndex = aIsoIt;
}
}
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherParamsIndex];
GCPnts_TangentialDeflection& aDIso = aDiscretIso[aMaxIndex];
for (Standard_Integer i = 1; i <= aMaxPointsNb; ++i)
aParams2.Append(aDIso.Parameter(i));
if (aParams2.Length() == 2)
aParams2.InsertAfter(1, 0.5 * (aRange2[1] + aRange2[0]));
}
Adaptor3d_IsoCurve aIsoV;
aIsoV.Load(gFace);
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
const Standard_Integer aUPointsNb = aParams[0].Length();
const Standard_Integer aVPointsNb = aParams[1].Length();
for (Standard_Integer i = 2; i < aVPointsNb; ++i)
{
const Standard_Real aV = aParams[1].Value(i);
aIsoV.Load(GeomAbs_IsoV, aV);
for (Standard_Integer j = 2; j < aUPointsNb; ++j)
{
const Standard_Real aU = aParams[0].Value(j);
const gp_Pnt2d aNewPoint(aU, aV);
if (aClassifier->Perform(aNewPoint) == TopAbs_IN)
insertVertex(aIsoV.Value(aU), aNewPoint.Coord(), theNewVertices);
}
}
}
//=======================================================================
//function : checkDeflectionAndInsert
//purpose :
@@ -1072,7 +1035,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
const Standard_Real theFaceDeflection,
const BRepMesh_CircleTool& theCircleTool,
BRepMesh::ListOfVertex& theVertices,
Standard_Real& theMaxTriangleDeflection)
Standard_Real& theMaxTriangleDeflection,
const Handle(NCollection_IncAllocator)& theTempAlloc)
{
if (theTriangleDeflection > theMaxTriangleDeflection)
theMaxTriangleDeflection = theTriangleDeflection;
@@ -1087,9 +1051,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
myAttribute->Scale(theUV, Standard_True));
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
for (; aCircleIt.More(); aCircleIt.Next())
{
@@ -1143,15 +1105,15 @@ Standard_Real BRepMesh_FastDiscretFace::control(
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
Handle(Geom_Surface) aBSpline;
GeomAbs_SurfaceType aSurfType = gFace->GetType();
if (aSurfType == GeomAbs_BezierSurface)
aBSpline = gFace->Bezier();
else if (aSurfType == GeomAbs_BSplineSurface)
aBSpline = gFace->BSpline();
const GeomAbs_SurfaceType aSurfType = gFace->GetType ();
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
aBSpline = gFace->ChangeSurface ().Surface().Surface();
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
BRepMesh::MapOfIntegerInteger aStatMap;
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
Handle(NCollection_IncAllocator) anAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
// Perform refinement passes
@@ -1162,8 +1124,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
Standard_Real aMaxSqDef = -1.;
Standard_Integer aPass = 1, aInsertedNb = 1;
Standard_Boolean isAllDegenerated = Standard_False;
Handle(NCollection_IncAllocator) aTempAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
{
aTempAlloc->Reset(Standard_False);
theNewVertices.Clear();
// Reset stop condition
@@ -1239,7 +1204,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
aSqDef *= aSqDef;
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
if (isSkipped)
break;
@@ -1273,7 +1238,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
aSqDef = aLin.SquareDistance(pDef);
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
}
}
@@ -1440,6 +1405,8 @@ void BRepMesh_FastDiscretFace::commitSurfaceTriangulation()
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
// Delete unused data
myUParam.Clear(0L);
myVParam.Clear(0L);
myAttribute->ChangeStructure().Nullify();
myAttribute->ChangeSurfacePoints().Nullify();
myAttribute->ChangeSurfaceVertices().Nullify();

View File

@@ -106,10 +106,6 @@ private:
//! @param theNewVertices list of vertices to be extended and added to mesh.
void insertInternalVerticesTorus(BRepMesh::ListOfVertex& theNewVertices);
//! Calculates nodes lying on Bezier/BSpline surface.
//! @param theNewVertices list of vertices to be extended and added to mesh.
void insertInternalVerticesBSpline(BRepMesh::ListOfVertex& theNewVertices);
//! Calculates nodes lying on custom-type surface.
//! @param theNewVertices list of vertices to be extended and added to mesh.
void insertInternalVerticesOther(BRepMesh::ListOfVertex& theNewVertices);
@@ -178,7 +174,8 @@ private:
const Standard_Real theFaceDeflection,
const BRepMesh_CircleTool& theCircleTool,
BRepMesh::ListOfVertex& theVertices,
Standard_Real& theMaxTriangleDeflection);
Standard_Real& theMaxTriangleDeflection,
const Handle(NCollection_IncAllocator)& theTempAlloc);
private:

View File

@@ -48,6 +48,7 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -125,8 +126,11 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
//=======================================================================
void BRepMesh_IncrementalMesh::clear()
{
myEdges.Clear();
myEdgeDeflection.Clear();
// the allocator will be alive while the structures are alive
Handle(NCollection_IncAllocator) anAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
myEdges.Clear(anAlloc);
myEdgeDeflection.Clear(anAlloc);
myFaces.Clear();
myMesh.Nullify();
}
@@ -146,15 +150,18 @@ void BRepMesh_IncrementalMesh::init()
collectFaces();
Bnd_Box aBox;
BRepBndLib::Add(myShape, aBox, Standard_False);
if (aBox.IsVoid())
if ( myParameters.Relative )
{
// Nothing to mesh.
return;
}
BRepBndLib::Add(myShape, aBox, Standard_False);
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
if (aBox.IsVoid())
{
// Nothing to mesh.
return;
}
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
}
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
@@ -167,22 +174,21 @@ void BRepMesh_IncrementalMesh::init()
//=======================================================================
void BRepMesh_IncrementalMesh::collectFaces()
{
TopTools_ListOfShape aFaceList;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
TopTools_ListOfShape aFaceList(anAlloc);
BRepLib::ReverseSortFaces(myShape, aFaceList);
TopTools_MapOfShape aFaceMap;
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
// make array of faces suitable for processing (excluding faces without surface)
TopLoc_Location aDummyLoc;
const TopLoc_Location aEmptyLoc;
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
for (; aFaceIter.More(); aFaceIter.Next())
{
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
aFaceNoLoc.Location(aEmptyLoc);
if (!aFaceMap.Add (aFaceNoLoc))
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
if (!aTFaceMap.Add (aTFace))
continue; // already processed
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
if (aSurf.IsNull())
continue;
@@ -282,8 +288,9 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
const TopoDS_Edge& theEdge)
{
if (myEdgeDeflection.IsBound(theEdge))
return myEdgeDeflection(theEdge);
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
if (pDef)
return *pDef;
Standard_Real aEdgeDeflection;
if ( myParameters.Relative )
@@ -329,7 +336,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
{
if (!myEdges.IsBound(theEdge))
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
// Check that triangulation relies to face of the given shape.

View File

@@ -30,13 +30,11 @@ public:
typedef Standard_Integer Target;
//! Constructor.
//! @param theReservedSize size to be reserved for vector of vertices.
//! @param theAllocator memory allocator to be used by internal collections.
Standard_EXPORT BRepMesh_VertexInspector (
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator)
: myResIndices(theAllocator),
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
myVertices (new BRepMesh::VectorOfVertex),
myDelNodes (theAllocator)
{
SetTolerance( Precision::Confusion() );

View File

@@ -56,11 +56,10 @@ NCollection_CellFilter_Action BRepMesh_VertexInspector::Inspect(
//purpose :
//=======================================================================
BRepMesh_VertexTool::BRepMesh_VertexTool(
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator)
: myAllocator (theAllocator),
myCellFilter(0., myAllocator),
mySelector (Max(theReservedSize, 64),myAllocator)
mySelector (myAllocator)
{
const Standard_Real aTol = Precision::Confusion();
SetCellSize ( aTol + 0.05 * aTol );

View File

@@ -36,10 +36,8 @@ public:
DEFINE_STANDARD_ALLOC
//! Constructor.
//! @param theReservedSize size to be reserved for vector of vertices.
//! @param theAllocator memory allocator to be used by internal collections.
Standard_EXPORT BRepMesh_VertexTool(
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator);
//! Sets new size of cell for cellfilter equal in both directions.

View File

@@ -22,7 +22,8 @@
#include <BRepTools_WireExplorer.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Iterator.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <BRepMesh_PairOfPolygon.hxx>
#include <TColStd_SequenceOfInteger.hxx>
@@ -147,10 +148,11 @@ BRepMesh_WireChecker::BRepMesh_WireChecker(
TopoDS_Face aFace = theFace;
aFace.Orientation(TopAbs_FORWARD);
TopExp_Explorer aFaceExplorer(aFace, TopAbs_WIRE);
for (; aFaceExplorer.More(); aFaceExplorer.Next())
for (TopoDS_Iterator aFaceIt(aFace); aFaceIt.More(); aFaceIt.Next())
{
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceExplorer.Current());
if (aFaceIt.Value().IsNull() || aFaceIt.Value().ShapeType() != TopAbs_WIRE) // may be inner vertex
continue;
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceIt.Value());
myWiresEdges.Append(ListOfEdges());
ListOfEdges& aEdges = myWiresEdges.ChangeLast();

View File

@@ -1792,7 +1792,7 @@ Standard_Integer build3d(Draw_Interpretor& di,
}
Standard_Boolean Ok;
TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
TopoDS_Shape S = DBRep::Get(a[1]);
if (S.IsNull()) return 1;
if (n==2) { Ok = BRepLib::BuildCurves3d(S); }

View File

@@ -732,10 +732,22 @@ static Standard_Integer PRF(Draw_Interpretor& theCommands,
static Standard_Integer SPLS(Draw_Interpretor& ,
Standard_Integer narg, const char** a)
{
Standard_Integer newnarg ;
Standard_Integer newnarg;
if (narg<3) return 1;
if (narg < 3)
{
cout << "Invalid number of arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << endl;
return 1;
}
TopoDS_Shape S = DBRep::Get(a[2]);
if (S.IsNull())
{
cout << "Invalid input shape " << a[2]<<endl;
return 1;
}
BRepFeat_SplitShape Spls(S);
Standard_Boolean pick = Standard_False;
TopoDS_Shape EF;
@@ -752,20 +764,42 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
(newnarg !=narg && ((narg-newnarg)<=2 || (narg-newnarg)%2 != 1))) {
return 1;
}
if (i<newnarg) {
Standard_Boolean isSplittingEdges = Standard_False;
TopTools_SequenceOfShape aSplitEdges;
if (i < newnarg) {
pick = (a[i][0] == '.');
EF = DBRep::Get(a[i],TopAbs_FACE);
if (EF.IsNull()) return 1;
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
cout << "Invalid input shape " <<a[i]<<endl;
return 1;
}
if (aSh.ShapeType() == TopAbs_FACE)
EF = TopoDS::Face(aSh);
else
{
if (aSh.ShapeType() == TopAbs_COMPOUND || aSh.ShapeType() == TopAbs_WIRE || aSh.ShapeType() == TopAbs_EDGE)
{
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
for (; aExpE.More(); aExpE.Next())
aSplitEdges.Append(aExpE.Current());
isSplittingEdges = (aSplitEdges.Length());
}
}
}
i++;
while (i < newnarg) {
if (pick) {
DBRep_DrawableShape::LastPick(EF,u,v);
}
if (EF.ShapeType() == TopAbs_FACE) {
if (!isSplittingEdges && !EF.IsNull() && EF.ShapeType() == TopAbs_FACE) {
// face wire/edge ...
i++;
while (i < newnarg) {
TopoDS_Shape W;
Standard_Boolean rever = Standard_False;
@@ -811,11 +845,36 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
}
}
else
return 1;
{
if (isSplittingEdges)
{
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
cout << "Invalid input shape " <<a[i]<< endl;
return 1;
}
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
for (; aExpE.More(); aExpE.Next())
aSplitEdges.Append(aExpE.Current());
}
else
{
cout << "Invalid input arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]"<<endl;
return 1;
}
}
i++;
}
if (isSplittingEdges)
Spls.Add(aSplitEdges);
// ici, i vaut newnarg
for (i++; i<narg; i+=2) {
for (; i < narg; i += 2) {
TopoDS_Shape Ew,Es;
TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
Es = TopoDS::Edge(aLocalShape);
@@ -827,6 +886,7 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
Ew = TopoDS::Edge(aLocalShape);
// Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
if (Ew.IsNull()) {
cout << "Invalid input shape " <<a[i+1]<< endl;
return 1;
}
Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es));
@@ -2250,8 +2310,8 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
theCommands.Add("splitshape",
"splitshape result shape face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
__FILE__,SPLS,g);
"splitshape result shape [splitedges] [face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
__FILE__, SPLS, g);
theCommands.Add("thickshell",

View File

@@ -539,6 +539,41 @@ static Standard_Integer encoderegularity (Draw_Interpretor& ,
return 0;
}
static Standard_Integer getedgeregul
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if( argc < 3)
{
cout<<"Invalid number of arguments. Should be: checkedgeregularity edge face1 [face2]"<<endl;
return 1;
}
TopoDS_Shape anEdge = DBRep::Get(argv[1],TopAbs_EDGE);
TopoDS_Shape aFace1 = DBRep::Get(argv[2],TopAbs_FACE);
TopoDS_Shape aFace2 = (argc > 3 ? DBRep::Get(argv[3],TopAbs_FACE) : aFace1);
if( anEdge.IsNull() || aFace1.IsNull() || aFace2.IsNull())
{
cout<<"Invalid number of arguments. Should be: getedgeregularity edge face1 [face2]"<<endl;
return 1;
}
GeomAbs_Shape aRegularity = BRep_Tool::Continuity(TopoDS::Edge(anEdge), TopoDS::Face(aFace1), TopoDS::Face(aFace2));
TCollection_AsciiString aStrReg("Regularity of edge : ");
switch( aRegularity)
{
default:
case GeomAbs_C0 : aStrReg += "C0"; break;
case GeomAbs_G1 : aStrReg += "G1"; break;
case GeomAbs_C1 : aStrReg += "C1"; break;
case GeomAbs_G2 : aStrReg += "G2"; break;
case GeomAbs_C2 : aStrReg += "C2"; break;
case GeomAbs_C3 : aStrReg += "C3"; break;
case GeomAbs_CN : aStrReg += "CN"; break;
};
di<<aStrReg.ToCString()<<"\n";
return 0; // Done
}
//=======================================================================
//function : SurfaceCommands
@@ -594,5 +629,6 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add ("fastsewing", "fastsewing result [-tol <value>] <list_of_faces>",
__FILE__, fastsewing, g);
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
}

View File

@@ -32,7 +32,6 @@
#include <BRepPrimAPI_MakeHalfSpace.hxx>
#include <BRepAlgo_FaceRestrictor.hxx>
#include <BRepExtrema_ExtPF.hxx>
#include <BRepLProp_SLProps.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>

View File

@@ -495,18 +495,21 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
Standard_Integer locStatus = myStatus;
// apply recorded modifications to subshapes
Standard_Boolean isEmpty = Standard_True;
for ( TopoDS_Iterator it(shape,Standard_False); it.More(); it.Next() ) {
TopoDS_Shape sh = it.Value();
newsh = Apply ( sh, until );
if ( newsh != sh ) {
if ( myStatus & EncodeStatus(4)) //ShapeExtend::DecodeStatus ( myStatus, ShapeExtend_DONE4 ) )
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
modif = 1;
}
if ( newsh.IsNull() ) {
locStatus |= EncodeStatus(4); //ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
continue;
}
if ( isEmpty )
isEmpty = Standard_False;
locStatus |= EncodeStatus(3);//ShapeExtend::EncodeStatus ( ShapeExtend_DONE3 );
if ( st == TopAbs_COMPOUND || newsh.ShapeType() == sh.ShapeType()) { //fix for SAMTECH bug OCC322 about abcense internal vertices after sewing.
B.Add ( result, newsh );
@@ -522,23 +525,33 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
}
if ( ! modif ) return shape;
// restore Range on edge broken by EmptyCopied()
if ( st == TopAbs_EDGE ) {
CopyRanges (result, shape, 0, 1);
// For empty topological containers (any kind of shape except vertex, edge
// and face) we have to produce an empty result
if ( isEmpty && st != TopAbs_VERTEX && st != TopAbs_EDGE && st != TopAbs_FACE )
{
result = TopoDS_Shape();
}
else if (st == TopAbs_FACE) {
TopoDS_Face face = TopoDS::Face ( shape );
if( BRep_Tool::NaturalRestriction( face ) ) {
BRep_Builder aB;
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
else
{
// restore Range on edge broken by EmptyCopied()
if ( st == TopAbs_EDGE ) {
CopyRanges (result, shape, 0, 1);
}
}
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
result.Closed (BRep_Tool::IsClosed (result));
else if (st == TopAbs_FACE) {
TopoDS_Face face = TopoDS::Face ( shape );
if( BRep_Tool::NaturalRestriction( face ) ) {
BRep_Builder aB;
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
}
}
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
result.Closed (BRep_Tool::IsClosed (result));
result.Orientation(orien);
}
result.Orientation(orien);
myStatus = locStatus;
Replace ( shape, result );
myStatus = locStatus;
return result;
}

View File

@@ -3211,8 +3211,7 @@ void BSplCLib::Eval
BSplCLib_LocalMatrix BsplineBasis (LocalRequest, Order);
ErrorCode =
BSplCLib::EvalBsplineBasis(1,
LocalRequest,
BSplCLib::EvalBsplineBasis(LocalRequest,
Order,
FlatKnots,
LocalParameter,
@@ -3410,8 +3409,7 @@ void BSplCLib::Eval
BSplCLib_LocalMatrix BsplineBasis (LocalRequest, Order);
ErrorCode =
BSplCLib::EvalBsplineBasis(1,
LocalRequest,
BSplCLib::EvalBsplineBasis(LocalRequest,
Order,
FlatKnots,
LocalParameter,

View File

@@ -702,7 +702,13 @@ public:
//! value of Nth derivative of first non vanishing
//! Bspline function which has Index FirstNonZeroBsplineIndex
//! if N <= DerivativeOrder + 1
Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer Side, const Standard_Integer DerivativeOrder, const Standard_Integer Order, const TColStd_Array1OfReal& FlatKnots, const Standard_Real Parameter, Standard_Integer& FirstNonZeroBsplineIndex, math_Matrix& BsplineBasis, const Standard_Boolean isPeriodic = Standard_False);
Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer DerivativeOrder,
const Standard_Integer Order,
const TColStd_Array1OfReal& FlatKnots,
const Standard_Real Parameter,
Standard_Integer& FirstNonZeroBsplineIndex,
math_Matrix& BsplineBasis,
const Standard_Boolean isPeriodic = Standard_False);
//! This Builds a fully blown Matrix of
//! (ni)

View File

@@ -346,8 +346,7 @@ BSplCLib::BuildBSpMatrix(const TColStd_Array1OfReal& Parameters,
for (ii = Parameters.Lower() ; ii <= Parameters.Upper() ; ii++) {
ErrorCode =
BSplCLib::EvalBsplineBasis(1,
ContactOrderArray(ii),
BSplCLib::EvalBsplineBasis(ContactOrderArray(ii),
Order,
FlatKnots,
Parameters(ii),
@@ -433,9 +432,7 @@ BSplCLib::FactorBandedMatrix(math_Matrix& Matrix,
Standard_Integer
BSplCLib::EvalBsplineBasis
//(const Standard_Integer Side, // = 1 rigth side, -1 left side
(const Standard_Integer , // = 1 rigth side, -1 left side
const Standard_Integer DerivativeRequest,
(const Standard_Integer DerivativeRequest,
const Standard_Integer Order,
const TColStd_Array1OfReal& FlatKnots,
const Standard_Real Parameter,

View File

@@ -1230,8 +1230,7 @@ void BSplCLib::MovePoint (const Standard_Real U,
math_Matrix BSplineBasis(1, 1,
1, Degree+1);
Standard_Integer ErrorCode =
BSplCLib::EvalBsplineBasis(1,
0,
BSplCLib::EvalBsplineBasis(0,
Degree+1,
FlatKnots,
U,

View File

@@ -2805,8 +2805,7 @@ void BSplSLib::MovePoint (const Standard_Real U,
Standard_Integer UFirstNonZeroBsplineIndex;
math_Matrix UBSplineBasis(1, 1,
1, UDegree+1);
Standard_Integer ErrorCod1 = BSplCLib::EvalBsplineBasis(1,
0,
Standard_Integer ErrorCod1 = BSplCLib::EvalBsplineBasis(0,
UDegree+1,
UFlatKnots,
U,
@@ -2816,8 +2815,7 @@ void BSplSLib::MovePoint (const Standard_Real U,
Standard_Integer VFirstNonZeroBsplineIndex;
math_Matrix VBSplineBasis(1, 1,
1, VDegree+1);
Standard_Integer ErrorCod2 = BSplCLib::EvalBsplineBasis(1,
0,
Standard_Integer ErrorCod2 = BSplCLib::EvalBsplineBasis(0,
VDegree+1,
VFlatKnots,
V,

View File

@@ -14,6 +14,8 @@
// commercial license or contractual agreement.
#include <BVH_Geometry.hxx>
#include <BVH_QuickSorter.hxx>
#include <BVH_RadixSorter.hxx>
#include <BVH_Triangulation.hxx>
#include <BVH_DistanceField.hxx>
#include <BVH_LinearBuilder.hxx>
@@ -93,6 +95,18 @@ template class BVH_BinnedBuilder<Standard_ShortReal, 2>;
template class BVH_BinnedBuilder<Standard_ShortReal, 3>;
template class BVH_BinnedBuilder<Standard_ShortReal, 4>;
template class BVH_QuickSorter<Standard_Real, 3>;
template class BVH_QuickSorter<Standard_Real, 4>;
template class BVH_QuickSorter<Standard_ShortReal, 3>;
template class BVH_QuickSorter<Standard_ShortReal, 4>;
template class BVH_RadixSorter<Standard_Real, 3>;
template class BVH_RadixSorter<Standard_Real, 4>;
template class BVH_RadixSorter<Standard_ShortReal, 3>;
template class BVH_RadixSorter<Standard_ShortReal, 4>;
template class BVH_LinearBuilder<Standard_Real, 3>;
template class BVH_LinearBuilder<Standard_Real, 4>;

View File

@@ -16,9 +16,7 @@
#ifndef _BVH_LinearBuilder_Header
#define _BVH_LinearBuilder_Header
#include <BVH_Builder.hxx>
typedef std::pair<Standard_Integer, Standard_Integer> BVH_EncodedLink;
#include <BVH_RadixSorter.hxx>
//! Performs fast BVH construction using LBVH building approach.
//! Algorithm uses spatial Morton codes to reduce the BVH construction
@@ -51,14 +49,28 @@ public:
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox);
protected:
typedef NCollection_Array1<BVH_EncodedLink>::iterator LinkIterator;
protected:
//! Emits hierarchy from sorted Morton codes.
Standard_Integer EmitHierachy (BVH_Tree<T, N>* theBVH,
const Standard_Integer theBit,
const Standard_Integer theShift,
std::vector<BVH_EncodedLink>::iterator theStart,
std::vector<BVH_EncodedLink>::iterator theFinal);
Standard_Integer EmitHierachy (BVH_Tree<T, N>* theBVH,
const Standard_Integer theBit,
const Standard_Integer theShift,
const Standard_Integer theStart,
const Standard_Integer theFinal);
//! Returns index of the first element which does not compare less than the given one.
Standard_Integer LowerBound (Standard_Integer theStart,
Standard_Integer theFinal,
Standard_Integer theDigit);
protected:
//! Tool object to perform radix sort of BVH primitives.
NCollection_Handle<BVH_RadixSorter<T, N> > myRadixSorter;
};

View File

@@ -13,24 +13,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <algorithm>
#include <Standard_Assert.hxx>
#include <NCollection_Array1.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 will
// run on Windows NT 4.0 at least
#if defined(_WIN32) && !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x0501
#endif
#include <tbb/task.h>
#endif
// =======================================================================
// function : BVH_LinearBuilder
// purpose :
@@ -54,69 +38,78 @@ BVH_LinearBuilder<T, N>::~BVH_LinearBuilder()
//
}
// =======================================================================
// function : LowerBound
// purpose : Returns index of first element greater than the given one
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::LowerBound (Standard_Integer theStart,
Standard_Integer theFinal,
Standard_Integer theDigit)
{
Standard_Integer aNbPrims = theFinal - theStart;
while (aNbPrims > 0)
{
const Standard_Integer aStep = aNbPrims / 2;
if (myRadixSorter->EncodedLinks().Value (theStart + aStep).first & (1 << theDigit))
{
aNbPrims = aStep;
}
else
{
theStart += aStep + 1;
aNbPrims -= aStep + 1;
}
}
return theStart;
}
// =======================================================================
// function : EmitHierachy
// purpose : Emits hierarchy from sorted Morton codes
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::EmitHierachy (BVH_Tree<T, N>* theBVH,
const Standard_Integer theBit,
const Standard_Integer theShift,
const Standard_Integer theStart,
const Standard_Integer theFinal)
{
if (theFinal - theStart > BVH_Builder<T, N>::myLeafNodeSize)
{
const Standard_Integer aPosition = theBit < 0 ?
(theStart + theFinal) / 2 : LowerBound (theStart, theFinal, theBit);
if (aPosition == theStart || aPosition == theFinal)
{
return EmitHierachy (theBVH, theBit - 1, theShift, theStart, theFinal);
}
// Build inner node
const Standard_Integer aNode = theBVH->AddInnerNode (0, 0);
const Standard_Integer aRghNode = theShift + aPosition - theStart;
const Standard_Integer aLftChild = EmitHierachy (theBVH, theBit - 1, theShift, theStart, aPosition);
const Standard_Integer aRghChild = EmitHierachy (theBVH, theBit - 1, aRghNode, aPosition, theFinal);
theBVH->NodeInfoBuffer()[aNode].y() = aLftChild;
theBVH->NodeInfoBuffer()[aNode].z() = aRghChild;
return aNode;
}
else
{
// Build leaf node
return theBVH->AddLeafNode (theShift, theShift + theFinal - theStart - 1);
}
}
namespace BVH
{
// Radix sort STL predicate for 32-bit integer.
class BitPredicate
{
Standard_Integer myBit;
public:
//! Creates new radix sort predicate.
BitPredicate (const Standard_Integer theBit) : myBit (theBit)
{
//
}
//! Returns predicate value.
bool operator() (const BVH_EncodedLink theLink) const
{
const Standard_Integer aMask = 1 << myBit;
return !(theLink.first & aMask); // 0-bit to the left side
}
};
//! STL compare tool used in binary search algorithm.
class BitComparator
{
Standard_Integer myBit;
public:
//! Creates new STL comparator.
BitComparator (const Standard_Integer theBit) : myBit (theBit)
{
//
}
//! Checks left value for the given bit.
bool operator() (BVH_EncodedLink theLink1, BVH_EncodedLink /*theLink2*/)
{
return !(theLink1.first & (1 << myBit));
}
};
//! Tool object for sorting link array using radix sort algorithm.
struct RadixSorter
{
typedef std::vector<BVH_EncodedLink>::iterator LinkIterator;
// Performs MSD (most significant digit) radix sort.
static void Perform (LinkIterator theStart, LinkIterator theFinal, Standard_Integer theBit = 29)
{
while (theStart != theFinal && theBit >= 0)
{
LinkIterator anOffset = std::partition (theStart, theFinal, BitPredicate (theBit--));
Perform (theStart, anOffset, theBit);
theStart = anOffset;
}
}
};
//! Calculates bounding boxes (AABBs) for the given BVH tree.
template<class T, int N>
Standard_Integer UpdateBounds (BVH_Set<T, N>* theSet, BVH_Tree<T, N>* theTree, const Standard_Integer theNode = 0)
@@ -168,108 +161,9 @@ namespace BVH
return 0;
}
}
// =======================================================================
// function : EmitHierachy
// purpose : Emits hierarchy from sorted Morton codes
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::EmitHierachy (BVH_Tree<T, N>* theBVH,
const Standard_Integer theBit,
const Standard_Integer theShift,
std::vector<BVH_EncodedLink>::iterator theStart,
std::vector<BVH_EncodedLink>::iterator theFinal)
{
if (theFinal - theStart > BVH_Builder<T, N>::myLeafNodeSize)
{
std::vector<BVH_EncodedLink>::iterator aPosition =
(theBit >= 0) ? std::lower_bound (theStart, theFinal, BVH_EncodedLink(), BVH::BitComparator (theBit))
: theStart + ((theFinal - theStart) / 2);
if (aPosition == theStart || aPosition == theFinal)
{
return EmitHierachy (theBVH, theBit - 1, theShift, theStart, theFinal);
}
// Build inner node
const Standard_Integer aNode = theBVH->AddInnerNode (0, 0);
const Standard_Integer aRghNode = theShift + static_cast<Standard_Integer> (aPosition - theStart);
const Standard_Integer aLftChild = EmitHierachy (theBVH, theBit - 1, theShift, theStart, aPosition);
const Standard_Integer aRghChild = EmitHierachy (theBVH, theBit - 1, aRghNode, aPosition, theFinal);
theBVH->NodeInfoBuffer()[aNode].y() = aLftChild;
theBVH->NodeInfoBuffer()[aNode].z() = aRghChild;
return aNode;
}
else
{
// Build leaf node
return theBVH->AddLeafNode (theShift, theShift + static_cast<Standard_Integer> (theFinal - theStart) - 1);
}
}
#ifdef HAVE_TBB
namespace BVH
{
//! TBB task for parallel radix sort.
class RadixSortTask : public tbb::task
{
typedef std::vector<BVH_EncodedLink>::iterator LinkIterator;
private:
//! Start range element.
LinkIterator myStart;
//! Final range element.
LinkIterator myFinal;
//! Bit position for range partition.
Standard_Integer myDigit;
public:
//! Creates new TBB radix sort task.
RadixSortTask (LinkIterator theStart, LinkIterator theFinal, Standard_Integer theDigit)
: myStart (theStart),
myFinal (theFinal),
myDigit (theDigit)
{
//
}
//! Executes the task.
tbb::task* execute()
{
if (myDigit < 28)
{
BVH::RadixSorter::Perform (myStart, myFinal, myDigit);
}
else
{
LinkIterator anOffset = std::partition (myStart, myFinal, BitPredicate (myDigit));
tbb::task_list aList;
aList.push_back (*new ( allocate_child() )
RadixSortTask (myStart, anOffset, myDigit - 1));
aList.push_back (*new ( allocate_child() )
RadixSortTask (anOffset, myFinal, myDigit - 1));
set_ref_count (3); // count + 1
spawn_and_wait_for_all (aList);
}
return NULL;
}
};
//! TBB task for parallel bounds updating.
template<class T, int N>
class UpdateBoundTask: public tbb::task
@@ -370,9 +264,9 @@ namespace BVH
return NULL;
}
};
}
#endif
}
// =======================================================================
// function : Build
@@ -384,125 +278,43 @@ void BVH_LinearBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
const BVH_Box<T, N>& theBox)
{
Standard_STATIC_ASSERT (N == 3 || N == 4);
if (theBVH == NULL || theSet->Size() == 0)
const Standard_Integer aSetSize = theSet->Size();
if (theBVH == NULL || aSetSize == 0)
{
return;
}
theBVH->Clear();
const Standard_Integer aDimensionX = 1024;
const Standard_Integer aDimensionY = 1024;
const Standard_Integer aDimensionZ = 1024;
// Step 0 -- Initialize parameter of virtual grid
myRadixSorter = new BVH_RadixSorter<T, N> (theBox);
const BVH_VecNt aSceneMin = theBox.CornerMin();
const BVH_VecNt aSceneMax = theBox.CornerMax();
// Step 1 - Perform radix sorting of primitive set
myRadixSorter->Perform (theSet);
const T aMinSize = static_cast<T> (BVH::THE_NODE_MIN_SIZE);
// Step 2 -- Emitting BVH hierarchy from sorted Morton codes
EmitHierachy (theBVH, 29, 0, 0, theSet->Size());
const T aReverseSizeX = static_cast<T> (aDimensionX) / Max (aMinSize, aSceneMax.x() - aSceneMin.x());
const T aReverseSizeY = static_cast<T> (aDimensionY) / Max (aMinSize, aSceneMax.y() - aSceneMin.y());
const T aReverseSizeZ = static_cast<T> (aDimensionZ) / Max (aMinSize, aSceneMax.z() - aSceneMin.z());
std::vector<BVH_EncodedLink> anEncodedLinks (theSet->Size(), BVH_EncodedLink());
// Step 1 -- Assign Morton code to each primitive
for (Standard_Integer aPrimIdx = 0; aPrimIdx < theSet->Size(); ++aPrimIdx)
{
const BVH_VecNt aCenter = theSet->Box (aPrimIdx).Center();
Standard_Integer aVoxelX = BVH::IntFloor ((aCenter.x() - aSceneMin.x()) * aReverseSizeX);
Standard_Integer aVoxelY = BVH::IntFloor ((aCenter.y() - aSceneMin.y()) * aReverseSizeY);
Standard_Integer aVoxelZ = BVH::IntFloor ((aCenter.z() - aSceneMin.z()) * aReverseSizeZ);
aVoxelX = Max (0, Min (aVoxelX, aDimensionX - 1));
aVoxelY = Max (0, Min (aVoxelY, aDimensionY - 1));
aVoxelZ = Max (0, Min (aVoxelZ, aDimensionZ - 1));
aVoxelX = (aVoxelX | (aVoxelX << 16)) & 0x030000FF;
aVoxelX = (aVoxelX | (aVoxelX << 8)) & 0x0300F00F;
aVoxelX = (aVoxelX | (aVoxelX << 4)) & 0x030C30C3;
aVoxelX = (aVoxelX | (aVoxelX << 2)) & 0x09249249;
aVoxelY = (aVoxelY | (aVoxelY << 16)) & 0x030000FF;
aVoxelY = (aVoxelY | (aVoxelY << 8)) & 0x0300F00F;
aVoxelY = (aVoxelY | (aVoxelY << 4)) & 0x030C30C3;
aVoxelY = (aVoxelY | (aVoxelY << 2)) & 0x09249249;
aVoxelZ = (aVoxelZ | (aVoxelZ << 16)) & 0x030000FF;
aVoxelZ = (aVoxelZ | (aVoxelZ << 8)) & 0x0300F00F;
aVoxelZ = (aVoxelZ | (aVoxelZ << 4)) & 0x030C30C3;
aVoxelZ = (aVoxelZ | (aVoxelZ << 2)) & 0x09249249;
anEncodedLinks[aPrimIdx] = BVH_EncodedLink (
aVoxelX | (aVoxelY << 1) | (aVoxelZ << 2), aPrimIdx);
}
// Step 2 -- Sort primitives by their Morton codes using radix sort
#ifdef HAVE_TBB
BVH::RadixSortTask& aSortTask = *new ( tbb::task::allocate_root() )
BVH::RadixSortTask (anEncodedLinks.begin(), anEncodedLinks.end(), 29);
tbb::task::spawn_root_and_wait (aSortTask);
#else
BVH::RadixSorter::Perform (anEncodedLinks.begin(), anEncodedLinks.end());
#endif
// Step 3 -- Emitting BVH hierarchy from sorted Morton codes
EmitHierachy (theBVH, 29, 0, anEncodedLinks.begin(), anEncodedLinks.end());
NCollection_Array1<Standard_Integer> aLinkMap (0, theSet->Size() - 1);
for (Standard_Integer aLinkIdx = 0; aLinkIdx < theSet->Size(); ++aLinkIdx)
{
aLinkMap (anEncodedLinks[aLinkIdx].second) = aLinkIdx;
}
// Step 4 -- Rearranging primitive list according to Morton codes (in place)
Standard_Integer aPrimIdx = 0;
while (aPrimIdx < theSet->Size())
{
const Standard_Integer aSortIdx = aLinkMap (aPrimIdx);
if (aPrimIdx != aSortIdx)
{
theSet->Swap (aPrimIdx, aSortIdx);
std::swap (aLinkMap (aPrimIdx),
aLinkMap (aSortIdx));
}
else
{
++aPrimIdx;
}
}
// Step 5 -- Compute bounding boxes of BVH nodes
// Step 3 -- Compute bounding boxes of BVH nodes
theBVH->MinPointBuffer().resize (theBVH->NodeInfoBuffer().size());
theBVH->MaxPointBuffer().resize (theBVH->NodeInfoBuffer().size());
Standard_Integer aDepth = 0;
Standard_Integer aHeight = 0;
#ifdef HAVE_TBB
// Note: Although TBB tasks are allocated using placement
// new, we do not need to delete them explicitly
BVH::UpdateBoundTask<T, N>& aRootTask = *new ( tbb::task::allocate_root() )
BVH::UpdateBoundTask<T, N> (theSet, theBVH, 0, 0, &aDepth);
BVH::UpdateBoundTask<T, N> (theSet, theBVH, 0, 0, &aHeight);
tbb::task::spawn_root_and_wait (aRootTask);
#else
aDepth = BVH::UpdateBounds (theSet, theBVH, 0);
aHeight = BVH::UpdateBounds (theSet, theBVH, 0);
#endif
BVH_Builder<T, N>::UpdateDepth (theBVH, aDepth);
BVH_Builder<T, N>::UpdateDepth (theBVH, aHeight);
}

View File

@@ -103,12 +103,13 @@ void BVH_QueueBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
"Error! BVH tree to construct is NULL", );
theBVH->Clear();
if (theSet->Size() == 0)
const Standard_Integer aSetSize = theSet->Size();
if (aSetSize == 0)
{
return;
}
const Standard_Integer aRoot = theBVH->AddLeafNode (theBox, 0, theSet->Size() - 1);
const Standard_Integer aRoot = theBVH->AddLeafNode (theBox, 0, aSetSize - 1);
if (theSet->Size() == 1)
{
return;
@@ -121,7 +122,7 @@ void BVH_QueueBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
if (myNumOfThreads > 1)
{
// Reserve the maximum possible number of nodes in the BVH
theBVH->Reserve (2 * theSet->Size() - 1);
theBVH->Reserve (2 * aSetSize - 1);
NCollection_Vector<Handle(BVH_BuildThread)> aThreads;

View File

@@ -0,0 +1,46 @@
// Created on: 2016-04-13
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2016 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 _BVH_QuickSorter_Header
#define _BVH_QuickSorter_Header
#include <BVH_Sorter.hxx>
//! Performs centroid-based sorting of abstract set along
//! the given axis (X - 0, Y - 1, Z - 2) using quick sort.
template<class T, int N>
class BVH_QuickSorter : public BVH_Sorter<T, N>
{
public:
//! Creates new BVH quick sorter for the given axis.
BVH_QuickSorter (const Standard_Integer theAxis = 0) : myAxis (theAxis) { }
//! Sorts the set.
virtual void Perform (BVH_Set<T, N>* theSet);
//! Sorts the given (inclusive) range in the set.
virtual void Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal);
protected:
//! Axis used to arrange the primitives (X - 0, Y - 1, Z - 2).
Standard_Integer myAxis;
};
#include <BVH_QuickSorter.lxx>
#endif // _BVH_QuickSorter_Header

View File

@@ -1,6 +1,6 @@
// Created on: 2014-01-10
// Created on: 2016-04-13
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
// Copyright (c) 2013-2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -18,10 +18,9 @@
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Sorter<T, N>::Perform (BVH_Set<T, N>* theSet,
const Standard_Integer theAxis)
void BVH_QuickSorter<T, N>::Perform (BVH_Set<T, N>* theSet)
{
Perform (theSet, theAxis, 0, theSet->Size() - 1);
Perform (theSet, 0, theSet->Size() - 1);
}
// =======================================================================
@@ -29,24 +28,21 @@ void BVH_Sorter<T, N>::Perform (BVH_Set<T, N>* theSet,
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Sorter<T, N>::Perform (BVH_Set<T, N>* theSet,
const Standard_Integer theAxis,
const Standard_Integer theBegElement,
const Standard_Integer theEndElement)
void BVH_QuickSorter<T, N>::Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal)
{
Standard_Integer aLft = theBegElement;
Standard_Integer aRgh = theEndElement;
Standard_Integer aLft = theStart;
Standard_Integer aRgh = theFinal;
T aPivot = theSet->Center ((aRgh + aLft) / 2, theAxis);
T aPivot = theSet->Center ((aRgh + aLft) / 2, myAxis);
while (aLft < aRgh)
{
while (theSet->Center (aLft, theAxis) < aPivot && aLft < theEndElement)
while (theSet->Center (aLft, myAxis) < aPivot && aLft < theFinal)
{
++aLft;
}
while (theSet->Center (aRgh, theAxis) > aPivot && aRgh > theBegElement)
while (theSet->Center (aRgh, myAxis) > aPivot && aRgh > theStart)
{
--aRgh;
}
@@ -63,13 +59,13 @@ void BVH_Sorter<T, N>::Perform (BVH_Set<T, N>* theSet,
}
}
if (aRgh > theBegElement)
if (aRgh > theStart)
{
Perform (theSet, theAxis, theBegElement, aRgh);
Perform (theSet, theStart, aRgh);
}
if (aLft < theEndElement)
if (aLft < theFinal)
{
Perform (theSet, theAxis, aLft, theEndElement);
Perform (theSet, aLft, theFinal);
}
}

View File

@@ -0,0 +1,63 @@
// Created on: 2016-04-13
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2016 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 _BVH_RadixSorter_Header
#define _BVH_RadixSorter_Header
#include <BVH_Sorter.hxx>
#include <BVH_Builder.hxx>
#include <NCollection_Handle.hxx>
#include <NCollection_Array1.hxx>
//! Pair of Morton code and primitive ID.
typedef std::pair<Standard_Integer, Standard_Integer> BVH_EncodedLink;
//! Performs radix sort of a BVH primitive set using
//! 10-bit Morton codes (or 1024 x 1024 x 1024 grid).
template<class T, int N>
class BVH_RadixSorter : public BVH_Sorter<T, N>
{
public:
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
public:
//! Creates new BVH radix sorter for the given AABB.
BVH_RadixSorter (const BVH_Box<T, N>& theBox) : myBox (theBox) { }
//! Sorts the set.
virtual void Perform (BVH_Set<T, N>* theSet);
//! Sorts the given (inclusive) range in the set.
virtual void Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal);
//! Returns Morton codes assigned to BVH primitives.
const NCollection_Array1<BVH_EncodedLink>& EncodedLinks() const { return *myEncodedLinks; }
protected:
//! Axis-aligned bounding box (AABB) to perform sorting.
BVH_Box<T, N> myBox;
//! Morton codes assigned to BVH primitives.
NCollection_Handle<NCollection_Array1<BVH_EncodedLink> > myEncodedLinks;
};
#include <BVH_RadixSorter.lxx>
#endif // _BVH_RadixSorter_Header

241
src/BVH/BVH_RadixSorter.lxx Normal file
View File

@@ -0,0 +1,241 @@
// Created on: 2016-04-13
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2016 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.
#include <algorithm>
#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 will
// run on Windows NT 4.0 at least
#if defined(_WIN32) && !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x0501
#endif
#include <tbb/parallel_invoke.h>
#endif
// =======================================================================
// function : Perform
// purpose :
// =======================================================================
template<class T, int N>
void BVH_RadixSorter<T, N>::Perform (BVH_Set<T, N>* theSet)
{
Perform (theSet, 0, theSet->Size() - 1);
}
namespace BVH
{
// Radix sort STL predicate for 32-bit integer.
class BitPredicate
{
Standard_Integer myBit;
public:
//! Creates new radix sort predicate.
BitPredicate (const Standard_Integer theBit) : myBit (theBit)
{
//
}
//! Returns predicate value.
bool operator() (const BVH_EncodedLink theLink) const
{
const Standard_Integer aMask = 1 << myBit;
return !(theLink.first & aMask); // 0-bit to the left side
}
};
//! STL compare tool used in binary search algorithm.
class BitComparator
{
Standard_Integer myBit;
public:
//! Creates new STL comparator.
BitComparator (const Standard_Integer theBit) : myBit (theBit)
{
//
}
//! Checks left value for the given bit.
bool operator() (BVH_EncodedLink theLink1, BVH_EncodedLink /*theLink2*/)
{
return !(theLink1.first & (1 << myBit));
}
};
//! Tool object for sorting link array using radix sort algorithm.
class RadixSorter
{
public:
typedef NCollection_Array1<BVH_EncodedLink>::iterator LinkIterator;
private:
//! TBB functor class to run sorting.
class Functor
{
//! Start element of exclusive sorting range.
LinkIterator myStart;
//! Final element of exclusive sorting range.
LinkIterator myFinal;
//! Bit number used for partition operation.
Standard_Integer myDigit;
public:
//! Creates new sorting functor.
Functor (LinkIterator theStart, LinkIterator theFinal, Standard_Integer theDigit)
: myStart (theStart),
myFinal (theFinal),
myDigit (theDigit) { }
//! Runs sorting function for the given range.
void operator() () const
{
RadixSorter::Sort (myStart, myFinal, myDigit);
}
};
public:
static void Sort (LinkIterator theStart, LinkIterator theFinal, Standard_Integer theDigit)
{
#ifdef HAVE_TBB
if (theDigit < 24)
{
BVH::RadixSorter::perform (theStart, theFinal, theDigit);
}
else
{
LinkIterator anOffset = std::partition (theStart, theFinal, BitPredicate (theDigit));
tbb::parallel_invoke (Functor (theStart, anOffset, theDigit - 1),
Functor (anOffset, theFinal, theDigit - 1));
}
#else
BVH::RadixSorter::perform (theStart, theFinal, theDigit);
#endif
}
protected:
// Performs MSD (most significant digit) radix sort.
static void perform (LinkIterator theStart, LinkIterator theFinal, Standard_Integer theBit = 29)
{
while (theStart != theFinal && theBit >= 0)
{
LinkIterator anOffset = std::partition (theStart, theFinal, BitPredicate (theBit--));
perform (theStart, anOffset, theBit);
theStart = anOffset;
}
}
};
}
// =======================================================================
// function : Perform
// purpose :
// =======================================================================
template<class T, int N>
void BVH_RadixSorter<T, N>::Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal)
{
Standard_STATIC_ASSERT (N == 3 || N == 4);
const Standard_Integer aDimensionX = 1024;
const Standard_Integer aDimensionY = 1024;
const Standard_Integer aDimensionZ = 1024;
const BVH_VecNt aSceneMin = myBox.CornerMin();
const BVH_VecNt aSceneMax = myBox.CornerMax();
const T aReverseSizeX = static_cast<T> (aDimensionX) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.x() - aSceneMin.x());
const T aReverseSizeY = static_cast<T> (aDimensionY) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.y() - aSceneMin.y());
const T aReverseSizeZ = static_cast<T> (aDimensionZ) / Max (static_cast<T> (BVH::THE_NODE_MIN_SIZE), aSceneMax.z() - aSceneMin.z());
myEncodedLinks = new NCollection_Array1<BVH_EncodedLink> (theStart, theFinal);
// Step 1 -- Assign Morton code to each primitive
for (Standard_Integer aPrimIdx = theStart; aPrimIdx <= theFinal; ++aPrimIdx)
{
const BVH_VecNt aCenter = theSet->Box (aPrimIdx).Center();
Standard_Integer aVoxelX = BVH::IntFloor ((aCenter.x() - aSceneMin.x()) * aReverseSizeX);
Standard_Integer aVoxelY = BVH::IntFloor ((aCenter.y() - aSceneMin.y()) * aReverseSizeY);
Standard_Integer aVoxelZ = BVH::IntFloor ((aCenter.z() - aSceneMin.z()) * aReverseSizeZ);
aVoxelX = Max (0, Min (aVoxelX, aDimensionX - 1));
aVoxelY = Max (0, Min (aVoxelY, aDimensionY - 1));
aVoxelZ = Max (0, Min (aVoxelZ, aDimensionZ - 1));
aVoxelX = (aVoxelX | (aVoxelX << 16)) & 0x030000FF;
aVoxelX = (aVoxelX | (aVoxelX << 8)) & 0x0300F00F;
aVoxelX = (aVoxelX | (aVoxelX << 4)) & 0x030C30C3;
aVoxelX = (aVoxelX | (aVoxelX << 2)) & 0x09249249;
aVoxelY = (aVoxelY | (aVoxelY << 16)) & 0x030000FF;
aVoxelY = (aVoxelY | (aVoxelY << 8)) & 0x0300F00F;
aVoxelY = (aVoxelY | (aVoxelY << 4)) & 0x030C30C3;
aVoxelY = (aVoxelY | (aVoxelY << 2)) & 0x09249249;
aVoxelZ = (aVoxelZ | (aVoxelZ << 16)) & 0x030000FF;
aVoxelZ = (aVoxelZ | (aVoxelZ << 8)) & 0x0300F00F;
aVoxelZ = (aVoxelZ | (aVoxelZ << 4)) & 0x030C30C3;
aVoxelZ = (aVoxelZ | (aVoxelZ << 2)) & 0x09249249;
myEncodedLinks->ChangeValue (aPrimIdx) = BVH_EncodedLink (
aVoxelX | (aVoxelY << 1) | (aVoxelZ << 2), aPrimIdx);
}
// Step 2 -- Sort primitives by their Morton codes using radix sort
BVH::RadixSorter::Sort (myEncodedLinks->begin(), myEncodedLinks->end(), 29);
NCollection_Array1<Standard_Integer> aLinkMap (theStart, theFinal);
for (Standard_Integer aLinkIdx = theStart; aLinkIdx <= theFinal; ++aLinkIdx)
{
aLinkMap (myEncodedLinks->Value (aLinkIdx).second) = aLinkIdx;
}
// Step 3 -- Rearranging primitive list according to Morton codes (in place)
Standard_Integer aPrimIdx = theStart;
while (aPrimIdx <= theFinal)
{
const Standard_Integer aSortIdx = aLinkMap (aPrimIdx);
if (aPrimIdx != aSortIdx)
{
theSet->Swap (aPrimIdx, aSortIdx);
std::swap (aLinkMap (aPrimIdx),
aLinkMap (aSortIdx));
}
else
{
++aPrimIdx;
}
}
}

View File

@@ -41,7 +41,8 @@ template<class T, int N>
BVH_Box<T, N> BVH_Set<T, N>::Box() const
{
BVH_Box<T, N> aBox;
for (Standard_Integer anIndex = 0; anIndex < Size(); ++anIndex)
const Standard_Integer aSize = Size();
for (Standard_Integer anIndex = 0; anIndex < aSize; ++anIndex)
{
aBox.Combine (Box (anIndex));
}

View File

@@ -18,24 +18,21 @@
#include <BVH_Set.hxx>
//! Performs centroid-based sorting of abstract set.
//! Tool object to sort abstract primitive set.
template<class T, int N>
class BVH_Sorter
{
public:
//! Sorts the set by centroids coordinates in specified axis.
static void Perform (BVH_Set<T, N>* theSet,
const Standard_Integer theAxis);
//! Releases resources of BVH sorter.
virtual ~BVH_Sorter() { }
//! Sorts the set by centroids coordinates in specified axis.
static void Perform (BVH_Set<T, N>* theSet,
const Standard_Integer theAxis,
const Standard_Integer theBegElement,
const Standard_Integer theEndElement);
//! Sorts the set.
virtual void Perform (BVH_Set<T, N>* theSet) = 0;
//! Sorts the given (inclusive) range in the set.
virtual void Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal) = 0;
};
#include <BVH_Sorter.lxx>
#endif // _BVH_Sorter_Header

View File

@@ -13,7 +13,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BVH_Sorter.hxx>
#include <BVH_QuickSorter.hxx>
#include <NCollection_Array1.hxx>
@@ -79,7 +79,7 @@ typename BVH_QueueBuilder<T, N>::BVH_ChildNodes BVH_SweepPlaneBuilder<T, N>::Bui
continue;
}
BVH_Sorter<T, N>::Perform (theSet, anAxis, aNodeBegPrimitive, aNodeEndPrimitive);
BVH_QuickSorter<T, N> (anAxis).Perform (theSet, aNodeBegPrimitive, aNodeEndPrimitive);
BVH_Box<T, N> aLftBox;
BVH_Box<T, N> aRghBox;
@@ -127,7 +127,7 @@ typename BVH_QueueBuilder<T, N>::BVH_ChildNodes BVH_SweepPlaneBuilder<T, N>::Bui
if (aMinSplitAxis != (N < 4 ? N - 1 : 2))
{
BVH_Sorter<T, N>::Perform (theSet, aMinSplitAxis, aNodeBegPrimitive, aNodeEndPrimitive);
BVH_QuickSorter<T, N> (aMinSplitAxis).Perform (theSet, aNodeBegPrimitive, aNodeEndPrimitive);
}
BVH_Box<T, N> aMinSplitBoxLft;

View File

@@ -29,7 +29,10 @@ BVH_QueueBuilder.lxx
BVH_Set.hxx
BVH_Set.lxx
BVH_Sorter.hxx
BVH_Sorter.lxx
BVH_QuickSorter.hxx
BVH_QuickSorter.lxx
BVH_RadixSorter.hxx
BVH_RadixSorter.lxx
BVH_SpatialMedianBuilder.hxx
BVH_SpatialMedianBuilder.lxx
BVH_SweepPlaneBuilder.hxx

View File

@@ -1332,8 +1332,11 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1389,8 +1392,12 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1457,8 +1464,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1525,8 +1534,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S2->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S1->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S2->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S1->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ) {
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}

View File

@@ -162,7 +162,7 @@ void Convert_CompBezierCurves2dToBSplineCurve2d::Perform()
myDegree = Max( myDegree, (mySequence(i))->Length() -1);
}
Standard_Real D1, D2, Lambda, Det=0;
Standard_Real Det=0;
gp_Pnt2d P1, P2, P3;
Standard_Integer Deg, Inc, MaxDegree = myDegree;
TColgp_Array1OfPnt2d Points(1, myDegree+1);
@@ -196,31 +196,25 @@ void Convert_CompBezierCurves2dToBSplineCurve2d::Perform()
P2 = Points(1);
P3 = Points(2);
gp_Vec2d V1(P1, P2), V2(P2, P3);
D1 = P1.SquareDistance(P2);
D2 = P3.SquareDistance(P2);
Lambda = Sqrt(D2/D1);
// Processing of the tangency between the Bezier and the previous.
// This allows guaranteeing at least continuity C1 if the tangents are coherent.
// Test of angle at myAngular
if (V1.Magnitude() > gp::Resolution() &&
V2.Magnitude() > gp::Resolution() &&
V1.IsParallel(V2, myAngular )) {
KnotsMultiplicities.Append(MaxDegree-1);
CurveKnVals(i) = CurveKnVals(i-1) * Lambda;
Det += CurveKnVals(i);
Standard_Real D1 = V1.SquareMagnitude();
Standard_Real D2 = V2.SquareMagnitude();
if (MaxDegree > 1 && //rln 20.06.99 work-around
D1 > gp::Resolution() && D2 > gp::Resolution() && V1.IsParallel(V2, myAngular ))
{
Standard_Real Lambda = Sqrt(D2/D1);
KnotsMultiplicities.Append(MaxDegree - 1);
CurveKnVals(i) = CurveKnVals(i - 1) * Lambda;
}
else {
CurveKnVals(i) = 1.0e0 ;
Det += CurveKnVals(i) ;
CurvePoles.Append(Points(1));
KnotsMultiplicities.Append(MaxDegree);
CurvePoles.Append(Points(1));
KnotsMultiplicities.Append(MaxDegree);
CurveKnVals(i) = 1.0;
}
Det += CurveKnVals(i);
// Store poles.
for (Standard_Integer j = 2 ; j <= MaxDegree ; j++) {

View File

@@ -51,9 +51,10 @@ void Convert_CompBezierCurvesToBSplineCurve::AddCurve
P1 = mySequence.Last()->Value(mySequence.Last()->Upper());
P2 = Poles(Poles.Lower());
// NYI
if ( !P1.IsEqual(P2,Precision::Confusion()))
cout << "Convert_CompBezierCurvesToBSplineCurve::Addcurve" << endl;;
#ifdef OCCT_DEBUG
if (!P1.IsEqual(P2, Precision::Confusion()))
cout << "Convert_CompBezierCurvesToBSplineCurve::Addcurve" << endl;
#endif
}
myDone = Standard_False;
Handle(TColgp_HArray1OfPnt) HPoles =
@@ -199,26 +200,26 @@ void Convert_CompBezierCurvesToBSplineCurve::Perform()
Standard_Real D1 = V1.SquareMagnitude();
Standard_Real D2 = V2.SquareMagnitude();
if (D1 > gp::Resolution() && D2 > gp::Resolution() && V1.IsParallel(V2, myAngular )) {
if (MaxDegree > 1 && //rln 20.06.99 work-around
D1 > gp::Resolution() && D2 > gp::Resolution() && V1.IsParallel(V2, myAngular ))
{
Standard_Real Lambda = Sqrt(D2/D1);
if(CurveKnVals(i-1) * Lambda > 10. * Epsilon(Det)) {
KnotsMultiplicities.Append(MaxDegree-1);
CurveKnVals(i) = CurveKnVals(i-1) * Lambda;
Det += CurveKnVals(i);
}
else {
CurvePoles.Append(Points(1));
KnotsMultiplicities.Append(MaxDegree);
CurveKnVals(i) = 1.0 ;
Det += CurveKnVals(i) ;
}
}
else {
CurvePoles.Append(Points(1));
KnotsMultiplicities.Append(MaxDegree);
CurveKnVals(i) = 1.0 ;
Det += CurveKnVals(i) ;
}
Det += CurveKnVals(i);
// Store the poles.
for (Standard_Integer j = 2 ; j <= MaxDegree ; j++) {

View File

@@ -543,21 +543,15 @@ proc checkprops {shape args} {
_check_args ${args} ${options} "checkprops"
if { ${length} != -1 || ${equal_check} == 1 } {
set CommandName lprops
set mass $length
set prop "length"
lappend CommandNames {lprops}
set equal_check 0
}
if { ${area} != -1 || ${equal_check} == 1 } {
set CommandName sprops
set mass $area
set prop "area"
lappend CommandNames {sprops}
set equal_check 0
}
if { ${volume} != -1 || ${equal_check} == 1 } {
set CommandName vprops
set mass $volume
set prop "volume"
lappend CommandNames {vprops}
set equal_check 0
}
@@ -565,41 +559,47 @@ proc checkprops {shape args} {
if { $skip } {
set skip_option "-skip"
}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
if { ${compared_equal_shape} != -1 } {
upvar ${compared_equal_shape} ${compared_equal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m != $m } {
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
foreach CommandName ${CommandNames} {
switch $CommandName {
"lprops" { set mass ${length}; set prop "length" }
"sprops" { set mass ${area}; set prop "area" }
"vprops" { set mass ${volume}; set prop "volume" }
}
}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
if { ${compared_notequal_shape} != -1 } {
upvar ${compared_notequal_shape} ${compared_notequal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m == $m } {
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
if { ${compared_equal_shape} != -1 } {
upvar ${compared_equal_shape} ${compared_equal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m != $m } {
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
}
}
}
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
if { [string compare "$mass" "empty"] != 0 } {
if { $m == 0 } {
puts "Error : The command is not valid. The $prop is 0."
if { ${compared_notequal_shape} != -1 } {
upvar ${compared_notequal_shape} ${compared_notequal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m == $m } {
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
}
if { $mass > 0 } {
puts "The expected $prop is $mass"
}
#check of change of area is < 1%
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
puts "Error : The $prop of result shape is $m"
}
} else {
if { $m != 0 } {
puts "Error : The command is not valid. The $prop is $m"
}
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
if { [string compare "$mass" "empty"] != 0 } {
if { $m == 0 } {
puts "Error : The command is not valid. The $prop is 0."
}
if { $mass > 0 } {
puts "The expected $prop is $mass"
}
#check of change of area is < 1%
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
puts "Error : The $prop of result shape is $m"
}
} else {
if { $m != 0 } {
puts "Error : The command is not valid. The $prop is $m"
}
}
}
}

View File

@@ -1428,7 +1428,7 @@ proc _html_color {status} {
if { $status == "OK" } {
return lightgreen
} elseif { [regexp -nocase {^FAIL} $status] } {
return red
return ff8080
} elseif { [regexp -nocase {^BAD} $status] } {
return yellow
} elseif { [regexp -nocase {^IMP} $status] } {
@@ -1976,7 +1976,7 @@ proc _log_html_diff {file log dir1 dir2 highlight_percent} {
# put a line; highlight considerable (> ${highlight_percent}%) deviations of CPU and memory
if { [regexp "\[\\\[](\[0-9.e+-]+)%\[\]]" $line res value] &&
[expr abs($value)] > ${highlight_percent} } {
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"red\" : \"lightgreen\"]\">$line</td></tr></table>"
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"ff8080\" : \"lightgreen\"]\">$line</td></tr></table>"
} else {
puts $fd $line
}

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