1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

45 Commits

Author SHA1 Message Date
bugmaster
94c00556ea Update version up to 7.5.1 2021-02-02 11:51:56 +03:00
emv
bf67bbf8fe 0031912: Modeling Algorithms - Boolean Cut can't build resulting shape
Problem is fixed by #0032058. Integrating test case only.
2021-02-02 11:49:33 +03:00
ifv
edf111202c 0032058: Modeling Data - Extrema curve-surface gives wrong result for planar surface of revolunion and circle
Extrema_GenExtCS.cxx : added solution refinement, if solution seems to be "bad" according to special criteria.
Extrema_FuncExtCS.cxx : "cosmetic" modifications
BOPAlgo_PaveFiller_3.cxx : adding control of shape index to prevent exception in ShapeInfo
bugs/moddata_3/bug32058 : new test
2021-02-02 11:30:40 +03:00
jgv
bbdcdcdd80 0031845: Modeling Algorithms - BRepOffsetAPI_MakeThickSolid fails
Multiple changes in BRepOffset_MakeOffset algorithm:
- correct fusing vertices;
- correct building intersection edges;
- correct intersecting new edges in 2D;
- correct building wire on a new face;
- correct building history.
2021-01-29 13:47:21 +03:00
bugmaster
2ecd3a06a6 Update version up to 7.5.1.dev 2020-11-11 20:08:01 +03:00
bugmaster
628c0211d5 Increment OCCT version up to 7.5.0 2020-11-02 19:52:44 +03:00
kgv
dbecff5fab 0031898: Coding Rules - extend Standard_WarningsDisable.hxx with -Wreorder 2020-11-02 19:41:29 +03:00
asuraven
7a88ce5b98 0029108: Crash writing STEP file
* Wrapped a try / catch block on creating objects in TopoDSToStep_MakeStepFace::Init()
2020-11-02 14:32:39 +03:00
Xu Zhongxing
2b7fd8c81c 0031887: IntTools_Context::IsPointInFace always return TRUE
If aDist >= aTol, bIn is never updated to false, and the function
always returns TRUE.
2020-10-30 18:25:19 +03:00
kgv
a8b9d7eb27 0031888: Configuration, qmake - linkage error due to missing .cpp file in TKMesh
OccToolkit.pri now handles also .cpp file extension.
2020-10-29 19:04:46 +03:00
dpasukhi
71af3370c4 0031878: DXF import - support Windows and ISO 8859 code pages in DXF import
Add support of converting Big5 and GBK code pages to Unicode within Resource_Unicode::ConvertFormatToUnicode
2020-10-29 19:01:54 +03:00
asuraven
40858cc79c 0030921: Data Exchange - STEPCAFControl_Reader incorrectly reads the specified stp file -- refactoring
File StepToGeom_MakeBSplineCurve.pxx is removed, relevant code is converted to C++ template and merged to StepToGeom.cxx
2020-10-29 18:55:37 +03:00
asuraven
3940436ae2 0030921: Data Exchange - STEPCAFControl_Reader incorrectly reads the specified stp file -- fix
The number of weights is adjusted to the number of poles in StepToGeom::MakeBSplineCurve(2d).
2020-10-29 18:55:36 +03:00
kgv
c3da64a686 0031884: Data Exchange - NULL de-reference within STEPCAFControl_Reader::SetSourceCodePage()
Removed methods with unclear usage rules.
2020-10-28 22:19:23 +03:00
mzernova
4065c66c24 0031808: Visualization - NULL dereference in Graphic3d_Structure::IsDisplayed() on Removed presentation
Added a NULL check for IsDisplayed(), IsHighlighted(), IsTransformed(), IsVisible(), etc.
2020-10-28 22:18:12 +03:00
abv
94f16a8961 0014673: Provide true support for Unicode symbols
Construction of TCollection_ExtendedString from plain C string is fixed to consider input string as UTF-8 in several places (identified as described in notes to #31113).

Message_MsgFile is corrected to load resource file as UTF-8 (unless it has BOM indicating use of UTF-16).

Added tests for use of Unicode in some DRAW commands (bugs demo bug14673_*)
2020-10-28 22:18:11 +03:00
kgv
aa7e9f8d78 0031881: Coding Rules - OpenGl_HaltonSampler::initRandom() uses deprecated in C++14 function std::random_shuffle
Unused function has been removed.
2020-10-28 19:24:00 +03:00
akaftasev
5445eaeed5 0030003: Construction of pipe by two circular sections and spine curve leads to crash
GeomFill_NSection.cxx  : setting of UPeriodic flag while call constructor of BSpline surface is added

bug3003 : Test cases added
2020-10-27 19:46:14 +03:00
asuraven
07bc68e8d8 0031873: Samples, Qt OCCT Overview sample - Problems of compilation and launch in 32 bit mode on Windows 2020-10-26 19:47:54 +03:00
kgv
ec4128df29 0031876: Configuration - Prs3d_Arrow::DrawShaded() crashes in msvc10 win32 Release build
Use longer code syntax to workaround compiler bug.
2020-10-26 19:45:16 +03:00
abv
f41fd243b6 0031877: DRAW - some Visualization commands are not protected against uninitialized viewer
Added protections in DRAW commands against accessing Null context

Added test bugs demo bug31877
2020-10-25 08:46:49 +03:00
kgv
9f9490e1ae 0031875: Draw Harness, ViewerTest - command vaspects -mostContinuity lacks g1 and g2 options
vaspects -mostContinuity now accepts g1 and g2 values.
2020-10-23 19:58:51 +03:00
emv
0612bb7010 0031858: Modeling Algorithms - boolean operation crash between the given cylinder and torus.
Integrating test cases only, as the problem is not reproduced.
2020-10-23 19:57:30 +03:00
ifv
7ccfd41fa2 0031782: Modeling Algorithms - Regressions on VS 2019 (vc142) on fillet tests
ChFiKPart_ComputeData_FilPlnCyl.cxx - rewriting some code to avoid "extra" optimization
2020-10-23 19:56:03 +03:00
dpasukhi
692decba26 0031825: Data Exchange, STEP - NULL dereference while re-exporting model with empty Datum description
Fix adding name and description of the datum
2020-10-23 19:54:58 +03:00
dpasukhi
1b9cb073b9 0028454: Data Exchange, STEP reader - names with special characters cannot be read
- Add support of the control directives ( "\X2\" "\X4" "\X\" "\P*\" "\S\");
- Make param "read.stepcaf.codepage" base for conversion inside StepData instead of CAF;
- Rename "read.stepcaf.codepage" to "read.step.codepage".
- Add ISO 8859-1 - 9 code pages for conversion
- Add Resource_FormatType_NoConversion format type, that indicates non-conversion behavior
- Update old test cases that contain control directives
2020-10-22 17:54:29 +03:00
ifv
380748c340 0027469: Modeling Algorithms - Regression vs 6.9.1: Wrong result of Edge/Face intersection
IntTools/IntTools_BeanFaceIntersector.cxx - decreasing parameter aDeltaRestrictor in method ComputeRangeFromStartPoint(...) to avoid "jumping" across the common part boundary.

IntTools/IntTools_EdgeFace.cxx - method IsCoincident() - improving criteria of coincidence between edge and face.
2020-10-22 17:49:17 +03:00
kgv
a966542b8a 0031866: Documentation - add description to Graphic3d_NameOfMaterial enumeration values
Enumeration values have been renamed to use complete prefix Graphic3d_NOM_ -> Graphic3d_NameOfMaterial_
and to match string names (with old values preserved as aliases).
2020-10-22 17:40:42 +03:00
asuraven
8833fd4dc5 0031827: Samples - Qt OCCT Overview sample is not compiled with VS 2010
* Menu storage changed from json to XML (because Qt 4 does not support json)
 * C++11 for(object : container) construction changed to OCCT iterators / Qt foreach
 * enum type::name changed to type_name
 * non used class members removed
 * Qt connect functions changed to macros version
 * warning 4127 disabled for Q_INIT_RESOURCE in VS2010 / Qt 4 case
 * widgets parent problem on Qt 4 fixed
 * QRegularExpression changed to QRegExp
2020-10-22 17:35:37 +03:00
kgv
1877dc98c9 0031856: Draw Harness - ReadStep should propagate progress indicator
Added progress indication to commands ReadStep, WriteStep, ReadIges, WriteIges, XOpen, XSave.

Draw_ProgressIndicator::Reset() now backups Tcl result string before evaluating command,
so that Draw_ProgressIndicator destructor will not eat error/result message in main command.
2020-10-20 18:16:09 +03:00
jgv
3e98579a83 0031855: Modeling Algorithms - regression of the unifysamedom command.
Transformation of 2d-curves on elementary surfaces has been corrected.
2020-10-20 18:13:49 +03:00
kgv
16ed73bec5 0031790: Configuration, CMake - add optional OpenVR dependency 2020-10-17 18:07:29 +03:00
abv
ae9f4b64ca 0031851: Data Exchange, STEP - enable Unicode symbols in STEP export
Class STEPCAFControl_Writer is corrected to avoid replacing non-Ascii symbols by question marks, and spaces by underscores, on export to STEP.

Related: DRAW commands dealing with strings in OCAF documents are corrected to pass Unicode symbols as UTF-8.

Off-topic: code saving names of external STEP files in XDE and fetching them back is corrected to preserve Unicode symbols as UTF-8.

Added test bugs xde bug31851

Test de step_4 E7 corrected (no more replacement of spaces by underscores in names of layers)
2020-10-14 19:28:58 +03:00
emv
870ae593c3 0031850: Modeling Algorithms - boolean cut and common generate unexpected result
IntPatch_WLineTool::JoinWLines(): using correct point for the check if WLines may be joined.
2020-10-14 19:25:45 +03:00
emv
135c2bd908 0031835: Modeling Algorithms - step by step Boolean common produces bad shape on given three cylinders
Fix inconsistency between IntAna_QuadQuadGeo(gp_Cylinder,gp_Cylinder) and AxeOperator::Coplanar().
2020-10-14 19:23:26 +03:00
kgv
6eeb528cd1 0031848: [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input vector has zero norm"
SelectMgr_RectangularFrustum::Overlaps() - added zero magnitude check.

Commands vsphere,vcylinder,vtorus have been corrected to provide missing parameters defining number of stacks and slices.
2020-10-14 19:17:33 +03:00
emv
815f039bd2 0031836: Modeling Algorithms - Boolean cut failed between a Cone and a Torus
BOPAlgo_PaveFiller::UpdateExistingPaveBlocks: Add check for closed edge when updating pave block.
2020-10-13 19:18:02 +03:00
abv
81f2078cdb 0031575: Tests - make location of source test folder available in test
Documentation of global variables available for the test script during test execution is improved.

Off-topic: mark-up error is fixed in DRAW user guide
2020-10-13 19:15:39 +03:00
ifv
794aa3390c 0029722: Modeling Algorithms - checkshape modifies UV points of parametric curve
removed updating uvpoints from WireExplorer
2020-10-13 19:09:44 +03:00
kgv
d922149528 0031842: Coding Rules, BOPAlgo - eliminate CLang warning -fsanitize=undefined reference binding to null pointer
Added NULL checks before Progress Scope pointer dereference.
2020-10-13 19:07:42 +03:00
mpv
2958b91f62 0031841: Coding Rules, LDOM_XmlReader - eliminate new CLang compiler warning -Wtautological-overlap-compare 2020-10-13 19:06:40 +03:00
kgv
cdfcd39b69 0031833: Visualization - dynamic highlighting does not appear within ImmediateRedraw()
AIS_ViewController::contextLazyMoveTo() now undoes Z Range changes after MoveTo().
2020-10-09 18:29:52 +03:00
vsv
c4d4fceaa7 0031824: Samples - Code is not displayed in Qt OCCT Overview sample after compilation by CMake 2020-10-09 18:28:27 +03:00
abv
d730835599 0031095: Debugging - add code for display of TCollection_AsciiString as UTF-8 in Visual Studio debugger visualizer 2020-10-09 18:26:03 +03:00
kgv
a84f14abee 0031830: Documentation - broken reference 14 in pbr_math document
References to literature are simplified to reduce duplication of names.
List of references is converted to table for better presentation.
2020-10-09 18:24:24 +03:00
248 changed files with 4976 additions and 2392 deletions

View File

@@ -101,7 +101,7 @@ if (BUILD_USE_PCH)
# Load Cotire tool for accelerating build procedure
include(cotire)
# Set Cotire to ignore lxx, pxx, gxx
# Set Cotire to ignore lxx, pxx, gxx
set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS "lxx;pxx;gxx" CACHE STRING "Set Cotire to ignore OCCT specific files that can be #included" FORCE)
# Set priority for inclusion of system headers in PCH to reduce problems
@@ -165,7 +165,7 @@ if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV)
elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
# CMAKE_INSTALL_PREFIX has been changed at previous step
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
# INSTALL_DIR is required to be updated
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
endif()
@@ -177,10 +177,10 @@ elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}")
# INSTALL_DIR has been changed at previous step
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
# sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
# sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
# set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
# set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
endif()
@@ -406,7 +406,7 @@ if (NOT DEFINED BUILD_DOC_Overview)
set (DO_ONLY_CHECK_FOR_DOXYGEN ON)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
set (DO_ONLY_CHECK_FOR_DOXYGEN OFF)
if (CAN_DOXYGEN_BE_USED)
message (STATUS "Info. Overview building is turned on")
endif()
@@ -495,7 +495,7 @@ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
if (USE_TCL)
message (STATUS "Info: TCL is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
message (STATUS "Info: TK is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
else()
@@ -523,7 +523,7 @@ if (USE_VTK)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK")
if (NOT CAN_USE_VTK EQUAL -1)
message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled")
@@ -565,6 +565,26 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
endif()
# OpenVR
# search for CSF_OpenVR variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenVR CAN_USE_OPENVR)
if (CAN_USE_OPENVR)
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
if (USE_OPENVR)
add_definitions (-DHAVE_OPENVR)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/openvr")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENVR")
OCCT_CHECK_AND_UNSET ("INSTALL_OPENVR")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_OPENVR")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENVR")
OCCT_CHECK_AND_UNSET ("INSTALL_OPENVR")
endif()
# FFmpeg
# search for CSF_FFmpeg variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_FFmpeg CAN_USE_FFMPEG)
@@ -694,14 +714,14 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
endif()
# bison
# bison
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE")
endif()
# flex
# flex
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex")
else()
@@ -780,7 +800,7 @@ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
if (WIN32)
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
@@ -849,11 +869,11 @@ if (INSTALL_SAMPLES)
OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code" "${INSTALL_DIR_SAMPLES}/OCCTOverview")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code" "${INSTALL_DIR_SAMPLES}/OCCTOverview")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/OCCTOverview" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/OCCTOverview" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}")
endif()
@@ -967,6 +987,15 @@ if (BUILD_SAMPLES_QT)
OCCT_INSTALL_FILE_OR_DIR ("samples/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/samples")
#message("Copy Sample resources: samples/${RESOURCE} into ${INSTALL_DIR_RESOURCE}/samples")
endforeach()
## Copy sources of OCCTOverview for using in the sample
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/DataExchangeSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/OcafSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/GeometrySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TopologySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TriangulationSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer2dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer3dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
endif()
@@ -1184,7 +1213,7 @@ foreach (OCCT_MODULE ${OCCT_MODULES_ENABLED})
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
endforeach()
# Update generated OpenCASCADETargets-*.cmake files
# Update generated OpenCASCADETargets-*.cmake files
# to have correct paths to libraries depending on the configuration
OCCT_UPDATE_TARGET_FILE ()

View File

@@ -97,12 +97,12 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR NAMES ${HEADER_NAME}
PATHS ${3RDPARTY_${PRODUCT_NAME}_DIR}
PATH_SUFFIXES include inc
PATH_SUFFIXES include inc headers
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR NAMES ${HEADER_NAME}
PATH_SUFFIXES include inc
PATH_SUFFIXES include inc headers
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
endif()
@@ -125,10 +125,14 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
if (WIN32)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} win${COMPILER_BITNESS}/${COMPILER}/lib)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} lib/win${COMPILER_BITNESS})
endif()
if (ANDROID)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
endif()
if(UNIX AND NOT APPLE AND NOT ANDROID)
set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} lib/linux${COMPILER_BITNESS})
endif()
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
@@ -184,7 +188,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}"))
find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
PATHS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin
PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin bin/win${COMPILER_BITNESS}
NO_DEFAULT_PATH)
if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
# find directory recursive
@@ -238,6 +242,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
if (INSTALL_${PRODUCT_NAME})
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
if (WIN32)
if (SINGLE_GENERATOR)
@@ -280,14 +285,17 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
endif()
else()
# the library directory for using by the executable
foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
if (WIN32)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}};${USED_3RDPARTY_${PRODUCT_NAME}_DIRS}")
else()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}:${USED_3RDPARTY_${PRODUCT_NAME}_DIRS}")
endif()
endforeach()
if (WIN32)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR ${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}})
endif()
endif()
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX})

View File

@@ -42,6 +42,13 @@ else()
endif()
endif()
# OpenVR
if (USE_OPENVR)
set (CSF_OpenVR "openvr_api")
else()
set (CSF_OpenVR)
endif()
# TCL/TK
if (USE_TCL)
if (WIN32)

5
adm/cmake/openvr.cmake Normal file
View File

@@ -0,0 +1,5 @@
# OpenVR SDK
# OpenVR is an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting.
# https://github.com/ValveSoftware/openvr
THIRDPARTY_PRODUCT("OPENVR" "openvr.h" "CSF_OpenVR" "")

View File

