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

Compare commits

...

32 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
206 changed files with 4035 additions and 2089 deletions

View File

@@ -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)

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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -655,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

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

@@ -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;
}

View File

@@ -97,7 +97,7 @@ public:
const TopoDS_Shape& InitShape() const
{
return myShape;
return myInitialShape;
}
//! returns information about offset state.
@@ -231,6 +231,7 @@ private:
Standard_Real myOffset;
Standard_Real myTol;
TopoDS_Shape myInitialShape;
TopoDS_Shape myShape;
TopoDS_Compound myFaceComp;
BRepOffset_Mode myMode;
@@ -248,8 +249,10 @@ private:
BRepAlgo_Image myInitOffsetFace;
BRepAlgo_Image myInitOffsetEdge;
BRepAlgo_Image myImageOffset;
BRepAlgo_Image myImageVV;
TopTools_ListOfShape myWalls;
Handle(BRepAlgo_AsDes) myAsDes;
TopTools_DataMapOfShapeListOfShape myEdgeIntEdges;
Standard_Boolean myDone;
BRepOffset_Error myError;
BRepOffset_MakeLoops myMakeLoops;

View File

@@ -5678,7 +5678,9 @@ void IntersectFaces(const TopoDS_Shape& theFInv,
TopAbs_State aSide = TopAbs_OUT;
TopTools_ListOfShape aLInt1, aLInt2;
TopoDS_Edge aNullEdge;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide, aNullEdge);
TopoDS_Face aNullFace;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide,
aNullEdge, aNullFace, aNullFace);
//
if (aLInt1.IsEmpty()) {
return;

View File

@@ -1401,8 +1401,9 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
TopTools_ListOfShape& L1,
TopTools_ListOfShape& L2,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined)
const TopoDS_Edge& RefEdge,
const TopoDS_Face& theRefFace1,
const TopoDS_Face& theRefFace2)
{
#ifdef DRAW
if (AffichInter) {
@@ -1445,7 +1446,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
aPF.Perform();
TopTools_IndexedMapOfShape TrueEdges;
if (IsRefEdgeDefined)
if (!RefEdge.IsNull())
CheckIntersFF( aPF.PDS(), RefEdge, TrueEdges );
Standard_Boolean addPCurve1 = 1;
@@ -1494,33 +1495,33 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F1)) {
Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d();
if(!aC3DETrim.IsNull()) {
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l, aC2d, aC2dNew, aContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge);
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l, aC2d, aC2dNew, aContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge);
}
if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F2)) {
Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d();
if(!aC3DETrim.IsNull()) {
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l, aC2d, aC2dNew, aContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge);
Handle(Geom2d_Curve) aC2dNew;
if(aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l, aC2d, aC2dNew, aContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext);
}
aC2d = aC2dNew;
}
BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge);
}
OrientSection (anEdge, F1, F2, O1, O2);
@@ -1563,6 +1564,84 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
isEl2 = Standard_True;
if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
{
//remove excess edges that are out of range
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (RefEdge, aV1, aV2);
if (!aV1.IsSame(aV2)) //only if RefEdge is open
{
Handle(Geom_Surface) aRefSurf1 = BRep_Tool::Surface (theRefFace1);
Handle(Geom_Surface) aRefSurf2 = BRep_Tool::Surface (theRefFace2);
if (aRefSurf1->IsUClosed() || aRefSurf1->IsVClosed() ||
aRefSurf2->IsUClosed() || aRefSurf2->IsVClosed())
{
TopoDS_Edge MinAngleEdge;
Standard_Real MinAngle = Precision::Infinite();
BRepAdaptor_Curve aRefBAcurve (RefEdge);
gp_Pnt aRefPnt = aRefBAcurve.Value ((aRefBAcurve.FirstParameter() + aRefBAcurve.LastParameter())/2);
TopTools_ListIteratorOfListOfShape itl (L1);
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (itl.Value());
BRepAdaptor_Curve aBAcurve (anEdge);
gp_Pnt aMidPntOnEdge = aBAcurve.Value ((aBAcurve.FirstParameter() + aBAcurve.LastParameter())/2);
gp_Vec RefToMid (aRefPnt, aMidPntOnEdge);
Extrema_ExtPC aProjector (aRefPnt, aBAcurve);
if (aProjector.IsDone())
{
Standard_Integer imin = 0;
Standard_Real MinSqDist = Precision::Infinite();
for (Standard_Integer ind = 1; ind <= aProjector.NbExt(); ind++)
{
Standard_Real aSqDist = aProjector.SquareDistance(ind);
if (aSqDist < MinSqDist)
{
MinSqDist = aSqDist;
imin = ind;
}
}
if (imin != 0)
{
gp_Pnt aProjectionOnEdge = aProjector.Point(imin).Value();
gp_Vec RefToProj (aRefPnt, aProjectionOnEdge);
Standard_Real anAngle = RefToProj.Angle(RefToMid);
if (anAngle < MinAngle)
{
MinAngle = anAngle;
MinAngleEdge = anEdge;
}
}
}
}
if (!MinAngleEdge.IsNull())
{
TopTools_ListIteratorOfListOfShape itlist1 (L1);
TopTools_ListIteratorOfListOfShape itlist2 (L2);
while (itlist1.More())
{
const TopoDS_Shape& anEdge = itlist1.Value();
if (anEdge.IsSame(MinAngleEdge))
{
itlist1.Next();
itlist2.Next();
}
else
{
L1.Remove(itlist1);
L2.Remove(itlist2);
}
}
}
} //if closed
} //if (!aV1.IsSame(aV2))
} //if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
if (L1.Extent() > 1 && (!isEl1 || !isEl2)) {
TopTools_SequenceOfShape eseq;
TopTools_SequenceOfShape EdgesForConcat;
@@ -1724,7 +1803,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
eseq.Append( aLocalEdgesForConcat(j) );
else
eseq.Append( AssembledEdge );
}
} //for (i = 1; i <= wseq.Length(); i++)
} //end of else (when TrueEdges is empty)
if (eseq.Length() < L1.Extent())
@@ -3468,7 +3547,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
if (ConstShapes.IsBound(E)) ToBuild.UnBind(E);
if (ToBuild.IsBound(E)) {
EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False);
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,Standard_True);
TopoDS_Face NullFace;
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,NullFace,NullFace);
// No intersection, it may happen for example for a chosen (non-offseted) planar face and
// its neighbour offseted cylindrical face, if the offset is directed so that
// the radius of the cylinder becomes smaller.

