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

Compare commits

..

49 Commits

Author SHA1 Message Date
kgv
60952ca959 0027257: Visualization, TKOpenGl - bind integer vertex attributes 2016-03-14 13:05:36 +03:00
abv
d3013f55a0 0027206: Inconsistent and obsolete information in persistence documentation and Release Notes
Technical docs are reviewed to:
* update references to page with third-party products
* update description of persistence, handles, and RTTI according to changes in OCCT 7.0
* remove references to CDL, WOK, and WOK-generated stuff
* update the list of environment variables
2016-03-04 15:03:05 +03:00
bugmaster
71b471d7b8 Incrementation OCCT version up to 7.0.0 rc 2016-03-04 15:02:14 +03:00
ysn
1454243292 0027218: Add information about porting from earlier versions in update guide
Added:
- porting notes for earlier versions starting with 6.5;
- section about zoom persistent selection
2016-03-04 14:44:23 +03:00
abv
72c3745808 0027193: Describe building OCCT with genproj tool
Description of building OCCT with WOK and automake scripts is removed from documentation.
Use of genproj utility is described in pages on building with MSVC, Code::Blocks, and XCode projects.

New script genconf allows starting configuration GUI explicitly; dialog is slightly revised.
Script genproj.sh is renamed to genproj; permissions for scripts are corrected for Linux.

Script env.bat does not set anymore environment required for Products.
2016-03-04 14:44:22 +03:00
myn
ff205346c9 0026961: Recover possibility to read files in old persistence format
Possibility to read shapes and OCAF documents from old persistence format (Std and StdL schema) is restored.

Test cases used old persistent files on input are restored with suffix "_std"

Removing toolkit from OS package
2016-03-04 07:31:08 +03:00
duv
1d8656890c 0026571: Visualization, TKOpenGl - write depth values within RayTracing program
View-projection matrix was added to raytrace shaders (as uniform) in order to compute correct depth values for OpenGL.
For path tracing the additional depth buffer sampler was added to Display.fs program. It allows propagation of depth values from internal FBO to resulting FBO.
The old approach of mixing of OpenGL and ray-tracing graphics was kept in order to keep correct blending of transparent ray-traced objects with non-transparent OpenGL objects.
2016-03-04 07:31:07 +03:00
ysn
251a79847b 0027216: Review the documentation before the final release.
Some pre-release updates, reviewing and implementation of some adequate remarks from JMA:
- redundant chapters in IGES and STEP guides
- proofreading of recent insertions in Draw, and tests guides
- mathjax information
- data, version, addresses, system requirements in overview.md

Corrections
2016-03-04 07:31:06 +03:00
kgv
7c65581dd3 0027197: Configuration - fix compilation issues when using mingw
AIS_ColorScale, AIS_Dimension - the protected method DrawText()
has been renamed to drawText() to avoid name collisions with macros.

_MSC_VER/_WIN32 misuse has been fixed in several places.
Header <malloc.h> is now included where alloca() is used.
Draw_Window - dllimport flag has been dropped from inline methods.

TKernel - mandatory dependencies Winspool.lib and Psapi.lib
are now linked explicitly (instead of msvc-specific pragma syntax).

CMake scripts - the option -std=c++0x has been replaced by -std=gnu++0x
for mingw to allow extensions (like _wfopen() and others).
The minimum Windows version has been set to _WIN32_WINNT=0x0501.
Invalid options "-z defs" and "-lm" have been dropped for mingw.
Flag --export-all-symbols has been added to CMAKE_SHARED_LINKER_FLAGS
to workaround missing vtable symbols when using mingw.
FreeType is now linked explicitly on Windows.

Draw::Load() - "lib" suffix is now prepended on mingw as well.

Drop redundant declaration of _TINT from OSD_WNT_1.hxx.
NCollection_UtfString::FromLocale() - platform-specific code has been moved to .cxx file.
Draw_BasicCommands - fixed incorrect mingw64 version macros.

genproj, cbp - added workaround for process argument list limits on Windows.
TKSTEP linkage is failing on this platform due to too long list of files.
The list of object files to link is now stored in dedicated file which is passed to gcc.

Option "-z defs" removed from CMake linker options to avoid problems when building with different configurations of VTK on Linux

Some MinGW-specific compiler warnings (potentially uninitialized vars, use of NULL, parentheses in conditional expressions) are fixed (speculatively)
2016-03-04 07:31:05 +03:00
kgv
8582eb08cc 0027198: OSD_Environment - use wide characters API on Windows 2016-03-04 07:31:04 +03:00
gka
5df609e75d 0026827: Position and orientation for GD&T frames
Implementation of graphical annotations of the PMI read from STEP
2016-03-04 07:30:38 +03:00
abv
cb72870231 0027196: CMake - avoid setting option -EHa for compilers other than MSVC
Option -EHa is now added only if MSVC is defined.

Descriptions of option -fp:precise in CMake and method OSD::SetSignal() in header file are updated.
2016-03-03 14:17:22 +03:00
vpa
114b7bf18f 0027180: Visualization - improve selection logic of MeshVS_Mesh
MeshVS_Mesh selection logic in MeshVS_SMF_Mesh mode (entire mesh) has been optimized.
MeshVS_Mesh::ComputeSelection() now creates single sensitive entity
MeshVS_CommonSensitiveEntity (new class) instead of small sensitive entity on each element.
MeshVS_SensitiveQuad (new class) and Select3D_SensitiveTriangle are used instead of Select3D_SensitiveFace for local selection to reduce memory consumption when possible.
2016-03-03 14:17:17 +03:00
jgv
bd5160a5fa 0027207: New universal method for extracting of results of work of HLRBRep_Algo algorithm
New method HLRBRep_HLRToShape::CompoundOfEdges with options:
- type of resulting edge
- visibility
- 3d/2d
has been added.

Minor correction of comments
2016-03-03 14:17:11 +03:00
kgv
4a535d3fd6 0026969: Visualization - support custom vertex attributes in GLSL program
Graphic3d_TypeOfData - added Graphic3d_TOD_FLOAT for passing single-float vertex attributes.
Graphic3d_TOA_CUSTOM - changed value to increase the range for custom vertex attributes locations (to fit into hardware limits).
Graphic3d_ShaderProgram::SetVertexAttributes() - introduced API for defining custom vertex attributes.

For compatibility with automated wrappers:
- Graphic3d_Buffer::Init() - added prototype taking NCollection_Array1<Graphic3d_Attribute> instead of C array
- Graphic3d_IndexBuffer::InitInt32() - added typed initialization method.
- Graphic3d_ShaderProgram::PushVariableVec3() and others - added typed methods to push uniform varibales.
2016-03-03 14:17:06 +03:00
Benjamin Bihler
9d55d9b0be 0027208: Show method in Message_ProgressIndicator::NewScope should not be commented out
Undone commenting out of Show method
2016-03-03 14:17:02 +03:00
abv
b508cbc59f 0026338: STL export (especially binary) needs a lot of time if selected export path is not local
Method StlAPI_Writer::Write() is reimplemented to write triangulation directly, without conversion to StlMesh_Mesh.

New DRAW command "tessellate" is added to generate rapidly triangulation of prescribed size (on surface).

Command "tricheck" is protected to deal correctly with triangulation without UV data.

New tests added: perf de bug26338_1 and _2; bugs stlvrml bug26338

Correction of testing environment
2016-03-03 14:16:57 +03:00
bugmaster
6396eacb4f 0024665: A sample for advanced function mechanism
Update for Linux platform
2016-02-25 17:08:20 +03:00
bugmaster
c19f09e973 Correction misprinting 2016-02-21 08:39:14 +03:00
aml
db2a696d96 0027135: Incorrect result of the normal projection algorithm
New check for possible local traps was added to build correct projection cache.
2016-02-20 19:13:11 +03:00
apn
c2c9890c68 0027152: Undefined symbols in library TKernel.so using clang compiler
Added ldl dependency for TKernel only (other toolkits were checked, no undefined symbols)
Added  option "-z defs" for linking on Linux
Added lm dependency for all toolkits
2016-02-20 18:43:49 +03:00
oan
aff123698b 0024594: Missing surfaces from STL output (second example)
Added test case
Small corrections of test case
2016-02-20 18:43:48 +03:00
jgv
0285a40010 0027159: Section between two faces is lost
Minor correction of test case

Another small correction of test case

One more correction of test case
2016-02-20 18:43:47 +03:00
ysn
dcb359e0ad 0027177: Review of recent additions in tests.md
Document corrected, warnings fixed.
2016-02-20 18:43:46 +03:00
oan
746f1ceb10 0025045: STEP Import fails to find all surfaces
Added test case
Small corrections in test case
2016-02-20 18:43:45 +03:00
oan
183acc2f10 0024593: Missing surfaces from STL output
Added test cases
Small corrections of test cases
2016-02-20 18:43:44 +03:00
jgv
3bfd1ba8f2 0026985: Wrong section between two faces: it has a gap 2016-02-20 13:04:34 +03:00
ibs
c1425a3f51 0027138: Configuration, Cmake - incorrect binaries installation path for single generators
specify a path for toolkit shared library
2016-02-20 13:04:33 +03:00
nbv
3906794761 0027035: General fuse algorithm loses face
The main reason of the bug is incorrect check, if the edge is seam-edge or not.
In the fix it is determined with new methods in GeomLib class.

The bug is fixed.

Creation of test case for this fix

Small correction in the code
2016-02-20 13:04:32 +03:00
vro
aff5997de8 0024665: A sample for advanced function mechanism
PRO file is added + a description of how to generate the Visual Studio projects and compile.
In addition, the sample folder is renamed to FuncDemo.

Adding 64 bit configuration to VC projects
2016-02-20 13:04:31 +03:00
vpa
a7d4dd9489 0026231: Visualization - Update description of selection algorithm in the user's guide
- updated description of selection mechanism in sections occt_visu_2_2, occt_visu_3_2_4 and occt_visu_3_6;
- unnecessary images were removed.

New Selection section  reviewed.

Semantic corrections
2016-02-20 13:04:30 +03:00
abv
a9dde4a31b 0027104: DownCast() cannot return null for mismatched handle
Method DownCast() is made template, to be available only when argument is actually a pointer or handle to a base class.

For compatibility with existing code, method DownCast() that can be used for the same type, derived, or unrelated class (i.e. where there is no actual down casting) is still available, its use shall cause "deprecated" compiler warning.

OCCT code is updated to remove meaningless DownCast()s; a few places where DownCast() was used with argument of unrelated type are corrected.

DRAW command QAHandleCast is removed (it was useful only during redesign of handles).
2016-02-20 10:10:15 +03:00
abv
5d351a0822 0026549: Provide move constructors and operators for basic classes
Move constructor and operator added for opencascade::handle<>
2016-02-20 10:10:13 +03:00
abv
4796758e8d 0027111: Add generalized copy constructor in handle class for old compilers
Copy constructor and assignment operator from handle of derived type is added in handle class.
They are enabled only if macro OCC_HANDLE_NOCASTS is defined, and operators of cast of handle to reference to handle to base type are disabled in that case.

Useless type casts to handle to base type are removed in GC and GCE2d classes.
Code returning reference to handle from function is corrected to return it either by value or as reference to handle of actual type.
2016-02-20 10:10:12 +03:00
abv
aa00364da7 0026377: Passing Handle objects as arguments to functions as non-const reference to base type is dangerous
Operator of cast to non-const reference is declared deprecated to produce compiler warning if used (usually implicitly).

OCCT code is updated to avoid that cast, occurring when function accepting non-const reference to handle is called with handle to derived type.
For that, local variable of argument type is passed instead, and down-cast is used to get it to desired type after the call.
A few occurrences of use of uninitialized variable are corrected.
2016-02-20 10:10:11 +03:00
kgv
fe9b8ff2f2 0027118: Configuration - do not suppress deprecation warnings when using msvc
Patch removes option -wd4996 from VS project settings (which suppresses old deprecation warnings).
Instead, macros _CRT_SECURE_NO_WARNINGS (suppresses 444 warnings) and _CRT_NONSTDC_NO_DEPRECATE (suppresses 17 warnings) have been added.

Deprecation warning on GetVersionEx() has been suppressed locally in OSD_Host.cxx.
In STEPConstruct_AP203Context.cxx, OSD_Host is used instead of low-level system functions.
This eliminates dependency of TKSTEP on winsock32.lib on Windows.
2016-02-20 10:10:10 +03:00
kgv
8ddd25b887 0027113: Coding - add macros Standard_DEPRECATED for marking deprecated functionality
Macro Standard_DEPRECATED("message") can be used in declarations to mark a method deprecated and generate compiler warning when it is used.
If OCCT_NO_DEPRECATED is defined, Standard_DEPRECATED is disabled (defined empty).
2016-02-20 10:10:09 +03:00
abv
84eca96b9d 0027107: ShapeAnalysis_Surface should use GeomAdaptor_Surface for surface evaluation
ShapeAnalysis_Surface is improved to use adaptor for evaluation of points on a surface.
Useless field myExtSur is removed.
DE tests are amended according to induced changes (number of edges varied).
2016-02-20 10:10:07 +03:00
oan
99c008e90f 0026384: Add explicit check for null magnitude instead of catching of exception in BRepMesh_FastDiscretFace::control()
Check normal for null magnitude using gp::Resolution ()
2016-02-20 10:10:06 +03:00
aml
1907fb9a74 0027131: [Regression to 6.7] DistShapeShape performance loss
Lipchitz constant approximation and fixes in global optimization algorithm added to improve performance.
Test case added.

Possibility to freeze Lipchitz constant is added to improve performance.
2016-02-20 10:10:05 +03:00
abv
290f0085d4 0027156: Doxygen warnings on overview docs
Documentation corrected to avoid Doxygen warnings
2016-02-20 10:10:04 +03:00
aml
92a206a3dd 0027162: Draw command "(2d)extrema" incorrectly represent underlying algorithm results
Correct handling of infinity solutions added for Curve / Curve case.
Unused code deleted.
Test cases updated to the new behavior.
2016-02-20 10:10:03 +03:00
kgv
6273fa4b6c 0027172: Visualization - avoid signed integer overflow within Graphic3d_ArrayOfPrimitives 2016-02-20 10:10:02 +03:00
apn
85b47ba49b 0023202: BRepMesh of face fails
Added test case bugs/mesh/bug23202
2016-02-20 10:10:01 +03:00
oan
660b601edd 0026692: BRepMesh hangs on the attached shape due to tessellation points produced out of surface range
BRepMesh_EdgeTessellator: do not use points out of face range and edge tolerance.

Test cases for issue CR26692
2016-02-20 10:10:00 +03:00
abv
451c4a3a57 0026941: Building on Windows with VC14 - debug info is generated for Release build
Generation of debug info is explicitly disabled on link step in templates of Visual Studio 10+ project files used by genproj, to avoid relying on default settings of Visual Studio.
2016-02-20 10:09:59 +03:00
kgv
c10c6ccdbf 0027086: Samples, jniviewer - avoid duplicating viewer redraws 2016-02-20 10:09:57 +03:00
kgv
2674244cde 0026939: Configuration, NCollection_UBTreeFiller - do not use _REENTRANT in a header file
Use std::mt19937 random number generator instead of rand() in NCollection_UBTreeFiller.

boolean gdml_private ZI7 ZJ7 - TODO "bopcheck failed" is only for Linux now, checkshape faulty is unstable (issue #27052)
boolean volumemaker B6 - Added TODO (bopcheck and checkshape faulties)
boolean volumemaker C9 - Added TODO (checkprops and checkshape faulties)
boolean volumemaker D2 - Added TODO (checkshape faulty)
boolean volumemaker H4 - Added TODO (checkprops and checkshape faulties Linux only)
boolean volumemaker D5 - IMVPROVEMENT, TODOs were deleted (bopcheck and checkshape faulties)
bugs modalg_1 buc60462_2 - modified TODOs according to new behavior
boolean gdml_private ZI7 ZJ7 - unstable case, added check for surface area and TODO

samples/tcl/ANC101.tcl - amended due to changed order of edges in BOP result
2016-02-20 10:09:42 +03:00
abv
9baa853415 Revert "0026314: Method SetShape working not correctly."
This reverts commit e2df45413e.
2016-02-17 12:33:27 +03:00
640 changed files with 19830 additions and 4194 deletions

0
LICENSE_LGPL_21.txt Executable file → Normal file
View File

View File

@@ -2,6 +2,6 @@ FoundationClasses TKernel TKMath
ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKShape FWOSPlugin TKTObj TKBinTObj TKXmlTObj TKVCAF
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd FWOSPlugin TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -244,9 +244,11 @@ n CDM
n FWOSDriver
n PCDM
n StdLDrivers
n StdLObject
n StdLPersistent
n StdObjMgt
n StdDrivers
n StdObject
n StdPersistent
n ShapePersistent
n TDF
@@ -279,7 +281,6 @@ t TKLCAF
t TKStdL
t TKStd
t TKShape
t TKTObj
t TKXml
t TKXmlL

View File

@@ -33,9 +33,23 @@ if (WIN32)
set (CSF_gdi32 "gdi32.lib")
set (CSF_user32 "user32.lib")
set (CSF_wsock32 "wsock32.lib")
set (CSF_winspool "Winspool.lib")
set (CSF_psapi "Psapi.lib")
set (CSF_AviLibs "ws2_32.lib vfw32.lib")
set (CSF_OpenGlLibs "opengl32.lib glu32.lib")
if (USE_FREETYPE)
set (CSF_FREETYPE "freetype.lib")
else()
set (CSF_FREETYPE)
endif()
if (USE_FREEIMAGE)
set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib")
else()
set (CSF_FreeImagePlus)
endif()
if (USE_TCL)
set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib")
set (CSF_TclTkLibs "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib")
@@ -77,6 +91,7 @@ else()
set (CSF_ThreadLibs "pthread rt stdc++")
set (CSF_OpenGlLibs "GLU GL")
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
if (USE_TCL)
set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}")

View File