@@ -89,6 +89,7 @@ INSTALL_MESSAGE (INSTALL_TEST_CASES "non-regression OCCT test scripts")
INSTALL_MESSAGE (INSTALL_DOC_Overview "OCCT overview documentation (HTML format)")
INSTALL_MESSAGE (INSTALL_FFMPEG "FFmpeg binaries")
INSTALL_MESSAGE (INSTALL_FREEIMAGE "FreeImage binaries")
INSTALL_MESSAGE (INSTALL_OPENVR "OpenVR binaries")
INSTALL_MESSAGE (INSTALL_EIGEN "EIGEN header files")
INSTALL_MESSAGE (INSTALL_EGL "EGL binaries")
INSTALL_MESSAGE (INSTALL_GLES2 "OpenGL ES 2.0 binaries")
@@ -162,6 +163,9 @@ set (USE_FREEIMAGE_DESCR
"Indicates whether Freeimage product should be used in OCCT visualization
module for support of popular graphics image formats (PNG, BMP etc)")
set (USE_OPENVR_DESCR
"Indicates whether OpenVR should be used in OCCT visualization module for VR support")
set (USE_RAPIDJSON_DESCR
"Indicates whether RapidJSON product should be used in OCCT DataExchange
module for support of JSON-based formats like glTF")

View File

@@ -77,8 +77,8 @@ for (aCfgIter, CONFIG) {
# Define the list of standard OCCT file extensions
aHxxRegex = ^.*\.(hxx|h|lxx|gxx)$
aPxxRegex = ^.*\.(pxx)$
aCxxRegex = ^.*\.(cxx|c)$
mac { aCxxRegex = ^.*\.(cxx|c|m|mm)$ }
aCxxRegex = ^.*\.(cxx|cpp|c)$
mac { aCxxRegex = ^.*\.(cxx|cpp|c|m|mm)$ }
# Auxiliary function for probing file extension
defineTest (occCheckExtension) {

View File

@@ -14,6 +14,7 @@ if /I "%VCVER%" == "@COMPILER@" (
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"
if not "@3RDPARTY_QT_DIR@" == "" (
set "QTDIR=@3RDPARTY_QT_DIR@"

View File

@@ -10,12 +10,13 @@ if /I "%VCVER%" == "@COMPILER@" (
set "TCL_DIR=@USED_3RDPARTY_TCL_DIR@"
set "TK_DIR=@USED_3RDPARTY_TK_DIR@"
set "FREETYPE_DIR=@USED_3RDPARTY_FREETYPE_DIR@"
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIRS@"
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIR@"
set "EGL_DIR=@USED_3RDPARTY_EGL_DIRS@"
set "GLES2_DIR=@USED_3RDPARTY_GLES2_DIRS@"
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@"
set "OPENVR_DIR=@USED_3RDPARTY_OPENVR_DIR@"
if not "@USED_3RDPARTY_QT_DIR@" == "" (
set "QTDIR=@USED_3RDPARTY_QT_DIR@"

View File

@@ -140,6 +140,7 @@ if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%"
if not ["%QTDIR%"] == [""] (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_PLUGIN_PATH=%QTDIR%/plugins"

View File

@@ -37,7 +37,7 @@ if not exist "%EXE_PATH%" (
)
rem Set path to location where sample code is installed
set "CSF_OCCTOverviewSampleCodePath=%~dp0samples\OCCTOverview\code"
set "CSF_OCCTOverviewSampleCodePath=%CSF_OCCTSamplesPath%\OCCTOverview\code"
"%EXE_PATH%"

View File

@@ -32,7 +32,7 @@ if [ ! -f "$EXE_PATH" ]; then
exit 1
fi
export CSF_OCCTOverviewSampleCodePath="${aCurrentPath}/samples/qt/OCCTOverview/code"
export CSF_OCCTOverviewSampleCodePath="${CSF_OCCTSamplesPath}/OCCTOverview/code"
cd ${aCurrentPath}
"$EXE_PATH"
"$EXE_PATH"

View File

@@ -555,7 +555,31 @@ if { [expr $actual_length - $expected_length] > 0.001 } {
At the end, the test script should output *TEST COMPLETED* string to mark a successful completion of the script. This is often done by the *end* script in the grid.
When the test script requires a data file, use Tcl procedure *locate_data_file* to get a path to it, instead of putting the path explicitly. This will allow easy move of the data file from OCCT sources repository to the data files repository without the need to update the test script.
During execution of a test, the following Tcl variables are defined on global level:
| Variable | Value |
|-----------|-------|
| dirname | Path to the root directory of the current set of test scripts |
| groupname | Name of the test group (subfolder of $dirname) |
| gridname | Name of the test grid (subfolder of $dirname/$gridname) |
| casename | Name of the test |
| imagedir | Path to folder where test log and other artifacts are saved |
The test script can use some data stored in a separate file (e.g. reference results of the test execution).
Such file can be put in subfolder *data* of the test grid directory.
During execution of the test, location of such data file can be constructed using the variables listed above.
Example:
~~~~~
checkresult $result $::dirname/$::groupname/$::gridname/data/${::casename}.txt
~~~~~
CAD models and other data files which are not going to change over time should be stored separately from the source repository.
Use Tcl procedure *locate_data_file* to get a path to such data files, instead of coding the path explicitly.
For the file to be found by that procedure, add directory that contains it into the environment variable *CSF_TestDataPath* (list of paths separated by semicolons on Windows or colons on other platforms).
The search is recursive, thus adding only root folder of a directory containing data files is sufficient.
If the file is not found, *locate_data_file* will raise exception, and the test will be reported as SKIPPED.
Example:
@@ -578,11 +602,11 @@ The image format (defined by extension) should be *png*.
Example:
~~~~~
xwd $imagedir/${casename}.png
xwd $::imagedir/${::casename}.png
vdisplay result; vfit
vdump $imagedir/${casename}-axo.png
vdump $::imagedir/${::casename}-axo.png
vfront; vfit
vdump $imagedir/${casename}-front.png
vdump $::imagedir/${::casename}-front.png
~~~~~
would produce:
@@ -594,11 +618,6 @@ A1-front.png
Note that OCCT must be built with FreeImage support to be able to produce usable images.
Other Tcl variables defined during the test execution are:
- *groupname*: name of the test group;
- *gridname*: name of the test grid;
- *dirname*: path to the root directory of the current set of test scripts.
In order to ensure that the test works as expected in different environments, observe the following additional rules:
* Avoid using external commands such as *grep, rm,* etc., as these commands can be absent on another system (e.g. on Windows); use facilities provided by Tcl instead.
* Do not put call to *locate_data_file* in catch statement -- this can prevent correct interpretation of the missing data file by the test system.

View File

@@ -61,6 +61,9 @@
</Type>
<Type Name="TCollection_AsciiString">
<DisplayString>{mylength}: {mystring,s}</DisplayString>
<Expand>
<Item Name="[utf-8]">mystring,s8</Item>
</Expand>
</Type>
<Type Name="TCollection_HAsciiString">
<DisplayString>{myString.mylength}: {myString.mystring,s}</DisplayString>

View File

@@ -358,7 +358,7 @@ for which OCCT is certified to work.
The following third-party libraries and tools are not included in OCCT sources but are either required or can be optionally used for the indicated components of OCCT.
They are not needed if relevant component is not needed.
Note that pe-built packages of many of the listed libraries are available at
Note that pre-built packages of many of the listed libraries are available at
https://www.opencascade.com/content/3rd-party-components
| Component | Where to find | Used for | Required or optional |
@@ -366,6 +366,7 @@ https://www.opencascade.com/content/3rd-party-components
| CMake 2.8+ | https://cmake.org/ | Build from sources | Optional |
| Intel TBB 4.x or later | https://www.threadingbuildingblocks.org/ | All | Optional (advanced parallelization of algorithms) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | Optional (VR support) |
| Direct3D 9 | Windows | Visualization | Optional (integration with GUI using Direct3D) |
| FreeType 2.4.11-2.7.1 | https://sourceforge.net/projects/freetype/files/ | Visualization | Required |
| FreeImage 3.17.0+ | https://sourceforge.net/projects/freeimage/files | Visualization | Optional (support of common 2D graphic formats) |
@@ -583,7 +584,14 @@ implementation of 3D viewer. OpenGL specification is developed by the
Khronos group, https://www.khronos.org/opengl/. OCCT code includes header
file *glext.h* obtained from Khronos web site.
**VTK** -- The **Visualization Toolkit (VTK)** is an open-source, freely available software system for 3D computer graphics, image processing and visualization. OCCT VIS component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library. If you need further information on VTK, refer to VTK Homepage https://www.vtk.org/.
**OpenVR** is an API and runtime that allows access to VR hardware from multiple vendors
without requiring that applications have specific knowledge of the hardware they are targeting.
OpenVR is optionally used by OCCT for VR support.
OpenVR is released under BSD-like license (https://github.com/ValveSoftware/openvr/blob/master/LICENSE).
**VTK** -- The **Visualization Toolkit (VTK)** is an open-source, freely available software system for 3D computer graphics, image processing and visualization.
OCCT VIS component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
If you need further information on VTK, refer to VTK Homepage https://www.vtk.org/.
**Doxygen** developed by Dimitri van Heesch is open source documentation system for
C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology
@@ -621,7 +629,8 @@ It is available under GNU GPL v3 license (https://www.gnu.org/software/bison/).
Delabella is used by BRepMesh as one of alternative 2D triangulation algorithms.
Delabella is licensed under the MIT license (https://github.com/msokalski/delabella).
**CMake** is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.
**CMake** is an open-source, cross-platform family of tools designed to build, test and package software.
CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.
OCCT uses CMake as a build system. CMake is available under BSD 3-Clause license.
See more at https://cmake.org/

View File

@@ -60,7 +60,7 @@ More general model will require to consider directions all around a whole sphere
\f$\cos\theta_l\f$ factor appearing is caused by affection of surface area and light direction mutual orientation to the amount of radiance coming to this area.
This is mainly due to geometric laws. The rest part of integral is the key of the whole illumination model.
BRDF defines it's complexity and optical properties of material.
It has to model all light and material interactions and also has to satisfy some following criteria in order to be physical correct @ref ref_Duvenhage13 "[Duvenhage13]":
It has to model all light and material interactions and also has to satisfy some following criteria in order to be physical correct [@ref Duvenhage13]:
* Positivity: \f$f(v,l) \geq 0\f$
* Helmholtz reciprocity: \f$f(v,l) = f(l, v)\f$ (follows from 2<sup>nd</sup> Law of Thermodynamics)
* Energy conservation: \f$\displaystyle \forall v \, \int\limits_H f(v,l) \cos\theta_l \, \mathrm{d}l = 1\f$ (in order not to reflect more light than came)
@@ -74,7 +74,7 @@ So that illumination equation might be rewritten as:
\f[L_o=\int\limits_H (f_d(v,l)+f_s(v, l)) L_i(l) \cos\theta_l\, \mathrm{d}l\f]
PBR theory is based on **Cook-Torrance specular BRDF** @ref ref_Cook81 "[Cook81]". It imagines surface as set of perfectly reflected micro faces distributed on area in different ways which is pretty good model approximation of real world materials.
PBR theory is based on **Cook-Torrance specular BRDF** [@ref Cook81]. It imagines surface as set of perfectly reflected micro faces distributed on area in different ways which is pretty good model approximation of real world materials.
If this area is small enough not to be able to recognize separate micro surfaces the results becomes a sort of averaging or mixing of every micro plane illumination contribution.
In that level it allows to work with micro faces in statistical manner manipulating only probabilities distributions of micro surfaces parameters such as normals, height, pattern, orientation etc.
In computer graphics pixels are units of images and it usually covers a relatively large areas of surfaces so that micro planes can be considered to be unrecognizable.
@@ -85,7 +85,7 @@ Going back to the BRDF the Cook-Torrance approach has the following expression:
Three parts presented in nominator have its own meaning but can have different implementation with various levels of complexity and physical accuracy.
In that paper only one certain implementation is used. The \f$D\f$ component is responsible for **micro faces normals distribution**.
It is the main instrument that controls reflection's shape and strength according to **roughness** \f$r\f$ parameter.
The implementation with good visual results is **Trowbridge-Reitz GGX** approach used in Disney's RenderMan and Unreal Engine @ref ref_Karis13 "[Karis13]":
The implementation with good visual results is **Trowbridge-Reitz GGX** approach used in Disney's RenderMan and Unreal Engine [@ref Karis13]:
\f[D=\frac{\alpha^2}{\pi(\cos^2\theta_h(\alpha^2-1) + 1)^2}\f]
@@ -93,8 +93,8 @@ Where \f$\alpha = r^2\f$. This square in needed only for smoother roughness para
Without it the visual appearance of surface becomes rough too quickly during the parameter's increasing.
The second \f$G\f$ component is called **geometric shadowing** or attenuation factor.
The point is that micro surfaces form kind of terrain and can cast shadows over each other especially on extreme viewing angles @ref ref_Heitz14 "[Heitz14]".
**Smith-Schlick model** @ref ref_Heitz14 "[Heitz14]", @ref ref_Schlick94 "[Schlick94]" has been chosen as implementation:
The point is that micro surfaces form kind of terrain and can cast shadows over each other especially on extreme viewing angles [@ref Heitz14].
**Smith-Schlick model** [@ref Heitz14], [@ref Schlick94] has been chosen as implementation:
\f[\displaystyle G=\frac{\cos\theta_l \cos\theta_v}{(\cos\theta_l(1-k)+k)(\cos\theta_v(1-k)+k)}\f]
@@ -105,7 +105,7 @@ One of this modification will be described later in following chapters.
The last component \f$F\f$ shows **how much light is reflected from surface** and is called **Fresnel's factor**.
The rest amount of radiance might be absorbed or refracted by material.
The most accurate expression of it is pretty complicate for calculation so that there is a variety of approximations.
The good one with less computation efforts is **Schlick's implementation** @ref ref_Schlick94 "[Schlick94]":
The good one with less computation efforts is **Schlick's implementation** [@ref Schlick94]:
\f[F=F_0+(1-F_0)(1-\cos\theta_{vh})^5\f]
@@ -115,7 +115,7 @@ In order to do that it is needed to be noticed that Schlick's approximation is a
**Index of Refraction** \f$IOR\f$ shows the proportion between light speed in vacuum (or even in air) and in material.
The reference value of \f$IOR\f$ for plastic is **1.5**, and this value can be considered as default for all unknown dielectrics.
In practice this parameter controls reflectance ability of material.
Also it should be remembered that this approximation produces poor results with large \f$IOR\f$ values so that it is recommended to be kept in range of \f$[1, 3]\f$ in order to get plausible Fresnel's factor @ref ref_Lazanyi05 "[Lazanyi05]", @ref ref_Lagarde13 "[Lagarde13]".
Also it should be remembered that this approximation produces poor results with large \f$IOR\f$ values so that it is recommended to be kept in range of \f$[1, 3]\f$ in order to get plausible Fresnel's factor [@ref Lazanyi05], [@ref Lagarde13].
This formula might be further propagated onto metals by using \f$F_0\f$ measured specifically for certain metal.
It can be considered as some kind of a 'color' of metal and can be stored as albedo parameter \f$c\f$.
And the final step of defining Fresnel's factor formula is mixing all this \f$F_0\f$ using metallic parameter \f$m\f$ (**metalness**):
@@ -184,7 +184,7 @@ Having finite discrete amount of it in scene and considering only single directi
Where \f$M\f$ is a number of sources, \f$l_j\f$ is a direction and \f$L_i^{direct}\f$ is an intensity related to this direction.
\f$direct\f$ label means that illumination has been computed directly from sources.
The BRDF can be used directly without any calculation problems.
The only exception might be \f$k\f$ in \f$G\f$ factor - it is recommended to be equal \f$\frac{(r+1)^2}{8}\f$ in order to get more pleasant results @ref ref_Karis13 "[Karis13]" (that is modification mentioned in previous chapter).
The only exception might be \f$k\f$ in \f$G\f$ factor - it is recommended to use \f$ k = (r+1)^2 / 8 \f$ in order to get more pleasant results [@ref Karis13] (that is modification mentioned in previous chapter).
And actually it is enough to finally see something.
There will be correct visualization with assumption of complete dark environment and absence of other points influence.
It is called **local illumination**. Based on this name there is also a global or **indirect illumination** and that is the rest of integral:
@@ -359,7 +359,7 @@ Optimization strategies use different samples distributions for different view d
Anyway even with all optimization techniques this algorithm continues to require too much calculations.
Good visual results require noticeable number of samples and using this approach for every point in real time rendering becomes unrealistic.
The way to avoid these enormous calculations is doing them beforehand somehow.
The first trick on the way to this is split the sum separating environment light component @ref ref_Karis13 "[Karis13]":
The first trick on the way to this is split the sum separating environment light component [@ref Karis13]:
\f[L_{indirect}^s \approx \frac{1}{N} \sum_{i=1}^N \frac{f_s(v, l_i) L_i^{indirect}(l_i) \cos\theta_{l_i}}{p(v, l_i)} \approx \left( \frac{1}{N} \sum_{i=1}^N L_i^{indirect}(l_i) \right) \left( \frac{1}{N} \sum_{i=1}^N \frac{f_s(v, l_i) \cos\theta_{l_i}}{p(v, l_i)} \right)\f]
@@ -424,7 +424,7 @@ Anyway that is good starting point and lets generate \f$h\f$ vectors first.
Frankly speaking \f$D(h)\f$ is called normal distribution but cannot be directly used as hemisphere distribution.
Originally it is statistical factor used to define total area of micro faces \f$\mathrm{d}A_h\f$
whose normals lie withing given infinitesimal solid angle \f$\mathrm{d}h\f$ centered on \f$h\f$ direction using the original small enough area of macro surface \f$\mathrm{d}A\f$ @ref ref_Walter07 "[Walter07]":
whose normals lie withing given infinitesimal solid angle \f$\mathrm{d}h\f$ centered on \f$h\f$ direction using the original small enough area of macro surface \f$\mathrm{d}A\f$ [@ref Walter07]:
\f[dA_h = D(h)\,\mathrm{d}h\, \mathrm{d}A\f]
@@ -460,7 +460,7 @@ Lets strict to samples generation procedure and find partial probability densiti
\f$p(\phi_h)\f$ is unnecessary to be calculated analytically.
The fact of independency from \f$\phi\f$ is enough to figure out that this coordinate is uniformly distributed.
Anyway the \f$F(\theta_h)\f$ is next step @ref ref_Cao15 "[Cao15]":
Anyway the \f$F(\theta_h)\f$ is next step [@ref Cao15]:
\f[F(\theta_h) = \int\limits_0^{\theta_h} \frac{2 \alpha^2 \cos\theta'_h\sin\theta'_h}{(\cos^2\theta'_h(\alpha^2-1) + 1)^2}\, \mathrm{d}\theta'_h = \int\limits_{\theta_h}^0 \frac{2 \alpha^2}{(\cos^2\theta'_h(\alpha^2-1) + 1)^2}\, \mathrm{d}(\cos^2\theta'_h) = \frac{\alpha^2}{\alpha^2-1}\int\limits_0^{\theta_h} \mathrm{d}\frac{1}{\cos^2\theta'_h(\alpha^2-1)+1} =\f]
@@ -494,7 +494,7 @@ Due to previous step \f$\theta_{vh}\f$ is used instead of \f$\theta_h\f$.
In this coordinate system reflecting of \f$v\f$ relative to \f$h\f$ is just doubling \f$\theta_{vh}\f$ and Jacobian of it is equal to \f$\frac{1}{2}\f$.
In series of transform the Jacobians are multiplied so that currently \f$|J_T| = \frac{1}{2}\sin\theta_{vh}\f$.
And the final step is inverse transform to Cartesian coordinate system with \f$|J_T| = (\sin\theta_{vl})^{-1} = (\sin2\theta_{vh})^{-1}\f$.
Combining this all together the following expression is obtained for reflection transform Jacobian @ref ref_Schutte18 "[Schutte18]":
Combining this all together the following expression is obtained for reflection transform Jacobian [@ref Schutte18]:
\f[|J_T| = \frac{\sin\theta_{vh}}{2\sin2\theta_{vh}} = \frac{\sin\theta_{vh}}{4\sin\theta_{vh}\cos\theta_{vh}} = \frac{1}{4\cos\theta_{vh}}\f]
@@ -532,7 +532,7 @@ A couple of tricks helps to reduce dimensions.
First of all the \f$\cos\theta_v\f$ and \f$\phi\f$ can be just excluded.
In that way \f$v\f$ is considered to be equal to \f$n\f$.
Of course this approach produces an error and affects the final result.
It can be fixed more or less by \f$\cos\theta_{l_i}\f$ weighting @ref ref_Karis13 "[Karis13]":
It can be fixed more or less by \f$\cos\theta_{l_i}\f$ weighting [@ref Karis13]:
\f[\frac{1}{N} \sum_{i=1}^N L_i^{indirect}(l_i) \cos\theta_{l_i}\f]
@@ -589,7 +589,7 @@ It wold be better to get from such direction already averaged over bigger area e
It can be achieved using mip levels of origin \f$L_i^{indirect}\f$ whose pixels of one level is exact 4 averaged pixels from previous one.
Also mip levels generation is build in most common graphic API so there are no problems with it.
But first of all the area covered by one sample is needed to be found.
And that can be done as @ref ref_Colbert07 "[Colbert07]":
And that can be done as [@ref Colbert07]:
\f[\Omega_s = \frac{1}{N\,p(l)} = \frac{4\cos\theta_{vh}}{ND\cos\theta_h}\f]
@@ -658,7 +658,7 @@ Dot product on a sphere is defined as integral of functions multiplication. In o
\f[\int\limits_S y_i^j(l)\, y_{i'}^{j'}(l)\, \mathrm{d}l = \begin{cases} 1 & \quad i,j = i',j' \\ 0 & \quad \mathrm{otherwise}\end{cases}\f]
Function basis with such traits is known and is described by following formulas @ref ref_Guy18 "[Guy18]":
Function basis with such traits is known and is described by following formulas [@ref Guy18]:
\f[y_i^{j > 0}(\theta, \phi) = \sqrt{2}K_i^j\cos(j\phi)P_i^j(\cos\theta)\f]
\f[y_i^{j<0}(\theta, \phi) = \sqrt{2}K_i^j\sin(j\phi)P_i^{|j|}(\cos\theta)\f]
@@ -691,7 +691,7 @@ Where \f$\overline{\cos}\f$ is cosine clamped to zero which can be expressed as:
Resulted expression can be considered as convolution in terms of spherical functions where \f$L_i^{indirect}(l)\f$ is target and \f$\overline{\cos}\theta_l\f$ is core.
This integral may seem independent but in fact hemisphere is oriented related to \f$n\f$ therefore \f$\overline{\cos}\theta_l\f$ depends on it too and became a kind of 'oriented' version of cosine.
That is pretty tricky and explanation about meaning of convolution on sphere is out of scope of this paper.
Fact that this is convolution analogue related to \f$n\f$ is enough for now @ref ref_Aguilar17 "[Aguilar17]", @ref ref_Ramamoorthi01 "[Ramamoorthi01]".
Fact that this is convolution analogue related to \f$n\f$ is enough for now [@ref Aguilar17], [@ref Ramamoorthi01].
The goal of looking at integral from this angle is using of convolution's trait allowing to compute decomposition using just only coefficients of function and core.
\f$\overline{\cos}\theta_l\f$ is independent from \f$\phi_l\f$ and in case of such radial symmetric cores the resulting coefficients boil down to following formula:
@@ -720,7 +720,7 @@ There is an analytical solution for this expressions:
Starting from about the third \f$c_i\f$ the coefficients become less and less valuable so that only couple of them is enough in order to approximate \f$\overline{\cos}\theta\f$ with appropriate accuracy.
The same principle is true for convolution too because its coefficients are multiplied by \f$c_i\f$.
So there is no need to use more than even three bands (\f$i = 0, 1, 2\f$) of basis functions.
Lets write down them all in Cartesian coordinate @ref ref_Ramamoorthi01 "[Ramamoorthi01]":
Lets write down them all in Cartesian coordinate [@ref Ramamoorthi01]:
\f[y_0^0 = \frac{1}{2}\sqrt{\frac{1}{\pi}} = Y_0^0\f]
@@ -749,7 +749,7 @@ Moreover, texture is not needed at all in that case and only 9 colors representi
The Monte-Carlo algorithm can be applied with just uniform samples distribution without importance sampling at all.
\f$Y_i^j\f$ are used twice: in \f$L_i^j\f$ calculations and in sum after that.
So there is sense to store only squares of it.
All tables with constants presented below [[14](#(14))]:
All tables with constants presented below [@ref Ramamoorthi01]:
| |
|-|
@@ -778,59 +778,104 @@ TODO
@section pbr_references References
* @anchor ref_Duvenhage13 **[Duvenhage13]**
<table cellpadding="4">
<tr><td valign="top">
@anchor Duvenhage13 **[Duvenhage13]**
</td><td>
Bernardt Duvenhage, Kadi Bouatouch, D.G. Kourie,
"Numerical Verification of Bidirectional Reflectance Distribution Functions for Physical Plausibility",
*Proceedings of the South African Institute for Computer Scientists and Information Technologists Conference*,
October 2013.
</td></tr>
* @anchor ref_Cook81 **[Cook81]**
<tr><td valign="top">
@anchor Cook81 **[Cook81]**
</td><td>
Robert Cook, Kenneth Torrance,
"A Refectance Model for Computer Graphics",
*SIGGRAPH '81: Proceedings of the 8th annual conference on Computer graphics and interactive techniques*,
August 1981, pp. 307-316.
</td></tr>
* @anchor ref_Karis13 **[Karis13]**
<tr><td valign="top">
@anchor Karis13 **[Karis13]**
</td><td>
Brian Karis, "Real Shading in Unreal Engine 4", *SIGGRAPH 2013 Presentation Notes*.
</td></tr>
* @anchor ref_Heitz14 **[Heitz14]**
<tr><td valign="top">
@anchor Heitz14 **[Heitz14]**
</td><td>
Eric Heitz, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs",
*Journal of Computer Graphics Techniques*, Vol. 3, No. 2, 2014.
</td></tr>
* @anchor ref_Schlick94 **[Schlick94]**
<tr><td valign="top">
@anchor Schlick94 **[Schlick94]**
</td><td>
Christophe Schlick, "An inexpensive brdf model for physically-based rendering",
*Computer Graphics Forum 13*, 1994, pp. 233-246.
</td></tr>
* @anchor ref_Lazanyi05 **[Lazanyi05]**
<tr><td valign="top">
@anchor Lazanyi05 **[Lazanyi05]**
</td><td>
Istvan Lazanyi, Lazslo Szirmay-Kalos, "Fresnel term approximations for Metals", January 2005.
</td></tr>
* @anchor ref_Lagarde13 **[Lagarde13]**
<tr><td valign="top">
@anchor Lagarde13 **[Lagarde13]**
</td><td>
Sebastien Lagarde, "Memo on Fresnel equations",
*Blog post*: [https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/](https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/).
</td></tr>
* @anchor ref_Walter07 **[Walter07]**
<tr><td valign="top">
@anchor Walter07 **[Walter07]**
</td><td>
Bruce Walter, Stephen Marschner, Hongsong Li, Kenneth Torrance,
"Microfacet Models for Refraction through Rough Surfaces", *Proceedings of Eurographics Symposium on Rendering*, 2007.
</td></tr>
* @anchor ref_Cao15 **[Cao15]**
<tr><td valign="top">
@anchor Cao15 **[Cao15]**
</td><td>
Jiayin Cao, "Sampling microfacet BRDF", November 1, 2015,
*Blog post*: [https://agraphicsguy.wordpress.com/2015/11/01/sampling-microfacet-brdf/](https://agraphicsguy.wordpress.com/2015/11/01/sampling-microfacet-brdf/).
</td></tr>
* @anchor ref_Schutte18 **[Schutte18]**
<tr><td valign="top">
@anchor Schutte18 **[Schutte18]**
</td><td>
Joe Schutte, "Sampling techniques for GGX with Smith Masking-Shadowing: Part 1", March 7, 2018,
*Blog post*: [https://schuttejoe.github.io/post/ggximportancesamplingpart1/](https://schuttejoe.github.io/post/ggximportancesamplingpart1/).
</td></tr>
* @anchor ref_Colbert07 **[Colbert07]**
<tr><td valign="top">
@anchor Colbert07 **[Colbert07]**
</td><td>
Mark Colbert, Jaroslav Krivanek, "GPU-Based Importance Sampling", *NVIDIA GPU Gems 3*, Chapter 20, 2007.
</td></tr>
* @anchor ref_Guy18 **[Guy18]**
<tr><td valign="top">
@anchor Guy18 **[Guy18]**
</td><td>
Romain Guy, Mathias Agopian, "Physically Based Rendering in Filament", *Part of Google's Filament project documentation*:
[https://google.github.io/filament/](https://google.github.io/filament/Filament.md.html)
</td></tr>
* @anchor ref_Aguilar17 **[Aguilar17]**
<tr><td valign="top">
@anchor Aguilar17 **[Aguilar17]**
</td><td>
Orlando Aguilar, "Spherical Harmonics", *Blog post*:
[http://orlandoaguilar.github.io/sh/spherical/harmonics/irradiance/map/2017/02/12/SphericalHarmonics.html](http://orlandoaguilar.github.io/sh/spherical/harmonics/irradiance/map/2017/02/12/SphericalHarmonics.html)
</td></tr>
* @anchor ref_Ramamoorthi01 **[Ramamoorthi01]**
<tr><td valign="top">
@anchor Ramamoorthi01 **[Ramamoorthi01]**
</td><td>
Ravi Ramamoorthi, Pat Hanrahan, "An Efficient Representation for Irradiance Environment Maps",
*SIGGRAPH '01: Proceedings of the 28th annual conference on Computer graphics and interactive techniques*, August 2001, pp. 497-500
</td></tr>
</table>

View File

@@ -2149,3 +2149,10 @@ For an example, access to labels and attributes could be protected by mutex if t
Draw Harness hotkeys **W** (Wireframe) and **S** (Shaded) have been re-mapped to **Ctrl+W** and **Ctrl+S**.
Hotkey **A** has been remapped to **Backspace**.
Hotkeys WASD and Arrays are now mapped for walk-through navigation in 3D Viewer.
@subsection upgrade_750_msgfile_utf8 Utf-8 encoding for message files
Message files (with extension .msg) are now expected to be in UTF-8 encoding (unless they have UTF-16 BOM in which case UTF-16 is expected).
This allows using arbitrary Unicode symbols for localization of messages.
Existing message files containing 8-bit characters (previously interpreted as characters from Latin-1 code block) should be converted to UTF-8.

View File

@@ -10989,8 +10989,6 @@ DT_SplitSurface <result> <Surface|GridSurf> <tol> <split(0|1)>
Divides surface with C1 criterion and returns the result of splitting of a given surface into surface, which is given as parameter result. If the surface has been divided into segments, then each segment is put to an individual result. This command can correct a given C0 surface at a knot with a given tolerance, if it is impossible, then the given surface is split at that knot. If the last parameter is 1, then 5 knots are added to the given surface, and its surface is split by segments, but this will be performed not for all parametric spaces.
**Example:**
~~~~~
~~~~~
# split surface with name "su"
DT_SplitSurface res su 0.1 1
@@ -11003,7 +11001,6 @@ DT_SplitSurface res su 0.1 1
==> transfert resultat
==> res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1
~~~~~
~~~~~
@subsubsection occt_draw_9_2_8 DT_ToBspl

View File

@@ -1556,7 +1556,7 @@ aTriangles->AddVertex ( 100./2., 100./2., 0.0);
Handle(Graphic3d_AspectFillArea3d) anAspects = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_RED,
Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0f,
Graphic3d_NOM_GOLD, Graphic3d_NOM_GOLD);
Graphic3d_NameOfMaterial_Gold, Graphic3d_NameOfMaterial_Gold);
aPrsGroup->SetGroupPrimitivesAspect (anAspects);
aPrsGroup->AddPrimitiveArray (aTriangles);
@@ -2018,8 +2018,8 @@ aFirebrickMarker->SetMarkerImage (theImage)
Create facet attributes.
~~~~~{.cpp}
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = new Graphic3d_AspectFillArea3d();
Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NOM_GOLD);
Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NameOfMaterial_Brass);
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NameOfMaterial_Gold);
aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID_WIREFRAME);
aFaceAspect->SetInteriorColor (aMyColor);
aFaceAspect->SetDistinguishOn ();

View File

@@ -748,7 +748,7 @@ public:
}
Handle(AIS_Shape) aPrs = new AIS_Shape (aShape);
myAISContext()->SetMaterial (aPrs, Graphic3d_NOM_GOLD, Standard_False);
myAISContext()->SetMaterial (aPrs, Graphic3d_NameOfMaterial_Gold, Standard_False);
myAISContext()->SetDisplayMode(aPrs, AIS_Shaded, Standard_False);
myAISContext()->Display (aPrs, Standard_True);
return true;

View File

@@ -1,51 +0,0 @@
{
"Data Exchange": {
"Export": [{
"text": "BREP",
"function": "BrepExportSample",
"description": ""
},
{
"text": "STEP",
"function": "StepExportSample",
"description": ""
},
{
"text": "IGES",
"function": "IgesExportSample",
"description": ""
},
{
"text": "STL",
"function": "StlExportSample",
"description": ""
},
{
"text": "VRML",
"function": "VrmlExportSample",
"description": ""
},
{
"text": "Image",
"function": "ImageExportSample",
"description": ""
}
],
"Import": [{
"text": "BREP",
"function": "BrepImportSample",
"description": ""
},
{
"text": "STEP",
"function": "StepImportSample",
"description": ""
},
{
"text": "IGES",
"function": "IgesImportSample",
"description": ""
}
]
}
}

View File

@@ -0,0 +1,17 @@
<Menu>
<MenuItem name="Data Exchange">
<MenuItem name="Export">
<Sample name="BREP" function="BrepExportSample"/>
<Sample name="STEP" function="StepExportSample"/>
<Sample name="IGES" function="IgesExportSample"/>
<Sample name="STL" function="StlExportSample"/>
<Sample name="VRML" function="VrmlExportSample"/>
<Sample name="Image" function="ImageExportSample"/>
</MenuItem>
<MenuItem name="Import">
<Sample name="BREP" function="BrepImportSample"/>
<Sample name="STEP" function="StepImportSample"/>
<Sample name="IGES" function="IgesImportSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -128,8 +128,10 @@ void DataExchangeSamples::ExecuteSample (const TCollection_AsciiString& theSampl
void DataExchangeSamples::BrepExportSample()
{
Standard_Boolean anIsShapeExist = Standard_False;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
anIsShapeExist = Standard_True;
@@ -167,8 +169,10 @@ void DataExchangeSamples::StepExportSample()
}
STEPControl_Writer aStepWriter;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
aStatus = aStepWriter.Transfer(aShape->Shape(), myStepType);
@@ -207,8 +211,10 @@ void DataExchangeSamples::IgesExportSample()
Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
Standard_Boolean anIsShapeExist = Standard_False;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
anIsShapeExist = Standard_True;
@@ -240,8 +246,10 @@ void DataExchangeSamples::StlExportSample()
aBuilder.MakeCompound(aTopoCompound);
Standard_Boolean anIsShapeExist = Standard_False;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
anIsShapeExist = Standard_True;
@@ -273,8 +281,10 @@ void DataExchangeSamples::VrmlExportSample()
aBrepBuilder.MakeCompound(aTopoCompound);
Standard_Boolean anIsShapeExist = Standard_False;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
anIsShapeExist = Standard_True;
@@ -382,8 +392,10 @@ void DataExchangeSamples::IgesImportSample()
Standard_Boolean DataExchangeSamples::CheckFacetedBrep()
{
Standard_Boolean anError = Standard_False;
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter (myObject3d);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
{
const TopoDS_Shape aTopoShape = aShape->Shape();

View File

@@ -37,7 +37,7 @@ public:
const Handle(V3d_View)& theView,
const Handle(AIS_InteractiveContext)& theContext)
: BaseSample (theSampleSourcePath, theContext),
myStepType (STEPControl_StepModelType::STEPControl_AsIs),
myStepType (STEPControl_AsIs),
myView (theView)
{
//

View File

@@ -8,15 +8,15 @@ AdaptorVec_AIS.cxx
AdaptorVec_AIS.h
BaseSample.cxx
BaseSample.h
DataExchange.json
DataExchange.xml
DataExchangeSamples.cxx
DataExchangeSamples.h
Geometry.json
Geometry.xml
GeometrySamples.cxx
GeometrySamples.h
MakeBottle.cxx
MakeBottle.h
Ocaf.json
Ocaf.xml
OcafSamples.cxx
OcafSamples.h
Sample2D_Face.cxx
@@ -34,15 +34,15 @@ TOcafFunction_CylDriver.cxx
TOcafFunction_CylDriver.h
TOcaf_Application.cxx
TOcaf_Application.h
Topology.json
Topology.xml
TopologySamples.cxx
TopologySamples.h
Triangulation.json
Triangulation.xml
TriangulationSamples.cxx
TriangulationSamples.h
Viewer2d.json
Viewer2d.xml
Viewer2dSamples.cxx
Viewer2dSamples.h
Viewer3d.json
Viewer3d.xml
Viewer3dSamples.cxx
Viewer3dSamples.h

View File

@@ -1,287 +0,0 @@
{
"Non Parametric": {
"Free creating": {
"3D": [{
"text": "Zero Dimension objects",
"function": "ZeroDimensionObjects3dSample",
"description": ""
},
{
"text": "Vectors",
"function": "Vectors3dSample",
"description": ""
},
{
"text": "Infinity lines",
"function": "InfinityLines3dSample",
"description": ""
},
{
"text": "Second order curves",
"function": "SecondOrderCurves3dSample",
"description": ""
},
{
"text": "Plane surfaces",
"function": "PlaneSurfaces3dSample",
"description": ""
},
{
"text": "Second order surfaces",
"function": "SecondOrderSurfaces3dSample",
"description": ""
}
],
"2D": [{
"text": "Zero Dimension objects",
"function": "ZeroDimensionObjects2dSample",
"description": ""
},
{
"text": "Vectors",
"function": "Vectors2dSample",
"description": ""
},
{
"text": "Infinity lines",
"function": "InfinityLines2dSample",
"description": ""
},
{
"text": "Second order curves",
"function": "SecondOrderCurves2dSample",
"description": ""
}
]
}
,
"Creating based on criteria": {
"3D": [{
"text": "Barycenter point",
"function": "BarycenterPoint3dSample",
"description": ""
},
{
"text": "Rotated vector",
"function": "RotatedVector3dSample",
"description": ""
},
{
"text": "Mirrored line",
"function": "MirroredLine3dSample",
"description": ""
},
{
"text": "Scaled Ellipse",
"function": "ScaledEllipse3dSample",
"description": ""
},
{
"text": "Transformed cylinder",
"function": "TransformedCylinder3dSample",
"description": ""
},
{
"text": "Translated torus",
"function": "TranslatedTorus3dSample",
"description": ""
},
{
"text": "Conjugate objects ",
"function": "ConjugateObjects3dSample",
"description": ""
},
{
"text": "Projection of point",
"function": "ProjectionOfPoint3dSample",
"description": ""
},
{
"text": "Minimal distance",
"function": "MinimalDistance3dSample",
"description": ""
},
{
"text": "Intersection",
"function": "Intersection3dSample",
"description": ""
}
],
"2D": [{
"text": "Translated point",
"function": "TranslatedPoint2dSample",
"description": ""
},
{
"text": "Rotated direction",
"function": "RotatedDirection2dSample",
"description": ""
},
{
"text": "Mirrored axis",
"function": "MirroredAxis2dSample",
"description": ""
},
{
"text": "Transformed ellipse",
"function": "TransformedEllipse2dSample",
"description": ""
},
{
"text": "Conjugate objects",
"function": "ConjugateObjects2dSample",
"description": ""
},
{
"text": "Tangent to 2 cilcles",
"function": "Tangent2dSample",
"description": ""
},
{
"text": "Projection of point",
"function": "ProjectionOfPoint2dSample",
"description": ""
},
{
"text": "Minimal distance",
"function": "MinimalDistance2dSample",
"description": ""
},
{
"text": "Intersection",
"function": "Intersection2dSample",
"description": ""
}
]
},
"Data extraction": {
"3D": [{
"text": "Point info",
"function": "PointInfo3dSample",
"description": ""
},
{
"text": "Ellipse info",
"function": "EllipseInfo3dSample",
"description": ""
}
],
"2D": [{
"text": "Point info",
"function": "PointInfo2dSample",
"description": ""
},
{
"text": "Circle info",
"function": "CircleInfo2dSample",
"description": ""
}
]
}
},
"Parametric": {
"Free creating": {
"3D": [{
"text": "Free style curves",
"function": "FreeStyleCurves3dSample",
"description": ""
},
{
"text": "Analytical surfaces",
"function": "AnalyticalSurfaces3dSample",
"description": ""
},
{
"text": "Free style surfaces",
"function": "FreeStyleSurfaces3dSample",
"description": ""
}
],
"2D": [{
"text": "Free style curves",
"function": "FreeStyleCurves2dSample",
"description": ""
}
]
},
"Creating based on geometry": {
"3D": [{
"text": "Trimmed curve",
"function": "TrimmedCurve3dSample",
"description": ""
},
{
"text": "Offset curve",
"function": "OffsetCurve3dSample",
"description": ""
},
{
"text": "BSpline from circle",
"function": "BSplineFromCircle3dSample",
"description": ""
},
{
"text": "Trimmed surface",
"function": "TrimmedSurface3dSample",
"description": ""
},
{
"text": "Offset surface",
"function": "OffsetSurface3dSample",
"description": ""
},
{
"text": "Extrusion surface",
"function": "ExtrusionSurface3dSample",
"description": ""
},
{
"text": "Revolution surface",
"function": "RevolutionSurface3dSample",
"description": ""
}
],
"2D": [{
"text": "Trimmed curve",
"function": "TrimmedCurve2dSample",
"description": ""
},
{
"text": "Offset curve",
"function": "OffsetCurve2dSample",
"description": ""
}
]
},
"Extract geometry": [{
"text": "Bounding box of surface (3D)",
"function": "BoundingBoxOfSurface3dSample",
"description": ""
},
{
"text": "Bounding box of curves (3D)",
"function": "BoundingBoxOfCurves3dSample",
"description": ""
},
{
"text": "Bounding box of curves (2D)",
"function": "BoundingBoxOfCurves2dSample",
"description": ""
}
],
"Data extraction": [{
"text": "Dump circle info",
"function": "DumpCircleInfoSample",
"description": ""
},
{
"text": "Dump BSpline curve info",
"function": "DumpBSplineCurveInfoSample",
"description": ""
}
]
}
}

View File

@@ -0,0 +1,92 @@
<Menu>
<MenuItem name="Non Parametric">
<MenuItem name="Free creating">
<MenuItem name="3D">
<Sample name="Zero Dimension objects" function="ZeroDimensionObjects3dSample"/>
<Sample name="Vectors" function="Vectors3dSample"/>
<Sample name="Infinity lines" function="InfinityLines3dSample"/>
<Sample name="Second order curves" function="SecondOrderCurves3dSample"/>
<Sample name="Plane surfaces" function="PlaneSurfaces3dSample"/>
<Sample name="Second order surfaces" function="SecondOrderSurfaces3dSample"/>
</MenuItem>
<MenuItem name="2D">
<Sample name="Zero Dimension objects" function="ZeroDimensionObjects2dSample"/>
<Sample name="Vectors" function="Vectors2dSample"/>
<Sample name="Infinity lines" function="InfinityLines2dSample"/>
<Sample name="Second order curves" function="SecondOrderCurves2dSample"/>
</MenuItem>
</MenuItem>
<MenuItem name="Creating based on criteria">
<MenuItem name="3D">
<Sample name="Barycenter point" function="BarycenterPoint3dSample"/>
<Sample name="Rotated vector" function="RotatedVector3dSample"/>
<Sample name="Mirrored line" function="MirroredLine3dSample"/>
<Sample name="Scaled Ellipse" function="ScaledEllipse3dSample"/>
<Sample name="Transformed cylinder" function="TransformedCylinder3dSample"/>
<Sample name="Translated torus" function="TranslatedTorus3dSample"/>
<Sample name="Conjugate objects" function="ConjugateObjects3dSample"/>
<Sample name="Projection of point" function="ProjectionOfPoint3dSample"/>
<Sample name="Minimal distance" function="MinimalDistance3dSample"/>
<Sample name="Intersection" function="Intersection3dSample"/>
</MenuItem>
<MenuItem name="2D">
<Sample name="Translated point" function="TranslatedPoint2dSample"/>
<Sample name="Rotated direction" function="RotatedDirection2dSample"/>
<Sample name="Mirrored axis" function="MirroredAxis2dSample"/>
<Sample name="Transformed ellipse" function="TransformedEllipse2dSample"/>
<Sample name="Conjugate objects" function="ConjugateObjects2dSample"/>
<Sample name="Tangent to 2 cilcles" function="Tangent2dSample"/>
<Sample name="Projection of point" function="ProjectionOfPoint2dSample"/>
<Sample name="Minimal distance" function="MinimalDistance2dSample"/>
<Sample name="Intersection" function="Intersection2dSample"/>
</MenuItem>
</MenuItem>
<MenuItem name="Data extraction">
<MenuItem name="3D">
<Sample name="Point info" function="PointInfo3dSample"/>
<Sample name="Ellipse info" function="EllipseInfo3dSample"/>
</MenuItem>
<MenuItem name="2D">
<Sample name="Point info" function="PointInfo2dSample"/>
<Sample name="Circle info" function="CircleInfo2dSample"/>
</MenuItem>
</MenuItem>
</MenuItem>
<MenuItem name="Parametric">
<MenuItem name="Free creating">
<MenuItem name="3D">
<Sample name="Free style curves" function="FreeStyleCurves3dSample"/>
<Sample name="Analytical surfaces" function="AnalyticalSurfaces3dSample"/>
<Sample name="Free style surfaces" function="FreeStyleSurfaces3dSample"/>
</MenuItem>
<MenuItem name="2D">
<Sample name="Free style curves" function="FreeStyleCurves2dSample"/>
</MenuItem>
</MenuItem>
<MenuItem name="Creating based on geometry">
<MenuItem name="3D">
<Sample name="Trimmed curve" function="TrimmedCurve3dSample"/>
<Sample name="Offset curve" function="OffsetCurve3dSample"/>
<Sample name="BSpline from circle" function="BSplineFromCircle3dSample"/>
<Sample name="Trimmed surface" function="TrimmedSurface3dSample"/>
<Sample name="Offset surface" function="OffsetSurface3dSample"/>
<Sample name="Extrusion surface" function="ExtrusionSurface3dSample"/>
<Sample name="Revolution surface" function="RevolutionSurface3dSample"/>
</MenuItem>
<MenuItem name="2D">
<Sample name="Trimmed curve" function="TrimmedCurve2dSample"/>
<Sample name="Offset curve" function="OffsetCurve2dSample"/>
</MenuItem>
</MenuItem>
<MenuItem name="Extract geometry">
<Sample name="Bounding box of surface (3D)" function="BoundingBoxOfSurface3dSample"/>
<Sample name="Bounding box of curves (3D)" function="BoundingBoxOfCurves3dSample"/>
<Sample name="Bounding box of curves (2D)" function="BoundingBoxOfCurves2dSample"/>
</MenuItem>
<MenuItem name="Data extraction">
<Sample name="Dump circle info" function="DumpCircleInfoSample"/>
<Sample name="Dump BSpline curve info" function="DumpBSplineCurveInfoSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -1,53 +0,0 @@
{
"OCAF": {
"1 Create": [{
"text": "Create Box",
"function": "CreateBoxOcafSample",
"description": ""
},
{
"text": "Create Cylinder",
"function": "CreateCylinderOcafSample",
"description": ""
}
],
"2 Modify": [{
"text": "Modify Box",
"function": "ModifyBoxOcafSample",
"description": ""
},
{
"text": "Modify Cylinder",
"function": "ModifyCylinderOcafSample",
"description": ""
}
],
"3 Action": [{
"text": "Undo",
"function": "UndoOcafSample",
"description": ""
},
{
"text": "Redo",
"function": "RedoOcafSample",
"description": ""
}
],
"4 Data storage": [{
"text": "Open OCAF",
"function": "DialogOpenOcafSample",
"description": ""
},
{
"text": "Save binary OCAF",
"function": "DialogSaveBinOcafSample",
"description": ""
},
{
"text": "Save XML OCAF",
"function": "DialogSaveXmlOcafSample",
"description": ""
}
]
}
}

View File

@@ -0,0 +1,21 @@
<Menu>
<MenuItem name="OCAF">
<MenuItem name="1 Create">
<Sample name="Create Box" function="CreateBoxOcafSample"/>
<Sample name="Create Cylinder" function="CreateCylinderOcafSample"/>
</MenuItem>
<MenuItem name="2 Modify">
<Sample name="Modify Box" function="ModifyBoxOcafSample"/>
<Sample name="Modify Cylinder" function="ModifyCylinderOcafSample"/>
</MenuItem>
<MenuItem name="3 Action">
<Sample name="Undo" function="UndoOcafSample"/>
<Sample name="Redo" function="RedoOcafSample"/>
</MenuItem>
<MenuItem name="4 Data storage">
<Sample name="Open OCAF" function="DialogOpenOcafSample"/>
<Sample name="Save binary OCAF" function="DialogSaveBinOcafSample"/>
<Sample name="Save XML OCAF" function="DialogSaveXmlOcafSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -298,8 +298,11 @@ void OcafSamples::ModifyBoxOcafSample()
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
Standard_Integer aBoxCount(0);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
// Get the main label of the selected object
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
TDF_Label aLabel = anAisPresentation->Label();
@@ -398,8 +401,10 @@ void OcafSamples::ModifyCylinderOcafSample()
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
Standard_Integer aCylCount(0);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
// Get the main label of the selected object
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
TDF_Label aLabel = anAisPresentation->Label();
@@ -534,7 +539,7 @@ void OcafSamples::DialogOpenOcafSample()
}
// Open the document in the current application
PCDM_ReaderStatus aReaderStatus = anOcaf_Application->Open(myFileName, myOcafDoc);
if (aReaderStatus == PCDM_ReaderStatus::PCDM_RS_OK)
if (aReaderStatus == PCDM_RS_OK)
{
// Connect the document CAF (myDoc) with the AISContext (myAISContext)
TPrsStd_AISViewer::New(myOcafDoc->Main(), myViewer);
@@ -563,7 +568,7 @@ void OcafSamples::DialogSaveBinOcafSample()
myOcafDoc->ChangeStorageFormat("BinOcaf");
// Saves the document in the current application
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
if (aStoreStatus == PCDM_SS_OK)
{
myResult << "The file was saved successfully" << std::endl;
}
@@ -580,7 +585,7 @@ void OcafSamples::DialogSaveXmlOcafSample()
myOcafDoc->ChangeStorageFormat("XmlOcaf");
// Saves the document in the current application
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
if (aStoreStatus == PCDM_SS_OK)
{
myResult << "The file was saved successfully" << std::endl;
}

View File

@@ -44,8 +44,6 @@ public:
//
}
enum ExchangeType { None, Binary, Xml };
virtual void Process (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE;
void ClearExtra();
@@ -75,11 +73,9 @@ private:
private:
ExchangeType myExchangeType;
TCollection_AsciiString myFileName;
Handle(V3d_Viewer) myViewer;
Handle(TDocStd_Document) myOcafDoc;
};
#endif //OCAFSAMPLES_H

View File

@@ -1,11 +1,11 @@
<RCC>
<qresource prefix="/menus">
<file>Geometry.json</file>
<file>Topology.json</file>
<file>Triangulation.json</file>
<file>DataExchange.json</file>
<file>Viewer3d.json</file>
<file>Viewer2d.json</file>
<file>Ocaf.json</file>
<file>Geometry.xml</file>
<file>Topology.xml</file>
<file>Triangulation.xml</file>
<file>DataExchange.xml</file>
<file>Viewer3d.xml</file>
<file>Viewer2d.xml</file>
<file>Ocaf.xml</file>
</qresource>
</RCC>

View File

@@ -1,176 +0,0 @@
{
"Topology": {
"Topological Shape": [{
"text": "Vertex",
"function": "Vertex3dSample",
"description": ""
},
{
"text": "Edge",
"function": "Edge3dSample",
"description": ""
},
{
"text": "Face",
"function": "Face3dSample",
"description": ""
},
{
"text": "Wire",
"function": "Wire3dSample",
"description": ""
},
{
"text": "Shell",
"function": "Shell3dSample",
"description": ""
},
{
"text": "Solid",
"function": "Solid3dSample",
"description": ""
},
{
"text": "Edge (2D)",
"function": "Edge2dSample",
"description": ""
}
],
"BRep primitive objects": [{
"text": "Box",
"function": "Box3dSample",
"description": ""
},
{
"text": "Cylinder",
"function": "Cylinder3dSample",
"description": ""
},
{
"text": "Revolution",
"function": "Revolution3dSample",
"description": ""
}
],
"Topology access": [{
"text": "Topology iterator",
"function": "TopologyIterator3dSample",
"description": ""
},
{
"text": "Topology explorer",
"function": "TopologyExplorer3dSample",
"description": ""
},
{
"text": "Assess to curve",
"function": "AssessToCurve3dSample",
"description": ""
},
{
"text": "Assess to composite curve",
"function": "AssessToCompositeCurve3dSample",
"description": ""
},
{
"text": "Assess to surface",
"function": "AssessToSurface3dSample",
"description": ""
}
],
"Boolean operation": [{
"text": "Common",
"function": "Common3dSample",
"description": ""
},
{
"text": "Cut",
"function": "Cut3dSample",
"description": ""
},
{
"text": "Fuse",
"function": "Fuse3dSample",
"description": ""
},
{
"text": "Section",
"function": "Section3dSample",
"description": ""
},
{
"text": "Splitter",
"function": "Splitter3dSample",
"description": ""
},
{
"text": "Defeaturing",
"function": "Defeaturing3dSample",
"description": ""
}
],
"Complex modelling": [{
"text": "Fillet",
"function": "Fillet3dSample",
"description": ""
},
{
"text": "Chamfer",
"function": "Chamfer3dSample",
"description": ""
},
{
"text": "Offset",
"function": "Offset3dSample",
"description": ""
},
{
"text": "Evolved",
"function": "Evolved3dSample",
"description": ""
}
],
"Modification": [{
"text": "Copy",
"function": "Copy3dSample",
"description": ""
},
{
"text": "Transform",
"function": "Transform3dSample",
"description": ""
},
{
"text": "Convert to NURBS",
"function": "ConvertToNurbs3dSample",
"description": ""
},
{
"text": "Sew contiguous faces",
"function": "SewContiguousFaces3dSample",
"description": ""
}
],
"Calculation": [{
"text": "Check validity",
"function": "CheckValidity3dSample",
"description": ""
},
{
"text": "Compute linear properties",
"function": "ComputeLinearProperties3dSample",
"description": ""
},
{
"text": "Compute surface properties",
"function": "ComputeSurfaceProperties3dSample",
"description": ""
},
{
"text": "Compute volume properties",
"function": "ComputeVolumeProperties3dSample",
"description": ""
}
]
}
}

View File

@@ -0,0 +1,51 @@
<Menu>
<MenuItem name="Topology">
<MenuItem name="Topological Shape">
<Sample name="Vertex" function="Vertex3dSample"/>
<Sample name="Edge" function="Edge3dSample"/>
<Sample name="Face" function="Face3dSample"/>
<Sample name="Wire" function="Wire3dSample"/>
<Sample name="Shell" function="Shell3dSample"/>
<Sample name="Solid" function="Solid3dSample"/>
<Sample name="Edge (2D)" function="Edge2dSample"/>
</MenuItem>
<MenuItem name="BRep primitive objects">
<Sample name="Box" function="Box3dSample"/>
<Sample name="Cylinder" function="Cylinder3dSample"/>
<Sample name="Revolution" function="Revolution3dSample"/>
</MenuItem>
<MenuItem name="Topology access">
<Sample name="Topology iterator" function="TopologyIterator3dSample"/>
<Sample name="Topology explorer" function="TopologyExplorer3dSample"/>
<Sample name="Assess to curve" function="AssessToCurve3dSample"/>
<Sample name="Assess to composite curve" function="AssessToCompositeCurve3dSample"/>
<Sample name="Assess to surface" function="AssessToSurface3dSample"/>
</MenuItem>
<MenuItem name="Boolean operation">
<Sample name="Common" function="Common3dSample"/>
<Sample name="Cut" function="Cut3dSample"/>
<Sample name="Fuse" function="Fuse3dSample"/>
<Sample name="Section" function="Section3dSample"/>
<Sample name="Splitter" function="Splitter3dSample"/>
<Sample name="Defeaturing" function="Defeaturing3dSample"/>
</MenuItem>
<MenuItem name="Complex modelling">
<Sample name="Fillet" function="Fillet3dSample"/>
<Sample name="Chamfer" function="Chamfer3dSample"/>
<Sample name="Offset" function="Offset3dSample"/>
<Sample name="Evolved" function="Evolved3dSample"/>
</MenuItem>
<MenuItem name="Modification">
<Sample name="Copy" function="Copy3dSample"/>
<Sample name="Transform" function="Transform3dSample"/>
<Sample name="Convert to NURBS" function="ConvertToNurbs3dSample"/>
<Sample name="Sew contiguous faces" function="SewContiguousFaces3dSample"/>
</MenuItem>
<MenuItem name="Calculation">
<Sample name="Check validity" function="CheckValidity3dSample"/>
<Sample name="Compute linear properties" function="ComputeLinearProperties3dSample"/>
<Sample name="Compute surface properties" function="ComputeSurfaceProperties3dSample"/>
<Sample name="Compute volume properties" function="ComputeVolumeProperties3dSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -1,10 +0,0 @@
{
"Triangulation": {
"Create Triangulation": [{
"text": "Triangulation on shape",
"function": "Triangulation3dSample",
"description": ""
}]
}
}

View File

@@ -0,0 +1,7 @@
<Menu>
<MenuItem name="Triangulation">
<MenuItem name="Create Triangulation">
<Sample name="Triangulation on shape" function="Triangulation3dSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -1,58 +0,0 @@
{
"Viewer 2D": {
"Labels": [{
"text": "Text",
"function": "TextView2dSample",
"description": ""
},
{
"text": "Marker",
"function": "MarkerView2dSample",
"description": ""
},
{
"text": "Fill Area",
"function": "FillAreaView2dSample",
"description": ""
},
{
"text": "Loop on face",
"function": "LoopOnFaceView2dSample",
"description": ""
}
],
"Grids": [{
"text": "Rectagular Lines",
"function": "RectagularLineGrid2dSample",
"description": ""
},
{
"text": "Rectagular Points",
"function": "RectagularPointGrid2dSample",
"description": ""
},
{
"text": "Circular Lines",
"function": "CircularLineGrid2dSample",
"description": ""
},
{
"text": "Circular Points",
"function": "CircularPointGrid2dSample",
"description": ""
},
{
"text": "Clear",
"function": "ClearGrid2dSample",
"description": ""
}
],
"Image": [{
"text": "Backgroung Image",
"function": "BackgroungImage2dSample",
"description": ""
}]
}
}

View File

@@ -0,0 +1,20 @@
<Menu>
<MenuItem name="Viewer 2D">
<MenuItem name="Labels">
<Sample name="Text" function="TextView2dSample"/>
<Sample name="Marker" function="MarkerView2dSample"/>
<Sample name="Fill Area" function="FillAreaView2dSample"/>
<Sample name="Loop on face" function="LoopOnFaceView2dSample"/>
</MenuItem>
<MenuItem name="Grids">
<Sample name="Rectagular Lines" function="RectagularLineGrid2dSample"/>
<Sample name="Rectagular Points" function="RectagularPointGrid2dSample"/>
<Sample name="Circular Lines" function="CircularLineGrid2dSample"/>
<Sample name="Circular Points" function="CircularPointGrid2dSample"/>
<Sample name="Clear" function="ClearGrid2dSample"/>
</MenuItem>
<MenuItem name="Image">
<Sample name="Backgroung Image" function="BackgroungImage2dSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -75,7 +75,7 @@ void Viewer2dSamples::ClearExtra()
void Viewer2dSamples::TextView2dSample()
{
Standard_Integer aColor = Quantity_NameOfColor::Quantity_NOC_MATRABLUE;
Standard_Integer aColor = Quantity_NOC_MATRABLUE;
for (Standard_Integer j = 15; j <= 20; j++)
{
Handle(AIS_TextLabel) aText = new AIS_TextLabel();

View File

@@ -1,106 +0,0 @@
{
"Viewer 3D": {
"Light source": [{
"text": "Spot",
"function": "SpotLight3dSample",
"description": ""
},
{
"text": "Positional",
"function": "PositionalLight3dSample",
"description": ""
},
{
"text": "Directional",
"function": "DirectionalLight3dSample",
"description": ""
},
{
"text": "Ambient",
"function": "AmbientLight3dSample",
"description": ""
},
{
"text": "Clear",
"function": "ClearLight3dSample",
"description": ""
}
],
"Selection mode": [{
"text": "Vertices",
"function": "VerticesSelect3dSample",
"description": ""
},
{
"text": "Edges",
"function": "EdgesSelect3dSample",
"description": ""
},
{
"text": "Faces",
"function": "FacesSelect3dSample",
"description": ""
},
{
"text": "Neutral point",
"function": "NeutralPointSelect3dSample",
"description": ""
}
],
"Shape presentation": [
{
"text": "WireFrame",
"function": "WireFramePresentation3dSample",
"description": ""
},
{
"text": "Shading",
"function": "ShadingPresentation3dSample",
"description": ""
},
{
"text": "Set color to red",
"function": "RedColorPresentation3dSample",
"description": ""
},
{
"text": "Set color to gray",
"function": "GrayColorPresentation3dSample",
"description": ""
},
{
"text": "Set plastic material",
"function": "PlasticPresentation3dSample",
"description": ""
},
{
"text": "Set bronze material",
"function": "BronzePresentation3dSample",
"description": ""
},
{
"text": "Set opaque",
"function": "OpaquePresentation3dSample",
"description": ""
},
{
"text": "Set half transparency",
"function": "HalfTransparencyPresentation3dSample",
"description": ""
}
],
"OpenGL VBO mode": [{
"text": "Vertex Buffer Object mode ON",
"function": "VboOn3dSample",
"description": ""
},
{
"text": "Vertex Buffer Object mode OFF",
"function": "VboOff3dSample",
"description": ""
}
]
}
}

View File

@@ -0,0 +1,31 @@
<Menu>
<MenuItem name="Viewer 3D">
<MenuItem name="Light source">
<Sample name="Spot" function="SpotLight3dSample"/>
<Sample name="Positional" function="PositionalLight3dSample"/>
<Sample name="Directional" function="DirectionalLight3dSample"/>
<Sample name="Ambient" function="AmbientLight3dSample"/>
<Sample name="Clear" function="ClearLight3dSample"/>
</MenuItem>
<MenuItem name="Selection mode">
<Sample name="Vertices" function="VerticesSelect3dSample"/>
<Sample name="Edges" function="EdgesSelect3dSample"/>
<Sample name="Faces" function="FacesSelect3dSample"/>
<Sample name="Neutral point" function="NeutralPointSelect3dSample"/>
</MenuItem>
<MenuItem name="Shape presentation">
<Sample name="WireFrame" function="WireFramePresentation3dSample"/>
<Sample name="Shading" function="ShadingPresentation3dSample"/>
<Sample name="Set color to red" function="RedColorPresentation3dSample"/>
<Sample name="Set color to gray" function="GrayColorPresentation3dSample"/>
<Sample name="Set plastic material" function="PlasticPresentation3dSample"/>
<Sample name="Set bronze material" function="BronzePresentation3dSample"/>
<Sample name="Set opaque" function="OpaquePresentation3dSample"/>
<Sample name="Set half transparency" function="HalfTransparencyPresentation3dSample"/>
</MenuItem>
<MenuItem name="OpenGL VBO mode">
<Sample name="Vertex Buffer Object mode ON" function="VboOn3dSample"/>
<Sample name="Vertex Buffer Object mode OFF" function="VboOff3dSample"/>
</MenuItem>
</MenuItem>
</Menu>

View File

@@ -99,12 +99,14 @@ void Viewer3dSamples::ClearExtra()
ClearLight3dSample();
// Delete Lights
V3d_ListOfLight aLights;
for (V3d_ListOfLightIterator anIter = myView->Viewer()->DefinedLightIterator(); anIter.More(); anIter.Next())
for(V3d_ListOfLightIterator anIter = myView->Viewer()->DefinedLightIterator();
anIter.More(); anIter.Next())
{
aLights.Append(anIter.Value());
}
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
for(V3d_ListOfLightIterator aLightIter (aLights);
aLightIter.More(); aLightIter.Next())
{
myView->Viewer()->DelLight (aLightIter.Value());
}
@@ -117,27 +119,31 @@ void Viewer3dSamples::ClearExtra()
void Viewer3dSamples::SpotLight3dSample()
{
// Spot light source creation
Handle(V3d_SpotLight) aSpotLight = new V3d_SpotLight(gp_Pnt(100.0, 0.0, 0.0), gp_Dir(-1.0, 0.0, 0.0), Quantity_NOC_RED);
Handle(V3d_SpotLight) aSpotLight =
new V3d_SpotLight(gp_Pnt(100.0, 0.0, 0.0), gp_Dir(-1.0, 0.0, 0.0), Quantity_NOC_RED);
aSpotLight->SetIntensity(5000);
myView->SetLightOn(aSpotLight);
}
void Viewer3dSamples::PositionalLight3dSample()
{
Handle(V3d_PositionalLight) aPositionalLight = new V3d_PositionalLight(gp_Pnt(0.0, -100.0, 5.0), Quantity_NOC_GREEN);
Handle(V3d_PositionalLight) aPositionalLight =
new V3d_PositionalLight(gp_Pnt(0.0, -100.0, 5.0), Quantity_NOC_GREEN);
aPositionalLight->SetAttenuation(1, 0);
myView->SetLightOn(aPositionalLight);
}
void Viewer3dSamples::DirectionalLight3dSample()
{
Handle(V3d_DirectionalLight) aDirectionalLight = new V3d_DirectionalLight(gp_Dir(-1.0, 0.0, -1.0), Quantity_NOC_BLUE1);
Handle(V3d_DirectionalLight) aDirectionalLight =
new V3d_DirectionalLight(gp_Dir(-1.0, 0.0, -1.0), Quantity_NOC_BLUE1);
myView->SetLightOn(aDirectionalLight);
}
void Viewer3dSamples::AmbientLight3dSample()
{
Handle(V3d_AmbientLight) aAmbientLight = new V3d_AmbientLight(Quantity_NOC_MAGENTA1);
Handle(V3d_AmbientLight) aAmbientLight =
new V3d_AmbientLight(Quantity_NOC_MAGENTA1);
myView->SetLightOn(aAmbientLight);
}
@@ -145,23 +151,27 @@ void Viewer3dSamples::ClearLight3dSample()
{
// Setting Off all viewer active lights
V3d_ListOfLight aLights;
for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())
for(V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator();
anIter.More(); anIter.Next())
{
aLights.Append(anIter.Value());
}
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
for(V3d_ListOfLightIterator aLightIter(aLights);
aLightIter.More(); aLightIter.Next())
{
myView->Viewer()->SetLightOff (aLightIter.Value());
}
// Setting Off all view active lights
aLights.Clear();
for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())
for(V3d_ListOfLightIterator anIter = myView->ActiveLightIterator();
anIter.More(); anIter.Next())
{
aLights.Append(anIter.Value());
}
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
for(V3d_ListOfLightIterator aLightIter (aLights);
aLightIter.More(); aLightIter.Next())
{
myView->SetLightOff (aLightIter.Value());
}
@@ -197,8 +207,10 @@ void Viewer3dSamples::WireFramePresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetDisplayMode(anAisObject, 0, false); // set wireframe
}
myContext->UpdateCurrentViewer();
@@ -208,8 +220,10 @@ void Viewer3dSamples::ShadingPresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetDisplayMode(anAisObject, 1, false); // set shading
}
myContext->UpdateCurrentViewer();
@@ -219,8 +233,10 @@ void Viewer3dSamples::RedColorPresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
Quantity_Color aShapeColor;
myContext->Color(anAisObject, aShapeColor);
myResult << "A Current shape color: Red = " << aShapeColor.Red()
@@ -236,16 +252,20 @@ void Viewer3dSamples::GrayColorPresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
Quantity_Color aShapeColor;
myContext->Color(anAisObject, aShapeColor);
myResult << "A Current shape color: Hue = " << aShapeColor.Hue()
<< " Light = " << aShapeColor.Light() << " Saturation = " << aShapeColor.Saturation() << std::endl;
<< " Light = " << aShapeColor.Light()
<< " Saturation = " << aShapeColor.Saturation() << std::endl;
aShapeColor.SetValues(0.0, 0.3, 0.1, Quantity_TOC_HLS);
myContext->SetColor(anAisObject, aShapeColor, Standard_False);
myResult << "A New shape color: Hue = " << aShapeColor.Hue()
<< " Light = " << aShapeColor.Light() << " Saturation = " << aShapeColor.Saturation() << std::endl;
<< " Light = " << aShapeColor.Light()
<< " Saturation = " << aShapeColor.Saturation() << std::endl;
}
}
@@ -254,8 +274,10 @@ void Viewer3dSamples::PlasticPresentation3dSample()
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_PLASTIC;
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
}
myContext->UpdateCurrentViewer();
@@ -266,8 +288,10 @@ void Viewer3dSamples::BronzePresentation3dSample()
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_BRONZE;
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
}
myContext->UpdateCurrentViewer();
@@ -277,8 +301,10 @@ void Viewer3dSamples::OpaquePresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetTransparency(anAisObject, 0.0, Standard_False);
}
myContext->UpdateCurrentViewer();
@@ -288,8 +314,10 @@ void Viewer3dSamples::HalfTransparencyPresentation3dSample()
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetTransparency(anAisObject, 0.5, Standard_False);
}
myContext->UpdateCurrentViewer();
@@ -297,7 +325,8 @@ void Viewer3dSamples::HalfTransparencyPresentation3dSample()
void Viewer3dSamples::VboOn3dSample()
{
if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
if(Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
{
aDriver->ChangeOptions().vboDisable = Standard_False;
}
@@ -305,7 +334,8 @@ void Viewer3dSamples::VboOn3dSample()
void Viewer3dSamples::VboOff3dSample()
{
if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
if(Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
{
aDriver->ChangeOptions().vboDisable = Standard_True;
}

View File

@@ -316,7 +316,7 @@ void OcctViewer::displayWithChildren (XCAFDoc_ShapeTool& theShapeToo
Handle(AIS_InteractiveObject) anAis;
if (!theMapOfShapes.Find (aRefLabel, anAis))
{
anAis = new CafShapePrs (aRefLabel, theParentStyle, Graphic3d_NOM_SHINY_PLASTIC);
anAis = new CafShapePrs (aRefLabel, theParentStyle, Graphic3d_NameOfMaterial_ShinyPlastified);
theMapOfShapes.Bind (aRefLabel, anAis);
}

View File

@@ -1532,7 +1532,7 @@ Handle(AIS_InteractiveObject) CGeometryDoc::drawSurface
Handle(AIS_Shape) aGraphicSurface =
new AIS_Shape(BRepBuilderAPI_MakeFace (theSurface, u1, u2, v1, v2, Precision::Confusion()));
myAISContext->SetMaterial(aGraphicSurface, Graphic3d_NOM_PLASTIC, toDisplay);
myAISContext->SetMaterial(aGraphicSurface, Graphic3d_NameOfMaterial_Plastified, toDisplay);
myAISContext->SetColor(aGraphicSurface, theColor, toDisplay);
if (toDisplay)
{

View File

@@ -76,7 +76,7 @@ public:
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NameOfMaterial_Brass,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)

View File

@@ -114,7 +114,7 @@ protected:
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NameOfMaterial_Brass,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)

View File

@@ -46,7 +46,7 @@ void CColoredShapes::Display(Handle(AIS_InteractiveContext)& anAIScontext)
{
Handle(AIS_Shape) ais = new AIS_Shape(iter.Value());
anAIScontext->SetColor(ais, (Quantity_NameOfColor)m_colorMap.Find(iter.Value()), Standard_False);
anAIScontext->SetMaterial(ais, Graphic3d_NOM_GOLD, Standard_False);
anAIScontext->SetMaterial(ais, Graphic3d_NameOfMaterial_Gold, Standard_False);
anAIScontext->Display(ais, Standard_False);
}
anAIScontext->UpdateCurrentViewer();

View File

@@ -25,7 +25,7 @@
#define DEFAULT_DCSMALL 0.0002
#define DEFAULT_DCVSMALL 0.00004
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_MATERIAL Graphic3d_NameOfMaterial_Plastered
#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW

View File

@@ -114,7 +114,7 @@ protected:
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NameOfMaterial_Brass,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)

View File

@@ -29,7 +29,7 @@
#define DEFAULT_DCSMALL 0.0002
#define DEFAULT_DCVSMALL 0.00004
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_MATERIAL Graphic3d_NameOfMaterial_Plastered
#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW

View File

@@ -12,7 +12,7 @@
#include "Fonc.hxx"
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_MATERIAL Graphic3d_NameOfMaterial_Plastered
#define DEFAULT_DEVIATIONCOEFFICIENT 0.001
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW
@@ -123,23 +123,23 @@ CAnimationDoc::CAnimationDoc()
myAisCylinderHead = new AIS_Shape (CylinderHead);
myAISContext->SetColor (myAisCylinderHead, Quantity_NOC_WHITE, Standard_False);
myAISContext->SetMaterial (myAisCylinderHead, Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->SetMaterial (myAisCylinderHead, Graphic3d_NameOfMaterial_Plastified, Standard_False);
myAisEngineBlock = new AIS_Shape (EngineBlock);
myAISContext->SetColor(myAisEngineBlock, Quantity_NOC_WHITE, Standard_False);
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NameOfMaterial_Plastified, Standard_False);
myAISContext->Display(myAisCylinderHead ,1,-1,Standard_False);
myAISContext->Display(myAisEngineBlock ,1,-1,Standard_False);
myAisCrankArm = new AIS_Shape (CrankArm);
myAISContext->SetColor (myAisCrankArm, Quantity_NOC_HOTPINK, Standard_False);
myAISContext->SetMaterial(myAisCrankArm, Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->SetMaterial(myAisCrankArm, Graphic3d_NameOfMaterial_Plastified, Standard_False);
myAisPiston = new AIS_Shape (Piston);
myAISContext->SetColor (myAisPiston , Quantity_NOC_WHITE, Standard_False);
myAISContext->SetMaterial(myAisPiston , Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->SetMaterial(myAisPiston , Graphic3d_NameOfMaterial_Plastified, Standard_False);
myAisPropeller = new AIS_Shape (Propeller);
myAISContext->SetColor (myAisPropeller, Quantity_NOC_RED, Standard_False);
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NameOfMaterial_Plastified, Standard_False);
myAISContext->Display(myAisCrankArm, 1,-1,Standard_False);
myAISContext->Display(myAisPropeller, 1,-1,Standard_False);
@@ -316,7 +316,7 @@ void CAnimationDoc::OnFileLoadgrid()
myAISContext->Display(myAISSurface, Standard_False);
myAISContext->Deactivate(myAISSurface,Standard_False);
myAISContext->SetColor (myAISSurface,Quantity_NOC_WHITE,Standard_False);
myAISContext->SetMaterial (myAISSurface,Graphic3d_NOM_STONE,Standard_False);
myAISContext->SetMaterial (myAISSurface,Graphic3d_NameOfMaterial_Stone,Standard_False);
myAISContext->SetDisplayMode (myAISSurface,1,Standard_False);
myAISContext->SetDeviationCoefficient (0.001);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;

View File

@@ -39,7 +39,7 @@ enum CurrentAction3d {
#define DEFAULT_DCSMALL 0.0002
#define DEFAULT_DCVSMALL 0.00004
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_MATERIAL Graphic3d_NameOfMaterial_Plastered
#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW

View File

@@ -113,7 +113,7 @@ protected:
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NameOfMaterial_Brass,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)

View File

@@ -2,14 +2,15 @@ TEMPLATE = app
CONFIG += debug_and_release qt
CONFIG += lrelease
CONFIG += embed_translations
QT += widgets
QT += xml
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
}
TARGET = OCCTOverview
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
FREEIMAGE_DIR = $$quote($$(FREEIMAGE_DIR))
TBB_DIR = $$quote($$(TBB_DIR))
HEADERS = ./src/*.h \
$${SAMPLESROOT}/../OCCTOverview/code/*.h

View File

@@ -5,8 +5,8 @@ if exist "%~dp0custom.bat" (
)
call "%CASROOT%\env.bat" %1 %2 %3
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
@@ -27,3 +27,5 @@ if not "%QTDIR%" == "" (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
)
set "CSF_OCCTOverviewSampleCodePath=%~dp0..\..\OCCTOverview\code"

View File

@@ -28,9 +28,6 @@
#include <QFont>
#include <QFrame>
#include <QGroupBox>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMap>
#include <QMdiArea>
#include <QMdiSubWindow>
@@ -43,6 +40,8 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QWidget>
#include <QDomDocument>
#include <QDomAttr>
#include <Standard_WarningsRestore.hxx>
#include <OpenGl_GraphicDriver.hxx>
@@ -53,13 +52,21 @@
ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
: QMainWindow (nullptr),
myAppType(theCategory),
myStdToolBar (nullptr),
myViewBar (nullptr),
myCasCadeBar (nullptr),
myFilePopup (nullptr),
myCategoryPopup (nullptr)
{
myAppType = theCategory;
ALL_CATEGORIES[AppType_Geometry] = "Geometry";
ALL_CATEGORIES[AppType_Topology] = "Topology";
ALL_CATEGORIES[AppType_Triangulation] = "Triangulation";
ALL_CATEGORIES[AppType_DataExchange] = "DataExchange";
ALL_CATEGORIES[AppType_Ocaf] = "OCAF";
ALL_CATEGORIES[AppType_Viewer3d] = "3D viewer";
ALL_CATEGORIES[AppType_Viewer2d] = "2D Viewer";
mySampleMapper = new QSignalMapper(this);
myExchangeMapper = new QSignalMapper(this);
myOcafMapper = new QSignalMapper(this);
@@ -68,19 +75,13 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
myCategoryMapper = new QSignalMapper(this);
connect(mySampleMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onProcessSample);
connect(myExchangeMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onProcessExchange);
connect(myOcafMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onProcessOcaf);
connect(myViewer3dMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onProcessViewer3d);
connect(myViewer2dMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onProcessViewer2d);
connect(mySampleMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessSample(const QString &)));
connect(myExchangeMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessExchange(const QString &)));
connect(myOcafMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessOcaf(const QString &)));
connect(myViewer3dMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessViewer3d(const QString &)));
connect(myViewer2dMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessViewer2d(const QString &)));
connect(myCategoryMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &ApplicationCommonWindow::onChangeCategory);
connect(myCategoryMapper, SIGNAL(mapped(const QString &)), this, SLOT(onChangeCategory(const QString &)));
setFocusPolicy(Qt::StrongFocus);
@@ -121,20 +122,25 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
aViewFrame->setLineWidth(3);
QVBoxLayout* aViewLayout = new QVBoxLayout(aViewFrame);
aViewLayout->setContentsMargins(0, 0, 0, 0);
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, this);
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, aViewFrame);
aViewLayout->addWidget(myGeomWidget);
//myGeomWidget->setContentsMargins(0, 0, 0, 0);
myGeomWidget->setContentsMargins(0, 0, 0, 0);
QSplitter* aGeomTextSplitter = new QSplitter(Qt::Horizontal);
aGeomTextSplitter->addWidget(aViewFrame);
aGeomTextSplitter->addWidget(aCodeResultSplitter);
aGeomTextSplitter->setStretchFactor(0, 1);
aGeomTextSplitter->setStretchFactor(1, 1);
QList<int> aSizeList{ 640, 640 };
QList<int> aSizeList;
aSizeList.append(640);
aSizeList.append(640);
aGeomTextSplitter->setSizes(aSizeList);
setCentralWidget(aGeomTextSplitter);
#include <Standard_WarningsDisable.hxx>
Q_INIT_RESOURCE(Samples);
#include <Standard_WarningsRestore.hxx>
TCollection_AsciiString aSampleSourcePach = getSampleSourceDir();
myGeometrySamples = new GeometrySamples(aSampleSourcePach,
@@ -157,13 +163,14 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
myDocument2d->getViewer(),
myDocument2d->getContext());
MenuFormJson(":/menus/Geometry.json", mySampleMapper, myGeometryMenus);
MenuFormJson(":/menus/Topology.json", mySampleMapper, myTopologyMenus);
MenuFormJson(":/menus/Triangulation.json", mySampleMapper, myTriangulationMenus);
MenuFormJson(":/menus/DataExchange.json", myExchangeMapper, myDataExchangeMenus);
MenuFormJson(":/menus/Ocaf.json", myOcafMapper, myOcafMenus);
MenuFormJson(":/menus/Viewer3d.json", myViewer3dMapper, myViewer3dMenus);
MenuFormJson(":/menus/Viewer2d.json", myViewer2dMapper, myViewer2dMenus);
MenuFormXml(":/menus/Geometry.xml", mySampleMapper, myGeometryMenus);
MenuFormXml(":/menus/Topology.xml", mySampleMapper, myTopologyMenus);
MenuFormXml(":/menus/Triangulation.xml", mySampleMapper, myTriangulationMenus);
MenuFormXml(":/menus/DataExchange.xml", myExchangeMapper, myDataExchangeMenus);
MenuFormXml(":/menus/Ocaf.xml", myOcafMapper, myOcafMenus);
MenuFormXml(":/menus/Viewer3d.xml", myViewer3dMapper, myViewer3dMenus);
MenuFormXml(":/menus/Viewer2d.xml", myViewer2dMapper, myViewer2dMenus);
onChangeCategory(ALL_CATEGORIES[myAppType]);
@@ -174,29 +181,31 @@ void ApplicationCommonWindow::RebuildMenu()
{
menuBar()->clear();
myStdActions[FileQuit] = CreateAction(&ApplicationCommonWindow::onCloseAllWindows, "Quit", "CTRL+Q");
myStdActions[HelpAbout] = CreateAction(&ApplicationCommonWindow::onAbout, "About", "F1", ":/icons/help.png");
myStdActions[StdActions_FileQuit] = CreateAction("Quit", "CTRL+Q");
connect(myStdActions[StdActions_FileQuit], SIGNAL(triggered()), this, SLOT(onCloseAllWindows()));
myStdActions[StdActions_HelpAbout] = CreateAction("About", "F1", ":/icons/help.png");
connect(myStdActions[StdActions_HelpAbout], SIGNAL(triggered()), this, SLOT(onAbout()));
// populate a menu with all actions
myFilePopup = new QMenu(this);
myFilePopup = menuBar()->addMenu(tr("&File"));
myFilePopup->addAction(myStdActions[FileQuit]);
myFilePopup->addAction(myStdActions[StdActions_FileQuit]);
myCategoryPopup = new QMenu(this);
myCategoryPopup = menuBar()->addMenu(tr("&Category"));
for (ApplicationType aCategory: ALL_CATEGORIES.keys())
foreach (ApplicationType aCategory, ALL_CATEGORIES.keys())
{
QString aCategoryName = ALL_CATEGORIES.value(aCategory);
QAction* anAction = myCategoryPopup->addAction(aCategoryName);
anAction->setText(aCategoryName);
myCategoryMapper->setMapping(anAction, aCategoryName);
connect(anAction, &QAction::triggered, myCategoryMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(anAction, SIGNAL(triggered()), myCategoryMapper, SLOT(map()));
myCategoryPopup->addAction(anAction);
myCategoryActions.insert(aCategory, anAction);
}
for (QMenu* aSampleMenu : GetCurrentMenus())
foreach (QMenu* aSampleMenu, GetCurrentMenus())
{
menuBar()->addMenu(aSampleMenu);
}
@@ -205,21 +214,21 @@ void ApplicationCommonWindow::RebuildMenu()
QMenu* aHelp = new QMenu(this);
menuBar()->addSeparator();
aHelp = menuBar()->addMenu(tr("&Help"));
aHelp->addAction(myStdActions[HelpAbout]);
aHelp->addAction(myStdActions[StdActions_HelpAbout]);
}
Handle(BaseSample) ApplicationCommonWindow::GetCurrentSamples()
{
switch (myAppType)
{
case Geometry: return myGeometrySamples;
case Topology: return myTopologySamples;
case Triangulation: return myTriangulationSamples;
case DataExchange: return myDataExchangeSamples;
case Ocaf: return myOcafSamples;
case Viewer2d: return myViewer2dSamples;
case Viewer3d: return myViewer3dSamples;
case Unknown:
case AppType_Geometry: return myGeometrySamples;
case AppType_Topology: return myTopologySamples;
case AppType_Triangulation: return myTriangulationSamples;
case AppType_DataExchange: return myDataExchangeSamples;
case AppType_Ocaf: return myOcafSamples;
case AppType_Viewer2d: return myViewer2dSamples;
case AppType_Viewer3d: return myViewer3dSamples;
case AppType_Unknown:
break;
}
throw QString("Unknown Application type");
@@ -229,14 +238,14 @@ const QList<QMenu*>& ApplicationCommonWindow::GetCurrentMenus()
{
switch (myAppType)
{
case Geometry: return myGeometryMenus;
case Topology: return myTopologyMenus;
case Triangulation: return myTriangulationMenus;
case DataExchange: return myDataExchangeMenus;
case Ocaf: return myOcafMenus;
case Viewer2d: return myViewer2dMenus;
case Viewer3d: return myViewer3dMenus;
case Unknown:
case AppType_Geometry: return myGeometryMenus;
case AppType_Topology: return myTopologyMenus;
case AppType_Triangulation: return myTriangulationMenus;
case AppType_DataExchange: return myDataExchangeMenus;
case AppType_Ocaf: return myOcafMenus;
case AppType_Viewer2d: return myViewer2dMenus;
case AppType_Viewer3d: return myViewer3dMenus;
case AppType_Unknown:
break;
}
throw QString("Unknown Application type");
@@ -270,35 +279,35 @@ void ApplicationCommonWindow::onChangeCategory(const QString& theCategory)
switch (myAppType)
{
case DataExchange:
case AppType_DataExchange:
{
myDataExchangeSamples->AppendBottle();
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
myGeomWidget->Show3d();
break;
}
case Ocaf:
case AppType_Ocaf:
{
onProcessOcaf("CreateOcafDocument");
myGeomWidget->Show3d();
break;
}
case Viewer2d:
case AppType_Viewer2d:
{
myGeomWidget->Show2d();
break;
}
case Viewer3d:
case AppType_Viewer3d:
{
myViewer3dSamples->AppendBottle();
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
myGeomWidget->Show3d();
break;
}
case Geometry:
case Topology:
case Triangulation:
case Unknown:
case AppType_Geometry:
case AppType_Topology:
case AppType_Triangulation:
case AppType_Unknown:
{
break;
}
@@ -326,9 +335,7 @@ TCollection_AsciiString ApplicationCommonWindow::getSampleSourceDir()
return aSampleSourceDir;
}
template <typename PointerToMemberFunction>
QAction* ApplicationCommonWindow::CreateAction (PointerToMemberFunction theHandlerMethod,
const QString& theActionName,
QAction* ApplicationCommonWindow::CreateAction (const QString& theActionName,
const QString& theShortcut,
const QString& theIconName)
{
@@ -345,7 +352,7 @@ QAction* ApplicationCommonWindow::CreateAction (PointerToMemberFunction theHandl
aAction->setToolTip(theActionName);
aAction->setStatusTip(theActionName);
aAction->setShortcut(theShortcut);
connect(aAction, &QAction::triggered, this, theHandlerMethod);
return aAction;
}
@@ -353,9 +360,9 @@ template <typename PointerToMemberFunction>
QAction* ApplicationCommonWindow::CreateSample (PointerToMemberFunction theHandlerMethod,
const char* theActionName)
{
QAction* aAction = new QAction(QObject::tr(theActionName), this);
connect(aAction, &QAction::triggered, this, theHandlerMethod);
return aAction;
QAction* anAction = new QAction(QObject::tr(theActionName), this);
connect(anAction, SIGNAL(triggered()), this, SLOT(theHandlerMethod()));
return anAction;
}
void ApplicationCommonWindow::resizeEvent(QResizeEvent* e)
@@ -608,78 +615,78 @@ TranslateDialog* ApplicationCommonWindow::getOcafDialog(const QString& theSample
return aTranslateDialog;
}
QMenu* ApplicationCommonWindow::MenuFromJsonObject (const QJsonValue& theJsonValue,
const QString& theKey,
QWidget* theParent,
QSignalMapper* theMapper)
QMenu* ApplicationCommonWindow::MenuFromDomNode(QDomElement& theItemElement,
QWidget* theParent,
QSignalMapper* theMapper)
{
QMenu* aMenu = new QMenu(theKey, theParent);
if (theJsonValue.isObject())
{
QJsonObject aBranchObject = theJsonValue.toObject();
for (const QString& aBranchKey : aBranchObject.keys())
{
aMenu->addMenu(MenuFromJsonObject(aBranchObject.value(aBranchKey), aBranchKey, aMenu, theMapper));
}
}
else if (theJsonValue.isArray())
{
QJsonArray aDataArray = theJsonValue.toArray();
for (const QJsonValue& aDataValue : aDataArray)
{
if (aDataValue.isObject())
{
QJsonObject aDataObject = aDataValue.toObject();
QString aSampleName = aDataObject["function"].toString();
QAction* anAction = aMenu->addAction(aSampleName);
anAction->setText(aDataObject["text"].toString());
QString anItemName = theItemElement.attribute("name");
QMenu* aMenu = new QMenu(anItemName, theParent);
QDomElement anChildItemElement = theItemElement.firstChildElement("MenuItem");
QDomElement anSampleElement = theItemElement.firstChildElement("Sample");
theMapper->setMapping(anAction, aSampleName);
connect(anAction, &QAction::triggered, theMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
}
}
while(anChildItemElement.isElement())
{
aMenu->addMenu(MenuFromDomNode(anChildItemElement, aMenu, theMapper));
anChildItemElement = anChildItemElement.nextSibling().toElement();
}
while(anSampleElement.isElement())
{
QString aSampleName = anSampleElement.attribute("name");
QString aSampleFunction = anSampleElement.attribute("function");
QAction* anAction = aMenu->addAction(aSampleFunction);
anAction->setText(aSampleName);
theMapper->setMapping(anAction, aSampleFunction);
connect(anAction, SIGNAL(triggered()), theMapper, SLOT(map()));
anSampleElement = anSampleElement.nextSibling().toElement();
}
return aMenu;
}
void ApplicationCommonWindow::MenuFormJson (const QString& thePath,
QSignalMapper* theMapper,
QList<QMenu*>& theMunusList)
void ApplicationCommonWindow::MenuFormXml(const QString& thePath,
QSignalMapper* theMapper,
QList<QMenu*>& theMunusList)
{
QDomDocument aDomDocument;
theMunusList.clear();
QFile aJsonFile(thePath);
QFile aXmlFile(thePath);
QString anErrorMessage;
if (aJsonFile.error() != QFile::NoError)
if (aXmlFile.error() != QFile::NoError)
{
anErrorMessage = aJsonFile.errorString();
anErrorMessage = aXmlFile.errorString();
Message::SendFail() << "QFile creating error: " << anErrorMessage.toUtf8().constData();
aXmlFile.close();
return;
}
if (!aJsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
if (!aXmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
Message::SendFail() << "File " << thePath.toUtf8().constData() << " could not open";
if (aJsonFile.error() != QFile::NoError)
if (aXmlFile.error() != QFile::NoError)
{
anErrorMessage = aJsonFile.errorString();
anErrorMessage = aXmlFile.errorString();
Message::SendFail() << "QFile opening error: " << anErrorMessage.toUtf8().constData();
}
aXmlFile.close();
return;
}
QString aJsonString = aJsonFile.readAll();
aJsonFile.close();
QJsonDocument aJsonDoc = QJsonDocument::fromJson(aJsonString.toUtf8());
if (aJsonDoc.isObject())
bool aNamespaceProcessing(false);
QString anErrorMsg;
int anErrorLine(0);
int anErrorColumn(0);
if (!aDomDocument.setContent(&aXmlFile, aNamespaceProcessing, &anErrorMsg, &anErrorLine, &anErrorColumn))
{
QJsonObject aJsonObj = aJsonDoc.object();
for (const QString& aKey : aJsonObj.keys())
{
QJsonValue aJsonValue = aJsonObj.value(aKey);
if (aJsonValue.isObject())
{
theMunusList.push_back(MenuFromJsonObject(aJsonValue.toObject(), aKey, this, theMapper));
}
}
Message::SendFail() << "XML file parsing error: " << anErrorMsg.toStdString()
<< " at line: " << anErrorLine << " column: " << anErrorColumn;
aXmlFile.close();
return;
}
aXmlFile.close();
QDomElement aRootElement = aDomDocument.documentElement();
QDomElement anItemElement = aRootElement.firstChildElement("MenuItem");
while(!anItemElement.isNull())
{
theMunusList.push_back(MenuFromDomNode(anItemElement, this, theMapper));
anItemElement = anItemElement.nextSiblingElement("MenuItem");
}
}

View File

@@ -40,6 +40,7 @@
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QAction>
#include <QDomNode>
#include <QList>
#include <QMainWindow>
#include <QMdiArea>
@@ -52,39 +53,25 @@
enum StdActions
{
FileNew, FilePrefUseVBO, FileClose, FilePreferences, FileQuit, ViewTool, ViewStatus, HelpAbout
};
enum ToolActions
{
ToolWireframe, ToolShading, ToolColor, ToolMaterial, ToolTransparency, ToolDelete
StdActions_FileQuit,
StdActions_HelpAbout
};
enum ApplicationType
{
Geometry,
Topology,
Triangulation,
DataExchange,
Ocaf,
Viewer2d,
Viewer3d,
Unknown
AppType_Geometry,
AppType_Topology,
AppType_Triangulation,
AppType_DataExchange,
AppType_Ocaf,
AppType_Viewer2d,
AppType_Viewer3d,
AppType_Unknown
};
const QMap<ApplicationType, QString> ALL_CATEGORIES =
{
{ ApplicationType::Geometry,"Geometry"},
{ ApplicationType::Topology, "Topology"},
{ ApplicationType::Triangulation, "Triangulation"},
{ ApplicationType::DataExchange, "DataExchange"},
{ ApplicationType::Ocaf, "OCAF"},
{ ApplicationType::Viewer3d, "3D viewer"},
{ ApplicationType::Viewer2d, "2D Viewer"}
};
//! Main application window
class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
class ApplicationCommonWindow: public QMainWindow
{
Q_OBJECT
@@ -104,9 +91,7 @@ public slots:
virtual void onChangeCategory(const QString& theCategory);
protected:
template <typename PointerToMemberFunction>
QAction* CreateAction(PointerToMemberFunction theHandlerMethod,
const QString& theActionName,
QAction* CreateAction(const QString& theActionName,
const QString& theShortcut = "",
const QString& theIconName = "");
@@ -118,13 +103,13 @@ protected:
QMenu* getFilePopup() { return myFilePopup; }
QToolBar* getCasCadeBar() { return myCasCadeBar; }
QMenu* MenuFromJsonObject (const QJsonValue& theJsonValue,
const QString& theKey,
QWidget* theParent,
QSignalMapper* theMapper);
void MenuFormJson (const QString& thePath,
void MenuFormXml (const QString& thePath,
QSignalMapper* theMapper,
QList<QMenu*>& theMunusList);
QMenu* MenuFromDomNode(QDomElement& theItemElement,
QWidget* theParent,
QSignalMapper* theMapper);
private slots:
void onCloseAllWindows() { qApp->closeAllWindows(); }
@@ -147,6 +132,7 @@ private:
private:
ApplicationType myAppType;
QMap<ApplicationType, QString> ALL_CATEGORIES;
Handle(GeometrySamples) myGeometrySamples;
Handle(TopologySamples) myTopologySamples;
@@ -158,7 +144,6 @@ private:
QMap<StdActions, QAction*> myStdActions;
QMap<ApplicationType, QAction*> myCategoryActions;
QMap<ToolActions, QAction*> myToolActions;
QMap<Graphic3d_NameOfMaterial, QAction*> myMaterialActions;
QToolBar* myStdToolBar;
@@ -167,7 +152,6 @@ private:
QMenu* myFilePopup;
QMenu* myCategoryPopup;
// QList<QMenu*> mySamplePopups;
QList<QMenu*> myGeometryMenus;
QList<QMenu*> myTopologyMenus;
QList<QMenu*> myTriangulationMenus;

View File

@@ -87,8 +87,11 @@ void DocumentCommon::SetObjects (const NCollection_Vector<Handle(AIS_Interactive
{
myContext->RemoveAll(Standard_False);
myContextIsEmpty = theObjects.IsEmpty();
for (const Handle(AIS_InteractiveObject) anObject : theObjects)
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(theObjects);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
if (!theDisplayShaded)
{
myContext->Display(anObject, Standard_False);

View File

@@ -35,7 +35,7 @@
class ApplicationCommonWindow;
//! Implements visualization of samples content
class COMMONSAMPLE_EXPORT DocumentCommon : public QObject
class DocumentCommon : public QObject
{
Q_OBJECT
public:

View File

@@ -44,7 +44,7 @@ GeomWidget::GeomWidget (DocumentCommon* theDocument3d,
QVBoxLayout* a2dLayout = new QVBoxLayout(my2dVidget);
a2dLayout->setContentsMargins(0, 0, 0, 0);
a2dLayout->setSpacing(0);
myView2d = new View(myDocument2d->getContext(), false, this);
myView2d = new View(myDocument2d->getContext(), false, my2dVidget);
QToolBar* aToolBar2d = new QToolBar;
aToolBar2d->addActions(myView2d->getViewActions());
a2dLayout->addWidget(aToolBar2d);
@@ -54,7 +54,7 @@ GeomWidget::GeomWidget (DocumentCommon* theDocument3d,
QVBoxLayout* a3dLayout = new QVBoxLayout(my3dVidget);
a3dLayout->setContentsMargins(0, 0, 0, 0);
a3dLayout->setSpacing(0);
myView3d = new View(myDocument3d->getContext(), true, this);
myView3d = new View(myDocument3d->getContext(), true, my3dVidget);
QToolBar* aToolBar3d = new QToolBar;
aToolBar3d->addActions(myView3d->getViewActions());
aToolBar3d->addSeparator();
@@ -82,10 +82,10 @@ void GeomWidget::Show3d()
{
myView3d->axo();
myView3d->fitAll();
QAction* aShadingAction = myView3d->getViewAction(ViewAction::Shading);
QAction* aShadingAction = myView3d->getViewAction(ViewAction_Shading);
aShadingAction->trigger();
aShadingAction->setChecked(true);
QAction* aHlrOffAction = myView3d->getViewAction(ViewAction::HlrOff);
QAction* aHlrOffAction = myView3d->getViewAction(ViewAction_HlrOff);
aHlrOffAction->trigger();
aHlrOffAction->setChecked(true);
myStackWidget->setCurrentWidget(my3dVidget);

View File

@@ -25,7 +25,6 @@
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QCommandLineParser>
#include <QLocale>
#include <QSettings>
#include <QStringList>
@@ -34,10 +33,12 @@
int main ( int argc, char* argv[] )
{
Q_INIT_RESOURCE(OCCTOverview);
QApplication aQApp( argc, argv );
#include <Standard_WarningsDisable.hxx>
Q_INIT_RESOURCE(OCCTOverview);
#include <Standard_WarningsRestore.hxx>
QSettings settings("OCCTOverview.conf", QSettings::IniFormat);
settings.beginGroup("ApplicationSetting");
ApplicationType aCategory = static_cast<ApplicationType>(settings.value("ApplicationType", "").toInt());

View File

@@ -23,152 +23,121 @@
#include <Standard_WarningsDisable.hxx>
#include <QFont>
#include <QStringList>
#include <Standard_WarningsRestore.hxx>
static const QString anOcctPatterns[] =
{
QStringLiteral("gp_Pnt"), QStringLiteral("gp_XYZ"), QStringLiteral("gp_Vec"),
QStringLiteral("gp_Dir"), QStringLiteral("gp_Ax1"), QStringLiteral("gp_Ax2"),
QStringLiteral("gp_Ax3"), QStringLiteral("gp_Lin"), QStringLiteral("gp_Circ"),
QStringLiteral("gp_Elips"), QStringLiteral("gp_Parab"), QStringLiteral("gp_Hypr"),
QStringLiteral("gp_Cylinder"), QStringLiteral("gp_Cone"), QStringLiteral("gp_Sphere"),
QStringLiteral("gp_Torus"), QStringLiteral("gp_Pnt2d"), QStringLiteral("gp_XY"),
QStringLiteral("gp_Ax2d"), QStringLiteral("gp_Ax22d"), QStringLiteral("gp_Lin2d"),
QStringLiteral("gp_Circ2d."), QStringLiteral("gp_Elips2d"), QStringLiteral("gp_Parab2d"),
QStringLiteral("gp_Hypr2d"), QStringLiteral("Geom2d_BSplineCurve"), QStringLiteral("Geom2d_BezierCurve"),
QStringLiteral("Geom2d_OffsetCurve"), QStringLiteral("ProjLib"), QStringLiteral("ElSLib"),
QStringLiteral("Extrema_ExtElCS"), QStringLiteral("Extrema_POnCurv"), QStringLiteral("IntAna_Quadric"),
QStringLiteral("IntAna_IntConicQuad"), QStringLiteral("GccAna_Lin2d2Tan"), QStringLiteral("GccEnt_QualifiedCirc"),
QStringLiteral("Geom2dAPI_ProjectPointOnCurve"), QStringLiteral("Geom2dAPI_ExtremaCurveCurve"),
QStringLiteral("Geom2dAPI_InterCurveCurve"), QStringLiteral("Geom2dAPI_PointsToBSpline"),
QStringLiteral("Geom_CartesianPoint"), QStringLiteral("Geom_VectorWithMagnitude"), QStringLiteral("Geom_Axis1Placement"),
QStringLiteral("Geom_Axis2Placement"), QStringLiteral("Geom_Line"), QStringLiteral("Geom_Circle"),
QStringLiteral("Geom_Ellipse"), QStringLiteral("Geom_Parabola"), QStringLiteral("Geom_Hyperbola"),
QStringLiteral("Geom_BSplineCurve"), QStringLiteral("Geom_BezierCurve"), QStringLiteral("Geom_TrimmedCurve"),
QStringLiteral("Geom_OffsetCurve"), QStringLiteral("Geom_BSplineSurface"), QStringLiteral("Geom_BezierSurface"),
QStringLiteral("Geom_Plane"), QStringLiteral("Geom_CylindricalSurface"), QStringLiteral("Geom_ConicalSurface"),
QStringLiteral("Geom_SphericalSurface"), QStringLiteral("Geom_ToroidalSurface"), QStringLiteral("Geom_RectangularTrimmedSurface"),
QStringLiteral("Geom_OffsetSurface"), QStringLiteral("Geom_SurfaceOfLinearExtrusion"), QStringLiteral("Geom_SurfaceOfRevolution"),
QStringLiteral("BndLib_Add3dCurve"), QStringLiteral("BndLib_AddSurface"), QStringLiteral("GeomAdaptor_Curve"),
QStringLiteral("GeomAdaptor_Surface"), QStringLiteral("GeomAPI_PointsToBSpline"), QStringLiteral("GeomAPI_PointsToBSplineSurface"),
QStringLiteral("GeomConvert"), QStringLiteral("Geom2d_CartesianPoint"), QStringLiteral("Geom2d_VectorWithMagnitude"),
QStringLiteral("Geom2d_Line"), QStringLiteral("Geom2d_Circle"), QStringLiteral("Geom2d_Ellipse"),
QStringLiteral("Geom2d_Parabola"), QStringLiteral("Geom2d_Hyperbola"), QStringLiteral("Geom2d_TrimmedCurve"),
QStringLiteral("Geom2dAdaptor_Curve"), QStringLiteral("Bnd_Box2d"), QStringLiteral("BndLib_Add2dCurve"),
QStringLiteral("Adaptor2d_Curve2d"), QStringLiteral("BRepBuilderAPI_MakeEdge"), QStringLiteral("BRepBuilderAPI_MakeFace"),
QStringLiteral("BRepPrimAPI_MakeBox"), QStringLiteral("AIS_Point"), QStringLiteral("AIS_TextLabel"), QStringLiteral("AIS_Axis"),
QStringLiteral("AIS_Circle"), QStringLiteral("AIS_Plane"), QStringLiteral("AIS_Shape"), QStringLiteral("AIS_ColoredShape"),
QStringLiteral("GProp_PEquation"), QStringLiteral("Extrema_ExtCS"), QStringLiteral("GCPnts_QuasiUniformDeflection"),
QStringLiteral("GProp_GProps"), QStringLiteral("GProp_PrincipalProps"), QStringLiteral("TopoDS"),
QStringLiteral("TopoDS_Iterator"), QStringLiteral("TopoDS_Compound"), QStringLiteral("TopoDS_Edge"), QStringLiteral("TopoDS_Face"),
QStringLiteral("TopoDS_Shell"), QStringLiteral("TopoDS_Solid"), QStringLiteral("TopoDS_Vertex"),
QStringLiteral("TopoDS_Wire"), QStringLiteral("TopExp"), QStringLiteral("TopExp_Explorer"),
QStringLiteral("TColgp_Array2OfPnt"), QStringLiteral("BRep_Builder"), QStringLiteral("BRepGProp"), QStringLiteral("BRep_Tool"),
QStringLiteral("BRepTools"), QStringLiteral("BRepTools_ReShape"), QStringLiteral("BRepAdaptor_Curve"),
QStringLiteral("BRepAdaptor_CompCurve"), QStringLiteral("BRepAdaptor_Surface"), QStringLiteral("BRepAlgoAPI_Common"),
QStringLiteral("BRepAlgoAPI_Cut"), QStringLiteral("BRepAlgoAPI_Fuse"), QStringLiteral("BRepAlgoAPI_Section"),
QStringLiteral("BRepAlgoAPI_Splitter"), QStringLiteral("BRepAlgoAPI_Defeaturing"), QStringLiteral("BRepBuilderAPI_Copy"),
QStringLiteral("BRepBuilderAPI_MakeVertex"), QStringLiteral("BRepBuilderAPI_MakeEdge"), QStringLiteral("BRepBuilderAPI_MakeFace"),
QStringLiteral("BRepBuilderAPI_MakePolygon"), QStringLiteral("BRepBuilderAPI_MakeShell"), QStringLiteral("BRepBuilderAPI_MakeSolid"),
QStringLiteral("BRepBuilderAPI_MakeWire"), QStringLiteral("BRepBuilderAPI_NurbsConvert"), QStringLiteral("BRepBuilderAPI_Sewing"),
QStringLiteral("BRepBuilderAPI_Transform"), QStringLiteral("BRepCheck_Analyzer"), QStringLiteral("BRepPrimAPI_MakeBox"),
QStringLiteral("BRepPrimAPI_MakeCylinder"), QStringLiteral("BRepPrimAPI_MakeRevol"), QStringLiteral("BRepFilletAPI_MakeChamfer"),
QStringLiteral("BRepFilletAPI_MakeFillet"), QStringLiteral("BRepOffsetAPI_MakeOffset"), QStringLiteral("BRepOffsetAPI_MakeEvolved.hxx"),
QStringLiteral("Standard_Integer"), QStringLiteral("Standard_Real"), QStringLiteral("Standard_Boolean"), QStringLiteral("Standard_ShortReal"),
QStringLiteral("Standard_Character"), QStringLiteral("Standard_Byte"), QStringLiteral("Standard_Address"), QStringLiteral("Standard_Size"),
QStringLiteral("Standard_Time"), QStringLiteral("Standard_Utf8Char"), QStringLiteral("Standard_Utf8UChar"),
QStringLiteral("Standard_ExtCharacter"), QStringLiteral("Standard_Utf16Char"), QStringLiteral("Standard_Utf32Char"),
QStringLiteral("Standard_WideChar"), QStringLiteral("Standard_CString"), QStringLiteral("Standard_ExtString"),
QStringLiteral("NCollection_Vector"), QStringLiteral("TCollection_AsciiString"), QStringLiteral("TCollection_BaseSequence"),
QStringLiteral("TCollection_BasicMap"), QStringLiteral("TCollection_BasicMapIterator"), QStringLiteral("TCollection_ExtendedString"),
QStringLiteral("TCollection_HAsciiString"), QStringLiteral("TCollection_HExtendedString"), QStringLiteral("TCollection_MapNode"),
QStringLiteral("TCollection_MapNodePtr"), QStringLiteral("TCollection_SeqNode"), QStringLiteral("TCollection_SeqNodePtr"),
QStringLiteral("TCollection_Side"), QStringLiteral("Standard_False"), QStringLiteral("Standard_True"),
QStringLiteral("TCollection"), QStringLiteral("NCollection"), QStringLiteral("gp_Trsf"), QStringLiteral("Handle"),
QStringLiteral("Aspect_TOL_DASH"), QStringLiteral("Aspect_TOM_O_STAR"), QStringLiteral("Aspect_TOL_SOLID"),
QStringLiteral("Aspect_TOM_O_STAR"), QStringLiteral("AIS_InteractiveObject"), QStringLiteral("AIS_ListOfInteractive"),
QStringLiteral("Aspect_GDM_Lines"), QStringLiteral("Aspect_GDM_Points"), QStringLiteral("Aspect_TOM_POINT"),
QStringLiteral("Aspect_TOM_RING1"), QStringLiteral("Aspect_TOM_O"),QStringLiteral("BinDrivers"),
QStringLiteral("DefineFormat"), QStringLiteral("Font_FA_Bold"), QStringLiteral("Font_FA_BoldItalic"),
QStringLiteral("Font_FA_Italic"), QStringLiteral("Font_FA_Regular"), QStringLiteral("DownCast"),
QStringLiteral("gp_Pln"), QStringLiteral("Graphic3d_AspectMarker3d"), QStringLiteral("Graphic3d_HTA_LEFT"),
QStringLiteral("Graphic3d_NameOfMaterial"), QStringLiteral("Graphic3d_NOM_BRONZE"), QStringLiteral("Graphic3d_NOM_PLASTIC"),
QStringLiteral("Graphic3d_VTA_BOTTOM"), QStringLiteral("OpenGl_GraphicDriver"), QStringLiteral("PCDM_RS_OK"),
QStringLiteral("PCDM_SS_OK"), QStringLiteral("PCDM_ReaderStatus"), QStringLiteral("PCDM_StoreStatus"),
QStringLiteral("Prs3d_Drawer"), QStringLiteral("TPrsStd_AISPresentation"), QStringLiteral("Quantity_Color"),
QStringLiteral("Quantity_NameOfColor"), QStringLiteral("Quantity_NOC_BLUE1"), QStringLiteral("Quantity_NOC_CADETBLUE"),
QStringLiteral("Quantity_NOC_GREEN"), QStringLiteral("Quantity_NOC_MAGENTA1"), QStringLiteral("Quantity_NOC_RED"),
QStringLiteral("Quantity_NOC_YELLOW"), QStringLiteral("Quantity_NOC_WHITE"), QStringLiteral("Quantity_NOC_MATRABLUE"),
QStringLiteral("Quantity_TOC_RGB"), QStringLiteral("Quantity_TOC_HLS"), QStringLiteral("Standard_GUID"),
QStringLiteral("TColStd_ListIteratorOfListOfTransient"), QStringLiteral("TColStd_ListOfTransient"), QStringLiteral("TDataStd_Integer"),
QStringLiteral("TDataStd_Name"), QStringLiteral("TDataStd_Real"), QStringLiteral("TFunction_Driver"),
QStringLiteral("TFunction_DriverTable"), QStringLiteral("TFunction_Function"), QStringLiteral("TFunction_Logbook"),
QStringLiteral("TDF_Label"), QStringLiteral("TDF_TagSource"), QStringLiteral("TNaming_NamedShape"),
QStringLiteral("TopAbs_EDGE"), QStringLiteral("TopAbs_FACE"), QStringLiteral("TopAbs_VERTEX"),
QStringLiteral("TPrsStd_AISPresentation"), QStringLiteral("TPrsStd_AISViewer"), QStringLiteral("V3d_AmbientLight"),
QStringLiteral("V3d_DirectionalLight"), QStringLiteral("V3d_PositionalLight"), QStringLiteral("V3d_SpotLight"),
QStringLiteral("XmlDrivers")
};
static const QString aHelperPatterns[] =
{
QStringLiteral("AdaptorCurve_AIS"), QStringLiteral("AdaptorVec_AIS"), QStringLiteral("AdaptorCurve2d_AIS"),
QStringLiteral("AdaptorPnt2d_AIS"), QStringLiteral("Sample2D_Image"), QStringLiteral("Sample2D_Markers"),
QStringLiteral("Sample2D_Face"), QStringLiteral("TOcafFunction_BoxDriver"), QStringLiteral("TOcafFunction_CylDriver"),
QStringLiteral("DisplayPresentation")
};
static const QString aKeywordPatterns[] =
{
QStringLiteral("\\balignas\\b"), QStringLiteral("\\balignof\\b"), QStringLiteral("\\band\\b"),
QStringLiteral("\\band_eq\\b"), QStringLiteral("\\basm\\b"), QStringLiteral("\\bauto\\b"),
QStringLiteral("\\bbitand\\b"), QStringLiteral("\\bbitor\\b"), QStringLiteral("\\bbool\\b"),
QStringLiteral("\\bbreak\\b"), QStringLiteral("\\bcase\\b"), QStringLiteral("\\bcatch\\b"),
QStringLiteral("\\bchar\\b"), QStringLiteral("\\bchar16_t\\b"), QStringLiteral("\\bchar32_t\\b"),
QStringLiteral("\\bclass\\b"), QStringLiteral("\\bcompl\\b"), QStringLiteral("\\bconst\\b"),
QStringLiteral("\\bconstexpr\\b"), QStringLiteral("\\bconst_cast\\b"), QStringLiteral("\\bcontinue\\b"),
QStringLiteral("\\bdecltype\\b"), QStringLiteral("\\bdefault\\b"), QStringLiteral("\\bdelete\\b"),
QStringLiteral("\\bdo\\b"), QStringLiteral("\\bdouble\\b"), QStringLiteral("\\bdynamic_cast\\b"),
QStringLiteral("\\belse\\b"), QStringLiteral("\\benum\\b"), QStringLiteral("\\bexplicit\\b"),
QStringLiteral("\\bexport\\b"), QStringLiteral("\\bextern\\b"), QStringLiteral("\\bfalse\\b"),
QStringLiteral("\\bfloat\\b"), QStringLiteral("\\bfor\\b"), QStringLiteral("\\bfriend\\b"),
QStringLiteral("\\bgoto\\b"), QStringLiteral("\\bif\\b"), QStringLiteral("\\binline\\b"),
QStringLiteral("\\bint\\b"), QStringLiteral("\\blong\\b"), QStringLiteral("\\bmutable\\b"),
QStringLiteral("\\bnamespace\\b"), QStringLiteral("\\bnew\\b"), QStringLiteral("\\bnoexcept\\b"),
QStringLiteral("\\bnot\\b"), QStringLiteral("\\bnot_eq\\b"), QStringLiteral("\\bnullptr\\b"),
QStringLiteral("\\boperator\\b"), QStringLiteral("\\bor\\b"), QStringLiteral("\\bor_eq\\b"),
QStringLiteral("\\bprivate\\b"), QStringLiteral("\\bprotected\\b"), QStringLiteral("\\bpublic\\b"),
QStringLiteral("\\bregister\\b"), QStringLiteral("\\breinterpret_cast\\b"), QStringLiteral("\\breturn\\b"),
QStringLiteral("\\bshort\\b"), QStringLiteral("\\bsigned\\b"), QStringLiteral("\\bsizeof\\b"),
QStringLiteral("\\bstatic\\b"), QStringLiteral("\\bstatic_assert\\b"), QStringLiteral("\\bstatic_cast\\b"),
QStringLiteral("\\bstruct\\b"),QStringLiteral("\\bswitch\\b"), QStringLiteral("\\btemplate\\b"),
QStringLiteral("\\bthis\\b"), QStringLiteral("\\bthread_local\\b"), QStringLiteral("\\bthrow\\b"),
QStringLiteral("\\btrue\\b"), QStringLiteral("\\btry\\b"), QStringLiteral("\\btypedef\\b"),
QStringLiteral("\\btypeid\\b"), QStringLiteral("\\btypename\\b"),QStringLiteral("\\bunion\\b"),
QStringLiteral("\\bunsigned\\b"), QStringLiteral("\\busing\\b"), QStringLiteral("\\bvirtual\\b"),
QStringLiteral("\\bvoid\\b"), QStringLiteral("\\bvolatile\\b"), QStringLiteral("\\bwchar_t\\b"),
QStringLiteral("\\bwhile\\b"), QStringLiteral("\\bxor\\b"), QStringLiteral("\\bxor_eq\\b"),
QStringLiteral("\\boverride\\b"), QStringLiteral("\\bfinal\\b")
};
OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
: QSyntaxHighlighter (theParent)
{
QStringList aKeywordPatterns;
aKeywordPatterns
<< "\\balignas\\b" << "\\balignof\\b" << "\\band\\b" << "\\band_eq\\b" << "\\basm\\b"
<< "\\bauto\\b" << "\\bbitand\\b" << "\\bbitor\\b" << "\\bbool\\b" << "\\bbreak\\b"
<< "\\bcase\\b" << "\\bcatch\\b" << "\\bchar\\b" << "\\bchar16_t\\b" << "\\bchar32_t\\b"
<< "\\bclass\\b" << "\\bcompl\\b" << "\\bconst\\b" << "\\bconstexpr\\b" << "\\bconst_cast\\b"
<< "\\bcontinue\\b" << "\\bdecltype\\b" << "\\bdefault\\b" << "\\bdelete\\b" << "\\bdo\\b"
<< "\\bdouble\\b" << "\\bdynamic_cast\\b" << "\\belse\\b" << "\\benum\\b" << "\\bexplicit\\b"
<< "\\bexport\\b" << "\\bextern\\b" << "\\bfalse\\b" << "\\bfloat\\b" << "\\bfor\\b"
<< "\\bfriend\\b" << "\\bgoto\\b" << "\\bif\\b" << "\\binline\\b" << "\\bint\\b" << "\\blong\\b"
<< "\\bmutable\\b" << "\\bnamespace\\b" << "\\bnew\\b" << "\\bnoexcept\\b" << "\\bnot\\b"
<< "\\bnot_eq\\b" << "\\bnullptr\\b" << "\\boperator\\b" << "\\bor\\b" << "\\bor_eq\\b"
<< "\\bprivate\\b" << "\\bprotected\\b" << "\\bpublic\\b" << "\\bregister\\b"
<< "\\breinterpret_cast\\b" << "\\breturn\\b" << "\\bshort\\b" << "\\bsigned\\b" << "\\bsizeof\\b"
<< "\\bstatic\\b" << "\\bstatic_assert\\b" << "\\bstatic_cast\\b" << "\\bstruct\\b"
<< "\\bswitch\\b" << "\\btemplate\\b" << "\\bthis\\b" << "\\bthread_local\\b" << "\\bthrow\\b"
<< "\\btrue\\b" << "\\btry\\b" << "\\btypedef\\b" << "\\btypeid\\b" << "\\btypename\\b"
<< "\\bunion\\b" << "\\bunsigned\\b" << "\\busing\\b" << "\\bvirtual\\b" << "\\bvoid\\b"
<< "\\bvolatile\\b" << "\\bwchar_t\\b" << "\\bwhile\\b" << "\\bxor\\b" << "\\bxor_eq\\b"
<< "\\boverride\\b" << "\\bfinal\\b";
QStringList anOcctPatterns;
anOcctPatterns
<< "gp_Pnt" << "gp_XYZ" << "gp_Vec" << "gp_Dir" << "gp_Ax1" << "gp_Ax2" << "gp_Ax3" << "gp_Lin"
<< "gp_Circ" << "gp_Elips" << "gp_Parab" << "gp_Hypr" << "gp_Cylinder" << "gp_Cone" << "gp_Sphere"
<< "gp_Torus" << "gp_Pnt2d" << "gp_XY" << "gp_Ax2d" << "gp_Ax22d" << "gp_Lin2d" << "gp_Circ2d"
<< "gp_Elips2d" << "gp_Parab2d" << "gp_Hypr2d" << "Geom2d_BSplineCurve" << "Geom2d_BezierCurve"
<< "Geom2d_OffsetCurve" << "ProjLib" << "ElSLib" << "IntAna_IntConicQuad" << "GccAna_Lin2d2Tan"
<< "GccEnt_QualifiedCirc" << "Geom2dAPI_ProjectPointOnCurve" << "Geom2dAPI_ExtremaCurveCurve"
<< "Geom2dAPI_InterCurveCurve" << "Geom2dAPI_PointsToBSpline" << "Geom_CartesianPoint"
<< "Geom_VectorWithMagnitude" << "Geom_Axis1Placement" << "Geom_Axis2Placement" << "Geom_Line"
<< "Geom_Circle" << "Geom_Ellipse" << "Geom_Parabola" << "Geom_Hyperbola" << "Geom_BSplineCurve"
<< "Geom_BezierCurve" << "Geom_TrimmedCurve" << "Geom_OffsetCurve" << "Geom_BSplineSurface"
<< "Geom_BezierSurface" << "Geom_Plane" << "Geom_CylindricalSurface" << "Geom_ConicalSurface"
<< "Geom_SphericalSurface" << "Geom_ToroidalSurface" << "Geom_RectangularTrimmedSurface"
<< "Geom_OffsetSurface" << "Geom_SurfaceOfLinearExtrusion" << "Geom_SurfaceOfRevolution"
<< "BndLib_Add3dCurve" << "BndLib_AddSurface" << "GeomAdaptor_Curve" << "GeomAdaptor_Surface"
<< "GeomAPI_PointsToBSpline" << "GeomAPI_PointsToBSplineSurface" << "GeomConvert"
<< "Geom2d_CartesianPoint" << "Geom2d_VectorWithMagnitude" << "Geom2d_Line" << "Geom2d_Circle"
<< "Geom2d_Ellipse" << "Geom2d_Parabola" << "Geom2d_Hyperbola" << "Geom2d_TrimmedCurve"
<< "Geom2dAdaptor_Curve" << "Bnd_Box2d" << "BndLib_Add2dCurve" << "Adaptor2d_Curve2d"
<< "BRepBuilderAPI_MakeEdge" << "BRepBuilderAPI_MakeFace" << "BRepPrimAPI_MakeBox" << "AIS_Point"
<< "AIS_TextLabel" << "AIS_Axis" << "AIS_Circle" << "AIS_Plane" << "AIS_Shape"
<< "AIS_ColoredShape" << "GProp_PEquation" << "Extrema_ExtCS" << "GCPnts_QuasiUniformDeflection"
<< "GProp_GProps" << "GProp_PrincipalProps" << "TopoDS" << "TopoDS_Iterator" << "TopoDS_Compound"
<< "TopoDS_Edge" << "TopoDS_Face" << "TopoDS_Shell" << "TopoDS_Solid" << "TopoDS_Vertex"
<< "TopoDS_Wire" << "TopExp" << "TopExp_Explorer" << "TColgp_Array2OfPnt" << "BRep_Builder"
<< "BRepGProp" << "BRep_Tool" << "BRepTools" << "BRepTools_ReShape" << "BRepAdaptor_Curve"
<< "BRepAdaptor_CompCurve" << "BRepAdaptor_Surface" << "BRepAlgoAPI_Common" << "BRepAlgoAPI_Cut"
<< "BRepAlgoAPI_Fuse" << "BRepAlgoAPI_Section" << "BRepAlgoAPI_Splitter" << "BRepAlgoAPI_Defeaturing"
<< "BRepBuilderAPI_Copy" << "BRepBuilderAPI_MakeVertex" << "BRepBuilderAPI_MakeEdge"
<< "BRepBuilderAPI_MakeFace" << "BRepBuilderAPI_MakePolygon" << "BRepBuilderAPI_MakeShell"
<< "BRepBuilderAPI_MakeSolid" << "BRepBuilderAPI_MakeWire" << "BRepBuilderAPI_NurbsConvert"
<< "BRepBuilderAPI_Sewing" << "BRepBuilderAPI_Transform" << "BRepCheck_Analyzer"
<< "BRepPrimAPI_MakeBox" << "BRepPrimAPI_MakeCylinder" << "BRepPrimAPI_MakeRevol"
<< "BRepFilletAPI_MakeChamfer" << "BRepFilletAPI_MakeFillet" << "BRepOffsetAPI_MakeOffset"
<< "BRepOffsetAPI_MakeEvolved.hxx" << "Standard_Integer" << "Standard_Real" << "Standard_Boolean"
<< "Standard_ShortReal" << "Standard_Character" << "Standard_Byte" << "Standard_Address"
<< "Standard_Size" << "Standard_Time" << "Standard_Utf8Char" << "Standard_Utf8UChar"
<< "Standard_ExtCharacter" << "Standard_Utf16Char" << "Standard_Utf32Char" << "Standard_WideChar"
<< "Standard_CString" << "Standard_ExtString" << "NCollection_Vector" << "TCollection_AsciiString"
<< "TCollection_BaseSequence"<< "TCollection_BasicMap" << "TCollection_BasicMapIterator"
<< "TCollection_ExtendedString" << "TCollection_HAsciiString" << "TCollection_HExtendedString"
<< "TCollection_MapNode" << "TCollection_MapNodePtr" << "TCollection_SeqNode"
<< "TCollection_SeqNodePtr" << "TCollection_Side" << "Standard_False" << "Standard_True"
<< "TCollection" << "NCollection" << "gp_Trsf" << "Handle" << "Aspect_TOL_DASH"
<< "Aspect_TOM_O_STAR" << "Aspect_TOL_SOLID" << "Aspect_TOM_O_STAR" << "AIS_InteractiveObject"
<< "AIS_ListOfInteractive" << "Aspect_GDM_Lines" << "Aspect_GDM_Points" << "Aspect_TOM_POINT"
<< "Aspect_TOM_RING1" << "Aspect_TOM_O" << "BinDrivers" << "DefineFormat" << "Font_FA_Bold"
<< "Font_FA_BoldItalic" << "Font_FA_Italic" << "Font_FA_Regular" << "DownCast" << "gp_Pln"
<< "Graphic3d_AspectMarker3d" << "Graphic3d_HTA_LEFT" << "Graphic3d_NameOfMaterial"
<< "Graphic3d_NOM_BRONZE" << "Graphic3d_NOM_PLASTIC" << "Graphic3d_VTA_BOTTOM"
<< "OpenGl_GraphicDriver" << "PCDM_RS_OK" << "PCDM_SS_OK" << "PCDM_ReaderStatus"
<< "PCDM_StoreStatus" << "Prs3d_Drawer" << "TPrsStd_AISPresentation" << "Quantity_Color"
<< "Quantity_NameOfColor" << "Quantity_NOC_BLUE1" << "Quantity_NOC_CADETBLUE"
<< "Quantity_NOC_GREEN" << "Quantity_NOC_MAGENTA1" << "Quantity_NOC_RED" << "Quantity_NOC_YELLOW"
<< "Quantity_NOC_WHITE" << "Quantity_NOC_MATRABLUE" << "Quantity_TOC_RGB" << "Quantity_TOC_HLS"
<< "Standard_GUID" << "TColStd_ListIteratorOfListOfTransient" << "TColStd_ListOfTransient"
<< "TDataStd_Integer" << "TDataStd_Name" << "TDataStd_Real" << "TFunction_Driver"
<< "TFunction_DriverTable" << "TFunction_Function" << "TFunction_Logbook" << "TDF_Label"
<< "TDF_TagSource" << "TNaming_NamedShape" << "TopAbs_EDGE" << "TopAbs_FACE" << "TopAbs_VERTEX"
<< "TPrsStd_AISPresentation" << "TPrsStd_AISViewer" << "V3d_AmbientLight"
<< "V3d_DirectionalLight" << "V3d_PositionalLight" << "V3d_SpotLight" << "XmlDrivers";
QStringList aHelperPatterns;
aHelperPatterns
<< "AdaptorCurve_AIS" << "AdaptorVec_AIS" << "AdaptorCurve2d_AIS" << "AdaptorPnt2d_AIS"
<< "Sample2D_Image" << "Sample2D_Markers" << "Sample2D_Face" << "TOcafFunction_BoxDriver"
<< "TOcafFunction_CylDriver" << "DisplayPresentation";
HighlightingRule aRule;
myOcctFormat.setForeground(Qt::darkCyan);
for (const QString& aPattern : anOcctPatterns)
foreach (const QString& aPattern, anOcctPatterns)
{
aRule.myPattern = QRegularExpression(aPattern);
aRule.myPattern = QRegExp(aPattern);
aRule.myFormat = myOcctFormat;
myHighlightingRules.append(aRule);
}
myHelperFormat.setForeground(Qt::red);
for (const QString& aPattern : aHelperPatterns)
foreach (const QString& aPattern, aHelperPatterns)
{
aRule.myPattern = QRegularExpression(aPattern);
aRule.myPattern = QRegExp(aPattern);
aRule.myFormat = myHelperFormat;
myHighlightingRules.append(aRule);
}
@@ -176,54 +145,56 @@ OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
myKeywordFormat.setForeground(Qt::darkBlue);
myKeywordFormat.setFontWeight(QFont::Bold);
for (const QString& aPattern : aKeywordPatterns)
foreach (const QString& aPattern, aKeywordPatterns)
{
aRule.myPattern = QRegularExpression(aPattern);
aRule.myPattern = QRegExp(aPattern);
aRule.myFormat = myKeywordFormat;
myHighlightingRules.append(aRule);
}
myMemberFormat.setFontWeight(QFont::Bold);
aRule.myPattern = QRegularExpression(QStringLiteral("\\bmy[0-9A-Za-z]+\\b"));
aRule.myPattern = QRegExp(QLatin1String("\\bmy[0-9A-Za-z]+\\b"));
aRule.myFormat = myMemberFormat;
myHighlightingRules.append(aRule);
myLocalFormat.setForeground(Qt::darkMagenta);
aRule.myPattern = QRegularExpression(QStringLiteral("\\ba[0-9A-Za-z]+\\b"));
aRule.myPattern = QRegExp(QLatin1String("\\ba[0-9A-Za-z]+\\b"));
aRule.myFormat = myLocalFormat;
myHighlightingRules.append(aRule);
myQuotationFormat.setForeground(Qt::darkRed);
aRule.myPattern = QRegularExpression(QStringLiteral("\".*\""));
aRule.myPattern = QRegExp(QLatin1String("\".*\""));
aRule.myFormat = myQuotationFormat;
myHighlightingRules.append(aRule);
myFunctionFormat.setFontItalic(true);
myFunctionFormat.setForeground(Qt::blue);
aRule.myPattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_]+(?=\\()"));
aRule.myPattern = QRegExp(QLatin1String("\\b[A-Za-z0-9_]+(?=\\()"));
aRule.myFormat = myFunctionFormat;
myHighlightingRules.append(aRule);
mySingleLineCommentFormat.setForeground(Qt::darkGreen);
aRule.myPattern = QRegularExpression(QStringLiteral("//[^\n]*"));
aRule.myPattern = QRegExp(QLatin1String("//[^\n]*"));
aRule.myFormat = mySingleLineCommentFormat;
myHighlightingRules.append(aRule);
myMultiLineCommentFormat.setForeground(Qt::darkGreen);
myCommentStartExpression = QRegularExpression(QStringLiteral("/\\*"));
myCommentEndExpression = QRegularExpression(QStringLiteral("\\*/"));
myCommentStartExpression = QRegExp(QLatin1String("/\\*"));
myCommentEndExpression = QRegExp(QLatin1String("\\*/"));
}
void OcctHighlighter::highlightBlock (const QString& theText)
{
for (const HighlightingRule& rule : qAsConst(myHighlightingRules))
foreach (const HighlightingRule &rule, myHighlightingRules)
{
QRegularExpressionMatchIterator matchIterator = rule.myPattern.globalMatch(theText);
while (matchIterator.hasNext())
QRegExp expression(rule.myPattern);
int index = expression.indexIn(theText);
while (index >= 0)
{
QRegularExpressionMatch match = matchIterator.next();
setFormat(match.capturedStart(), match.capturedLength(), rule.myFormat);
int length = expression.matchedLength();
setFormat(index, length, rule.myFormat);
index = expression.indexIn(theText, index + length);
}
}
@@ -233,22 +204,21 @@ void OcctHighlighter::highlightBlock (const QString& theText)
if (previousBlockState() != 1)
startIndex = theText.indexOf(myCommentStartExpression);
while (startIndex >= 0)
while (startIndex >= 0)
{
QRegularExpressionMatch match = myCommentEndExpression.match(theText, startIndex);
int endIndex = match.capturedStart();
int commentLength = 0;
if (endIndex == -1)
int endIndex = myCommentEndExpression.indexIn(theText, startIndex);
int commentLength;
if (endIndex == -1)
{
setCurrentBlockState(1);
commentLength = theText.length() - startIndex;
}
else
}
else
{
commentLength = endIndex - startIndex
+ match.capturedLength();
+ myCommentEndExpression.matchedLength();
}
setFormat(startIndex, commentLength, myMultiLineCommentFormat);
startIndex = theText.indexOf(myCommentStartExpression, startIndex + commentLength);
startIndex = myCommentEndExpression.indexIn(theText, startIndex + commentLength);
}
}

View File

@@ -25,7 +25,7 @@
#include <Standard_Macro.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QRegularExpression>
#include <QRegExp>
#include <QSyntaxHighlighter>
#include <QString>
#include <QTextDocument>
@@ -51,15 +51,17 @@ protected:
private:
struct HighlightingRule
{
QRegularExpression myPattern;
QRegExp myPattern;
QTextCharFormat myFormat;
};
private:
QVector<HighlightingRule> myHighlightingRules;
QRegularExpression myCommentStartExpression;
QRegularExpression myCommentEndExpression;
// QRegExp (Qt4+) introduced by the patch as alternative to QRegularExpression
// (Qt5+) for compatibility reasons. QRegExp will be moved in future Qt6 to
// a qt5compat module: QRegExp -> Qt5::QRegExp
QRegExp myCommentStartExpression;
QRegExp myCommentEndExpression;
QTextCharFormat myKeywordFormat;
QTextCharFormat mySingleLineCommentFormat;

View File

@@ -135,10 +135,10 @@ Aspect_TypeOfResize OcctWindow::DoResize()
break;
} // end switch
*((Standard_Integer*)&myXLeft) = myWidget->rect().left();
*((Standard_Integer*)&myXRight) = myWidget->rect().right();
*((Standard_Integer*)&myYTop) = myWidget->rect().top();
*((Standard_Integer*)&myYBottom) = myWidget->rect().bottom();
myXLeft = myWidget->rect().left();
myXRight = myWidget->rect().right();
myYTop = myWidget->rect().top();
myYBottom = myWidget->rect().bottom();
}
return aMode;

View File

@@ -118,7 +118,7 @@ View::View (const Handle(AIS_InteractiveContext)& theContext, bool theIs3dView,
setAttribute(Qt::WA_NoSystemBackground);
myDefaultGestures = myMouseGestureMap;
myCurrentMode = CurrentAction3d::Nothing;
myCurrentMode = CurrentAction3d_Nothing;
setMouseTracking(true);
initViewActions();
@@ -148,10 +148,12 @@ void View::init()
if (myIs3dView)
{
SetAllowRotation(Standard_True);
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.0, 0.3, Quantity_TOC_RGB));
}
else
{
SetAllowRotation(Standard_False);
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.2, 0.0, Quantity_TOC_RGB));
myV3dView->SetProj(V3d_Zpos);
}
@@ -205,9 +207,9 @@ void View::hlrOff()
QApplication::setOverrideCursor(Qt::WaitCursor);
myV3dView->SetComputedMode(Standard_False);
myV3dView->Redraw();
QAction* aShadingAction = getViewAction(ViewAction::Shading);
QAction* aShadingAction = getViewAction(ViewAction_Shading);
aShadingAction->setEnabled(true);
QAction* aWireframeAction = getViewAction(ViewAction::Wireframe);
QAction* aWireframeAction = getViewAction(ViewAction_Wireframe);
aWireframeAction->setEnabled(true);
QApplication::restoreOverrideCursor();
}
@@ -217,9 +219,9 @@ void View::hlrOn()
QApplication::setOverrideCursor(Qt::WaitCursor);
myV3dView->SetComputedMode(Standard_True);
myV3dView->Redraw();
QAction* aShadingAction = getViewAction(ViewAction::Shading);
QAction* aShadingAction = getViewAction(ViewAction_Shading);
aShadingAction->setEnabled(false);
QAction* aWireframeAction = getViewAction(ViewAction::Wireframe);
QAction* aWireframeAction = getViewAction(ViewAction_Wireframe);
aWireframeAction->setEnabled(false);
QApplication::restoreOverrideCursor();
}
@@ -252,9 +254,9 @@ void View::onRaytraceAction()
{
QAction* aSentBy = (QAction*)sender();
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolRaytracing))
if (aSentBy == myRaytraceActions.value(RaytraceAction_Raytracing))
{
bool aState = myRaytraceActions.value(RaytraceAction::ToolRaytracing)->isChecked();
bool aState = myRaytraceActions.value(RaytraceAction_Raytracing)->isChecked();
QApplication::setOverrideCursor(Qt::WaitCursor);
if (aState)
@@ -264,21 +266,21 @@ void View::onRaytraceAction()
QApplication::restoreOverrideCursor();
}
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolShadows))
if (aSentBy == myRaytraceActions.value(RaytraceAction_Shadows))
{
bool aState = myRaytraceActions.value(RaytraceAction::ToolShadows)->isChecked();
bool aState = myRaytraceActions.value(RaytraceAction_Shadows)->isChecked();
SetRaytracedShadows(aState);
}
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolReflections))
if (aSentBy == myRaytraceActions.value(RaytraceAction_Reflections))
{
bool aState = myRaytraceActions.value(RaytraceAction::ToolReflections)->isChecked();
bool aState = myRaytraceActions.value(RaytraceAction_Reflections)->isChecked();
SetRaytracedReflections(aState);
}
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolAntialiasing))
if (aSentBy == myRaytraceActions.value(RaytraceAction_Antialiasing))
{
bool aState = myRaytraceActions.value(RaytraceAction::ToolAntialiasing)->isChecked();
bool aState = myRaytraceActions.value(RaytraceAction_Antialiasing)->isChecked();
SetRaytracedAntialiasing(aState);
}
}
@@ -318,7 +320,7 @@ void View::updateToggled(bool isOn)
return;
}
for (QAction* anAction : myViewActions)
foreach (QAction* anAction, myViewActions)
{
if (anAction && (anAction != sentBy))
{
@@ -327,15 +329,15 @@ void View::updateToggled(bool isOn)
}
else
{
if (sentBy == myViewActions.value(ViewAction::FitArea))
if (sentBy == myViewActions.value(ViewAction_FitArea))
setCursor(*handCursor);
else if (sentBy == myViewActions.value(ViewAction::Zoom))
else if (sentBy == myViewActions.value(ViewAction_Zoom))
setCursor(*zoomCursor);
else if (sentBy == myViewActions.value(ViewAction::Pan))
else if (sentBy == myViewActions.value(ViewAction_Pan))
setCursor(*panCursor);
else if (sentBy == myViewActions.value(ViewAction::GlobalPan))
else if (sentBy == myViewActions.value(ViewAction_GlobalPan))
setCursor(*globPanCursor);
else if (sentBy == myViewActions.value(ViewAction::Rotation))
else if (sentBy == myViewActions.value(ViewAction_Rotation))
setCursor(*rotCursor);
else
setCursor(*defCursor);
@@ -391,12 +393,11 @@ QPaintEngine* View::paintEngine() const
return 0;
}
QAction* View::RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void))
QAction* View::RegisterAction(QString theIconPath, QString thePromt)
{
QAction* anAction = new QAction(QPixmap(theIconPath), thePromt, this);
anAction->setToolTip(thePromt);
anAction->setStatusTip(thePromt);
connect(anAction, &QAction::triggered, this, theSlot);
return anAction;
}
@@ -404,34 +405,42 @@ void View::initViewActions()
{
if (!myViewActions.empty())
return;
myViewActions[ViewAction::FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"), &View::fitAll);
myViewActions[ViewAction_FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"));
connect(myViewActions[ViewAction_FitAll], SIGNAL(triggered()), this, SLOT(fitAll()));
if (myIs3dView)
{
myViewActions[ViewAction::Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"), &View::axo);
myViewActions[ViewAction_Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"));
connect(myViewActions[ViewAction_Axo], SIGNAL(triggered()), this, SLOT(axo()));
QActionGroup* aShadingActionGroup = new QActionGroup(this);
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"), &View::shading);
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"));
connect(aShadingAction, SIGNAL(triggered()), this, SLOT(shading()));
aShadingAction->setCheckable(true);
aShadingActionGroup->addAction(aShadingAction);
myViewActions[ViewAction::Shading] = aShadingAction;
myViewActions[ViewAction_Shading] = aShadingAction;
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"), &View::wireframe);
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"));
connect(aWireframeAction, SIGNAL(triggered()), this, SLOT(wireframe()));
aWireframeAction->setCheckable(true);
aShadingActionGroup->addAction(aWireframeAction);
myViewActions[ViewAction::Wireframe] = aWireframeAction;
myViewActions[ViewAction_Wireframe] = aWireframeAction;
QActionGroup* aHlrActionGroup = new QActionGroup(this);
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr("HLR off"), &View::hlrOff);
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr("HLR off"));
connect(aHlrOffAction, SIGNAL(triggered()), this, SLOT(hlrOff()));
aHlrOffAction->setCheckable(true);
aHlrActionGroup->addAction(aHlrOffAction);
myViewActions[ViewAction::HlrOff] = aHlrOffAction;
myViewActions[ViewAction_HlrOff] = aHlrOffAction;
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr("HLR on"), &View::hlrOn);
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr("HLR on"));
connect(aHlrOnAction, SIGNAL(triggered()), this, SLOT(hlrOn()));
aHlrOnAction->setCheckable(true);
aHlrActionGroup->addAction(aHlrOnAction);
myViewActions[ViewAction::HlrOn] = aHlrOnAction;
myViewActions[ViewAction_HlrOn] = aHlrOnAction;
myViewActions[ViewAction::Transparency] = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"), &View::onTransparency);
QAction* aTransparencyAction = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"));
connect(aTransparencyAction, SIGNAL(triggered()), this, SLOT(onTransparency()));
myViewActions[ViewAction_Transparency] = aTransparencyAction;
}
}
@@ -442,23 +451,27 @@ void View::initRaytraceActions()
return;
}
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"), &View::onRaytraceAction);
myRaytraceActions[RaytraceAction::ToolRaytracing] = aRayTraceAction;
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"));
connect(aRayTraceAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Raytracing] = aRayTraceAction;
aRayTraceAction->setCheckable(true);
aRayTraceAction->setChecked(false);
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"), &View::onRaytraceAction);
myRaytraceActions[RaytraceAction::ToolShadows] = aShadowAction;
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"));
connect(aShadowAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Shadows] = aShadowAction;
aShadowAction->setCheckable(true);
aShadowAction->setChecked(true);
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"), &View::onRaytraceAction);
myRaytraceActions[RaytraceAction::ToolReflections] = aReflectAction;
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"));
connect(aReflectAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Reflections] = aReflectAction;
aReflectAction->setCheckable(true);
aReflectAction->setChecked(false);
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"), &View::onRaytraceAction);
myRaytraceActions[RaytraceAction::ToolAntialiasing] = anAntiAliasingAction;
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"));
connect(anAntiAliasingAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Antialiasing] = anAntiAliasingAction;
anAntiAliasingAction->setCheckable(true);
anAntiAliasingAction->setChecked(false);
}
@@ -468,12 +481,12 @@ void View::activateCursor(const CurrentAction3d theMode)
QCursor* aCursor = defCursor;
switch (theMode)
{
case CurrentAction3d::DynamicPanning: aCursor = panCursor; break;
case CurrentAction3d::DynamicZooming: aCursor = zoomCursor; break;
case CurrentAction3d::DynamicRotation: aCursor = rotCursor; break;
case CurrentAction3d::GlobalPanning: aCursor = globPanCursor; break;
case CurrentAction3d::WindowZooming: aCursor = handCursor; break;
case CurrentAction3d::Nothing: aCursor = defCursor; break;
case CurrentAction3d_DynamicPanning: aCursor = panCursor; break;
case CurrentAction3d_DynamicZooming: aCursor = zoomCursor; break;
case CurrentAction3d_DynamicRotation: aCursor = rotCursor; break;
case CurrentAction3d_GlobalPanning: aCursor = globPanCursor; break;
case CurrentAction3d_WindowZooming: aCursor = handCursor; break;
case CurrentAction3d_Nothing: aCursor = defCursor; break;
default:
break;
}
@@ -483,10 +496,6 @@ void View::activateCursor(const CurrentAction3d theMode)
void View::mousePressEvent(QMouseEvent* theEvent)
{
Qt::MouseButtons aMouseButtons = theEvent->buttons();
if (!myIs3dView)
{
aMouseButtons.setFlag(Qt::LeftButton, false);
}
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
if (!myV3dView.IsNull()
@@ -500,10 +509,6 @@ void View::mousePressEvent(QMouseEvent* theEvent)
void View::mouseReleaseEvent(QMouseEvent* theEvent)
{
Qt::MouseButtons aMouseButtons = theEvent->buttons();
if (!myIs3dView)
{
aMouseButtons.setFlag(Qt::LeftButton, false);
}
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
if (!myV3dView.IsNull()
@@ -512,23 +517,19 @@ void View::mouseReleaseEvent(QMouseEvent* theEvent)
updateView();
}
if (myCurrentMode == CurrentAction3d::GlobalPanning)
if (myCurrentMode == CurrentAction3d_GlobalPanning)
{
myV3dView->Place(aPnt.x(), aPnt.y(), myCurZoom);
}
if (myCurrentMode != CurrentAction3d::Nothing)
if (myCurrentMode != CurrentAction3d_Nothing)
{
setCurrentAction(CurrentAction3d::Nothing);
setCurrentAction(CurrentAction3d_Nothing);
}
}
void View::mouseMoveEvent(QMouseEvent* theEvent)
{
Qt::MouseButtons aMouseButtons = theEvent->buttons();
if (!myIs3dView)
{
aMouseButtons.setFlag(Qt::LeftButton, false);
}
const Graphic3d_Vec2i aNewPos(theEvent->pos().x(), theEvent->pos().y());
if (!myV3dView.IsNull()
&& UpdateMousePosition(aNewPos, qtMouseButtons2VKeys(aMouseButtons), qtMouseModifiers2VKeys(theEvent->modifiers()), false))
@@ -567,31 +568,31 @@ void View::defineMouseGestures()
activateCursor(myCurrentMode);
switch (myCurrentMode)
{
case CurrentAction3d::Nothing:
case CurrentAction3d_Nothing:
{
myMouseGestureMap = myDefaultGestures;
break;
}
case CurrentAction3d::DynamicZooming:
case CurrentAction3d_DynamicZooming:
{
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
break;
}
case CurrentAction3d::GlobalPanning:
case CurrentAction3d_GlobalPanning:
{
break;
}
case CurrentAction3d::WindowZooming:
case CurrentAction3d_WindowZooming:
{
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
break;
}
case CurrentAction3d::DynamicPanning:
case CurrentAction3d_DynamicPanning:
{
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
break;
}
case CurrentAction3d::DynamicRotation:
case CurrentAction3d_DynamicRotation:
{
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, aRot);
break;
@@ -667,9 +668,11 @@ void View::onTransparencyChanged(int theVal)
{
AIS_ListOfInteractive anAisObjectsList;
myContext->DisplayedObjects(anAisObjectsList);
double aTranspValue = theVal / 10.;
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
double aTranspValue = theVal / 10.;
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
myContext->SetTransparency(anAisObject, aTranspValue, Standard_False);
}
myContext->UpdateCurrentViewer();

View File

@@ -38,11 +38,45 @@
class TopoDS_Shape;
enum CurrentAction3d { Nothing, DynamicZooming, WindowZooming,
DynamicPanning, GlobalPanning, DynamicRotation, ObjectDececting };
enum ViewAction { FitAll, FitArea, Zoom, Pan, GlobalPan, Front, Back, Top, Bottom,
Left, Right, Axo, Rotation, Reset, HlrOff, HlrOn, Shading, Wireframe, Transparency };
enum RaytraceAction { ToolRaytracing, ToolShadows, ToolReflections, ToolAntialiasing };
enum CurrentAction3d
{
CurrentAction3d_Nothing,
CurrentAction3d_DynamicZooming,
CurrentAction3d_WindowZooming,
CurrentAction3d_DynamicPanning,
CurrentAction3d_GlobalPanning,
CurrentAction3d_DynamicRotation,
CurrentAction3d_ObjectDececting
};
enum ViewAction
{
ViewAction_FitAll,
ViewAction_FitArea,
ViewAction_Zoom,
ViewAction_Pan,
ViewAction_GlobalPan,
ViewAction_Front,
ViewAction_Back,
ViewAction_Top,
ViewAction_Bottom,
ViewAction_Left,
ViewAction_Right,
ViewAction_Axo,
ViewAction_Rotation,
ViewAction_Reset,
ViewAction_HlrOff,
ViewAction_HlrOn,
ViewAction_Shading,
ViewAction_Wireframe,
ViewAction_Transparency
};
enum RaytraceAction
{
RaytraceAction_Raytracing,
RaytraceAction_Shadows,
RaytraceAction_Reflections,
RaytraceAction_Antialiasing
};
//! Qt widget containing V3d_View and toolbar with view manipulation buttons.
//! Also use AIS_ViewController for redirecting user input (mouse, keyboard)
@@ -128,7 +162,7 @@ private:
void initViewActions();
void initRaytraceActions();
QAction* RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void));
QAction* RegisterAction(QString theIconPath, QString thePromt);
private:
bool myIsRaytracing;

View File

@@ -26,7 +26,7 @@ void DocumentTut::onMakeBottle()
QApplication::setOverrideCursor( Qt::WaitCursor );
TopoDS_Shape aBottle=MakeBottle(50,70,30);
Handle(AIS_Shape) AISBottle=new AIS_Shape(aBottle);
getContext()->SetMaterial (AISBottle, Graphic3d_NOM_GOLD, Standard_False);
getContext()->SetMaterial (AISBottle, Graphic3d_NameOfMaterial_Gold, Standard_False);
getContext()->SetDisplayMode(AISBottle, 1, Standard_False);
getContext()->Display(AISBottle, Standard_False);
const Handle(AIS_InteractiveObject)& anIOAISBottle = AISBottle;

View File

@@ -46,7 +46,7 @@ extern "C" void onFileDataRead (void* theOpaque, void* theBuffer, int theDataLen
BRepTools::Read (aShape, aStream, aBuilder);
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aShape);
aShapePrs->SetMaterial (Graphic3d_NOM_SILVER);
aShapePrs->SetMaterial (Graphic3d_NameOfMaterial_Silver);
aViewer.Context()->Display (aShapePrs, AIS_Shaded, 0, false);
aViewer.View()->FitAll (0.01, false);
aViewer.View()->Redraw();

View File

@@ -43,7 +43,7 @@ AIS_CameraFrustum::AIS_CameraFrustum()
myDrawer->SetLineAspect (new Prs3d_LineAspect (THE_DEFAULT_COLOR, Aspect_TOL_SOLID, 1.0));
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
aShadingAspect->SetMaterial (Graphic3d_NOM_PLASTIC);
aShadingAspect->SetMaterial (Graphic3d_NameOfMaterial_Plastified);
aShadingAspect->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
aShadingAspect->SetTransparency (THE_DEFAULT_TRANSPARENCY);
aShadingAspect->SetColor (THE_DEFAULT_COLOR);

View File

@@ -2180,7 +2180,7 @@ void AIS_InteractiveContext::SetSelectionSensitivity (const Handle(AIS_Interacti
//=======================================================================
void AIS_InteractiveContext::InitAttributes()
{
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_Brass);
myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
// myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);

View File

@@ -588,7 +588,7 @@ void AIS_Plane::ComputeFields()
void AIS_Plane::InitDrawerAttributes()
{
Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();
shasp->SetMaterial(Graphic3d_NOM_PLASTIC);
shasp->SetMaterial(Graphic3d_NameOfMaterial_Plastified);
shasp->SetColor(Quantity_NOC_GRAY40);
myDrawer->SetShadingAspect(shasp);
Handle(Graphic3d_AspectFillArea3d) asf = shasp->Aspect();

View File

@@ -297,7 +297,7 @@ void AIS_PointCloud::UnsetColor()
AIS_InteractiveObject::UnsetColor();
{
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NameOfMaterial_Brass);
Graphic3d_MaterialAspect aMat = aDefaultMat;
Quantity_Color aColor = aDefaultMat.Color();
if (myDrawer->HasLink())
@@ -353,7 +353,7 @@ void AIS_PointCloud::UnsetMaterial()
}
{
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NameOfMaterial_Brass);
myDrawer->ShadingAspect()->SetMaterial (myDrawer->HasLink() ?
myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel) :
aDefaultMat,

View File

@@ -42,7 +42,7 @@ AIS_RubberBand::AIS_RubberBand()
{
myDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0));
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Plastified);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
@@ -65,7 +65,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
{
myDrawer->SetLineAspect (new Prs3d_LineAspect (theLineColor, theLineType, theWidth));
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Plastified);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
@@ -90,7 +90,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
{
myDrawer->SetLineAspect (new Prs3d_LineAspect (theLineColor, theLineType, theLineWidth));
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Plastified);
myDrawer->ShadingAspect()->SetColor (theFillColor);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);

View File

@@ -489,7 +489,7 @@ void AIS_Shape::UnsetColor()
|| IsTransparent()
|| myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
{
const Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
const Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NameOfMaterial_Brass);
Graphic3d_MaterialAspect mat = aDefaultMat;
Quantity_Color anInteriorColors[2] = {Quantity_NOC_CYAN1, Quantity_NOC_CYAN1};
if (myDrawer->HasLink())

View File

@@ -2697,8 +2697,14 @@ void AIS_ViewController::contextLazyMoveTo (const Handle(AIS_InteractiveContext)
myPrevMoveTo = thePnt;
Handle(SelectMgr_EntityOwner) aLastPicked = theCtx->DetectedOwner();
// Picking relies on the camera frustum (including Z-range) - so make temporary AutoZFit()
// and then restore previous frustum to avoid immediate layer rendering issues if View has not been invalidated.
const Standard_Real aZNear = theView->Camera()->ZNear(), aZFar = theView->Camera()->ZFar();
theView->AutoZFit();
theCtx->MoveTo (thePnt.x(), thePnt.y(), theView, false);
theView->Camera()->SetZRange (aZNear, aZFar);
Handle(SelectMgr_EntityOwner) aNewPicked = theCtx->DetectedOwner();
if (theView->Viewer()->Grid()->IsActive()

View File

@@ -200,7 +200,7 @@ void AIS_ViewCube::setDefaultAttributes()
// this should be forced back-face culling regardless Closed flag
myDrawer->TextAspect()->Aspect()->SetSuppressBackFaces (true);
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_UserDefined);
aMat.SetColor (Quantity_NOC_WHITE);
aMat.SetAmbientColor (Quantity_NOC_GRAY60);

View File

@@ -451,7 +451,7 @@ public:
//! Sets the material for the interactive object.
virtual void UnsetMaterial() Standard_OVERRIDE
{
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_UserDefined);
aMat.SetColor (Quantity_NOC_WHITE);
aMat.SetAmbientColor (Quantity_NOC_GRAY60);
myDrawer->ShadingAspect()->SetMaterial (aMat);

View File

@@ -68,7 +68,7 @@ AIS_XRTrackedDevice::AIS_XRTrackedDevice (const Handle(Graphic3d_ArrayOfTriangle
myToShowAxes (false)
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_DEFAULT);
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_DEFAULT);
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
if (!theTexture.IsNull())
{

View File

@@ -387,7 +387,10 @@ void BOPAlgo_BOP::Perform()
pPF=new BOPAlgo_PaveFiller(aAllocator);
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -195,7 +195,10 @@ void BOPAlgo_Builder::Perform()
//
pPF->SetArguments(myArguments);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
@@ -632,7 +635,10 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
aBS.SetRunParallel(myRunParallel);
aBS.SetContext(myContext);
aBS.SetFuzzyValue(myFuzzyValue);
aBS.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aBS.SetProgressIndicator(*myProgressScope);
}
aBS.Perform();
// Resulting solids

View File

@@ -450,7 +450,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
aBF.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aBF.SetProgressIndicator(*myProgressScope);
}
//
}// for (i=0; i<aNbS; ++i) {
//
@@ -637,7 +640,10 @@ void BOPAlgo_Builder::FillSameDomainFaces()
aPSB.Shape1() = aF1;
aPSB.Shape2() = aF2;
aPSB.SetFuzzyValue(myFuzzyValue);
aPSB.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aPSB.SetProgressIndicator(*myProgressScope);
}
}
}
}
@@ -790,7 +796,10 @@ void BOPAlgo_Builder::FillInternalVertices()
aVFI.SetVertex(aV);
aVFI.SetFace(aFIm);
aVFI.SetFuzzyValue(myFuzzyValue);
aVFI.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aVFI.SetProgressIndicator(*myProgressScope);
}
}
}
}