View File

@@ -87,9 +87,10 @@ public:
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined = Standard_False);
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const TopoDS_Face& RefFace1,
const TopoDS_Face& RefFace2);
//! Find if the edges <Edges> of the face <F2> are on
//! the face <F1>.

View File

@@ -1780,10 +1780,12 @@ void BiTgte_Blend::ComputeCenters()
}
}
}
TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes,
CurOF,
myEdges,
myTol,
anEmptyMap,
aDMVV);
}
}
@@ -1813,20 +1815,23 @@ void BiTgte_Blend::ComputeCenters()
myAsDes->Add(CurOF,CurOE);
}
TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes,
CurOF,
myEdges,
myTol,
anEmptyMap,
aDMVV);
}
//
// fuse vertices on edges stored in AsDes
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
BRepAlgo_Image anEmptyImage;
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, anEmptyImage);
// ------------
// unwinding
// ------------
BRepOffset_MakeLoops MakeLoops;
MakeLoops.Build( LOF, myAsDes, myImageOffset );
MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage);
// ------------------------------------------------------------
// It is possible to unwind edges at least one ancestor which of

View File

@@ -123,20 +123,25 @@ Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
UOnCyl = ElCLib::InPeriod(UOnCyl,fu,fu+2*M_PI);
ElSLib::Parameters(Pln,OrFillet,UOnPln,VOnPln);
gp_Vec XDir,OtherDir;
XDir = NorF.Reversed();
OtherDir = gp_Dir(gp_Vec(OrFillet,ElSLib::Value(UOnCyl,VOnCyl,Cyl)));
if (!plandab) {
gp_Vec tmp = XDir;
XDir = OtherDir;
OtherDir = tmp;
gp_Vec XDir, OtherDir;
if (plandab)
{
XDir = NorF.Reversed();
OtherDir = gp_Vec(OrFillet, ElSLib::Value(UOnCyl, VOnCyl, Cyl));
OtherDir.Normalize();
}
gp_Ax3 AxFil (OrFillet,DirFillet,XDir);
// construction YDir to go from face1 to face2.
if ((XDir^OtherDir).Dot(DirFillet) < 0.)
else
{
OtherDir = NorF.Reversed();
XDir = gp_Vec(OrFillet, ElSLib::Value(UOnCyl, VOnCyl, Cyl));
XDir.Normalize();
}
gp_Ax3 AxFil (OrFillet, DirFillet, XDir);
gp_Vec aProd = XDir.Crossed(OtherDir);
if (aProd.Dot(DirFillet) < 0.)
AxFil.YReverse();
Handle(Geom_CylindricalSurface)
Fillet = new Geom_CylindricalSurface(AxFil,Radius);
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(Fillet,DStr));
@@ -149,8 +154,10 @@ Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
gp_Lin2d Lin2dPln(PPln2d,VPln2d);
gp_Pnt POnPln = ElSLib::Value(UOnPln,VOnPln,Pln);
gp_Lin C3d(POnPln,DirFillet);
Standard_Real UOnFillet,V;
ElSLib::CylinderParameters(AxFil,Radius,POnPln,UOnFillet,V);
if(UOnFillet > M_PI) UOnFillet = 0.;
gp_Lin2d LOnFillet(gp_Pnt2d(UOnFillet,V),gp::DY2d());
Handle(Geom_Line) L3d = new Geom_Line (C3d);

View File

