mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
Compare commits
28 Commits
CR31644
...
OCCT-751de
Author | SHA1 | Date | |
---|---|---|---|
|
2ecd3a06a6 | ||
|
628c0211d5 | ||
|
dbecff5fab | ||
|
7a88ce5b98 | ||
|
2b7fd8c81c | ||
|
a8b9d7eb27 | ||
|
71af3370c4 | ||
|
40858cc79c | ||
|
3940436ae2 | ||
|
c3da64a686 | ||
|
4065c66c24 | ||
|
94f16a8961 | ||
|
aa7e9f8d78 | ||
|
5445eaeed5 | ||
|
07bc68e8d8 | ||
|
ec4128df29 | ||
|
f41fd243b6 | ||
|
9f9490e1ae | ||
|
0612bb7010 | ||
|
7ccfd41fa2 | ||
|
692decba26 | ||
|
1b9cb073b9 | ||
|
380748c340 | ||
|
a966542b8a | ||
|
8833fd4dc5 | ||
|
1877dc98c9 | ||
|
3e98579a83 | ||
|
16ed73bec5 |
@@ -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)
|
||||
|
@@ -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})
|
||||
|
@@ -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
5
adm/cmake/openvr.cmake
Normal 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" "")
|
@@ -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")
|
||||
|
@@ -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) {
|
||||
|
@@ -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@"
|
||||
|
@@ -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@"
|
||||
|
@@ -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"
|
||||
|
@@ -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/
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -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 ();
|
||||
|
@@ -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;
|
||||
|
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
17
samples/OCCTOverview/code/DataExchange.xml
Normal file
17
samples/OCCTOverview/code/DataExchange.xml
Normal 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>
|
@@ -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();
|
||||
|
@@ -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)
|
||||
{
|
||||
//
|
||||
|
@@ -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
|
||||
|
@@ -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": ""
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
}
|
92
samples/OCCTOverview/code/Geometry.xml
Normal file
92
samples/OCCTOverview/code/Geometry.xml
Normal 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>
|
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
21
samples/OCCTOverview/code/Ocaf.xml
Normal file
21
samples/OCCTOverview/code/Ocaf.xml
Normal 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>
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
51
samples/OCCTOverview/code/Topology.xml
Normal file
51
samples/OCCTOverview/code/Topology.xml
Normal 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>
|
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"Triangulation": {
|
||||
|
||||
"Create Triangulation": [{
|
||||
"text": "Triangulation on shape",
|
||||
"function": "Triangulation3dSample",
|
||||
"description": ""
|
||||
}]
|
||||
}
|
||||
}
|
7
samples/OCCTOverview/code/Triangulation.xml
Normal file
7
samples/OCCTOverview/code/Triangulation.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<Menu>
|
||||
<MenuItem name="Triangulation">
|
||||
<MenuItem name="Create Triangulation">
|
||||
<Sample name="Triangulation on shape" function="Triangulation3dSample"/>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
@@ -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": ""
|
||||
}]
|
||||
}
|
||||
}
|
20
samples/OCCTOverview/code/Viewer2d.xml
Normal file
20
samples/OCCTOverview/code/Viewer2d.xml
Normal 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>
|
@@ -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();
|
||||
|
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
31
samples/OCCTOverview/code/Viewer3d.xml
Normal file
31
samples/OCCTOverview/code/Viewer3d.xml
Normal 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>
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -35,7 +35,7 @@
|
||||
class ApplicationCommonWindow;
|
||||
|
||||
//! Implements visualization of samples content
|
||||
class COMMONSAMPLE_EXPORT DocumentCommon : public QObject
|
||||
class DocumentCommon : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@@ -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);
|
||||
|
@@ -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());
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -1002,13 +1002,7 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
|
||||
if (!myMainVwr->ActiveViews().IsEmpty())
|
||||
{
|
||||
theIObj->RecomputeTransformation (myMainVwr->ActiveViewIterator().Value()->Camera());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RecomputeSelectionOnly
|
||||
//purpose :
|
||||
@@ -2186,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);
|
||||
|
@@ -225,7 +225,6 @@ AIS_Manipulator::AIS_Manipulator()
|
||||
myCurrentMode (AIS_MM_None),
|
||||
myIsActivationOnDetection (Standard_False),
|
||||
myIsZoomPersistentMode (Standard_True),
|
||||
mySkinMode (ManipulatorSkin_Shaded),
|
||||
myHasStartedTransformation (Standard_False),
|
||||
myStartPosition (gp::XOY()),
|
||||
myStartPick (0.0, 0.0, 0.0),
|
||||
@@ -247,7 +246,6 @@ AIS_Manipulator::AIS_Manipulator (const gp_Ax2& thePosition)
|
||||
myCurrentMode (AIS_MM_None),
|
||||
myIsActivationOnDetection (Standard_False),
|
||||
myIsZoomPersistentMode (Standard_True),
|
||||
mySkinMode (ManipulatorSkin_Shaded),
|
||||
myHasStartedTransformation (Standard_False),
|
||||
myStartPosition (gp::XOY()),
|
||||
myStartPick (0.0, 0.0, 0.0),
|
||||
@@ -587,35 +585,18 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
gp_Dir aCurrentAxis = gce_MakeDir (aPosLoc, aNewPosition);
|
||||
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, aCurrAxis.Direction());
|
||||
|
||||
// Change value of an angle if it should have different sign.
|
||||
if (anAngle * myPrevState < 0 && Abs (anAngle) < M_PI_2)
|
||||
{
|
||||
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
|
||||
anAngle = aSign * (M_PI * 2 - anAngle);
|
||||
}
|
||||
|
||||
if (Abs (anAngle) < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Draw a sector indicating the rotation angle
|
||||
if (mySkinMode == ManipulatorSkin_Flat)
|
||||
{
|
||||
const gp_Ax1& anAxis = myAxes[myCurrentIndex].ReferenceAxis();
|
||||
const gp_Dir aRotationStart = anAxis.Direction().Z() > 0 ? myStartPosition.YDirection() : myStartPosition.Direction();
|
||||
Standard_Real aRotationAngle = aRotationStart.AngleWithRef (aCurrentAxis, aCurrAxis.Direction());
|
||||
aRotationAngle -= (anAngle > 0) ? anAngle * 2.0 : anAngle;
|
||||
if (anAxis.Direction().Z() > 0) { aRotationAngle += M_PI_2; }
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetRotation (anAxis, aRotationAngle);
|
||||
|
||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||
anAspect->SetMaterial (myDrawer->ShadingAspect()->Material());
|
||||
anAspect->SetTransparency (0.5);
|
||||
anAspect->SetColor (myAxes[myCurrentIndex].Color());
|
||||
|
||||
mySector.Init (0.0f, myAxes[myCurrentIndex].InnerRadius(), anAxis, Abs (anAngle));
|
||||
mySectorGroup->Clear();
|
||||
mySectorGroup->SetPrimitivesAspect (anAspect->Aspect());
|
||||
mySectorGroup->AddPrimitiveArray (mySector.Array());
|
||||
mySectorGroup->SetTransformation (aTrsf);
|
||||
}
|
||||
|
||||
gp_Trsf aNewTrsf;
|
||||
aNewTrsf.SetRotation (aCurrAxis, anAngle);
|
||||
theTrsf *= aNewTrsf;
|
||||
@@ -691,10 +672,7 @@ Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveC
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_DragAction_Stop:
|
||||
{
|
||||
if (mySkinMode == ManipulatorSkin_Flat) { mySectorGroup->Clear(); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -741,173 +719,6 @@ void AIS_Manipulator::StopTransform (const Standard_Boolean theToApply)
|
||||
SetPosition (myStartPosition);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RecomputeTransformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::RecomputeTransformation (const Handle(Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean isRecomputedTranslation = Standard_False;
|
||||
Standard_Boolean isRecomputedRotation = Standard_False;
|
||||
Standard_Boolean isRecomputedDragging = Standard_False;
|
||||
Standard_Boolean isRecomputedScaling = Standard_False;
|
||||
|
||||
// Remove transformation from dragger group
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
if (myAxes[anIt].HasDragging())
|
||||
{
|
||||
myAxes[anIt].DraggerGroup()->SetTransformation (gp_Trsf());
|
||||
isRecomputedDragging = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Dir& aCameraDir = theCamera->Direction();
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
const gp_Ax1& anAxis = myAxes[anIt].ReferenceAxis();
|
||||
gp_Dir anAxisDir, aNormal;
|
||||
|
||||
if (anAxis.Direction().X() > 0)
|
||||
{
|
||||
aNormal = myPosition.YDirection().Reversed();
|
||||
anAxisDir = myPosition.XDirection();
|
||||
}
|
||||
else if (anAxis.Direction().Y() > 0)
|
||||
{
|
||||
aNormal = myPosition.XDirection().Crossed (myPosition.YDirection()).Reversed();
|
||||
anAxisDir = myPosition.YDirection();
|
||||
}
|
||||
else
|
||||
{
|
||||
aNormal = myPosition.XDirection().Reversed();
|
||||
anAxisDir = myPosition.XDirection().Crossed (myPosition.YDirection());
|
||||
}
|
||||
|
||||
const gp_Dir aCameraProj = Abs (Abs (anAxisDir.Dot (aCameraDir)) - 1.0) <= gp::Resolution()
|
||||
? aCameraDir
|
||||
: anAxisDir.Crossed (aCameraDir).Crossed (anAxisDir);
|
||||
const Standard_Boolean isReversed = anAxisDir.Dot (aCameraDir) > 0;
|
||||
Standard_Real anAngle = aNormal.AngleWithRef (aCameraProj, anAxisDir);
|
||||
if (anAxis.Direction().X() > 0) anAngle -= M_PI_2;
|
||||
|
||||
if (myAxes[anIt].HasTranslation())
|
||||
{
|
||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||
|
||||
Graphic3d_MaterialAspect& aMat = anAspect->Aspect()->ChangeFrontMaterial();
|
||||
Quantity_Color aColor = isReversed
|
||||
? Quantity_Color (myAxes[anIt].Color().Rgb() * 0.05f)
|
||||
: myAxes[anIt].Color();
|
||||
aMat.SetAmbientColor (aColor);
|
||||
aMat.SetDiffuseColor (aColor);
|
||||
aMat.SetSpecularColor (aColor);
|
||||
aMat.SetEmissiveColor (aColor);
|
||||
|
||||
gp_Trsf aTranslatorTrsf;
|
||||
aTranslatorTrsf.SetRotation (anAxis, anAngle);
|
||||
if (isReversed)
|
||||
{
|
||||
const Standard_Real aLength = myAxes[anIt].AxisLength() + myAxes[anIt].Indent() * 4.0f;
|
||||
aTranslatorTrsf.SetTranslationPart (anAxis.Direction().XYZ().Reversed() * aLength);
|
||||
}
|
||||
|
||||
myAxes[anIt].TranslatorGroup()->SetGroupPrimitivesAspect (anAspect->Aspect());
|
||||
myAxes[anIt].TranslatorGroup()->SetTransformation (aTranslatorTrsf);
|
||||
myAxes[anIt].TranslatorHighlightPrs()->CurrentGroup()->SetTransformation (aTranslatorTrsf);
|
||||
isRecomputedTranslation = Standard_True;
|
||||
}
|
||||
|
||||
if (myAxes[anIt].HasRotation())
|
||||
{
|
||||
gp_Trsf aRotatorTrsf;
|
||||
aRotatorTrsf.SetRotation (anAxis, anAngle - M_PI_2);
|
||||
myAxes[anIt].RotatorGroup()->SetTransformation (aRotatorTrsf);
|
||||
myAxes[anIt].RotatorHighlightPrs()->CurrentGroup()->SetTransformation (aRotatorTrsf);
|
||||
isRecomputedRotation = Standard_True;
|
||||
}
|
||||
|
||||
if (myAxes[anIt].HasDragging() && isReversed)
|
||||
{
|
||||
for (Standard_Integer anIndexIter = 0; anIndexIter < 3; ++anIndexIter)
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aDraggerGroup = myAxes[anIndexIter].DraggerGroup();
|
||||
gp_Vec aTranslation = (anIndexIter == anIt)
|
||||
? anAxis.Direction().XYZ() * myAxes[anIndexIter].AxisRadius() * 2.0f
|
||||
: anAxis.Direction().XYZ().Reversed() * myAxes[anIndexIter].AxisLength();
|
||||
gp_Trsf aDraggerTrsf;
|
||||
aDraggerTrsf.SetTranslation (aTranslation);
|
||||
aDraggerTrsf *= aDraggerGroup->Transformation();
|
||||
aDraggerGroup->SetTransformation (aDraggerTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
if (myAxes[anIt].HasScaling())
|
||||
{
|
||||
gp_Trsf aScalerTrsf;
|
||||
if (anAxis.Direction().X() > 0) { anAngle += M_PI_2; }
|
||||
aScalerTrsf.SetRotation (anAxis, anAngle);
|
||||
if (isReversed)
|
||||
{
|
||||
Standard_ShortReal aLength = myAxes[anIt].AxisLength() * 2.0f + myAxes[anIt].BoxSize() + myAxes[anIt].Indent() * 4.0f;
|
||||
aScalerTrsf.SetTranslationPart (gp_Vec (anAxis.Direction().XYZ().Reversed() * aLength));
|
||||
}
|
||||
myAxes[anIt].ScalerGroup()->SetTransformation (aScalerTrsf);
|
||||
myAxes[anIt].ScalerHighlightPrs()->CurrentGroup()->SetTransformation (aScalerTrsf);
|
||||
isRecomputedScaling = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecomputedRotation)
|
||||
{
|
||||
const gp_Dir aXDir = gp::DX();
|
||||
const gp_Dir anYDir = gp::DY();
|
||||
const gp_Dir aZDir = gp::DZ();
|
||||
|
||||
const gp_Dir aCameraProjection = Abs (aXDir.Dot (aCameraDir)) <= gp::Resolution() || Abs (anYDir.Dot (aCameraDir)) <= gp::Resolution()
|
||||
? aCameraDir
|
||||
: aXDir.XYZ() * (aXDir.Dot (aCameraDir)) + anYDir.XYZ() * (anYDir.Dot (aCameraDir));
|
||||
const Standard_Boolean isReversed = aZDir.Dot (aCameraDir) > 0;
|
||||
|
||||
const Standard_Real anAngle = M_PI_2 - aCameraDir.Angle (aCameraProjection);
|
||||
gp_Dir aRotAxis = Abs (Abs (aCameraProjection.Dot (aZDir)) - 1.0) <= gp::Resolution()
|
||||
? aZDir
|
||||
: aCameraProjection.Crossed (aZDir);
|
||||
if (isReversed) { aRotAxis.Reverse(); }
|
||||
|
||||
gp_Trsf aRotationTrsf;
|
||||
aRotationTrsf.SetRotation (gp_Ax1 (gp::Origin(), aRotAxis), anAngle);
|
||||
|
||||
gp_Ax3 aToSystem (gp::Origin(), myPosition.XDirection().Crossed (myPosition.YDirection()), myPosition.XDirection());
|
||||
gp_Ax3 aFromSystem (gp::XOY());
|
||||
aFromSystem.Transform (aRotationTrsf);
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aFromSystem, aToSystem);
|
||||
myCircleGroup->SetTransformation (aTrsf);
|
||||
}
|
||||
|
||||
if (isRecomputedDragging)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
myAxes[anIt].DraggerHighlightPrs()->CurrentGroup()->SetTransformation (myAxes[anIt].DraggerGroup()->Transformation());
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecomputedTranslation) { RecomputeSelection (AIS_MM_Translation); };
|
||||
if (isRecomputedRotation) { RecomputeSelection (AIS_MM_Rotation); };
|
||||
if (isRecomputedDragging) { RecomputeSelection (AIS_MM_TranslationPlane); };
|
||||
if (isRecomputedScaling) { RecomputeSelection (AIS_MM_Scaling); };
|
||||
|
||||
Object()->GetContext()->RecomputeSelectionOnly (this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transform
|
||||
//purpose :
|
||||
@@ -1113,19 +924,6 @@ void AIS_Manipulator::SetZoomPersistence (const Standard_Boolean theToEnable)
|
||||
updateTransformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSkinMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::SetSkinMode (const ManipulatorSkin theSkinMode)
|
||||
{
|
||||
if (mySkinMode != theSkinMode)
|
||||
{
|
||||
SetToUpdate();
|
||||
}
|
||||
mySkinMode = theSkinMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformPersistence
|
||||
//purpose :
|
||||
@@ -1185,26 +983,11 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
|
||||
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
|
||||
|
||||
// Display center
|
||||
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin(), mySkinMode);
|
||||
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin());
|
||||
aGroup = thePrs->NewGroup ();
|
||||
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myCenter.Array());
|
||||
|
||||
// Display outer circle
|
||||
if (mySkinMode == ManipulatorSkin_Flat
|
||||
&& (myAxes[0].HasRotation() || myAxes[1].HasRotation() || myAxes[2].HasRotation()))
|
||||
{
|
||||
myCircle.Init (myAxes[0].InnerRadius(), myAxes[0].Size(),
|
||||
gp_Ax1 (gp::Origin(), gp::DZ()),
|
||||
2.0f * M_PI, myAxes[0].FacettesNumber() * 4);
|
||||
myCircleGroup = thePrs->NewGroup ();
|
||||
myCircleGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
myCircleGroup->AddPrimitiveArray (myCircle.Array());
|
||||
|
||||
mySectorGroup = thePrs->NewGroup ();
|
||||
mySectorGroup->SetGroupPrimitivesAspect (anAspect->Aspect());
|
||||
}
|
||||
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
// Display axes
|
||||
@@ -1213,7 +996,7 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
|
||||
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
|
||||
anAspectAx->SetColor (myAxes[anIt].Color());
|
||||
aGroup->SetGroupPrimitivesAspect (anAspectAx->Aspect());
|
||||
myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx, mySkinMode);
|
||||
myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx);
|
||||
myAxes[anIt].SetTransformPersistence (TransformPersistence());
|
||||
}
|
||||
|
||||
@@ -1251,7 +1034,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
|
||||
return;
|
||||
}
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
||||
@@ -1289,7 +1072,7 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
|
||||
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor (myAxes[anOwner->Index()].Color());
|
||||
@@ -1325,25 +1108,6 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RecomputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::RecomputeSelection (const AIS_ManipulatorMode theMode)
|
||||
{
|
||||
if (theMode == AIS_MM_None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_Selection)& aSelection = Object()->Selection (theMode);
|
||||
if (!aSelection.IsNull())
|
||||
{
|
||||
aSelection->Clear();
|
||||
ComputeSelection (aSelection, theMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
@@ -1357,9 +1121,13 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner;
|
||||
if (aMode == AIS_MM_Translation)
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Translation || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1368,27 +1136,23 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
// define sensitivity by line
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (15);
|
||||
theSelection->Add (aLine);
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
|
||||
}
|
||||
// define sensitivity by line
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (15);
|
||||
theSelection->Add (aLine);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
TopLoc_Location aTrsf = !myAxes[anIt].TranslatorGroup().IsNull()
|
||||
? TopLoc_Location (myAxes[anIt].TranslatorGroup()->Transformation())
|
||||
: TopLoc_Location();
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), aTrsf);
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), TopLoc_Location());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Rotation)
|
||||
if (aMode == AIS_MM_Rotation || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1397,28 +1161,22 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
|
||||
}
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].RotatorGroup();
|
||||
TopLoc_Location aTrsf = !aGroup.IsNull()
|
||||
? TopLoc_Location (aGroup->Transformation())
|
||||
: TopLoc_Location();
|
||||
aTri->InitTriangulation (myAxes[anIt].RotatorDisk().Array()->Attributes(), myAxes[anIt].RotatorDisk().Array()->Indices(), aTrsf);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Scaling)
|
||||
if (aMode == AIS_MM_Scaling || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1426,27 +1184,21 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
// define sensitivity by point
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint (anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (15);
|
||||
theSelection->Add (aPnt);
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);
|
||||
}
|
||||
// define sensitivity by point
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint (anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (15);
|
||||
theSelection->Add (aPnt);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].ScalerGroup();
|
||||
TopLoc_Location aTrsf = !aGroup.IsNull()
|
||||
? TopLoc_Location (aGroup->Transformation())
|
||||
: TopLoc_Location();
|
||||
aTri->InitTriangulation (myAxes[anIt].ScalerCube().Array()->Attributes(), myAxes[anIt].ScalerCube().Array()->Indices(), aTrsf);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane)
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1454,32 +1206,27 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
// define sensitivity by two crossed lines
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
}
|
||||
|
||||
// define sensitivity by two crossed lines
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].DraggerGroup();
|
||||
TopLoc_Location aTrsf = !aGroup.IsNull()
|
||||
? TopLoc_Location (aGroup->Transformation())
|
||||
: TopLoc_Location();
|
||||
aTri->InitTriangulation (myAxes[anIt].DraggerSector().Array()->Attributes(), myAxes[anIt].DraggerSector().Array()->Indices(), aTrsf);
|
||||
theSelection->Add (aTri);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add(aTri);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1491,17 +1238,15 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
|
||||
const Standard_ShortReal theOuterRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Real theAngle,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
{
|
||||
myPosition = thePosition;
|
||||
myInnerRad = theInnerRadius;
|
||||
myOuterRad = theOuterRadius;
|
||||
|
||||
Prs3d_ToolDisk aTool (theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
|
||||
aTool.SetAngleRange (0, theAngle);
|
||||
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
@@ -1516,18 +1261,15 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
|
||||
const gp_Pnt& thePosition,
|
||||
const ManipulatorSkin theSkinMode,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
{
|
||||
myPosition = thePosition;
|
||||
myRadius = theRadius;
|
||||
|
||||
Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
|
||||
|
||||
const Standard_Real aRadius = theSkinMode == ManipulatorSkin_Flat ? theRadius * 0.5 : theRadius;
|
||||
Prs3d_ToolSphere aTool (aRadius, theSlicesNb, theStacksNb);
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
@@ -1537,75 +1279,52 @@ void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition,
|
||||
const Standard_ShortReal theSize,
|
||||
const ManipulatorSkin theSkinMode)
|
||||
void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition, const Standard_ShortReal theSize)
|
||||
{
|
||||
if (theSkinMode == ManipulatorSkin_Flat)
|
||||
{
|
||||
gp_Dir aXDirection;
|
||||
if (thePosition.Direction().X() > 0)
|
||||
aXDirection = gp::DY();
|
||||
else if (thePosition.Direction().Y() > 0)
|
||||
aXDirection = gp::DZ();
|
||||
else
|
||||
aXDirection = gp::DX();
|
||||
myArray = new Graphic3d_ArrayOfTriangles (12 * 3, 0, Standard_True);
|
||||
|
||||
gp_Pnt aLocation = thePosition.Location().Translated (gp_Vec (thePosition.Direction().XYZ() * theSize));
|
||||
gp_Ax3 aSystem (aLocation, aXDirection, thePosition.Direction());
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
Poly_Array1OfTriangle aPolyTriangles (1, 12);
|
||||
TColgp_Array1OfPnt aPoints (1, 36);
|
||||
NCollection_Array1<gp_Dir> aNormals (1, 12);
|
||||
myTriangulation = new Poly_Triangulation (aPoints, aPolyTriangles);
|
||||
|
||||
Prs3d_ToolDisk aTool (0.0, theSize, 40, 40);
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
else
|
||||
{
|
||||
myArray = new Graphic3d_ArrayOfTriangles (12 * 3, 0, Standard_True);
|
||||
gp_Ax2 aPln (thePosition.Location(), thePosition.Direction());
|
||||
gp_Pnt aBottomLeft = thePosition.Location().XYZ() - aPln.XDirection().XYZ() * theSize * 0.5 - aPln.YDirection().XYZ() * theSize * 0.5;
|
||||
gp_Pnt aV2 = aBottomLeft.XYZ() + aPln.YDirection().XYZ() * theSize;
|
||||
gp_Pnt aV3 = aBottomLeft.XYZ() + aPln.YDirection().XYZ() * theSize + aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aV4 = aBottomLeft.XYZ() + aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aTopRight = thePosition.Location().XYZ() + thePosition.Direction().XYZ() * theSize
|
||||
+ aPln.XDirection().XYZ() * theSize * 0.5 + aPln.YDirection().XYZ() * theSize * 0.5;
|
||||
gp_Pnt aV5 = aTopRight.XYZ() - aPln.YDirection().XYZ() * theSize;
|
||||
gp_Pnt aV6 = aTopRight.XYZ() - aPln.YDirection().XYZ() * theSize - aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aV7 = aTopRight.XYZ() - aPln.XDirection().XYZ() * theSize;
|
||||
|
||||
Poly_Array1OfTriangle aPolyTriangles (1, 12);
|
||||
TColgp_Array1OfPnt aPoints (1, 36);
|
||||
myTriangulation = new Poly_Triangulation (aPoints, aPolyTriangles);
|
||||
gp_Dir aRight ((gp_Vec(aTopRight, aV7) ^ gp_Vec(aTopRight, aV2)).XYZ());
|
||||
gp_Dir aFront ((gp_Vec(aV3, aV4) ^ gp_Vec(aV3, aV5)).XYZ());
|
||||
|
||||
gp_Ax2 aPln (thePosition.Location(), thePosition.Direction());
|
||||
gp_Pnt aBottomLeft = thePosition.Location().XYZ() - aPln.XDirection().XYZ() * theSize * 0.5 - aPln.YDirection().XYZ() * theSize * 0.5;
|
||||
gp_Pnt aV2 = aBottomLeft.XYZ() + aPln.YDirection().XYZ() * theSize;
|
||||
gp_Pnt aV3 = aBottomLeft.XYZ() + aPln.YDirection().XYZ() * theSize + aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aV4 = aBottomLeft.XYZ() + aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aTopRight = thePosition.Location().XYZ() + thePosition.Direction().XYZ() * theSize
|
||||
+ aPln.XDirection().XYZ() * theSize * 0.5 + aPln.YDirection().XYZ() * theSize * 0.5;
|
||||
gp_Pnt aV5 = aTopRight.XYZ() - aPln.YDirection().XYZ() * theSize;
|
||||
gp_Pnt aV6 = aTopRight.XYZ() - aPln.YDirection().XYZ() * theSize - aPln.XDirection().XYZ() * theSize;
|
||||
gp_Pnt aV7 = aTopRight.XYZ() - aPln.XDirection().XYZ() * theSize;
|
||||
// Bottom
|
||||
addTriangle (0, aBottomLeft, aV2, aV3, -thePosition.Direction());
|
||||
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
|
||||
|
||||
gp_Dir aRight ((gp_Vec(aTopRight, aV7) ^ gp_Vec(aTopRight, aV2)).XYZ());
|
||||
gp_Dir aFront ((gp_Vec(aV3, aV4) ^ gp_Vec(aV3, aV5)).XYZ());
|
||||
// Front
|
||||
addTriangle (2, aV3, aV5, aV4, -aFront);
|
||||
addTriangle (3, aV3, aTopRight, aV5, -aFront);
|
||||
|
||||
// Bottom
|
||||
addTriangle (0, aBottomLeft, aV2, aV3, -thePosition.Direction());
|
||||
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
|
||||
// Back
|
||||
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
|
||||
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
|
||||
|
||||
// Front
|
||||
addTriangle (2, aV3, aV5, aV4, -aFront);
|
||||
addTriangle (3, aV3, aTopRight, aV5, -aFront);
|
||||
// aTop
|
||||
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
|
||||
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
|
||||
|
||||
// Back
|
||||
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
|
||||
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
|
||||
// Left
|
||||
addTriangle (8, aV6, aV4, aV5, aRight);
|
||||
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
|
||||
|
||||
// aTop
|
||||
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
|
||||
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
|
||||
|
||||
// Left
|
||||
addTriangle (8, aV6, aV4, aV5, aRight);
|
||||
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
|
||||
|
||||
// Right
|
||||
addTriangle (10, aV3, aV7, aTopRight, -aRight);
|
||||
addTriangle (11, aV3, aV2, aV7, -aRight);
|
||||
}
|
||||
// Right
|
||||
addTriangle (10, aV3, aV7, aTopRight, -aRight);
|
||||
addTriangle (11, aV3, aV2, aV7, -aRight);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1635,49 +1354,15 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
|
||||
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const ManipulatorSkin theSkinMode,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
{
|
||||
gp_Ax3 aSystem (thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
|
||||
if (theSkinMode == ManipulatorSkin_Flat)
|
||||
{
|
||||
myArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
|
||||
myTriangulation = new Poly_Triangulation (4, 2, Standard_False);
|
||||
TColgp_Array1OfPnt& aNodes = myTriangulation->ChangeNodes();
|
||||
Poly_Array1OfTriangle& aTriangles = myTriangulation->ChangeTriangles();
|
||||
|
||||
gp_Dir aNormal = gp_Dir (0.0, 0.0, -1.0).Transformed (aTrsf);
|
||||
|
||||
const Standard_Real anIndent = theRadius / 3.0;
|
||||
gp_Pnt aV1 = gp_Pnt (anIndent, anIndent, 0.0).Transformed (aTrsf);
|
||||
gp_Pnt aV2 = gp_Pnt (anIndent, anIndent * 2.0, 0.0).Transformed (aTrsf);
|
||||
gp_Pnt aV3 = gp_Pnt (anIndent * 2.0, anIndent * 2.0, 0.0).Transformed (aTrsf);
|
||||
gp_Pnt aV4 = gp_Pnt (anIndent * 2.0, anIndent, 0.0).Transformed (aTrsf);
|
||||
|
||||
myArray->AddVertex (aV1, aNormal);
|
||||
myArray->AddVertex (aV2, aNormal);
|
||||
myArray->AddVertex (aV3, aNormal);
|
||||
myArray->AddVertex (aV4, aNormal);
|
||||
myArray->AddTriangleEdges (3, 1, 2);
|
||||
myArray->AddTriangleEdges (1, 3, 4);
|
||||
|
||||
aNodes.SetValue (1, aV1);
|
||||
aNodes.SetValue (2, aV2);
|
||||
aNodes.SetValue (3, aV3);
|
||||
aNodes.SetValue (4, aV4);
|
||||
aTriangles.SetValue (1, Poly_Triangle (3, 1, 2));
|
||||
aTriangles.SetValue (2, Poly_Triangle (1, 3, 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1715,8 +1400,7 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
|
||||
|
||||
void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect,
|
||||
const ManipulatorSkin theSkinMode)
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect)
|
||||
{
|
||||
if (myHasTranslation)
|
||||
{
|
||||
@@ -1724,66 +1408,16 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
const Standard_Real aCylinderLength = myLength - anArrowLength;
|
||||
myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength);
|
||||
|
||||
myTriangleArray = Prs3d_Arrow::DrawShaded (gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
||||
myAxisRadius,
|
||||
myLength,
|
||||
myAxisRadius * 1.5,
|
||||
anArrowLength,
|
||||
myFacettesNumber);
|
||||
myTranslatorGroup = thePrs->NewGroup();
|
||||
myTranslatorGroup->SetClosed (theSkinMode == ManipulatorSkin_Shaded);
|
||||
myTranslatorGroup->SetClosed (true);
|
||||
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
|
||||
if (theSkinMode == ManipulatorSkin_Flat)
|
||||
{
|
||||
const Standard_Integer aStripsNb = 14;
|
||||
|
||||
myTriangleArray = new Graphic3d_ArrayOfTriangles (aStripsNb * 4, aStripsNb * 6, Graphic3d_ArrayFlags_VertexNormal);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aColorlessArr = new Graphic3d_ArrayOfTriangles (aStripsNb * 2, aStripsNb * 3, Graphic3d_ArrayFlags_VertexNormal);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aColoredArr = new Graphic3d_ArrayOfTriangles (aStripsNb * 2, aStripsNb * 3,
|
||||
Graphic3d_ArrayFlags_VertexNormal | Graphic3d_ArrayFlags_VertexColor);
|
||||
|
||||
gp_Ax3 aSystem (gp::Origin(), myReferenceAxis.Direction());
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
|
||||
gp_Dir aNormal = gp_Dir (1.0, 0.0, 0.0).Transformed (aTrsf);
|
||||
Standard_Real aLength = myLength + myIndent * 4.0f;
|
||||
|
||||
const Standard_Real aStepV = 1.0f / aStripsNb;
|
||||
for (Standard_Integer aU = 0; aU <= 1; ++aU)
|
||||
{
|
||||
for (Standard_Integer aV = 0; aV <= aStripsNb; ++aV)
|
||||
{
|
||||
gp_Pnt aVertex = gp_Pnt (0.0, myAxisRadius * (1.5f * aU - 0.75f), aLength * aV * aStepV).Transformed (aTrsf);
|
||||
myTriangleArray->AddVertex (aVertex, aNormal);
|
||||
|
||||
if (aV != 0) { aColorlessArr->AddVertex (aVertex, aNormal); }
|
||||
if (aV != aStripsNb) { aColoredArr->AddVertex (aVertex, aNormal, myColor); }
|
||||
|
||||
if (aU != 0 && aV != 0)
|
||||
{
|
||||
int aVertId = myTriangleArray->VertexNumber();
|
||||
myTriangleArray->AddTriangleEdges (aVertId, aVertId - aStripsNb - 2, aVertId - 1);
|
||||
myTriangleArray->AddTriangleEdges (aVertId - aStripsNb - 2, aVertId, aVertId - aStripsNb - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aSquares = aV % 2 == 0
|
||||
? aColorlessArr
|
||||
: aColoredArr;
|
||||
|
||||
aVertId = aSquares->VertexNumber();
|
||||
aSquares->AddTriangleEdges (aVertId, aVertId - aStripsNb - 1, aVertId - 1);
|
||||
aSquares->AddTriangleEdges (aVertId - aStripsNb - 1, aVertId, aVertId - aStripsNb);
|
||||
}
|
||||
}
|
||||
}
|
||||
myTranslatorGroup->AddPrimitiveArray (aColoredArr);
|
||||
myTranslatorGroup->AddPrimitiveArray (aColorlessArr);
|
||||
}
|
||||
else
|
||||
{
|
||||
myTriangleArray = Prs3d_Arrow::DrawShaded (gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
||||
myAxisRadius,
|
||||
myLength,
|
||||
myAxisRadius * 1.5,
|
||||
anArrowLength,
|
||||
myFacettesNumber);
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
}
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
|
||||
if (myHighlightTranslator.IsNull())
|
||||
{
|
||||
@@ -1803,11 +1437,10 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
if (myHasScaling)
|
||||
{
|
||||
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
||||
const Standard_ShortReal aBoxSize = theSkinMode == ManipulatorSkin_Shaded ? myBoxSize : myBoxSize * 0.5f + myIndent;
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), aBoxSize, theSkinMode);
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
||||
|
||||
myScalerGroup = thePrs->NewGroup();
|
||||
myScalerGroup->SetClosed (theSkinMode == ManipulatorSkin_Shaded);
|
||||
myScalerGroup->SetClosed (true);
|
||||
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myScalerGroup->AddPrimitiveArray (myCube.Array());
|
||||
|
||||
@@ -1828,11 +1461,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
|
||||
if (myHasRotation)
|
||||
{
|
||||
myCircleRadius = myInnerRadius + myIndent * 2.0f + myDiskThickness * 0.5f;
|
||||
const Standard_Real anAngle = theSkinMode == ManipulatorSkin_Shaded ? M_PI * 2.0f : M_PI;
|
||||
myCircle.Init (myInnerRadius + myIndent * 2.0f, Size(),
|
||||
gp_Ax1 (gp::Origin(), myReferenceAxis.Direction()),
|
||||
anAngle, myFacettesNumber * 2);
|
||||
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
|
||||
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
|
||||
myRotatorGroup = thePrs->NewGroup ();
|
||||
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
|
||||
@@ -1862,17 +1492,10 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
else
|
||||
aXDirection = gp::DX();
|
||||
|
||||
gp_Pnt aPosition = theSkinMode == ManipulatorSkin_Flat
|
||||
? gp_Pnt (myReferenceAxis.Direction().Reversed().XYZ() * (myAxisRadius))
|
||||
: gp::Origin();
|
||||
Standard_ShortReal aRadius = theSkinMode == ManipulatorSkin_Flat ? myLength : myInnerRadius + myIndent * 2;
|
||||
mySector.Init (aRadius, gp_Ax1 (aPosition, myReferenceAxis.Direction()), aXDirection, theSkinMode, myFacettesNumber * 2);
|
||||
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
|
||||
myDraggerGroup = thePrs->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = theSkinMode == ManipulatorSkin_Flat
|
||||
? theAspect->Aspect()
|
||||
: new Graphic3d_AspectFillArea3d();
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
|
||||
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
||||
|
||||
@@ -1886,8 +1509,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
}
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = myHighlightDragger->CurrentGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (aFillArea);
|
||||
aGroup->AddPrimitiveArray (mySector.Array());
|
||||
aGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
aGroup->AddPrimitiveArray(mySector.Array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -189,13 +189,6 @@ public:
|
||||
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
|
||||
Standard_EXPORT void Transform (const gp_Trsf& aTrsf);
|
||||
|
||||
//! Apply camera transformation to flat skin manipulator
|
||||
Standard_EXPORT void RecomputeTransformation (const Handle(Graphic3d_Camera)& theCamera) Standard_OVERRIDE;
|
||||
|
||||
//! Recomputes sensitive primitives for the given selection mode.
|
||||
//! @param theMode selection mode to recompute sensitive primitives
|
||||
Standard_EXPORT void RecomputeSelection (const AIS_ManipulatorMode theMode);
|
||||
|
||||
//! Reset start (reference) transformation.
|
||||
//! @param theToApply [in] option to apply or to cancel the started transformation.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
@@ -275,18 +268,6 @@ public: //! @name Configuration of graphical transformations
|
||||
|
||||
public: //! @name Setters for parameters
|
||||
|
||||
enum ManipulatorSkin
|
||||
{
|
||||
ManipulatorSkin_Shaded,
|
||||
ManipulatorSkin_Flat
|
||||
};
|
||||
|
||||
//! @return current manipulator skin mode.
|
||||
ManipulatorSkin SkinMode() const { return mySkinMode; }
|
||||
|
||||
//! Sets skin mode for the manipulator.
|
||||
Standard_EXPORT void SetSkinMode (const ManipulatorSkin theSkinMode);
|
||||
|
||||
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
|
||||
|
||||
Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
|
||||
@@ -426,10 +407,9 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
void Init (const Standard_ShortReal theInnerRadius,
|
||||
const Standard_ShortReal theOuterRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Real theAngle,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -448,7 +428,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
void Init (const Standard_ShortReal theRadius,
|
||||
const gp_Pnt& thePosition,
|
||||
const ManipulatorSkin theSkinMode,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
@@ -465,9 +444,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Cube() { }
|
||||
~Cube() { }
|
||||
|
||||
void Init (const gp_Ax1& thePosition,
|
||||
const Standard_ShortReal myBoxSize,
|
||||
const ManipulatorSkin theSkinMode);
|
||||
void Init (const gp_Ax1& thePosition, const Standard_ShortReal myBoxSize);
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
@@ -498,7 +475,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
void Init(const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const ManipulatorSkin theSkinMode,
|
||||
const Standard_Integer theSlicesNb = 5,
|
||||
const Standard_Integer theStacksNb = 5);
|
||||
|
||||
@@ -523,8 +499,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect,
|
||||
const ManipulatorSkin theSkinMode);
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect);
|
||||
|
||||
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
||||
|
||||
@@ -598,12 +573,8 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
Standard_ShortReal AxisLength() const { return myLength; }
|
||||
|
||||
Standard_ShortReal BoxSize() const { return myBoxSize; }
|
||||
|
||||
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
|
||||
|
||||
Standard_ShortReal Indent() const { return myIndent; }
|
||||
|
||||
void SetAxisRadius (const Standard_ShortReal theValue) { myAxisRadius = theValue; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const { return myHighlightTranslator; }
|
||||
@@ -628,8 +599,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
Standard_ShortReal Size() const { return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f; }
|
||||
|
||||
Standard_ShortReal InnerRadius() const { return myInnerRadius + myIndent * 2.0f; }
|
||||
|
||||
gp_Pnt ScalerCenter (const gp_Pnt& theLocation) const { return theLocation.XYZ() + myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f); }
|
||||
|
||||
void SetSize (const Standard_ShortReal theValue)
|
||||
@@ -705,23 +674,17 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Handle(Prs3d_Presentation) myHighlightDragger;
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
|
||||
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Axis myAxes[3]; //!< Tree axes of the manipulator.
|
||||
Axis myAxes[3]; //!< Tree axes of the manipulator.
|
||||
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
|
||||
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
|
||||
|
||||
Disk myCircle; //!< Outer circle
|
||||
Handle(Graphic3d_Group) myCircleGroup;
|
||||
|
||||
Disk mySector; //!< Sector indicating the rotation angle
|
||||
Handle(Graphic3d_Group) mySectorGroup;
|
||||
|
||||
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
|
||||
ManipulatorSkin mySkinMode; //!< Name of active skin mode.
|
||||
|
||||
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
||||
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
||||
|
@@ -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();
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
@@ -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())
|
||||
|
@@ -2149,13 +2149,6 @@ void AIS_ViewController::handleCameraActions (const Handle(AIS_InteractiveContex
|
||||
myGL.Orientation.ToFitAll = false;
|
||||
}
|
||||
|
||||
AIS_ListOfInteractive anObjects;
|
||||
theCtx->DisplayedObjects (anObjects);
|
||||
for (AIS_ListIteratorOfListOfInteractive anObjIter (anObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
anObjIter.Value()->RecomputeTransformation (theView->Camera());
|
||||
}
|
||||
|
||||
if (myGL.IsNewGesture)
|
||||
{
|
||||
if (myAnchorPointPrs1->HasInteractiveContext())
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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())
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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 {
|
||||
|
@@ -291,8 +291,6 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
||||
return;
|
||||
}
|
||||
|
||||
theStruct->RecomputeTransformation (myCamera);
|
||||
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
|
||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
@@ -599,11 +597,6 @@ void Graphic3d_CView::Compute()
|
||||
aStructIter.Value()->SetHLRValidation (Standard_False);
|
||||
}
|
||||
|
||||
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
aStructIter.Value()->RecomputeTransformation (myCamera);
|
||||
}
|
||||
|
||||
if (!ComputedMode())
|
||||
{
|
||||
return;
|
||||
@@ -704,8 +697,6 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
anIndex = 0;
|
||||
}
|
||||
|
||||
theStructure->RecomputeTransformation (myCamera);
|
||||
|
||||
Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (theStructure->Visual());
|
||||
if (anAnswer == Graphic3d_TOA_NO)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -136,12 +136,6 @@ public:
|
||||
//! sets the flipping to theIsEnabled state.
|
||||
Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled, const gp_Ax2& theRefPlane) = 0;
|
||||
|
||||
//! Return transformation.
|
||||
const gp_Trsf& Transformation() const { return myTrsf; }
|
||||
|
||||
//! Assign transformation.
|
||||
virtual void SetTransformation (const gp_Trsf& theTrsf) { myTrsf = theTrsf; }
|
||||
|
||||
//! Returns true if the group contains Polygons, Triangles or Quadrangles.
|
||||
bool ContainsFacet() const { return myContainsFacet; }
|
||||
|
||||
@@ -298,7 +292,6 @@ protected:
|
||||
|
||||
Graphic3d_Structure* myStructure; //!< pointer to the parent structure
|
||||
Graphic3d_BndBox4f myBounds; //!< bounding box
|
||||
gp_Trsf myTrsf; //!< group transformation
|
||||
bool myIsClosed; //!< flag indicating closed volume
|
||||
bool myContainsFacet; //!< flag indicating that this group contains face primitives
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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";
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
@@ -184,12 +193,6 @@ public:
|
||||
(void )theStructure;
|
||||
}
|
||||
|
||||
//! Calculates structure transformation for specific camera position
|
||||
virtual void RecomputeTransformation (const Handle(Graphic3d_Camera)& theProjector)
|
||||
{
|
||||
(void )theProjector;
|
||||
}
|
||||
|
||||
//! Forces a new construction of the structure <me>
|
||||
//! if <me> is displayed and TOS_COMPUTED.
|
||||
Standard_EXPORT void ReCompute();
|
||||
@@ -228,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 :
|
||||
@@ -245,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
|
||||
@@ -340,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.
|
||||
@@ -367,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; }
|
||||
|
@@ -1140,7 +1140,7 @@ void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boo
|
||||
Standard_Integer aValidIndex = theIndex;
|
||||
|
||||
Standard_Real aMinDelta = myCurveResolution * 0.5;
|
||||
Standard_Real aDeltaRestrictor = myLastParameter - myFirstParameter;
|
||||
Standard_Real aDeltaRestrictor = 0.1 * (myLastParameter - myFirstParameter);
|
||||
|
||||
if(aMinDelta > aDeltaRestrictor)
|
||||
aMinDelta = aDeltaRestrictor * 0.5;
|
||||
@@ -1202,7 +1202,7 @@ void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boo
|
||||
|
||||
aDelta = (pointfound) ? (aDelta * 2.) : (aDelta * 0.5);
|
||||
aDelta = (aDelta < aDeltaRestrictor) ? aDelta : aDeltaRestrictor;
|
||||
|
||||
|
||||
aCurPar = (ToIncreaseParameter) ? (aPrevPar + aDelta) : (aPrevPar - aDelta);
|
||||
|
||||
|
||||
|
@@ -723,14 +723,14 @@ Standard_Boolean IntTools_Context::IsPointInFace
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bIn;
|
||||
Standard_Boolean bIn = Standard_False;
|
||||
Standard_Real aDist;
|
||||
//
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
|
||||
aProjector.Perform(aP);
|
||||
//
|
||||
bIn = aProjector.IsDone();
|
||||
if (bIn) {
|
||||
Standard_Boolean bDone = aProjector.IsDone();
|
||||
if (bDone) {
|
||||
aDist = aProjector.LowerDistance();
|
||||
if (aDist < aTol) {
|
||||
Standard_Real U, V;
|
||||
|
@@ -93,13 +93,18 @@ Standard_Boolean IntTools_EdgeFace::IsCoincident()
|
||||
myS.GetType() == GeomAbs_Plane)
|
||||
aNbSeg = 2; // Check only three points for Line/Plane intersection
|
||||
|
||||
const Standard_Real aTresh=0.5;
|
||||
const Standard_Real aTresh = 0.5;
|
||||
const Standard_Integer aTreshIdxF = RealToInt((aNbSeg+1)*0.25),
|
||||
aTreshIdxL = RealToInt((aNbSeg+1)*0.75);
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(myFace);
|
||||
|
||||
aT1=myRange.First();
|
||||
aT2=myRange.Last();
|
||||
Standard_Real aBndShift = 0.01 * (aT2 - aT1);
|
||||
//Shifting first and last curve points in order to avoid projection
|
||||
//on surface boundary and rejection projection point with minimal distance
|
||||
aT1 += aBndShift;
|
||||
aT2 -= aBndShift;
|
||||
dT=(aT2-aT1)/aNbSeg;
|
||||
//
|
||||
Standard_Boolean isClassified = Standard_False;
|
||||
@@ -115,8 +120,11 @@ Standard_Boolean IntTools_EdgeFace::IsCoincident()
|
||||
//
|
||||
|
||||
aD=aProjector.LowerDistance();
|
||||
if (aD>myCriteria) {
|
||||
continue;
|
||||
if (aD > myCriteria) {
|
||||
if (aD > 100. * myCriteria)
|
||||
return Standard_False;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
||||
|
@@ -215,7 +215,7 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
PolygonVerticesFor3D, PolygonBoundsFor3D );
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
|
||||
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NameOfMaterial_Plastified, Graphic3d_NameOfMaterial_Plastified };
|
||||
for (Standard_Integer i = 0; i < 2; i++)
|
||||
{
|
||||
// OCC20644 "plastic" is most suitable here, as it is "non-physic"
|
||||
@@ -478,7 +478,7 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
CustomBuild(Prs, aCustomElements, IDsToExclude, DisplayMode);
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect aMaterial2[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
|
||||
Graphic3d_MaterialAspect aMaterial2[2] = { Graphic3d_NameOfMaterial_Plastified, Graphic3d_NameOfMaterial_Plastified };
|
||||
for (Standard_Integer i = 0; i < 2; i++)
|
||||
{
|
||||
// OCC20644 "plastic" is most suitable here, as it is "non-physic"
|
||||
|
@@ -82,7 +82,7 @@ MeshVS_Mesh::MeshVS_Mesh (const Standard_Boolean theIsAllowOverlapped )
|
||||
SetHilightMode( MeshVS_DMF_WireFrame ); // Wireframe as default hilight mode
|
||||
|
||||
SetColor ( Quantity_NOC_WHITE );
|
||||
SetMaterial ( Graphic3d_NOM_PLASTIC );
|
||||
SetMaterial (Graphic3d_NameOfMaterial_Plastified);
|
||||
|
||||
myCurrentDrawer = new MeshVS_Drawer();
|
||||
myCurrentDrawer->SetColor ( MeshVS_DA_InteriorColor, Quantity_NOC_BLUE4 );
|
||||
@@ -123,8 +123,8 @@ MeshVS_Mesh::MeshVS_Mesh (const Standard_Boolean theIsAllowOverlapped )
|
||||
myHilightDrawer->SetColor ( MeshVS_DA_EdgeColor, Quantity_NOC_GREEN );
|
||||
myHilightDrawer->SetInteger ( MeshVS_DA_EdgeType, Aspect_TOL_SOLID );
|
||||
myHilightDrawer->SetDouble ( MeshVS_DA_EdgeWidth, 1.0 );
|
||||
myHilightDrawer->SetMaterial ( MeshVS_DA_FrontMaterial, Graphic3d_NOM_PLASTIC );
|
||||
myHilightDrawer->SetMaterial ( MeshVS_DA_BackMaterial, Graphic3d_NOM_PLASTIC );
|
||||
myHilightDrawer->SetMaterial ( MeshVS_DA_FrontMaterial, Graphic3d_NameOfMaterial_Plastified );
|
||||
myHilightDrawer->SetMaterial ( MeshVS_DA_BackMaterial, Graphic3d_NameOfMaterial_Plastified );
|
||||
|
||||
myHilightDrawer->SetColor ( MeshVS_DA_BeamColor, Quantity_NOC_GRAY80 );
|
||||
myHilightDrawer->SetInteger ( MeshVS_DA_BeamType, Aspect_TOL_SOLID );
|
||||
|
@@ -189,7 +189,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
|
||||
// Draw faces with nodal color
|
||||
// OCC20644 Use "plastic" material as it is "non-physic" and so it is easier to get the required colors
|
||||
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
|
||||
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NameOfMaterial_Plastified, Graphic3d_NameOfMaterial_Plastified };
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
|
||||
|
@@ -96,10 +96,10 @@ Handle( Graphic3d_AspectFillArea3d ) MeshVS_Tool::CreateAspectFillArea3d
|
||||
( const Handle(MeshVS_Drawer)& theDr,
|
||||
const Standard_Boolean UseDefaults )
|
||||
{
|
||||
Graphic3d_MaterialAspect aFrMat = Graphic3d_NOM_BRASS;
|
||||
Graphic3d_MaterialAspect aBackMat = Graphic3d_NOM_BRASS;
|
||||
Standard_Integer aFrMatI = (Standard_Integer)Graphic3d_NOM_BRASS;
|
||||
Standard_Integer aBackMatI = (Standard_Integer)Graphic3d_NOM_BRASS;
|
||||
Graphic3d_MaterialAspect aFrMat = Graphic3d_NameOfMaterial_Brass;
|
||||
Graphic3d_MaterialAspect aBackMat = Graphic3d_NameOfMaterial_Brass;
|
||||
Standard_Integer aFrMatI = (Standard_Integer)Graphic3d_NameOfMaterial_Brass;
|
||||
Standard_Integer aBackMatI = (Standard_Integer)Graphic3d_NameOfMaterial_Brass;
|
||||
|
||||
if ( !theDr->GetInteger ( MeshVS_DA_FrontMaterial, aFrMatI ) && !UseDefaults )
|
||||
return 0;
|
||||
|
@@ -82,13 +82,17 @@ Standard_Boolean Message_MsgFile::Load (const Standard_CString theDirName,
|
||||
//Called : from loadFile()
|
||||
//=======================================================================
|
||||
|
||||
template <class _Char> static inline Standard_Boolean
|
||||
getString (_Char *& thePtr,
|
||||
template <typename CharType> struct TCollection_String;
|
||||
template <> struct TCollection_String <Standard_Character> { typedef TCollection_AsciiString type; };
|
||||
template <> struct TCollection_String <Standard_ExtCharacter> { typedef TCollection_ExtendedString type; };
|
||||
|
||||
template <class CharType> static inline Standard_Boolean
|
||||
getString (CharType *& thePtr,
|
||||
TCollection_ExtendedString& theString,
|
||||
Standard_Integer& theLeftSpaces)
|
||||
{
|
||||
_Char * anEndPtr = thePtr;
|
||||
_Char * aPtr;
|
||||
CharType * anEndPtr = thePtr;
|
||||
CharType * aPtr;
|
||||
Standard_Integer aLeftSpaces;
|
||||
|
||||
do
|
||||
@@ -98,7 +102,7 @@ getString (_Char *& thePtr,
|
||||
aLeftSpaces = 0;
|
||||
for (;;)
|
||||
{
|
||||
_Char aChar = * aPtr;
|
||||
CharType aChar = * aPtr;
|
||||
if (aChar == ' ') aLeftSpaces++;
|
||||
else if (aChar == '\t') aLeftSpaces += 8;
|
||||
else if (aChar == '\r' || * aPtr == '\n') aLeftSpaces = 0;
|
||||
@@ -121,7 +125,7 @@ getString (_Char *& thePtr,
|
||||
thePtr = anEndPtr;
|
||||
if (*thePtr)
|
||||
*thePtr++ = '\0';
|
||||
theString = TCollection_ExtendedString (aPtr);
|
||||
theString = typename TCollection_String<CharType>::type (aPtr);
|
||||
theLeftSpaces = aLeftSpaces;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
//! Compute points of the Halton sequence with with digit-permutations for different bases.
|
||||
//! Compute points of the Halton sequence with digit-permutations for different bases.
|
||||
class OpenGl_HaltonSampler
|
||||
{
|
||||
public:
|
||||
@@ -35,19 +35,13 @@ public:
|
||||
public:
|
||||
|
||||
//! Init the permutation arrays using Faure-permutations.
|
||||
//! Alternatively, initRandom() can be called before the sampling functionality can be used.
|
||||
void initFaure();
|
||||
|
||||
//! Init the permutation arrays using randomized permutations.
|
||||
//! Alternatively, initFaure() can be called before the sampling functionality can be used.
|
||||
//! The client needs to specify a random number generator function object that can be used to generate a random sequence of integers.
|
||||
//! That is: if f is a random number generator and N is a positive integer,
|
||||
//! then f(N) will return an integer less than N and greater than or equal to 0.
|
||||
template <typename Random_number_generator>
|
||||
void initRandom (Random_number_generator& theRand);
|
||||
OpenGl_HaltonSampler()
|
||||
{
|
||||
initFaure();
|
||||
}
|
||||
|
||||
//! Return the Halton sample for the given dimension (component) and index.
|
||||
//! The client must have called initRandom or initFaure() at least once before.
|
||||
//! The client must have called initFaure() at least once before.
|
||||
//! dimension must be smaller than the value returned by get_num_dimensions().
|
||||
float sample (unsigned theDimension, unsigned theIndex) const
|
||||
{
|
||||
@@ -62,6 +56,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//! Init the permutation arrays using Faure-permutations.
|
||||
void initFaure();
|
||||
|
||||
static unsigned short invert (unsigned short theBase, unsigned short theDigits,
|
||||
unsigned short theIndex, const std::vector<unsigned short>& thePerm)
|
||||
{
|
||||
@@ -159,30 +156,4 @@ inline void OpenGl_HaltonSampler::initFaure()
|
||||
initTables (aPerms);
|
||||
}
|
||||
|
||||
template <typename Random_number_generator>
|
||||
void OpenGl_HaltonSampler::initRandom (Random_number_generator& theRand)
|
||||
{
|
||||
const unsigned THE_MAX_BASE = 5u;
|
||||
std::vector<std::vector<unsigned short> > aPerms(THE_MAX_BASE + 1);
|
||||
for (unsigned k = 1; k <= 3; ++k) // Keep identity permutations for base 1, 2, 3.
|
||||
{
|
||||
aPerms[k].resize (k);
|
||||
for (unsigned i = 0; i < k; ++i)
|
||||
{
|
||||
aPerms[k][i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned aBase = 4; aBase <= THE_MAX_BASE; ++aBase)
|
||||
{
|
||||
aPerms[aBase].resize (aBase);
|
||||
for (unsigned i = 0; i < aBase; ++i)
|
||||
{
|
||||
aPerms[aBase][i] = i;
|
||||
}
|
||||
std::random_shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand);
|
||||
}
|
||||
initTables (aPerms);
|
||||
}
|
||||
|
||||
#endif // _OpenGl_HaltonSampler_H
|
||||
|
@@ -389,40 +389,10 @@ void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorksp
|
||||
myInstancedStructure->renderGeometry (theWorkspace, theHasClosed);
|
||||
}
|
||||
|
||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
const gp_Trsf& aTrsf = aGroupIter.Value()->Transformation();
|
||||
applyTransformation (aCtx, aTrsf, Standard_True);
|
||||
|
||||
theHasClosed = theHasClosed || aGroupIter.Value()->IsClosed();
|
||||
aGroupIter.Value()->Render (theWorkspace);
|
||||
|
||||
applyTransformation (aCtx, aTrsf, Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : applyTransformation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::applyTransformation (const Handle(OpenGl_Context)& theContext,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean toEnable) const
|
||||
{
|
||||
if (toEnable)
|
||||
{
|
||||
OpenGl_Mat4 aTrsf;
|
||||
theTrsf.GetMat4 (aTrsf);
|
||||
theContext->ModelWorldState.Push();
|
||||
OpenGl_Mat4& aModelWorld = theContext->ModelWorldState.ChangeCurrent();
|
||||
aModelWorld = aModelWorld * aTrsf;
|
||||
theContext->ApplyModelViewMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
theContext->ModelWorldState.Pop();
|
||||
theContext->ApplyModelViewMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -147,14 +147,6 @@ protected:
|
||||
//! Render the bounding box.
|
||||
Standard_EXPORT void renderBoundingBox(const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
|
||||
//! Apply transformation into context.
|
||||
//! @param theWorkspace current workspace
|
||||
//! @param theTrsf transformation
|
||||
//! @param toEnable flag to switch ON/OFF transformation
|
||||
Standard_EXPORT void applyTransformation (const Handle(OpenGl_Context)& theContext,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean toEnable) const;
|
||||
|
||||
protected:
|
||||
|
||||
OpenGl_Structure* myInstancedStructure;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user