View File

@@ -432,7 +432,10 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS);
aBS.SetRunParallel(myRunParallel);
aBS.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aBS.SetProgressIndicator(*myProgressScope);
}
}//for (i=0; i<aNbS; ++i) {
//
Standard_Integer k, aNbBS;

View File

@@ -432,7 +432,10 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
aFaceSelfIntersect.SetFace(aF);
aFaceSelfIntersect.SetTolF(aTolF);
//
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
}
}
Standard_Integer aNbFace = aVFace.Length();

View File

@@ -86,7 +86,10 @@ void BOPAlgo_MakerVolume::Perform()
}
//
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -264,7 +264,10 @@ void BOPAlgo_PaveFiller::IntersectVE
aVESolver.SetEdge(aE);
aVESolver.SetPaveBlock(aPB);
aVESolver.SetFuzzyValue(myFuzzyValue);
aVESolver.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aVESolver.SetProgressIndicator(*myProgressScope);
}
}
}
//

View File

@@ -253,7 +253,10 @@ void BOPAlgo_PaveFiller::PerformEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (aBB1, aBB2);
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
}//for (; aIt2.More(); aIt2.Next()) {
}//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
@@ -652,6 +655,12 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
// Vertices
Standard_Integer nV1, nV2;
thePB->Indices(nV1, nV2);
if (nV1 < 0 || nV2 < 0)
{
return;
}
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
// Get the edge
@@ -1070,10 +1079,17 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (myDS->ShapeInfo(nE1).Box(), myDS->ShapeInfo (nE2).Box());
if (bUseAddTol)
{
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
}
else
{
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
if (myProgressScope != NULL)
{
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
}
}
}