@@ -5,6 +5,12 @@ if(FLAGS_ALREADY_INCLUDED)
endif()
set(FLAGS_ALREADY_INCLUDED 1)
# force option -fp:precise for Visual Studio projects.
#
# Note that while this option is default for MSVC compiler, Visual Studio
# project can be switched later to use Intel Compiler (ICC).
# Enforcing -fp:precise ensures that in such case ICC will use correct
# option instead of its default -fp:fast which is harmful for OCCT.
if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp:precise")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp:precise")
@@ -20,8 +26,7 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
if (WIN32)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4996")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd4996")
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
@@ -32,7 +37,7 @@ endif()
string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
if (ISFLAG)
string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
elseif (WIN32)
elseif (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
endif()
@@ -93,9 +98,25 @@ if (MSVC)
endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if (BUILD_SHARED_LIBS)
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
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 (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
if(MINGW)
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
add_definitions(-D_WIN32_WINNT=0x0501)
# workaround bugs in mingw with vtable export
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
@@ -106,4 +127,4 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
endif()
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")

View File

@@ -147,7 +147,10 @@ else()
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
if (DEFINED INSTALL_LIB_DIR)
install (TARGETS ${PROJECT_NAME} DESTINATION "${INSTALL_LIB_DIR}")
install (TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}")
else()
install (TARGETS ${PROJECT_NAME}
CONFIGURATIONS Release

View File

@@ -363,7 +363,7 @@ proc wokdep:gui:Show64Bitness { theRowIter } {
}
# Header
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 80 5}
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 30
ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6
entry .myFrame.myVcEntry -textvariable VCVER -width 6
@@ -371,12 +371,11 @@ entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
#
ttk::label .myFrame.myHxxChecks.myOcctBuildLbl -text "OCCT headers configuration" -relief solid -padding {5 5 80 5}
checkbutton .myFrame.myHxxChecks.myScutsCheck -offvalue "false" -onvalue "true" -variable SHORTCUT_HEADERS
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Short-cut headers instead original ones in inc"
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Create short-cuts to headers in inc folder instead of copying"
#
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
entry .myFrame.mySrchEntry -textvariable PRODUCTS_PATH -width 80
ttk::button .myFrame.mySrchBrowseBtn -text "Browse" -command wokdep:gui:BrowsePartiesRoot
checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true" -variable HAVE_FREEIMAGE -command wokdep:gui:UpdateList
@@ -397,7 +396,7 @@ checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myJDKLbl -text "Search JDK"
# Additional headers search paths
ttk::label .myFrame.myIncLbl -text "Additional headers search paths" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myIncLbl -text "Additional headers search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myIncScrl -command ".myFrame.myIncList yview"
listbox .myFrame.myIncList -listvariable CSF_OPT_INC -width 80 -height 5 -yscrollcommand ".myFrame.myIncScrl set"
ttk::button .myFrame.myIncAdd -text "Add" -command wokdep:gui:AddIncPath
@@ -407,7 +406,7 @@ ttk::button .myFrame.myIncClear -text "Reset" -command wokdep:gui:ResetIncP
ttk::label .myFrame.myIncErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (32-bit) search paths
ttk::label .myFrame.myLib32Lbl -text "Additional libraries (32-bit) search paths" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myLib32Lbl -text "Additional libraries (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib32Scrl -command ".myFrame.myLib32List yview"
listbox .myFrame.myLib32List -listvariable CSF_OPT_LIB32 -width 80 -height 5 -yscrollcommand ".myFrame.myLib32Scrl set"
ttk::button .myFrame.myLib32Add -text "Add" -command wokdep:gui:AddLib32Path
@@ -417,7 +416,7 @@ ttk::button .myFrame.myLib32Clear -text "Reset" -command wokdep:gui:ResetLi
ttk::label .myFrame.myLib32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (64-bit) search paths
ttk::label .myFrame.myLib64Lbl -text "Additional libraries (64-bit) search paths" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myLib64Lbl -text "Additional libraries (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib64Scrl -command ".myFrame.myLib64List yview"
listbox .myFrame.myLib64List -listvariable CSF_OPT_LIB64 -width 80 -height 5 -yscrollcommand ".myFrame.myLib64Scrl set"
ttk::button .myFrame.myLib64Add -text "Add" -command wokdep:gui:AddLib64Path
@@ -427,7 +426,7 @@ ttk::button .myFrame.myLib64Clear -text "Reset" -command wokdep:gui:ResetLi
ttk::label .myFrame.myLib64ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (32-bit) search paths
ttk::label .myFrame.myBin32Lbl -text "Additional executables (32-bit) search paths" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myBin32Lbl -text "Additional executables (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin32Scrl -command ".myFrame.myBin32List yview"
listbox .myFrame.myBin32List -listvariable CSF_OPT_BIN32 -width 80 -height 5 -yscrollcommand ".myFrame.myBin32Scrl set"
ttk::button .myFrame.myBin32Add -text "Add" -command wokdep:gui:AddBin32Path
@@ -437,7 +436,7 @@ ttk::button .myFrame.myBin32Clear -text "Reset" -command wokdep:gui:ResetBi
ttk::label .myFrame.myBin32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (64-bit) search paths
ttk::label .myFrame.myBin64Lbl -text "Additional executables (64-bit) search paths" -relief solid -padding {5 5 80 5}
ttk::label .myFrame.myBin64Lbl -text "Additional executables (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin64Scrl -command ".myFrame.myBin64List yview"
listbox .myFrame.myBin64List -listvariable CSF_OPT_BIN64 -width 80 -height 5 -yscrollcommand ".myFrame.myBin64Scrl set"
ttk::button .myFrame.myBin64Add -text "Add" -command wokdep:gui:AddBin64Path
@@ -466,9 +465,8 @@ if { "$tcl_platform(platform)" == "windows" } {
#
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myHxxChecks.myOcctBuildLbl -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 1
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 2
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
incr aRowIter
#
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w

View File

@@ -128,6 +128,7 @@ proc genproj { args } {
# Setting default IDE.
set anTarget ""
set aCmpl "gcc"
switch -exact -- "$targetStation" {
"wnt" {set anTarget "$::env(VCVER)"}
"lin" {set anTarget "cbp"}
@@ -215,7 +216,7 @@ proc genproj { args } {
set anAdmPath "$path/adm"
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform"
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl"
genprojbat "$anTarget"
}
@@ -260,7 +261,10 @@ proc genprojbat {theIDE} {
file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else {
switch -exact -- "$theIDE" {
"cbp" { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" }
"cbp" {
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh"
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat"
}
"xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
}
}
@@ -279,7 +283,12 @@ set aTKNullKey "TKNull"
set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
# Entry function to generate project files and solutions for IDE
proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
# @param theOutDir Root directory for project files
# @param theIDE IDE code name (vc10 for Visual Studio 2010, cbp for Code::Blocks, xcd for XCode)
# @param theLibType Library type - dynamic or static
# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
# @param theCmpl Compiler option (msvc or gcc)
proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
global path targetStation
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
@@ -352,7 +361,7 @@ proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform "
"vc11" -
"vc12" -
"vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution }
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
@@ -1076,6 +1085,8 @@ proc osutils:tk:csfInExternlib { EXTERNLIB } {
return $lret
}
# Collect dependencies map depending on target OS (libraries for CSF_ codenames used in EXTERNLIB) .
# @param theOS - target OS
# @param theCsfLibsMap - libraries map
# @param theCsfFrmsMap - frameworks map, OS X specific
proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
@@ -1085,60 +1096,75 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
unset theCsfLibsMap
unset theCsfFrmsMap
set aLibsMap(CSF_FREETYPE) "freetype"
set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "tk8.6"
if { "$::HAVE_FREEIMAGE" == "true" } {
if { "$theOS" == "wnt" } {
set aLibsMap(CSF_FreeImagePlus) "FreeImage FreeImagePlus"
} else {
set aLibsMap(CSF_FreeImagePlus) "freeimage"
}
}
if { "$::HAVE_GL2PS" == "true" } {
set aLibsMap(CSF_GL2PS) "gl2ps"
}
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}
if { "$::HAVE_VTK" == "true" } {
if { "$theOS" == "wnt" } {
set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
} else {
set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
}
}
if { "$theOS" == "wnt" } {
# WinAPI libraries
set aLibsMap(CSF_kernel32) "kernel32.lib"
set aLibsMap(CSF_advapi32) "advapi32.lib"
set aLibsMap(CSF_gdi32) "gdi32.lib"
set aLibsMap(CSF_user32) "user32.lib"
set aLibsMap(CSF_opengl32) "opengl32.lib"
set aLibsMap(CSF_wsock32) "wsock32.lib"
set aLibsMap(CSF_netapi32) "netapi32.lib"
set aLibsMap(CSF_AviLibs) "ws2_32.lib vfw32.lib"
set aLibsMap(CSF_OpenGlLibs) "opengl32.lib"
set aLibsMap(CSF_kernel32) "kernel32"
set aLibsMap(CSF_advapi32) "advapi32"
set aLibsMap(CSF_gdi32) "gdi32"
set aLibsMap(CSF_user32) "user32 comdlg32"
set aLibsMap(CSF_opengl32) "opengl32"
set aLibsMap(CSF_wsock32) "wsock32"
set aLibsMap(CSF_netapi32) "netapi32"
set aLibsMap(CSF_AviLibs) "ws2_32 vfw32"
set aLibsMap(CSF_OpenGlLibs) "opengl32"
set aLibsMap(CSF_winspool) "Winspool"
set aLibsMap(CSF_psapi) "Psapi"
set aLibsMap(CSF_d3d9) "d3d9"
set aLibsMap(CSF_QT) "QtCore4.lib QtGui4.lib"
# the naming is different on Windows
set aLibsMap(CSF_TclLibs) "tcl86"
set aLibsMap(CSF_TclTkLibs) "tk86"
# VTK
set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
set aLibsMap(CSF_QT) "QtCore4 QtGui4"
# tbb headers define different pragma lib depending on debug/release
set aLibsMap(CSF_TBB) ""
} else {
set aLibsMap(CSF_FREETYPE) "freetype"
if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "Appkit"
set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl"
set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk"
set aLibsMap(CSF_TclTkLibs) ""
} else {
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part og libc on QNX
# CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "tk8.6"
} else {
set aLibsMap(CSF_ThreadLibs) "pthread rt"
set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_MotifLibs) "X11"
}
}
# optional 3rd-parties
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}
if { "$::HAVE_FREEIMAGE" == "true" } {
set aLibsMap(CSF_FreeImagePlus) "freeimage"
}
if { "$::HAVE_GL2PS" == "true" } {
set aLibsMap(CSF_GL2PS) "gl2ps"
}
if { "$::HAVE_VTK" == "true" } {
set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
}
}
}
@@ -1146,12 +1172,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
proc osutils:vtkCsf {{theOS ""}} {
set aVtkVer "6.1"
set aLibSuffix ""
set aPathSplitter ":"
if {"$theOS" == "wnt"} {
set aPathSplitter ";"
set aLibSuffix ".lib"
}
set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"]
@@ -1167,7 +1190,7 @@ proc osutils:vtkCsf {{theOS ""}} {
# Additional suffices for the libraries
set anIdx 0
foreach anItem $aLibArray {
lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix
lset aLibArray $anIdx $anItem-$aVtkVer
incr anIdx
}
@@ -1449,24 +1472,26 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
}
regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
set aCommonUsedTK [list]
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] {
lappend aCommonUsedTK "${tkx}.lib"
lappend aUsedLibs "${tkx}.lib"
}
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
set aUsedToolKits [concat $aCommonUsedTK $aLibs]
foreach aLibIter $aLibs {
lappend aUsedLibs "${aLibIter}.lib"
}
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
# and put this list to project file
#puts "$theToolKit requires $aUsedToolKits"
#puts "$theToolKit requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set aUsedToolKits [join $aUsedToolKits {;}]
set aUsedLibs [join $aUsedLibs {;}]
}
regsub -all -- {__TKDEP__} $theProjTmpl $aUsedToolKits theProjTmpl
regsub -all -- {__TKDEP__} $theProjTmpl $aUsedLibs theProjTmpl
set anIncPaths "..\\..\\..\\inc"
set aTKDefines ""
@@ -1666,23 +1691,25 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aCommonUsedTK [list]
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] {
lappend aCommonUsedTK "${tkx}.lib"
lappend aUsedLibs "${tkx}.lib"
}
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
set aUsedToolKits [concat $aCommonUsedTK $aLibs]
foreach aLibIter $aLibs {
lappend aUsedLibs "${aLibIter}.lib"
}
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
# puts "$aProjName requires $aUsedToolKits"
# puts "$aProjName requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set aUsedToolKits [join $aUsedToolKits {;}]
set aUsedLibs [join $aUsedLibs {;}]
}
regsub -all -- {__TKDEP__} $aProjTmpl $aUsedToolKits aProjTmpl
regsub -all -- {__TKDEP__} $aProjTmpl $aUsedLibs aProjTmpl
set aFilesSection ""
set aVcFilesX(units) ""
@@ -1848,13 +1875,13 @@ proc osutils:justunix { listloc } {
####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files
proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } {
puts stderr "Generating project files for Code Blocks"
# Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules {
OS:cworkspace $aModule $aModule $theOutDir
OS:cbp $aModule $theOutDir
OS:cworkspace $aModule $aModule $theOutDir
OS:cbp $theCmpl $aModule $theOutDir
}
# Generate single workspace "OCCT" containing projects from all modules
@@ -1866,30 +1893,69 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
}
# Generate Code Blocks projects
proc OS:cbp { theModules theOutDir } {
proc OS:cbp { theCmpl theModules theOutDir } {
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:cbptk $theOutDir $aToolKit ]
lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ]
}
foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:cbpx $theOutDir $anExecutable]
lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable]
}
}
return $aProjectFiles
}
# Generate Code::Blocks project file for ToolKit
proc osutils:cbptk { theOutDir theToolKit } {
set aUsedToolKits [list]
proc osutils:cbptk { theCmpl theOutDir theToolKit } {
set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
osutils:tkinfo "../../.." $theToolKit aUsedToolKits aFrameworks anIncPaths aTKDefines aTKSrcFiles
global path targetStation
set aWokStation "$targetStation"
return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines]
# collect list of referred libraries to link with
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
foreach tkx $aDepToolkits {
lappend aUsedLibs "${tkx}"
}
lappend anIncPaths "../../../inc"
set listloc [osutils:tk:units $theToolKit]
if { [llength $listloc] == 0 } {
set listloc $theToolKit
}
if { "$aWokStation" == "wnt" } {
set resultloc [osutils:justwnt $listloc]
} else {
set resultloc [osutils:justunix $listloc]
}
if [array exists written] { unset written }
foreach fxlo $resultloc {
set xlo $fxlo
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : more than one occurences for [file tail $aSrcFile]"
}
}
# macros for correct DLL exports
if { "$aWokStation" == "wnt" } {
lappend aTKDefines "__${xlo}_DLL"
}
}
return [osutils:cbp $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
}
# Generates Code Blocks workspace.
@@ -1962,7 +2028,7 @@ proc OS:cworkspace { theSolName theModules theOutDir } {
}
# Generate Code::Blocks project file for Executable
proc osutils:cbpx { theOutDir theToolKit } {
proc osutils:cbpx { theCmpl theOutDir theToolKit } {
global path targetStation
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)"
@@ -1970,21 +2036,22 @@ proc osutils:cbpx { theOutDir theToolKit } {
set aCbpFiles {}
foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] {
# collect list of referred libraries to link with
set aUsedToolKits [list]
set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
set aProjName [file rootname [file tail $aSrcFile]]
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedToolKits aFrameworks
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
set aDepToolkits [LibToLinkX $theToolKit $aProjName]
foreach tkx $aDepToolkits {
if {[_get_type $tkx] == "t"} {
lappend aUsedToolKits "${tkx}"
lappend aUsedLibs "${tkx}"
}
if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} {
lappend aUsedToolKits "${tkx}"
lappend aUsedLibs "${tkx}"
}
}
@@ -1997,7 +2064,7 @@ proc osutils:cbpx { theOutDir theToolKit } {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles $aSrcFile
lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : in cbp there are more than one occurences for [file tail $aSrcFile]"
}
@@ -2010,25 +2077,14 @@ proc osutils:cbpx { theOutDir theToolKit } {
# common include paths
lappend anIncPaths "../../../inc"
# extra macros
if { "$aWokStation" == "wnt" } {
lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
} else {
lappend aTKDefines "OCC_CONVERT_SIGNALS"
#lappend aTKDefines "_GNU_SOURCE=1"
}
lappend aCbpFiles [osutils:cbp $theOutDir $aProjName $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines $isExecutable]
lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
}
return $aCbpFiles
}
proc osutils:optinal_libs { } {
return [list tbb.lib tbbmalloc.lib FreeImage.lib FreeImagePlus.lib gl2ps.lib]
}
# This function intended to generate Code::Blocks project file
# @param theCmpl - the compiler (gcc or msvc)
# @param theOutDir - output directory to place project file
# @param theProjName - project name
# @param theSrcFiles - list of source files
@@ -2037,12 +2093,60 @@ proc osutils:optinal_libs { } {
# @param theIncPaths - header search paths
# @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target
proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
proc osutils:cbp { theCmpl theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
global targetStation
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)"
set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
set aCmplCbp "gcc"
set aCmplFlags [list]
set aCmplFlagsRelease [list]
set aCmplFlagsDebug [list]
set toPassArgsByFile 0
set aLibPrefix "lib"
if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } {
set toPassArgsByFile 1
}
if { "$theCmpl" == "msvc" } {
set aCmplCbp "msvc8"
set aLibPrefix ""
}
if { "$theCmpl" == "msvc" } {
set aCmplFlags "-arch:SSE2 -EHsc -W4 -MP"
set aCmplFlagsRelease "-MD -O2"
set aCmplFlagsDebug "-MDd -Od -Zi"
lappend aCmplFlags "-D_CRT_SECURE_NO_WARNINGS"
lappend aCmplFlags "-D_CRT_NONSTDC_NO_DEPRECATE"
} elseif { "$theCmpl" == "gcc" } {
if { "$aWokStation" != "qnx" } {
set aCmplFlags "-mmmx -msse -msse2 -mfpmath=sse"
}
set aCmplFlagsRelease "-O2"
set aCmplFlagsDebug "-O0 -g"
if { "$aWokStation" == "wnt" } {
lappend aCmplFlags "-std=gnu++0x"
lappend aCmplFlags "-D_WIN32_WINNT=0x0501"
} else {
lappend aCmplFlags "-std=c++0x"
lappend aCmplFlags "-fPIC"
lappend aCmplFlags "-DOCC_CONVERT_SIGNALS"
}
lappend aCmplFlags "-Wall"
lappend aCmplFlags "-fexceptions"
}
lappend aCmplFlagsRelease "-DNDEBUG"
lappend aCmplFlagsRelease "-DNo_Exception"
lappend aCmplFlagsDebug "-D_DEBUG"
if { "$aWokStation" == "qnx" } {
lappend aCmplFlags "-D_QNX_SOURCE"
}
set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
set aLnkFileName "${theProjName}_obj.link"
set aLnkDebFileName "${theProjName}_objd.link"
set aLnkFilePath "${theOutDir}/${aLnkFileName}"
set aLnkDebFilePath "${theOutDir}/${aLnkDebFileName}"
set aFile [open $aCbpFilePath "w"]
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
puts $aFile "<CodeBlocks_project_file>"
@@ -2050,11 +2154,7 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
puts $aFile "\t<Project>"
puts $aFile "\t\t<Option title=\"$theProjName\" />"
puts $aFile "\t\t<Option pch_mode=\"2\" />"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t<Build>"
# Release target configuration
@@ -2064,55 +2164,40 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t\t<Add option=\"-MD\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
} else {
puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
if { "$aWokStation" != "qnx" } {
puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
}
foreach aFlagIter $aCmplFlagsRelease {
puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-DNDEBUG\" />"
if { "$aWokStation" == "qnx" } {
puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-DNo_Exception\" />"
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
}
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/lib\" />"
if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
if { "$aWokStation" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
puts $aFile "\t\t\t\t</Linker>"
@@ -2126,56 +2211,40 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t\t<Add option=\"-MDd\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-Od\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-Zi\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
} else {
puts $aFile "\t\t\t\t\t<Add option=\"-O0\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-g\" />"
if { "$aWokStation" != "qnx" } {
puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
}
foreach aFlagIter $aCmplFlagsDebug {
puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-D_DEBUG\" />"
if { "$aWokStation" == "qnx" } {
puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-DDEB\" />"
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
}
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/libd\" />"
if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
if { "$aWokStation" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
puts $aFile "\t\t\t\t</Linker>"
@@ -2186,9 +2255,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
# COMMON compiler options
puts $aFile "\t\t<Compiler>"
puts $aFile "\t\t\t<Add option=\"-Wall\" />"
puts $aFile "\t\t\t<Add option=\"-fexceptions\" />"
puts $aFile "\t\t\t<Add option=\"-fPIC\" />"
foreach aFlagIter $aCmplFlags {
puts $aFile "\t\t\t<Add option=\"$aFlagIter\" />"
}
puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />"
foreach anIncPath $theIncPaths {
puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />"
@@ -2197,6 +2266,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
# COMMON linker options
puts $aFile "\t\t<Linker>"
if { "$aWokStation" == "wnt" && "$theCmpl" == "gcc" } {
puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
}
foreach aFrameworkName $theFrameworks {
if { "$aFrameworkName" != "" } {
puts $aFile "\t\t\t<Add option=\"-framework $aFrameworkName\" />"
@@ -2204,12 +2276,25 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
}
foreach aLibName $theLibsList {
if { "$aLibName" != "" } {
puts $aFile "\t\t\t<Add library=\"$aLibName\" />"
if { "$theCmpl" == "msvc" } {
puts $aFile "\t\t\t<Add library=\"${aLibName}.lib\" />"
} else {
puts $aFile "\t\t\t<Add library=\"${aLibName}\" />"
}
}
}
puts $aFile "\t\t</Linker>"
# list of sources
set aFileLnkObj ""
set aFileLnkObjd ""
set isFirstSrcFile 1
if { $toPassArgsByFile == 1 } {
set aFileLnkObj [open $aLnkFilePath "w"]
set aFileLnkObjd [open $aLnkDebFilePath "w"]
}
foreach aSrcFile $theSrcFiles {
if {[string equal -nocase [file extension $aSrcFile] ".mm"]} {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
@@ -2220,11 +2305,28 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option compilerVar=\"CC\" />"
puts $aFile "\t\t</Unit>"
} elseif { $toPassArgsByFile == 1 && $isFirstSrcFile == 0 && [string equal -nocase [file extension $aSrcFile] ".cxx" ] } {
# pass at list single source file to Code::Blocks as is
# and pack the list of other files into the dedicated file to workaround process arguments limits on systems like Windows
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option link=\"0\" />"
puts $aFile "\t\t</Unit>"
set aFileObj [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/obj/src/"] $aSrcFile]]
set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/objd/src/"] $aSrcFile]]
puts -nonewline $aFileLnkObj "$aFileObj "
puts -nonewline $aFileLnkObjd "$aFileObjd "
} else {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />"
set isFirstSrcFile 0
}
}
if { "$aWokStation" == "wnt" } {
close $aFileLnkObj
close $aFileLnkObjd
}
puts $aFile "\t</Project>"
puts $aFile "</CodeBlocks_project_file>"
close $aFile
@@ -2232,74 +2334,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
return $aCbpFilePath
}
# Auxiliary function to achieve complete information to build Toolkit
# @param theRelativePath - relative path to CASROOT
# @param theToolKit - Toolkit name
# @param theUsedLib - dependencies (libraries list)
# @param theFrameworks - dependencies (frameworks list, Mac OS X specific)
# @param theIncPaths - header search paths
# @param theTKDefines - compiler macro definitions
# @param theTKSrcFiles - list of source files
proc osutils:tkinfo { theRelativePath theToolKit theUsedLib theFrameworks theIncPaths theTKDefines theTKSrcFiles } {
global path targetStation
set aWokStation "$targetStation"
# collect list of referred libraries to link with
upvar $theUsedLib aUsedLibs
upvar $theFrameworks aFrameworks
upvar $theIncPaths anIncPaths
upvar $theTKDefines aTKDefines
upvar $theTKSrcFiles aTKSrcFiles
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
foreach tkx $aDepToolkits {
lappend aUsedLibs "${tkx}"
}
lappend anIncPaths "$theRelativePath/inc"
set listloc [osutils:tk:units $theToolKit]
if { [llength $listloc] == 0 } {
set listloc $theToolKit
}
if { "$aWokStation" == "wnt" } {
set resultloc [osutils:justwnt $listloc]
} else {
set resultloc [osutils:justunix $listloc]
}
if [array exists written] { unset written }
foreach fxlo $resultloc {
set xlo $fxlo
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles "${theRelativePath}/[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : more than one occurences for [file tail $aSrcFile]"
}
}
# macros for correct DLL exports
if { "$aWokStation" == "wnt" } {
lappend aTKDefines "__${xlo}_DLL"
}
# common include paths
# lappend anIncPaths "${theRelativePath}/src/${xlo}"
}
# extra macros
if { "$aWokStation" == "wnt" } {
lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
} else {
lappend aTKDefines "OCC_CONVERT_SIGNALS"
#lappend aTKDefines "_GNU_SOURCE=1"
}
}
# Define libraries to link using only EXTERNLIB file
proc LibToLinkX {thePackage theDummyName} {
set aToolKits [LibToLink $thePackage]
@@ -2431,7 +2465,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
upvar $theDepsRefGuids aDepsRefGuids
set aBuildFileSection ""
set aUsedToolKits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
set aUsedLibs [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
if { "$theTargetType" == "executable" } {
@@ -2449,9 +2483,9 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
}
osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
set aUsedToolKits [concat $aUsedToolKits $aLibs]
set aUsedToolKits [concat $aUsedToolKits $aFrameworks]
foreach tkx $aUsedToolKits {
set aUsedLibs [concat $aUsedLibs $aLibs]
set aUsedLibs [concat $aUsedLibs $aFrameworks]
foreach tkx $aUsedLibs {
set aDepLib "${tkx}_Dep"
set aDepLibRef "${tkx}_DepRef"

View File

@@ -0,0 +1,19 @@
@echo off
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
rem Define path to project file
set "PRJFILE=%~dp0\adm\wnt\cbp\OCCT.workspace"
if not exist "%PRJFILE%" set "PRJFILE=%~dp0\adm\wnt\cbp\Products.workspace"
if not "%4" == "" (
set "PRJFILE=%4"
)
if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe"
if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe"
set "CASBIN=wnt\cbp"
set "PATH=%~dp0%CASBIN%\bin%CASDEB%;%PATH%"
start "" "%CB_PATH%" "%PRJFILE%"

View File

@@ -11,10 +11,9 @@ set "SCRIPTROOT=%~dp0"
set "SCRIPTROOT=%SCRIPTROOT:~0,-1%"
rem ----- Reset values to defaults -----
set "CASROOT=__CASROOT__"
set "CASDEB="
set "VCVER=vc8"
set "ARCH=32"
set "VCVER=vc10"
set "ARCH=64"
set "VCVARS="
set "HAVE_TBB=false"
set "HAVE_OPENCL=false"
@@ -49,19 +48,14 @@ if /I ["%3"] == ["d"] set "CASDEB=d"
if /I ["%3"] == ["i"] set "CASDEB=i"
if /I ["%3"] == ["relwithdeb"] set "CASDEB=i"
set "CSF_OPT_INC=%CSF_OPT_INC%;%CASROOT%\inc"
set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\libd"
set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\libd"
set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bind"
set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bind"
set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\libi"
set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\libi"
set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bini"
set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bini"
set "CSF_OPT_LIB32=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\lib"
set "CSF_OPT_LIB64=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\lib"
set "CSF_OPT_BIN32=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bin"
set "CSF_OPT_BIN64=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bin"
set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%"
set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%"
set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%"
set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%"
set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%"
set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%"
set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%"
rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
set "CSF_OPT_CMPL="
@@ -150,9 +144,6 @@ if exist "%CASROOT%\src\DrawResources" (
set "DRAWHOME=%CASROOT%\src\DrawResources"
set "CSF_DrawPluginDefaults=%DRAWHOME%"
)
if exist "%SCRIPTROOT%\src\DrawResourcesProducts" (
set "CSF_DrawPluginProductsDefaults=%SCRIPTROOT%\src\DrawResourcesProducts"
)
goto :eof
:concatCmplInc
@@ -160,9 +151,13 @@ set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
goto :eof
:concatLib32
set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
set "OPT_LIB32=%OPT_LIB32% -L%1"
goto :eof
:concatLib64
set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
set "OPT_LIB64=%OPT_LIB64% -L%1"
goto :eof

View File

@@ -85,7 +85,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
<ResourceCompile>
@@ -107,6 +107,7 @@
<OutputFile>.\..\..\..\win32\__VCVER__\bin\__TKNAM__.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\lib;$(CSF_OPT_LIB32);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>No</GenerateDebugInformation>
<ProgramDatabaseFile>.\..\..\..\win32\__VCVER__\bin\__TKNAM__.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<ImportLibrary>..\..\..\win32\__VCVER__\lib\__TKNAM__.lib</ImportLibrary>
@@ -128,7 +129,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -138,7 +139,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
@@ -173,7 +174,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -183,7 +184,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>
<ResourceCompile>
@@ -195,6 +196,7 @@
<OutputFile>.\..\..\..\win64\__VCVER__\bin\__TKNAM__.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\lib;$(CSF_OPT_LIB64);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>No</GenerateDebugInformation>
<ProgramDatabaseFile>.\..\..\..\win64\__VCVER__\bin\__TKNAM__.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<ImportLibrary>..\..\..\win64\__VCVER__\lib\__TKNAM__.lib</ImportLibrary>
@@ -216,7 +218,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -226,7 +228,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>

View File

@@ -85,7 +85,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
<ResourceCompile>
@@ -106,6 +106,7 @@
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\lib;$(CSF_OPT_LIB32);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>No</GenerateDebugInformation>
<ProgramDatabaseFile>.\..\..\..\win32\__VCVER__\bin\__XQTNAM__.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<ImportLibrary>..\..\..\win32\__VCVER__\lib\__XQTNAM__.lib</ImportLibrary>
@@ -127,7 +128,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -137,7 +138,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
@@ -171,7 +172,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -181,7 +182,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>
<ResourceCompile>
@@ -192,6 +193,7 @@
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\lib;$(CSF_OPT_LIB64);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>No</GenerateDebugInformation>
<ProgramDatabaseFile>.\..\..\..\win64\__VCVER__\bin\__XQTNAM__.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<ImportLibrary>..\..\..\win64\__VCVER__\lib\__XQTNAM__.lib</ImportLibrary>
@@ -213,7 +215,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -223,7 +225,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>

View File

@@ -50,7 +50,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -62,7 +62,6 @@
ProgramDataBaseFileName=".\..\..\..\win32\vc8\obj\__TKNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
EnableEnhancedInstructionSet="2"
/>
<Tool
@@ -149,7 +148,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
InlineFunctionExpansion="1"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -163,7 +162,6 @@
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4996"
EnableEnhancedInstructionSet="2"
/>
<Tool
@@ -251,7 +249,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -263,7 +261,6 @@
ProgramDataBaseFileName=".\..\..\..\win64\vc8\obj\__TKNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -350,7 +347,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
InlineFunctionExpansion="1"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -364,7 +361,6 @@
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"

View File

@@ -49,7 +49,7 @@
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__;"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -60,7 +60,6 @@
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
EnableEnhancedInstructionSet="2"
/>
<Tool
@@ -146,7 +145,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__;"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__;"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -157,7 +156,6 @@
ProgramDataBaseFileName=".\..\..\..\win32\vc8\obj\__XQTNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
EnableEnhancedInstructionSet="2"
/>
<Tool
@@ -242,7 +240,7 @@
AdditionalOptions="/favor:blend"
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -253,7 +251,6 @@
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -340,7 +337,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -351,7 +348,6 @@
ProgramDataBaseFileName=".\..\..\..\win64\vc8\obj\__XQTNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"

View File

@@ -52,7 +52,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -65,7 +65,6 @@
ProgramDataBaseFileName=".\..\..\..\win32\vc9\obj\__TKNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -150,7 +149,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
InlineFunctionExpansion="1"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -165,7 +164,6 @@
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -248,7 +246,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -260,7 +258,6 @@
ProgramDataBaseFileName=".\..\..\..\win64\vc9\obj\__TKNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -343,7 +340,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
InlineFunctionExpansion="1"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -357,7 +354,6 @@
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"

View File

@@ -52,7 +52,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -64,7 +64,6 @@
ProgramDataBaseFileName=".\..\..\..\win32\vc9\obj\__XQTNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -144,7 +143,7 @@
AdditionalOptions="-MP"
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -156,7 +155,6 @@
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -238,7 +236,7 @@
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;No_Exception;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
@@ -249,7 +247,6 @@
ProgramDataBaseFileName=".\..\..\..\win64\vc9\obj\__XQTNAM__/"
WarningLevel="4"
SuppressStartupBanner="true"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -330,7 +327,7 @@
AdditionalOptions="-MP -favor:blend"
AdditionalIncludeDirectories="__TKINC__;$(CSF_OPT_INC)"
Optimization="0"
PreprocessorDefinitions="_DEBUG;$(CSF_DEFINES)__TKDEFS__"
PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES)__TKDEFS__"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -341,7 +338,6 @@
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"

View File

@@ -47,8 +47,6 @@ dev_guides/building/building.md
dev_guides/building/3rdparty/3rdparty_windows.md
dev_guides/building/3rdparty/3rdparty_linux.md
dev_guides/building/3rdparty/3rdparty_osx.md
dev_guides/building/wok/wok.md
dev_guides/building/automake.md
dev_guides/building/cmake/cmake.md
dev_guides/building/android/android.md
dev_guides/building/code_blocks.md

View File

@@ -10,7 +10,7 @@ products used by Open CASCADE Technology and samples on Linux platform.
The links for downloading the third-party products are available on the web site
of OPEN CASCADE SAS at
http://www.opencascade.org/getocc/require/.
http://www.opencascade.com/content/3rd-party-components.
There are two types of third-party products, which are necessary to build OCCT:

View File

@@ -8,8 +8,7 @@ This document presents additional guidelines for building third-party products
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
The links for downloading the third-party products are available
on the web site of OPEN CASCADE SAS at
http://www.opencascade.org/getocc/require/</a>.
on the web site of OPEN CASCADE SAS at http://www.opencascade.com/content/3rd-party-components.
There are two types of third-party products, which are necessary to build OCCT:

View File

@@ -8,7 +8,9 @@ This document presents guidelines for building third-party products used by Open
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of run-time binaries.
The links for downloading the third-party products are available on the web site of OPEN CASCADE SAS at http://www.opencascade.org/getocc/require/. There are two types of third-party products used by OCCT:
The links for downloading the third-party products are available on the web site of OPEN CASCADE SAS at http://www.opencascade.com/content/3rd-party-components.
There are two types of third-party products used by OCCT:
* Mandatory products:
* Tcl/Tk 8.5 -- 8.6;

View File

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -1,72 +0,0 @@
Building with Automake {#occt_dev_guides__building_automake}
======================
This file describes steps to build OCCT libraries from a complete source
archive on Linux with **Autotools** GNU build system.
If you build OCCT from bare sources (as in Git repository), or do some
changes affecting CDL files, you need to use WOK to re-generate header files
and build scripts / projects. See paragraph 1 \ref occt_dev_guides__building_wok for instructions.
Before building OCCT, you need to install the required third-party libraries; see paragraph 1 of
\ref occt_dev_guides__building for instructions.
Note that during compilation by makefiles on Linux station with
NVIDIA video card you may experience problems because the installation
procedure of NVIDIA video driver removes library *libGL.so* included in package
*libMesaGL* from directory <i>/usr/X11R6/lib</i> and places this library *libGL.so* in
directory <i>/usr/lib</i>. However, *libtool* expects to find the library in directory
<i>/usr/X11R6/lib</i>, which causes compilation crash (See <i>/usr/X11R6/lib/libGLU.la </i>).
To prevent this, it is suggested to make links:
ln -s /usr/lib/libGL.so /usr/X11R6/lib/libGL.so
ln -s /usr/lib/libGL.la /usr/X11R6/lib/libGL.la
1.In OCCT root folder, launch *build_configure* script to generate files *configure* and *Makefile.in* for your system.
2.Go to the directory, where OCCT will be built, and run *configure* to generate makefiles.
$CASROOT/configure \<FLAGS\>
Where <i> \<FLAGS\> </i> is a set of options.
The following flags are mandatory:
* <i> --with-tcl= </i> defines the location of *tclConfig.sh*;
* <i> --with-tk= </i> defines location of *tkConfig.sh*;
* <i> --with-freetype= </i> defines location of installed **FreeType** product
* <i> --prefix= </i> defines the location for installation of OCCT binaries
Additional flags:
* <i> --with-gl2ps= </i> defines the location of installed **gl2ps** product;
* <i> --with-freeimage= </i> defines the location of installed **FreeImage** product;
* <i> --with-tbb-include= </i> defines the location of *tbb.h*;
* <i> --with-tbb-library= </i> defines the location of *libtbb.so*;
* <i> --with-vtk-include= </i> defines the location of VTK includes;
* <i> --with-vtk-library= </i> defines the location of VTK libraries;
* <i> --enable-debug= yes: </i> includes debug information, no: does not include debug information;
* <i> --enable-production= yes: </i> switches code optimization, no: switches off code optimization;
* <i> --disable-draw </i> allows OCCT building without Draw.
If location of **FreeImage, TBB, gl2ps** or **VTK** is not specified, OCCT will be built without these optional libraries.
Attention: 64-bit platforms are detected automatically.
Example:
\> ./configure -prefix=/PRODUCTS/occt-6.5.5 --with-tcl=/PRODUCTS/tcltk-8.5.8/lib --with-tk=/PRODUCTS/tcltk-8.5.8/lib --with-freetype=/PRODUCTS/freetype-2.4.10 --with-gl2ps=/PRODUCTS/gl2ps-1.3.5 --with-freeimage=/PRODUCTS/freeimage-3.14.1 --with-tbb-include=/PRODUCTS/tbb30_018oss/include --with-tbb-library=/PRODUCTS/tbb30_018oss/lib/ia32/cc4.1.0_libc2.4_kernel2.6.16.21 --with-vtk-include=/PRODUCTS/VTK-6.1.0/include/vtk-6.1 -with-vtk-library=/PRODUCTS/ /VTK-6.1.0//lib
3.If configure exits successfully, you can build OCCT with *make* command.
\> make -j8 install
4.To start *DRAW*, launch
\> draw.sh

View File

@@ -1,25 +1,24 @@
Building OCCT from sources {#occt_dev_guides__building}
=========
In order to build OCCT libraries from these sources for use in your program,
you need to:
Before building OCCT, make sure to have all the required third-party libraries installed.
The list of required libraries depends on what OCCT modules will be used, and your preferences.
The typical minimum is **Freetype** (necessary for Visualization) and **Tcl/Tk** (for DRAW Test Harness).
See "Third-party libraries" section in \ref OCCT_OVW_SECTION_5 "Overview" for a full list.
1. Make sure you have all required third-party libraries installed (check
software requirements in \ref OCCT_OVW_SECTION_5 "Overview").
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from http://www.opencascade.com/content/3rd-party-components.
On Linux and OS X, it is recommended to use the version installed in the system natively.
See the following documents for short guide to installation of
third-party libraries on different platforms:
- \subpage occt_dev_guides__building_3rdparty_windows
- \subpage occt_dev_guides__building_3rdparty_linux
- \subpage occt_dev_guides__building_3rdparty_osx
You can also build third-party libraries from their sources:
* \subpage occt_dev_guides__building_3rdparty_windows
* \subpage occt_dev_guides__building_3rdparty_linux
* \subpage occt_dev_guides__building_3rdparty_osx
2. Build using your preferred build tool.
- \subpage occt_dev_guides__building_automake "Building on Linux with Autotools"
- \subpage occt_dev_guides__building_cmake "Building with CMake (cross-platform)"
- \subpage occt_dev_guides__building_android "Building with CMake for Android (cross-platform)"
- \subpage occt_dev_guides__building_code_blocks "Building on Mac OS X with Code::Blocks"
- \subpage occt_dev_guides__building_msvc "Building on Windows with MS Visual Studio"
- \subpage occt_dev_guides__building_xcode "Building on Mac OS X with Xcode"
Build OCCT using your preferred build tool.
* \subpage occt_dev_guides__building_cmake "Building with CMake (cross-platform)"
* \subpage occt_dev_guides__building_android "Building with CMake for Android (cross-platform)"
* \subpage occt_dev_guides__building_msvc "Building on Windows with MS Visual Studio projects"
* \subpage occt_dev_guides__building_code_blocks "Building on Mac OS X with Code::Blocks projects"
* \subpage occt_dev_guides__building_xcode "Building on Mac OS X with Xcode projects"
The current version of OCCT can be consulted in the file src/Standard/Standard_Version.hxx

View File

@@ -3,39 +3,23 @@ Building with CMake {#occt_dev_guides__building_cmake}
@tableofcontents
@section build_cmake_intro General
This article describes **CMake**-based build process which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. *OCCT requires CMake version 2.8.12 or later*.
**Note**: Comparing to the previous (6.x) releases of Open CASCADE Technology, OCCT 7.0 comes with a complete set of CMake scripts and projects, so that there is no need to use WOK anymore. Moreover, CMake gives you a powerful configuration tool which allows to control many aspects of OCCT deployment. At the same time this tool is quite intuitive which is a significant advantage over the legacy WOK utilities.
@note Comparing to the previous (6.x) releases of Open CASCADE Technology, OCCT 7.0 comes with a complete set of CMake scripts and projects, so that there is no need to use WOK anymore. Moreover, CMake gives you a powerful configuration tool which allows to control many aspects of OCCT deployment. At the same time this tool is quite intuitive which is a significant advantage over the legacy WOK utilities.
**Note**: We discuss the build procedure on example of Windows platform. However, the workflow is almost the same for *nix and Mac operating systems.
Here we describe the build procedure on example of Windows platform with Visual Studio 2010.
However, CMake is cross-platform and can be used to build OCCT on Linux and OS X in essentially the same way.
All the examples in the article will be based on Windows x64 platform and Visual Studio 2010 solution will be the target IDE. The solution will be generated by CMake from the OCCT sources, the one will be built by an user and ready-to-go OCCT binaries will be deployed into a user specified directory by building *INSTALL* project.
@note Before you start, make sure to have installed all the 3-rd party products that you are going to use with OCCT; see @ref occt_dev_guides__building.
You can get all the required 3-rd party products visiting [the official download page](http://www.opencascade.org/getocc/download/loadocc); see @ref occt_dev_guides__building for more detailed information also.
@section build_cmake_start Start CMake
## Get sources
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
The sources of OCCT can be obtained from [the official development web-site](http://dev.opencascade.org) by either downloading the universal source package (available at [the official download page](http://www.opencascade.org/getocc/download/loadocc)) or by cloning the Git repository:
git clone ssh://gitolite@git.dev.opencascade.org/occt occt
As a result, you obtain the following directory structure in your filesystem (d:\ name is used for example):
d:\occt\adm
\data
\dox
\samples
\src
\tests
...
The bare sources distribution contains not only the sources of Open CASCADE Technology, but also documentation, samples and non-regression test scripts.
## The usage of CMake
Now it is time to run a CMake tool which will generate the actual project files for the target IDE (e.g., Visual Studio 2010 solution).
It is recommended to use *cmake-gui* -- cross-platform GUI tool provided by CMake on Windows, Mac and Linux. As a command-line alternative, *ccmake* also can be used.
For unexpericnced users we recommend to start with *cmake-gui* -- cross-platform GUI tool provided by CMake on Windows, Mac and Linux.
A command-line alternative, *ccmake* also can be used.
CMake deals with three directories: source, build or binary and install.
@@ -43,9 +27,9 @@ CMake deals with three directories: source, build or binary and install.
* The build or binary directory is where all the files created during CMake configuration and generation process will be located. The mentioned process will be described below.
* The installation directory is where binaries will be installed after build the *INSTALL* project that is created by CMake generation process, along with header files and resources required for OCCT use in applications.
**Note**: It is possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type).
**Note**: The good practice is not to mix up different build configurations in a single directory and not to use the source directory as a build one, for example:
The good practice is not to use the source directory as a build one.
Different configurations should be built in different build directories to avoid conflicts.
It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example:
d:/occt/ -- the source directory
d:/tmp/occt-build-vc10-x64 -- the build directory with the generated
@@ -53,7 +37,7 @@ CMake deals with three directories: source, build or binary and install.
d:/occt-install -- the installation directory that is
able to contain several OCCT configuratoion
## Configuration process
@section build_cmake_conf Configuration process
If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory:
@@ -124,9 +108,9 @@ The following table enumerates the full list of environment variables used at co
**Note:** In those CMake options defining paths only the forward slashes ("/") are acceptable.
### 3rd party search mechanism (The variables with <i>3RDPARTY_</i> prefix)
@section build_cmake_3rdparty 3rd party search mechanism
If *3RDPARTY_DIR* directory is defined, required 3rd party binaries are sought in it, default system folders are ignored.
If *3RDPARTY_DIR* directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored.
The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*.
@@ -167,11 +151,11 @@ During the configuration process the related variables (*3RDPARTY_FREETYPE_DLL_D
**Note**: The names of searched libraries and header files are hard-coded. If there is the need to change their names, change appropriate cmake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration: *3RDPARTY_\<PRODUCT\>_INCLUDE* for include, *3RDPARTY_\<PRODUCT\>_LIB* for library and *3RDPARTY_\<PRODUCT\>_DLL* for shared library.
### OCCT Generation
@section build_cmake_gen Projects generation
Once the configuration process is done, "Generate" button is used to prepare project files for the target IDE. In our exercise the Visual Studio solution will be automatically created in the buid directory.
### OCCT Building
@section build_cmake_build Building
Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**.
@@ -185,7 +169,7 @@ When the building process is finished build:
For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer.
## Installation process
@section build_cmake_install Installation
Installation is a process of extracting redistributable resources (binaries,include files etc) from the build directory into the installation one. The installation directory will be free of project files, intermediate object files and any other information related to the build routines.

View File

@@ -1,70 +1,58 @@
Building with Code::Blocks on Mac OS X {#occt_dev_guides__building_code_blocks}
======================================
Building with Code::Blocks {#occt_dev_guides__building_code_blocks}
==========================
This file describes steps to build OCCT libraries from a complete source package
on Mac OS X with **Code::Blocks**.
@tableofcontents
If you build OCCT from bare sources (as in Git repository) or do some
changes affecting CDL files, you need to use WOK to re-generate header files
and build scripts / projects. See \ref occt_dev_guides__building_wok for instructions.
@section build_codeblocks_intro General
Before building OCCT, you need to install the required third-party libraries; see
paragraph 1 of \ref occt_dev_guides__building for details.
This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**.
It can be an alternative to use of CMake build system (see @ref occt_dev_guides__building_cmake) for all supported platforms.
1. Add paths to the mandatory 3rd-party products (**Tcl/Tk** and **FreeType**) in file
*custom.sh* located in <i>\<OCCT_ROOT_DIR\></i>. For this:
@section build_codeblocks_3rdparty Third-party libraries
1.1. Add paths to the includes in variable *CSF_OPT_INC*;
Before building OCCT, make sure to have all the needed third-party libraries installed, see @ref occt_dev_guides__building.
1.2. Add paths to the binary libraries in variable *CSF_OPT_LIB64*;
All paths should be separated by ":" symbol.
@section build_codeblocks_conf Configuration
2. Add paths to the optional 3rd-party libraries (**TBB, gl2ps** and **FreeImage**)
in the aforementioned environment variables *CSF_OPT_INC* and
*CSF_OPT_LIB64* from file *custom.sh*.
Before building it is necessary to set up build environment.
If you want to build OCCT without the optional libraries perform the
following steps:
The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited directly:
2.1 Disable unnecessary library in custom.sh by setting the corresponding
variable <i>HAVE_\<LIBRARY_NAME\></i> to *false*.
~~~~~
export HAVE_GL2PS=false
* 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*.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
~~~~~
2.2 Remove this library from Linker settings in **Code::Blocks** for each project
that uses it: right click on the required project, choose **Build options**,
go to **Linker settings** tab in the opened window , select unnecessary
libraries and click **Delete** button.
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:
3. Open Terminal application
@figure{/dev_guides/building/3rdparty/images/genconf_linux.png}
4. Enter <i> \<OCCT_ROOT_DIR\></i>:
Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
@section build_codeblocks_gen Projects generation
Launch **genproj** tool with option *-target=cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files:
~~~~~
cd \<OCCT_ROOT_DIR\>
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj.sh -target=cbp
~~~~~
5. To start **Code::Blocks**, run the command <i>/codeblocks.sh</i>
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.
6. To build all toolkits, click **Build->Build workspace** in the menu bar.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
@section build_codeblocks_build Building
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, perform
the following steps:
To start **Code::Blocks**, launch script *codeblocks.sh*.
1.Open Terminal application
To build all toolkits, click **Build->Build workspace** in the menu bar.
2.Enter <i>\<OCCT_ROOT_DIR\></i>:
~~~~~
cd \<OCCT_ROOT_DIR\>
~~~~~
3.Run the script
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~~
./draw_cbp.sh cbp [d]
~~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
Option *d* is used if OCCT has been built in **Debug** mode.

View File

@@ -1,35 +1,68 @@
Building with MS Visual C++ {#occt_dev_guides__building_msvc}
===========================
This file describes steps to build OCCT libraries from a complete source
archive on Windows with <b>MS Visual C++</b>.
@tableofcontents
If you build OCCT from bare sources (as in Git repository) or do some
changes affecting CDL files, you need to use WOK to re-generate header files
and build scripts / projects. See \ref occt_dev_guides__building_wok for instructions.
@section build_msvc_intro General
Before building OCCT, you need to install the required third-party libraries; see
paragraph 1 of \ref occt_dev_guides__building for instructions.
This page describes steps to build OCCT libraries from a complete source archive on Windows with <b>MS Visual C++</b> using projects generated by **genproj** tool.
It is an alternative to use of CMake build system (see @ref occt_dev_guides__building_cmake).
1. Edit file *custom.bat* to define the environment:
**genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code.Blocks, and XCode project files used for building Open CASCADE Technology.
These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
- *VCVER* -- version of Visual Studio (vc8, vc9, vc10, vc11 or vc12),
and relevant *VCVARS* path
- *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
- CSF_OPT_* -- paths to search for includes and binaries of all used
third-party products
The project files included in official distribution of OCCT are generated by this tool.
If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
2. Launch *msvc.bat* to start Visual Studio with all necessary environment
variables defined.
@section build_msvc_3rdparty Third-party libraries
Note: the MSVC project files are located in folders <i>adm\\msvc\\vc[9-12]</i>.
Binaries are produced in *win32* or *win64* folders.
Before building OCCT, make sure to have all the required third-party libraries installed.
3. Build with Visual Studio
The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to version of Visual Studio you are using, from http://www.opencascade.com/content/3rd-party-components.
Note: If VTK was not installed on you computer and you are not interested in usage of
OCCT VTK Integration Services (VIS) component you should exclude TKIVtk and TKIVtkDraw
projects from process of compilation in the main menu <b>Build / Configuration Manager</b>.
You can also build third-party libraries from their sources, see @ref occt_dev_guides__building_3rdparty_windows for instructions.
@section build_msvc_conf Configuration
If you have Visual Studio projects already available (pre-installed or generated), you can edit file *custom.bat* manually to adjust the environment:
* *VCVER* -- version of Visual Studio (vc10, vc11, vc12, or vc14), and relevant *VCVARS* path
* *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*.
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).
* 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).
@figure{/dev_guides/building/3rdparty/images/genconf_windows.png}
Click "Save" to store the specified configuration in *custom.bat* file.
@section build_msvc_generate Projects generation
Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found.
~~~~~
$ genproj.bat
~~~~~
Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
@section build_msvc_build Building
Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits.
Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
Binaries are produced in *win32* or *win64* folders.
To start DRAW, launch *draw.bat*.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 KiB

View File

@@ -1,162 +0,0 @@
Using WOK {#occt_dev_guides__building_wok}
=========
@tableofcontents
WOK is a legacy build environment for Open CASCADE Technology.
It is required for generation of header files for classes defined with
CDL ("Cascade Definition Language").
Also tools for generation of project files for other build systems, and OCCT
documentation, are integrated to WOK.
WOK thus is needed in the following situations:
- Building from OCCT sources from Git repository (do not contain generated files)
- Building after some changes made in CDL files
Before installing and using WOK, make sure that you have installed a compiler
(it is assumed that it is Visual Studio on Windows or gcc on Linux and MacOS)
and third-party components required for building OCCT.
@section wok1 Installing WOK
Download the latest version of binary distribution WOK from http://dev.opencascade.org/index.php?q=home/resources
@subsection wok11 Windows
Run the installer. You will be prompted to read and accept the OCCT Public License to proceed:
@image html /dev_guides/building/wok/images/wok_image001.png
@image latex /dev_guides/building/wok/images/wok_image001.png
Click **Next** and proceed with the installation.
At the end of the installation you will be prompted to specify the version and the location of Visual Studio to be used, and the location of third-party libraries:
@image html /dev_guides/building/wok/images/wok_image002.png
@image latex /dev_guides/building/wok/images/wok_image002.png
You can change these settings at any time later. For this click on the item **Customize environment (GUI tool)** in the WOK group in the Windows Start menu.
The shortcuts from this group provide two ways to run WOK:
* In command prompt window using option *WOK TCL shell*.
* In Emacs editor using option *WOK Emacs*. Using Emacs is convenient if you need to work within WOK environment.
By default WOK installer creates a WOK factory with name *LOC* within workshop *dev*. I.e. the WOK path is <i>:LOC:dev</i>.
@subsection wok12 Linux
* Unpack the .tgz archive containing WOK distributive into the installation directory <i>\<WOK_INSTALL_DIR\></i>.
* Perform the following commands assuming that you have unpacked WOK distributive archive into <i>\<WOK_INSTALL_DIR\></i>:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
cd \<WOK_INSTALL_DIR\>/site
wok_confgui.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Define all necessary paths to third-party products in the dialog window:
@image html /dev_guides/building/wok/images/wok_image003.png
@image latex /dev_guides/building/wok/images/wok_image003.png
* Run the following commands to create WOK LOC factory:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
cd \<WOK_INSTALL_DIR\>/site
wok_init.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Your installation procedure is over. To run WOK use one the following commands:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
cd \<WOK_INSTALL_DIR\>/site
wok_emacs.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
cd \<WOK_INSTALL_DIR\>/site
wok_tclsh.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection wok13 Mac OS X
* Double click on file *wokSetup.dmg* in the Finder. This opens a new window. Drag and drop *wokSetup* folder from this window at the location in the Finder where you want to install WOK, i.e. <i>\<WOK_INSTALL_DIR\></i>.
* Browse to the folder <i>\<WOK_INSTALL_DIR\>/site</i> and double click on *WokConfig*. This opens a window with additional search path settings. Define all necessary paths to third-party products in the dialog window:
@image html /dev_guides/building/wok/images/wok_image004.png
@image latex /dev_guides/building/wok/images/wok_image004.png
* Run the following commands to create WOK LOC factory:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
cd \<WOK_INSTALL_DIR\>/site
wok_init.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Your installation procedure is over. To run WOK in Emacs navigate in the Finder to the folder <i>\<WOK_INSTALL_DIR\>/site</i> and double click on *WokEmacs*.
@section wok2 Initialization of Workbench
To start working with OCCT, clone the OCCT Git repository from the server (see http://dev.opencascade.org/index.php?q=home/resources for details) or unpack the source archive.
Then create a WOK workbench (command *wcreate*) setting its Home to the directory, where the repository is created (<i>$CASROOT</i> variable). The workbench should have the same name as that directory.
For example, assuming that OCCT repository has been cloned into *D:/occt* folder:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
LOC:dev> wcreate occt -DHome=D:/occt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that <i>$CASROOT</i> is equal to *D:/occt* now.
Then you can work with this workbench using normal WOK functionality (*wprocess, umake*, etc.) or use it only for generation of derived sources and project files, and build OCCT with Visual Studio on Windows or *make* command on Linux, as described below.
@section wok3 Generation of building projects
Use command *wgenproj* in WOK to generate derived headers, source and building projects files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
LOC:dev> wokcd occt
LOC:dev:occt> wgenproj [ -target=<TARGET> ] [ -no_wprocess ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TARGET:
* *vc8* -- Visual Studio 2005;
* *vc9* -- Visual Studio 2008;
* *vc10* -- Visual Studio 2010;
* *vc11* -- Visual Studio 2012;
* *cbp* -- CodeBlocks;
* *cmake* -- CMake;
* *amk* -- AutoMake;
* *xcd* -- Xcode;
* <i>-no_wprocess</i> option skips generation of derived headers and source files.
Note that this command takes several minutes to complete at the first call.
Re-execute this step to generate derived headers, source and building projects files if some CDL files in OCCT have been modified (either by you directly, or due to updates in the repository). Note that in some cases WOK may fail to update correctly; in such case remove sub-directories *drv* and <i>.adm</i> and repeat the command.
To regenerate derived headers and source files without regeneration of projects use command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
LOC:dev> wokcd occt
LOC:dev:occt> wprocess -DGroups=Src,Xcpp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The generated building project has been placed into <i>$CASROOT/adm</i> folder:
* for vc8 -- <i>$CASROOT/adm/msvc/vc8</i>;
* for vc9 -- <i>$CASROOT/adm/msvc/vc9</i>;
* for vc10 -- <i>$CASROOT/adm/msvc/vc10</i>;
* for vc11 -- <i>$CASROOT/adm/msvc/vc11</i>;
* for cbp -- <i>$CASROOT/adm/\<OS\>/cbp</i>;
* for cmake -- <i>$CASROOT/adm/cmake</i>;
* for amk -- <i>$CASROOT/adm/lin/amk</i>;
* xcd -- <i>$CASROOT/adm/\<OS\>/xcd</i>
@section wok4 Generation of documentation
Use command *wgendoc* in WOK to generate reference documentation:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl}
:LOC:dev> wokcd occt
:LOC:dev:occt> wgendoc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following options can be used:
* <i>-wb=\<workbench name\></i> -- the name of OCCT workbench (the current one by default);
* <i>-m=\<list of modules\></i> -- the list of modules that will be contained in the documentation;
* <i>-outdir=\<path\></i> -- the output directory for the documentation;
* <i>-chm</i> -- the option to generate CHM file;
* <i>-hhc=\<path\></i> -- the path to HTML Help Compiler *hhc.exe* or equivalent;
* <i>-qthelp=\<path\></i> -- the option to generate Qt Help file, where <i>\<path\></i> is the required path to *qthelpgenerator* executable;
* <i>-doxygen=\<path\></i> -- the path to Doxygen executable;
* <i>-dot=\<path\></i> -- the path to GraphViz dot executable.

View File

@@ -1,58 +1,65 @@
Building with Xcode {#occt_dev_guides__building_xcode}
===================
This file describes steps to build OCCT libraries from a complete source package
on Mac OS X with **Xcode**.
@tableofcontents
If you build OCCT from bare sources (as in Git repository) or do some
changes affecting CDL files, you need to use WOK to re-generate header files
and build scripts / projects. See \ref occt_dev_guides__building_wok for instructions.
@section build_xcode_intro General
Before building OCCT, you need to install the required third-party libraries; see
paragraph 1 of \ref occt_dev_guides__building for details.
This file describes steps to build OCCT libraries from sources on Mac OS X with **Xcode** projects, generated by OCCT legacy tool **genproj**.
1. Add paths to the mandatory 3rd-party products (**Tcl/Tk** and **FreeType**)
in file *custom.sh* located in <i>\<OCCT_ROOT_DIR\> </i>. For this:
@section build_xcode_3rdparty Third-party libraries
1.1. Add paths to the includes in variable *CSF_OPT_INC*;
Before building OCCT, make sure to have all the needed third-party libraries installed.
On OS X we recommend to use native libraries.
You can also build third-party libraries from their sources, see @ref occt_dev_guides__building_3rdparty_osx for instructions.
1.2. Add paths to the binary libraries in variable *CSF_OPT_LIB64*;
@section build_xcode_conf Configuration
All paths should be separated by ":" symbol.
Before building it is necessary to set up build environment.
2. Add paths to the optional 3rd-party libraries (**TBB, gl2ps** and **FreeImage**)
in the aforementioned environment variables *CSF_OPT_INC* and *CSF_OPT_LIB64* from file *custom.sh*.
The environment is defined in the file *custom.sh* which can be edited directly:
If you want to build OCCT without the optional libraries perform the following steps:
2.1 Disable unnecessary library in *custom.sh* by setting the corresponding
variable <i>HAVE_<LIBRARY_NAME></i> to *false*.
* 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*.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
~~~~~
2.2 Remove this library from Project navigator in Xcode for each project that
uses it: choose the required project, right click on the unnecessary
library and select **Delete** button.
3. Open Terminal application.
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
@figure{/dev_guides/building/3rdparty/images/genconf_osx.png}
Click "Save" to store the specified configuration in *custom.sh* file.
@section build_xcode_gen Projects generation
Launch **genproj** tool to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
For instance, in Terminal application:
4. Enter <i>\<OCCT_ROOT_DIR\></i>:
~~~~~
cd \<OCCT_ROOT_DIR\>
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj.sh
~~~~~
5. To start **Xcode**, run command <i>/xcode.sh</i>
6. To build a certain toolkit, select it in **Scheme** drop-down list in Xcode
toolbar, press **Product** in the menu and click **Build** button.
@section build_xcode_build Building
To build the entire OCCT, create a new empty project (select **File ->
New -> Project -> "Empty project** in the menu. Input the project name,
e.g. *OCCT*, click **Next** and **Create** buttons). Drag and drop the *OCCT*
folder in the created *OCCT* project in the Project navigator. Select
**File -> New -> Target -> Aggregate** in the menu. Enter the project name
(e.g. <i>OCCT</i>) and click **Finish**. The **Build Phases** tab will open.
Click "+" button to add the necessary toolkits to the target project.
It is possible to select all toolkits by pressing **Command+A** combination.
To start **Xcode**, launch script *xcode.sh*.
To build a certain toolkit, select it in **Scheme** drop-down list in Xcode toolbar, press **Product** in the menu and click **Build** button.
To build the entire OCCT:
* Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**).
* Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator.
* Select **File -> New -> Target -> Aggregate** in the menu.
* Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open.
* Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination.
@section build_xcode_draw Launching DRAW
To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps:
@@ -67,4 +74,5 @@ To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the fol
~~~~~
./draw_cbp.sh xcd [d]
~~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
Option *d* is used if OCCT has been built in **Debug** mode.

View File

@@ -36,7 +36,6 @@ Open CASCADE Technology is an open source platform available for an internationa
Names should be meaningful or, at least, contain a meaningful part. To better understand this requirement, let us examine the existing names of toolkits, packages, classes and methods:
- Packages containing words *Geom* or *Geom2d* in their names are related to geometrical data and operations.
- Packages containing words *TopoDS* or *BRep* in their names are related to topological data and operations.
- In OCAF, packages that define transient, persistent data classes and drivers to map between them, have similar names prefixed by *T*, *P*, and *M* correspondingly (e.g. *TDocStd*, *PDocStd*, *MDocStd*).
- Packages ending with <i>...Test</i> define Draw Harness plugins.
- Methods starting with *Get...* and *Set...* are usually responsible for correspondingly retrieving and storing data.
@@ -67,10 +66,9 @@ Names of units should not contain underscores, unless the use of underscores is
The following extensions should be used for source files, depending on their type:
* <i>.cdl</i> -- CDL declaration files
* <i>.cxx</i> -- C++ source files
* <i>.hxx</i> -- C++ header files
* <i>.lxx</i> -- headers with definitions of inline methods (CDL packages)
* <i>.lxx</i> -- additional headers containing definitions of inline methods and auxiliary code
### Prefix for toolkit names [MANDATORY]

View File

@@ -37,8 +37,8 @@ Follow the instructions to proceed (define proxy settings if needed, select a mi
**MathJax** is used for rendering math formulas in browser (HTML and CHM outputs): http://www.mathjax.org.
By default MathJAX scripts and fonts are taken from http://cdn.mathjax.org/mathjax/latest and no installation of MathJAX is necessary if Internet is accessible.
If you need to use OCCT documentation while off-line, you can install a local copy of MatJAX, see http://www.mathjax.org/download/.
By default MathJAX scripts and fonts work on-line and no installation of MathJAX is necessary if Internet is accessible.
If you need to use OCCT documentation while off-line, you can install a local copy of MatJAX, see https://docs.mathjax.org/en/v2.6-latest/start.html#installing-your-own-copy-of-mathjax.
See \ref OCCT_DM_SECTION_A_9 for more details on inserting mathematical expressions.
@section OCCT_DM_SECTION_2_1 Documentation Generation

View File

@@ -265,8 +265,7 @@ Click **Save** to input the key to the system.
* Create a new branch for your development, basing on the selected version of the sources
(usually the current master) and switch your working copy to it
* Develop and test your change. Note that for the first time, and after any changes
made in CDL files you will have to re-generate build scripts or Visual Studio projects using WOK.
* Develop and test your change.
* Do as many commits in your branch as you feel convenient;
the general recommendation is to commit every stable state (even incomplete), to record the history of your development.
* Push your branch to the repository when your development is complete or when you need to share it with other people (e.g. for review)

View File

@@ -23,7 +23,8 @@ The tests are organized in three levels:
See @ref testmanual_5_1 "Test Groups" chapter for the current list of available test groups and grids.
Some tests involve data files (typically CAD models) which are located separately and are not included with OCCT code. The archive with publicly available test data files should be downloaded and installed independently on OCCT sources (see http://dev.opencascade.org).
@note Many tests involve data files (typically CAD models) which are located separately and (except a few) are not included with OCCT code.
These tests will be skipped if data files are not available.
@subsection testmanual_1_2 Intended Use of Automatic Tests
@@ -109,8 +110,8 @@ Draw[]> testgrid -outdir d:/occt/last_results -overwrite
~~~~~
In the output directory, a cumulative HTML report <i>summary.html</i> provides links to reports on each test case. An additional report in JUnit-style XML format can be output for use in Jenkins or other continuous integration system.
To re-run test cases which were detected as regressions on previous run, option <i>-regress dirname</i> should be used.
<i>dirname</i> is path to directory containing results of previous run. Only test cases with *FAILED* and *IMPROVEMENT* statuses will be tested.
To re-run the test cases, which were detected as regressions on the previous run, option <i>-regress dirname</i> should be used.
<i>dirname</i> is a path to the directory containing the results of the previous run. Only the test cases with *FAILED* and *IMPROVEMENT* statuses will be tested.
Example:
~~~~~
@@ -130,10 +131,10 @@ testgrid: Run all tests, or specified group, or one grid
-overwrite: force writing logs in existing non-empty directory
-xml filename: write XML report for Jenkins (in JUnit-like format)
-beep: play sound signal at the end of the tests
-regress dirname: re-run only a set of tests that have been detected as regressions on some previous run.
Here "dirname" is path to directory containing results of previous run.
Groups, grids, and test cases to be executed can be specified by list of file
masks, separated by spaces or comma; default is all (*).
-regress dirname: re-run only a set of tests that have been detected as regressions on the previous run.
Here "dirname" is a path to the directory containing the results of the previous run.
Groups, grids, and test cases to be executed can be specified by the list of file
masks separated by spaces or commas; default is all (*).
~~~~~
@subsubsection testmanual_1_3_3 Running a Single Test
@@ -186,13 +187,13 @@ Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional
3. In the test script:
* Load all necessary DRAW modules by command *pload*.
* Use command *locate_data_file* to get a path to data files used by test script. (Make sure to have this command not inside catch statement if it is used.)
* Use DRAW commands to reproduce the situation being tested.
* Make sure that in case of failure the test produces message containing word "Error" or other recognized by test system as error (add new error patterns in file parse.rules if necessary).
* If test case reports error due to existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
* To check expected output which should be obtained as a result of a test, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
* If test case produces error messages (contained in parse.rules) which are expected in that test and should not be considered as its failure (e.g. test for checkshape command), add REQUIRED statement for each error to mark it as required output.
4. If the test uses data file(s) not yet present in the test database, these can be put to (sub)directory pointed out by *CSF_TestDataPath* variable for running test. The files should be attached to Mantis issue corresponding to the modification being tested.
5. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate to Git branch created for the issue.
* Use DRAW commands to reproduce the tested situation.
* Make sure that in case of failure the test produces a message containing word "Error" or other recognized by the test system as error (add new error patterns in file parse.rules if necessary).
* If the test case reports error due to an existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as a known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
* To check expected output which should be obtained as the test result, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
* If the test case produces error messages (contained in parse.rules), which are expected in that test and should not be considered as its failure (e.g. test for *checkshape* command), add REQUIRED statement for each error to mark it as required output.
4. If the test uses data file(s) that are not yet present in the test database, it is possible to put them to (sub)directory pointed out by *CSF_TestDataPath* variable for running test. The files should be attached to the Mantis issue corresponding to the tested modification.
5. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate it to the Git branch created for the issue.
Example:
@@ -316,7 +317,7 @@ The test group may contain *parse.rules* file. This file defines patterns used f
Each line in the file should specify a status (single word), followed by a regular expression delimited by slashes (*/*) that will be matched against lines in the test output log to check if it corresponds to this status.
The regular expressions should follow <a href="http://www.tcl.tk/man/tcl/TclCmd/re_syntax.htm">Tcl syntax</a>, with special exception that "\b" is considered as word limit (Perl-style), in addition to "\y" used in Tcl.
The regular expressions should follow <a href="http://www.tcl.tk/man/tcl/TclCmd/re_syntax.htm">Tcl syntax</a>, with a special exception that "\b" is considered as word limit (Perl-style), in addition to "\y" used in Tcl.
The rest of the line can contain a comment message, which will be added to the test report when this status is detected.
@@ -631,8 +632,8 @@ puts "TODO OCC22817 All: TEST INCOMPLETE"
@subsection testmanual_3_7 Marking required output
To check expected output which must be obtained as a result of a test for it to be considered correct, add REQUIRED statement for each specific message.
For that, the following statement should be added to such a test script:
To check the obtained test output matches the expected results considered correct, add REQUIRED statement for each specific message.
For that, the following statement should be added to the corresponding test script:
~~~~~
puts "REQUIRED ListOfPlatforms: RegularExpression"
@@ -640,7 +641,7 @@ puts "REQUIRED ListOfPlatforms: RegularExpression"
Here *ListOfPlatforms* and *RegularExpression* have the same meaning as in TODO statements described above.
The REQUIRED statement can also be used to mask message that would normally be interpreted as error (according to rules defined in *parse.rules*) but should not be considered as such within current test.
The REQUIRED statement can also be used to mask the message that would normally be interpreted as error (according to the rules defined in *parse.rules*) but should not be considered as such within the current test.
Example:
~~~~~
@@ -1065,6 +1066,7 @@ Error : Number of faults is UNSTABLE
~~~~~
@subsubsection testmanual_5_3_2 Shape tolerance
The maximal tolerance of sub-shapes of each kind of the resulting shape can be extracted from output of tolerance command as follows:
~~~~~
@@ -1079,10 +1081,10 @@ It is possible to use command *checkmaxtol* to check maximal tolerance of shape
Use: checkmaxtol shape [options...]
Allowed options are:
* -ref: reference value of maximum tolerance
* -source: list of shapes to compare with
* -min_tol: minimum tolerance for comparison
* -multi_tol: tolerance multiplier
* <i>-ref</i> -- reference value of maximum tolerance;
* <i>-source</i> -- list of shapes to compare with;
* <i>-min_tol</i> -- minimum tolerance for comparison;
* <i>-multi_tol</i> -- tolerance multiplier.
The default syntax of *checkmaxtol* command for comparison with the reference value:
~~~~~
@@ -1121,9 +1123,10 @@ if { abs($area - $expected) > 0.1 + 0.01 * abs ($area) } {
@subsubsection testmanual_5_3_4 Memory leaks
The test system measures the amount of memory used by each test case, and considerable deviations (as well as overall difference) comparing with reference results will be reported by *testdiff* command.
The test system measures the amount of memory used by each test case. Considerable deviations (as well as the overall difference) in comparison with reference results can be reported by command *testdiff* (see @ref testmanual_4_4).
The typical approach to checking memory leak on a particular operation is to run this operation in cycle measuring memory consumption at each step and comparing it with some threshold value. Note that file begin in group bugs defines command *checktrend* that can be used to analyze a sequence of memory measurements to get statistically based evaluation of the leak presence.
To check memory leak on a particular operation, run it in a cycle, measure the memory consumption at each step and compare it with a threshold value.
The command *checktrend* (defined in *tests/bugs/begin*) can be used to analyze a sequence of memory measurements and to get a statistically based evaluation of the leak presence.
Example:
~~~~~
@@ -1142,7 +1145,7 @@ for {set i 1} {$i < 100} {incr i} {
@subsubsection testmanual_5_3_5 Visualization
Take a snapshot of the viewer, give it the name of the test case, and save in the directory indicated by Tcl variable *imagedir*.
The following command sequence allows you to take a snapshot of the viewer, give it the name of the test case, and save in the directory indicated by Tcl variable *imagedir*.
~~~~~
vinit
@@ -1160,22 +1163,22 @@ Also it is possible to use command *checkview* to make a snapshot of the viewer.
Use: checkview [options...]
Allowed options are:
* -display shapename: display shape with name 'shapename'
* -3d: display shape in 3d viewer
* -2d [ v2d / smallview ]: display shape in 2d viewer (default viewer is a 'smallview')
* -path PATH: location of saved screenshot of viewer
* -vdispmode N: it is possible to set vdispmode for 3d viewer (default value is 1)
* -screenshot: procedure will try to make screenshot of already created viewer
* Procedure can check some property of shape (length, area or volume) and compare it with some value N:
* -l [N]
* -s [N]
* -v [N]
* If current property is equal to value N, shape is marked as valid in procedure.
* If value N is not given procedure will mark shape as valid if current property is non-zero.
* -with {a b c}: display shapes 'a' 'b' 'c' together with 'shape' (if shape is valid)
* -otherwise {d e f}: display shapes 'd' 'e' 'f' instead of 'shape' (if shape is NOT valid)
* <i>-display shapename </i> -- displays shape with name *shapename*;
* <i>-3d </i> -- displays shape in 3d viewer;
* <i>-2d [ v2d / smallview ] </i> - displays shape in 2d viewer (the default viewer is *smallview*);
* <i>-path PATH</i> -- sets the location of the saved viewer screenshot;
* <i>-vdispmode N</i> -- sets *vdispmode* for 3d viewer (default value is 1)
* <i>-screenshot</i> -- makes a screenshot of already created viewer
* The procedure can check a property of shape (length, area or volume) and compare it with value *N*:
* <i>-l [N]</i>
* <i>-s [N]</i>
* <i>-v [N]</i>
* If the current property is equal to value *N*, the shape is marked as valid in the procedure.
* If value *N* is not given, the procedure will mark the shape as valid if the current property is non-zero.
* <i>-with {a b c}</i> -- displays shapes *a, b* and *c* together with the shape (if the shape is valid)
* <i>-otherwise {d e f}</i> -- displays shapes *d, e* and *f* instead of the shape (if the shape is NOT valid)
Note that one of two options -2d/-3d is required.
Note that is required to use either option <i> -2d </i> or option <i> -3d</i>.
Examples:
~~~~~
@@ -1183,6 +1186,7 @@ checkview -display result -2d -path ${imagedir}/${test_image}.png
checkview -display result -3d -path ${imagedir}/${test_image}.png
checkview -display result_2d -2d v2d -path ${imagedir}/${test_image}.png
~~~~~
~~~~~
box a 10 10 10
box b 5 5 5 10 10 10
@@ -1190,6 +1194,7 @@ bcut result b a
set result_vertices [explode result v]
checkview -display result -2d -with ${result_vertices} -otherwise { a b } -l -path ${imagedir}/${test_image}.png
~~~~~
~~~~~
box a 10 10 10
box b 5 5 5 10 10 10
@@ -1202,25 +1207,23 @@ checkview -screenshot -3d -path ${imagedir}/${test_image}.png
@subsubsection testmanual_5_3_6 Number of free edges
To check the number of free edges run the command *checkfreebounds*.
It compares number of free edges with reference value.
Procedure *checkfreebounds* compares the number of free edges with a reference value.
Use: checkfreebounds shape ref_value [options...]
Allowed options are:
* -tol N: used tolerance (default -0.01)
* -type N: used type, possible values are "closed" and "opened" (default "closed")
* <i>-tol N</i> -- used tolerance (default -0.01);
* <i>-type N</i> -- used type, possible values are "closed" and "opened" (default "closed").
~~~~~
checkfreebounds result 13
~~~~~
Option -tol N is used to set tolerance for command *freebounds*, which is used within command *checkfreebounds*.
Option <i>-tol N</i> defines tolerance for command *freebounds*, which is used within command *checkfreebounds*.
Option -type N is used to select the type of counted free edges - closed or opened.
Option <i>-type N</i> is used to select the type of counted free edges: closed or open.
If the number of free edges in the resulting shape is unstable, reference value should be set to "-1".
If the number of free edges in the resulting shape is unstable, the reference value should be set to "-1".
As a result command *checkfreebounds* will return the following error:
~~~~~
@@ -1230,7 +1233,7 @@ Error : Number of free edges is UNSTABLE
@subsubsection testmanual_5_3_7 Compare numbers
Procedure to check equality of two reals with some tolerance (relative and absolute)
Procedure *checkreal* checks the equality of two reals with a tolerance (relative and absolute).
Use: checkreal name value expected tol_abs tol_rel
@@ -1240,11 +1243,12 @@ checkreal "Some important value" $value 5 0.0001 0.01
@subsubsection testmanual_5_3_8 Check number of sub-shapes
Compare number of sub-shapes in "shape" with given reference data
Procedure *checknbshapes* compares the number of sub-shapes in "shape" with the given reference data.
Use: checknbshapes shape [options...]
Allowed options are:
* -vertex N
* <i>-vertex N
* -edge N
* -wire N
* -face N
@@ -1253,9 +1257,9 @@ Allowed options are:
* -compsolid N
* -compound N
* -shape N
* -t: compare the number of sub-shapes in "shape" counting
* -t</i> -- compares the number of sub-shapes in "shape" counting
the same sub-shapes with different location as different sub-shapes.
* -m msg: print "msg" in case of error
* <i>-m msg</i> -- prints "msg" in case of error
~~~~~
checknbshapes result -vertex 8 -edge 4
@@ -1263,15 +1267,15 @@ checknbshapes result -vertex 8 -edge 4
@subsubsection testmanual_5_3_9 Check pixel color
To check pixel color command *checkcolor* can be used.
Command *checkcolor* can be used to check pixel color.
Use: checkcolor x y red green blue
x, y -- pixel coordinates
where:
* <i>x, y</i> -- pixel coordinates;
* <i>red green blue</i> -- expected pixel color (values from 0 to 1).
red green blue -- expected pixel color (values from 0 to 1)
This procedure checks color with tolerance (5x5 area)
This procedure checks color with tolerance (5x5 area).
Next example will compare color of point with coordinates x=100 y=100 with RGB color R=1 G=0 B=0.
If colors are not equal, procedure will check the nearest ones points (5x5 area)
@@ -1281,19 +1285,19 @@ checkcolor 100 100 1 0 0
@subsubsection testmanual_5_3_10 Compute length, area and volume of input shape
Procedure *checkprops* computes length, area and volume of input shape.
Procedure *checkprops* computes length, area and volume of the input shape.
Use: checkprops shapename [options...]
Allowed options are:
* -l LENGTH: command lprops, computes the mass properties of all edges in the shape with a linear density of 1
* -s AREA: command sprops, computes the mass properties of all faces with a surface density of 1
* -v VOLUME: command vprops, computes the mass properties of all solids with a density of 1
* -eps EPSILON: the epsilon defines relative precision of computation
* -equal SHAPE: compare area\volume\length of input shapes. Puts error if its are not equal
* -notequal SHAPE: compare area\volume\length of input shapes. Puts error if its are equal
* <i>-l LENGTH</i> -- command *lprops*, computes the mass properties of all edges in the shape with a linear density of 1;
* <i>-s AREA</i> -- command *sprops*, computes the mass properties of all faces with a surface density of 1;
* <i>-v VOLUME</i> -- command *vprops*, computes the mass properties of all solids with a density of 1;
* <i>-eps EPSILON</i> -- the epsilon defines relative precision of computation;
* <i>-equal SHAPE</i> -- compares area, volume and length of input shapes. Puts error if they are not equal;
* <i>-notequal SHAPE</i> -- compares area, volume and length of input shapes. Puts error if they are equal.
Options -l, -s and -v are independent and can be used in any order. Tolerance epsilon is the same for all options.
Options <i> -l, -s </i> and <i> -v</i> are independent and can be used in any order. Tolerance *epsilon* is the same for all options.
~~~~~
checkprops result -s 6265.68
@@ -1307,9 +1311,9 @@ Procedure *checkdump* is used to parse output dump and compare it with reference
Use: checkdump shapename [options...]
Allowed options are:
* -name NAME: list of parsing parameters (e.g. Center, Axis, etc)
* -ref VALUE: list of reference values for each parameter in NAME
* -eps EPSILON: the epsilon defines relative precision of computation
* <i>-name NAME</i> -- list of parsing parameters (e.g. Center, Axis, etc.);
* <i>-ref VALUE</i> -- list of reference values for each parameter in *NAME*;
* <i>-eps EPSILON</i> -- the epsilon defines relative precision of computation.
~~~~~
checkdump result -name {Center Axis XAxis YAxis Radii} -ref {{-70 0} {-1 -0} {-1 -0} {0 -1} {20 10}} -eps 0.01
@@ -1317,15 +1321,15 @@ checkdump result -name {Center Axis XAxis YAxis Radii} -ref {{-70 0} {-1 -0} {-1
@subsubsection testmanual_5_3_12 Compute length of input curve
Procedure *checklength* computes length of input curve.
Procedure *checklength* computes length of the input curve.
Use: checklength curvename [options...]
Allowed options are:
* -l LENGTH: command length, computes the length of input curve with precision of computation
* -eps EPSILON: the epsilon defines relative precision of computation
* -equal CURVE: compare length of input curves. Puts error if its are not equal
* -notequal CURVE: compare length of input curves. Puts error if its are equal
* <i>-l LENGTH</i> -- command *length*, computes the length of the input curve with precision of computation;
* <i>-eps EPSILON</i> -- the epsilon defines a relative precision of computation;
* <i>-equal CURVE</i> -- compares the length of input curves. Puts error if they are not equal;
* <i>-notequal CURVE</i> -- compares the length of input curves. Puts error if they are equal.
~~~~~
checklength cp1 -l 7.278
@@ -1333,60 +1337,57 @@ checklength res -l -equal ext_1
~~~~~
@subsubsection testmanual_5_3_13 Check maximum deflection, number of triangles and nodes in mesh
To check maximum deflection, number of nodes and triangles in mesh command *checktrinfo* can be used.
Command *checktrinfo* can be used to to check the maximum deflection, as well as the number of nodes and triangles in mesh.
Use: checktrinfo shapename [options...]
Allowed options are:
* -tri [N]: compare current number of triangles in "shapename" mesh with given reference data.
If reference value N is not given and current number of triangles is equal to 0
procedure checktrinfo will print an error.
* -nod [N]: compare current number of nodes in "shapename" mesh with given reference data.
If reference value N is not givenand current number of nodes is equal to 0
procedure checktrinfo will print an error.
* -defl [N]: compare current value of maximum deflection in "shapename" mesh with given reference data
If reference value N is not given and current maximum deflection is equal to 0
procedure checktrinfo will print an error.
* -max_defl N: compare current value of maximum deflection in "shapename" mesh with max possible value
* -tol_abs_tri N: absolute tolerance for comparison of number of triangles (default value 0)
* -tol_rel_tri N: relative tolerance for comparison of number of triangles (default value 0)
* -tol_abs_nod N: absolute tolerance for comparison of number of nodes (default value 0)
* -tol_rel_nod N: relative tolerance for comparison of number of nodes (default value 0)
* -tol_abs_defl N: absolute tolerance for deflection comparison (default value 0)
* -tol_rel_defl N: relative tolerance for deflection comparison (default value 0)
* -ref [trinfo a]: compare deflection, number of triangles and nodes in "shapename" and in "a"
* <i>-tri [N]</i> -- compares the current number of triangles in *shapename* mesh with the given reference data.
If reference value N is not given and the current number of triangles is equal to 0, procedure *checktrinfo* will print an error.
* <i>-nod [N]</i> -- compares the current number of nodes in *shapename* mesh with the given reference data.
If reference value N is not given and the current number of nodes is equal to 0, procedure *checktrinfo* will print an error.
* <i>-defl [N]</i> -- compares the current value of maximum deflection in *shapename* mesh with the given reference data.
If reference value N is not given and current maximum deflection is equal to 0, procedure *checktrinfo* will print an error.
* <i>-max_defl N</i> -- compares the current value of maximum deflection in *shapename* mesh with the max possible value.
* <i>-tol_abs_tri N</i> -- absolute tolerance for comparison of number of triangles (default value 0).
* <i>-tol_rel_tri N</i> -- relative tolerance for comparison of number of triangles (default value 0).
* <i>-tol_abs_nod N</i> -- absolute tolerance for comparison of number of nodes (default value 0).
* <i>-tol_rel_nod N</i> -- relative tolerance for comparison of number of nodes (default value 0).
* <i>-tol_abs_defl N</i> -- absolute tolerance for deflection comparison (default value 0).
* <i>-tol_rel_defl N</i> -- relative tolerance for deflection comparison (default value 0).
* <i>-ref [trinfo a]</i> -- compares deflection, number of triangles and nodes in *shapename* and *a*.
Note that options -tri, -nod, -defl do not work together with option -ref.
Note that options <i> -tri, -nod </i> and <i> -defl </i> do not work together with option <i> -ref</i>.
Examples:
comparison with some reference values
Comparison with some reference values:
~~~~~
checktrinfo result -tri 129 -nod 131 -defl 0.01
~~~~~
comparison with another mesh
Comparison with another mesh:
~~~~~
checktrinfo result -ref [tringo a]
~~~~~
comparison of deflection with max possible value
Comparison of deflection with the max possible value:
~~~~~
checktrinfo result -max_defl 1
~~~~~
to make sure that current values are not equal to zero
Check that the current values are not equal to zero:
~~~~~
checktrinfo result -tri -nod -defl
~~~~~
to make sure that number of triangles and number of nodes are not equal to some specific values
Check that the number of triangles and the number of nodes are not equal to some specific values:
~~~~~
checktrinfo result -tri !10 -nod !8
~~~~~
it is possible to compare current values with reference values with some tolerances.
Use options -tol_\* for that.
It is possible to compare current values with reference values with some tolerances.
Use options <i>-tol_\* </i> for that.
~~~~~
checktrinfo result -defl 1 -tol_abs_defl 0.001
~~~~~

View File

@@ -24,14 +24,309 @@ The automatic upgrade tool is provided as is, without warranty of any kind, and
It is your responsibility to ensure that the changes you made in your code are correct.
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
@section upgrade_65 Upgrade to OCCT 6.5.0
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
* If you are not comfortable with dependence on Intel TBB, FreeImage, or Gl2Ps libraries, you will need to (re)build OCCT with these dependencies disabled.
* The low-level format version of OCAF binary and XML persistence has been incremented. Hence, the files saved by OCCT 6.5 to OCAF binary or XML format will not be readable by previous versions of OCCT.
* The *BRepMesh* triangulation algorithm has been seriously revised and now tries hard to fulfill the requested deflection and angular tolerance parameters. If you experience any problems with performance or triangulation quality (in particular, display of shapes in shading mode), consider revising the values of these parameters used in your application.
* If you were using method *ToPixMap()* of class *V3d_View* to get a buffer for passing to Windows API functions (e.g. *BitBlt*), this will not work anymore. You will need to use method *Image_PixMap::AccessBuffer()* to get the raw buffer data that can be further passed to WinAPI functions.
* As the processing of message gravity parameter in *Message* package has been improved, some application messages (especially the ones generated by IGES or STEP translators) can be suppressed or new messages appear in the application. Use relevant message level parameter to tune this behavior.
@section upgrade_651 Upgrade to OCCT 6.5.1
Porting of user applications from an earlier OCCT version to version 6.5.1 requires taking into account the following major changes:
* Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection:
~~~~
const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups();
Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup();
Standard_Integer aLen = aGroupsSeq.Length();
for (Standard_Integer aGr = 1; aGr <= aLen; ++aGr)
{
aGroupSet->Add (aGroupsSeq.Value (aGr));
}
~~~~
* All occurrences of *Select3D_Projector* in the application code (if any) should be replaced with *Handle(Select3D_Projector)*.
* The code of inheritors of *Select3D_SensitiveEntity* should be updated if they override <i>Matches()</i> (this is probable, if clipping planes are used).
* Constructor for *V3d_Plane* has been changed, so the extra argument should be removed if used in the application. It is necessary to add a new plane using method *V3d_Viewer::AddPlane()* if *V3d_Viewer* has been used to manage clipping planes list (this does not affect clipping planes representation). Please, have a look at the source code for new DRAWEXE *vclipplane* command in *ViewerTest_ObjectsCommands.cxx, VClipPlane* to see how clipping planes can be managed in the application.
@section upgrade_652 Upgrade to OCCT 6.5.2
Porting of user applications from an earlier OCCT version to version 6.5.2 requires taking into account the following major changes:
* Any code that has been generated by WOK from CDL generic classes *Tcollection_DataMap* and *Tcollection_IndexedDataMap* needs to be regenerated by WOK to take into account the change in the interface of these classes.
* The enumerations *CDF_StoreStatus* and *CDF_RetrievableStatus* have been replaced by the enumerations *PCDM_StoreStatus* and *PCDM_ReaderStatus*. Correspondingly, the methods *Open, Save* and *SaveAs* of the class *TDocStd_Application* have changed their return value. Any code, which uses these enumerations, needs to be updated.
* *BRepLib_MakeFace* has been modified to accept tolerance value for resolution of degenerated edges. This tolerance parameter has no default value to ensure that the client code takes care of passing a meaningful value, not just *Precision::Confusion*, so some porting overheads are expected.
* If the callback mechanism in call_togl_redraw function was used in the application code, it is necessary to revise it to take into account the new callback execution and provide a check of reason value of Aspect_GraphicCallbackStruct in callback methods to confirm that the callback code is executed at the right moment. Now the callbacks are executed before redrawing the underlayer, before redrawing the overlayer and at the end of redrawing. The information about the moment when the callback is invoked is provided with the reason value in form of an additional bit flag <i>(OCC_PRE_REDRAW, OCC_PRE_OVERLAY)</i>. The state of OpenGl changed in callback methods will not be restored automatically, which might lead to unwanted behavior in redrawing procedure.
* The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting.
* It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner:
~~~~
Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler);
if (!aMeshAlgo.IsNull()) {}
~~~~
* The default state of *BRepMesh* parallelization has been turned off. The user should switch this flag explicitly:
* by using methods *BRepMesh_IncrementalMesh::SetParallel(Standard_True)* for each *BRepMesh_IncrementalMesh* instance before <i>Perform()</i>;
* by calling *BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True)* when *BRepMesh_DiscretFactory* is used to retrieve the meshing tool (this also affects auto-triangulation in *AIS*).
@section upgrade_653 Upgrade to OCCT 6.5.3
Porting of user applications from an earlier OCCT version to version 6.5.3 requires taking into account the following major changes:
* As a result of code clean-up and redesign of *TKOpenGl* driver, some obsolete functions and rendering primitives <i>(TriangleMesh, TriangleSet, Bezier, Polyline, Polygon, PolygonHoles, QuadrangleMesh</i> and *QuadrangleSet*) have been removed. Instead, the application developers should use primitive arrays that provide the same functionality but are hardware-accelerated. The details can be found in OCCT Visualization User's Guide, “Primitive Arrays” chapter.
* Applications should not call *AIS_InteractiveObject::SetPolygonOffsets()* method for an instance of *AIS_TexturedShape* class after it has been added to *AIS_InteractiveContext*. More generally, modification of *Graphic3d_AspectFillArea3d* parameters for the computed groups of any *AIS_InteractiveObject* subclass that uses texture mapping should be avoided, because this results in broken texture mapping (see issue 23118). It is still possible to apply non-default polygon offsets to *AIS_TexturedShape* by calling *SetPolygonOffsets()* before displaying the shape.
* The applications that might have used internal functions provided by *TKOpenGl* or removed primitives will need to be updated.
* In connection with the implementation of Z-layers it might be necessary to revise the application code or revise the custom direct descendant classes of *Graphic3d_GraphicDriver* and *Graphic3d_StructureManager* to use the Z-layer feature.
* Global variables *Standard_PI* and *PI* have been eliminated (use macro *M_PI* instead).
* Method *HashCode()* has been removed from class *Standard_Transient*. It is advisable to use global function <i>HashCode()</i> for Handle objects instead.
* Declaration of operators new/delete for classes has become consistent and is encapsulated in macros.
* Memory management has been changed to use standard heap <i>(MMGT_OPT=0)</i> and reentrant mode <i>(MMGT_REENTRANT=1)</i> by default.
* Map classes in *NCollection* package now accept one more argument defining a hash tool.
@section upgrade_654 Upgrade to OCCT 6.5.4
Porting of user applications from an earlier OCCT version to version 6.5.4 requires taking into account the following major changes:
* The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below:
~~~~
#include <Image_AlienPixMap.hxx>
void dump (Handle(V3d_View)& theView3D)
{
Standard_Integer aWndSizeX = 0;
Standard_Integer aWndSizeY = 0;
theView3D->Window()->Size (aWndSizeX, aWndSizeY);
Image_AlienPixMap aPixMap;
theView3D->ToPixMap (aPixMap, aWndSizeX, aWndSizeY);
aPixMap.Save ("c:\\image.png");
}
~~~~
* Now OpenGL resources related to Interactive Objects are automatically freed when the last view (window) is removed from graphical driver.
To avoid presentation data loss, the application should replace an old view with a new one in the proper order: first the new view is created and activated and only then the old one is detached and removed.
* It is recommended to use *NCollection* containers with hasher parameter (introduced in 6.5.3) instead of global definition <i>IsEqual()/HashCode()</i> as well as to use explicit namespaces to avoid name collision.
@section upgrade_660 Upgrade to OCCT 6.6.0
Porting of user applications from an earlier OCCT version to version 6.6.0 requires taking into account the following major changes:
* Due to the changes in the implementation of Boolean Operations, the order of sub-shapes resulting from the same operation performed with OCCT 6.5.x and OCCT 6.6.0 can be different.
It is necessary to introduce the corresponding changes in the applications for which the order of sub-shapes resulting from a Boolean operation is important. It is strongly recommended to use identification methods not relying on the order of sub-shapes (e.g. OCAF naming).
* If you need to use OCCT on Mac OS X with X11 (without Cocoa), build OCCT with defined pre-processor macro *CSF_MAC_USE_GLX11*. XLib front-end (previously the only way for unofficial OCCT builds on Mac OS X) is now disabled by default on this platform. If your application has no support for Cocoa framework you may build OCCT with XLib front-end adding *MACOSX_USE_GLX* macro to compiler options (you may check the appropriate option in WOK configuration GUI and in CMake configuration). Notice that XQuartz (XLib implementation for Mac OS X) now is an optional component and does not provide a sufficient level of integrity with native (Cocoa-based) applications in the system. It is not possible to build OCCT with both XLib and Cocoa at the same time due to symbols conflict in OpenGL functions.
* Animation mode and degeneration presentation mode (simplified presentation for animation) and associated methods have been removed from 3D viewer functionality.
Correspondingly, the code using methods *SetAnimationModeOn(), SetAnimationModeOff(), AnimationModeIsOn(), AnimationMode(), Tumble(), SetDegenerateModeOn(), SetDegenerateModeOff()* and *DegenerateModeIsOn()* of classes *V3d_View* and *Visual3d_View* will need to be removed or redesigned. Please, notice that Hidden Line Removal presentation was not affected; however, the old code that used methods *V3d_View::SetDegenerateModeOn* or *V3d_View::SetDegenerateModeOff* to control HLR presentation should be updated to use *V3d_View::SetComputedMode* method instead.
* Calls of *Graphic3d_Group::BeginPrimitives()* and *Graphic3d_Group::EndPrimitives()* should be removed from the application code.
* Application functionality for drawing 2D graphics that was formerly based on *TKV2d* API should be migrated to *TKV3d* API. The following changes are recommended for this migration:
* A 2D view can be implemented as a *V3d_View* instance belonging to *V3d_Viewer* managed by *AIS_InteractiveContext* instance. To turn *V3d_View* into a 2D view, the necessary view orientation should be set up at the view initialization stage using *V3d_View::SetProj()* method, and view rotation methods simply should not be called.
* Any 2D graphic entity (formerly represented with *AIS2D_InteractiveObject*) should become a class derived from *AIS_InteractiveObject* base. These entities should be manipulated in a view using *AIS_InteractiveContext* class API.
* All drawing code should be put into *Compute()* virtual method of a custom interactive object class and use API of *Graphic3d* package. In particular, all geometry should be drawn using class hierarchy derived from *Graphic3d_ArrayOfPrimitives*. Normally, the Z coordinate for 2D geometry should be constant, unless the application implements some advanced 2D drawing techniques like e.g. multiple "Z layers" of drawings.
* Interactive selection of 2D presentations should be set up inside *ComputeSelection()* virtual method of a custom interactive object class, using standard sensitive entities from *Select3D* package and standard or custom entity owners derived from *SelectMgr_EntityOwner* base.
Please refer to the Visualization User's Guide for further details concerning OCCT 3D visualization and selection classes. See also *Viewer2D* OCCT sample application, which shows how 2D drawing can be implemented using TKV3d API.
* Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code:
~~~~
// initialize a new viewer with OpenGl graphic driver
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
new OpenGl_GraphicDriver ("TKOpenGl");
aGraphicDriver->Begin (new Aspect_DisplayConnection());
TCollection_ExtendedString aNameOfViewer ("Visu3D");
Handle(V3d_Viewer) aViewer
= new V3d_Viewer (aGraphicDriver, aNameOfViewer.ToExtString());
aViewer->Init();
// create a new window or a wrapper over the existing window,
// provided by a 3rd-party framework (Qt, MFC, C# or Cocoa)
#if defined(_WIN32) || defined(__WIN32__)
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
Handle(WNT_Window) aWindow = new WNT_Window (winId());
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
NSView* aViewHandle = (NSView* )winId();
Handle(Cocoa_Window) aWindow = new Cocoa_Window (aViewHandle);
#else
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
Handle(Xw_Window) aWindow =
new Xw_Window (aGraphicDriver->GetDisplayConnection(), aWindowHandle);
#endif // WNT
// setup the window for a new view
Handle(V3d_View) aView = aViewer->CreateView();
aView->SetWindow (aWindow);
~~~~
* The following changes should be made in the application-specific implementations of texture aspect:
* *Graphic3d_TextureRoot* inheritors now should return texture image by overloading of *Graphic3d_TextureRoot::GetImage()* method instead of the old logic.
* Now you can decide if the application should store the image copy as a field of property or reload it dynamically each time (to optimize the memory usage). The default implementation (which loads the image content from the provided file path) does not hold an extra copy since it will be uploaded to the graphic memory when first used.
* Notice that the image itself should be created within *Image_PixMap* class from *AlienImage* package, while *Image_Image* class is no more supported and will be removed in the next OCCT release.
@section upgrade_670 Upgrade to OCCT 6.7.0
Porting of user applications from an earlier OCCT version to version 6.7.0 requires taking into account the following major changes.
@subsection upgrade_670_clipping Object-level clipping and capping algorithm.
* It might be necessary to revise and port code related to management of view-level clipping to use *Graphic3d_ClipPlane* instead of *V3d_Plane* instances. Please note that *V3d_Plane* class has been preserved -- as previously, it can be used as plane representation. Another approach to represent *Graphic3d_ClipPlane* in a view is to use custom presentable object.
* The list of arguments of *Select3D_SensitiveEntity::Matches()* method for picking detection has changed. Since now, for correct selection clipping, the implementations should perform a depth clipping check and return (as output argument) minimum depth value found at the detected part of sensitive. Please refer to CDL / Doxygen documentation to find descriptive hints and snippets.
* *Select3D_SensitiveEntity::ComputeDepth()* abstract method has been removed. Custom implementations should provide depth checks by method *Matches()* instead -- all data required for it is available within a scope of single method.
* It might be necessary to revise the code of custom sensitive entities and port *Matches()* and *ComputeDepth()* methods to ensure proper selection clipping. Please note that obsolete signature of *Matches* is not used anymore by the selector. If your class inheriting *Select3D_SensitiveEntity* redefines the method with old signature the code should not compile as the return type has been changed. This is done to prevent override of removed methods.
@subsection upgrade_670_markers Redesign of markers presentation
* Due to the redesign of *Graphic3d_AspectMarker3d* class the code of custom markers initialization should be updated. Notice that you can reuse old markers definition code as *TColStd_HArray1OfByte*; however, *Image_PixMap* is now the preferred way (and supports full-color images on modern hardware).
* Logics and arguments of methods *AIS_InteractiveContext::Erase()* and *AIS_InteractiveContext::EraseAll()* have been changed. Now these methods do not remove resources from *Graphic3d_Structure*; they simply change the visibility flag in it. Therefore, the code that deletes and reсomputes resources should be revised.
* *Graphic3d_Group::MarkerSet()* has been removed. *Graphic3d_Group::AddPrimitiveArray()* should be used instead to specify marker(s) array.
@subsection upgrade_670_views Default views are not created automatically
As the obsolete methods *Init(), DefaultOrthographicView()* and *DefaultPerspectiveView()* have been removed from *V3d_Viewer* class, the two default views are no longer created automatically. It is obligatory to create *V3d_View* instances explicitly, either directly by operator new or by calling *V3d_Viewer::CreateView()*.
The call *V3d_Viewer::SetDefaultLights()* should also be done explicitly at the application level, if the application prefers to use the default light source configuration. Otherwise, the application itself should set up the light sources to obtain a correct 3D scene.
@subsection upgrade_670_dimensions Improved dimensions implementation
* It might be necessary to revise and port code related to management of *AIS_LengthDimension, AIS_AngleDimension* and *AIS_DiameterDimension* presentations. There is no more need to compute value of dimension and pass it as string to constructor argument. The value is computed internally. The custom value can be set with *SetCustomValue()* method.
* The definition of units and general aspect properties is now provided by *Prs3d_DimensionUnits* and *Prs3d_DimensionApsect* classes.
* It might be also necessary to revise code of your application related to usage of *AIS_DimensionDisplayMode enumeration*. If it used for specifying the selection mode, then it should be replaced by a more appropriate enumeration *AIS_DimensionSelectionMode*.
@subsection upgrade_670_list_collection NCollection_Set replaced by List collection
It might be necessary to revise your application code, which uses non-ordered *Graphic3d_SetOfHClipPlane* collection type and replace its occurrences by ordered *Graphic3d_SequenceOfHClipPlane* collection type.
@section upgrade_680 Upgrade to OCCT 6.8.0
Porting of user applications from an earlier OCCT version to version 6.8.0 requires taking into account the following major changes.
@subsection upgrade_680_ncollection Changes in NCollection classes
Method *Assign()* in *NCollection* classes does not allow any more copying between different collection types. Such copying should be done manually.
List and map classes in *NCollection* package now require that their items be copy-constructible, but do not require items to have default constructor. Thus the code using *NCollection* classes for non-copy-constructible objects needs be updated. One option is to provide copy constructor; another possibility is to use Handle or other smart pointer.
@subsection upgrade_680_view_camera 3D View Camera
If *ViewMapping* and *ViewOrientation* were used directly, this functionality has to be ported to the new camera model. The following methods should be considered as an alternative to the obsolete *Visual3d* services (all points and directions are supposed to be in world coordinates):
* *Graphic3d_Camera::ViewDimensions()* or *V3d_View::Size()/ZSize()* -- returns view width, height and depth (or "Z size"). Since the view is symmetric now, you can easily compute top, bottom, left and right limits. *Graphic3d_Camera::ZNear()/ZFar()* can be used to obtain the near and far clipping distances with respect to the eye.
* *Graphic3d_Camera::Up()* or *V3d_View::Up()* -- returns Y direction of the view.
* *Graphic3d_Camera::Direction()* returns the reverse view normal directed from the eye, *V3d_View::Proj()* returns the old-style view normal.
* *Graphic3d_Camera::Eye()* or *V3d_View::Eye()* -- returns the camera position (same as projection reference point in old implementation).
* *Graphic3d_Camera::Center()* or *V3d_View::At()* -- returns the point the camera looks at (or view reference point according to old terminology).
The current perspective model is not fully backward compatible, so the old perspective-related functionality needs to be reviewed.
Please revise application-specific custom presentations to provide proper bounding box. Otherwise object might become erroneously clipped by automatic *ZFit* or frustum culling algorithms enabled by default.
@subsection upgrade_680_connected_objects Redesign of Connected Interactive Objects
The new implementation of connected Interactive Objects makes it necessary to take the following steps if you use connected Interactive Objects in your application.
* Use new *PrsMgr_PresentableObject* transformation API.
* Call *RemoveChild()* from the original object after connect if you need the original object and *AIS_ConnectedInteractive* to move independently.
* Access instances of objects connected to *AIS_MultiplyConnectedInteractive* with *Children()* method.
* For *PrsMgr_PresentableObject* transformation:
* *SetLocation (TopLoc_Location) -> SetLocalTransformation (gp_Trsf)*
* *Location -> LocalTransformation*
* *HasLocation -> HasTransformation*
* *ResetLocation -> ResetTransformation*
@subsection upgrade_680_unicode Support of UNICODE Characters
Support of UNICODE characters introduced in OCCT breaks backward compatibility with applications, which currently use filenames in extended ASCII encoding bound to the current locale. Such applications should be updated to convert such strings to UTF-8 format.
The conversion from UTF-8 to wchar_t is made using little-endian approach. Thus, this code will not work correctly on big-endian platforms. It is needed to complete this in the way similar as it is done for binary persistence (see the macro *DO_INVERSE* in *FSD_FileHeader.hxx).*
@subsection upgrade_680_projection_shift Elimination of Projection Shift Concept
It might be necessary to revise the application code, which deals with *Center()* method of *V3d_View*.
This method was used to pan a *V3d* view by virtually moving the screen center with respect to the projection ray passed through Eye and At points. There is no more need to derive the panning from the Center parameter to get a camera-like eye position and look at the coordinates. *Eye()* and *At()* now return these coordinates directly. When porting code dealing with *Center()*, the parameters *Eye()* and *At()* can be adjusted instead. Also *V3d_View::SetCenter(Xpix, Ypix)* method can be used instead of *V3d_View::Center(X, Y)* to center the view at the given point. However, if the center coordinates X and Y come from older OCCT releases, calling *V3d_View::Panning(-X, -Y)* can be recommended to compensate missing projection shift effect.
There are several changes introduced to *Graphic3d_Camera*. The internal data structure of the camera is based on *Standard_Real* data types to avoid redundant application-level conversions and precision errors. The transformation matrices now can be evaluated both for *Standard_Real* and *Standard_ShortReal* value types. *ZNear* and *ZFar* planes can be either negative or positive for orthographic camera projection, providing a trade-off between the camera distance and the range of *ZNear* or *ZFar* to reduce difference of exponents of values composing the orientation matrix - to avoid calculation errors. The negative values can be specified to avoid Z-clipping if the reference system of camera goes inside of the model when decreasing camera distance.
The auto z fit mode, since now, has a parameter defining Z-range margin (the one which is usually passed as argument to *ZFitAll()* method). The methods *SetAutoZFitMode(), AutoZFitScaleFactor()* and *ZFitAll()* from class *V3d_View* deal with the new parameter.
The class *Select3D_Projector* now supports both orientation and projection transformation matrices, which can be naturally set for the projector. The definition of projector was revised in *StdSelect_ViewerSelector3d*: perspective and orthographic projection parameters are handled properly. Orthographic projector is based only on direction of projection - no more *Center* property. This makes it possible to avoid unnecessary re-projection of sensitive while panning, zooming or moving along the projection ray of the view. These operations do not affect the orthographic projection.
@section upgrade_690 Upgrade to OCCT 6.9.0
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_selection Changes in Selection
Selection mechanism of 3D Viewer has been redesigned to use 3-level BVH tree traverse directly in 3D space instead of projection onto 2D screen space (updated on each rotation). This architectural redesign may require appropriate changes at application level in case if custom Interactive Objects are used.
#### Standard selection
Usage of standard OCCT selection entities would require only minor updates.
Custom Interactive Objects should implement new virtual method *SelectMgr_SelectableObject::BoundingBox().*
Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example:
~~~~
Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
}
~~~~
#### Custom sensitive entities
Custom sensitive entities require more complex changes, since the selection algorithm has been redesigned and requires different output from the entities.
The method *SelectBasics_SensitiveEntity::Matches()* of the base class should be overridden following the new signature:
*Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult)*, where *theMgr* contains information about the currently selected frustum or set of frustums (see *SelectMgr_RectangularFrustum, SelectMgr_TrangularFrustum, SelectMgr_TriangularFrustumSet)* and *SelectBasics_PickResult* is an output parameter, containing information about the depth of the detected entity and distance to its center of geometry.
In the overridden method it is necessary to implement an algorithm of overlap and inclusion detection (the active mode is returned by *theMgr.IsOverlapAllowed()*) with triangular and rectangular frustums.
The depth and distance to the center of geometry must be calculated for the 3D projection of user-picked screen point in the world space. You may use already implemented overlap and inclusion detection methods for different primitives from *SelectMgr_RectangularFrustum* and *SelectMgr_TriangularFrustum*, including triangle, point, axis-aligned box, line segment and planar polygon.
Here is an example of overlap/inclusion test for a box:
~~~~
if (!theMgr.IsOverlapAllowed()) // check for inclusion
{
Standard_Boolean isInside = Standard_True;
return theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), &isInside) && isInside;
}
Standard_Real aDepth;
if (!theMgr.Overlaps (myBox, aDepth)) // check for overlap
{
return Standard_False;
}
thePickResult =
SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (myCenter3d));
~~~~
The interface of *SelectBasics_SensitiveEntity* now contains four new pure virtual functions that should be implemented by each custom sensitive:
* <i>BoundingBox()</i> returns a bounding box of the entity;
* <i>Clear()</i> clears up all the resources and memory allocated for complex sensitive entities;
* <i>BVH()</i> builds a BVH tree for complex sensitive entities, if it is needed;
* <i>NbSubElements()</i> returns atomic sub-entities of a complex sensitive entity, which will be used as primitives for BVH building. If the entity is simple and no BVH is required, this method returns 1.
Each sensitive entity now has its own tolerance, which can be overridden by method *SelectBasics_SensitiveEntity::SetSensitivityFactor()* called from constructor.
@subsection upgrade_690_adaptor3d-curve Changes in Adaptor3d_Curve class
All classes inheriting *Adaptor3d_Curve* (directly or indirectly) must be updated in application code to use new signature of methods *Intervals()* and *NbIntervals()*. Note that no compiler warning will be generated if this is not done.
@subsection upgrade_690_v3d_view Changes in V3d_View class
The methods *V3d_View::Convert* and *V3d_View::ConvertWithProj()* have ceased to return point on the active grid. It might be necessary to revise the code of your application so that *V3d_View::ConvertToGrid()* was called explicitly for the values returned by *V3d_View::Convert* to get analogous coordinates on the grid. The methods *V3d_View::Convert* and *V3d_View::ConvertWithProj* convert point into reference plane of the view corresponding to the intersection with the projection plane of the eye/view point vector.
@section upgrade_700 Upgrade to OCCT 7.0.0
Porting of user applications from an earlier OCCT version to version 7.0.0 requires taking into account the following major changes.
@subsection upgrade_700_persist Removal of legacy persistence
Legacy persistence for shapes and OCAF data based on *Storage_Schema* (toolkits *TKShapeShcema, TLStdLSchema, TKStdSchema* and *TKXCAFSchema*) has been removed in OCCT 7.0.0.
Legacy persistence for shapes and OCAF data based on *Storage_Schema* (toolkits *TKPShape*, *TKPLCAF*, *TKPCAF*, *TKShapeShcema, TLStdLSchema, TKStdSchema*, and *TKXCAFSchema*) has been removed in OCCT 7.0.0.
The applications that used these data persistence tools need to be updated to use other persistence mechanisms.
The existing data files in standard formats can be converted using OCCT 6.9.0 or a previous version, as follows.
@note For compatibility with previous versions, possibility to read standard OCAF data (TKLCAF, TKCAF) from the files stored in old format is preserved (toolkits *TKStdL*, *TKStd*).
The existing data files in standard formats can be converted using OCCT 6.9.1 or a previous version, as follows.
#### CSFDB files
@@ -47,7 +342,8 @@ The easiest way to do that is to use ImportExport sample provided with OCCT 6.9.
#### OCAF and XCAF documents
Files containing OCAF data saved in the old format usually have extensions <i>.std, .sgd</i> or <i>.dxc</i> (XDE documents).
These files can be converted to XML or binary OCAF formats using DRAW Test Harness commands available in OCCT 6.9.0 or earlier.
These files can be converted to XML or binary OCAF formats using DRAW Test Harness commands.
Note that if the file contains only attributes defined in TKLCAF and TKCAF, this action can be performed in OCCT 7.0; otherwise OCCT 6.9.1 or earlier should be used.
For that, start *DRAWEXE* and perform the following commands:
@@ -84,7 +380,7 @@ However, due to redesign of basic mechanisms (CDL generic classes, Handles and R
WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved.
The recommended method for building OCCT 7.x is CMake, see @ref occt_dev_guides__building_cmake.
The alternative solution is to use legacy generator of project files (extracted from WOK), see @ref occt_dev_guides__building_wok.
The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref occt_dev_guides__building_msvc, @ref occt_dev_guides__building_code_blocks, and @ref occt_dev_guides__building_xcode.
@subsubsection upgrade_occt700_cdl_auto Automatic upgrade
@@ -219,6 +515,8 @@ Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...);
func (aCurve); // ambiguity error in VC++ 10
~~~~~
Note that this problem can be avoided in many cases if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
To resolve this ambiguity, change your code so that argument type should correspond exactly to the function signature.
In some cases this can be done by using the relevant type for the corresponding variable, like in the example above:
@@ -262,6 +560,16 @@ or use variable of the appropriate type:
Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok
~~~~~
With GCC compiler, similar problem appears when const handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance:
~~~~~
const Handle(Geom_Line) aLine;
Handle(Geom_Curve) c1 = aLine; // GCC error
Handle(Geom_Curve) c2 (aLine); // ok
~~~~~
This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
#### Incorrect use of STANDARD_TYPE and Handle macros
You might need to clean your code from incorrect use of macros *STANDARD_TYPE*() and *Handle*().
@@ -310,6 +618,30 @@ os << aLine; // in OCCT 6.9.0, resolves to operator << (void*)
Call method <i>get()</i> explicitly to output the address of the Handle.
#### Method DownCast for non-base types
Method *DownCast()* in OCCT 7.0 is made templated; if it is used with argument which is not a base class, "deprecated" compiler warning is generated.
This is done to prevent possible unintended errors like this:
~~~~~
Handle(Geom_Surface) aSurf = ;
Handle(Geom_Line) aLine =
Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x
~~~~~
The places where this cast has been used should be corrected manually.
If down casting is used in a template context where argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.:
~~~~~
template <class T>
bool CheckLine (const Handle(T) theArg)
{
Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get());
...
}
~~~~~
@subsubsection upgrade_occt700_cdl_runtime Possible runtime problems
Here is the list of known possible problems at run time after the upgrade to OCCT 7.0.
@@ -317,7 +649,9 @@ Here is the list of known possible problems at run time after the upgrade to OCC
#### References to temporary objects
In previous versions, the compiler was able to detect the situation when a local variable of a "reference to a Handle" type is initialized by temporary object, and ensured that lifetime of that object is longer than that of the variable.
Since OCCT 7.0, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately.
In OCCT 7.0 with default options, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately.
This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compilation, see below.
Example:
@@ -328,6 +662,42 @@ Handle(Geom_TrimmedCurve)::DownCast(aCurve);
aBC->Transform (T); // access violation in OCCT 7.0
~~~~~
@subsubsection upgrade_occt700_cdl_nocast Option to avoid cast of handle to reference to base type
In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing hierarchy of corresponding object classes.
This automatically enabled possibility to use handle to derived class in all contexts where handle to base class was needed, e.g. pass it in function by reference without copying:
~~~~
Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve);
....
Handle(Geom_Line) aLine;
if (GetCurve (aLine)) {
// use aLine, unsafe
}
~~~~
This feature was used in multiple places in OCCT and dependent projects.
However it is potentially unsafe: in the above example no checks are done at compile time or at run time to ensure that argument handle is assigned a type compatible with the type of handle passed as argument.
If object of incompatible type (e.g. Geom_Circle) is assigned to *theCurve*, the behavior will be unpredictable.
For compatibility with existing code, by default OCCT 7.0 keeps this possibility, providing operators of type cast to handle to base type.
Besides being unsafe, in specific situations this feature may cause compile-time or run-time errors as described above.
In order to provide safer behavior, this feature can be disabled by defining a compile-time macro *OCCT_HANDLE_NOCAST*.
When it is defined, constructors and assignment operators are defined (instead of type cast operators) to convert from handle to defived type to handle to base type.
This implies creation of temporary objects and hence may be more expensive at run time in some circumstances, however this way is more standard, safer, and in general recommended.
The code that relies on possibility of casting to base should be amended so that handle of argument type is always used in function call, and to use DownCast() to safely convert the result to desired type.
For instance, the code from the example below can be changed as follows:
~~~~~
Handle(Geom_Line) aLine;
Handle(Geom_Curve) aCurve;
if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) {
// use aLine safely
}
~~~~~
@subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x
If you like to preserve the compatibility of your application code with OCCT versions 6.x even after the upgrade to 7.0, consider the following suggestions:
@@ -578,20 +948,26 @@ The main functionality provided by Local Context - selection of object subparts
@subsection upgrade_occt700_separate_caf_visualisation Separation of visualization part from TKCAF
Visualization CAF attributes moved into new toolkit TKVCAF.
If your application uses the classes from TPrsStd package then add link to TKVCAF library.
Visualization CAF attributes have been moved into a new toolkit *TKVCAF*.
If your application uses the classes from *TPrsStd* package then add link to *TKVCAF* library.
Verson numbers of BinOCAF and XmlOCAF formats are incremented; new files cannot be read by previous versions of OCCT.
Version numbers of *BinOCAF* and *XmlOCAF* formats are incremented; new files cannot be read by earlier versions of OCCT.
For loading OCAF files saved by previous versions and containing attribute TPrsStd_AISPresentation it is necessary that environment variable CSF_MIGRATION_TYPES should be defined, pointing to file src/StdResources/MigrationSheet.txt.
When using documents loaded from a file, make sure to call method TPrsStd_AISViewer::New() prior to accessing TPrsStd_AISPresentation attributes in this document (that method will create them).
Before loading the OCAF files saved by previous versions and containing *TPrsStd_AISPresentation* attribute it is necessary to define the environment variable *CSF_MIGRATION_TYPES*, pointing to file *src/StdResources/MigrationSheet.txt*.
When using documents loaded from a file, make sure to call method *TPrsStd_AISViewer::New()* prior to accessing *TPrsStd_AISPresentation* attributes in this document as that method creates them.
@subsection upgrade_euler_angles Correction of interpretation of Euler angles in gp_Quaternion
@subsection Correction of interpretation of Euler angles in gp_Quaternion
Conversion of *gp_Quaternion* to and from intrinsic Tait-Bryan angles (including *gp_YawPitchRoll*) is fixed.
Conversion of gp_Quaternion to and from intrinsic Tait-Bryan angles (including gp_YawPitchRoll) is fixed.
Before that fix the sequence of rotation axes was opposite to the intended; e.g. *gp_YawPitchRoll* (equivalent to *gp_Intrinsic_ZYX*) actually defined intrinsic rotations around X, then Y, then Z. Now the rotations are made in correct order.
Before that fix the sequence of rotation axes was opposite to intended; e.g. gp_YawPitchRoll (equivalent to gp_Intrinsic_ZYX) actually was defining intrinsic rotations around X, then Y, then Z.
Now this is fixed, and rotations are made in correct order.
Applications that use *gp_Quaternion* to convert Yaw-Pitch-Roll angles (or other intrinsic Tait-Bryan sequences) may need to be updated to take this change into account.
Applications that use gp_Quaternion to convert Yaw-Pitch-Roll angles (or other intrinsic Tait-Bryan sequences) may need to be updated to take this change into account.
@subsection upgrade_zoom_persistent_selection Zoom Persistent Selection
Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* for transform persistence methods and parameters and a new class *Graphic3d_WorldViewProjState* for referring camera transformation state. You might need to update your code to deal with the new classes if you were using the related features. Please, keep in mind the following:
* *Graphic3d_Camera::ModelViewState* has been renamed to *Graphic3d_Camera::WorldViewState*.
* 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.

View File

@@ -19,7 +19,7 @@ modeling (CAD), manufacturing / measuring (CAM) or numerical simulation (CAE).
@section OCCT_OVW_SECTION_2 Copyrights
Open CASCADE Technology and all materials, including this documentation, is
Copyright (c) 1999-2015 by OPEN CASCADE S.A.S. All rights reserved.
Copyright (c) 1999-2016 by OPEN CASCADE S.A.S. All rights reserved.
@htmlonly<center>@endhtmlonly
http://www.opencascade.com
@@ -73,7 +73,7 @@ and, in case you need any further information, directly contact their authors.
**Qt** is a cross-platform application framework that is widely used for developing application software
with graphical user interface (GUI). Qt is free and open source software distributed under
the terms of the GNU Lesser General Public License. In OCCT Qt is used for programming samples.
If you need further information on Qt, please, refer to Qt Homepage (http://qt.digia.com).
If you need further information on Qt, please, refer to Qt Homepage (http://www.qt.io/)
**Tcl** is a high-level programming language. Tk is a graphical user interface (GUI) toolkit,
with buttons, menus, listboxes, scrollbars, and so on. Taken together Tcl and Tk provide a solution
@@ -107,9 +107,6 @@ Threading Building Blocks is not just a threads-replacement library. It represen
abstracts platform details and threading mechanisms for scalability and performance.
TBB is available under GPLv2 license with the runtime exception.
Open CASCADE Technology WOK module on Windows also makes use of LGPL-licensed C routines **regexp**
and **getopt**, taken from GNU C library.
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
implementation of 3D viewer. OpenGL specification is developed by the
Khronos group, http://www.khronos.org/opengl/. OCCT code includes header
@@ -199,17 +196,18 @@ for which OCCT is certified to work.
| Linux | Mandriva 2010, CentOS 6.3, Fedora 18, Ubuntu 14.10 - 15.10, Debian 6.0, Debian 7.0 |
| OS X | 10.10 Yosemite / 10.9 Mavericks / 10.8 Mountain Lion / 10.7 Lion |
| Android | 6.x, 5.x, 4.0.4+ |
| iOS | iOS 7 |
@subsection overview_req_cpp C++ Compiler / IDE
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2010 SP1\*, 2012 Update 4, 2013 Update 5, 2015 <br> Intel C++ Composer XE 2013 SP1 |
| Windows | Microsoft Visual Studio: 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015 <br> Intel C++ Composer XE 2013 SP1 <br> GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |
* VC++ 10 64-bit is used for regular testing and for building
1) VC++ 10 64-bit is used for regular testing and for building
binary package of official release of OCCT on Windows.
@subsection overview_req_libs Third-party libraries
@@ -218,12 +216,13 @@ for which OCCT is certified to work.
| --------- | ----------- |
| Graphic library | OpenGL 3.3+, OpenGL ES 2.0+ <br> Direct3D 9 |
| Qt (for samples and demos) | Desktop: Qt 4.8.6+ http://www.qt.io/download/ <br> Android: Qt 5.3.2+ http://www.qt.io/download/ |
| TCL (for testing tools) | Tcl/Tk 8.6.3+ http://www.tcl.tk/software/tcltk/download.html |
| Freetype (for text rendering) | freetype-2.5.3+ http://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.16.0+ http://sourceforge.net/projects/freeimage/files |
| TCL (for testing tools) | Tcl/Tk 8.6.3+ http://www.tcl.tk/software/tcltk/download.html <br> or ActiveTcl 8.6 http://www.activestate.com/activetcl/downloads (for Windows)|
| Freetype (for text rendering) | FreeType 2.4.11-2.5.5 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.17.0+ http://sourceforge.net/projects/freeimage/files |
| gl2ps (optional, for export contents of OCCT viewer to vector formats) | gl2ps-1.3.8+ http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 4.x or 5.x http://www.threadingbuildingblocks.org/ |
| VTK (for VTK Integration Services | VTK 6.1+ http://www.vtk.org/VTK/resources/software.html |
| Doxygen (optional for building documentation) | Doxygen 1.8.5+ http://www.stack.nl/~dimitri/doxygen/download.html |
@subsection overview_req_hw Hardware
@@ -233,8 +232,8 @@ for which OCCT is certified to work.
| Free disk space (complete installation) | 600 MB approx. |
On desktop, 3D viewer for optimal performance requires graphics processing unit (GPU) supporting OpenGL 3.3 or above.
Ray tracing requires OpenGL 4.0+ or OpenGL 3.3+ with GL_ARB_texture_buffer_object_rgb32 extension.
Textures within ray tracing will be available only when GL_ARB_bindless_texture extension is provided by driver.
Ray tracing requires OpenGL 4.0+ or OpenGL 3.3+ with *GL_ARB_texture_buffer_object_rgb32* extension.
Textures within ray tracing will be available only when *GL_ARB_bindless_texture extension* is provided by driver.
On mobile platforms, OpenGL ES 2.0+ is required for 3D viewer. The ray tracing is not yet available on mobile platforms.
Some old hardware might be unable to execute complex GLSL programs (e.g. with high number of light sources, clipping planes).
@@ -286,7 +285,7 @@ When the installation is complete, you will find the directories for 3rd party p
@image html /overview/images/overview_3rdparty.png
@image latex /overview/images/overview_3rdparty.png
The contents of the OCCT-6.9.0 directory (called further "OCCT root", or $CASROOT) are as follows:
The contents of the OCCT-7.0.0 directory (called further "OCCT root", or $CASROOT) are as follows:
@image html /overview/images/overview_installation.png "The directory tree"
@image latex /overview/images/overview_installation.png "The directory tree"
@@ -297,8 +296,7 @@ The contents of the OCCT-6.9.0 directory (called further "OCCT root", or $CASROO
* **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality;
* **doc** This folder contains OCCT documentation in HTML and PDF format;
* **dox** This folder contains sources of OCCT documentation in plain text (MarkDown) format;
* **drv** This folder contains source files generated by WOK (private header files and instantiations of generic classes);
* **inc** This folder contains all OCCT header files;
* **inc** This folder contains copies of all OCCT header files;
* **samples** This folder contains sample applications.
* **src** This folder contains OCCT source files. They are organized in folders, one per development unit;
* **tests** This folder contains scripts for OCCT testing.
@@ -339,7 +337,7 @@ The scripts are located in the OCCT root folder.
* **MMGT_OPT** (optional) if set to 1, the memory manager performs optimizations as described below; if set to 2,
Intel (R) TBB optimized memory manager is used; if 0 (default), every memory block is allocated
in C memory heap directly (via malloc() and free() functions).
In the latter case, all other options except MMGT_CLEAR are ignored;
In the latter case, all other options starting with *MMGT*, except MMGT_CLEAR, are ignored;
* **MMGT_CLEAR** (optional) if set to 1 (default), every allocated memory block is cleared by zeros;
if set to 0, memory block is returned as it is;
* **MMGT_CELLSIZE** (optional) defines the maximal size of blocks allocated in large pools of memory. Default is 200;
@@ -350,21 +348,18 @@ The scripts are located in the OCCT root folder.
* **MMGT_MMAP** (optional) when set to 1 (default), large memory blocks are allocated using
memory mapping functions of the operating system; if set to 0,
they will be allocated in the C heap by malloc();
* **CSF_LANGUAGE** is required to define the default language of messages;
* **CSF_LANGUAGE** (optional) defines default language of messages;
* **CSF_DEBUG** (optional, Windows only): if defined then a diagnostic message is displayed in case of an exception;
* **CSF_DEBUG_BOP** (optional): if defined then it should specify directory where diagnostic data on problems occured in Boolean operations will be saved;
* **CSF_MDTVTexturesDirectory** defines the directory for available textures when using texture mapping;
* **CSF_ShadersDirectory** defines the directory for GLSL programs (required for advanced rendering techniques and custom shaders);
* **CSF_UnitsDefinition** and **CSF_UnitsLexicon** should define paths to resource files Lexi_Expr.dat and Units.dat, respectively, required for support of measurement units;
* **CSF_SHMessage** is required in order to define the path to the messages file for *ShapeHealing*;
* **CSF_XSMessage** is required in order to define the path to the messages file for **STEP** and **IGES** translators;
* **CSF_StandardDefaults** and **CSF_PluginDefaults** are required in order to maintain CASCADE Persistence mechanism to make possible any open/save operations with OCAF documents;
* **CSF_StandardLiteDefaults** is required in order to maintain *OCCT Persistence mechanism* to make possible any open/save operations with Lite OCAF documents;
* **CSF_XCAFDefaults** any open/save operations for **XDE** documents;
* **CSF_IGESDefaults** and **CSF_STEPDefaults** are required for **IGES** and **STEP** translators correspondingly in order to define the path to the resource files;
* **CSF_ShadersDirectory** defines the directory for GLSL programs (required for 3D viewer to work);
* **CSF_UnitsDefinition** and **CSF_UnitsLexicon** should define paths to resource files Lexi_Expr.dat and Units.dat, respectively (required for support of measurement units);
* **CSF_SHMessage** defines the path to the messages file for *ShapeHealing*;
* **CSF_XSMessage** defines the path to the messages file for **STEP** and **IGES** translators;
* **CSF_StandardDefaults**, **CSF_StandardLiteDefaults*, **CSF_XCAFDefaults**, and **CSF_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents);
* **CSF_IGESDefaults** and **CSF_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located;
* **CSF_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar.
* **CSF_MIGRATION_TYPES** is required in order to read documents that contain old data types, such as *TDataStd_Shape*;
* **TCLLIBPATH**, **TCL_LIBRARY**, **TK_LIBRARY** and **TIX_LIBRARY** are required to allow work with **DRAW** and **WOK**.
@section OCCT_OVW_SECTION_7 Getting Started
@@ -394,14 +389,14 @@ Draw contains:
You can add new custom test harness commands to Draw in order to test
or demonstrate a new functionality, which you are developing.
Currently DRAW Test Harness is a single executable called DRAWEXE.
Currently DRAW Test Harness is a single executable called *DRAWEXE*.
Commands grouped in toolkits can be loaded at run-time thereby implementing dynamically loaded plug-ins.
Thus you can work only with the commands that suit your needs adding
the commands dynamically without leaving the Test Harness session.
Declaration of available plug-ins is done through special resource file(s).
The pload command loads the plug-in in accordance with
The *pload* command loads the plug-in in accordance with
the specified resource file and activates the commands implemented in the plug-in.
The whole process of using the plug-in mechanism as well as the instructions for extending Test Harness is described in the @ref occt_user_guides__test_harness.

View File

@@ -1065,7 +1065,7 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
* For Boolean operation Fuse all arguments should have equal dimensions.
* For Boolean operation Cut the minimal dimension of *S2* should not be less than the maximal dimension of *S1*.
* For Boolean operation Common the arguments could have any dimension.
* For Boolean operation Common the arguments can have any dimension.
@subsection occt_algorithms_9_3 Results. General Rules
@@ -1074,12 +1074,12 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
* The result of the operation Fuse is defined for arguments *S1* and *S2* that have the same dimension value : *Dim(S1)=Dim(S2)*. If the arguments have different dimension values the result of the operation Fuse is not defined. The dimension of the result is equal to the dimension of the arguments. For example, it is impossible to fuse an edge and a face.
* The result of the operation Fuse for arguments *S1* and *S2* contains the parts of arguments that have states **OUT** relative to the opposite arguments.
* The result of the operation Fuse for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
* The result of the operation Common for the arguments *S1* and *S2* contains the parts of the argument that have states **IN** and **ON** relative to the opposite argument.
* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
* The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
* The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
* For the argumenst of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be compound containing Wire.
* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be a compound containing Wire.
@subsection occt_algorithms_9_4 Examples
@@ -1540,7 +1540,7 @@ Let us consider Shell *Sh* and Wire *W* as the objects and Solid *S* as the tool
@figure{/user_guides/boolean_operations/images/boolean_image138.png}
* The result of *Cut21* operation is not defined as the objects have lower dimension than the tool.
* The result of *Cut21* operation is not defined as the objects have a lower dimension than the tool.
@subsection occt_algorithms_9_5 Class BOPAlgo_BOP

View File

@@ -1282,11 +1282,15 @@ Syntax:
~~~~~
vinit
~~~~~
Creates new View window with specified name view_name.
By default the new view is created in the viewer and in graphic driver shared with active view.
* *name* = {driverName/viewerName/viewName | viewerName/viewName | viewName}.
If driverName isn't specified the driver will be shared with active view.
If viewerName isn't specified the viewer will be shared with active view.
Creates a new View window with the specified *view_name*.
By default the view is created in the viewer and in the graphic driver shared with the active view.
~~~~
name = {driverName/viewerName/viewName | viewerName/viewName | viewName}
~~~~
If *driverName* is not specified the driver will be shared with the active view.
If *viewerName* is not specified the viewer will be shared with the active view.
@subsubsection occt_draw_4_2_2 vhelp
@@ -1361,7 +1365,7 @@ Syntax:
~~~~~
vrepaint
~~~~~
Forcebly redisplays the shape in the 3D viewer window.
Forcibly redisplays the shape in the 3D viewer window.
@subsubsection occt_draw_4_2_8 vfit
@@ -1401,7 +1405,7 @@ Emulates different types of selection:
* single mouse click selection
* selection with a rectangle having the upper left and bottom right corners in <i>(x1,y1)</i> and <i>(x2,y2)</i> respectively
* selection with a polygon having the corners in pixel positions <i>(x1,y1), (x2,y2),…, (xn,yn)</i>
* -allowoverlap manages overlap and inclusion detection in rectangular selection. If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined rectangle will be detected, otherwise algorithm will chose only fully included sensitives. Default behavior is to detect only full inclusion.
* <i> -allowoverlap </i> manages overlap and inclusion detection in rectangular selection. If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined rectangle will be detected, otherwise algorithm will chose only fully included sensitives. Default behavior is to detect only full inclusion.
* any of these selections if shift_selection is set to 1.
@subsubsection occt_draw_4_2_12 vmoveto
@@ -1419,15 +1423,15 @@ Syntax:
~~~~~
vviewparams [-scale [s]] [-eye [x y z]] [-at [x y z]] [-up [x y z]] [-proj [x y z]] [-center x y] [-size sx]
~~~~~
Gets or sets current view parameters.
Gets or sets the current view parameters.
* If called without arguments, all view parameters are printed.
* The options are:
* -scale [s] : prints or sets viewport relative scale.
* -eye [x y z] : prints or sets eye location.
* -at [x y z] : prints or sets center of look.
* -up [x y z] : prints or sets direction of up vector.
* -proj [x y z] : prints or sets direction of look.
* -center x y : sets location of center of the screen in pixels.
* -scale [s] : prints or sets the relative scale of viewport.
* -eye [x y z] : prints or sets the eye location.
* -at [x y z] : prints or sets the view center.
* -up [x y z] : prints or sets the up vector direction.
* -proj [x y z] : prints or sets the view direction.
* -center x y : sets the screen center location in pixels.
* -size [sx] : prints viewport projection width and height sizes or changes the size of its maximum dimension.
@subsubsection occt_draw_4_2_14 vchangeselected
@@ -1480,8 +1484,8 @@ Syntax:
vhlr is_enabled={on|off} [show_hidden={1|0}]
~~~~~
Hidden line removal algorithm:
* is_enabled: if is on HLR algorithm is applied.
* show_hidden: if equals to 1, hidden lines are drawn as dotted ones.
* <i>is_enabled</i> applies HLR algorithm.
* <i>show_hidden</i> if equals to 1, hidden lines are drawn as dotted ones.
@subsubsection occt_draw_4_2_20 vhlrtype
@@ -1509,22 +1513,25 @@ vcamera [-ortho] [-projtype]
[-zfocus [Value]] [-zfocusType [absolute|relative]]
~~~~~
Manage camera parameters.
Prints current value when option called without argument.
Manages camera parameters.
Prints the current value when the option is called without argument.
Orthographic camera:
* -ortho activate orthographic projection
* -ortho -- activates orthographic projection.
Perspective camera:
* -persp activate perspective projection (mono)
* -fovy field of view in y axis, in degrees
* -distance distance of eye from camera center
* -persp -- activated perspective projection (mono);
* -fovy -- field of view in y axis, in degrees;
* -distance -- distance of eye from the camera center.
Stereoscopic camera:
* -stereo perspective projection (stereo)
* -leftEye perspective projection (left eye)
* -rightEye perspective projection (right eye)
* -iod intraocular distance value
* -iodType distance type, absolute or relative
* -zfocus stereographic focus value
* -zfocusType focus type, absolute or relative"
* -stereo -- perspective projection (stereo);
* -leftEye -- perspective projection (left eye);
* -rightEye -- perspective projection (right eye);
* -iod -- intraocular distance value;
* -iodType -- distance type, absolute or relative;
* -zfocus -- stereographic focus value;
* -zfocusType -- focus type, absolute or relative.
**Example:**
~~~~~
@@ -1542,17 +1549,16 @@ Syntax:
vstereo [0|1] [-mode Mode] [-reverse {0|1}] [-anaglyph Filter]
~~~~~
Control stereo output mode.
Available modes for -mode:
* quadBuffer -- OpenGL QuadBuffer stereo, requires driver support. Should be called BEFORE vinit!
* anaglyph -- Anaglyph glasses
* rowInterlaced -- row-interlaced display
* columnInterlaced -- column-interlaced display
* chessBoard -- chess-board output
* sideBySide -- horizontal pair
* overUnder -- vertical pair
Defines the stereo output mode. The following modes are available:
* quadBuffer -- OpenGL QuadBuffer stereo, requires driver support. Should be called BEFORE *vinit*!
* anaglyph -- Anaglyph glasses;
* rowInterlaced -- row-interlaced display;
* columnInterlaced -- column-interlaced display;
* chessBoard -- chess-board output;
* sideBySide -- horizontal pair;
* overUnder -- vertical pair;
Available Anaglyph filters for -anaglyph:
* redCyan, redCyanSimple, yellowBlue, yellowBlueSimple, greenMagentaSimple
* redCyan, redCyanSimple, yellowBlue, yellowBlueSimple, greenMagentaSimple.
**Example:**
~~~~~
@@ -1591,19 +1597,19 @@ vdisplay [-noupdate|-update] [-local] [-mutable] [-neutral]
~~~~~
Displays named objects.
Option -local enables displaying of objects in local selection context.
Option <i>-local</i> enables display of objects in the local selection context.
Local selection context will be opened if there is not any.
* *noupdate* suppresses viewer redraw call.
* *mutable* enables optimizations for mutable objects.
* *neutral* draws objects in main viewer.
* *layer* sets z-layer for objects. It can use '-overlay|-underlay|-top|-topmost' instead of '-layer index' for the default z-layers.
* *top* draws objects on top of main presentations but below topmost.
* *mutable* enables optimization for mutable objects.
* *neutral* draws objects in the main viewer.
* *layer* sets z-layer for objects. It can use <i>-overlay|-underlay|-top|-topmost</i> instead of <i>-layer index</i> for the default z-layers.
* *top* draws objects on top of main presentations but below the topmost level.
* *topmost* draws in overlay for 3D presentations with independent Depth.
* *overlay* draws objects in overlay for 2D presentations (On-Screen-Display).
* *underlay* draws objects in underlay for 2D presentations (On-Screen-Display).
* *selectable|-noselect* controls selection of objects.
* *trsfPers* sets a transform persistence flags. Flag 'full' is pan, zoom and rotate.
* *trsfPers* sets transform persistence flags. Flag *full* allows to pan, zoom and rotate.
* *trsfPersPos* sets an anchor point for transform persistence.
* *2d|-2dTopDown* displays object in screen coordinates.
* *dispmode* sets display mode for objects.
@@ -1645,7 +1651,7 @@ vdisplayall [-local]
~~~~~
Displays all erased interactive objects (see vdir and vstate).
Option -local enables displaying of the objects in local selection context.
Option <i>-local</i> enables displaying objects in the local selection context.
**Example:**
~~~~~
@@ -1773,10 +1779,10 @@ vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]
~~~~~
Manage presentation properties of all, selected or named objects.
When *-subshapes* is specified than following properties will be assigned to specified sub-shapes.
When *-defaults* is specified than presentation properties will be assigned to all objects that have not their own specified properties and to all objects to be displayed in the future.
If *-defaults* is used there should not be any names of objects and *-subshapes* specifier.
Manages presentation properties of all, selected or named objects.
* *-subshapes* -- assigns presentation properties to the specified sub-shapes.
* *-defaults* -- assigns presentation properties to all objects that do not have their own specified properties and to all objects to be displayed in the future.
If *-defaults* option is used there should not be any names of objects and *-subshapes* specifier.
Aliases:
~~~~~
@@ -2008,7 +2014,7 @@ Syntax:
vstate [-entities] [-hasSelected] [name1] ... [nameN]
~~~~~
Reports show/hidden state for selected or named objects
Reports show/hidden state for selected or named objects:
* *entities* -- prints low-level information about detected entities;
* *hasSelected* -- prints 1 if the context has a selected shape and 0 otherwise.
@@ -2044,8 +2050,8 @@ Manages rendering parameters:
* env -- Enables/disables environment map background
* shadingModel -- Controls shading model from enumeration color, flat, gouraud, phong
Unlike vcaps, these parameters dramatically change visual properties.
Command is intended to control presentation quality depending on hardware capabilities and performance.
Unlike *vcaps*, these parameters dramatically change visual properties.
The command is intended to control presentation quality depending on hardware capabilities and performance.
**Example:**
~~~~~
@@ -2106,7 +2112,7 @@ Syntax:
vplanetri name
~~~~~
Create a plane from a trihedron selection. If no arguments are set, the default
Creates a plane from a trihedron selection. If no arguments are set, the default plane is created.
@subsubsection occt_draw_4_4_3 vsize
@@ -2273,7 +2279,7 @@ vselmode [object] mode_number is_turned_on=(1|0)
~~~~~
Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
*Mode_number* is non-negative integer that has different meaning for different interactive object classes.
*Mode_number* is a non-negative integer encoding different interactive object classes.
For shapes the following *mode_number* values are allowed:
* 0 -- shape
* 1 -- vertex
@@ -2304,7 +2310,7 @@ Syntax:
vconnect vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
~~~~~
Creates and displays AIS_ConnectedInteractive object from input object and location
Creates *AIS_ConnectedInteractive* object from the input object and location and displays it.
**Example:**
~~~~~
@@ -2359,20 +2365,20 @@ Syntax:
vpointcloud name shape [-randColor] [-normals] [-noNormals]
~~~~~
Creates an interactive object for an arbitary set of points from the triangulated shape.
Creates an interactive object for an arbitrary set of points from the triangulated shape.
Additional options:
* *randColor* -- generate random color per point
* *normals* -- generate normal per point (default)
* *noNormals* -- do not generate normal per point
* *randColor* -- generates a random color per point;
* *normals* -- generates a normal per point (default);
* *noNormals* -- does not generate a normal per point.
~~~~~
vpointcloud name x y z r npts {surface|volume} [-randColor] [-normals] [-noNormals]
~~~~~
Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r).
Additional options:
* *randColor* -- generate random color per point
* *normals* -- generate normal per point (default)
* *noNormals* -- do not generate normal per point
* *randColor* -- generates a random color per point;
* *normals* -- generates a normal per point (default);
* *noNormals* -- does not generate a normal per point.
**Example:**
~~~~~

View File

@@ -124,38 +124,8 @@ The fundamental software component in object-oriented software development is t
Classes fall into three categories:
* Ordinary classes.
* Deferred classes. A **deferred class** cannot be instantiated. The purpose of having such classes is to have a given behavior shared by a hierarchy of classes and dependent on the implementation of the descendants. This is a way of guaranteeing a certain base of inherited behavior common to all the classes based on a particular deferred class. The C++ equivalent of a deferred CDL class is an abstract class.
* Generic classes. A **generic class** offers a set of functional behaviors to manipulate other data types. Instantiation of a generic class requires that a data type is given for its argument(s). The generic classes in CDL perform the same mission as template classes in C++.
@subsubsection occt_fcug_2_a_4 Generic Classes
Generic classes are implemented in two steps. First you declare the generic class to establish the model, then you instantiate this class by giving information about the generic types.
#### Declaring a Generic Class
The generic classes in Open CASCADE Technology are similar by their intent to C++ templates with explicit instantiation.
A generic class is declared in CDL as operating on data items of non-fixed types which are declared as arguments of the generic class. It is possible to put a restriction on these data types to be of subtype of some definite class. Definition of the generic class does not create new class type in C++ terms; it only defines a pattern for generation (instantiation) of the real classes.
#### Instantiation of a Generic Class
When a generic class is instantiated, its argument types are substituted by actually existing data types (elementary types or classes). The result of instantiation is a new C++ class with an arbitrary name (specified in the instantiating declaration). By convention, the name of the instantiated class is usually constructed from the name of the generic class and names of actual argument types. As for any other class, the name of the class instantiating a generic type is prefixed by the name of the package in which instantiation is declared.
@code
class Array1OfReal instantiates Array1 from TCollection (Real);
@endcode
This declaration located in a CDL file of the *TColStd* package defines a new C++ class *TColStd_Array1OfReal* as the instantiation of generic class *TCollection_Array1* for *Real* values.
More than one class can be instantiated from the same generic class with the same argument types. Such classes will be identical by implementation, but considered as two different classes by C++.
No class can inherit from a generic class.
A generic class can be a deferred class. A generic class can also accept a deferred class as its argument. In both these cases, any class instantiated from it will also be deferred. The resulting class can then be inherited by another class.
#### Nested Generic Classes
It often happens that many classes are linked by a common generic type. This is the case when a base structure furnishes an iterator. In this context, it is necessary to make sure that the group of linked generic classes is indeed instantiated for the same type of object. In order to group the instantiation, you may declare certain classes as being nested.
When generic class is instantiated, its nested classes are instantiated as well. The name of the instantiation of the nested class is constructed from the name of that nested class and name of the main generic class, connected by Of.
@code
class MapOfReal instantiates Map from TCollection (Real,MapRealHasher);
@endcode
This declaration in *TColStd* defines not only class *TColStd_MapOfReal*, but also class *TColStd_MapIteratorOfMapOfReal*, which is instantiated from nested class *MapIterator* of the generic class *TCollection_Map*. Note that instantiation of the nested class is separate class, it is not nested class to the instantiation of the main class.
**Nested classes**, even though they are described as non-generic classes, are generic by construction being inside the class they are a member of.
* Abstract classes. An **abstract class** cannot be instantiated. The purpose of having such classes is to have a given behavior shared by a hierarchy of classes and dependent on the implementation of the descendants. This is a way of guaranteeing a certain base of inherited behavior common to all the classes based on a particular deferred class.
* Template classes. A **template class** offers a set of functional behaviors to manipulate other data types. Instantiation of a template class requires that a data type is given for its argument(s).
@subsubsection occt_fcug_2_a_5 Inheritance
The purpose of inheritance is to reduce the development workload. The inheritance mechanism allows a new class to be declared already containing the characteristics of an existing class. This new class can then be rapidly specialized for the task in hand. This avoids the necessity of developing each component “from scratch”.
@@ -163,16 +133,7 @@ For example, having already developed a class *BankAccount* you could quickly s
The corollary of this is that when two or more classes inherit from a parent (or ancestor) class, all these classes guarantee as a minimum the behavior of their parent (or ancestor). For example, if the parent class BankAccount contains the method Print which tells it to print itself out, then all its descendant classes guarantee to offer the same service.
One way of ensuring the use of inheritance is to declare classes at the top of a hierarchy as being **deferred**. In such classes, the methods are not implemented. This forces the user to create a new class which redefines the methods. This is a way of guaranteeing a certain minimum of behavior among descendant classes.
@subsection occt_fcug_2_b Persistence and Data Schema
The data schema is the structure used by an application to store its data. Data schemas consist of persistent classes.
An object is called **persistent** if it can be permanently stored. Thus, the object can be reused at a later date by the application, which created it, or by another application.
In order for an object to be persistent for CDL, its type must be declared as inheriting from the class *Standard_Persistent* or have a parent class inheriting from the *Standard_Persistent* class. Note that classes inheriting from *Standard_Persistent* are handled by a reference.
Objects instantiated from classes which inherit from the Standard_Storable class cannot themselves be stored individually, but they can be stored as fields of an object which inherits from *Standard_Persistent*. Note that objects inheriting from *Standard_Storable* are handled by a value.
One way of ensuring the use of inheritance is to declare classes at the top of a hierarchy as being **abstract**. In such classes, the methods are not implemented. This forces the user to create a new class which redefines the methods. This is a way of guaranteeing a certain minimum of behavior among descendant classes.
@subsection occt_fcug_2_1 Data Types
@@ -203,19 +164,17 @@ In Open CASCADE Technology, the Handles are specific classes that are used to s
@subsubsection occt_fcug_2_1_1 Primitive Types
The primitive types are predefined in the language and they are **manipulated by value**.
Some of these primitives inherit from the **Storable** class. This means they can be used in the implementation of persistent objects, either contained in entities declared within the methods of the object, or they form part of the internal representation of the object.
The primitives inheriting from *Standard_Storable* are the following:
* **Boolean** is used to represent logical data. It may have only two values: *Standard_True* and *Standard_False*.
* **Character** designates any ASCII character.
* **ExtCharacter** is an extended character.
* **Integer** is a whole number.
* **Real** denotes a real number (i.e. one with whole and a fractional part, either of which may be null).
* **ShortReal** is a real with a smaller choice of values and memory size.
There are also non-Storable primitives. They are:
* **CString** is used for literal constants.
* **ExtString** is an extended string.
* **Address** represents a byte address of undetermined size.
The services offered by each of these types are described in the **Standard** Package.
The table below presents the equivalence existing between C++ fundamental types and OCCT primitive types.
@@ -251,31 +210,21 @@ The table below presents the equivalence existing between C++ fundamental types
There are three categories of types which are manipulated by value:
* Primitive types
* Enumerated types
* Types defined by classes not inheriting from *Standard_Persistent* or *Standard_Transient*, whether directly or not.
* Types defined by classes not inheriting from *Standard_Transient*, whether directly or not.
Types which are manipulated by value behave in a more direct fashion than those manipulated by handle and thus can be expected to perform operations faster, but they cannot be stored independently in a file.
@image html /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value"
@image latex /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value"
Types that are known to the schema (i.e. they are either **primitives** or they inherit from *Storable*) and are manipulated by value, can be stored inside a persistent object as part of the representation. Only in this way can a “manipulated by value” object be stored in a file.
@subsubsection occt_fcug_2_1_3 Types manipulated by reference (handle)
There are two categories of types which are manipulated by handle:
* Types defined by classes inheriting from the *Persistent* class, which are therefore storable in a file.
* Types defined by classes inheriting from the *Transient* class.
These are types defined by classes inheriting from the *Transient* class.
@image html /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@image latex /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@subsubsection occt_fcug_2_1_4 When is it necessary to use a handle?
The following table summarizes how various data types are handled and stored.
| Type | Manipulated by handle | Manipulated by value |
| :------- | :-------------------- | :-------------------- |
| storable | Persistent | Primitive, Storable (if nested in a persistent class)|
|temporary | Transient | Other |
When you design an object, it can be difficult to choose how to manipulate that
object: by value or by handle. The following ideas can help you to make up your mind:
@@ -296,21 +245,27 @@ global variable.
@subsubsection occt_fcug_2_2_1 Handle Definition
A handle may be compared with a C++ pointer. Several handles can reference the same object. Also, a single handle may reference several objects, but only one at a time. To have access to the object it refers to, the handle must be de-referenced just as with a C++ pointer.
Transient and Persistent classes may be manipulated either with handles or with values. Handles which reference non-persistent objects are called non-storable handles; therefore, a persistent object cannot contain a non-storable handle.
A handle is OCCT implementation of a smart pointer.
Several handles can reference the same object.
Also, a single handle may reference several objects, but only one at a time.
To have access to the object it refers to, the handle must be de-referenced just as with a C++ pointer.
#### Organization of Classes
Classes used with handles are persistent or transient.
Classes that inherit from *Standard_Transient* are transient while classes that inherit from *Standard_Persistent* are persistent.
In this chapter we will discuss only transient classes and relevant handles. Persistent classes and their handles are organized in a similar manner.
Class *Standard_Transient* is a root of a big hierarchy of OCCT classes that are said to be operable by handles. It provides a reference counter field, inherited by all its descendant classes, that is used by associated *Handle()* classes to track a number of handles pointing to this instance of the object.
For every class derived (directly or indirectly) from *Transient*, CDL extractor creates associated class *Handle()* whose name is the same as the name of that class prefixed by *Handle_*. Open CASCADE Technology provides preprocessor macro *Handle()* that produces a name of a *Handle()* class for a given transient class name.
Objects of classes derived (directly or indirectly) from *Transient*, are normally allocated in dynamic memory using operator **new**, and manipulated by handle.
Handle is defined as template class *opencascade::handle<>*.
Open CASCADE Technology provides preprocessor macro *Handle()* that is historically used throughout OCCT code to name a handle:
~~~~~{.cpp}
Handle(Geom_Line) aLine; // "Handle(Geom_Line)" is expanded to "opencascade::handleL<Geom_Line>"
~~~~~
In addition, for standard OCCT classes additional typedef is defined for a handle, as name of a class prefixed by *Handle_*.
For instance, above example can be also coded as:
~~~~~{.cpp}
Handle_Geom_Line aLine; // "Handle_Geom_Line" is typedef to "opencascade::handleL<Geom_Line>"
~~~~~
#### Using a Handle
@@ -329,17 +284,61 @@ To initialize a handle, either a new object should be created or the value of a
@subsubsection occt_fcug_2_2_2 Type Management
Open CASCADE Technology provides a means to describe the hierarchy of data types in a generic way, with a possibility to check the exact type of the given object at run-time (similarly to C++ RTTI). For every class type derived from *Standard_Transient*, CDL extractor creates a code instantiating single instance of the class *Standard_Type* (type descriptor) that holds information on that type: its name and list of ancestor types.
Open CASCADE Technology provides a means to describe the hierarchy of data types in a generic way, with a possibility to check the exact type of the given object at run-time (similarly to C++ RTTI).
That instance (actually, a handle on it) is returned by the virtual method *DynamicType()* of the class derived from *Standard_Transient*. The other virtual method *IsKind()* provides a means to check whether a given object has specified type or inherits it.
To enable this feature, a class declaration should include declaration of OCCT RTTI.
Header *Standard_Type.hxx* provides two variants of preprocessor macros facilitating this:
In order to refer to the type descriptor object for a given class type, use macros *STANDARD_TYPE()* with argument being a name of the class.
* Inline variant, declares and defines RTTI methods by single line of code:
~~~~~{.cpp}
#include <Geom_Surface.hxx>
class Appli_ExtSurface : public Geom_Surface
{
. . .
public:
DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
};
~~~~~
* Out-of line variant, using one macros in declaration (normally put in header file), and another for implementation (to be put in C++ source):
In *Appli_ExtSurface.hxx* file:
~~~~~{.cpp}
#include <Geom_Surface.hxx>
class Appli_ExtSurface : public Geom_Surface
{
. . .
public:
DEFINE_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
};
~~~~~
In *Appli_ExtSurface.cxx* file:
~~~~~{.cpp}
#include <Appli_ExtSurface.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
~~~~~
These macros define method *DynamicType()* that returns a type descriptor - handle to singleton instance of the class *Standard_Type* describing the class.
Type descriptor stores name of the class and descriptor of its parent class.
Note that while inline version is easier to use, for widely used classes this method may lead to bloating of binary code of dependent libraries, due to multiple instantiations of inline method.
To get the type descriptor for a given class type, use macros *STANDARD_TYPE()* with name of the class as argument.
Example of usage:
~~~~~{.cpp}
if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) // equivalent to "if (dynamic_cast<Geom_Line>(aCurve.get()) != 0)"
{
...
}
~~~~~
#### Type Conformity
The type used in the declaration of a handle is the static type of the object, the type seen by the compiler. A handle can reference an object instantiated from a subclass of its static type. Thus, the dynamic type of an object (also called the actual type of an object) can be a descendant of the type which appears in the handle declaration through which it is manipulated.
Consider the persistent class *CartesianPoint*, a sub-class of *Point*; the rule of type conformity can be illustrated as follows:
Consider the class *CartesianPoint*, a sub-class of *Point*; the rule of type conformity can be illustrated as follows:
~~~~~
Handle (Geom_Point) p1;
@@ -418,7 +417,7 @@ p = new Geom_CartesianPoint (0, 0, 0);
Unlike for a pointer, the **delete** operator does not work on a handle; the referenced object is automatically destroyed when no longer in use.
@subsubsection occt_fcug_2_2_4 Invoking Methods
Once you have a handle on a persistent or transient object, you can use it like a pointer in C++. To invoke a method which acts on the referenced object, you translate this method by the standard *arrow* operator, or alternatively, by function call syntax when this is available.
Once you have a handle to an object, you can use it like a pointer in C++. To invoke a method which acts on the referenced object, you translate this method by the standard *arrow* operator, or alternatively, by function call syntax when this is available.
To test or to modify the state of the handle, the method is translated by the *dot* operator.
The example below illustrates how to access the coordinates of an (optionally initialized) point object:
@@ -508,123 +507,6 @@ There are two approaches how to avoid such situation:
* Use C++ pointer for one kind of references, e.g. from a primitive to the graph
* Nullify one set of handles (e.g. handles to a graph in primitives) when a graph object needs to be destroyed
@subsubsection occt_fcug_2_2_7 Creating Transient Classes without CDL
Though generation of Handle class and related C++ code is normally performed by CDL extractor, it is also possible to define a class managed by handle without CDL. To facilitate that, several macros are provided in the file Standard_DefineHandle.hxx:
* **DEFINE_STANDARD_HANDLE(class_name,ancestor_name)** -- declares Handle class for a class *class_name* that inherits class *ancestor_name* (for instance, *Standard_Transient*). This macro should be put in a header file; the declaration of the handle to a base class must be available (usually put before or after the declaration of the class *class_name*, or into a separate header file).
* **IMPLEMENT_STANDARD_HANDLE(class_name,ancestor_name)** -- implements method *DownCast()* of the *Handle* class. Should be located in a C++ file (normally the file where methods of the class *class_name* are implemented).
* **DEFINE_STANDARD_RTTI(class_name)** -- declares methods required for RTTI in the class *class_name* declaration; should be in public: section.
* **IMPLEMENT_STANDARD_RTTIEXT(class_name,ancestor_name)** -- implements above methods. Usually put into the C++ file implementing class *class_name*.
Note that it is important to ensure correctness of macro arguments, especially the ancestor name, otherwise the definition may be inconsistent (no compiler warnings will be issued in case of mistake).
In *Appli_ExtSurface.hxx* file:
~~~~~
#include <Geom_Surface.hxx>
class Appli_ExtSurface : public Geom_Surface
{
. . .
public:
DEFINE_STANDARD_RTTI(Appli_ExtSurface)
}
DEFINE_STANDARD_HANDLE(Appli_ExtSurface,Geom_Surface)
~~~~~
In *Appli_ExtSurface.cxx* file:
~~~~~
#include <Appli_ExtSurface.hxx>
IMPLEMENT_STANDARD_HANDLE(Appli_ExtSurface,Geom_Surface)
IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
~~~~~
#### Example
The following example shows how to define a class <i> SamplePoint </i> manipulated by handle.
First you need to define *Sample_Point.hxx* :
~~~~
#ifndef _Sample_Point_HeaderFile
#define _Sample_Point_HeaderFile
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <MMgt_TShared.hxx>
#include <Standard_DefineHandle.hxx>
// Handle definition
//
DEFINE_STANDARD_HANDLE(Sample_Point,MMgt_TShared)
class Sample_Point: public MMgt_TShared {
public:
Sample_Point();
Sample_Point(const Standard_Real, const
Standard_Real);
void SetX(const Standard_Real x) {
myX = x;
}
void SetY(const Standard_Real y) {
myY = y;
}
Standard_Real X() const {
return myX;
}
Standard_Real Y() const {
return myY;
}
// some methods like DynamicType() or
IsKind()
//
DEFINE_STANDARD_RTTI(Sample_Point)
private:
Standard_Real myX;
Standard_Real myY;
};
#endif
~~~~
Then you need to define *Sample_Point.cxx* :
~~~~
#include <Sample_Point.hxx>
// Implementation of Handle and type mgt
IMPLEMENT_STANDARD_HANDLE(Sample_Point,MMgt_TShared)
IMPLEMENT_STANDARD_RTTI(Sample_Point,MMgt_TShared)
// For ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and
// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
// We must respect the order: from the direct ancestor class to the base class.
IMPLEMENT_STANDARD_TYPE(Sample_Point)
IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
IMPLEMENT_STANDARD_TYPE_END(Sample_Point)
// Constructors implementation
Sample_Point::Sample_Point(const
Standard_Real x, const Standard_Real y)
{
myX = x;
myY = y;
}
Sample_Point::Sample_Point()
{
myX = 0.0;
myY = 0.0;
}
~~~~
@subsection occt_fcug_2_3 Memory Management
In a work session, geometric modeling applications create and delete a considerable number of C++ objects allocated in the dynamic memory (heap). In this context, performance of standard functions for allocating and deallocating memory may be not sufficient. For this reason, Open CASCADE Technology employs a specialized memory manager implemented in the *Standard* package.
@@ -642,7 +524,8 @@ To allocate memory in a C code with Open CASCADE Technology memory manager, sim
In C++, operators *new()* and *delete()* for a class may be defined so as to allocate memory using *Standard::Allocate()* and free it using *Standard::Free()*. In that case all objects of that class and all inherited classes will be allocated using the OCCT memory manager.
CDL extractor defines *new()* and *delete()* in this way for all classes declared with CDL. Thus all OCCT classes (apart from a few exceptions) are allocated using the OCCT memory manager.
Preprocessor macro *DEFINE_STANDARD_ALLOC* provided by header *Standard_DefineAlloc.hxx* defines *new()* and *delete()* in this way.
It is used for all OCCT classes (apart from a few exceptions) which thus are allocated using the OCCT memory manager.
Since operators *new()* and *delete()* are inherited, this is also true for any class derived from an OCCT class, for instance, for all classes derived from *Standard_Transient*.
**Note** that it is possible (though not recommended unless really unavoidable) to redefine *new()* and *delete()* functions for a class inheriting *Standard_Transient*. If that is done, the method *Delete()* should be also redefined to apply operator *delete* to this pointer. This will ensure that appropriate *delete()* function will be called, even if the object is manipulated by a handle to a base class.
@@ -1073,21 +956,6 @@ The **Collections** component provides a wide range of generic collections:
* **Lists** are similar to sequences but have different algorithms to explore them.
* Specific iterators for sequences and maps.
Most collections follow value semantics: their instances are the actual collections, not **handles** to a collection. Only arrays and sequences may also be manipulated by handle, and therefore shared.
Each collection directly used as an argument in Open CASCADE Technology public syntax
is instantiated in an OCCT component using the corresponding generic class in package
<i> TCollection</i>, by means of compiling the CDL declaration of the instance.
Thus OCCT generic classes require compilation of definitions in the CDL language and therefore
can only be instantiated in WOK.
If you do not use CDL in your project (CDL compilation under WOK is necessary
to instantiate any generic Collection from package <i>TCollection</i>), then you should
use the Collections defined in <i> NCollection</i> package. It contains definitions of the
same generic collection classes described above, but in a form of C++ templates.
Therefore, to instantiate any collection type no additional support is required beyond
the ANSI C++ compiler.
@subsubsection occt_fcug_3_1_2 Generic general-purpose Aggregates
#### TCollection_Array1
@@ -1152,14 +1020,6 @@ Sequences have about the same goal as unidimensional arrays *TCollection_HArray
* *Item*, the type of element in the sequence,
* *Seq*, the actual type of sequence handled by *HSequence*. This is an instantiation with *Item* of the *TCollection_Sequence* generic class.
#### TCollection_HSet
This is a collection of non-ordered items without any duplicates. At each transaction, the system checks if there are no duplicates.
*HSet* objects are *handles* to sets.
*HSet* is a generic class which depends on two parameters:
* *Item*, the type of element in the set,
* *Set*, the actual type of set handled by *HSet*. This is an instantiation with *TCollection_Set* generic class.
#### TCollection_List
These are ordered lists of non-unique objects which can be accessed sequentially using an iterator.
@@ -1174,10 +1034,6 @@ A sequence is a better structure when searching for items by value.
Queues and stacks are other kinds of list with a different access to data.
#### TCollection_Queue
This is a structure, where items are added at the end and removed from the front. The first item entered will be the first removed (**FIFO** structure: First In First Out). *Queue* is a generic class which depends on *Item*, the type of element in the structure.
#### TCollection_Sequence
This is a sequence of items indexed by an integer.
@@ -1185,22 +1041,6 @@ Sequences have about the same goal as unidimensional arrays (*TCollection_Array
*Sequence* is a generic class which depends on *Item*, the type of element in the sequence.
#### TCollection_Set
This is a collection of non-ordered items without any duplicates. At each transaction, the system checks if there are no duplicates.
A set generates the same result as a map. A map is more effective; so it is advisable to use maps instead of sets.
*Set* is a generic class which depends on *Item*, the type of element in the set.
Use *SetIterator* iterator to explore a *Set* structure.
#### TCollection_Stack
This is a structure where items are added and removed from the top. The last item entered will be the first removed.
*Stack* is a generic class which depends on *Item*, the type of element in the structure.
Use a *StackIterator* iterator to explore a *Stack* structure.
@subsubsection occt_fcug_3_1_3 Generic Maps
Maps are dynamically extended data structures where data is quickly accessed with a key. *TCollection_BasicMap* is a root class for maps.
@@ -1403,13 +1243,9 @@ These instantiations are the following:
@subsection occt_fcug_3_3 NCollections
@subsubsection occt_fcug_3_3_1 Overview
*NCollection* package allows to not use WOK development environment in projects. Though it is quite natural to develop a code based on OCCT in any environment accepted in the industry, there is still one limitation: the so-called OCCT generic classes provided in TCollection package require compilation of the definitions in the CDL language and therefore can only be instantiated in WOK development environment.
The *NCollection* package provides a set of template collection classes used throughout OCCT.
The NCollection library provides a full replacement of all TCollection generic classes so that any OCCT collection could be instantiated via C++ template or macro definitions. It can be used in WOK as a package development unit, or in any other configuration, since it only uses the standard capabilities of C++ compiler.
Macro definitions of these classes are stored in *NCollection_Define\*.hxx* files. These definitions are now obsolete though still can be used, particularly for compatibility with the existing code. On the contrary, template classes in *NCollection_\*.hxx* files are recommended, they are supported by OPEN CASCADE Company and further developed according to various needs.
The technology used in this unit continues and complements the one offered in the header file *Standard_DefineHandle* -- allowing to implement outside CDL the classes managed by Handle, also providing OCCT RTTI support.
Macro definitions of these classes are stored in *NCollection_Define\*.hxx* files. These definitions are now obsolete though still can be used, particularly for compatibility with the existing code.
@subsubsection occt_fcug_3_3_2 Instantiation of collection classes
@@ -1478,24 +1314,26 @@ Source code file will be *MyPackage_HSequenceOfPnt.cxx* or any other .cxx file (
IMPLEMENT_HSEQUENCE (MyPackage_HSequenceOfPnt)
~~~~~
@subsubsection occt_fcug_3_3_3 Class architecture
@subsubsection occt_fcug_3_3_3 Arrays and sequences
Standard collections provided by OCCT are:
* *NCollection_Array1* - fixed-size (at initialization) one-dimensional array; note that index can start at any value, usually 1
* *NCollection_Array2* - fixed-size (at initialization) two-dimensional array; note that index can start at any value, usually 1
* *NCollection_List* - plain list
* *NCollection_Sequence* - double-connected list with access by index; note that index starts at 1
To understand the basic architecture of the classes instantiated from *NCollection* macros, please refer to the documentation on *TCollection* package, particularly to CDL files. Almost all API described there is preserved in *NCollection*. Changes are described in corresponding *NCollection_Define\*.hxx* files.
These classes provide STL-style iterators (methods begin() and end()) and thus can be used in STL algorithms.
Nevertheless the internal structure of NCollection classes is more complex than that of *TCollection* ones, providing more capabilities. The advanced layer of architecture is described in the next chapter Features.
@subsubsection occt_fcug_3_3_3x Maps
There are two principal changes:
* In *TCollection* some classes ( Stack, List, Set, Map, DataMap, DoubleMap ) define the Iterator type, the name of Iterator being like *MyPackage_DoubleMapIteratorOfDoubleMapOfIntegerReal*. In *NCollection* each Iterator is always defined as subtype of the collection *MyPackage_DoubleMapOfIntegerReal::Iterator*.
* Hashed collections (of type Map\* ) require in *TCollection* that the special class *Map\*Hasher* is defined. In *NCollection* it is only required that the global functions *IsEqual* and *HashCode* are defined.
NCollection provides several classes for storage of objects by value, providing fast search due to use of hash:
* *NCollection_Map* - hash set
* *NCollection_IndexedMap* - set with prefixed order of elements, allowing fast access by index or by value (hash-based)
* *NCollection_DataMap* - hash map
* *NCollection_IndexedDataMap* - map with prefixed order of elements, allowing fast access by index or by value (hash-based)
* *NCollection_DoubleMap* - two-side hash map (with two keys)
#### Interface to classes defined in CDL
The classes defined above can be used as types for fields, parameters of methods and return values in CDL definitions. In our example, if MyPackage is a CDL package, you will need to create the file *MyPackage_SequenceOfPnt.hxx* containing or including the above definitions, and then to add the line: imported *SequenceOfPnt* to file *MyPackage.cdl*;
Then the new collection type can be used in any CDL definition under the name *SequenceOfPnt* from *MyPackage*.
@subsubsection occt_fcug_3_3_4 New collection types
@subsubsection occt_fcug_3_3_4 Other collection types
There are 4 collection types provided as template classes:
* *NCollection_Vector*
@@ -1904,7 +1742,7 @@ They provide:
All these functions are provided by geometric processor package <i> gp</i>. Its classes for 2d and 3d objects are handled by value rather than by reference. When this sort of object is copied, it is copied entirely. Changes in one instance will not be reflected in another.
The *gp* package defines the basic non-persistent geometric entities used for algebraic calculation and basic analytical geometry in 2d & 3d space. It also provides basic transformations such as identity, rotation, translation, mirroring, scale transformations, combinations of transformations, etc. Entities are handled by value.
The *gp* package defines the basic geometric entities used for algebraic calculation and basic analytical geometry in 2d & 3d space. It also provides basic transformations such as identity, rotation, translation, mirroring, scale transformations, combinations of transformations, etc. Entities are handled by value.
Please, note that <i> gp</i> curves and surfaces are analytic: there is no parameterization and no orientation on <i>gp</i> entities, i.e. these entities do not provide functions which work with these properties.
@@ -1922,7 +1760,6 @@ Note: the <i> gp</i> entities cannot be shared when they are inside more complex
Before creating a geometric object, you must decide whether you are in a 2d or in a 3d context and how you want to handle the object.
If you do not need a single instance of a geometric primitive but a set of them then the package which deals with collections of this sort of object, *TColgp*, will provide the necessary functionality.
In particular, this package provides standard and frequently used instantiations of generic classes with geometric objects, i.e. *XY*, *XYZ*, *Pnt*, *Pnt2d*, *Vec*, *Vec2d*, *Lin*, *Lin2d*, *Circ*, *Circ2d.*
These are non-persistent classes.
@subsection occt_occt_fcug_4_5 Basic Geometric Libraries
There are various library packages available which offer a range of basic computations on curves and surfaces.
@@ -2135,76 +1972,3 @@ This is reasonable precision to pass to an Intersection process as a limit of r
This is a reasonable precision to pass to an approximation process as a limit of refinement of fitting. The approximation is greater than the other precisions because it is designed to be used when the time is at a premium. It has been provided as a reasonable compromise by the designers of the Approximation algorithm. The current value is *Confusion() * 10*.
Note that Approximation is greater than Confusion, so care must be taken when using Confusion in an approximation process.
@section occt_fcug_5 Data Storage
@subsection occt_fcug_5_1 Saving and Opening Files
@image html /user_guides/foundation_classes/images/foundation_classes_image007.png "Example of Saving-Opening workflow"
@image latex /user_guides/foundation_classes/images/foundation_classes_image007.png "Example of Saving-Opening workflow"
In the example, the roots of the transferable transient objects *TopoDS_Shape, Geom_Geometry* and *Geom2d_Geometry* are used in algorithms, they contain data and temporary results.
The associated objects in the persistent domain are *PTopoDS_HShape, PGeom_Geometry* and *PGeom2d_Geometry*. They contain a real data structure which is stored in a file.
Note that when an object is stored, if it contains another stored object, the references to the contained object are also managed.
@image html /user_guides/foundation_classes/images/foundation_classes_image008.png "Saving-Opening mechanism"
@image latex /user_guides/foundation_classes/images/foundation_classes_image008.png "Saving-Opening mechanism"
@subsection occt_fcug_5_2 Basic Storage Procedures
@subsubsection occt_fcug_5_2_1 Saving
The storage procedure of a transient object follows five main steps.
1. Create an I/O driver for files. For example, *FSD_File f()*;
2. Instance the data schema, which will process your persistent information. The schema is used for read/write operations. If ShapeSchema is the name of your schema:
~~~~~
Handle(ShapeSchema) s = new ShapeSchema;
~~~~~
3. Create a persistent shape from a transient shape.
~~~~~
TopoDS_Shape aShape;
PTColStd_TransientPersistentMap aMap;
Handle(PTopoDS_HShape) aPShape = MgtBRep::Translate
(aShape, aMap, MgtBRep_WithoutTriangle);
~~~~~
4. Create a new container and fill it using the *AddRoot()* method.
~~~~~
Handle(Storage_Data) d = new Storage_Data;
d -> AddRoot (“ObjectName”, aPShape);
~~~~~
You may add as many objects as you want in this container.
5. Save to the archive.
~~~~~
s -> Write (f,d);
~~~~~
@subsubsection occt_fcug_5_2_2 Opening
The retrieval mechanism is the opposite of the storage mechanism. The procedure for retrieving an object is as follows:
1. Create an I/O driver and instance a data schema (if not done).
2. Read the persistent object from the archive and get the list of objects using *Roots()* method.
~~~~~
Handle(Storage_Data) d = s -> Read(f);
Handle(Storage_HSeqOfRoot) roots = d-> Roots();
~~~~~
3. Loop on root objects to get *Standard_Persistent* objects (the following sequence only gets the first root).
~~~~~
Handle(Standard_Persistent) p;
Handle(Standard_Root) r;
if(roots -> Length() >= 1) {
r = roots -> Value(1);
p = r -> Object();
}
~~~~~
4. DownCast the persistent object to a *PTopoDS_Hshape*.
~~~~~
Handle(PTopoDS_HShape) aPShape;
aPShape = Handle(PTopoDS_HShape)::DownCast(p);
~~~~~
5. Create the *TopoDS_Shape*.
~~~~~
TopoDS_Shape aShape;
PTColStd_PersistentTransientMap aMap;
MgtBRep::Translate (aPShape, aMap, aShape, MgtBRep_WithoutTriangle);
~~~~~

View File

@@ -1116,9 +1116,11 @@ Draw> writeall <filename.igs>
~~~~~
Allows writing the prepared model to a file with name *filename.igs*.
@section occt_iges_5_ Reading from and writing to XDE
@section occt_iges_5 Reading from and writing to IGES
@subsection occt_iges_5_1 Loading an IGES file
@subsection occt_iges_5_1 Reading from IGES
### Load an IGES file
Before performing any other operation, you must load an IGES file with:
~~~~~
@@ -1127,11 +1129,12 @@ IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
~~~~~
Loading the file only memorizes, but does not translate the data.
@subsection occt_iges_5_2 Checking the loaded IGES file
### Check the loaded IGES file
This step is not obligatory. See the description of @ref occt_iges_2_3_2 "Checking the IGES file" above.
@subsection occt_iges_5_3 Setting parameters for translation to XDE
### Set parameters for translation to XDE
See the description of @ref occt_iges_2_3_3 "Setting translation parameters" above.
In addition, the following parameters can be set for XDE translation of attributes:
@@ -1145,19 +1148,24 @@ reader.SetColorMode(mode);
reader.SetNameMode(mode);
// mode can be Standard_True or Standard_False
~~~~~
@subsection occt_iges_5_4 Performing the translation of an IGES file to XDE
### Translate an IGES file to XDE
The following function performs a translation of the whole document:
~~~~~
Standard_Boolean ok = reader.Transfer(doc);
~~~~~
where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*.
@subsection occt_iges_5_5 Initializing the process of translation from XDE to IGES
The process can be initialized as follows:
@subsection occt_iges_5_2 Writing to IGES
The translation from XDE to IGES can be initialized as follows:
~~~~~
IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False);
~~~~~
@subsection occt_iges_5_6 Setting parameters for translation from XDE to IGES
### Set parameters for translation from XDE to IGES
The following parameters can be set for translation of attributes to IGES:
* For transferring colors:
@@ -1170,7 +1178,8 @@ aWriter.SetColorMode(mode);
aWriter.SetNameMode(mode);
// mode can be Standard_True or Standard_False
~~~~~
@subsection occt_iges_5_7 Performing the translation of an XDE document to IGES
### Translate an XDE document to IGES
You can perform the translation of a document by calling the function:
~~~~~
@@ -1178,7 +1187,8 @@ IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
~~~~~
where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
@subsection occt_iges_5_8 Writing an IGES file
### Write an IGES file
Write an IGES file with:
~~~~~
IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs");

View File

@@ -202,9 +202,9 @@ construction or construction error) is described by the enumeration <i>gce_Error
Note, that classes, which construct geometric transformations do not return a status, and therefore do not inherit from *Root*.
@subsubsection occt_modat_1_2_1 Non-persistent entities
@subsubsection occt_modat_1_2_1 Simple geometric entities
The following algorithms used to build entities from non-persistent *gp* entities are provided by *gce* package.
The following algorithms used to build entities from *gp* package are provided by *gce* package.
- 2D line parallel to another at a distance,
- 2D line parallel to another passing through a point,
- 2D circle passing through two points,
@@ -264,9 +264,11 @@ This is useful if you are uncertain as to whether the arguments can create the *
gp_Lin2d l = gce_MakeLin2d(Point1,Point2);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_modat_1_2_2 Persistent entities
@subsubsection occt_modat_1_2_2 Geometric entities manipulated by handle
*GC* and *GCE2d* packages provides an implementation of algorithms used to build entities from *Geom* and *Geom2D* packages. They implement the same algorithms as the *gce* package but create **persistent** entities, and also contain algorithms for trimmed surfaces and curves. The following algorithms are available:
*GC* and *GCE2d* packages provides an implementation of algorithms used to build entities from *Geom* and *Geom2D* packages.
They implement the same algorithms as the *gce* package, and also contain algorithms for trimmed surfaces and curves.
The following algorithms are available:
- arc of a circle trimmed by two points,
- arc of a circle trimmed by two parameters,
- arc of a circle trimmed by one point and one parameter,
@@ -420,7 +422,7 @@ The *GeomAPI_ExtremaSurfaceSurface* class allows calculation of all extrema betw
@section occt_modat_2 2D Geometry
*Geom2d* package defines geometric objects in 2dspace. All geometric entities are STEP processed. The objects are non-persistent and are handled by reference.
*Geom2d* package defines geometric objects in 2dspace. All geometric entities are STEP processed. The objects are handled by reference.
In particular, <i>Geom2d</i> package provides classes for:
* description of points, vectors and curves,
@@ -484,7 +486,7 @@ In particular, it provides classes for:
* their positioning in 3D space using axis or coordinate systems, and
* their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof.
The following non-persistent and reference-handled objects are available:
The following objects are available:
- Point
- Cartesian point
- Vector

View File

@@ -105,7 +105,7 @@ The *Application* is an abstract class in charge of handling documents during th
In addition, application-specific data can be added by defining new attribute classes; naturally, this changes the standard file format. The only functions that have to be implemented are:
* Copying the attribute
* Converting it from and to its persistent homologue (persistence is briefly presented in the paragraph @ref occt_ocaf_9a_3 "Persistent Data Storage")
* Converting it from and persistent data storage
@subsection occt_ocaf_1_3 Reference-key model
@@ -483,32 +483,23 @@ If the set of existing and ready to use attributes implementing standard data ty
There are two ways to implement a new data type: create a new attribute (standard approach), or use the notion of User Attribute by means of a combination of standard attributes (alternative way)
In order to create a new attribute in the standard way do the following:
* Create a class inherited from *TDF_Attribute* and implement all purely virtual and necessary virtual methods:
+ **ID()** -- returns a unique GUID of a given attribute
+ **Restore(attribute)** -- sets fields of this attribute equal to the fields of a given attribute of the same type
+ **Paste(attribute, relocation_table)** -- sets fields of a given attribute equal to the field values of this attribute ; if the attribute has references to some objects of the data framework and relocation_table has this element, then the given attribute must also refer to this object .
+ **NewEmpty()** -- returns a new attribute of this class with empty fields
+ **Dump(stream)** -- outputs information about a given attribute to a given stream debug (usually outputs an attribute of type string only)
* Create the persistence classes for this attribute according to the file format chosen for the document (see below).
In order to create a new attribute in the standard way, create a class inherited from *TDF_Attribute* and implement all purely virtual and necessary virtual methods:
* **ID()** -- returns a unique GUID of a given attribute
* **Restore(attribute)** -- sets fields of this attribute equal to the fields of a given attribute of the same type
* **Paste(attribute, relocation_table)** -- sets fields of a given attribute equal to the field values of this attribute ; if the attribute has references to some objects of the data framework and relocation_table has this element, then the given attribute must also refer to this object .
* **NewEmpty()** -- returns a new attribute of this class with empty fields
* **Dump(stream)** -- outputs information about a given attribute to a given stream debug (usually outputs an attribute of type string only)
Methods *NewEmpty, Restore* and *Paste* are used for the common transactions mechanism (Undo/Redo commands). If you dont need this attribute to react to undo/redo commands, you can write only stubs of these methods, else you must call the Backup method of the *TDF_Attribute* class every time attribute fields are changed.
If you use a standard file format and you want your new attributes to be stored during document saving and retrieved to the data framework whenever a document is opened, you must do the following:
1. If you place an attribute to a new package, it is desirable (although not mandatory) if your package name starts with letter "T" (transient), for example: attribute *TMyAttributePackage_MyAttribute* in the package *TMyAttributePackage*.
2. Create a new package with name "P[package name]" (for example *PMyAttributePackage*) with class *PMyAttributePackage_MyAttribute* inside. The new class inherits the *PDF_Attribute* class and contains fields of attributes, which must be saved or retrieved ("P" -- persistent).
3. Create a new package with name "M[package name]" (for example *MMyAttributePackage*) with classes *MMyAttributePackage_MyAttributeRetrievalDriver* and *MMyAttributePackage_MyAttributeStorageDriver* inside. The new classes inherit *MDF_ARDriver* and *MDF_ASDriver* classes respectively and contain the translation functionality: from T... attribute to P... and vice versa (M -- middle) (see the realization of the standard attributes).
4. M... package must contain *AddStorageDrivers(aDriverSeq : ASDriverHSequence* from MDF) and *AddRetrievalDrivers(aDriverSeq : ASDriverHSequence* from MDF) methods, which append to the given sequence of drivers *aDriverSeq*, which is a sequence of all new attribute drivers (see the previous point) used for the storage/retrieval of attributes.
5 Use the standard schema (*StdSchema* unit) or create a new one to add your P-package and compile it.
If you use the XML format, do the following:
To enable possibility to save / restore the new attribute in XML format, do the following:
1. Create a new package with the name Xml[package name] (for example *XmlMyAttributePackage*) containing class *XmlMyAttributePackage_MyAttributeDriver*. The new class inherits *XmlMDF_ADriver* class and contains the translation functionality: from transient to persistent and vice versa (see the realization of the standard attributes in the packages *XmlMDataStd*, for example). Add package method AddDrivers which adds your class to a driver table (see below).
2. Create a new package (or do it in the current one) with two package methods:
* *Factory*, which loads the document storage and retrieval drivers; and
* *AttributeDrivers*, which calls the methods AddDrivers for all packages responsible for persistence of the document.
3. Create a plug-in implemented as an executable (see example *XmlPlugin*). It calls a macro PLUGIN with the package name where you implemented the method Factory.
If you use the binary format, do the following:
To enable possibility to save / restore the new attribute in binary format, do the following:
1. Create a new package with name <i> Bin[package name] </i> (for example *BinMyAttributePackage*) containing a class *BinMyAttributePackage_MyAttributeDriver*. The new class inherits *BinMDF_ADriver* class and contains the translation functionality: from transient to persistent and vice versa (see the realization of the standard attributes in the packages *BinMDataStd*, for example). Add package method *AddDrivers*, which adds your class to a driver table.
2. Create a new package (or do it in the current one) with two package methods:
* Factory, which loads the document storage and retrieval drivers; and
@@ -714,7 +705,7 @@ setenv CSF_NewFormatDefaults MyApplicationPath/MyResources
Once these steps are taken you may run your application, create documents and Save/Open them. These resource files already exist in the OCAF (format "Standard").
If you use your specific attributes from packages, for example, <i>P-, M-</i> and *TMyAttributePackage* (see @ref occt_ocaf_3_4_6 "Specific attribute creation") you must take some additional steps for the new plugin implementation:
If you use your specific attributes from packages, for example, <i>P-, M-</i> and *TMyAttributePackage* (see @ref occt_ocaf_3_5_6 "Specific attribute creation") you must take some additional steps for the new plugin implementation:
1. Add our *P* package to the standard schema. You can get an already existing (in Open CASCADE Technology sources) schema from *StdSchema* unit and add your package string to the cdl-file: package *PMyAttributePackage*.
2. The next step consists in the implementation of an executable, which will connect our documents to our application and open/save them. Copy the package *PAppStdPlugin* and change its name to *MyTheBestApplicationPlugin*. In the *PLUGIN* macros type the name of your factory, which will be defined at the next step.
@@ -1745,25 +1736,11 @@ Both the XML format and the XML OCAF persistence code are extensible in the sens
In OCAF, persistence, that is, the mechanism used to save a document in a file, is based on an explicit formal description of the data saved.
When you open a document, the application reads the corresponding file and first creates a memory representation of it. This representation is then converted to the application data model — the OCAF-based data structure the application operates on. The file's memory representation consists of objects defined by classes known as persistent.
The persistent classes needed by an application to save its documents make the application's data schema. This schema defines the way the data are organized in the file — the format of the data. In other words, the file is simply an ASCII dump of the persistent data defined by the schema, the persistent data being created from the application data model during the save process.
Only canonical information is saved. As a matter of fact, the application data model usually contains additional data to optimize processing. For example, the persistent Bézier curve is defined by its poles, whereas its data model equivalent also contains coefficients used to compute a point at a given parameter. The additional data is calculated when the document is opened.
The major advantages of this approach are the following:
* Providing that the data format is published, files created by OCAF-based applications
can be read without needing a runtime of the application (openness)
* Although the persistence approach makes the data format more stable,
OCAF provides a framework for managing compatibility of data between versions of the application —
modification of the data format is supported through the versioning of schema.
OCAF includes a ready-to-use schema suitable for most applications.
However, it can be extended if needed. For that, the only things you have to do are:
* To define the additional persistent attributes
* To implement the functions converting these persistent attribute to and from the application data model.
OCAF includes a ready-to-use schema suitable for most applications.
However, it can be extended if needed.
Applications using compound documents extensively (saving data in many files linked together) should implement data management services. As a matter of fact, it's out the scope of OCAF to provide functions such as:
Applications using compound documents extensively (saving data in many files linked together) should implement data management services. It is out the scope of OCAF to provide functions such as:
* Version and configuration management of compound documents;
* Querying a referenced document for its referencing documents.
@@ -1774,198 +1751,14 @@ In order to ease the delegation of document management to a data management appl
There are three schemes of persistence, which you can use to store and retrieve OCAF data (documents):
* <i> Standard</i> persistence schema, compatible with previous OCAF applications
* <i> Standard</i> persistence schema, compatible with previous OCAF applications. This schema is deprecated and supports only reading of standard attributes (no writing).
* <i> XmlOcaf</i> persistence, allowing the storage of all OCAF data in XML form
* <i> BinOcaf</i> persistence, allowing the storage of all OCAF data in binary format form
All schemes are independent of each other, but they guarantee that the standard OCAF
attributes stored and retrieved by one schema will be storable and retrievable by
the other. Therefore in any OCAF application you can use any persistence schema or
In an OCAF application you can use any persistence schema or
even all three of them. The choice is made depending on the *Format* string of stored OCAF documents
or automatically by the file header data -- on retrieval.
Persistent data storage in OCAF using the <i> Standard</i> package is presented in:
* Basic Data Storage
* Persistent Collections
Persistent storage of shapes is presented in the following chapters:
* Persistent Geometry
* Persistent Topology
Finally, information about opening and saving persistent data is presented in Standard
Documents.
@subsection occt_ocaf_9a_3 Basic Data Storage
Normally, all data structures provided by Open CASCADE Technology are run-time structures,
in other words, transient data. As transient data, they exist only while an application
is running and are not stored permanently. However, the Data Storage module provides
resources, which enable an application to store data on disk as persistent data.
Data storage services also provide libraries of persistent classes and translation
functions needed to translate data from transient to persistent state and vice-versa.
#### Libraries of persistent classes
Libraries of persistent classes are extensible libraries of elementary classes you
use to define the database schema of your application. They include:
* Unicode (8-bit or 16-bit character type) strings
* Collections of any kind of persistent data such as arrays.
All persistent classes are derived from the \b Persistent base class, which defines
a unique way of creating and handling persistent objects. You create new persistent
classes by inheriting from this base class.
#### Translation Functions
Translation functions allow you to convert persistent objects to transient ones and
vice-versa. These translation functions are used to build Storage and Retrieval drivers
of an application.
For each class of 2D and 3D geometric types, and for the general shape class in the
topological data structure library, there are corresponding persistent class libraries,
which allow you to translate your data with ease.
#### Creation of Persistent Classes
If you use Unix platforms as well as WOK and CDL, you can create your own persistent
classes. In this case, data storage is achieved by implementing *Storage* and *Retrieval*
drivers.
The <i> Storage </i> package is used to write and read persistent objects.
These objects are read and written by a retrieval or storage algorithm
(<i> Storage_Schema </i>object) in a container (disk, memory, network ...).
Drivers (<i> FSD_File</i> objects) assign a physical container for data to be stored or retrieved.
The standard procedure for an application in reading a container is as follows:
* open the driver in reading mode,
* call the Read function from the schema, setting the driver as a parameter. This function returns an instance of the <i> Storage_Data </i> class which contains the data being read,
* close the driver.
The standard procedure for an application in writing a container is as follows:
* open the driver in writing mode,
* create an instance of the <i> Storage_Data </i> class, then add the persistent data to write with the function <i> AddRoot</i>,
* call the function <i> Write </i> from the schema, setting the driver and the <i> Storage_Data </i> instance as parameters,
* close the driver.
@subsection occt_ocaf_9a_4 Persistent Collections
Persistent collections are classes which handle dynamically sized collections of data that can be stored in the database. These collections provide three categories of service:
* persistent strings,
* generic arrays of data,
* commonly used instantiations of arrays.
Persistent strings are concrete classes that handle sequences of characters based
on both ASCII (normal 8-bit) and Unicode (16-bit) character sets.
Arrays are generic classes, that is, they can hold a variety of objects not necessarily inheriting from a unique root class. These arrays can be instantiated with any kind of storable or persistent object, and then inserted into the persistent data model of a user application.
The purpose of these data collections is simply to convert transient data into its persistent equivalent so that it can be stored in the database. To this end, the collections are used to create the persistent data model and assure the link with the database. They do not provide editing or query capabilities because it is more efficient, within the operative data model of the application, to work with transient data structures (from the <i> TCollection</i> package).
For this reason:
* the persistent strings only provide constructors and functions to convert between transient and persistent strings, and
* the persistent data collections are limited to arrays. In other words, <i> PCollection</i> does not include sequences, lists, and so on (unlike <i> TCollection</i>).
Persistent string and array classes are found in the <i> PCollection</i> package. In addition, <i> PColStd</i> package provides standard, and frequently used, instantiations of persistent arrays, for very simple objects.
@subsection occt_ocaf_9a_5 Persistent Geometry
The Persistent Geometry component describes geometric data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world".
Persistent Geometry consists of a set of atomic data models parallel to the geometric data structures described in the geometry packages. Geometric data models, independent of each other, can appear within the data model of any application. The system provides the means to convert each atomic transient data model into a persistent one, but it does not provide a way for these data models to share data.
Consequently, you can create a data model using these components, store data in, and retrieve it from a file or a database, using the geometric components provided in the transient and persistent "worlds". In other words, you customize the system by declaring your own objects, and the conversion of the geometric components from persistent to transient and vice versa is automatically managed for you by the system.
However, these simple objects cannot be shared within a more complex data model. To allow data to be shared, you must provide additional tools.
Persistent Geometry is provided by several packages.
The <i> PGeom</i> package describes geometric persistent objects in 3D space, such as points,
vectors, positioning systems, curves and surfaces.
These objects are persistent versions of those provided by the <i> Geom</i> package: for
each type of transient object provided by Geom there is a corresponding type of persistent
object in the <i>PGeom</i> package. In particular the inheritance structure is parallel.
However the <i> PGeom </i>package does not provide any functions to construct, edit or access
the persistent objects. Instead the objects are manipulated as follows:
* Persistent objects are constructed by converting the equivalent transient <i> Geom </i> objects. To do this you use the <i>MgtGeom::Translate</i> function.
* Persistent objects created in this way are used to build persistent data structures that are then stored in a file or database.
* When these objects are retrieved from the file or database, they are converted back into the corresponding transient objects from the Geom package. To do this, you use <i>MgtGeom::Translate</i> function.
In other words, you always edit or query transient data structures within the transient
data model supplied by the session.
Consequently, the documentation for the <i> PGeom </i> package consists simply of a list of available objects.
The <i> PGeom2d </i> package describes persistent geometric objects in 2D space, such as points,
vectors, positioning systems and curves. This package provides the same type of services
as the <i> PGeom</i> package, but for the 2D geometric objects provided by the <i> Geom2d</i> package.
Conversions are provided by the <i>MgtGeom::Translate</i> function.
~~~~
//Create a coordinate system
Handle(Geom_Axis2Placement) aSys;
//Create a persistent coordinate PTopoDS_HShape.cdlsystem
Handle(PGeom_Axis2placement)
aPSys = MgtGeom::Translate(aSys);
//Restore a transient coordinate system
Handle(PGeom_Axis2Placement) aPSys;
Handle(Geom_Axis2Placement)
aSys = MgtGeom::Translate(aPSys);
~~~~
@subsection occt_ocaf_9a_6 Persistent Topology
The Persistent Topology component describes topological data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world".
Persistent Topology is based on the BRep concrete data model provided by the topology packages. Unlike the components of the Persistent Geometry package, topological components can be fully shared within a single model, as well as between several models.
Each topological component is considered to be a shape: a <i> TopoDS_Shape</i> object. The system's capacity to convert a transient shape into a persistent shape and vice-versa applies to all objects, irrespective of their complexity: vertex, edge, wire, face, shell, solid, and so on.
When a user creates a data model using BRep shapes, he uses the conversion functions that the system provides to store the data in, and retrieve it from the database. The data can also be shared.
Persistent Topology is provided by several packages.
The <i> PTopoDS</i> package describes the persistent data model associated with any BRep shape; it is the persistent version of any shape of type <i> TopoDS_Shape</i>. As is the case for persistent geometric models, this data structure is never edited or queried, it is simply stored in or retrieved from the database. It is created or converted by the <i>MgtBRep::Translate</i> function.
The <i> MgtBRepAbs</i> and <i> PTColStd </i> packages provide tools used by the conversion functions of topological objects.
~~~~
//Create a shape
TopoDS_Shape aShape;
//Create a persistent shape
PtColStd_DoubleTransientPersistentMap aMap;
Handle(PTopoDS_HShape) aPShape =
aMap.Bind2(MgtBRep::Translate
aShape,aMap,MgtBRepAbs_WithTriangle));
aPShape.Nullify();
//Restore a transient shape
Handle(PTopoDS_HShape) aPShape;
Handle(TopoDS_HShape) aShape =
aMap.Bind1(MgtBRep::Translate
(aPShape,aMap,MgtBRepAbs_WithTriangle));
aShape.Nullify();
~~~~
@section occt_ocaf_10 GLOSSARY
@@ -1986,7 +1779,6 @@ aShape.Nullify();
* Store the names of software extensions.
* **Driver** -- an abstract class, which defines the communications protocol with a system.
* **Entry** -- an ASCII character string containing the tag list of a label. For example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
0:3:24:7:2:7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2002,7 +1794,6 @@ To store these references properly, a label must also contain an external link a
In C++, the application behavior is implemented in virtual functions redefined in these derived classes. This is known as overriding.
* **GUID** -- Global Universal ID. A string of 37 characters intended to uniquely identify an object. For example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
2a96b602-ec8b-11d0-bee7-080009dc3333
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2148,162 +1939,109 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
@subsection occt_ocaf_11_1 Implementation of Attribute Transformation in a CDL file
@subsection occt_ocaf_11_1 Implementation of Attribute Transformation in a HXX file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
class Transformation from MyPackage inherits Attribute from TDF
\#include <TDF_Attribute.hxx>
---Purpose: This attribute implements a transformation data container.
\#include <gp_Ax3.hxx>
\#include <gp_Pnt.hxx>
\#include <gp_Vec.hxx>
\#include <gp_Trsf.hxx>
uses
//! This attribute implements a transformation data container
class MyPackage_Transformation : public TDF_Attribute
{
public:
//!@name Static methods
Attribute from TDF,
Label from TDF,
GUID from Standard,
RelocationTable from TDF,
Pnt from gp,
Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Vec from gp,
Trsf from gp,
TrsfForm from gp
//! The method returns a unique GUID of this attribute.
//! By means of this GUID this attribute may be identified
//! among other attributes attached to the same label.
Standard_EXPORT static const Standard_GUID& GetID ();
is
//! Finds or creates the attribute attached to <theLabel>.
//! The found or created attribute is returned.
Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel);
---Category: Static methods
-- ===============
GetID (myclass)
---C++: return const &
---Purpose: The method returns a unique GUID of this attribute.
-- By means of this GUID this attribute may be identified
-- among other attributes attached to the same label.
returns GUID from Standard;
Set (myclass; theLabel : Label from TDF)
---Purpose: Finds or creates the attribute attached to <theLabel>.
-- The found or created attribute is returned.
returns Transformation from MyPackage;
---Category: Methods for access to the attribute data
-- ========================================
//!@name Methods for access to the attribute data
Get (me)
---Purpose: The method returns the transformation.
returns Trsf from gp;
//! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//!@name Methods for setting the data of transformation
---Category: Methods for setting the data of transformation
-- ==============================================
//! The method defines a rotation type of transformation.
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
SetRotation (me : mutable;
theAxis : Ax1 from gp;
theAngle : Real from Standard);
---Purpose: The method defines a rotation type of transformation.
//! The method defines a translation type of transformation.
Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
SetTranslation (me : mutable;
theVector : Vec from gp);
---Purpose: The method defines a translation type of transformation.
//! The method defines a point mirror type of transformation (point symmetry).
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
SetMirror (me : mutable;
thePoint : Pnt from gp);
---Purpose: The method defines a point mirror type of transformation
-- (point symmetry).
//! The method defines an axis mirror type of transformation (axial symmetry).
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
SetMirror (me : mutable;
theAxis : Ax1 from gp);
---Purpose: The method defines an axis mirror type of transformation
-- (axial symmetry).
//! The method defines a point mirror type of transformation (planar symmetry).
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
SetMirror (me : mutable;
thePlane : Ax2 from gp);
---Purpose: The method defines a point mirror type of transformation
-- (planar symmetry).
//! The method defines a scale type of transformation.
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
SetScale (me : mutable;
thePoint : Pnt from gp;
theScale : Real from Standard);
---Purpose: The method defines a scale type of transformation.
//! The method defines a complex type of transformation from one co-ordinate system to another.
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
SetTransformation (me : mutable;
theCoordinateSystem1 : Ax3 from gp;
theCoordinateSystem2 : Ax3 from gp);
---Purpose: The method defines a complex type of transformation
-- from one co-ordinate system to another.
---Category: Overridden methods from TDF_Attribute
-- =====================================
//!@name Overridden methods from TDF_Attribute
ID (me)
---C++: return const &
---Purpose: The method returns a unique GUID of the attribute.
-- By means of this GUID this attribute may be identified
-- among other attributes attached to the same label.
returns GUID from Standard;
//! The method returns a unique GUID of the attribute.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT const Standard_GUID& ID () const;
Restore (me: mutable;
theAttribute : Attribute from TDF);
---Purpose: The method is called on Undo / Redo.
-- It copies the content of <theAttribute>
-- into this attribute (copies the fields).
//! The method is called on Undo / Redo.
//! It copies the content of theAttribute into this attribute (copies the fields).
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
NewEmpty (me)
---Purpose: It creates a new instance of this attribute.
-- It is called on Copy / Paste, Undo / Redo.
returns mutable Attribute from TDF;
//! It creates a new instance of this attribute.
//! It is called on Copy / Paste, Undo / Redo.
Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const;
Paste (me;
theAttribute : mutable Attribute from TDF;
theRelocationTable : mutable RelocationTable from TDF);
---Purpose:: The method is called on Copy / Paste.
-- It copies the content of this attribute into
-- <theAttribute> (copies the fields).
//! The method is called on Copy / Paste.
//! It copies the content of this attribute into theAttribute (copies the fields).
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
Dump(me; anOS : in out OStream from Standard)
---C++: return;
---Purpose: Prints the content of this attribute into the stream.
returns OStream from Standard is redefined;
//! Prints the content of this attribute into the stream.
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS);
//!@name Constructor
---Category: Constructor
-- ===========
//! The C++ constructor of this atribute class.
//! Usually it is never called outside this class.
Standard_EXPORT MyPackage_Transformation();
Create
---Purpose: The C++ constructor of this atribute class.
-- Usually it is never called outside this class.
returns mutable Transformation from MyPackage;
private:
gp_TrsfForm myType;
// Axes (Ax1, Ax2, Ax3)
gp_Ax1 myAx1;
gp_Ax2 myAx2;
gp_Ax3 myFirstAx3;
gp_Ax3 mySecondAx3;
fields
// Scalar values
Standard_Real myAngle;
Standard_Real myScale;
-- Type of transformation
myType : TrsfForm from gp;
-- Axes (Ax1, Ax2, Ax3)
myAx1 : Ax1 from gp;
myAx2 : Ax2 from gp;
myFirstAx3 : Ax3 from gp;
mySecondAx3 : Ax3 from gp;
-- Scalar values
myAngle : Real from Standard;
myScale : Real from Standard;
-- Points
myFirstPoint : Pnt from gp;
mySecondPoint : Pnt from gp;
end Transformation;
// Points
gp_Pnt myFirstPoint;
gp_Pnt mySecondPoint;
};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection occt_ocaf_11_2 Implementation of Attribute Transformation in a CPP file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include MyPackage_Transformation.ixx;
\#include <MyPackage_Transformation.hxx>
//=======================================================================
//function : GetID

View File

@@ -50,7 +50,7 @@ Each sub-domain has its own scope of functionality:
* customization -- modifying shape representation to fit specific needs (shape is not modified, only the form of its representation is modified);
* processing -- mechanism of managing shape modification via a user-editable resource file.
Message management is used for creating messages, filling them with various parameters and storing them in the trace file. This tool provides functionality for attaching messages to the shapes for deferred analysis of various run-time events. In this document only general principles of using Shape Healing will be described. For more detailed information please see the corresponding CDL files.
Message management is used for creating messages, filling them with various parameters and storing them in the trace file. This tool provides functionality for attaching messages to the shapes for deferred analysis of various run-time events. In this document only general principles of using Shape Healing will be described. For more detailed information please see the corresponding header files.
Tools responsible for analysis, fixing and upgrading of shapes can give the information about how these operations were performed. This information can be obtained by the user with the help of mechanism of status querying.
@@ -70,7 +70,7 @@ if ( object.Status.. ( ShapeExtend_DONE ) ) {// something was done
}
~~~~~
8 'DONE' and 8 'FAIL' flags, named ShapeExtend_DONE1 ... ShapeExtend_FAIL8, are defined for a detailed analysis of the encountered situation. Each method assigns its own meaning to each flag, documented in the CDL for that method. There are also three enumerative values used for testing several flags at a time:
8 'DONE' and 8 'FAIL' flags, named ShapeExtend_DONE1 ... ShapeExtend_FAIL8, are defined for a detailed analysis of the encountered situation. Each method assigns its own meaning to each flag, documented in the header for that method. There are also three enumerative values used for testing several flags at a time:
* *ShapeExtend_OK* -- if no flags have been set;
* *ShapeExtend_DONE* -- if at least one ShapeExtend_DONEi has been set;
* *ShapeExtend_FAIL* -- if at least one ShapeExtend_FAILi has been set.

View File

@@ -40,7 +40,7 @@ These modules share common architecture and capabilities with other exchange mod
In addition, Open Cascade provides tools to process models described using STEP: to reflect EXPRESS descriptions, to read, write and check data, to analyze the whole models ... Their key features are:
* Modularity by sets of data types, which can be hierarchized to reflect the original modularity describing the resources and application protocols;
* Implementation as CDL/C++ classes, providing comprehensive access to their members;
* Implementation as C++ classes, providing comprehensive access to their members;
* Early binding is basically used, providing good performance, easy installation and use as well as the capability to support non-compiled descriptions.
This provides a natural way to deal with non-supported protocols when they share common definitions, as for geometry, which can then be exploited. The common frame, as the already supported data types, give a good foundation to go towards new uses of STEP, either on data definition (protocols from ISO or from industrial consortia) or on mapping with applicative data.
@@ -1105,14 +1105,14 @@ writer.Write(;Output.stp;);
@subsection occt_step_4_1 Architecture of STEP Read and Write classes
@subsubsection occt_step_4_1_1 General principles
To perform data loading from a STEP file and to translate this data it is necessary to create correspondence between the EXPRESS schema and the structure of CDL classes. There are two possibilities to organize such correspondence: the so-called early binding and late binding.
To perform data loading from a STEP file and to translate this data it is necessary to create correspondence between the EXPRESS schema and the structure of the classes. There are two possibilities to organize such correspondence: the so-called early binding and late binding.
* Late binding means that the processor works with a description of the schema. The processor builds a dictionary of entities and can recognize and read any entity that is described in the schema. To change the behavior and the scope of processor based on late binding it is enough to change the description of the schema. However, this binding has some disadvantages (for example low speed of reading process).
* In case of early binding, the structure of CDL classes is created beforehand with the help of a specific automatic tool or manually. If the processor finds an entity that is not found in this schema, it will simply be ignored. The processor calls constructors of appropriate classes and their read methods. To add a new type in the scope of the processor it is necessary to create a class corresponding to the new entity.
* In case of early binding, the structure of the classes is created beforehand with the help of a specific automatic tool or manually. If the processor finds an entity that is not found in this schema, it will simply be ignored. The processor calls constructors of appropriate classes and their read methods. To add a new type in the scope of the processor it is necessary to create a class corresponding to the new entity.
The STEP processor is based on early binding principles. It means that specific classes for each EXPRESS type have been created with the help of an automatic tool from the EXPRESS schema. There are two CDL classes for each EXPRESS type. The first class (named the representing class) represents the STEP entity in memory. The second one (RW-class) is intended to perform the initialization of the representing class and to output data to an intermediate structure to be written in a STEP file.
The STEP processor is based on early binding principles. It means that specific classes for each EXPRESS type have been created with the help of an automatic tool from the EXPRESS schema. There are two classes for each EXPRESS type. The first class (named the representing class) represents the STEP entity in memory. The second one (RW-class) is intended to perform the initialization of the representing class and to output data to an intermediate structure to be written in a STEP file.
@subsubsection occt_step_4_1_2 Complex entities
EXPRESS schema allows multiple inheritance. Entities that are built on the basis of multiple inheritance are called complex entities. Multiple inheritance is not available in CDL. EXPRESS enables any type of complex entities that can be inherited from any EXPRESS type. In the manner of early binding it is not possible to create a CDL class for any possible complex type. Thus, only widespread complex entities have corresponding representing classes and RW-classes that are created manually beforehand.
EXPRESS schema allows multiple inheritance. Entities that are built on the basis of multiple inheritance are called complex entities. EXPRESS enables any type of complex entities that can be inherited from any EXPRESS type. In the manner of early binding it is not possible to create a C++ class for any possible complex type. Thus, only widespread complex entities have corresponding representing classes and RW-classes that are created manually beforehand.
@subsection occt_step_4_2 Physical file reading
Physical file reading consists of the following steps:
@@ -1140,7 +1140,7 @@ The final phase is building a graph of references between entities. For each ent
@subsection occt_step_4_3 How to add a new entity in scope of the STEP processor
If it is necessary to read and translate a new entity by the STEP processor the Reader and Actor scope should be enhanced. Note that some actions to be made for adding a new type are different for simple and complex types.
The following steps should be taken:
* Create a CDL class representing a new entity. This can be *Stepxxx_NewEntity* class where xxx can be one of the following:
* Create a class representing a new entity. This can be *Stepxxx_NewEntity* class where xxx can be one of the following:
* Basic
* Geom
* Shape
@@ -1385,8 +1385,9 @@ Mode (0 end, 1 file) :
~~~~~
It is necessary to call command *newmodel* to perform a new translation of the next OCCT shape.
@section occt_step_7 Reading from and writing to XDE
The *STEPCAFControl* package (TKXDESTEP toolkit) provides tools to read and write STEP files to and from XDE format (see XDE Users Guide).
@section occt_step_7 Reading from and writing to STEP
The *STEPCAFControl* package (TKXDESTEP toolkit) provides tools to read and write STEP files (see XDE Users Guide).
In addition to the translation of shapes implemented in basic translator, it provides the following:
* STEP assemblies, read as OCCT compounds by basic translator, are translated to XDE assemblies;
@@ -1395,9 +1396,9 @@ In addition to the translation of shapes implemented in basic translator, it pro
* Colors, layers, materials and validation properties assigned to parts or subparts are translated;
* STEP dimensional tolerances are translated.
@subsection occt_step_7_1 Description of the process
@subsection occt_step_7_1 Reading from STEP
@subsubsection occt_step_7_1_1 Loading a STEP file
### Load a STEP file
Before performing any other operation, you must load a STEP file with:
~~~~~
STEPCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
@@ -1405,10 +1406,11 @@ IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp");
~~~~~
Loading the file only memorizes the data, it does not translate it.
@subsubsection occt_step_7_1_2 Checking the loaded STEP file
### Check the loaded STEP file
This step is not obligatory. See a description of this step in section @ref occt_step_2_3_2 "Checking the STEP file".
@subsubsection occt_step_7_1_3 Setting the parameters for translation to XDE
### Set parameters for translation to XDE
See a description of this step in section @ref occt_step_2_3_3 "Setting the translation parameters".
In addition, the following parameters can be set for XDE translation of attributes:
@@ -1422,38 +1424,46 @@ reader.SetColorMode(mode);
reader.SetNameMode(mode);
// mode can be Standard_True or Standard_False
~~~~~
@subsubsection occt_step_7_1_4 Performing the translation of a STEP file to XDE
### Translate a STEP file to XDE
The following function performs a translation of the whole document:
~~~~~
Standard_Boolean ok = reader.Transfer(doc);
~~~~~
where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*.
@subsubsection occt_step_7_1_5 Initializing the process of translation from XDE to STEP
Here is how to initialize the process:
@subsection occt_step_7_2 Writing to STEP
The translation from XDE to STEP can be initialized as follows:
~~~~~
STEPCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False);
~~~~~
@subsubsection occt_step_7_1_6 Setting the parameters for translation from XDE to STEP
### Set parameters for translation from XDE to STEP
The following parameters can be set for a translation of attributes to STEP:
* Parameter for transferring colors:
* For transferring colors:
~~~~~
aWriter.SetColorMode(mode);
// mode can be Standard_True or Standard_False
~~~~~
* Parameter for transferring names:
* For transferring names:
~~~~~
aWriter.SetNameMode(mode);
// mode can be Standard_True or Standard_False
~~~~~
@subsubsection occt_step_7_1_7 Performing the translation of an XDE document to STEP
### Translate an XDE document to STEP
You can perform the translation of document by calling the function:
~~~~~
IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
~~~~~
where *doc* is a variable, which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
@subsubsection occt_step_7_18 Writing a STEP file
### Write a STEP file
Write a STEP file with:
~~~~~
IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.stp");

View File

@@ -15,7 +15,7 @@ This includes:
* Definition of classes representing data objects. Data objects store their data using primitive OCAF attributes, taking advantage of OCAF mechanisms for Undo/Redo and persistence. At the same time they provide a higher level abstraction over the pure OCAF document structure (labels / attributes).
* Organization of the data model as a hierarchical (tree-like) structure of objects.
* Support of cross-references between objects within one model or among different models. In case of cross-model references the models should depend hierarchically.
* Persistence mechanism for storing *TObj* objects in OCAF files, which allows storing and retrieving objects of derived types without regenerating the schema.
* Persistence mechanism for storing *TObj* objects in OCAF files, which allows storing and retrieving objects of derived types without writing additional code to support persistence.
This document describes basic principles of logical and physical organization
of TObj-based data models and typical approaches to implementation of classes representing model objects.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -99,301 +99,354 @@ aContext -> Display(anAis);
The shape is created using the *BRepPrimAPI_MakeWedge* command. An *AIS_Shape* is then created from the shape. When calling the *Display* command, the interactive context calls the Compute method of the presentable object to calculate the presentation data and transfer it to the viewer. See figure below.
@image html visualization_image004.png "Processes involved in displaying a presentable shape"
@image latex visualization_image004.png "Processes involved in displaying a presentable shape"
@image html visualization_image004.svg "Processes involved in displaying a presentable shape"
@image latex visualization_image004.svg "Processes involved in displaying a presentable shape"
@subsection occt_visu_2_2 Selection
Objects that may be selected graphically, are displayed as sets of sensitive primitives, which provide sensitive zones in 2D graphic space. These zones are sorted according to their position on the screen when starting the selection process.
@image html visualization_image006.png "A model"
@image latex visualization_image006.png "A model"
Standard OCCT selection algorithm is represented by 2 parts: dynamic and static. Dynamic selection causes objects to be automatically highlighted as the mouse cursor moves over them. Static selection allows to pick particular object (or objects) for further processing.
The position of the mouse is also associated with a sensitive zone. When moving within the window where objects are displayed, the areas touched by the zone of the mouse are analyzed. The owners of these areas are then highlighted or signaled by other means such as the name of the object highlighted in a list. That way, you are informed of the identity of the detected element.
There are 3 different selection types:
- **Point selection** -- allows picking and highlighting a single object (or its part) located under the mouse cursor;
- **Rectangle selection** -- allows picking objects or parts located under the rectangle defined by the start and end mouse cursor positions;
- **Polyline selection** -- allows picking objects or parts located under a user-defined non-self-intersecting polyline.
@image html visualization_image007.png "Modeling faces with sensitive primitives"
@image latex visualization_image007.png "Modeling faces with sensitive primitives"
For OCCT selection algorithm, all selectable objects are represented as a set of sensitive zones, called <b>sensitive entities</b>. When the mouse cursor moves in the view, the sensitive entities of each object are analyzed for collision.
@image html visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"
@image latex visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"
@subsubsection occt_visu_2_2_1 Terms and notions
@image html visualization_image009.png "Reference to the sensitive primitive, then to the owner"
@image latex visualization_image009.png "Reference to the sensitive primitive, then to the owner"
This section introduces basic terms and notions used throughout the algorithm description.
<h4>Sensitive entity</h4>
Sensitive entities in the same way as entity owners are links between objects and the selection mechanism.
The purpose of entities is to define what parts of the object will be selectable in particular. Thus, any object that is meant to be selectable must be split into sensitive entities (one or several). For instance, to apply face selection to an object it is necessary to explode it into faces and use them for creation of a sensitive entity set.
@image html visualization_image005.png "Example of a shape divided into sensitive entities"
@image latex visualization_image005.png "Example of a shape divided into sensitive entities"
Depending on the user's needs, sensitive entities may be atomic (point or edge) or complex. Complex entities contain many sub-elements that can be handled by detection mechanism in a similar way (for example, a polyline stored as a set of line segments or a triangulation).
Entities are used as internal units of the selection algorithm and do not contain any topological data, hence they have a link to an upper-level interface that maintains topology-specific methods.
<h4>Entity owner</h4>
Each sensitive entity stores a reference to its owner, which is a class connecting the entity and the corresponding selectable object. Besides, owners can store any additional information, for example, the topological shape of the sensitive entity, highlight colors and methods, or if the entity is selected or not.
<h4>Selection</h4>
To simplify the handling of different selection modes of an object, sensitive entities linked to its owners are organized into sets, called **selections**.
Each selection contains entities created for a certain mode along with the sensitivity and update states.
<h4>Selectable object</h4>
Selectable object stores information about all created selection modes and sensitive entities.
All successors of a selectable object must implement the method that splits its presentation into sensitive entities according to the given mode. The computed entities are arranged in one selection and added to the list of all selections of this object. No selection will be removed from the list until the object is deleted permanently.
For all standard OCCT shapes, zero mode is supposed to select the whole object (but it may be redefined easily in the custom object). For example, the standard OCCT selection mechanism and *AIS_Shape* determine the following modes:
- 0 -- selection of the *AIS_Shape*;
- 1 -- selection of the vertices;
- 2 -- selection of the edges;
- 3 -- selection of the wires;
- 4 -- selection of the faces;
- 5 -- selection of the shells;
- 6 -- selection of the constituent solids.
@image html visualization_image006.png "Hierarchy of references from sensitive entity to selectable object"
@image latex visualization_image006.png "Hierarchy of references from sensitive entity to selectable object"
@image html visualization_image007.png "The principle of entities organization within the selectable object"
@image latex visualization_image007.png "The principle of entities organization within the selectable object"
<h4>Viewer selector</h4>
For each OCCT viewer there is a **Viewer selector** class instance. It provides a high-level API for the whole selection algorithm and encapsulates the processing of objects and sensitive entities for each mouse pick.
The viewer selector maintains activation and deactivation of selection modes, launches the algorithm, which detects candidate entities to be picked, and stores its results, as well as implements an interface for keeping selection structures up-to-date.
<h4>Selection manager</h4>
Selection manager is a high-level API to manipulate selection of all displayed objects. It handles all viewer selectors, activates and deactivates selection modes for the objects in all or particular selectors, manages computation and update of selections for each object. Moreover, it keeps selection structures updated taking into account applied changes.
@image html visualization_image008.png "The relations chain between viewer selector and selection manager"
@image latex visualization_image008.png "The relations chain between viewer selector and selection manager"
@subsubsection occt_visu_2_2_2 Algorithm
All three types of OCCT selection are implemented as a single concept, based on the search for overlap between frustum and sensitive entity through 3-level BVH tree traversal.
<h4>Selection Frustum</h4>
The first step of each run of selection algorithm is to build the selection frustum according to the currently activated selection type.
For the point or the rectangular selection the base of the frustum is a rectangle built in conformity with the pixel tolerance or the dimensions of a user-defined area, respectively. For the polyline selection, the polygon defined by the constructed line is triangulated and each triangle is used as the base for its own frustum. Thus, this type of selection uses a set of triangular frustums for overlap detection.
The frustum length is limited by near and far view volume planes and each plane is built parallel to the corresponding view volume plane.
@image html visualization_image009.png "Rectangular frustum: a) after mouse move or click, b) after applying the rectangular selection"
@image latex visualization_image009.png "Rectangular frustum: a) after mouse move or click, b) after applying the rectangular selection"
@image html visualization_image010.png "Triangular frustum set: a) user-defined polyline, b) triangulation of the polygon based on the given polyline, c) triangular frustum based on one of the triangles"
@image latex visualization_image010.png "Triangular frustum set: a) user-defined polyline, b) triangulation of the polygon based on the given polyline, c) triangular frustum based on one of the triangles"
<h4>BVH trees</h4>
To maintain selection mechanism at the viewer level, a speedup structure composed of 3 BVH trees is used.
The first level tree is constructed of axis-aligned bounding boxes of each selectable object. Hence, the root of this tree contains the combination of all selectable boundaries even if they have no currently activated selections. Objects are added during the display of <i>AIS_InteractiveObject</i> and will be removed from this tree only when the object is destroyed. The 1st level BVH tree is build on demand simultaneously with the first run of the selection algorithm.
The second level BVH tree consists of all sensitive entities of one selectable object. The 2nd level trees are built automatically when the default mode is activated and rebuilt whenever a new selection mode is calculated for the first time.
The third level BVH tree is used for complex sensitive entities that contain many elements: for example, triangulations, wires with many segments, point sets, etc. It is built on demand for sensitive entities with under 800K sub-elements.
@image html visualization_image022.png "Selection BVH tree hierarchy: from the biggest object-level (first) to the smallest complex entity level (third)"
@image latex visualization_image022.png "Selection BVH tree hierarchy: from the biggest object-level (first) to the smallest complex entity level (third)"
<h4>Stages of the algorithm</h4>
The algorithm includes pre-processing and three main stages.
* **Pre-processing** -- implies calculation of the selection frustum and its main characteristics.
* **First stage** -- traverse of the first level BVH tree.
After successful building of the selection frustum, the algorithm starts traversal of the object-level BVH tree. The nodes containing axis-aligned bounding boxes are tested for overlap with the selection frustum following the terms of <i>separating axis theorem (SAT)</i>. When the traverse goes down to the leaf node, it means that a candidate object with possibly overlapping sensitive entities has been found. If no such objects have been detected, the algorithm stops and it is assumed that no object needs to be selected. Otherwise it passes to the next stage to process the entities of the found selectable.
* **Second stage** -- traverse of the second level BVH tree
At this stage it is necessary to determine if there are candidates among all sensitive entities of one object.
First of all, at this stage the algorithm checks if there is any transformation applied for the current object. If it has its own location, then the correspondingly transformed frustum will be used for further calculations. At the next step the nodes of the second level BVH tree of the given object are visited to search for overlapping leaves. If no such leafs have been found, the algorithm returns to the second stage. Otherwise it starts processing the found entities by performing the following checks:
- activation check - the entity may be inactive at the moment as it belongs to deactivated selection;
- tolerance check - current selection frustum may be too large for further checks as it is always built with the maximum tolerance among all activated entities. Thus, at this step the frustum may be scaled.
After these checks the algorithm passes to the last stage.
* **Third stage** -- overlap or inclusion test of a particular sensitive entity
If the entity is atomic, a simple SAT test is performed. In case of a complex entity, the third level BVH tree is traversed. The quantitative characteristics (like depth, distance to the center of geometry) of matched sensitive entities is analyzed and clipping planes are applied (if they have been set). The result of detection is stored and the algorithm returns to the second stage.
@subsubsection occt_visu_2_2_3 Packages and classes
Selection is implemented as a combination of various algorithms divided among several packages -- <i>SelectBasics</i>, <i>Select3D</i>, <i>SelectMgr</i> and <i>StdSelect</i>.
<h4>SelectBasics</h4>
<i>SelectBasics</i> package contains basic classes and interfaces for selection. The most notable are:
- <i>SelectBasics_SensitiveEntity</i> -- the base definition of a sensitive entity;
- <i>SelectBasics_EntityOwner</i> -- the base definition of the an entity owner -- the link between the sensitive entity and the object to be selected;
- <i>SelectBasics_PickResult</i> -- the structure for storing quantitative results of detection procedure, for example, depth and distance to the center of geometry;
- <i>SelectBasics_SelectingVolumeManager</i> -- the interface for interaction with the current selection frustum.
@subsubsection occt_visu_2_2_1 The Sensitive Primitive
Each custom sensitive entity must inherit at least <i>SelectBasics_SensitiveEntity</i>.
The sensitive primitive along with the entity owner allows defining what can be made selectable, and providing the link between the applicative object and the sensitive zones defined by the 2D bounding boxes. To be dynamically selectable, an object has to be represented either as a sensitive primitive or a set of them, e.g. 2D boxes that will be included in a sorting algorithm.
<h4>Select3D</h4>
The use of 2D boxes allows a pre-selection of the detected entities. After pre-selection, the algorithm checks which sensitive primitives are actually detected. When detected, the primitives provide their owners' identity.
<i>Select3D</i> package provides a definition of standard sensitive entities, such as:
- box;
- circle;
- curve;
- face;
- group;
- point;
- segment;
- triangle;
- triangulation;
- wire.
@image html visualization_image010.png "Example of sensitive primitives"
@image latex visualization_image010.png "Example of sensitive primitives"
Each basic sensitive entity inherits <i>Select3D_SensitiveEntity</i>, which is a child class of <i>SelectBasics_SensitiveEntity</i>.
In the example, the sensitive line segment proposes a bounding box to the selector. During selection, positions 1 and 2 of the mouse detect the box but after sorting, only position 2 retains the line segment as selected by the algorithm.
The package also contains two auxiliary classes, <i>Select3D_SensitivePoly</i> and <i>Select3D_SensitiveSet</i>.
When the Box associated with the position of the mouse intersects the Box of a sensitive primitive, the owner of the sensitive primitive is called and its presentation is highlighted.
<i>Select3D_SensitivePoly</i> -- describes an arbitrary point set and implements basic functions for selection. It is important to know that this class does not perform any internal data checks. Hence, custom implementations of sensitive entity inherited from <i>Select3D_SensitivePoly</i> must satisfy the terms of Separating Axis Theorem to use standard OCCT overlap detection methods.
The notion of sensitive primitive is important for the developer when defining his own classes of sensitive primitives for the chosen selection modes. The classes must contain *Areas* and *Matches* functions.
<i>Select3D_SensitiveSet</i> -- a base class for all complex sensitive entities that require the third level BVH usage. It implements traverse of the tree and defines an interface for the methods that check sub-entities.
The former provides the list of 2D sensitive boxes representing the sensitive primitive at pre-selection and the latter determines if the detection of the primitive by the 2D boxes is valid.
<h4>SelectMgr</h4>
<i>SelectMgr</i> package is used to maintain the whole selection process. For this purpose, the package provides the following services:
- activation and deactivation of selection modes for all selectable objects;
- interfaces to compute selection mode of the object;
- definition of selection filter classes;
- keeping selection BVH data up-to-date.
@subsubsection occt_visu_2_2_2 Dynamic Selection
A brief description of the main classes:
- <i>SelectMgr_FrustumBase</i>, <i>SelectMgr_Frustum</i>, <i>SelectMgr_RectangularFrustum</i>, <i>SelectMgr_TriangluarFrustum</i> and <i>SelectMgr_TriangularFrustumSet</i> -- interfaces and implementations of selecting frustums, these classes implement different SAT tests for overlap and inclusion detection. They also contain methods to measure characteristics of detected entities (depth, distance to center of geometry);
- <i>SelectMgr_SensitiveEntity</i>, <i>SelectMgr_Selection</i> and <i>SelectMgr_SensitiveEntitySet</i> -- store and handle sensitive entities; <i>SelectMgr_SensitiveEntitySet</i> implements a primitive set for the second level BVH tree;
- <i>SelectMgr_SelectableObject</i> and <i>SelectMgr_SelectableObjectSet</i> -- describe selectable objects. They also manage storage, calculation and removal of selections. <i>SelectMgr_SelectableObjectSet</i> implements a primitive set for the first level BVH tree;
- <i>SelectMgr_ViewerSelector</i> -- encapsulates all logics of the selection algorithm and implements the third level BVH tree traverse;
- <i>SelectMgr_SelectionManager</i> -- manages activation/deactivation, calculation and update of selections of every selectable object, and keeps BVH data up-to-date.
Dynamic selection causes objects in a view to be automatically highlighted
as the mouse cursor moves over them. This allows the user to be certain that the picked object
is the correct one. Dynamic Selection is based on the following two concepts:
<h4>StdSelect</h4>
* a Selectable Object (*AIS_InteractiveObject*)
* an Interactive Context
<h4>Selectable Object</h4>
<i>StdSelect</i> package contains the implementation of some <i>SelectMgr</i> classes and tools for creation of selection structures. For example,
- <i>StdSelect_BRepOwner</i> -- defines an entity owner with a link to its topological shape and methods for highlighting;
- <i>StdSelect_BRepSelectionTool</i> -- contains algorithms for splitting standard AIS shapes into sensitive primitives;
- <i>StdSelect_ViewerSelector3d</i> -- an example of <i>SelectMgr_ViewerSelecor</i> implementation, which is used in a default OCCT selection mechanism;
- <i>StdSelect_FaceFilter</i>, <i>StdSelect_EdgeFilter</i> -- implementation of selection filters.
A selectable object presents a given number of selection modes which can be redefined, and which will be activated or deactivated in the selection manager's selectors.
@subsubsection occt_visu_2_2_4 Examples of usage
Note that the selection mode of a selectable object, can refer to the selection mode of the object itself or to the selection mode of its part.
The first code snippet illustrates the implementation of <i>SelectMgr_SelectableObject::ComputeSelection()</i> method in a custom interactive object. The method is used for computation of user-defined selection modes.
For each selection mode, a *SelectMgr_Selection* object class is included in the selectable object. (Each selection mode establishes a priority of selection for each class of selectable object defined.)
Let us assume it is required to make a box selectable in two modes -- the whole shape (mode 0) and each of its edges (mode 1).
The notion of **Selection** is comparable to the notion of **Display**. Just as a display contains a set of graphic primitives that allow display of the entity in a specific display mode, a **Selection** contains a set of sensitive primitives, which allow detection of the entities they are associated with.
To select the whole box, the application can create a sensitive primitive for each face of the interactive object. In this case, all primitives share the same owner -- the box itself.
<h4>Interactive Context</h4>
The interactive context is used to manage both selectable objects and selection processes.
Selection modes may be activated or de-activated for given selectable objects. Information is then provided about the status of activated/de-activated selection modes for a given object in a given selector.
See also @ref occt_visu_3 "AIS: Application Interactive Services".
Let us consider, for example, a 3D selectable shape object, which corresponds to a topological shape.
For this class, seven selection modes can be defined:
* mode 0 - selection of the shape itself
* mode 1 - selection of vertices
* mode 2 - selection of edges
* mode 3 - selection of wires
* mode 4 - selection of faces
* mode 5 - selection of shells
* mode 6 - selection of solids
* mode 7 - selection of compsolids
* mode 8 - selection of compounds
Selection 2 includes the sensitive primitives that model all the edges of the shape. Each of these primitives contains a reference to the edge it represents.
The selections may be calculated before any activation and are graph independent as long as they are not activated in a given selector. Activation of selection mode 3 in a selector associated with a view V leads to the projection of the 3D sensitive primitives contained in the selection; then the 2D areas which represent the 2D bounding boxes of these primitives are provided to the sorting process of the selector containing all the detectable areas.
To deactivate selection mode 3 remove all those 2D areas.
@subsubsection occt_visu_2_2_3 Selection Packages
Selection of 3D data structures is provided using various algorithms. The following selection packages exist : *SelectBasics*, *SelectMgr*, *Select3D* and *StdSelect*.
### Basic Selection
*SelectBasics* package contains the basic classes of the selection:
* the main definition of a sensitive primitive: *SensitiveEntity*, which is a selectable entity in a view;
* the definition of a sensitive primitive owner: *EntityOwner* this entity relates the primitive to the application entity which is to be selected in the view.
* the algorithm used for sorting sensitive boxes: *SortAlgo*
*EntityOwner* is used to establish a link from *SensitiveEntity* to application-level objects. For example, *SelectMgr_EntityOwner* (see below) class holds a pointer to corresponding *SelectableObject*.
### Standard Selections
*Select3D* package provides definition of all 3D standard sensitive primitives such as point, curve and face. All these classes inherit from 3D *SensitiveEntry* from *SelectBasics* with an additional method, which allows recovery of the bounding boxes in the 2D graphic selection space, if required. This package also includes the 3D-2D projector.
*StdSelect* package provides standard uses of the classes described above and main tools used to prevent the developer from redefining the selection objects. In particular, *StdSelect* includes standard modes for selection of topological shapes, definition of several filter standard <i> Selection2d.ap </i> classes and 3D viewer selectors.
Note that each new Interactive Object must have all its selection modes defined.
### Selection Management
*SelectMgr* package is used to manage the whole dynamic selection process.
It provides low level services and classes *SelectMgr_SelectionManager* and *SelectMgr_ViewerSelector*. They can be used when you do not want to use the services provided by *AIS*.
There are also implementations of *ViewerSelector* interface for 3D selection in *StdSelect* package: *ViewerSelector3d*.
*SelectMgr* manages the process of dynamic selection through the following services:
* Activating and deactivating selection modes for Interactive Objects.
* Adding and removing viewer selectors.
* Definitions of abstract filter classes.
The principle of graphic selection consists in representing the objects which you want to select by a bounding box in the selection view.
The object is selected when you use the mouse to designate the zone produced by the object.
To realize this, the application creates a selection structure which is independent of the point of view.
This structure is made up of sensitive primitives which have one owner object associated to each of them.
The role of the sensitive primitive is to reply to the requests of the selection algorithm whereas the owner's purpose is to make the link between the sensitive primitive and the object to be selected.
Each selection structure corresponds to a selection mode which defines the elements that can be selected.
### Example: Selection of a Geometric Model
For example, to select a complete geometric model, the application can create a sensitive primitive for each face of the interactive object representing the geometric model.
In this case, all the primitives share the same owner.
On the other hand, to select an edge in a model, the application must create one sensitive primitive per edge.
To select box's edge, the application must create one sensitive primitive per edge. Here all sensitive entities cannot share the owner since different geometric primitives must be highlighted as the result of selection procedure.
~~~~
void InteractiveBox::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
void InteractiveBox::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
switch (theMode)
{
case 0: // locating the whole box by making its faces sensitive
switch (theMode)
{
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, 5);
for (Standard_Integer anIt = 1; anIt <= aFacesNb; anIt++)
{
theSel->Add (new Select3D_SensitiveFace (anOwner,[array of the vertices] face I);
break;
}
case 1: // locating the edges
case 0: // creation of face sensitives for selection of the whole box
{
for (Standard_Integer anIt = 1; anIt <= 12; anIt++)
Handle(SelectMgr_EntityOwner) anOwnr = new SelectMgr_EntityOwner (this, 5);
for (Standard_Integer aFaceIdx = 1; aFaceIdx <= myNbFaces; aFaceIdx++)
{
// 1 owner per edge
Handle(mypk_EdgeOwner) anOwner = new mypk_EdgeOwner (this, anIt, 6); // 6->priority
theSel->Add (new Select3D_SensitiveSegment (anOwner, firstpt (anIt), lastpt (anIt));
Select3D_TypeOfSensitivity aIsInteriorSensitivity = myIsInterior;
theSel->Add (new Select3D_SensitiveFace (anOwnr,
myFaces[aFaceIdx]->PointArray(),
aIsInteriorSensitivity));
}
break;
}
case 1: // creation of edge sensitives for selection of box edges only
{
for (Standard_Integer anEdgeIdx = 1; anEdgeIdx <= 12; anEdgeIdx++)
{
// 1 owner per edge, where 6 is a priority of the sensitive
Handle(MySelection_EdgeOwner) anOwnr = new MySelection_EdgeOwner (this, anEdgeIdx, 6);
theSel->Add (new Select3D_SensitiveSegment (anOwnr,
FirstPnt[anEdgeIdx]),
LastPnt[anEdgeIdx]));
}
break;
}
}
}
~~~~
The algorithms for creating selection structures store the sensitive primitives in a <i>SelectMgr_Selection</i> object.
To do this, a set of ready-made sensitive primitives is supplied in the <i>Select3D</i>package.
New sensitive primitives can be defined through inheritance from <i>SensitiveEntity</i>.
For the application to make its own objects selectable, it must define owner classes inheriting <i>SelectMgr_EntityOwner</i>.
The algorithms for creating selection structures store sensitive primitives in <i>SelectMgr_Selection</i> instance. Each <i>SelectMgr_Selection</i> sequence in the list of selections of the object must correspond to a particular selection mode.
Selection structures for any interactive object are generated in <i>ComputeSelection()</i> method.
In the example below there are different modes of selection on the topological shape contained within the interactive object,
selection of the shape itself, the vertices, the edges, the wires, the faces.
To describe the decomposition of the object into selectable primitives, a set of ready-made sensitive entities is supplied in <i>Select3D</i> package. Custom sensitive primitives can be defined through inheritance from <i>SelectBasics_SensitiveEntity</i>.
To make custom interactive objects selectable or customize selection modes of existing objects, the entity owners must be defined. They must inherit <i>SelectMgr_EntityOwner</i> interface.
Selection structures for any interactive object are created in <i>SelectMgr_SelectableObject::ComputeSelection()</i> method.
The example below shows how computation of different selection modes of the topological shape can be done using standard OCCT mechanisms, implemented in <i>StdSelect_BRepSelectionTool</i>.
~~~~
void MyPack_MyClass::ComputeSelection(
const Handle(SelectMgr_Selection)& theaSelection,
const Standard_Integer theMode)
void MyInteractiveObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
{
switch (theMode)
{
case 0:
StdSelect_BRepSelectionTool::Load (theSelection, this, myShape, TopAbs_SHAPE);
StdSelect_BRepSelectionTool::Load (theSelection, this, myTopoDSShape, TopAbs_SHAPE);
break;
case 1:
StdSelect_BRepSelectionTool::Load (theSelection, this, myShape, TopAbs_VERTEX);
StdSelect_BRepSelectionTool::Load (theSelection, this, myTopoDSShape, TopAbs_VERTEX);
break;
case 2:
StdSelect_BRepSelectionTool::Load (theSelection, this, myShape, TopAbs_EDGE);
StdSelect_BRepSelectionTool::Load (theSelection, this, myTopoDSShape, TopAbs_EDGE);
break;
case 3:
StdSelect_BRepSelectionTool::Load (theSelection, this, myShape, TopAbs_WIRE);
StdSelect_BRepSelectionTool::Load (theSelection, this, myTopoDSShape, TopAbs_WIRE);
break;
case 4:
StdSelect_BRepSelectionTool::Load (theSelection, this, myShape, TopAbs_FACE);
StdSelect_BRepSelectionTool::Load (theSelection, this, myTopoDSShape, TopAbs_FACE);
break;
}
}
~~~~
The <i>StdSelect_BRepSelectionTool</i> object provides a high level service which will make the topological shape <i>myShape</i> selectable when the <i>AIS_InteractiveContext</i> is asked to display your object.
Note:
The <i>StdSelect_BRepSelectionTool</i> class provides a high level API for computing sensitive entities of the given type (for example, face, vertex, edge, wire and others) using topological data from the given <i>TopoDS_Shape</i>.
The traditional way of highlighting selected entity owners adopted by Open CASCADE Technology assumes that each entity owner highlights itself on its own. This approach has two drawbacks:
* Each entity owner has to maintain its own <i>Prs3d_Presentation object</i>, that results in large memory overhead for thousands of owners.
* Drawing selected owners one by one is not efficient from the OpenGL usage viewpoint.
- each entity owner has to maintain its own <i>Prs3d_Presentation</i> object, that results in a large memory overhead for thousands of owners;
- drawing selected owners one by one is not efficient from the OpenGL usage viewpoint.
That is why a different method has been introduced.
On the basis of <i>SelectMgr_EntityOwner::IsAutoHilight()</i> return value <i>AIS_LocalContext</i>
object either uses the traditional way of highlighting (<i>IsAutoHilight()</i> returned true)
or groups such owners according to their Selectable Objects and finally calls <i> SelectMgr_SelectableObject::HilightSelected()</i> or
<i>ClearSelected()</i>, passing a group of owners as an argument.
Therefore, to overcome these limitations, OCCT has an alternative way to implement the highlighting of a selected presentation. Using this approach, the interactive object itself will be responsible for the highlighting, not the entity owner.
Hence, an application can derive its own interactive object and redefine <i> HilightSelected()</i>,
<i>ClearSelected()</i> and <i>HilightOwnerWithColor()</i> virtual methods
to take advantage of such OpenGL technique as arrays of primitives.
In any case, these methods should at least have empty implementation.
On the basis of <i>SelectMgr_EntityOwner::IsAutoHilight()</i> return value, <i>AIS_LocalContext</i> object either uses the traditional way of highlighting (in case if <i>IsAutoHilight()</i> returns true) or groups such owners according to their selectable objects and finally calls <i> SelectMgr_SelectableObject::HilightSelected()</i> or <i>SelectMgr_SelectableObject::ClearSelected()</i>, passing a group of owners as an argument.
The <i>AIS_LocalContext::UpdateSelected (const Handle(AIS_InteratciveObject)&, Standard_Boolean)</i>
method can be used for efficient redrawing a selection presentation for a given interactive object from an application code.
Additionally, the <i>SelectMgr_SelectableObject::ClearSelections()</i> method now accepts an optional Boolean argument.
This parameter defines whether all object selections should be flagged for further update or not.
This improved method can be used to re-compute an object selection (without redisplaying the object completely)
when some selection mode is activated not for the first time.
Hence, an application can derive its own interactive object and redefine virtual methods <i>HilightSelected()</i>, <i>ClearSelected()</i> and <i>HilightOwnerWithColor()</i> from <i>SelectMgr_SelectableObject</i>. <i>SelectMgr_SelectableObject::GetHilightPresentation</i> and <i>SelectMgr_SelectableObject::GetSelectPresentation</i> methods can be used to optimize filling of selection and highlight presentations according to the user's needs.
@subsubsection occt_visu_2_2_4 How to use dynamic selection
The <i>AIS_InteractiveContext::HighlightSelected()</i> method can be used for efficient redrawing of the selection presentation for a given interactive object from an application code.
Several operations must be performed prior to using dynamic selection:
1. Implement specific sensitive primitives if those defined in Select3D are not sufficient. These primitives must inherit from *SensitiveEntity* from *SelectBasics* or from a suitable Select3D sensitive entity class when a projection from 3D to 2D is necessary.
2. Define all the owner types, which will be used, and the classes of selectable objects, i.e. the number of possible selection modes for these objects and the calculation of the decomposition of the object into sensitive primitives of all the primitives describing this mode. It is possible to define only one default selection mode for a selectable object if this object is to be selectable in a unique way.
3. Install the process, which provides the user with the identity of the owner of the detected entities in the selection loop.
When all these steps have been carried out, follow the procedure below:
1. Create an interactive context.
2. Create the selectable objects and calculate their various possible selections.
3. Load these selectable objects in the interactive context. The objects may be common to all the selectors, i.e. they will be seen by all the selectors in the selection manager, or local to one selector or more.
4. Activate or deactivate the objects' selection modes in the selector(s). When activating a selection mode in a selector for a given object, the manager sends the order to make the sensitive primitives in this selector selectable. If the primitives are to projected from 3D to 2D, the selector calls the specific method used to carry out this projection.
After all the necessary sensitive entities are computed and packed in <i>SelectMgr_Selection</i> instance with the corresponding owners in a redefinition of <i>SelectMgr_SelectableObject::ComputeSelection()</i> method, it is necessary to register the prepared selection in <i>SelectMgr_SelectionManager</i> through the following steps:
- if there was no <i>AIS_InteractiveContext</i> opened, create an interactive context and display the selectable object in it;
- load the selectable object to the selection manager of the interactive context using <i>AIS_InteractiveContext::Load()</i> method. If the selection mode passed as a parameter to this method is not equal to -1, <i>ComputeSelection()</i> for this selection mode will be called;
- activate or deactivate the defined selection mode using <i>AIS_InteractiveContext::Activate()</i> or <i>AIS_InteractiveContext::Deactivate()</i> methods.
At this stage, the selection of selectable entities in the selectors is available.
The selection loop informs constantly the selectors with the position of the mouse and questions them about the detected entities.
After these steps, the selection manager of the created interactive context will contain the given object and its selection entities, and they will be involved in the detection procedure.
Let us suppose that you create an application that displays houses in a viewer of the V3d package and you want to select houses or parts of these houses (windows, doors, etc.) in the graphic window.
You define a selectable object called *House* and propose four possible selection modes for this object:
1. selection of the house itself;
2. selection of the rooms
3. selection of the walls
4. selection of the doors.
You have to write the method, which calculates the four selections above, i.e. the sensitive primitives which are activated when the mode is.
You must define the class *Owner* specific to your application. This class will contain the reference to the house element it represents: wall, door or room. It inherits from *EntityOwner* from *SelectMgr*.
For example, let us consider a house with the following representation:
@image html visualization_image011.png "Selection of rooms in a house"
@image latex visualization_image011.png "Selection of rooms in a house"
To build the selection, which corresponds to the mode "selection of the rooms"
(selection 2 in the list of selection modes), use the following procedure:
The code snippet below illustrates the above steps. It also contains the code to start the detection procedure and parse the results of selection.
~~~~~
Void House::ComputeSelection
(Const Handle(SelectMgr_Selection)& Sel,
const Standard_Integer mode {
switch(mode){
case 0: //Selection of the rooms
{
for(Standard_Integer i = 1; i <= myNbRooms; i++)
{
//for every room, create an instance of the owner, the given room and its name.
Handle(RoomOwner) aRoomOwner = new RoomOwner (Room(i), NameRoom(i));
//Room() returns a room and NameRoom() returns its name.
Handle(Select3d_SensitiveBox) aSensitiveBox;
aSensitiveBox = new Select3d_SensitiveBox
(aRoomOwner, Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
Sel -> Add(aSensitiveBox);
}
break;
Case 1: ... //Selection of the doors
} //Switch
) // ComputeSelection
// Suppose there is an instance of class InteractiveBox from the previous sample.
// It contains an implementation of method InteractiveBox::ComputeSelection() for selection
// modes 0 (whole box must be selected) and 1 (edge of the box must be selectable)
Handle(InteractiveBox) aBox;
// Assume there is a created interactive context
const Handle(AIS_InteractiveContext)& aContext = GetContext();
// To prevent automatic activation of the default selection mode
aContext->SetAutoActivateSelection (Standard_False);
aContext->Display (aBox);
// Load a box to the selection manager without computation of any selection mode
aContext->Load (aBox, -1, Standard_True);
// Activate edge selection
aContext->Activate (aBox, 1);
// Run the detection mechanism for activated entities in the current mouse coordinates and
// in the current view. Detected owners will be highlighted with context highlight color
aContext->MoveTo (aXMousePos, aYMousePos, myView);
// Select the detected owners
aContext->Select();
// Iterate through the selected owners
for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected())
{
Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
}
// deactivate all selection modes for aBox1
aContext->Deactivate (aBox1);
~~~~~
@image html visualization_image012.png "Activated sensitive boxes corresponding to selection mode 0 (selection of rooms)"
@image latex visualization_image012.png "Activated sensitive boxes corresponding to selection mode 0 (selection of rooms)"
It is also important to know, that there are 2 types of detection implemented for rectangular selection in OCCT:
- <b>inclusive</b> detection. In this case the sensitive primitive is considered detected only when all its points are included in the area defined by the selection rectangle;
- <b>overlap</b> detection. In this case the sensitive primitive is considered detected when it is partially overlapped by the selection rectangle.
@image html visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1"
@image latex visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1"
The standard OCCT selection mechanism uses inclusion detection by default. To change this, use the following code:
@image html visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
@image latex visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
~~~~~
@image html visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2"
@image latex visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2"
// Assume there is a created interactive context
const Handle(AIS_InteractiveContext)& aContext = GetContext();
// Retrieve the current viewer selector
const Handle(StdSelect_ViewerSelector3d)& aMainSelector = aContext->MainSelector();
// Set the flag to allow overlap detection
aMainSelector->AllowOverlapDetection (Standard_True);
~~~~~
@section occt_visu_3 Application Interactive Services
@subsection occt_visu_3_1 Introduction
@@ -555,25 +608,24 @@ void myPk_IsShape::Compute
@subsubsection occt_visu_3_2_4 Selection
An interactive object can have an indefinite number of selection modes, each representing a "decomposition" into sensitive primitives; each primitive has an Owner (*SelectMgr_EntityOwner*) which allows identifying the exact entity which has been detected (see ref occt_visu_3_6 "Dynamic Selection" chapter).
An interactive object can have an indefinite number of selection modes, each representing a "decomposition" into sensitive primitives. Each primitive has an <i>owner</i> (*SelectMgr_EntityOwner*) which allows identifying the exact interactive object or shape which has been detected (see @ref occt_visu_2_2 "Selection" chapter).
The set of sensitive primitives, which correspond to a given mode, is stocked in a SELECTION (*SelectMgr_Selection*).
The set of sensitive primitives, which correspond to a given mode, is stocked in a <b>selection</b> (*SelectMgr_Selection*).
Each Selection mode is identified by an index. By Convention, the default selection mode that allows us to grasp the Interactive object in its entirety is mode *0*.
Each selection mode is identified by an index. By convention, the default selection mode that allows us to grasp the interactive object in its entirety is mode *0*. However, it can be modified in the custom interactive objects using method <i>SelectMgr_SelectableObject::setGlobalSelMode()</i>.
The calculation of Selection primitives (or sensitive primitives) is done by the intermediary of a virtual function, *ComputeSelection*. This should be implemented for each type of interactive object on which you want to make different type selections using the function *AIS_ConnectedInteractive::ComputeSelection*.
The calculation of selection primitives (or sensitive entities) is done by the intermediary of a virtual function, *ComputeSelection*. It should be implemented for each type of interactive object that is assumed to have different selection modes using the function *AIS_ConnectedInteractive::ComputeSelection*.
A detailed explanation of the mechanism and the manner of implementing this function has been given in @ref occt_visu_3_6 "Dynamic Selection" chapter.
A detailed explanation of the mechanism and the manner of implementing this function has been given in @ref occt_visu_2_2 "Selection" chapter.
Moreover, just as the most frequently manipulated entity is *TopoDS_Shape*, the most used Interactive Object is *AIS_Shape*. You will see below activation functions for standard selection modes are proposed in the Interactive context (selection by vertex, by edges etc). To create new classes of interactive object with the same behavior as *AIS_Shape* -- such as vertices and edges -- you must redefine the virtual function *AIS_ConnectedInteractive::AcceptShapeDecomposition*.
There are some examples of selection mode calculation for the most widely used interactive object in OCCT -- *AIS_Shape* (selection by vertex, by edges, etc). To create new classes of interactive objects with the same selection behavior as *AIS_Shape* -- such as vertices and edges -- you must redefine the virtual function *AIS_InteractiveObject::AcceptShapeDecomposition*.
You can change the default selection mode index of an Interactive Object using the following functions:
* *AIS_InteractiveObject::HasSelectionMode* checks if there is a selection mode;
* *AIS_InteractiveObject::SelectionMode* check the current selection mode;
* *AIS_InteractiveContext::SetSelectionMode* sets a selection mode;
* *AIS_InteractiveContext::UnsetSelectionMode* unsets a selection mode.
You can change the default selection mode index of a custom interactive object using the following functions:
* *AIS_InteractiveObject::setGlobalSelMode* sets global selection mode;
* *AIS_InteractiveObject::GlobalSelectionMode* returns global selection mode of the object;
* *AIS_InteractiveObject::GlobalSelOwner* returns an entity owner that corresponds to a global selection mode.
These functions can be useful if you decide that the *0* mode used by default will not do. In the same way, you can temporarily change the priority of certain interactive objects for selection of 0 mode to facilitate detecting them graphically using the following functions:
You also can temporarily change the priority of some interactive objects for selection of the global mode to facilitate their graphic detection using the following functions:
* *AIS_InteractiveObject::HasSelectionPriority* checks if there is a selection priority setting for the owner;
* *AIS_InteractiveObject::SelectionPriority* checks the current priority;
* *AIS_InteractiveObject::SetSelectionPriority* sets a priority;
@@ -1423,116 +1475,9 @@ aMesh->AddBuilder (aBuilder, Standard_True);
@subsection occt_visu_3_6 Dynamic Selection
The idea of dynamic selection is to represent the entities, which you want to select by a bounding box in the actual 2D space of the selection view. The set of these zones is ordered by a powerful sorting algorithm.
To then find the applicative entities actually detected at this position, all you have to do is read which rectangles are touched at mouse position (X,Y) of the view, and judiciously reject some of the entities which have provided these rectangles.
The dynamic selection represents the topological shape, which you want to select, by decomposition of <i>sensitive primitives</i> -- the sub-parts of the shape that will be detected and highlighted. The sets of these primitives are handled by the powerful three-level BVH tree selection algorithm.
@subsubsection occt_visu_3_6_1 How to go from the objects to 2D boxes
An intermediary stage consists in representing what you can make selectable by means of sensitive primitives and owners, entities of a high enough level to be known by the selector mechanisms.
The sensitive primitive is capable of:
* giving a 2D bounding box to the selector.
* answering the rejection criteria positively or negatively by a "Matches" function.
* being projected from 3D in the 2D space of the view if need be.
* returning the owner which it will represent in terms of selection.
A set of standard sensitive primitives exists in Select3D packages for 3D primitives.
The owner is the entity, which makes it possible to link the sensitive primitives and the objects that you really wanted to detect. It stocks the diverse information, which makes it possible to find objects. An owner has a priority (*5* by default), which you can change to make one entity more selectable than another.
@image html visualization_image021.png
@image latex visualization_image021.png
@subsubsection occt_visu_3_6_2 Implementation in an interactive/selectable object
Define the number of selection modes possible, i.e. what you want to identify by activating each of the selection modes.
For example: for an interactive object representing a topological shape:
* mode 0: selection of the interactive object itself;
* mode 1: selection of the vertices;
* mode 2: selection of the edges;
* mode 3: selection of the wires;
* mode 4: selection of the detectable faces.
For each selection mode of an interactive object, "model" is the set of entities, which you want to locate by these primitives and these owners.
There is an "owner" root class, *SelectMgr_EntityOwner*, containing a reference to a selectable object, which has created it. If you want to stock its information, you have to create classes derived from this root class. Example: for shapes, there is the *StdSelect_BRepOwner* class, which can save a *TopoDS* shape as a field as well as the Interactive Object.
The set of sensitive primitives which has been calculated for a given mode is stocked in *SelectMgr_Selection*.
For an Interactive object, the modeling is done in the *ComputeSelection* virtual function.
Let us consider an example of an interactive object representing a box.
We are interested in two location modes:
* mode 0: location of the whole box.
* mode 1: location of the edges on the box.
For the first mode, all sensitive primitives will have the same owner, which will represent the interactive object. In the second case, we have to create an owner for each edge, and this owner will have to contain the index for the edge, which it represents. You will create a class of owner, which derives from *SelectMgr_EntityOwner*.
The *ComputeSelection* function for the interactive box can have the following form:
~~~~~
void InteractiveBox::ComputeSelection
(const Handle(SelectMgr_Selection)& Sel,
const Standard_Integer Mode)
{
switch(Mode)
{ case 0: //locating the whole box by making its faces sensitive...
{
Handle(SelectMgr_EntityOwner) Ownr = new SelectMgr_EntityOwner(this,5);
for(Standard_Integer I=1;I<=Nbfaces;I++)
{
//Array is a TColgp_Array1OfPnt: which represents the array of vertices. Sensitivity is
Select3D_TypeOfSensitivity value
Sel->Add(new Select3D_SensitiveFace(Ownr,Array,Sensitivity));
}
break;
}
case 1:
// locates the edges {
for(Standard_Integer i=1;i<=12;i++)
{
// 1 owner per edge...
Handle(mypk_EdgeOwner) Ownr = new mypk_EdgeOwner(this,i,6);
//6->priority
Sel->Add(new Select3D_SensitiveSegment (Ownr,firstpt(i),lastpt(i)));
}
break;
}
}
}
~~~~~
Selectable objects are loaded in the selection manager, which has one or more selectors; in general, we suggest assigning one selector per viewer. All you have to do afterwards is to activate or deactivate the different selection modes for selectable objects. The *SelectionManager* looks after the call to the *ComputeSelection* functions for different objects.
NOTE: This procedure is completely hidden if you use the @ref occt_visu_3_3 "AIS Interactive Context"
<h4>Example </h4>
~~~~~
//We have several " interactive boxes " box1, box2, box3;
Handle(SelectMgr_SelectionManager) SM = new SelectMgr_SelectionManager();
Handle(StdSelect_ViewerSelector3d) VS = new StdSelect_ViewerSelector3d();
SM->Add(VS);
SM->Load(box1);SM->Load(box2);SM->Load(box3);
// box load.
SM->Activate(box1,0,VS);
// activates mode 0 of box 1 in the selector VS
SM->Activate(box1,1,VS);
M->Activate(box3,1,VS);
VS->Pick(xpix,ypix,vue3d)
// detection of primitives by mouse position.
Handle(EntityOwner) POwnr = VS->OnePicked();
// picking of the "best" owner detected
for(VS->Init();VS->More();VS->Next())
{
VS->Picked();
// picking of all owners detected
}
SM->Deactivate(box1);
// deactivate all active modes of box1
~~~~~
For more details on the algorithm and examples of usage, please, refer to @ref occt_visu_2_2 "Selection" chapter.
@section occt_visu_4 3D Presentations

13
genconf Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Helper script to configure environment for genproj tool.
# Running it requires that Tcl should be in the PATH
# initialize environment
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
if [ ! -e "${aScriptPath}/env.sh" ]; then
cat ${aScriptPath}/adm/templates/env.sh | sed -e '/__CASROOT__/d' > ${aScriptPath}/env.sh
fi
# run GUI tool
tclsh "${aScriptPath}/adm/genconf.tcl"

59
genconf.bat Normal file
View File

@@ -0,0 +1,59 @@
@echo off
rem Helper script to configure environment for building with genproj tool.
rem Running it requires that Tcl should be in the PATH
SET "OLD_PATH=%PATH%"
rem create env.bat if it does not exist yet
if exist "%~dp0env.bat" (
call "%~dp0env.bat"
) else (
type "%~dp0adm\templates\env.bat" | findstr /i /v "__CASROOT__" > "%~dp0env.bat"
)
rem find Tcl
set "TCL_EXEC=tclsh.exe"
for %%X in (%TCL_EXEC%) do (set TCL_FOUND=%%~$PATH:X)
set "TCL_EXEC2=tclsh86.exe"
if not defined TCL_FOUND (
for %%X in (%TCL_EXEC2%) do (
set TCL_FOUND=%%~$PATH:X
set TCL_EXEC=%TCL_EXEC2%
)
)
rem Prompt the user to specify location of Tcl if not found in PATH
if not defined TCL_FOUND (
set /P TCL_PATH=This script requires Tcl, but tclsh.exe cannot be found in PATH.^
Please enter path to folder containing tclsh.exe^
^:
rem NOTE: KEEP LINE AFTER "set" ABOVE EMPTY !
)
if exist %TCL_PATH%\tclsh.exe (
set "TCL_FOUND=%TCL_PATH%\tclsh.exe"
) else if exist %TCL_PATH%\tclsh86.exe (
set "TCL_FOUND=%TCL_PATH%\tclsh86.exe"
) else (
set "TCL_EXEC=%TCL_PATH%\tclsh.exe"
)
rem Initialize custom.bat if it does not exist yet
rem if not exist %%dp0custom.bat (
rem echo set "PATH=%%PATH%%;%TCL_PATH%" >%~dp0custom.bat
rem )
rem fail if Tcl is not found
if not defined TCL_FOUND (
echo Error: "%TCL_EXEC%" is not found. Please update PATH variable ^(use custom.bat^)
goto :eof
)
:: run GUI tool
%TCL_FOUND% %~dp0adm/genconf.tcl
SET "PATH=%OLD_PATH%"

2
gendoc Normal file → Executable file
View File

@@ -12,7 +12,7 @@ anOldDyLd="$DYLD_LIBRARY_PATH"
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi
tclsh "${aScriptPath}/adm/start.tcl" $anArgs
tclsh "${aScriptPath}/adm/start.tcl" gendoc $anArgs
export PATH="$anOldPath"
export LD_LIBRARY_PATH="$anOldLd"

View File

@@ -29,7 +29,8 @@ if [ ! -e "${aScriptPath}/custom.sh" ]; then
fi
if [ ! -e "${aScriptPath}/custom.sh" ]; then
echo custom.sh is not created. Run the script again and generate custom.sh
echo "Error: custom.sh is not present."
echo "Run the script again to generate custom.sh, or create it manually"
exit 1
fi
source "${aScriptPath}/custom.sh"

View File

@@ -5,33 +5,38 @@ rem Running it requires that Tcl should be in the PATH
SET "OLD_PATH=%PATH%"
if exist "%~dp0env.bat" (
call "%~dp0env.bat"
) else (
type "%~dp0adm\templates\env.bat" | findstr /i /v "__CASROOT__" > "%~dp0env.bat"
rem run GUI configurator if custom.bat is missing
if not exist "%~dp0custom.bat" (
call %~dp0genconf.bat
)
set "TCL_EXEC=tclsh.exe"
if not exist "%~dp0custom.bat" (
echo Error: custom.bat is not present.
echo Run the script again to generate custom.bat, or create it manually
goto :eof
)
if exist "%~dp0env.bat" (
call "%~dp0env.bat"
)
rem find Tcl
set "TCL_EXEC=tclsh.exe"
for %%X in (%TCL_EXEC%) do (set TCL_FOUND=%%~$PATH:X)
set "TCL_EXEC2=tclsh86.exe"
if not defined TCL_FOUND (
echo "Error. %TCL_EXEC% is not found. Please update PATH variable"
for %%X in (%TCL_EXEC2%) do (
set TCL_FOUND=%%~$PATH:X
set TCL_EXEC=%TCL_EXEC2%
)
)
rem fail if Tcl is not found
if not defined TCL_FOUND (
echo Error: "%TCL_EXEC%" is not found. Please update PATH variable ^(use custom.bat^)
goto :eof
)
if not exist "%~dp0custom.bat" (
%TCL_EXEC% %~dp0adm/genconf.tcl
)
if not exist "%~dp0custom.bat" (
echo custom.bat is not created. Run the script again or create custom.bat manually
goto :eof
)
if exist "%~dp0env.bat" (
call "%~dp0env.bat"
)
)
cd %~dp0
%TCL_EXEC% %~dp0adm/start.tcl genproj -path=. -target=%VCVER%

View File

@@ -245,6 +245,7 @@ void OcctJni_Viewer::resize (int theWidth,
//myView->MustBeResized(); // can be used instead of SetWindow() when EGLsurface has not been changed
EGLContext anEglContext = eglGetCurrentContext();
myView->SetImmediateUpdate (Standard_False);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext);
//saveSnapshot ("/sdcard/Download/tt.png", theWidth, theHeight);
}
@@ -554,7 +555,8 @@ void OcctJni_Viewer::fitAll()
return;
}
myView->FitAll();
myView->FitAll (0.01, Standard_False);
myView->Invalidate();
}
// =======================================================================
@@ -570,6 +572,7 @@ void OcctJni_Viewer::startRotation (int theStartX,
}
myView->StartRotation (theStartX, theStartY, 0.45);
myView->Invalidate();
}
// =======================================================================
@@ -585,6 +588,7 @@ void OcctJni_Viewer::onRotation (int theX,
}
myView->Rotation (theX, theY);
myView->Invalidate();
}
// =======================================================================
@@ -600,6 +604,7 @@ void OcctJni_Viewer::onPanning (int theDX,
}
myView->Pan (theDX, theDY);
myView->Invalidate();
}
// =======================================================================
@@ -615,7 +620,8 @@ void OcctJni_Viewer::onClick (int theX,
}
myContext->MoveTo (theX, theY, myView, Standard_False);
myContext->Select (Standard_True);
myContext->Select (Standard_False);
myView->Invalidate();
}
// =======================================================================

View File

@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FuncDemo-vc10", "FuncDemo-vc10.vcxproj", "{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Debug|Win32.ActiveCfg = Debug|x64
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Debug|x64.ActiveCfg = Release|x64
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Debug|x64.Build.0 = Release|x64
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Release|Win32.ActiveCfg = Release|x64
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Release|x64.ActiveCfg = Release|x64
{F2D59C5F-5C24-30CF-AD15-5EFBBA975C97}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FuncDemo-vc11", "FuncDemo-vc11.vcxproj", "{2D45A075-9BD9-385B-9361-B8E6DB02E623}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2D45A075-9BD9-385B-9361-B8E6DB02E623}.Debug|Win32.ActiveCfg = Debug|x64
{2D45A075-9BD9-385B-9361-B8E6DB02E623}.Debug|x64.ActiveCfg = Debug|x64
{2D45A075-9BD9-385B-9361-B8E6DB02E623}.Release|Win32.ActiveCfg = Release|x64
{2D45A075-9BD9-385B-9361-B8E6DB02E623}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FuncDemo-vc12", "FuncDemo-vc12.vcxproj", "{10FEA026-33D8-3FA2-904F-8B99F5CC7A8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10FEA026-33D8-3FA2-904F-8B99F5CC7A8F}.Debug|Win32.ActiveCfg = Debug|x64
{10FEA026-33D8-3FA2-904F-8B99F5CC7A8F}.Debug|x64.ActiveCfg = Debug|x64
{10FEA026-33D8-3FA2-904F-8B99F5CC7A8F}.Release|Win32.ActiveCfg = Release|x64
{10FEA026-33D8-3FA2-904F-8B99F5CC7A8F}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,81 @@
TEMPLATE = app
CONFIG += debug_and_release qt
TARGET = FuncDemo
SAMPLESROOT = $$quote($$(CASROOT)/samples/qt)
HEADERS = src/*.h
SOURCES = src/*.cpp
INCLUDEPATH += $$quote($$(CASROOT)/inc)
OCCT_DEFINES = $$(CSF_DEFINES)
DEFINES = $$split(OCCT_DEFINES, ;)
unix {
UNAME = $$system(uname -s)
LIBLIST = $$(LD_LIBRARY_PATH)
LIBPATHS = $$split(LIBLIST,":")
for(lib, LIBPATHS):LIBS += -L$${lib}
CONFIG(debug, debug|release) {
DESTDIR = ./$$UNAME/bind
OBJECTS_DIR = ./$$UNAME/objd
MOC_DIR = ./src
} else {
DESTDIR = ./$$UNAME/bin
OBJECTS_DIR = ./$$UNAME/obj
MOC_DIR = ./src
}
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
!macx | equals(MACOSX_USE_GLX, true): INCLUDEPATH += $$QMAKE_INCDIR_X11 $$QMAKE_INCDIR_OPENGL $$QMAKE_INCDIR_THREAD
equals(MACOSX_USE_GLX, true): DEFINES += MACOSX_USE_GLX
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
QMAKE_CXXFLAGS += -std=gnu++11
}
win32 {
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bind
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
MOC_DIR = ./src
LIBS = -L$$(QTDIR)/lib;$$(CASROOT)/win$$(ARCH)/$$(VCVER)/libd
} else {
DEFINES += NDEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bin
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
MOC_DIR = ./src
LIBS = -L$$(QTDIR)/lib;$$(CASROOT)/win$$(ARCH)/$$(VCVER)/lib
}
}
LIBS += -lTKernel -lTKMath -lTKBRep -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
-lTKTopAlgo -lTKMesh -lTKPrim -lTKCDF -lTKLCAF -lTKCAF -lTKBO
lrelease.name = LRELEASE ${QMAKE_FILE_IN}
lrelease.commands = lrelease ${QMAKE_FILE_IN} -qm $${RES_DIR}/${QMAKE_FILE_BASE}.qm
lrelease.output = ${QMAKE_FILE_BASE}.qm
lrelease.input = TS_FILES
lrelease.clean = $${RES_DIR}/${QMAKE_FILE_BASE}.qm
lrelease.CONFIG += no_link target_predeps
QMAKE_EXTRA_COMPILERS += lrelease
copy_res.name = Copy resource ${QMAKE_FILE_IN}
copy_res.output = ${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
copy_res.clean = $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
copy_res.input = RES_FILES
copy_res.CONFIG += no_link target_predeps
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
QMAKE_EXTRA_COMPILERS += copy_res
#QMAKE_CXXFLAGS += /wd4996
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
}

View File

@@ -0,0 +1,30 @@
Advanced Function Mechanism sample application
==============================================
This sample demonstrates a simple way of using an advanced function mechanism of Ocaf.
Description
===========
The sample application represents a window demontsrating calculation of two simple models by the advanced function mechanism. The models are displayed as a graph (colored circles connected to each other). The links between circles define the dependences of the sample functions. Having pressed the button "Compute" the user may see how the function mechanism calculates the functions - the calculated circles change the color to yellow (indicating the process of calculation) and then, to blue - the function is computed. It is possible to define the number of threads to be used by the function mechanism (up to 4, just a limitation of this sample application). Having chosen 4 threads, for example, the user may see how the functions are calculated by 4 at once.
Compilation
===========
Run genproj.bat in a command-line to generate Visual Studio projects. For example, for Visual Studio 2010 call this line:
>genproj vc10 win32 debug
It generates VCPROJ (or VCXPROJ) files. Then, call the Visual Studio:
msvc vc10 win32 debug
Usage
=====
There are 4 menu-items:
Model \ Model1 - chooses the 1st test model. The application clears the previously selected model and displays a set of connected green circles (functions). You may move the circles by mouse for more convenient view.
Model \ Model2 - chooses the 2nd test model. It behaves the same as the Model1 described above.
Model \ Compute - runs the calculation of the chosen model in multi-threaded mode.
Model \ Number of threads - defines the number of threads (up to 4, for this sample application) to be used for calculation of a chosen model.
Implementation
==============
The models (Model1 and Model2) are hard-coded in MainWindow.cpp in the methods createDefaultModel1() and createDefaultModel2().
The Model1 represents a set of dependent "simple" functions. By "simple" I mean the function without a meaning. In other words, it doesn't matter what the function do, it is important how it depends on other functions and how it is being calculated by the function mechanism.
The Model2 has more meaning. It represents a process of creation of a shape. A Circle depends on a Point, A Prism is built on a Circle, ...

View File

@@ -0,0 +1,3 @@
@echo off
rem Define QTDIR variable
set QTDIR=

View File

@@ -0,0 +1,3 @@
#!/bin/bash
#Define QTDIR variables in order to generate Makefile files by qmake
export QTDIR=

View File

@@ -0,0 +1,8 @@
@echo off
call "custom.bat" %1 %2 %3
call "%~dp0..\..\..\env.bat" %1 %2 %3
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"

View File

@@ -0,0 +1,21 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "custom.sh" ]; then
source "custom.sh";
fi
if [ -e "${aSamplePath}/../../../env.sh" ]; then
source "${aSamplePath}/../../../env.sh";
fi
if test "${QTDIR}" == ""; then
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
exit 1
fi
host=`uname -s`
export STATION=$host
export PATH=${QTDIR}/bin:${PATH}

View File

@@ -0,0 +1,44 @@
@echo off
REM Generation of vcproj files with qmake utilite
REM Variable QTDIR and PATH to qmake executable must be defined without fail
REM Use first argument to specify version of Visual Studio (vc8, vc9, or vc10),
REM second argument specifies architecture) (win32 or win64)
REM third argument specifies Debug or Release mode
call "%~dp0env.bat" %1 %2 %3
set EXT=vcproj
if not "%VCVER%" == "" (
if /I "%VCVER%" == "vc8" (
set VCVER=vc8
set "VCVARS=%VS80COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%VCVER%" == "vc9" (
set VCVER=vc9
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%VCVER%" == "vc10" (
set VCVER=vc10
set EXT=vcxproj
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%VCVER%" == "vc11" (
set VCVER=vc11
set EXT=vcxproj
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%VCVER%" == "vc12" (
set VCVER=vc12
set EXT=vcxproj
set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
) else (
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
echo one of: vc8 ^(VS 2005 SP1^), vc9 ^(VS 2008 SP1^), vc10 ^(VS 2010^) or vc11 ^(VS 2012^)
exit
)
)
if ["%ARCH%"] == ["32"] set VCARCH=x86
if ["%ARCH%"] == ["64"] set VCARCH=amd64
call "%VCVARS%" %VCARCH%
qmake -tp vc -o FuncDemo-%VCVER%.%EXT% FuncDemo.pro

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,13 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
qmake FuncDemo.pro
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
if [ "${CASDEB}" == "d" ]; then
make debug
else
make release
fi
fi

View File

@@ -0,0 +1,38 @@
@echo off
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
rem Define path to project file
set "PRJFILE=%~dp0FuncDemo-%VCVER%.sln"
set "VisualStudioExpressName=VCExpress"
if "%VCVER%" == "vc8" (
set "DevEnvDir=%VS80COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc11" (
set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
rem and has a new name for executable - WDExpress
set "VisualStudioExpressName=WDExpress"
) else if "%VCVER%" == "vc12" (
set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
set "VisualStudioExpressName=WDExpress"
) else (
echo Error: wrong VS identifier
exit /B
)
rem Launch Visual Studio - either professional (devenv) or Express, as available
if exist "%DevEnvDir%\devenv.exe" (
start "%DevEnvDir%\devenv.exe" "%PRJFILE%"
) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe" (
start "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
) else (
echo Error: Could not find MS Visual Studio ^(%VCVER%^)
echo Check relevant environment variable ^(e.g. VS80COMNTOOLS for vc8^)
)

View File

@@ -0,0 +1,21 @@
call "%~dp0env.bat" %1 %2 %3
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
if ["%CASDEB%"] == [""] (
set "BIN_DIR=win%ARCH%\%VCVER%\bin"
)
if not exist "%~dp0%BIN_DIR%\FuncDemo.exe" goto ERR_EXE
echo Starting Demo .....
"%~dp0%BIN_DIR%\FuncDemo.exe"
goto END
:ERR_EXE
echo Executable %~dp0%BIN_DIR%\FuncDemo.exe not found.
echo Probably you didn't compile the application.
pause
goto END
:END

View File

@@ -0,0 +1,32 @@
#!/bin/bash
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
cd $aSamplePath
aSystem=`uname -s`
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
if [ "${CASDEB}" == "d" ]; then
BIN_DIR="${aSamplePath}/build/Debug/FuncDemo.app/Contents/MacOS"
else
BIN_DIR="${aSamplePath}/build/Release/FuncDemo.app/Contents/MacOS"
fi
else
BIN_DIR="${aSamplePath}/${STATION}/bin${CASDEB}"
fi
PATH="${BIN_DIR}:${PATH}"
export PATH
if test ! -r "${BIN_DIR}/FuncDemo"; then
echo "Executable \"${BIN_DIR}/FuncDemo\" not found."
if [ "$aSystem" == "Darwin" ] && [ "$MACOSX_USE_GLX" != "true" ]; then
echo "Probably you don't compile the application. Build it with Xcode."
else
echo "Probably you don't compile the application. Execute \"make\"."
fi
exit 1
fi
${BIN_DIR}/FuncDemo

View File

@@ -0,0 +1,66 @@
// BaseDriver.cpp: implementation of the BaseDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "BaseDriver.h"
#include <TDF_Reference.hxx>
#include <TDF_ChildIterator.hxx>
#define SLOW
#ifdef SLOW
#include <OSD_Timer.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#endif
IMPLEMENT_STANDARD_HANDLE(BaseDriver,TFunction_Driver)
IMPLEMENT_STANDARD_RTTIEXT(BaseDriver,TFunction_Driver)
// Constructor
BaseDriver::BaseDriver()
{
}
// Returns the arguments of the function
void BaseDriver::Arguments(TDF_LabelList& args) const
{
// Append all arguments.
TDF_ChildIterator itr(Label().FindChild(1), false);
for (; itr.More(); itr.Next())
{
Handle(TDF_Reference) ref;
if (itr.Value().FindAttribute(TDF_Reference::GetID(), ref))
args.Append(ref->Get());
}
}
// Returns the results of the function
void BaseDriver::Results(TDF_LabelList& res) const
{
// Append all results
TDF_ChildIterator itr(Label().FindChild(2), false);
for (; itr.More(); itr.Next())
{
Handle(TDF_Reference) ref;
if (itr.Value().FindAttribute(TDF_Reference::GetID(), ref))
res.Append(ref->Get());
}
}
// Execution.
Standard_Integer BaseDriver::Execute(Handle(TFunction_Logbook)& log) const
{
#ifdef SLOW
// Make a boolean operation to slow down the function
TopoDS_Shape S1 = BRepPrimAPI_MakeSphere(100.0, 2.0 * M_PI / 3.0);
TopoDS_Shape S2 = BRepPrimAPI_MakeSphere(gp_Pnt(10, 10, 10), 100.0, 2.0 * M_PI / 3.0);
BRepAlgoAPI_Fuse fuser(S1, S2);
fuser.Build();
#endif
// Empty... should be implemented in descendent classes
return 0;
}

View File

@@ -0,0 +1,39 @@
// BaseDriver.h: interface for the Base function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_BASEDRIVER_H_)
#define _BASEDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <Standard_DefineHandle.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_LabelList.hxx>
DEFINE_STANDARD_HANDLE(BaseDriver, TFunction_Driver)
// A base function driver.
class BaseDriver : public TFunction_Driver
{
public:
// Constructor
BaseDriver();
// Returns the arguments of the function
virtual void Arguments(TDF_LabelList& args) const;
// Returns the results of the function
virtual void Results(TDF_LabelList& res) const;
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(BaseDriver, TFunction_Driver)
};
#endif // !defined(_BASEDRIVER_H_)

View File

@@ -0,0 +1,76 @@
// CircleDriver.cpp: implementation of the CircleDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "CircleDriver.h"
#include <Standard_GUID.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_Real.hxx>
#include <TopoDS.hxx>
#include <gp_Circ.hxx>
#include <BRep_Tool.hxx>
#include <Precision.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
IMPLEMENT_STANDARD_HANDLE(CircleDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(CircleDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& CircleDriver::GetID()
{
static const Standard_GUID id("D10515D5-7C4E-4fe3-A7E2-DE2E01859B4D");
return id;
}
// Constructor
CircleDriver::CircleDriver()
{
}
// Execution.
Standard_Integer CircleDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// Take the arguments (radius)
Handle(TDataStd_Real) r;
if (!Label().FindAttribute(TDataStd_Real::GetID(), r))
return 2;
double radius = r->Get();
if (radius < Precision::Confusion())
return 3;
// Take the arguments (center point)
Handle(TDF_Reference) ref;
TDF_Label Lpoint = Label().FindChild(1).FindChild(1);
if (!Lpoint.FindAttribute(TDF_Reference::GetID(), ref))
return 4;
Handle(TNaming_NamedShape) n;
if (!ref->Get().FindAttribute(TNaming_NamedShape::GetID(), n) || n->IsEmpty())
return 5;
TopoDS_Vertex V = TopoDS::Vertex(n->Get());
// Make the result
gp_Circ C(gp_Ax2(BRep_Tool::Pnt(V), gp::DZ()), radius);
TopoDS_Edge E = BRepBuilderAPI_MakeEdge(C);
TopoDS_Wire W = BRepBuilderAPI_MakeWire(E);
TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
// Set the result
TNaming_Builder B(Label());
B.Generated(F);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// CircleDriver.h: interface for the Circle function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_CIRCLEDRIVER_H_)
#define _CIRCLEDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(CircleDriver, BaseDriver)
// A Circle function driver.
class CircleDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
CircleDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(CircleDriver, TFunction_Driver)
};
#endif // !defined(_CIRCLEDRIVER_H_)

View File

@@ -0,0 +1,153 @@
// ConeDriver.cpp: implementation of the ConeDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "ConeDriver.h"
#include <Standard_GUID.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_Real.hxx>
#include <gp_Pnt.hxx>
#include <gp_Circ.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <Precision.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
IMPLEMENT_STANDARD_HANDLE(ConeDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(ConeDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& ConeDriver::GetID()
{
static const Standard_GUID id("73C5C048-59EC-404a-850B-08363D75E63C");
return id;
}
// Constructor
ConeDriver::ConeDriver()
{
}
// Execution.
Standard_Integer ConeDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// Take the arguments (height)
Handle(TDataStd_Real) h;
if (!Label().FindAttribute(TDataStd_Real::GetID(), h))
return 2;
double height = h->Get();
if (height < Precision::Confusion())
return 3;
// Take the arguments (top faces)
Handle(TDF_Reference) ref1, ref2, ref3, ref4;
if (!Label().FindChild(1).FindChild(1).FindAttribute(TDF_Reference::GetID(), ref1))
return 4;
if (!Label().FindChild(1).FindChild(2).FindAttribute(TDF_Reference::GetID(), ref2))
return 5;
if (!Label().FindChild(1).FindChild(3).FindAttribute(TDF_Reference::GetID(), ref3))
return 6;
if (!Label().FindChild(1).FindChild(4).FindAttribute(TDF_Reference::GetID(), ref4))
return 7;
Handle(TNaming_NamedShape) n1, n2, n3, n4;
if (!ref1->Get().FindAttribute(TNaming_NamedShape::GetID(), n1) || n1->IsEmpty())
return 8;
if (!ref2->Get().FindAttribute(TNaming_NamedShape::GetID(), n2) || n2->IsEmpty())
return 9;
if (!ref3->Get().FindAttribute(TNaming_NamedShape::GetID(), n3) || n3->IsEmpty())
return 10;
if (!ref4->Get().FindAttribute(TNaming_NamedShape::GetID(), n4) || n4->IsEmpty())
return 11;
TopoDS_Face F1 = TopoDS::Face(n1->Get());
TopoDS_Face F2 = TopoDS::Face(n2->Get());
TopoDS_Face F3 = TopoDS::Face(n3->Get());
TopoDS_Face F4 = TopoDS::Face(n4->Get());
// Compute central points
gp_Pnt p1, p2, p3, p4;
TopoDS_Edge E1, E2, E3, E4;
TopExp_Explorer expl(F1, TopAbs_EDGE);
if (!expl.More())
return 12;
E1 = TopoDS::Edge(expl.Current());
expl.Init(F2, TopAbs_EDGE);
if (!expl.More())
return 13;
E2 = TopoDS::Edge(expl.Current());
expl.Init(F3, TopAbs_EDGE);
if (!expl.More())
return 14;
E3 = TopoDS::Edge(expl.Current());
expl.Init(F4, TopAbs_EDGE);
if (!expl.More())
return 15;
E4 = TopoDS::Edge(expl.Current());
BRepAdaptor_Curve A(E1);
gp_Circ C1 = A.Circle();
p1 = C1.Location();
A.Initialize(E2);
gp_Circ C2 = A.Circle();
p2 = C2.Location();
A.Initialize(E3);
gp_Circ C3 = A.Circle();
p3 = C3.Location();
A.Initialize(E4);
gp_Circ C4 = A.Circle();
p4 = C4.Location();
// Center of cone
gp_Pnt p(0.25*(p1.X()+p2.X()+p3.X()+p4.X()),
0.25*(p1.Y()+p2.Y()+p3.Y()+p4.Y()),
0.25*(p1.Z()+p2.Z()+p3.Z()+p4.Z()));
// Bottom radius (max distance to points from center)
double bRadius = 0.0;
if (p1.Distance(p) > bRadius)
bRadius = p1.Distance(p);
if (p2.Distance(p) > bRadius)
bRadius = p2.Distance(p);
if (p3.Distance(p) > bRadius)
bRadius = p3.Distance(p);
if (p4.Distance(p) > bRadius)
bRadius = p4.Distance(p);
bRadius *= 1.5;
// Top radius
double tRadius = bRadius / 2.0;
// Make the result
BRepPrimAPI_MakeCone mkCone(gp_Ax2(p, gp::DZ()), bRadius, tRadius, height);
mkCone.Build();
if (!mkCone.IsDone())
return 16;
TopoDS_Shape C = mkCone.Shape();
// Make another result: a circle for next functions (many cylinders)
p.Translate(height * gp::DZ());
gp_Circ TC(gp_Ax2(p, gp::DZ()), 0.8 * tRadius);
TopoDS_Edge E = BRepBuilderAPI_MakeEdge(TC);
TopoDS_Wire W = BRepBuilderAPI_MakeWire(E);
TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
// Set the result
TNaming_Builder B(Label());
B.Generated(C);
TNaming_Builder B2(Label().FindChild(3));
B2.Generated(F);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// ConeDriver.h: interface for the Cone function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_CONEDRIVER_H_)
#define _CONEDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(ConeDriver, BaseDriver)
// A Cone function driver.
class ConeDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
ConeDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(ConeDriver, TFunction_Driver)
};
#endif // !defined(_CONEDRIVER_H_)

View File

@@ -0,0 +1,102 @@
// CylinderDriver.cpp: implementation of the CylinderDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "CylinderDriver.h"
#include <Standard_GUID.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_RealArray.hxx>
#include <TopoDS.hxx>
#include <ElCLib.hxx>
#include <gp_Circ.hxx>
#include <Precision.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
IMPLEMENT_STANDARD_HANDLE(CylinderDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(CylinderDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& CylinderDriver::GetID()
{
static const Standard_GUID id("9CE1FCDA-C8EA-4b09-B1C4-021FCD44F3F3");
return id;
}
// Constructor
CylinderDriver::CylinderDriver()
{
}
// Execution.
Standard_Integer CylinderDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// Take the arguments (radius, angle, height)
Handle(TDataStd_RealArray) arr;
if (!Label().FindAttribute(TDataStd_RealArray::GetID(), arr))
return 2;
double radius = arr->Value(1);
double angle = arr->Value(2);
double height = arr->Value(3);
if (radius < Precision::Confusion() || height < Precision::Confusion())
return 3;
// Take the arguments (top face)
Handle(TDF_Reference) ref;
if (!Label().FindChild(1).FindChild(1).FindAttribute(TDF_Reference::GetID(), ref))
return 4;
Handle(TNaming_NamedShape) n;
if (!ref->Get().FindAttribute(TNaming_NamedShape::GetID(), n) || n->IsEmpty())
return 5;
TopoDS_Face F = TopoDS::Face(n->Get());
// Take the circle
TopExp_Explorer expl(F, TopAbs_EDGE);
if (!expl.More())
return 6;
TopoDS_Edge E = TopoDS::Edge(expl.Current());
BRepAdaptor_Curve A(E);
gp_Circ C = A.Circle();
// Center of the cylinder
gp_Pnt p = ElCLib::Value(angle * M_PI / 180.0, C);
gp_Vec v(p, C.Location());
v.Normalize();
p.Translate(radius * v);
// Make the result
BRepPrimAPI_MakeCylinder mkCylinder(gp_Ax2(p, gp::DZ()), radius, height);
mkCylinder.Build();
if (!mkCylinder.IsDone())
return 7;
TopoDS_Shape Cyl = mkCylinder.Shape();
// Make the top face of the cylinder for next functions
gp_Circ Ctop(gp_Ax2(p.Translated(height * gp::DZ()), gp::DZ()), radius);
TopoDS_Edge Etop = BRepBuilderAPI_MakeEdge(Ctop);
TopoDS_Wire Wtop = BRepBuilderAPI_MakeWire(Etop);
TopoDS_Face Ftop = BRepBuilderAPI_MakeFace(Wtop);
// Set the result
TNaming_Builder B(Label());
B.Generated(Cyl);
TNaming_Builder B2(Label().FindChild(3));
B2.Generated(Ftop);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// CylinderDriver.h: interface for the Cylinder function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_CYLINDERDRIVER_H_)
#define _CYLINDERDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(CylinderDriver, BaseDriver)
// A Cylinder function driver.
class CylinderDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
CylinderDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(CylinderDriver, TFunction_Driver)
};
#endif // !defined(_CYLINDERDRIVER_H_)

View File

@@ -0,0 +1,130 @@
#include "FThread.h"
#include "graphwidget.h"
#include <TFunction_Function.hxx>
#include <TFunction_IFunction.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_GraphNode.hxx>
#include <TDataStd_Tick.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
FThread::FThread(QObject* parent):QThread(parent),thread_index(0)
{
}
FThread::~FThread()
{
}
void FThread::setIterator(const TFunction_Iterator& itr)
{
this->itr = itr;
}
void FThread::setLogbook(const Handle(TFunction_Logbook)& log)
{
this->log = log;
}
void FThread::setGraph(GraphWidget* graph)
{
this->graph = graph;
}
void FThread::setThreadIndex(const int thread_index)
{
this->thread_index = thread_index;
}
// Returns any free (not executed yet) function
TDF_Label FThread::getFreeFunction()
{
TDF_Label L;
TDF_ListIteratorOfLabelList itrl(itr.Current());
for (; itrl.More(); itrl.Next())
{
if (itr.GetStatus(itrl.Value()) == TFunction_ES_NotExecuted)
{
L = itrl.Value();
itr.SetStatus(L, TFunction_ES_Executing);
break;
}
}
return L;
}
void FThread::run()
{
while (itr.More())
{
// Take current function,
// choose one and set its status to "executing".
TDF_Label L;
for (; itr.More(); itr.Next())
{
L = getFreeFunction();
if (L.IsNull())
#ifdef __GNUC__
sleep(0.001);
#else
::Sleep(100);
#endif
else
break;
}
// Nothing to compute? Finish.
if (L.IsNull())
{
graph->setFinished();
return;
}
// Check a Tick attribute - a marker of skipped for execution functions.
// It is used only for visual presentation of skipped (not modified) functions.
Handle(TDataStd_Tick) tick;
if (L.FindAttribute(TDataStd_Tick::GetID(), tick))
L.ForgetAttribute(tick);
// Execute the function
Handle(TFunction_Driver) D = TFunction_IFunction(L).GetDriver(thread_index);
const bool must = D->MustExecute(log);
if (must)
{
// Usage of mutex for execution of Open CASCADE code is the most stupid thing!!!
// But it makes the execution more reliable...
const int ret = D->Execute(log);
if (ret == 0)
{
// Successfuly executed!
itr.SetStatus(L, TFunction_ES_Succeeded);
TDF_LabelList res;
D->Results(res);
TDF_ListIteratorOfLabelList itrr(res);
for (; itrr.More(); itrr.Next())
{
log->SetImpacted(itrr.Value());
}
}
else
{
// Failed...
itr.SetStatus(L, TFunction_ES_Failed);
graph->setFinished();
return;
}
}
else if (itr.GetStatus(L) == TFunction_ES_Executing)
{
itr.SetStatus(L, TFunction_ES_Succeeded);
TDataStd_Tick::Set(L);
}
}// while (More())
graph->setFinished();
}

View File

@@ -0,0 +1,41 @@
#ifndef _FTHREAD_H_
#define _FTHREAD_H_
#include <QThread>
#include <TFunction_Logbook.hxx>
#include <TFunction_Iterator.hxx>
#include <TFunction_Driver.hxx>
class GraphWidget; // shows graphically execution of functions
class FThread : public QThread
{
Q_OBJECT
public:
FThread(QObject* parent = 0);
~FThread();
void setIterator(const TFunction_Iterator& ); // to iterate and call functions
void setLogbook(const Handle(TFunction_Logbook)& ); // to set logbook with modifications
void setGraph(GraphWidget* ); // to change color of a graph circle
void setThreadIndex(const int ); // to set the index of the thread
protected:
void run();
virtual TDF_Label getFreeFunction(); // Returns any free (not executed yet) function
private:
TFunction_Iterator itr;
Handle(TFunction_Logbook) log;
int thread_index;
GraphWidget* graph;
};
#endif // _FTHREAD_H_

View File

@@ -0,0 +1,55 @@
// PointDriver.cpp: implementation of the PointDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "PointDriver.h"
#include <Standard_GUID.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TDataStd_RealArray.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
IMPLEMENT_STANDARD_HANDLE(PointDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(PointDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& PointDriver::GetID()
{
static const Standard_GUID id("E9467D43-B11D-42d3-AF10-E91B74D2A3D9");
return id;
}
// Constructor
PointDriver::PointDriver()
{
}
// Execution.
Standard_Integer PointDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// Take the arguments (x, y, z)
Handle(TDataStd_RealArray) arr;
if (!Label().FindAttribute(TDataStd_RealArray::GetID(), arr))
return 2;
double x = arr->Value(1);
double y = arr->Value(2);
double z = arr->Value(3);
// Make the result
TopoDS_Vertex V = BRepBuilderAPI_MakeVertex(gp_Pnt(x, y, z));
// Set the result
TNaming_Builder B(Label());
B.Generated(V);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// PointDriver.h: interface for the Point function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_PointDRIVER_H_)
#define _PointDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(PointDriver, BaseDriver)
// A Point function driver.
class PointDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
PointDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(PointDriver, TFunction_Driver)
};
#endif // !defined(_PointDRIVER_H_)

View File

@@ -0,0 +1,73 @@
// PrismDriver.cpp: implementation of the PrismDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "PrismDriver.h"
#include <Standard_GUID.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_Real.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <Precision.hxx>
IMPLEMENT_STANDARD_HANDLE(PrismDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(PrismDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& PrismDriver::GetID()
{
static const Standard_GUID id("D017489C-EFCE-4e57-8FE9-FA3DEF7DACA9");
return id;
}
// Constructor
PrismDriver::PrismDriver()
{
}
// Execution.
Standard_Integer PrismDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// Take the arguments (height)
Handle(TDataStd_Real) h;
if (!Label().FindAttribute(TDataStd_Real::GetID(), h))
return 2;
double height = h->Get();
if (height < Precision::Confusion())
return 3;
// Take the arguments (circular face)
Handle(TDF_Reference) ref;
TDF_Label Lcircle = Label().FindChild(1).FindChild(1);
if (!Lcircle.FindAttribute(TDF_Reference::GetID(), ref))
return 4;
Handle(TNaming_NamedShape) n;
if (!ref->Get().FindAttribute(TNaming_NamedShape::GetID(), n) || n->IsEmpty())
return 5;
TopoDS_Face F = TopoDS::Face(n->Get());
// Make the result
BRepPrimAPI_MakePrism mkPrism(F, gp_Vec(height * gp::DZ()));
if (!mkPrism.IsDone())
return 6;
TopoDS_Shape P = mkPrism.Shape();
TopoDS_Shape Top = mkPrism.LastShape();
// Set the result
TNaming_Builder B(Label());
B.Generated(P);
TNaming_Builder B2(Label().FindChild(3));
B2.Generated(Top);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// PrismDriver.h: interface for the Prism function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_PRISMDRIVER_H_)
#define _PRISMDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(PrismDriver, BaseDriver)
// A Prism function driver.
class PrismDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
PrismDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(PrismDriver, TFunction_Driver)
};
#endif // !defined(_PRISMDRIVER_H_)

View File

@@ -0,0 +1,65 @@
// ShapeSaverDriver.cpp: implementation of the ShapeSaverDriver class.
//
//////////////////////////////////////////////////////////////////////
#include "ShapeSaverDriver.h"
#include <Standard_GUID.hxx>
#include <TopoDS_Compound.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Reference.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
IMPLEMENT_STANDARD_HANDLE(ShapeSaverDriver,BaseDriver)
IMPLEMENT_STANDARD_RTTIEXT(ShapeSaverDriver,BaseDriver)
// ID of the function driver
const Standard_GUID& ShapeSaverDriver::GetID()
{
static const Standard_GUID id("6B77A40E-E074-4fe1-AB9B-ECECA506717A");
return id;
}
// Constructor
ShapeSaverDriver::ShapeSaverDriver()
{
}
// Execution.
Standard_Integer ShapeSaverDriver::Execute(Handle(TFunction_Logbook)& log) const
{
// Usual check...
if (Label().IsNull())
return 1;
// A compound of results of all functions
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
// Take results of all functions
TDF_ChildIterator itr(Label().FindChild(1), false);
for (; itr.More(); itr.Next())
{
Handle(TDF_Reference) ref;
if (itr.Value().FindAttribute(TDF_Reference::GetID(), ref))
{
Handle(TNaming_NamedShape) n;
if (ref->Get().FindAttribute(TNaming_NamedShape::GetID(), n) && !n->IsEmpty())
{
B.Add(C, n->Get());
}
}
}
//BRepTools::Write(C, "result.brep");
TNaming_Builder Bui(Label());
Bui.Generated(C);
return BaseDriver::Execute(log);
}

View File

@@ -0,0 +1,36 @@
// ShapeSaverDriver.h: interface for the ShapeSaver function driver.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_SHAPESAVERDRIVER_H_)
#define _SHAPESAVERDRIVER_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseDriver.h"
#include <Standard_DefineHandle.hxx>
#include <TFunction_Logbook.hxx>
DEFINE_STANDARD_HANDLE(ShapeSaverDriver, BaseDriver)
// A ShapeSaver function driver.
class ShapeSaverDriver : public BaseDriver
{
public:
// ID of the function driver
static const Standard_GUID& GetID();
// Constructor
ShapeSaverDriver();
// Execution.
virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
DEFINE_STANDARD_RTTIEXT(ShapeSaverDriver, TFunction_Driver)
};
#endif // !defined(_SHAPESAVERDRIVER_H_)

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