@@ -1042,7 +1042,7 @@ static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
Standard_CString expr (arg[3]);
Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
aR->SetRelation(expr);
aR->SetRelation(TCollection_ExtendedString (expr, Standard_True));
Handle(TDataStd_Variable) aV;
for (Standard_Integer i = 4; i < nb; i++)
@@ -1222,7 +1222,8 @@ static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
j = j + 2;
for(Standard_Integer i = From; i<=To; ++i) {
A->SetValue(i, arg[j] );
TCollection_ExtendedString aVal (arg[j], Standard_True);
A->SetValue(i, aVal);
j++;
}
}
@@ -1256,7 +1257,8 @@ static Standard_Integer DDataStd_SetExtStringArrayValue (Draw_Interpretor&,
Handle(TDataStd_ExtStringArray) arr;
if (label.FindAttribute(TDataStd_ExtStringArray::GetID(), arr))
{
arr->SetValue(index, arg[4]);
TCollection_ExtendedString aVal(arg[4], Standard_True);
arr->SetValue(index, aVal);
return 0;
}
@@ -3444,13 +3446,14 @@ static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasInteger(arg[3])) {
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasInteger(aKey)) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(aKey)<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
Draw::Set(arg[4], anAtt->GetInteger(aKey));
return 0;
}
}
@@ -3560,13 +3563,14 @@ static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasReal(arg[3])) {
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasReal(aKey)) {
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(aKey)<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetReal(arg[3]));
Draw::Set(arg[4], anAtt->GetReal(aKey));
return 0;
}
}
@@ -3693,14 +3697,15 @@ static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if (!anAtt->HasString(arg[3]))
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasString(aKey))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
}
else
{
TCollection_AsciiString aValue (anAtt->GetString(arg[3]));
TCollection_AsciiString aValue (anAtt->GetString(aKey));
std::cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << std::endl;
if(nb == 5)
Draw::Set(arg[4], aValue.ToCString());
@@ -3815,16 +3820,17 @@ static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if (!anAtt->HasByte(arg[3]))
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasByte(aKey))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
}
else
{
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(aKey)<< std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetByte(arg[3]));
Draw::Set(arg[4], anAtt->GetByte(aKey));
return 0;
}
}
@@ -3948,7 +3954,8 @@ static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if (!anAtt->HasArrayOfIntegers(arg[3]))
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasArrayOfIntegers(aKey))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
@@ -3957,7 +3964,7 @@ static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
{
std::cout << "Key = " << arg[3] <<std::endl;
Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(aKey);
if(!anArrValue.IsNull()) {
Standard_Integer lower = anArrValue->Lower();
Standard_Integer upper = anArrValue->Upper();
@@ -4088,13 +4095,14 @@ static Standard_Integer DDataStd_GetNDRealArray (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
if(!anAtt->HasArrayOfReals(arg[3])) {
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasArrayOfReals(aKey)) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
std::cout << "Key = " << arg[3] <<std::endl;
Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(arg[3]);
Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(aKey);
if(!anArrValue.IsNull()) {
Standard_Integer lower = anArrValue->Lower();
Standard_Integer upper = anArrValue->Upper();

View File

@@ -127,7 +127,7 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
const char** a)
{
if (nb >= 3) {
TCollection_ExtendedString path (a[1]);
TCollection_ExtendedString path (a[1], Standard_True);
Handle(TDocStd_Application) A = DDocStd::GetApplication();
Handle(TDocStd_Document) D;
Standard_Integer insession = A->IsInSession(path);
@@ -245,7 +245,7 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
if (nb >= 3) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_ExtendedString path (a[2]);
TCollection_ExtendedString path (a[2], Standard_True);
Handle(TDocStd_Application) A = DDocStd::GetApplication();
PCDM_StoreStatus theStatus;
@@ -423,7 +423,7 @@ static Standard_Integer DDocStd_Path (Draw_Interpretor& di,
const char** a)
{
if (nb == 2) {
TDocStd_PathParser path (a[1]);
TDocStd_PathParser path (TCollection_ExtendedString (a[1], Standard_True));
di << "Trek : " << path.Trek() << "\n";
di << "Name : " << path.Name() << "\n";
di << "Extension : " << path.Extension() << "\n";
@@ -445,7 +445,7 @@ static Standard_Integer DDocStd_AddComment (Draw_Interpretor& di,
if (nb == 3) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_ExtendedString comment (a[2]);
TCollection_ExtendedString comment (a[2], Standard_True);
// Handle(TDocStd_Application) A = DDocStd::GetApplication();
// A->AddComment(D,comment);
D->AddComment(comment);

View File

@@ -109,7 +109,7 @@ static int mtmCommitTransaction (Draw_Interpretor& di, int n, const char** a)
return 1;
}
if(n > 1)
sMultiTransactionManager->CommitCommand(a[1]);
sMultiTransactionManager->CommitCommand(TCollection_ExtendedString (a[1], Standard_True));
else
sMultiTransactionManager->CommitCommand();
return 0;

View File

@@ -453,7 +453,7 @@ static Standard_Integer DNaming_ImportShape (Draw_Interpretor& di,
const TopoDS_Shape& aShape = DBRep::Get(a[3]);
if(aShape.IsNull()) return 1;
if(nb == 5) {
TDataStd_Name::Set(L, a[4]);
TDataStd_Name::Set(L, TCollection_ExtendedString (a[4], Standard_True));
}
DNaming::LoadImportedShape(L, aShape);

View File

@@ -105,7 +105,7 @@ static Standard_Integer DNaming_AddObject(Draw_Interpretor& di,
Handle(TDataStd_UAttribute) anObj = AddObject (aDoc);
if(!anObj.IsNull()) {
if(nb == 3)
TDataStd_Name::Set(anObj->Label(), a[2]);
TDataStd_Name::Set(anObj->Label(), TCollection_ExtendedString (a[2], Standard_True));
DDF::ReturnLabel(di, anObj->Label());
return 0;
}

View File

@@ -11,10 +11,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Draw_ProgressIndicator.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Message_ProgressScope.hxx>
@@ -64,8 +64,12 @@ Draw_ProgressIndicator::~Draw_ProgressIndicator()
void Draw_ProgressIndicator::Reset()
{
Message_ProgressIndicator::Reset();
if ( myShown ) {
if (myShown)
{
// eval will reset current string result - backup it beforehand
const TCollection_AsciiString aTclResStr (myDraw->Result());
myDraw->Eval ( "destroy .xprogress" );
*myDraw << aTclResStr;
myShown = Standard_False;
}
myBreak = Standard_False;
@@ -147,6 +151,8 @@ void Draw_ProgressIndicator::Show (const Message_ProgressScope& theScope, const
"/" << ( aTime - myStartTime ) / GetPosition() << " sec";
}
// eval will reset current string result - backup it beforehand
const TCollection_AsciiString aTclResStr (myDraw->Result());
if ( ! myShown ) {
char command[1024];
Sprintf ( command, "toplevel .xprogress -height 100 -width 410;"
@@ -168,7 +174,9 @@ void Draw_ProgressIndicator::Show (const Message_ProgressScope& theScope, const
aCommand << ".xprogress.bar coords progress_next 2 2 " << (1 + 400 * theScope.GetPortion()) << " 21;";
aCommand << ".xprogress.text configure -text \"" << aText.str() << "\";";
aCommand << "update";
myDraw->Eval (aCommand.str().c_str());
*myDraw << aTclResStr;
}
// Print textual progress info
@@ -313,5 +321,3 @@ Standard_Address &Draw_ProgressIndicator::StopIndicator()
static Standard_Address stopIndicator = 0;
return stopIndicator;
}

View File

@@ -208,12 +208,13 @@ Standard_Integer Extrema_FuncExtCS::GetStateNumber()
std::cout <<"F(1)= "<<Sol(1)<<" F(2)= "<<Sol(2)<<" F(3)= "<<Sol(3)<<std::endl;
#endif
//comparison of solution with previous solutions
Standard_Real tol2d = Precision::PConfusion() * Precision::PConfusion();
Standard_Real tol2d = Precision::SquarePConfusion();
Standard_Integer i = 1, nbSol = mySqDist.Length();
for( ; i <= nbSol; i++)
{
Standard_Real aT = myPoint1(i).Parameter();
if( (myt - aT) * (myt - aT) <= tol2d )
aT -= myt; aT *= aT;
if( aT <= tol2d )
break;
}
if (i <= nbSol)

View File

@@ -38,6 +38,8 @@
#include <TColgp_Array1OfPnt.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <ElCLib.hxx>
#include <Extrema_GenLocateExtPS.hxx>
const Standard_Real MaxParamVal = 1.0e+10;
const Standard_Real aBorderDivisor = 1.0e+4;
@@ -331,8 +333,8 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
// Find min approximation
math_FunctionSetRoot anA(myF, Tol);
anA.Perform(myF, TUV, TUVinf, TUVsup);
myDone = Standard_True;
}
//=======================================================================
//function : GlobMinGenCS
@@ -447,6 +449,7 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
anUVsup(i) = theTUVsup(i + 1);
}
//
//
math_PSOParticlesPool aParticles(theNbParticles, aNbVar);
math_Vector aMinUV(1, aNbVar);
@@ -517,10 +520,103 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
aCT = ElCLib::InPeriod(aCT, theTUVinf(1), theTUVinf(1) + 2. * M_PI);
}
}
theTUV(1) = aCT;
theTUV(2) = anUV(1);
theTUV(3) = anUV(2);
Standard_Boolean isBadSol = Standard_False;
gp_Vec aDU, aDV, aDT;
gp_Pnt aPOnS, aPOnC;
myS->D1(anUV(1), anUV(2), aPOnS, aDU, aDV);
theC.D1(aCT, aPOnC, aDT);
Standard_Real aSqDist = aPOnC.SquareDistance(aPOnS);
if (aSqDist <= Precision::SquareConfusion())
return;
gp_Vec aN = aDU.Crossed(aDV);
if (aN.SquareMagnitude() < Precision::SquareConfusion())
return;
gp_Vec PcPs(aPOnC, aPOnS);
Standard_Real anAngMin = M_PI_2 - M_PI_2 / 10.;
Standard_Real anAngMax = M_PI_2 + M_PI_2 / 10.;
Standard_Real anAngN = PcPs.Angle(aN);
if (anAngN >= anAngMin && anAngN <= anAngMax)
{
// PcPs is perpendicular to surface normal, it means that
// aPOnC can be on surface, but far from aPOnS
isBadSol = Standard_True;
Standard_Integer iu, iv;
for (iu = -1; iu <= 1; ++iu)
{
Standard_Real u = anUV(1) + iu * aStepSU;
u = Max(anUVinf(1), u);
u = Min(anUVsup(1), u);
for (iv = -1; iv <= 1; ++iv)
{
Standard_Real v = anUV(2) + iv * aStepSV;
v = Max(anUVinf(2), v);
v = Min(anUVsup(2), v);
myS->D1(u, v, aPOnS, aDU, aDV);
if (aPOnC.SquareDistance(aPOnS) < Precision::SquareConfusion())
{
isBadSol = Standard_False;
break;
}
aN = aDU.Crossed(aDV);
if (aN.SquareMagnitude() < Precision::SquareConfusion())
{
isBadSol = Standard_False;
break;
}
PcPs.SetXYZ(aPOnS.XYZ() - aPOnC.XYZ());
anAngN = PcPs.Angle(aN);
if (anAngN < anAngMin || anAngN > anAngMax)
{
isBadSol = Standard_False;
break;
}
}
if (!isBadSol)
{
break;
}
}
}
if (isBadSol)
{
//Try to precise solution with help of Extrema PS
math_Vector aF(1, 3);
aF(1) = PcPs.Dot(aDT);
aF(2) = PcPs.Dot(aDU);
aF(3) = PcPs.Dot(aDV);
Standard_Real aFF = aF.Norm2();
Extrema_GenLocateExtPS anExtPS(*myS, mytol2, mytol2);
anExtPS.Perform(aPOnC, anUV(1), anUV(2), Standard_False);
if (anExtPS.IsDone())
{
const Extrema_POnSurf& aPmin = anExtPS.Point();
aPmin.Parameter(anUV(1), anUV(2));
math_Vector aTUV = theTUV;
aTUV(2) = anUV(1);
aTUV(3) = anUV(2);
myF.Value(aTUV, aF);
Standard_Real aFF1 = aF.Norm2();
if (anExtPS.SquareDistance() < aSqDist && aFF1 <= 1.1 * aFF)
{
theTUV(2) = aTUV(2);
theTUV(3) = aTUV(3);
}
}
}
}
//=======================================================================
//function : GlobMinCQuadric

View File

@@ -598,7 +598,8 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC,
new Geom_BSplineSurface(anApprox.SurfPoles(), anApprox.SurfWeights(),
anApprox.SurfUKnots(), anApprox.SurfVKnots(),
anApprox.SurfUMults(), anApprox.SurfVMults(),
anApprox.UDegree(), anApprox.VDegree());
anApprox.UDegree(), anApprox.VDegree(),
section.IsPeriodic());
}
else {

View File

@@ -27,7 +27,7 @@ namespace
static Handle(Graphic3d_AspectFillArea3d) defaultAspect()
{
Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
Graphic3d_MaterialAspect aMaterial (Graphic3d_NameOfMaterial_DEFAULT);
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
anAspect->SetDistinguishOff();
anAspect->SetFrontMaterial (aMaterial);

View File

@@ -53,7 +53,7 @@ public:
//! - Equation (0.0, 0.0, 1.0, 0)
//! - IsOn (True),
//! - IsCapping (False),
//! - Material (Graphic3d_NOM_DEFAULT),
//! - Material (Graphic3d_NameOfMaterial_DEFAULT),
//! - Texture (NULL),
//! - HatchStyle (Aspect_HS_HORIZONTAL),
//! - IsHatchOn (False)

View File

@@ -42,32 +42,32 @@ namespace
//! Name list of standard materials (defined within enumeration).
static const RawMaterial THE_MATERIALS[] =
{
RawMaterial (Graphic3d_NOM_BRASS, "Brass"),
RawMaterial (Graphic3d_NOM_BRONZE, "Bronze"),
RawMaterial (Graphic3d_NOM_COPPER, "Copper"),
RawMaterial (Graphic3d_NOM_GOLD, "Gold"),
RawMaterial (Graphic3d_NOM_PEWTER, "Pewter"),
RawMaterial (Graphic3d_NOM_PLASTER, "Plastered"),
RawMaterial (Graphic3d_NOM_PLASTIC, "Plastified"),
RawMaterial (Graphic3d_NOM_SILVER, "Silver"),
RawMaterial (Graphic3d_NOM_STEEL, "Steel"),
RawMaterial (Graphic3d_NOM_STONE, "Stone"),
RawMaterial (Graphic3d_NOM_SHINY_PLASTIC, "Shiny_plastified"),
RawMaterial (Graphic3d_NOM_SATIN, "Satined"),
RawMaterial (Graphic3d_NOM_METALIZED, "Metalized"),
RawMaterial (Graphic3d_NOM_NEON_GNC, "Ionized"),
RawMaterial (Graphic3d_NOM_CHROME, "Chrome"),
RawMaterial (Graphic3d_NOM_ALUMINIUM, "Aluminium"),
RawMaterial (Graphic3d_NOM_OBSIDIAN, "Obsidian"),
RawMaterial (Graphic3d_NOM_NEON_PHC, "Neon"),
RawMaterial (Graphic3d_NOM_JADE, "Jade"),
RawMaterial (Graphic3d_NOM_CHARCOAL, "Charcoal"),
RawMaterial (Graphic3d_NOM_WATER, "Water"),
RawMaterial (Graphic3d_NOM_GLASS, "Glass"),
RawMaterial (Graphic3d_NOM_DIAMOND, "Diamond"),
RawMaterial (Graphic3d_NOM_TRANSPARENT, "Transparent"),
RawMaterial (Graphic3d_NOM_DEFAULT, "Default"),
RawMaterial (Graphic3d_NOM_UserDefined, "UserDefined")
RawMaterial (Graphic3d_NameOfMaterial_Brass, "Brass"),
RawMaterial (Graphic3d_NameOfMaterial_Bronze, "Bronze"),
RawMaterial (Graphic3d_NameOfMaterial_Copper, "Copper"),
RawMaterial (Graphic3d_NameOfMaterial_Gold, "Gold"),
RawMaterial (Graphic3d_NameOfMaterial_Pewter, "Pewter"),
RawMaterial (Graphic3d_NameOfMaterial_Plastered, "Plastered"),
RawMaterial (Graphic3d_NameOfMaterial_Plastified, "Plastified"),
RawMaterial (Graphic3d_NameOfMaterial_Silver, "Silver"),
RawMaterial (Graphic3d_NameOfMaterial_Steel, "Steel"),
RawMaterial (Graphic3d_NameOfMaterial_Stone, "Stone"),
RawMaterial (Graphic3d_NameOfMaterial_ShinyPlastified, "Shiny_plastified"),
RawMaterial (Graphic3d_NameOfMaterial_Satin, "Satined"),
RawMaterial (Graphic3d_NameOfMaterial_Metalized, "Metalized"),
RawMaterial (Graphic3d_NameOfMaterial_Ionized, "Ionized"),
RawMaterial (Graphic3d_NameOfMaterial_Chrome, "Chrome"),
RawMaterial (Graphic3d_NameOfMaterial_Aluminum, "Aluminium"),
RawMaterial (Graphic3d_NameOfMaterial_Obsidian, "Obsidian"),
RawMaterial (Graphic3d_NameOfMaterial_Neon, "Neon"),
RawMaterial (Graphic3d_NameOfMaterial_Jade, "Jade"),
RawMaterial (Graphic3d_NameOfMaterial_Charcoal, "Charcoal"),
RawMaterial (Graphic3d_NameOfMaterial_Water, "Water"),
RawMaterial (Graphic3d_NameOfMaterial_Glass, "Glass"),
RawMaterial (Graphic3d_NameOfMaterial_Diamond, "Diamond"),
RawMaterial (Graphic3d_NameOfMaterial_Transparent, "Transparent"),
RawMaterial (Graphic3d_NameOfMaterial_DEFAULT, "Default"),
RawMaterial (Graphic3d_NameOfMaterial_UserDefined, "UserDefined")
};
}
@@ -88,7 +88,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
{
switch (theName)
{
case Graphic3d_NOM_PLASTIC:
case Graphic3d_NameOfMaterial_Plastified:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.0078125f;
@@ -102,7 +102,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Normalize();
break;
case Graphic3d_NOM_SHINY_PLASTIC:
case Graphic3d_NameOfMaterial_ShinyPlastified:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 1.00f;
@@ -115,7 +115,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Ks = Graphic3d_Vec4 (0.145f, 0.145f, 0.145f, 0.17f);
BSDF.Normalize();
break;
case Graphic3d_NOM_SATIN:
case Graphic3d_NameOfMaterial_Satin:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.09375f;
@@ -128,7 +128,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Ks = Graphic3d_Vec4 (0.6f);
break;
case Graphic3d_NOM_NEON_GNC:
case Graphic3d_NameOfMaterial_Ionized:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.05f;
@@ -142,7 +142,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Le = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
break;
case Graphic3d_NOM_METALIZED:
case Graphic3d_NameOfMaterial_Metalized:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.13f;
@@ -154,7 +154,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.2f)), 0.045f);
break;
case Graphic3d_NOM_BRASS:
case Graphic3d_NameOfMaterial_Brass:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -166,7 +166,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.992f, 0.941f, 0.808f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_BRONZE:
case Graphic3d_NameOfMaterial_Bronze:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -178,7 +178,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.590f, 0.408f, 0.250f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_COPPER:
case Graphic3d_NameOfMaterial_Copper:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -190,7 +190,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.640f, 0.540f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_GOLD:
case Graphic3d_NameOfMaterial_Gold:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -202,7 +202,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.000f, 0.710f, 0.290f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_PEWTER:
case Graphic3d_NameOfMaterial_Pewter:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -214,7 +214,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.333f, 0.333f, 0.522f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_PLASTER:
case Graphic3d_NameOfMaterial_Plastered:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.01f;
@@ -226,7 +226,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Kd = Graphic3d_Vec3 (0.482353f, 0.482353f, 0.482353f);
break;
case Graphic3d_NOM_SILVER:
case Graphic3d_NameOfMaterial_Silver:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -238,7 +238,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.930f, 0.880f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_STEEL:
case Graphic3d_NameOfMaterial_Steel:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -250,7 +250,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.560f, 0.570f, 0.580f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_STONE:
case Graphic3d_NameOfMaterial_Stone:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
// special case for SetColor()
@@ -267,7 +267,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Ks = Graphic3d_Vec4 (0.00392157f, 0.00392157f, 0.00392157f, 0.5f);
break;
case Graphic3d_NOM_CHROME:
case Graphic3d_NameOfMaterial_Chrome:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -279,7 +279,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.975f, 0.975f, 0.975f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_ALUMINIUM:
case Graphic3d_NameOfMaterial_Aluminum:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
@@ -291,7 +291,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.910f, 0.920f, 0.920f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_NEON_PHC:
case Graphic3d_NameOfMaterial_Neon:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.05f;
@@ -305,7 +305,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Le = Graphic3d_Vec3 (0.0f, 1.0f, 0.46f);
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
break;
case Graphic3d_NOM_OBSIDIAN:
case Graphic3d_NameOfMaterial_Obsidian:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.3f;
@@ -317,7 +317,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Kd = Graphic3d_Vec3 (0.023f, 0.f, 0.023f);
BSDF.Ks = Graphic3d_Vec4 (0.0156863f, 0.0156863f, 0.0156863f, 0.1f);
break;
case Graphic3d_NOM_JADE:
case Graphic3d_NameOfMaterial_Jade:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.10f;
@@ -330,7 +330,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Kd = Graphic3d_Vec3 (0.208658f, 0.415686f, 0.218401f);
BSDF.Ks = Graphic3d_Vec4 (0.611765f, 0.611765f, 0.611765f, 0.06f);
break;
case Graphic3d_NOM_CHARCOAL:
case Graphic3d_NameOfMaterial_Charcoal:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.01f;
@@ -342,7 +342,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.Kd = Graphic3d_Vec3 (0.02f, 0.02f, 0.02f);
BSDF.Ks = Graphic3d_Vec4 (0.1f, 0.1f, 0.1f, 0.3f);
break;
case Graphic3d_NOM_WATER:
case Graphic3d_NameOfMaterial_Water:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
RefractionIndex = 1.33f;
@@ -358,7 +358,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.380f, 0.380f, 0.380f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_GLASS:
case Graphic3d_NameOfMaterial_Glass:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
RefractionIndex = 1.62f;
@@ -374,7 +374,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.920f, 0.920f, 0.920f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_DIAMOND:
case Graphic3d_NameOfMaterial_Diamond:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
RefractionIndex = 2.42f;
@@ -391,7 +391,7 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_TRANSPARENT:
case Graphic3d_NameOfMaterial_Transparent:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
RefractionIndex = 1.0f;
@@ -407,14 +407,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_UserDefined:
case Graphic3d_NameOfMaterial_UserDefined:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.1f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.6f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.2f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_DEFAULT:
case Graphic3d_NameOfMaterial_DEFAULT:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.15f));
@@ -431,9 +431,9 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
// purpose :
// =======================================================================
Graphic3d_MaterialAspect::Graphic3d_MaterialAspect()
: myRequestedMaterialName (Graphic3d_NOM_DEFAULT)
: myRequestedMaterialName (Graphic3d_NameOfMaterial_DEFAULT)
{
init (Graphic3d_NOM_DEFAULT);
init (Graphic3d_NameOfMaterial_DEFAULT);
}
// =======================================================================
@@ -511,7 +511,7 @@ void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
const RawMaterial& aSrcMat = THE_MATERIALS[myRequestedMaterialName];
const Quantity_Color anAmbient((Graphic3d_Vec3 )theColor * aSrcMat.AmbientCoef);
const Quantity_Color aDiffuse ((Graphic3d_Vec3 )theColor * aSrcMat.DiffuseCoef);
if (myMaterialName != Graphic3d_NOM_UserDefined
if (myMaterialName != Graphic3d_NameOfMaterial_UserDefined
&& (!myColors[Graphic3d_TOR_AMBIENT].IsEqual (anAmbient)
|| !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (aDiffuse)))
{
@@ -528,7 +528,7 @@ void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& myMaterialName != Graphic3d_NameOfMaterial_UserDefined
&& !myColors[Graphic3d_TOR_AMBIENT].IsEqual (theColor))
{
setUserMaterial();
@@ -543,7 +543,7 @@ void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& myMaterialName != Graphic3d_NameOfMaterial_UserDefined
&& !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (theColor))
{
setUserMaterial();
@@ -558,7 +558,7 @@ void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& myMaterialName != Graphic3d_NameOfMaterial_UserDefined
&& !myColors[Graphic3d_TOR_SPECULAR].IsEqual (theColor))
{
setUserMaterial();
@@ -573,7 +573,7 @@ void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
void Graphic3d_MaterialAspect::SetEmissiveColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& myMaterialName != Graphic3d_NameOfMaterial_UserDefined
&& !myColors[Graphic3d_TOR_EMISSION].IsEqual (theColor))
{
setUserMaterial();
@@ -668,32 +668,32 @@ Standard_Boolean Graphic3d_MaterialAspect::MaterialFromName (const Standard_CStr
// parse aliases
if (aName == "Plastic") // Plastified
{
theMat = Graphic3d_NOM_PLASTIC;
theMat = Graphic3d_NameOfMaterial_Plastified;
return Standard_True;
}
else if (aName == "Shiny_plastic") // Shiny_plastified
{
theMat = Graphic3d_NOM_SHINY_PLASTIC;
theMat = Graphic3d_NameOfMaterial_ShinyPlastified;
return Standard_True;
}
else if (aName == "Plaster") // Plastered
{
theMat = Graphic3d_NOM_PLASTER;
theMat = Graphic3d_NameOfMaterial_Plastered;
return Standard_True;
}
else if (aName == "Satin") // Satined
{
theMat = Graphic3d_NOM_SATIN;
theMat = Graphic3d_NameOfMaterial_Satin;
return Standard_True;
}
else if (aName == "Neon_gnc") // Ionized
{
theMat = Graphic3d_NOM_NEON_GNC;
theMat = Graphic3d_NameOfMaterial_Ionized;
return Standard_True;
}
else if (aName == "Neon_phc") // Neon
{
theMat = Graphic3d_NOM_NEON_PHC;
theMat = Graphic3d_NameOfMaterial_Neon;
return Standard_True;
}
return Standard_False;

View File

@@ -35,7 +35,7 @@ public:
DEFINE_STANDARD_ALLOC
//! Returns the number of predefined textures.
static Standard_Integer NumberOfMaterials() { return Graphic3d_NOM_DEFAULT; }
static Standard_Integer NumberOfMaterials() { return Graphic3d_NameOfMaterial_DEFAULT; }
//! Returns the name of the predefined material of specified rank within range [1, NumberOfMaterials()].
Standard_EXPORT static Standard_CString MaterialName (const Standard_Integer theRank);
@@ -50,10 +50,10 @@ public:
Standard_EXPORT static Standard_Boolean MaterialFromName (const Standard_CString theName,
Graphic3d_NameOfMaterial& theMat);
//! Returns the material for specified name or Graphic3d_NOM_DEFAULT if name is unknown.
//! Returns the material for specified name or Graphic3d_NameOfMaterial_DEFAULT if name is unknown.
static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName)
{
Graphic3d_NameOfMaterial aMat = Graphic3d_NOM_DEFAULT;
Graphic3d_NameOfMaterial aMat = Graphic3d_NameOfMaterial_DEFAULT;
MaterialFromName (theName, aMat);
return aMat;
}
@@ -87,7 +87,7 @@ public:
{
// if a component of a "standard" material change, the
// result is no more standard (a blue gold is not a gold)
myMaterialName = Graphic3d_NOM_UserDefined;
myMaterialName = Graphic3d_NameOfMaterial_UserDefined;
myStringName = theName;
}
@@ -248,9 +248,9 @@ private:
{
// if a component of a "standard" material change, the
// result is no more standard (a blue gold is not a gold)
if (myMaterialName != Graphic3d_NOM_UserDefined)
if (myMaterialName != Graphic3d_NameOfMaterial_UserDefined)
{
myMaterialName = Graphic3d_NOM_UserDefined;
myMaterialName = Graphic3d_NameOfMaterial_UserDefined;
myStringName = "UserDefined";
}
}

View File

@@ -17,35 +17,66 @@
#ifndef _Graphic3d_NameOfMaterial_HeaderFile
#define _Graphic3d_NameOfMaterial_HeaderFile
//! Types of aspect materials.
//! List of named materials (predefined presets).
//! Each preset defines either physical (having natural color) or generic (mutable color) material (@sa Graphic3d_TypeOfMaterial).
enum Graphic3d_NameOfMaterial
{
Graphic3d_NOM_BRASS,
Graphic3d_NOM_BRONZE,
Graphic3d_NOM_COPPER,
Graphic3d_NOM_GOLD,
Graphic3d_NOM_PEWTER,
Graphic3d_NOM_PLASTER,
Graphic3d_NOM_PLASTIC,
Graphic3d_NOM_SILVER,
Graphic3d_NOM_STEEL,
Graphic3d_NOM_STONE,
Graphic3d_NOM_SHINY_PLASTIC,
Graphic3d_NOM_SATIN,
Graphic3d_NOM_METALIZED,
Graphic3d_NOM_NEON_GNC,
Graphic3d_NOM_CHROME,
Graphic3d_NOM_ALUMINIUM,
Graphic3d_NOM_OBSIDIAN,
Graphic3d_NOM_NEON_PHC,
Graphic3d_NOM_JADE,
Graphic3d_NOM_CHARCOAL,
Graphic3d_NOM_WATER,
Graphic3d_NOM_GLASS,
Graphic3d_NOM_DIAMOND,
Graphic3d_NOM_TRANSPARENT,
Graphic3d_NOM_DEFAULT,
Graphic3d_NOM_UserDefined
Graphic3d_NameOfMaterial_Brass, //!< Brass (Physic)
Graphic3d_NameOfMaterial_Bronze, //!< Bronze (Physic)
Graphic3d_NameOfMaterial_Copper, //!< Copper (Physic)
Graphic3d_NameOfMaterial_Gold, //!< Gold (Physic)
Graphic3d_NameOfMaterial_Pewter, //!< Pewter (Physic)
Graphic3d_NameOfMaterial_Plastered, //!< Plastered (Generic)
Graphic3d_NameOfMaterial_Plastified, //!< Plastified (Generic)
Graphic3d_NameOfMaterial_Silver, //!< Silver (Physic)
Graphic3d_NameOfMaterial_Steel, //!< Steel (Physic)
Graphic3d_NameOfMaterial_Stone, //!< Stone (Physic)
Graphic3d_NameOfMaterial_ShinyPlastified, //!< Shiny Plastified (Generic)
Graphic3d_NameOfMaterial_Satin, //!< Satin (Generic)
Graphic3d_NameOfMaterial_Metalized, //!< Metalized (Generic)
Graphic3d_NameOfMaterial_Ionized, //!< Ionized (Generic)
Graphic3d_NameOfMaterial_Chrome, //!< Chrome (Physic)
Graphic3d_NameOfMaterial_Aluminum, //!< Aluminum (Physic)
Graphic3d_NameOfMaterial_Obsidian, //!< Obsidian (Physic)
Graphic3d_NameOfMaterial_Neon, //!< Neon (Physic)
Graphic3d_NameOfMaterial_Jade, //!< Jade (Physic)
Graphic3d_NameOfMaterial_Charcoal, //!< Charcoal (Physic)
Graphic3d_NameOfMaterial_Water, //!< Water (Physic)
Graphic3d_NameOfMaterial_Glass, //!< Glass (Physic)
Graphic3d_NameOfMaterial_Diamond, //!< Diamond (Physic)
Graphic3d_NameOfMaterial_Transparent, //!< Transparent (Physic)
Graphic3d_NameOfMaterial_DEFAULT, //!< Default (Generic);
//! normally used as out-of-range value pointing to some application default
Graphic3d_NameOfMaterial_UserDefined, //!< User-defined (Physic);
//! used for any material with non-standard definition
// old aliases
Graphic3d_NOM_BRASS = Graphic3d_NameOfMaterial_Brass,
Graphic3d_NOM_BRONZE = Graphic3d_NameOfMaterial_Bronze,
Graphic3d_NOM_COPPER = Graphic3d_NameOfMaterial_Copper,
Graphic3d_NOM_GOLD = Graphic3d_NameOfMaterial_Gold,
Graphic3d_NOM_PEWTER = Graphic3d_NameOfMaterial_Pewter,
Graphic3d_NOM_PLASTER = Graphic3d_NameOfMaterial_Plastered,
Graphic3d_NOM_PLASTIC = Graphic3d_NameOfMaterial_Plastified,
Graphic3d_NOM_SILVER = Graphic3d_NameOfMaterial_Silver,
Graphic3d_NOM_STEEL = Graphic3d_NameOfMaterial_Steel,
Graphic3d_NOM_STONE = Graphic3d_NameOfMaterial_Stone,
Graphic3d_NOM_SHINY_PLASTIC = Graphic3d_NameOfMaterial_ShinyPlastified,
Graphic3d_NOM_SATIN = Graphic3d_NameOfMaterial_Satin,
Graphic3d_NOM_METALIZED = Graphic3d_NameOfMaterial_Metalized,
Graphic3d_NOM_NEON_GNC = Graphic3d_NameOfMaterial_Ionized,
Graphic3d_NOM_CHROME = Graphic3d_NameOfMaterial_Chrome,
Graphic3d_NOM_ALUMINIUM = Graphic3d_NameOfMaterial_Aluminum,
Graphic3d_NOM_OBSIDIAN = Graphic3d_NameOfMaterial_Obsidian,
Graphic3d_NOM_NEON_PHC = Graphic3d_NameOfMaterial_Neon,
Graphic3d_NOM_JADE = Graphic3d_NameOfMaterial_Jade,
Graphic3d_NOM_CHARCOAL = Graphic3d_NameOfMaterial_Charcoal,
Graphic3d_NOM_WATER = Graphic3d_NameOfMaterial_Water,
Graphic3d_NOM_GLASS = Graphic3d_NameOfMaterial_Glass,
Graphic3d_NOM_DIAMOND = Graphic3d_NameOfMaterial_Diamond,
Graphic3d_NOM_TRANSPARENT = Graphic3d_NameOfMaterial_Transparent,
Graphic3d_NOM_DEFAULT = Graphic3d_NameOfMaterial_DEFAULT,
Graphic3d_NOM_UserDefined = Graphic3d_NameOfMaterial_UserDefined
};
#endif // _Graphic3d_NameOfMaterial_HeaderFile

View File

@@ -104,7 +104,10 @@ public:
//! theXMin = theYMin = theZMin = RealFirst().
//! theXMax = theYMax = theZMax = RealLast().
//! By default, structure is created not infinite but empty.
void SetInfiniteState (const Standard_Boolean theToSet) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
void SetInfiniteState (const Standard_Boolean theToSet)
{
if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
}
//! Modifies the order of displaying the structure.
//! Values are between 0 and 10.
@@ -140,7 +143,10 @@ public:
//! Changes a sequence of clip planes slicing the structure on rendering.
//! @param thePlanes [in] the set of clip planes.
void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myCStructure->SetClipPlanes (thePlanes); }
void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes)
{
if (!myCStructure.IsNull()) { myCStructure->SetClipPlanes (thePlanes); }
}
//! Get clip planes slicing the structure on rendering.
//! @return set of clip planes.
@@ -165,7 +171,10 @@ public:
Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup);
//! Marks the structure <me> representing wired structure needed for highlight only so it won't be added to BVH tree.
void SetIsForHighlight (const Standard_Boolean isForHighlight) { myCStructure->IsForHighlight = isForHighlight; }
void SetIsForHighlight (const Standard_Boolean isForHighlight)
{
if (!myCStructure.IsNull()) { myCStructure->IsForHighlight = isForHighlight; }
}
//! Suppresses the highlight for the structure <me>
//! in all the views of the visualiser.
@@ -222,7 +231,11 @@ public:
Standard_Boolean IsDeleted() const { return myCStructure.IsNull(); }
//! Returns the display indicator for this structure.
virtual Standard_Boolean IsDisplayed() const { return myCStructure->stick != 0; }
virtual Standard_Boolean IsDisplayed() const
{
return !myCStructure.IsNull()
&& myCStructure->stick != 0;
}
//! Returns Standard_True if the structure <me> is empty.
//! Warning: A structure is empty if :
@@ -239,17 +252,26 @@ public:
}
//! Returns the highlight indicator for this structure.
virtual Standard_Boolean IsHighlighted() const { return myCStructure->highlight != 0; }
virtual Standard_Boolean IsHighlighted() const
{
return !myCStructure.IsNull()
&& myCStructure->highlight != 0;
}
//! Returns TRUE if the structure is transformed.
Standard_Boolean IsTransformed() const
{
return !myCStructure->Transformation().IsNull()
&& myCStructure->Transformation()->Form() != gp_Identity;
return !myCStructure.IsNull()
&& !myCStructure->Transformation().IsNull()
&& myCStructure->Transformation()->Form() != gp_Identity;
}
//! Returns the visibility indicator for this structure.
Standard_Boolean IsVisible() const { return myCStructure->visible != 0; }
Standard_Boolean IsVisible() const
{
return !myCStructure.IsNull()
&& myCStructure->visible != 0;
}
//! Returns the coordinates of the boundary box of the structure <me>.
//! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical
@@ -334,7 +356,10 @@ public:
Standard_Address Owner() const { return myOwner; }
void SetHLRValidation (const Standard_Boolean theFlag) { myCStructure->HLRValidation = theFlag ? 1 : 0; }
void SetHLRValidation (const Standard_Boolean theFlag)
{
if (!myCStructure.IsNull()) { myCStructure->HLRValidation = theFlag ? 1 : 0; }
}
//! Hidden parts stored in this structure are valid if:
//! 1) the owner is defined.
@@ -361,23 +386,39 @@ public:
const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); }
//! Sets if the structure location has mutable nature (content or location will be changed regularly).
void SetMutable (const Standard_Boolean theIsMutable) { myCStructure->IsMutable = theIsMutable; }
void SetMutable (const Standard_Boolean theIsMutable)
{
if (!myCStructure.IsNull()) { myCStructure->IsMutable = theIsMutable; }
}
//! Returns true if structure has mutable nature (content or location are be changed regularly).
//! Mutable structure will be managed in different way than static onces.
Standard_Boolean IsMutable() const { return myCStructure->IsMutable; }
Standard_Boolean IsMutable() const
{
return !myCStructure.IsNull()
&& myCStructure->IsMutable;
}
Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; }
//! Clears the structure <me>.
Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction);
void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Connect (*theDaughter->myCStructure); }
void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Disconnect (*theDaughter->myCStructure); }
void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter)
{
if (!myCStructure.IsNull()) { myCStructure->Connect (*theDaughter->myCStructure); }
}
void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter)
{
if (!myCStructure.IsNull()) { myCStructure->Disconnect (*theDaughter->myCStructure); }
}
//! Internal method which sets new transformation without calling graphic manager callbacks.
void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf) { myCStructure->SetTransformation (theTrsf); }
void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf)
{
if (!myCStructure.IsNull()) { myCStructure->SetTransformation (theTrsf); }
}
//! Returns the identification number of this structure.
Standard_Integer Identification() const { return myCStructure->Id; }

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