View File

@@ -217,7 +217,10 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aVertexFace.SetProgressIndicator(*myProgressScope);
}
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Length();

View File

@@ -278,7 +278,10 @@ void BOPAlgo_PaveFiller::PerformEF()
aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
aEdgeFace.SetRange (aPBRange);
aEdgeFace.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aEdgeFace.SetProgressIndicator(*myProgressScope);
}
// Save the pair to avoid their forced intersection
BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
if (!pMPB)
@@ -1010,7 +1013,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
aEdgeFace.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aEdgeFace.SetProgressIndicator(*myProgressScope);
}
}
}
}

View File

@@ -308,7 +308,10 @@ void BOPAlgo_PaveFiller::PerformFF()
//
aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aFaceFace.SetProgressIndicator(*myProgressScope);
}
}
else {
// for the Glue mode just add all interferences of that type
@@ -1019,7 +1022,10 @@ void BOPAlgo_PaveFiller::PostTreatFF
}
//
// 2 Fuse shapes
aPF.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aPF.SetProgressIndicator(*myProgressScope);
}
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();
@@ -2832,37 +2838,50 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
else {
// For the different original edge compute the parameters of paves
BOPDS_Pave aPave[2];
for (Standard_Integer i = 0; i < 2; ++i) {
Standard_Integer nV = aPBValuePaves[i].Index();
aPave[i].SetIndex(nV);
if (nV == aPB2->Pave1().Index()) {
aPave[i].SetParameter(aPB2->Pave1().Parameter());
}
else if (nV == aPB2->Pave2().Index()) {
aPave[i].SetParameter(aPB2->Pave2().Parameter());
}
else {
// Compute the parameter by projecting the point
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
const TopoDS_Edge& aEOr = TopoDS::Edge(myDS->Shape(nE));
Standard_Real aTOut, aDist;
Standard_Integer iErr = myContext->ComputeVE(aV, aEOr, aTOut, aDist, myFuzzyValue);
if (!iErr) {
aPave[i].SetParameter(aTOut);
if (aPBValuePaves[0].Index() == aPBValuePaves[1].Index() &&
aPB2->Pave1().Index() == aPB2->Pave2().Index())
{
// still closed
aPave[0].SetIndex (aPBValuePaves[0].Index());
aPave[0].SetParameter (aPB2->Pave1().Parameter());
aPave[1].SetIndex (aPBValuePaves[1].Index());
aPave[1].SetParameter (aPB2->Pave2().Parameter());
}
else
{
for (Standard_Integer i = 0; i < 2; ++i) {
Standard_Integer nV = aPBValuePaves[i].Index();
aPave[i].SetIndex(nV);
if (nV == aPB2->Pave1().Index()) {
aPave[i].SetParameter(aPB2->Pave1().Parameter());
}
else if (nV == aPB2->Pave2().Index()) {
aPave[i].SetParameter(aPB2->Pave2().Parameter());
}
else {
// Unable to project - set the parameter of the closest boundary
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(aPB2->Pave1().Index()));
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(aPB2->Pave2().Index()));
//
gp_Pnt aP = BRep_Tool::Pnt(aV);
gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
gp_Pnt aP2 = BRep_Tool::Pnt(aV2);
//
Standard_Real aDist1 = aP.SquareDistance(aP1);
Standard_Real aDist2 = aP.SquareDistance(aP2);
//
aPave[i].SetParameter(aDist1 < aDist2 ? aPB2->Pave1().Parameter() : aPB2->Pave2().Parameter());
// Compute the parameter by projecting the point
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
const TopoDS_Edge& aEOr = TopoDS::Edge(myDS->Shape(nE));
Standard_Real aTOut, aDist;
Standard_Integer iErr = myContext->ComputeVE(aV, aEOr, aTOut, aDist, myFuzzyValue);
if (!iErr) {
aPave[i].SetParameter(aTOut);
}
else {
// Unable to project - set the parameter of the closest boundary
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(aPB2->Pave1().Index()));
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(aPB2->Pave2().Index()));
//
gp_Pnt aP = BRep_Tool::Pnt(aV);
gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
gp_Pnt aP2 = BRep_Tool::Pnt(aV2);
//
Standard_Real aDist1 = aP.SquareDistance(aP1);
Standard_Real aDist2 = aP.SquareDistance(aP2);
//
aPave[i].SetParameter(aDist1 < aDist2 ? aPB2->Pave1().Parameter() : aPB2->Pave2().Parameter());
}
}
}
}

View File

@@ -484,7 +484,10 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
aBSE.SetCommonBlock(aCB);
}
aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aBSE.SetProgressIndicator(*myProgressScope);
}
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
//
@@ -596,7 +599,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Appended();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
}
//
// On
@@ -660,7 +666,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
}
}// for (i=0; i<aNbFI; ++i) {
//
@@ -710,7 +719,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
}
}
}

View File

@@ -89,7 +89,10 @@ void BOPAlgo_Splitter::Perform()
BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -23,8 +23,10 @@
#include <BRepAlgo_Loop.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Ax2.hxx>
#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@@ -160,6 +162,15 @@ void BRepAlgo_Loop::AddConstEdges(const TopTools_ListOfShape& LE)
}
}
//=======================================================================
//function : SetImageVV
//purpose :
//=======================================================================
void BRepAlgo_Loop::SetImageVV (const BRepAlgo_Image& theImageVV)
{
myImageVV = theImageVV;
}
//=======================================================================
//function : UpdateClosedEdge
@@ -606,6 +617,8 @@ void BRepAlgo_Loop::Perform()
TopoDS_Wire NW;
Standard_Boolean End;
UpdateVEmap (MVE);
TopTools_MapOfShape UsedEdges;
while (MVE.Extent() > 0) {
@@ -924,6 +937,7 @@ void BRepAlgo_Loop::GetVerticesForSubstitute( TopTools_DataMapOfShapeShape& Ver
{
VerVerMap = myVerticesForSubstitute;
}
//=======================================================================
//function : VerticesForSubstitute
//purpose :
@@ -933,3 +947,123 @@ void BRepAlgo_Loop::VerticesForSubstitute( TopTools_DataMapOfShapeShape& VerVer
{
myVerticesForSubstitute = VerVerMap;
}
//=======================================================================
//function : UpdateVEmap
//purpose :
//=======================================================================
void BRepAlgo_Loop::UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap)
{
TopTools_IndexedDataMapOfShapeListOfShape VerLver;
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (theVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = theVEmap(ii);
if (aElist.Extent() == 1 && myImageVV.IsImage(aVertex))
{
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (myImageVV.ImageFrom(aVertex));
if (VerLver.Contains(aProVertex))
{
TopTools_ListOfShape& aVlist = VerLver.ChangeFromKey(aProVertex);
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
}
else
{
TopTools_ListOfShape aVlist;
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
VerLver.Add (aProVertex, aVlist);
}
}
}
if (VerLver.IsEmpty())
return;
BRep_Builder aBB;
for (Standard_Integer ii = 1; ii <= VerLver.Extent(); ii++)
{
const TopTools_ListOfShape& aVlist = VerLver(ii);
if (aVlist.Extent() == 1)
continue;
Standard_Real aMaxTol = 0.;
TColgp_Array1OfPnt Points (1, aVlist.Extent());
TopTools_ListIteratorOfListOfShape itl (aVlist);
Standard_Integer jj = 0;
for (; itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
aMaxTol = Max (aMaxTol, aTol);
gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
Points(++jj) = aPnt;
}
gp_Ax2 anAxis;
Standard_Boolean IsSingular;
GeomLib::AxeOfInertia (Points, anAxis, IsSingular);
gp_Pnt aCentre = anAxis.Location();
Standard_Real aMaxDist = 0.;
for (jj = 1; jj <= Points.Upper(); jj++)
{
Standard_Real aSqDist = aCentre.SquareDistance (Points(jj));
aMaxDist = Max (aMaxDist, aSqDist);
}
aMaxDist = Sqrt(aMaxDist);
aMaxTol = Max (aMaxTol, aMaxDist);
//Find constant vertex
TopoDS_Vertex aConstVertex;
for (itl.Initialize(aVlist); itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey(aVertex);
const TopoDS_Shape& anEdge = aElist.First();
TopTools_ListIteratorOfListOfShape itcedges (myConstEdges);
for (; itcedges.More(); itcedges.Next())
if (anEdge.IsSame (itcedges.Value()))
{
aConstVertex = aVertex;
break;
}
if (!aConstVertex.IsNull())
break;
}
if (aConstVertex.IsNull())
aConstVertex = TopoDS::Vertex(aVlist.First());
aBB.UpdateVertex (aConstVertex, aCentre, aMaxTol);
for (itl.Initialize(aVlist); itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
if (aVertex.IsSame(aConstVertex))
continue;
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey (aVertex);
TopoDS_Edge anEdge = TopoDS::Edge (aElist.First());
anEdge.Orientation(TopAbs_FORWARD);
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (anEdge, aV1, aV2);
TopoDS_Vertex aVertexToRemove = (aV1.IsSame(aVertex))? aV1 : aV2;
anEdge.Free(Standard_True);
aBB.Remove (anEdge, aVertexToRemove);
aBB.Add (anEdge, aConstVertex.Oriented (aVertexToRemove.Orientation()));
}
}
TopTools_IndexedMapOfShape Emap;
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
{
const TopTools_ListOfShape& aElist = theVEmap(ii);
TopTools_ListIteratorOfListOfShape itl (aElist);
for (; itl.More(); itl.Next())
Emap.Add (itl.Value());
}
theVEmap.Clear();
for (Standard_Integer ii = 1; ii <= Emap.Extent(); ii++)
TopExp::MapShapesAndAncestors (Emap(ii), TopAbs_VERTEX, TopAbs_EDGE, theVEmap);
}

View File

@@ -25,6 +25,8 @@
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRepAlgo_Image.hxx>
class TopoDS_Face;
class TopoDS_Edge;
@@ -53,9 +55,15 @@ public:
//! Add <LE> as a set of const edges.
Standard_EXPORT void AddConstEdges (const TopTools_ListOfShape& LE);
//! Sets the Image Vertex - Vertex
Standard_EXPORT void SetImageVV (const BRepAlgo_Image& theImageVV);
//! Make loops.
Standard_EXPORT void Perform();
//! Update VE map according to Image Vertex - Vertex
Standard_EXPORT void UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap);
//! Cut the edge <E> in several edges <NE> on the
//! vertices<VonE>.
Standard_EXPORT void CutEdge (const TopoDS_Edge& E, const TopTools_ListOfShape& VonE, TopTools_ListOfShape& NE) const;
@@ -102,6 +110,7 @@ private:
TopTools_ListOfShape myNewFaces;
TopTools_DataMapOfShapeListOfShape myCutEdges;
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
BRepAlgo_Image myImageVV;
};

View File

@@ -125,7 +125,10 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg
myDSFiller->SetArguments(theArgs);
// Set options for intersection
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
myDSFiller->SetProgressIndicator(*myProgressScope);
}
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
@@ -145,7 +148,10 @@ void BRepAlgoAPI_BuilderAlgo::BuildResult()
{
// Set options to the builder
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
myBuilder->SetProgressIndicator(*myProgressScope);
}
myBuilder->SetCheckInverted(myCheckInverted);
myBuilder->SetToFillHistory(myFillHistory);
// Perform building of the result with pre-calculated intersections

View File

@@ -94,7 +94,10 @@ void BRepAlgoAPI_Check::Perform()
anAnalyzer.SelfInterMode() = myTestSI;
// Set options from BOPAlgo_Options
anAnalyzer.SetRunParallel(myRunParallel);
anAnalyzer.SetProgressIndicator(*myProgressScope);
if (myProgressScope != NULL)
{
anAnalyzer.SetProgressIndicator(*myProgressScope);
}
anAnalyzer.SetFuzzyValue(myFuzzyValue);
// Perform the check
anAnalyzer.Perform();

View File

@@ -32,6 +32,7 @@
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgo_AsDes.hxx>
#include <BRepAlgo_Image.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepOffset_Analyse.hxx>
@@ -78,6 +79,7 @@
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <stdio.h>
#ifdef DRAW
@@ -113,27 +115,153 @@ static TopoDS_Vertex CommonVertex(TopoDS_Edge& E1,
return V;
}
static Standard_Boolean IsOrientationChanged(TopTools_IndexedMapOfShape& theMap,
const TopoDS_Edge& theEdge)
static Standard_Integer DefineClosedness(const TopoDS_Face& theFace)
{
Standard_Boolean IsOrChanged = Standard_False;
if (!theMap.Contains(theEdge))
theMap.Add(theEdge);
else
TopExp_Explorer anExplo (theFace, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
Standard_Integer anInd = theMap.FindIndex(theEdge);
const TopoDS_Shape& anEdge = theMap(anInd);
if (theEdge.Orientation() != anEdge.Orientation())
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (BRepTools::IsReallyClosed(anEdge, theFace))
{
theMap.Substitute( anInd, theEdge );
IsOrChanged = Standard_True;
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
gp_Vec2d aTangent = aPCurve->DN(fpar, 1);
Standard_Real aCrossProd1 = aTangent ^ gp::DX2d();
Standard_Real aCrossProd2 = aTangent ^ gp::DY2d();
if (Abs(aCrossProd2) < Abs(aCrossProd1)) //pcurve is parallel to OY
return 1;
else
return 2;
}
}
return IsOrChanged;
return 0;
}
static void GetEdgesOrientedInFace(const TopoDS_Shape& theShape,
const TopoDS_Face& theFace,
const Handle(BRepAlgo_AsDes)& theAsDes,
TopTools_SequenceOfShape& theSeqEdges)
{
const TopTools_ListOfShape& aEdges = theAsDes->Descendant (theFace);
TopExp_Explorer anExplo (theShape, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Shape& anEdge = anExplo.Current();
TopTools_ListIteratorOfListOfShape itl (aEdges);
for (; itl.More(); itl.Next())
{
const TopoDS_Shape& anEdgeInFace = itl.Value();
if (anEdgeInFace.IsSame(anEdge))
{
theSeqEdges.Append (anEdgeInFace);
break;
}
}
}
if (theSeqEdges.Length() == 1)
return;
TopTools_IndexedDataMapOfShapeListOfShape aVEmap;
for (Standard_Integer ii = 1; ii <= theSeqEdges.Length(); ii++)
TopExp::MapShapesAndAncestors (theSeqEdges(ii), TopAbs_VERTEX, TopAbs_EDGE, aVEmap);
TopoDS_Vertex aFirstVertex;
TopoDS_Edge aFirstEdge;
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = aVEmap(ii);
if (aElist.Extent() == 1)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(aElist.First());
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
if (aV1.IsSame(aVertex))
{
aFirstVertex = aVertex;
aFirstEdge = anEdge;
break;
}
}
}
if (aFirstEdge.IsNull()) //closed set of edges
{
//Standard_Real aPeriod = 0.;
Standard_Integer IndCoord = DefineClosedness (theFace);
/*
BRepAdaptor_Surface aBAsurf (theFace, Standard_False);
if (IndCoord == 1)
aPeriod = aBAsurf.LastUParameter() - aBAsurf.FirstUParameter();
else if (IndCoord == 2)
aPeriod = aBAsurf.LastVParameter() - aBAsurf.FirstVParameter();
*/
if (IndCoord != 0)
{
Standard_Real aMaxDelta = 0.;
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = aVEmap(ii);
const TopoDS_Edge& anEdge1 = TopoDS::Edge(aElist.First());
const TopoDS_Edge& anEdge2 = TopoDS::Edge(aElist.Last());
Standard_Real aParam1 = BRep_Tool::Parameter(aVertex, anEdge1);
Standard_Real aParam2 = BRep_Tool::Parameter(aVertex, anEdge2);
BRepAdaptor_Curve2d aBAcurve1 (anEdge1, theFace);
BRepAdaptor_Curve2d aBAcurve2 (anEdge2, theFace);
gp_Pnt2d aPnt1 = aBAcurve1.Value(aParam1);
gp_Pnt2d aPnt2 = aBAcurve2.Value(aParam2);
Standard_Real aDelta = Abs(aPnt1.Coord(IndCoord) - aPnt2.Coord(IndCoord));
if (aDelta > aMaxDelta)
{
aMaxDelta = aDelta;
aFirstVertex = aVertex;
}
}
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aFirstVertex);
TopTools_ListIteratorOfListOfShape itl (aElist);
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
if (aV1.IsSame(aFirstVertex))
{
aFirstEdge = anEdge;
break;
}
}
}
}
Standard_Integer aNbEdges = theSeqEdges.Length();
theSeqEdges.Clear();
theSeqEdges.Append (aFirstEdge);
TopoDS_Edge anEdge = aFirstEdge;
for (;;)
{
TopoDS_Vertex aLastVertex = TopExp::LastVertex (anEdge, Standard_True); //with orientation
if (aLastVertex.IsSame(aFirstVertex))
break;
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aLastVertex);
if (aElist.Extent() == 1)
break;
if (aElist.First().IsSame(anEdge))
anEdge = TopoDS::Edge(aElist.Last());
else
anEdge = TopoDS::Edge(aElist.First());
theSeqEdges.Append (anEdge);
if (theSeqEdges.Length() == aNbEdges)
break;
}
}
//=======================================================================
//function : Store
@@ -505,7 +633,7 @@ static void EdgeInter(const TopoDS_Face& F,
// Vertex storage in DS.
//---------------------------------
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
TolStore = Max(TolStore, 10.*Tol);
TolStore = Max (TolStore, Tol);
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
}
}
@@ -518,10 +646,13 @@ static void RefEdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
const TopAbs_Orientation theOr1,
const TopAbs_Orientation theOr2,
const Handle(BRepAlgo_AsDes)& AsDes,
Standard_Real Tol,
Standard_Boolean WithOri,
gp_Pnt& Pref,
const TopoDS_Vertex& theVref,
BRepAlgo_Image& theImageVV,
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV,
Standard_Boolean& theCoincide)
{
@@ -567,20 +698,20 @@ static void RefEdgeInter(const TopoDS_Face& F,
Standard_Boolean WithDegen = BRep_Tool::Degenerated(E1) || BRep_Tool::Degenerated(E2);
if (WithDegen)
{
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
TopoDS_Iterator iter( EI[ideg] );
if (iter.More())
{
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
TopoDS_Iterator iter( EI[ideg] );
if (iter.More())
{
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
DegPoint = BRep_Tool::Pnt(vdeg);
}
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
DegPoint = BRep_Tool::Pnt(vdeg);
}
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
}
//
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
@@ -596,107 +727,113 @@ static void RefEdgeInter(const TopoDS_Face& F,
return;
}
}
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
//
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
theCoincide = (Inter2d.NbSegments() &&
(GAC1.GetType() == GeomAbs_Line) &&
(GAC2.GetType() == GeomAbs_Line));
(GAC1.GetType() == GeomAbs_Line) &&
(GAC2.GetType() == GeomAbs_Line));
return;
}
//
for (i = 1; i <= Inter2d.NbPoints(); i++)
{
gp_Pnt P3d;
if (WithDegen)
P3d = DegPoint;
else
{
gp_Pnt P3d;
if (WithDegen)
P3d = DegPoint;
else
{
gp_Pnt2d P2d = Inter2d.Point(i).Value();
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
}
ResPoints.Append( P3d );
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
gp_Pnt2d P2d = Inter2d.Point(i).Value();
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
}
ResPoints.Append( P3d );
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
}
for (i = 1; i <= ResPoints.Length(); i++)
{
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{
#ifdef OCCT_DEBUG
std::cout << "Inter2d : Solution rejected due to infinite parameter"<<std::endl;
std::cout << "Inter2d : Solution rejected due to infinite parameter"<<std::endl;
#endif
continue;
}
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
std::cout << "out of limit"<<std::endl;
std::cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<std::endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
std::cout << "out of limit"<<std::endl;
std::cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<std::endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
std::cout << "Inter2d : Solution rejected"<<std::endl;
std::cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<std::endl;
std::cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<std::endl;
std::cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<std::endl;
std::cout<<"MaxDist = "<<dist1<<std::endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
std::cout<<std::endl<<"CrossProd = "<<CrossProd<<std::endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
continue;
}
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
std::cout << "out of limit"<<std::endl;
std::cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<std::endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
std::cout << "out of limit"<<std::endl;
std::cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<std::endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
std::cout << "Inter2d : Solution rejected"<<std::endl;
std::cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<std::endl;
std::cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<std::endl;
std::cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<std::endl;
std::cout<<"MaxDist = "<<dist1<<std::endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
std::cout<<std::endl<<"CrossProd = "<<CrossProd<<std::endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
if (theOr1 != TopAbs_EXTERNAL)
OO1 = theOr1;
if (theOr2 != TopAbs_EXTERNAL)
OO2 = theOr2;
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
}
//----------------------------------
// Test at end.
@@ -755,7 +892,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
while (j < i) {
P1 = BRep_Tool::Pnt(TopoDS::Vertex(it1LV1.Value()));
P2 = BRep_Tool::Pnt(TopoDS::Vertex(it2LV1.Value()));
if (P1.IsEqual(P2,10*Tol)) {
if (P1.IsEqual(P2, Tol)) {
LV1.Remove(it1LV1);
LV2.Remove(it1LV2);
if (AffichPurge) std::cout <<"Doubles removed in EdgeInter."<<std::endl;
@@ -775,6 +912,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
////-----------------------------------------------------
if(LV1.Extent() > 1) {
//std::cout << "IFV - RefEdgeInter: remove vertex" << std::endl;
gp_Pnt Pref = BRep_Tool::Pnt(theVref);
Standard_Real dmin = RealLast();
TopoDS_Vertex Vmin;
for (it1LV1.Initialize(LV1); it1LV1.More(); it1LV1.Next()) {
@@ -794,10 +932,21 @@ static void RefEdgeInter(const TopoDS_Face& F,
}
}
}
TopTools_ListIteratorOfListOfShape itl (LV1);
for (; itl.More(); itl.Next())
{
TopoDS_Shape aNewVertex = itl.Value();
aNewVertex.Orientation(TopAbs_FORWARD);
if (theImageVV.HasImage (theVref))
theImageVV.Add (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
else
theImageVV.Bind (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
}
////-----------------------------------------------------
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
TolStore = Max(TolStore, 10.*Tol);
TolStore = Max (TolStore, Tol);
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
}
}
@@ -1406,6 +1555,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
{
#ifdef DRAW
@@ -1441,12 +1591,41 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
while (j < i && it2LE.More()) {
const TopoDS_Edge& E2 = TopoDS::Edge(it2LE.Value());
Standard_Boolean ToIntersect = Standard_True;
if (theEdgeIntEdges.IsBound(E1))
{
const TopTools_ListOfShape& aElist = theEdgeIntEdges(E1);
TopTools_ListIteratorOfListOfShape itedges (aElist);
for (; itedges.More(); itedges.Next())
if (E2.IsSame (itedges.Value()))
ToIntersect = Standard_False;
if (ToIntersect)
{
for (itedges.Initialize(aElist); itedges.More(); itedges.Next())
{
const TopoDS_Shape& anEdge = itedges.Value();
if (theEdgeIntEdges.IsBound(anEdge))
{
const TopTools_ListOfShape& aElist2 = theEdgeIntEdges(anEdge);
TopTools_ListIteratorOfListOfShape itedges2 (aElist2);
for (; itedges2.More(); itedges2.Next())
if (E2.IsSame (itedges2.Value()))
ToIntersect = Standard_False;
}
}
}
}
//--------------------------------------------------------------
// Intersections of New edges obtained by intersection
// between them and with edges of restrictions
//------------------------------------------------------
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
if (ToIntersect &&
(!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD);
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True, theDMVV);
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
@@ -1467,11 +1646,14 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
{
@@ -1529,8 +1711,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
continue; // Protection from case when explorer does not contain edges.
CurE = FirstE = wexp.Current();
TopTools_IndexedMapOfShape Edges;
Standard_Boolean ToReverse1, ToReverse2;
ToReverse1 = IsOrientationChanged(Edges, CurE);
while (!end) {
wexp.Next();
if (wexp.More()) {
@@ -1541,10 +1722,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
}
if (CurE.IsSame(NextE)) continue;
ToReverse2 = IsOrientationChanged(Edges, NextE);
TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
CurE = Analyse.EdgeReplacement (FI, CurE);
NextE = Analyse.EdgeReplacement (FI, NextE);
@@ -1559,21 +1737,38 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
TopTools_ListOfShape LV1,LV2;
Standard_Boolean DoInter = 1;
TopoDS_Shape NE1,NE2;
TopTools_SequenceOfShape NE1seq, NE2seq;
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
Standard_Integer aChoice = 0;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
aChoice = 1;
NE1 = Build(CurE );
NE2 = Build(NextE);
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
GetEdgesOrientedInFace (NE2, FIO, theAsDes, NE2seq);
anOr1 = TopAbs_REVERSED;
anOr2 = TopAbs_FORWARD;
}
else if (Build.IsBound(CurE) && MES.IsBound(NEO)) {
aChoice = 2;
NE1 = Build(CurE);
NE2 = MES (NEO);
NE2.Orientation (NextE.Orientation());
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
NE2seq.Append (NE2);
anOr1 = TopAbs_REVERSED;
anOr2 = TopAbs_FORWARD;
}
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
aChoice = 3;
NE1 = Build(NextE);
NE2 = MES(CEO);
Standard_Boolean Tmp = ToReverse1;
ToReverse1 = ToReverse2;
ToReverse2 = Tmp;
NE2.Orientation (CurE.Orientation());
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
NE2seq.Append (NE2);
anOr1 = TopAbs_FORWARD;
anOr2 = TopAbs_REVERSED;
}
else {
DoInter = 0;
@@ -1583,23 +1778,43 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
// NE1,NE2 can be a compound of Edges.
//------------------------------------
Standard_Boolean bCoincide;
TopExp_Explorer Exp1, Exp2;
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
TopoDS_Edge aE1 = TopoDS::Edge(Exp1.Current());
for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) {
TopoDS_Edge aE2 = TopoDS::Edge(Exp2.Current());
//Correct orientation of edges
if (ToReverse1)
aE1.Reverse();
if (ToReverse2)
aE2.Reverse();
//////////////////////////////
RefEdgeInter(FIO, BAsurf, aE1, aE2, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
}
TopoDS_Edge aE1, aE2;
if (aChoice == 1 || aChoice == 2)
{
aE1 = TopoDS::Edge (NE1seq.Last());
aE2 = TopoDS::Edge (NE2seq.First());
}
else // aChoice == 3
{
aE1 = TopoDS::Edge (NE1seq.First());
aE2 = TopoDS::Edge (NE2seq.Last());
}
if (aE1.Orientation() == TopAbs_REVERSED)
anOr1 = TopAbs::Reverse(anOr1);
if (aE2.Orientation() == TopAbs_REVERSED)
anOr2 = TopAbs::Reverse(anOr2);
RefEdgeInter(FIO, BAsurf, aE1, aE2, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, theImageVV, theDMVV, bCoincide);
if (theEdgeIntEdges.IsBound(aE1))
theEdgeIntEdges(aE1).Append(aE2);
else
{
TopTools_ListOfShape aElist;
aElist.Append(aE2);
theEdgeIntEdges.Bind (aE1, aElist);
}
if (theEdgeIntEdges.IsBound(aE2))
theEdgeIntEdges(aE2).Append(aE1);
else
{
TopTools_ListOfShape aElist;
aElist.Append(aE1);
theEdgeIntEdges.Bind (aE2, aElist);
}
//
// check if some of the offset edges have been
// generated out of the common vertex
@@ -1622,7 +1837,6 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
}
}
CurE = wexp.Current();
ToReverse1 = ToReverse2;
}
}
return Standard_True;
@@ -1682,7 +1896,6 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
if (CurE.IsSame(NextE)) continue;
//
TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
if (!Build.IsBound(Vref)) {
CurE = NextE;
continue;
@@ -1697,6 +1910,7 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
TopoDS_Edge NEO = TopoDS::Edge(aLocalShape);
//
TopoDS_Shape NE1,NE2;
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
NE1 = Build(CurE );
@@ -1729,8 +1943,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with first edge
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
BRepAlgo_Image anEmptyImage;
RefEdgeInter(FIO, BAsurf, aE1, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E1
Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1740,8 +1955,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with second edge
for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE2, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
BRepAlgo_Image anEmptyImage;
RefEdgeInter(FIO, BAsurf, aE2, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E2
Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1759,8 +1975,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
for (Exp1.Next(); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current());
if (aME.Contains(aE3Next)) {
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
BRepAlgo_Image anEmptyImage;
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
}
}
}
@@ -1795,7 +2012,8 @@ static void MakeChain(const TopoDS_Shape& theV,
//purpose :
//=======================================================================
Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes)
const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV)
{
BRep_Builder aBB;
TopTools_MapOfShape aMVDone;
@@ -1837,6 +2055,11 @@ Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMap
}
// and replace the vertex
theAsDes->Replace(aVOld, aVNew);
if (theImageVV.IsImage(aVOld))
{
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (theImageVV.ImageFrom(aVOld));
theImageVV.Add (aProVertex, aVNew.Oriented(TopAbs_FORWARD));
}
}
}
return Standard_True;

View File

@@ -24,14 +24,17 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class BRepAlgo_AsDes;
class TopoDS_Face;
class BRepAlgo_Image;
class BRepOffset_Analyse;
class BRepOffset_Offset;
class TopoDS_Edge;
class TopoDS_Face;
//! Computes the intersections betwwen edges on a face
//! Computes the intersections between edges on a face
//! stores result is SD as AsDes from BRepOffset.
class BRepOffset_Inter2d
{
@@ -50,6 +53,7 @@ public:
const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
//! Computes the intersection between the offset edges of the <FI>.
@@ -58,15 +62,18 @@ public:
//! have to be fused using the FuseVertices method.
//! theDMVV contains the vertices that should be fused.
Standard_EXPORT static Standard_Boolean ConnexIntByInt (const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
//! Computes the intersection between the offset edges generated
//! from vertices and stored into AsDes as descendants of the <FI>.
@@ -88,7 +95,9 @@ public:
//! and updates AsDes by replacing the old vertices
//! with the new ones.
Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes);
const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV);
//! extents the edge
Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E,
TopoDS_Edge& NE,

View File

@@ -169,6 +169,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
{
TopTools_ListOfShape LInt1, LInt2;
TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
if (F1.IsSame(F2)) return;
if (IsDone(F1,F2)) return;
@@ -221,11 +222,11 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
}
}
else {
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
}
}
}
@@ -236,7 +237,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
}
else {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
}
}
Store (F1,F2,LInt1,LInt2);
@@ -259,6 +260,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
TopTools_ListOfShape LInt1,LInt2;
TopoDS_Face F1,F2;
TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
//---------------------------------------------------------------------
// etape 1 : Intersection of faces // corresponding to the initial faces
@@ -273,10 +275,13 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
//-----------------------------------------------------------
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
if (Anc.Extent() == 2) {
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First());
const TopoDS_Face& InitF1 = TopoDS::Face(Anc.First());
const TopoDS_Face& InitF2 = TopoDS::Face(Anc.Last());
F1 = TopoDS::Face(InitOffsetFace.Image(InitF1).First());
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True);
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,InitF1,InitF2);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -361,7 +366,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -371,7 +376,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -635,7 +640,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
//
if (!IsDone(NF1,NF2)) {
TopTools_ListOfShape LInt1,LInt2;
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge);
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,F1,F2);
SetDone(NF1,NF2);
if (!LInt1.IsEmpty()) {
Store (NF1,NF2,LInt1,LInt2);
@@ -1034,7 +1039,7 @@ void BRepOffset_Inter3d::ContextIntByInt
TopTools_ListOfShape LInt1,LInt2;
TopTools_ListOfShape LOE;
LOE.Append(OE);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,CF,F);
SetDone(NF,CF);
if (!LInt1.IsEmpty()) {
Store (CF,NF,LInt1,LInt2);
@@ -1086,6 +1091,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
TopoDS_Edge OE;
BRep_Builder B;
TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
Standard_Integer j;
for (j = 1; j <= ContextFaces.Extent(); j++) {
@@ -1255,7 +1261,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
// If no trace try intersection.
//-------------------------------------------------------
if (LInt1.IsEmpty()) {
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
}
Store (CF,OF1,LInt1,LInt2);
}

View File

@@ -51,12 +51,14 @@ BRepOffset_MakeLoops::BRepOffset_MakeLoops()
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image)
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV)
{
TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap );
Loops.SetImageVV (theImageVV);
for (; it.More(); it.Next()) {
const TopoDS_Face& F = TopoDS::Face(it.Value());

View File

@@ -39,11 +39,20 @@ public:
Standard_EXPORT BRepOffset_MakeLoops();
Standard_EXPORT void Build (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image);
Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext, const BRepOffset_Analyse& Analyse, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image, const Standard_Boolean InSide);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Standard_Boolean InSide);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image);

View File

@@ -591,6 +591,7 @@ BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S,
:
myOffset (Offset),
myTol (Tol),
myInitialShape (S),
myShape (S),
myMode (Mode),
myInter (Inter),
@@ -623,6 +624,7 @@ void BRepOffset_MakeOffset::Initialize(const TopoDS_Shape& S,
const Standard_Boolean RemoveIntEdges)
{
myOffset = Offset;
myInitialShape = S;
myShape = S;
myTol = Tol;
myMode = Mode;
@@ -650,9 +652,11 @@ void BRepOffset_MakeOffset::Clear()
myInitOffsetFace .Clear();
myInitOffsetEdge .Clear();
myImageOffset .Clear();
myImageVV .Clear();
myFaces .Clear();
myOriginalFaces .Clear();
myFaceOffset .Clear();
myEdgeIntEdges .Clear();
myAsDes ->Clear();
myDone = Standard_False;
myGenerated.Clear();
@@ -1256,7 +1260,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
{
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, aDMVV);
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
}
//----------------------------------------------
// Intersections 2d on caps.
@@ -1266,10 +1270,10 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
{
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, aDMVV);
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
}
//
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes);
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV);
//-------------------------------
// Unwinding of extended Faces.
//-------------------------------
@@ -1286,7 +1290,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
}
}
else {
myMakeLoops.Build(LFE, AsDes, IMOE);
myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV);
}
//
#ifdef OCCT_DEBUG
@@ -2526,10 +2530,10 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
Standard_Integer i;
for (i = 1; i <= Modif.Extent(); i++) {
const TopoDS_Face& F = TopoDS::Face(Modif(i));
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol, aDMVV);
BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV);
}
//
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV);
//
#ifdef OCCT_DEBUG
if (AffichInt2d) {
@@ -2569,7 +2573,7 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset);
}
else {
myMakeLoops.Build(LF,myAsDes,myImageOffset);
myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV);
}
//-----------------------------------------
@@ -3345,7 +3349,7 @@ const BRepAlgo_Image& BRepOffset_MakeOffset::OffsetEdgesFromShapes() const
const TopTools_IndexedMapOfShape& BRepOffset_MakeOffset::ClosingFaces () const
{
return myFaces;
return myOriginalFaces;
}
@@ -3998,8 +4002,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
{
const TopoDS_Face& aF = TopoDS::Face (it.Value());
aTolF = BRep_Tool::Tolerance (aF);
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes2d,
myOffset, aTolF, myAnalyse, aMFV, aDMVV))
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d,
myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV))
{
myError = BRepOffset_CannotExtentEdge;
return;
@@ -4015,7 +4019,7 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
}
//
// fuse vertices on edges
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d))
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d, myImageVV))
{
myError = BRepOffset_CannotFuseVertices;
return;
@@ -4490,9 +4494,24 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
Standard_FALLTHROUGH
case TopAbs_FACE:
{
if (myInitOffsetFace.HasImage (theS))
TopoDS_Shape aS = theS;
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
if (aPlanface)
aS = TopoDS::Face(*aPlanface);
if (!myFaces.Contains (aS) &&
myInitOffsetFace.HasImage (aS))
{
myInitOffsetFace.LastImage (theS, myGenerated);
myInitOffsetFace.LastImage (aS, myGenerated);
if (!myFaces.IsEmpty())
{
// Reverse generated shapes in case of small solids.
// Useful only for faces without influence on others.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
}
break;
}
@@ -4524,9 +4543,33 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape&)
const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape& theShape)
{
myGenerated.Clear();
if (theShape.ShapeType() == TopAbs_FACE)
{
TopoDS_Shape aS = theShape;
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
if (aPlanface)
aS = TopoDS::Face(*aPlanface);
if (myFaces.Contains (aS) &&
myInitOffsetFace.HasImage (aS))
{
myInitOffsetFace.LastImage (aS, myGenerated);
if (!myFaces.IsEmpty())
{
// Reverse generated shapes in case of small solids.
// Useful only for faces without influence on others.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
}
}
return myGenerated;
}

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