mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9cc4eb28e6 | ||
|
fb390c0ef0 | ||
|
5c9a669080 | ||
|
0046a27b65 |
@@ -565,26 +565,6 @@ 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 headers
|
||||
PATH_SUFFIXES include inc
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR NAMES ${HEADER_NAME}
|
||||
PATH_SUFFIXES include inc headers
|
||||
PATH_SUFFIXES include inc
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
endif()
|
||||
@@ -125,14 +125,10 @@ 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)
|
||||
@@ -188,7 +184,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 bin/win${COMPILER_BITNESS}
|
||||
PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
|
||||
# find directory recursive
|
||||
@@ -242,7 +238,6 @@ 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)
|
||||
@@ -285,17 +280,14 @@ 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,13 +42,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenVR
|
||||
if (USE_OPENVR)
|
||||
set (CSF_OpenVR "openvr_api")
|
||||
else()
|
||||
set (CSF_OpenVR)
|
||||
endif()
|
||||
|
||||
# TCL/TK
|
||||
if (USE_TCL)
|
||||
if (WIN32)
|
||||
|
@@ -1,5 +0,0 @@
|
||||
# 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,7 +89,6 @@ 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")
|
||||
@@ -163,9 +162,6 @@ 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|cpp|c)$
|
||||
mac { aCxxRegex = ^.*\.(cxx|cpp|c|m|mm)$ }
|
||||
aCxxRegex = ^.*\.(cxx|c)$
|
||||
mac { aCxxRegex = ^.*\.(cxx|c|m|mm)$ }
|
||||
|
||||
# Auxiliary function for probing file extension
|
||||
defineTest (occCheckExtension) {
|
||||
|
@@ -14,7 +14,6 @@ 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,13 +10,12 @@ 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_DIR@"
|
||||
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIRS@"
|
||||
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,7 +140,6 @@ 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"
|
||||
|
@@ -260,6 +260,12 @@ TCollection_AsciiString=<mylength,d> <mystring,s>
|
||||
TCollection_HAsciiString=<myString.mylength,d> <myString.mystring,s>
|
||||
TCollection_ExtendedString=<mylength,d> <mystring,su>
|
||||
TCollection_HExtendedString=<myString.mylength,d> <myString.mystring,su>
|
||||
TCollection_BaseSequence=size=<Size,d> curr=<CurrentIndex,d>
|
||||
TCollection_BasicMap=size=<mySize,d>
|
||||
NCollection_BaseSequence=size=<mySize,d> curr=<myCurrentIndex,d>
|
||||
NCollection_BaseList=length=<myLength,d>
|
||||
NCollection_BaseMap=size=<mySize,d> buckets=<myNbBuckets>
|
||||
NCollection_BaseVector=length=<myLength,d>
|
||||
TDF_Label=<myLabelNode,x> tag=<myLabelNode->myTag>
|
||||
TDF_LabelNode=tag=<myTag,d>
|
||||
TDocStd_Document=format=<myStorageFormat.mystring,su> count=<count,d> <,t>
|
||||
|
@@ -77,6 +77,13 @@
|
||||
<Type Name="TCollection_HExtendedString">
|
||||
<DisplayString>{myString.mylength}: {(wchar_t *)myString.mystring,su}</DisplayString>
|
||||
</Type>
|
||||
<Type Name="TCollection_BaseSequence">
|
||||
<DisplayString>TCollection_Sequence [{Size}], curr={CurrentIndex}</DisplayString>
|
||||
</Type>
|
||||
<Type Name="TCollection_BasicMap">
|
||||
<AlternativeType Name="NCollection_BaseMap"/>
|
||||
<DisplayString>TCollection_Map [{mySize}]</DisplayString>
|
||||
</Type>
|
||||
<Type Name="TColStd_PackedMapOfInteger">
|
||||
<DisplayString>TColStd_PackedMapOfInteger [{myExtent}]</DisplayString>
|
||||
</Type>
|
||||
|
@@ -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 pre-built packages of many of the listed libraries are available at
|
||||
Note that pe-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,7 +366,6 @@ 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) |
|
||||
@@ -584,14 +583,7 @@ 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.
|
||||
|
||||
**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/.
|
||||
**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
|
||||
@@ -629,8 +621,7 @@ 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,24 +2149,3 @@ 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.
|
||||
|
||||
@section upgrade_occt760 Upgrade to OCCT 7.6.0
|
||||
|
||||
@subsection upgrade_760_trimming_surface Trimming surface
|
||||
|
||||
Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim.
|
||||
For example:
|
||||
~~~~~
|
||||
Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U
|
||||
Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V
|
||||
~~~~~
|
||||
gives different result.
|
||||
In current version ST1 - surface trimmed only along V, U trim is removed;
|
||||
After modification ST1 - surface trimmed along U and V, U trim is kept.
|
||||
|
@@ -4879,9 +4879,9 @@ bsplinesurf s \
|
||||
|
||||
Syntax:
|
||||
~~~~~
|
||||
trim newname name [u1 u2 [v1 v2] [usense vsense]]
|
||||
trimu newname name u1 u2 [usense]
|
||||
trimv newname name v1 v2 [vsense]
|
||||
trim newname name [u1 u2 [v1 v2]]
|
||||
trimu newname name
|
||||
trimv newname name
|
||||
~~~~~
|
||||
|
||||
The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package.
|
||||
|
@@ -1356,7 +1356,9 @@ MF.Add(W);
|
||||
TopoDS_Face F = MF;
|
||||
~~~~~
|
||||
|
||||
More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked).
|
||||
More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked). The edges on a Face must have a parametric curve description.
|
||||
|
||||
If there is no parametric curve for an edge of the wire on the Face it is computed by projection.
|
||||
|
||||
For one wire, a simple syntax is provided to construct the face from the surface and the wire. The above lines could be written:
|
||||
|
||||
@@ -1364,8 +1366,6 @@ For one wire, a simple syntax is provided to construct the face from the surfac
|
||||
TopoDS_Face F = BRepBuilderAPI_MakeFace(C,W);
|
||||
~~~~~
|
||||
|
||||
The edges on a face must have a parametric curve description. If there is no parametric curve for an edge of the wire on the face it is computed by projection, moreover, the calculation is possible only for the planar face.
|
||||
|
||||
A planar face can be created from only a wire, provided this wire defines a plane. For example, to create a planar face from a set of points you can use *BRepBuilderAPI_MakePolygon* and *BRepBuilderAPI_MakeFace*.
|
||||
|
||||
~~~~~
|
||||
|
@@ -937,10 +937,10 @@ The following steps are performed:
|
||||
**TopTools** package contains tools for exploiting the *TopoDS* data structure. It is an instantiation of the tools from *TCollection* package with the Shape classes of *TopoDS*.
|
||||
|
||||
|
||||
* *TopTools_Array1OfShape, HArray1OfShape* -- instantiation of the *NCollection_Array1* with *TopoDS_Shape*.
|
||||
* *TopTools_SequenceOfShape* -- instantiation of the *NCollection_Sequence* with *TopoDS_Shape*.
|
||||
* *TopTools_MapOfShape* - instantiation of the *NCollection_Map*. Allows the construction of sets of shapes.
|
||||
* *TopTools_IndexedMapOfShape* - instantiation of the *NCollection_IndexedMap*. Allows the construction of tables of shapes and other data structures.
|
||||
* *TopTools_Array1OfShape, HArray1OfShape* -- instantiation of the *TCollection_Array1* and *TCollection_HArray1* with *TopoDS_Shape*.
|
||||
* *TopTools_SequenceOfShape* -- instantiation of the *TCollection_Sequence* with *TopoDS_Shape*.
|
||||
* *TopTools_MapOfShape* - instantiation of the *TCollection_Map*. Allows the construction of sets of shapes.
|
||||
* *TopTools_IndexedMapOfShape* - instantiation of the *TCollection_IndexedMap*. Allows the construction of tables of shapes and other data structures.
|
||||
|
||||
With a *TopTools_Map*, a set of references to Shapes can be kept without duplication.
|
||||
The following example counts the size of a data structure as a number of *TShapes*.
|
||||
|
@@ -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_NameOfMaterial_Gold, Graphic3d_NameOfMaterial_Gold);
|
||||
Graphic3d_NOM_GOLD, Graphic3d_NOM_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_NameOfMaterial_Brass);
|
||||
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NameOfMaterial_Gold);
|
||||
Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NOM_BRASS);
|
||||
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NOM_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_NameOfMaterial_Gold, Standard_False);
|
||||
myAISContext()->SetMaterial (aPrs, Graphic3d_NOM_GOLD, Standard_False);
|
||||
myAISContext()->SetDisplayMode(aPrs, AIS_Shaded, Standard_False);
|
||||
myAISContext()->Display (aPrs, Standard_True);
|
||||
return true;
|
||||
|
51
samples/OCCTOverview/code/DataExchange.json
Normal file
51
samples/OCCTOverview/code/DataExchange.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
<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,10 +128,8 @@ void DataExchangeSamples::ExecuteSample (const TCollection_AsciiString& theSampl
|
||||
void DataExchangeSamples::BrepExportSample()
|
||||
{
|
||||
Standard_Boolean anIsShapeExist = Standard_False;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||
{
|
||||
anIsShapeExist = Standard_True;
|
||||
@@ -169,10 +167,8 @@ void DataExchangeSamples::StepExportSample()
|
||||
}
|
||||
|
||||
STEPControl_Writer aStepWriter;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||
{
|
||||
aStatus = aStepWriter.Transfer(aShape->Shape(), myStepType);
|
||||
@@ -211,10 +207,8 @@ void DataExchangeSamples::IgesExportSample()
|
||||
Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
|
||||
|
||||
Standard_Boolean anIsShapeExist = Standard_False;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||
{
|
||||
anIsShapeExist = Standard_True;
|
||||
@@ -246,10 +240,8 @@ void DataExchangeSamples::StlExportSample()
|
||||
aBuilder.MakeCompound(aTopoCompound);
|
||||
|
||||
Standard_Boolean anIsShapeExist = Standard_False;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||
{
|
||||
anIsShapeExist = Standard_True;
|
||||
@@ -281,10 +273,8 @@ void DataExchangeSamples::VrmlExportSample()
|
||||
aBrepBuilder.MakeCompound(aTopoCompound);
|
||||
|
||||
Standard_Boolean anIsShapeExist = Standard_False;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||
{
|
||||
anIsShapeExist = Standard_True;
|
||||
@@ -392,10 +382,8 @@ void DataExchangeSamples::IgesImportSample()
|
||||
Standard_Boolean DataExchangeSamples::CheckFacetedBrep()
|
||||
{
|
||||
Standard_Boolean anError = Standard_False;
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter (myObject3d);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
||||
{
|
||||
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_AsIs),
|
||||
myStepType (STEPControl_StepModelType::STEPControl_AsIs),
|
||||
myView (theView)
|
||||
{
|
||||
//
|
||||
|
@@ -8,15 +8,15 @@ AdaptorVec_AIS.cxx
|
||||
AdaptorVec_AIS.h
|
||||
BaseSample.cxx
|
||||
BaseSample.h
|
||||
DataExchange.xml
|
||||
DataExchange.json
|
||||
DataExchangeSamples.cxx
|
||||
DataExchangeSamples.h
|
||||
Geometry.xml
|
||||
Geometry.json
|
||||
GeometrySamples.cxx
|
||||
GeometrySamples.h
|
||||
MakeBottle.cxx
|
||||
MakeBottle.h
|
||||
Ocaf.xml
|
||||
Ocaf.json
|
||||
OcafSamples.cxx
|
||||
OcafSamples.h
|
||||
Sample2D_Face.cxx
|
||||
@@ -34,15 +34,15 @@ TOcafFunction_CylDriver.cxx
|
||||
TOcafFunction_CylDriver.h
|
||||
TOcaf_Application.cxx
|
||||
TOcaf_Application.h
|
||||
Topology.xml
|
||||
Topology.json
|
||||
TopologySamples.cxx
|
||||
TopologySamples.h
|
||||
Triangulation.xml
|
||||
Triangulation.json
|
||||
TriangulationSamples.cxx
|
||||
TriangulationSamples.h
|
||||
Viewer2d.xml
|
||||
Viewer2d.json
|
||||
Viewer2dSamples.cxx
|
||||
Viewer2dSamples.h
|
||||
Viewer3d.xml
|
||||
Viewer3d.json
|
||||
Viewer3dSamples.cxx
|
||||
Viewer3dSamples.h
|
||||
|
287
samples/OCCTOverview/code/Geometry.json
Normal file
287
samples/OCCTOverview/code/Geometry.json
Normal file
@@ -0,0 +1,287 @@
|
||||
{
|
||||
"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": ""
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
<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>
|
53
samples/OCCTOverview/code/Ocaf.json
Normal file
53
samples/OCCTOverview/code/Ocaf.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
<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,11 +298,8 @@ void OcafSamples::ModifyBoxOcafSample()
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
Standard_Integer aBoxCount(0);
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
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();
|
||||
@@ -401,10 +398,8 @@ void OcafSamples::ModifyCylinderOcafSample()
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
Standard_Integer aCylCount(0);
|
||||
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
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();
|
||||
@@ -539,7 +534,7 @@ void OcafSamples::DialogOpenOcafSample()
|
||||
}
|
||||
// Open the document in the current application
|
||||
PCDM_ReaderStatus aReaderStatus = anOcaf_Application->Open(myFileName, myOcafDoc);
|
||||
if (aReaderStatus == PCDM_RS_OK)
|
||||
if (aReaderStatus == PCDM_ReaderStatus::PCDM_RS_OK)
|
||||
{
|
||||
// Connect the document CAF (myDoc) with the AISContext (myAISContext)
|
||||
TPrsStd_AISViewer::New(myOcafDoc->Main(), myViewer);
|
||||
@@ -568,7 +563,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_SS_OK)
|
||||
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
|
||||
{
|
||||
myResult << "The file was saved successfully" << std::endl;
|
||||
}
|
||||
@@ -585,7 +580,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_SS_OK)
|
||||
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
|
||||
{
|
||||
myResult << "The file was saved successfully" << std::endl;
|
||||
}
|
||||
|
@@ -44,6 +44,8 @@ public:
|
||||
//
|
||||
}
|
||||
|
||||
enum ExchangeType { None, Binary, Xml };
|
||||
|
||||
virtual void Process (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE;
|
||||
|
||||
void ClearExtra();
|
||||
@@ -73,9 +75,11 @@ 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.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>
|
||||
<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>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
176
samples/OCCTOverview/code/Topology.json
Normal file
176
samples/OCCTOverview/code/Topology.json
Normal file
@@ -0,0 +1,176 @@
|
||||
{
|
||||
"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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
<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>
|
10
samples/OCCTOverview/code/Triangulation.json
Normal file
10
samples/OCCTOverview/code/Triangulation.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Triangulation": {
|
||||
|
||||
"Create Triangulation": [{
|
||||
"text": "Triangulation on shape",
|
||||
"function": "Triangulation3dSample",
|
||||
"description": ""
|
||||
}]
|
||||
}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<Menu>
|
||||
<MenuItem name="Triangulation">
|
||||
<MenuItem name="Create Triangulation">
|
||||
<Sample name="Triangulation on shape" function="Triangulation3dSample"/>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
58
samples/OCCTOverview/code/Viewer2d.json
Normal file
58
samples/OCCTOverview/code/Viewer2d.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"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": ""
|
||||
}]
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
<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_NOC_MATRABLUE;
|
||||
Standard_Integer aColor = Quantity_NameOfColor::Quantity_NOC_MATRABLUE;
|
||||
for (Standard_Integer j = 15; j <= 20; j++)
|
||||
{
|
||||
Handle(AIS_TextLabel) aText = new AIS_TextLabel();
|
||||
|
106
samples/OCCTOverview/code/Viewer3d.json
Normal file
106
samples/OCCTOverview/code/Viewer3d.json
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
<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,14 +99,12 @@ 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());
|
||||
}
|
||||
@@ -119,31 +117,27 @@ 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);
|
||||
}
|
||||
|
||||
@@ -151,27 +145,23 @@ 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());
|
||||
}
|
||||
@@ -207,10 +197,8 @@ void Viewer3dSamples::WireFramePresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetDisplayMode(anAisObject, 0, false); // set wireframe
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -220,10 +208,8 @@ void Viewer3dSamples::ShadingPresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetDisplayMode(anAisObject, 1, false); // set shading
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -233,10 +219,8 @@ void Viewer3dSamples::RedColorPresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
Quantity_Color aShapeColor;
|
||||
myContext->Color(anAisObject, aShapeColor);
|
||||
myResult << "A Current shape color: Red = " << aShapeColor.Red()
|
||||
@@ -252,20 +236,16 @@ void Viewer3dSamples::GrayColorPresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +254,8 @@ void Viewer3dSamples::PlasticPresentation3dSample()
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_PLASTIC;
|
||||
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -288,10 +266,8 @@ void Viewer3dSamples::BronzePresentation3dSample()
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_BRONZE;
|
||||
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -301,10 +277,8 @@ void Viewer3dSamples::OpaquePresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetTransparency(anAisObject, 0.0, Standard_False);
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -314,10 +288,8 @@ void Viewer3dSamples::HalfTransparencyPresentation3dSample()
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetTransparency(anAisObject, 0.5, Standard_False);
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
@@ -325,8 +297,7 @@ 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;
|
||||
}
|
||||
@@ -334,8 +305,7 @@ 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_NameOfMaterial_ShinyPlastified);
|
||||
anAis = new CafShapePrs (aRefLabel, theParentStyle, Graphic3d_NOM_SHINY_PLASTIC);
|
||||
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_NameOfMaterial_Plastified, toDisplay);
|
||||
myAISContext->SetMaterial(aGraphicSurface, Graphic3d_NOM_PLASTIC, 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_NameOfMaterial_Brass,
|
||||
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_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_NameOfMaterial_Brass,
|
||||
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_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_NameOfMaterial_Gold, Standard_False);
|
||||
anAIScontext->SetMaterial(ais, Graphic3d_NOM_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_NameOfMaterial_Plastered
|
||||
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
|
||||
#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_NameOfMaterial_Brass,
|
||||
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_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_NameOfMaterial_Plastered
|
||||
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
|
||||
#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_NameOfMaterial_Plastered
|
||||
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
|
||||
#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_NameOfMaterial_Plastified, Standard_False);
|
||||
myAISContext->SetMaterial (myAisCylinderHead, Graphic3d_NOM_PLASTIC, Standard_False);
|
||||
myAisEngineBlock = new AIS_Shape (EngineBlock);
|
||||
myAISContext->SetColor(myAisEngineBlock, Quantity_NOC_WHITE, Standard_False);
|
||||
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NameOfMaterial_Plastified, Standard_False);
|
||||
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NOM_PLASTIC, 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_NameOfMaterial_Plastified, Standard_False);
|
||||
myAISContext->SetMaterial(myAisCrankArm, Graphic3d_NOM_PLASTIC, Standard_False);
|
||||
myAisPiston = new AIS_Shape (Piston);
|
||||
myAISContext->SetColor (myAisPiston , Quantity_NOC_WHITE, Standard_False);
|
||||
myAISContext->SetMaterial(myAisPiston , Graphic3d_NameOfMaterial_Plastified, Standard_False);
|
||||
myAISContext->SetMaterial(myAisPiston , Graphic3d_NOM_PLASTIC, Standard_False);
|
||||
myAisPropeller = new AIS_Shape (Propeller);
|
||||
myAISContext->SetColor (myAisPropeller, Quantity_NOC_RED, Standard_False);
|
||||
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NameOfMaterial_Plastified, Standard_False);
|
||||
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NOM_PLASTIC, 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_NameOfMaterial_Stone,Standard_False);
|
||||
myAISContext->SetMaterial (myAISSurface,Graphic3d_NOM_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_NameOfMaterial_Plastered
|
||||
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
|
||||
#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_NameOfMaterial_Brass,
|
||||
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_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,15 +2,14 @@ TEMPLATE = app
|
||||
CONFIG += debug_and_release qt
|
||||
CONFIG += lrelease
|
||||
CONFIG += embed_translations
|
||||
QT += xml
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
QT += widgets
|
||||
}
|
||||
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,5 +27,3 @@ if not "%QTDIR%" == "" (
|
||||
set "PATH=%QTDIR%/bin;%PATH%"
|
||||
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
|
||||
)
|
||||
|
||||
set "CSF_OCCTOverviewSampleCodePath=%~dp0..\..\OCCTOverview\code"
|
||||
|
@@ -28,6 +28,9 @@
|
||||
#include <QFont>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMap>
|
||||
#include <QMdiArea>
|
||||
#include <QMdiSubWindow>
|
||||
@@ -40,8 +43,6 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <QDomDocument>
|
||||
#include <QDomAttr>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
@@ -52,21 +53,13 @@
|
||||
|
||||
ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
||||
: QMainWindow (nullptr),
|
||||
myAppType(theCategory),
|
||||
myStdToolBar (nullptr),
|
||||
myViewBar (nullptr),
|
||||
myCasCadeBar (nullptr),
|
||||
myFilePopup (nullptr),
|
||||
myCategoryPopup (nullptr)
|
||||
{
|
||||
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";
|
||||
|
||||
myAppType = theCategory;
|
||||
mySampleMapper = new QSignalMapper(this);
|
||||
myExchangeMapper = new QSignalMapper(this);
|
||||
myOcafMapper = new QSignalMapper(this);
|
||||
@@ -75,13 +68,19 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
||||
|
||||
myCategoryMapper = new QSignalMapper(this);
|
||||
|
||||
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(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(myCategoryMapper, SIGNAL(mapped(const QString &)), this, SLOT(onChangeCategory(const QString &)));
|
||||
connect(myCategoryMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
||||
this, &ApplicationCommonWindow::onChangeCategory);
|
||||
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
@@ -122,25 +121,20 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
||||
aViewFrame->setLineWidth(3);
|
||||
QVBoxLayout* aViewLayout = new QVBoxLayout(aViewFrame);
|
||||
aViewLayout->setContentsMargins(0, 0, 0, 0);
|
||||
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, aViewFrame);
|
||||
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, this);
|
||||
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;
|
||||
aSizeList.append(640);
|
||||
aSizeList.append(640);
|
||||
QList<int> aSizeList{ 640, 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,
|
||||
@@ -163,14 +157,13 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
||||
myDocument2d->getViewer(),
|
||||
myDocument2d->getContext());
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
onChangeCategory(ALL_CATEGORIES[myAppType]);
|
||||
|
||||
@@ -181,31 +174,29 @@ void ApplicationCommonWindow::RebuildMenu()
|
||||
{
|
||||
menuBar()->clear();
|
||||
|
||||
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()));
|
||||
myStdActions[FileQuit] = CreateAction(&ApplicationCommonWindow::onCloseAllWindows, "Quit", "CTRL+Q");
|
||||
myStdActions[HelpAbout] = CreateAction(&ApplicationCommonWindow::onAbout, "About", "F1", ":/icons/help.png");
|
||||
|
||||
// populate a menu with all actions
|
||||
myFilePopup = new QMenu(this);
|
||||
myFilePopup = menuBar()->addMenu(tr("&File"));
|
||||
myFilePopup->addAction(myStdActions[StdActions_FileQuit]);
|
||||
myFilePopup->addAction(myStdActions[FileQuit]);
|
||||
|
||||
myCategoryPopup = new QMenu(this);
|
||||
myCategoryPopup = menuBar()->addMenu(tr("&Category"));
|
||||
|
||||
foreach (ApplicationType aCategory, ALL_CATEGORIES.keys())
|
||||
for (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, SIGNAL(triggered()), myCategoryMapper, SLOT(map()));
|
||||
connect(anAction, &QAction::triggered, myCategoryMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
myCategoryPopup->addAction(anAction);
|
||||
myCategoryActions.insert(aCategory, anAction);
|
||||
}
|
||||
|
||||
foreach (QMenu* aSampleMenu, GetCurrentMenus())
|
||||
for (QMenu* aSampleMenu : GetCurrentMenus())
|
||||
{
|
||||
menuBar()->addMenu(aSampleMenu);
|
||||
}
|
||||
@@ -214,21 +205,21 @@ void ApplicationCommonWindow::RebuildMenu()
|
||||
QMenu* aHelp = new QMenu(this);
|
||||
menuBar()->addSeparator();
|
||||
aHelp = menuBar()->addMenu(tr("&Help"));
|
||||
aHelp->addAction(myStdActions[StdActions_HelpAbout]);
|
||||
aHelp->addAction(myStdActions[HelpAbout]);
|
||||
}
|
||||
|
||||
Handle(BaseSample) ApplicationCommonWindow::GetCurrentSamples()
|
||||
{
|
||||
switch (myAppType)
|
||||
{
|
||||
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:
|
||||
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:
|
||||
break;
|
||||
}
|
||||
throw QString("Unknown Application type");
|
||||
@@ -238,14 +229,14 @@ const QList<QMenu*>& ApplicationCommonWindow::GetCurrentMenus()
|
||||
{
|
||||
switch (myAppType)
|
||||
{
|
||||
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:
|
||||
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:
|
||||
break;
|
||||
}
|
||||
throw QString("Unknown Application type");
|
||||
@@ -279,35 +270,35 @@ void ApplicationCommonWindow::onChangeCategory(const QString& theCategory)
|
||||
|
||||
switch (myAppType)
|
||||
{
|
||||
case AppType_DataExchange:
|
||||
case DataExchange:
|
||||
{
|
||||
myDataExchangeSamples->AppendBottle();
|
||||
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
||||
myGeomWidget->Show3d();
|
||||
break;
|
||||
}
|
||||
case AppType_Ocaf:
|
||||
case Ocaf:
|
||||
{
|
||||
onProcessOcaf("CreateOcafDocument");
|
||||
myGeomWidget->Show3d();
|
||||
break;
|
||||
}
|
||||
case AppType_Viewer2d:
|
||||
case Viewer2d:
|
||||
{
|
||||
myGeomWidget->Show2d();
|
||||
break;
|
||||
}
|
||||
case AppType_Viewer3d:
|
||||
case Viewer3d:
|
||||
{
|
||||
myViewer3dSamples->AppendBottle();
|
||||
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
||||
myGeomWidget->Show3d();
|
||||
break;
|
||||
}
|
||||
case AppType_Geometry:
|
||||
case AppType_Topology:
|
||||
case AppType_Triangulation:
|
||||
case AppType_Unknown:
|
||||
case Geometry:
|
||||
case Topology:
|
||||
case Triangulation:
|
||||
case Unknown:
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -335,7 +326,9 @@ TCollection_AsciiString ApplicationCommonWindow::getSampleSourceDir()
|
||||
return aSampleSourceDir;
|
||||
}
|
||||
|
||||
QAction* ApplicationCommonWindow::CreateAction (const QString& theActionName,
|
||||
template <typename PointerToMemberFunction>
|
||||
QAction* ApplicationCommonWindow::CreateAction (PointerToMemberFunction theHandlerMethod,
|
||||
const QString& theActionName,
|
||||
const QString& theShortcut,
|
||||
const QString& theIconName)
|
||||
{
|
||||
@@ -352,7 +345,7 @@ QAction* ApplicationCommonWindow::CreateAction (const QString& theActionName,
|
||||
aAction->setToolTip(theActionName);
|
||||
aAction->setStatusTip(theActionName);
|
||||
aAction->setShortcut(theShortcut);
|
||||
|
||||
connect(aAction, &QAction::triggered, this, theHandlerMethod);
|
||||
return aAction;
|
||||
}
|
||||
|
||||
@@ -360,9 +353,9 @@ template <typename PointerToMemberFunction>
|
||||
QAction* ApplicationCommonWindow::CreateSample (PointerToMemberFunction theHandlerMethod,
|
||||
const char* theActionName)
|
||||
{
|
||||
QAction* anAction = new QAction(QObject::tr(theActionName), this);
|
||||
connect(anAction, SIGNAL(triggered()), this, SLOT(theHandlerMethod()));
|
||||
return anAction;
|
||||
QAction* aAction = new QAction(QObject::tr(theActionName), this);
|
||||
connect(aAction, &QAction::triggered, this, theHandlerMethod);
|
||||
return aAction;
|
||||
}
|
||||
|
||||
void ApplicationCommonWindow::resizeEvent(QResizeEvent* e)
|
||||
@@ -615,78 +608,78 @@ TranslateDialog* ApplicationCommonWindow::getOcafDialog(const QString& theSample
|
||||
return aTranslateDialog;
|
||||
}
|
||||
|
||||
QMenu* ApplicationCommonWindow::MenuFromDomNode(QDomElement& theItemElement,
|
||||
QWidget* theParent,
|
||||
QSignalMapper* theMapper)
|
||||
QMenu* ApplicationCommonWindow::MenuFromJsonObject (const QJsonValue& theJsonValue,
|
||||
const QString& theKey,
|
||||
QWidget* theParent,
|
||||
QSignalMapper* theMapper)
|
||||
{
|
||||
QString anItemName = theItemElement.attribute("name");
|
||||
QMenu* aMenu = new QMenu(anItemName, theParent);
|
||||
QDomElement anChildItemElement = theItemElement.firstChildElement("MenuItem");
|
||||
QDomElement anSampleElement = theItemElement.firstChildElement("Sample");
|
||||
|
||||
while(anChildItemElement.isElement())
|
||||
QMenu* aMenu = new QMenu(theKey, theParent);
|
||||
if (theJsonValue.isObject())
|
||||
{
|
||||
aMenu->addMenu(MenuFromDomNode(anChildItemElement, aMenu, theMapper));
|
||||
anChildItemElement = anChildItemElement.nextSibling().toElement();
|
||||
QJsonObject aBranchObject = theJsonValue.toObject();
|
||||
for (const QString& aBranchKey : aBranchObject.keys())
|
||||
{
|
||||
aMenu->addMenu(MenuFromJsonObject(aBranchObject.value(aBranchKey), aBranchKey, aMenu, theMapper));
|
||||
}
|
||||
}
|
||||
|
||||
while(anSampleElement.isElement())
|
||||
else if (theJsonValue.isArray())
|
||||
{
|
||||
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();
|
||||
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());
|
||||
|
||||
theMapper->setMapping(anAction, aSampleName);
|
||||
connect(anAction, &QAction::triggered, theMapper,
|
||||
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
}
|
||||
}
|
||||
}
|
||||
return aMenu;
|
||||
}
|
||||
|
||||
void ApplicationCommonWindow::MenuFormXml(const QString& thePath,
|
||||
QSignalMapper* theMapper,
|
||||
QList<QMenu*>& theMunusList)
|
||||
void ApplicationCommonWindow::MenuFormJson (const QString& thePath,
|
||||
QSignalMapper* theMapper,
|
||||
QList<QMenu*>& theMunusList)
|
||||
{
|
||||
QDomDocument aDomDocument;
|
||||
theMunusList.clear();
|
||||
QFile aXmlFile(thePath);
|
||||
QFile aJsonFile(thePath);
|
||||
QString anErrorMessage;
|
||||
if (aXmlFile.error() != QFile::NoError)
|
||||
if (aJsonFile.error() != QFile::NoError)
|
||||
{
|
||||
anErrorMessage = aXmlFile.errorString();
|
||||
anErrorMessage = aJsonFile.errorString();
|
||||
Message::SendFail() << "QFile creating error: " << anErrorMessage.toUtf8().constData();
|
||||
aXmlFile.close();
|
||||
return;
|
||||
}
|
||||
if (!aXmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
if (!aJsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
Message::SendFail() << "File " << thePath.toUtf8().constData() << " could not open";
|
||||
if (aXmlFile.error() != QFile::NoError)
|
||||
if (aJsonFile.error() != QFile::NoError)
|
||||
{
|
||||
anErrorMessage = aXmlFile.errorString();
|
||||
anErrorMessage = aJsonFile.errorString();
|
||||
Message::SendFail() << "QFile opening error: " << anErrorMessage.toUtf8().constData();
|
||||
}
|
||||
aXmlFile.close();
|
||||
return;
|
||||
}
|
||||
bool aNamespaceProcessing(false);
|
||||
QString anErrorMsg;
|
||||
int anErrorLine(0);
|
||||
int anErrorColumn(0);
|
||||
if (!aDomDocument.setContent(&aXmlFile, aNamespaceProcessing, &anErrorMsg, &anErrorLine, &anErrorColumn))
|
||||
{
|
||||
Message::SendFail() << "XML file parsing error: " << anErrorMsg.toStdString()
|
||||
<< " at line: " << anErrorLine << " column: " << anErrorColumn;
|
||||
aXmlFile.close();
|
||||
return;
|
||||
}
|
||||
aXmlFile.close();
|
||||
QString aJsonString = aJsonFile.readAll();
|
||||
aJsonFile.close();
|
||||
|
||||
QDomElement aRootElement = aDomDocument.documentElement();
|
||||
QDomElement anItemElement = aRootElement.firstChildElement("MenuItem");
|
||||
while(!anItemElement.isNull())
|
||||
QJsonDocument aJsonDoc = QJsonDocument::fromJson(aJsonString.toUtf8());
|
||||
if (aJsonDoc.isObject())
|
||||
{
|
||||
theMunusList.push_back(MenuFromDomNode(anItemElement, this, theMapper));
|
||||
anItemElement = anItemElement.nextSiblingElement("MenuItem");
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QDomNode>
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
#include <QMdiArea>
|
||||
@@ -53,25 +52,39 @@
|
||||
|
||||
enum StdActions
|
||||
{
|
||||
StdActions_FileQuit,
|
||||
StdActions_HelpAbout
|
||||
FileNew, FilePrefUseVBO, FileClose, FilePreferences, FileQuit, ViewTool, ViewStatus, HelpAbout
|
||||
};
|
||||
|
||||
enum ToolActions
|
||||
{
|
||||
ToolWireframe, ToolShading, ToolColor, ToolMaterial, ToolTransparency, ToolDelete
|
||||
};
|
||||
|
||||
enum ApplicationType
|
||||
{
|
||||
AppType_Geometry,
|
||||
AppType_Topology,
|
||||
AppType_Triangulation,
|
||||
AppType_DataExchange,
|
||||
AppType_Ocaf,
|
||||
AppType_Viewer2d,
|
||||
AppType_Viewer3d,
|
||||
AppType_Unknown
|
||||
Geometry,
|
||||
Topology,
|
||||
Triangulation,
|
||||
DataExchange,
|
||||
Ocaf,
|
||||
Viewer2d,
|
||||
Viewer3d,
|
||||
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 ApplicationCommonWindow: public QMainWindow
|
||||
class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -91,7 +104,9 @@ public slots:
|
||||
virtual void onChangeCategory(const QString& theCategory);
|
||||
|
||||
protected:
|
||||
QAction* CreateAction(const QString& theActionName,
|
||||
template <typename PointerToMemberFunction>
|
||||
QAction* CreateAction(PointerToMemberFunction theHandlerMethod,
|
||||
const QString& theActionName,
|
||||
const QString& theShortcut = "",
|
||||
const QString& theIconName = "");
|
||||
|
||||
@@ -103,13 +118,13 @@ protected:
|
||||
QMenu* getFilePopup() { return myFilePopup; }
|
||||
QToolBar* getCasCadeBar() { return myCasCadeBar; }
|
||||
|
||||
void MenuFormXml (const QString& thePath,
|
||||
QMenu* MenuFromJsonObject (const QJsonValue& theJsonValue,
|
||||
const QString& theKey,
|
||||
QWidget* theParent,
|
||||
QSignalMapper* theMapper);
|
||||
void MenuFormJson (const QString& thePath,
|
||||
QSignalMapper* theMapper,
|
||||
QList<QMenu*>& theMunusList);
|
||||
QMenu* MenuFromDomNode(QDomElement& theItemElement,
|
||||
QWidget* theParent,
|
||||
QSignalMapper* theMapper);
|
||||
|
||||
|
||||
private slots:
|
||||
void onCloseAllWindows() { qApp->closeAllWindows(); }
|
||||
@@ -132,7 +147,6 @@ private:
|
||||
|
||||
private:
|
||||
ApplicationType myAppType;
|
||||
QMap<ApplicationType, QString> ALL_CATEGORIES;
|
||||
|
||||
Handle(GeometrySamples) myGeometrySamples;
|
||||
Handle(TopologySamples) myTopologySamples;
|
||||
@@ -144,6 +158,7 @@ private:
|
||||
|
||||
QMap<StdActions, QAction*> myStdActions;
|
||||
QMap<ApplicationType, QAction*> myCategoryActions;
|
||||
QMap<ToolActions, QAction*> myToolActions;
|
||||
QMap<Graphic3d_NameOfMaterial, QAction*> myMaterialActions;
|
||||
|
||||
QToolBar* myStdToolBar;
|
||||
@@ -152,6 +167,7 @@ private:
|
||||
QMenu* myFilePopup;
|
||||
QMenu* myCategoryPopup;
|
||||
|
||||
// QList<QMenu*> mySamplePopups;
|
||||
QList<QMenu*> myGeometryMenus;
|
||||
QList<QMenu*> myTopologyMenus;
|
||||
QList<QMenu*> myTriangulationMenus;
|
||||
|
@@ -87,11 +87,8 @@ void DocumentCommon::SetObjects (const NCollection_Vector<Handle(AIS_Interactive
|
||||
{
|
||||
myContext->RemoveAll(Standard_False);
|
||||
myContextIsEmpty = theObjects.IsEmpty();
|
||||
|
||||
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(theObjects);
|
||||
anIter.More(); anIter.Next())
|
||||
for (const Handle(AIS_InteractiveObject) anObject : theObjects)
|
||||
{
|
||||
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 DocumentCommon : public QObject
|
||||
class COMMONSAMPLE_EXPORT 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, my2dVidget);
|
||||
myView2d = new View(myDocument2d->getContext(), false, this);
|
||||
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, my3dVidget);
|
||||
myView3d = new View(myDocument3d->getContext(), true, this);
|
||||
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,6 +25,7 @@
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QLocale>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
@@ -33,11 +34,9 @@
|
||||
|
||||
int main ( int argc, char* argv[] )
|
||||
{
|
||||
QApplication aQApp( argc, argv );
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
Q_INIT_RESOURCE(OCCTOverview);
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
QApplication aQApp( argc, argv );
|
||||
|
||||
QSettings settings("OCCTOverview.conf", QSettings::IniFormat);
|
||||
settings.beginGroup("ApplicationSetting");
|
||||
|
@@ -23,119 +23,152 @@
|
||||
|
||||
#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_ExtendedString" << "TCollection_HAsciiString" << "TCollection_HExtendedString"
|
||||
<< "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);
|
||||
|
||||
foreach (const QString& aPattern, anOcctPatterns)
|
||||
for (const QString& aPattern : anOcctPatterns)
|
||||
{
|
||||
aRule.myPattern = QRegExp(aPattern);
|
||||
aRule.myPattern = QRegularExpression(aPattern);
|
||||
aRule.myFormat = myOcctFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
}
|
||||
|
||||
myHelperFormat.setForeground(Qt::red);
|
||||
foreach (const QString& aPattern, aHelperPatterns)
|
||||
for (const QString& aPattern : aHelperPatterns)
|
||||
{
|
||||
aRule.myPattern = QRegExp(aPattern);
|
||||
aRule.myPattern = QRegularExpression(aPattern);
|
||||
aRule.myFormat = myHelperFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
}
|
||||
@@ -143,56 +176,54 @@ OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
|
||||
|
||||
myKeywordFormat.setForeground(Qt::darkBlue);
|
||||
myKeywordFormat.setFontWeight(QFont::Bold);
|
||||
foreach (const QString& aPattern, aKeywordPatterns)
|
||||
for (const QString& aPattern : aKeywordPatterns)
|
||||
{
|
||||
aRule.myPattern = QRegExp(aPattern);
|
||||
aRule.myPattern = QRegularExpression(aPattern);
|
||||
aRule.myFormat = myKeywordFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
}
|
||||
|
||||
myMemberFormat.setFontWeight(QFont::Bold);
|
||||
aRule.myPattern = QRegExp(QLatin1String("\\bmy[0-9A-Za-z]+\\b"));
|
||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\bmy[0-9A-Za-z]+\\b"));
|
||||
aRule.myFormat = myMemberFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
|
||||
myLocalFormat.setForeground(Qt::darkMagenta);
|
||||
aRule.myPattern = QRegExp(QLatin1String("\\ba[0-9A-Za-z]+\\b"));
|
||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\ba[0-9A-Za-z]+\\b"));
|
||||
aRule.myFormat = myLocalFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
|
||||
myQuotationFormat.setForeground(Qt::darkRed);
|
||||
aRule.myPattern = QRegExp(QLatin1String("\".*\""));
|
||||
aRule.myPattern = QRegularExpression(QStringLiteral("\".*\""));
|
||||
aRule.myFormat = myQuotationFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
|
||||
myFunctionFormat.setFontItalic(true);
|
||||
myFunctionFormat.setForeground(Qt::blue);
|
||||
aRule.myPattern = QRegExp(QLatin1String("\\b[A-Za-z0-9_]+(?=\\()"));
|
||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_]+(?=\\()"));
|
||||
aRule.myFormat = myFunctionFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
|
||||
mySingleLineCommentFormat.setForeground(Qt::darkGreen);
|
||||
aRule.myPattern = QRegExp(QLatin1String("//[^\n]*"));
|
||||
aRule.myPattern = QRegularExpression(QStringLiteral("//[^\n]*"));
|
||||
aRule.myFormat = mySingleLineCommentFormat;
|
||||
myHighlightingRules.append(aRule);
|
||||
|
||||
myMultiLineCommentFormat.setForeground(Qt::darkGreen);
|
||||
|
||||
myCommentStartExpression = QRegExp(QLatin1String("/\\*"));
|
||||
myCommentEndExpression = QRegExp(QLatin1String("\\*/"));
|
||||
myCommentStartExpression = QRegularExpression(QStringLiteral("/\\*"));
|
||||
myCommentEndExpression = QRegularExpression(QStringLiteral("\\*/"));
|
||||
}
|
||||
|
||||
void OcctHighlighter::highlightBlock (const QString& theText)
|
||||
{
|
||||
foreach (const HighlightingRule &rule, myHighlightingRules)
|
||||
for (const HighlightingRule& rule : qAsConst(myHighlightingRules))
|
||||
{
|
||||
QRegExp expression(rule.myPattern);
|
||||
int index = expression.indexIn(theText);
|
||||
while (index >= 0)
|
||||
QRegularExpressionMatchIterator matchIterator = rule.myPattern.globalMatch(theText);
|
||||
while (matchIterator.hasNext())
|
||||
{
|
||||
int length = expression.matchedLength();
|
||||
setFormat(index, length, rule.myFormat);
|
||||
index = expression.indexIn(theText, index + length);
|
||||
QRegularExpressionMatch match = matchIterator.next();
|
||||
setFormat(match.capturedStart(), match.capturedLength(), rule.myFormat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,21 +233,22 @@ void OcctHighlighter::highlightBlock (const QString& theText)
|
||||
if (previousBlockState() != 1)
|
||||
startIndex = theText.indexOf(myCommentStartExpression);
|
||||
|
||||
while (startIndex >= 0)
|
||||
while (startIndex >= 0)
|
||||
{
|
||||
int endIndex = myCommentEndExpression.indexIn(theText, startIndex);
|
||||
int commentLength;
|
||||
if (endIndex == -1)
|
||||
QRegularExpressionMatch match = myCommentEndExpression.match(theText, startIndex);
|
||||
int endIndex = match.capturedStart();
|
||||
int commentLength = 0;
|
||||
if (endIndex == -1)
|
||||
{
|
||||
setCurrentBlockState(1);
|
||||
commentLength = theText.length() - startIndex;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
commentLength = endIndex - startIndex
|
||||
+ myCommentEndExpression.matchedLength();
|
||||
+ match.capturedLength();
|
||||
}
|
||||
setFormat(startIndex, commentLength, myMultiLineCommentFormat);
|
||||
startIndex = myCommentEndExpression.indexIn(theText, startIndex + commentLength);
|
||||
startIndex = theText.indexOf(myCommentStartExpression, startIndex + commentLength);
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QString>
|
||||
#include <QTextDocument>
|
||||
@@ -51,17 +51,15 @@ protected:
|
||||
private:
|
||||
struct HighlightingRule
|
||||
{
|
||||
QRegExp myPattern;
|
||||
QRegularExpression myPattern;
|
||||
QTextCharFormat myFormat;
|
||||
};
|
||||
|
||||
private:
|
||||
QVector<HighlightingRule> myHighlightingRules;
|
||||
// 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;
|
||||
|
||||
QRegularExpression myCommentStartExpression;
|
||||
QRegularExpression myCommentEndExpression;
|
||||
|
||||
QTextCharFormat myKeywordFormat;
|
||||
QTextCharFormat mySingleLineCommentFormat;
|
||||
|
@@ -135,10 +135,10 @@ Aspect_TypeOfResize OcctWindow::DoResize()
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
myXLeft = myWidget->rect().left();
|
||||
myXRight = myWidget->rect().right();
|
||||
myYTop = myWidget->rect().top();
|
||||
myYBottom = myWidget->rect().bottom();
|
||||
*((Standard_Integer*)&myXLeft) = myWidget->rect().left();
|
||||
*((Standard_Integer*)&myXRight) = myWidget->rect().right();
|
||||
*((Standard_Integer*)&myYTop) = myWidget->rect().top();
|
||||
*((Standard_Integer*)&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,12 +148,10 @@ 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);
|
||||
}
|
||||
@@ -207,9 +205,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();
|
||||
}
|
||||
@@ -219,9 +217,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();
|
||||
}
|
||||
@@ -254,9 +252,9 @@ void View::onRaytraceAction()
|
||||
{
|
||||
QAction* aSentBy = (QAction*)sender();
|
||||
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction_Raytracing))
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolRaytracing))
|
||||
{
|
||||
bool aState = myRaytraceActions.value(RaytraceAction_Raytracing)->isChecked();
|
||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolRaytracing)->isChecked();
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
if (aState)
|
||||
@@ -266,21 +264,21 @@ void View::onRaytraceAction()
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction_Shadows))
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolShadows))
|
||||
{
|
||||
bool aState = myRaytraceActions.value(RaytraceAction_Shadows)->isChecked();
|
||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolShadows)->isChecked();
|
||||
SetRaytracedShadows(aState);
|
||||
}
|
||||
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction_Reflections))
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolReflections))
|
||||
{
|
||||
bool aState = myRaytraceActions.value(RaytraceAction_Reflections)->isChecked();
|
||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolReflections)->isChecked();
|
||||
SetRaytracedReflections(aState);
|
||||
}
|
||||
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction_Antialiasing))
|
||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolAntialiasing))
|
||||
{
|
||||
bool aState = myRaytraceActions.value(RaytraceAction_Antialiasing)->isChecked();
|
||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolAntialiasing)->isChecked();
|
||||
SetRaytracedAntialiasing(aState);
|
||||
}
|
||||
}
|
||||
@@ -320,7 +318,7 @@ void View::updateToggled(bool isOn)
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (QAction* anAction, myViewActions)
|
||||
for (QAction* anAction : myViewActions)
|
||||
{
|
||||
if (anAction && (anAction != sentBy))
|
||||
{
|
||||
@@ -329,15 +327,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);
|
||||
@@ -393,11 +391,12 @@ QPaintEngine* View::paintEngine() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
QAction* View::RegisterAction(QString theIconPath, QString thePromt)
|
||||
QAction* View::RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void))
|
||||
{
|
||||
QAction* anAction = new QAction(QPixmap(theIconPath), thePromt, this);
|
||||
anAction->setToolTip(thePromt);
|
||||
anAction->setStatusTip(thePromt);
|
||||
connect(anAction, &QAction::triggered, this, theSlot);
|
||||
return anAction;
|
||||
}
|
||||
|
||||
@@ -405,42 +404,34 @@ void View::initViewActions()
|
||||
{
|
||||
if (!myViewActions.empty())
|
||||
return;
|
||||
myViewActions[ViewAction_FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"));
|
||||
connect(myViewActions[ViewAction_FitAll], SIGNAL(triggered()), this, SLOT(fitAll()));
|
||||
myViewActions[ViewAction::FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"), &View::fitAll);
|
||||
if (myIs3dView)
|
||||
{
|
||||
myViewActions[ViewAction_Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"));
|
||||
connect(myViewActions[ViewAction_Axo], SIGNAL(triggered()), this, SLOT(axo()));
|
||||
myViewActions[ViewAction::Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"), &View::axo);
|
||||
|
||||
QActionGroup* aShadingActionGroup = new QActionGroup(this);
|
||||
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"));
|
||||
connect(aShadingAction, SIGNAL(triggered()), this, SLOT(shading()));
|
||||
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"), &View::shading);
|
||||
aShadingAction->setCheckable(true);
|
||||
aShadingActionGroup->addAction(aShadingAction);
|
||||
myViewActions[ViewAction_Shading] = aShadingAction;
|
||||
myViewActions[ViewAction::Shading] = aShadingAction;
|
||||
|
||||
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"));
|
||||
connect(aWireframeAction, SIGNAL(triggered()), this, SLOT(wireframe()));
|
||||
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"), &View::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"));
|
||||
connect(aHlrOffAction, SIGNAL(triggered()), this, SLOT(hlrOff()));
|
||||
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr("HLR off"), &View::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"));
|
||||
connect(aHlrOnAction, SIGNAL(triggered()), this, SLOT(hlrOn()));
|
||||
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr("HLR on"), &View::hlrOn);
|
||||
aHlrOnAction->setCheckable(true);
|
||||
aHlrActionGroup->addAction(aHlrOnAction);
|
||||
myViewActions[ViewAction_HlrOn] = aHlrOnAction;
|
||||
myViewActions[ViewAction::HlrOn] = aHlrOnAction;
|
||||
|
||||
QAction* aTransparencyAction = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"));
|
||||
connect(aTransparencyAction, SIGNAL(triggered()), this, SLOT(onTransparency()));
|
||||
myViewActions[ViewAction_Transparency] = aTransparencyAction;
|
||||
myViewActions[ViewAction::Transparency] = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"), &View::onTransparency);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,27 +442,23 @@ void View::initRaytraceActions()
|
||||
return;
|
||||
}
|
||||
|
||||
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"));
|
||||
connect(aRayTraceAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||
myRaytraceActions[RaytraceAction_Raytracing] = aRayTraceAction;
|
||||
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"), &View::onRaytraceAction);
|
||||
myRaytraceActions[RaytraceAction::ToolRaytracing] = aRayTraceAction;
|
||||
aRayTraceAction->setCheckable(true);
|
||||
aRayTraceAction->setChecked(false);
|
||||
|
||||
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"));
|
||||
connect(aShadowAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||
myRaytraceActions[RaytraceAction_Shadows] = aShadowAction;
|
||||
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"), &View::onRaytraceAction);
|
||||
myRaytraceActions[RaytraceAction::ToolShadows] = aShadowAction;
|
||||
aShadowAction->setCheckable(true);
|
||||
aShadowAction->setChecked(true);
|
||||
|
||||
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"));
|
||||
connect(aReflectAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||
myRaytraceActions[RaytraceAction_Reflections] = aReflectAction;
|
||||
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"), &View::onRaytraceAction);
|
||||
myRaytraceActions[RaytraceAction::ToolReflections] = aReflectAction;
|
||||
aReflectAction->setCheckable(true);
|
||||
aReflectAction->setChecked(false);
|
||||
|
||||
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"));
|
||||
connect(anAntiAliasingAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||
myRaytraceActions[RaytraceAction_Antialiasing] = anAntiAliasingAction;
|
||||
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"), &View::onRaytraceAction);
|
||||
myRaytraceActions[RaytraceAction::ToolAntialiasing] = anAntiAliasingAction;
|
||||
anAntiAliasingAction->setCheckable(true);
|
||||
anAntiAliasingAction->setChecked(false);
|
||||
}
|
||||
@@ -481,12 +468,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;
|
||||
}
|
||||
@@ -496,6 +483,10 @@ 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()
|
||||
@@ -509,6 +500,10 @@ 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()
|
||||
@@ -517,19 +512,23 @@ 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))
|
||||
@@ -568,31 +567,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;
|
||||
@@ -668,11 +667,9 @@ void View::onTransparencyChanged(int theVal)
|
||||
{
|
||||
AIS_ListOfInteractive anAisObjectsList;
|
||||
myContext->DisplayedObjects(anAisObjectsList);
|
||||
double aTranspValue = theVal / 10.;
|
||||
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||
anIter.More(); anIter.Next())
|
||||
double aTranspValue = theVal / 10.;
|
||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||
myContext->SetTransparency(anAisObject, aTranspValue, Standard_False);
|
||||
}
|
||||
myContext->UpdateCurrentViewer();
|
||||
|
@@ -38,45 +38,11 @@
|
||||
|
||||
class TopoDS_Shape;
|
||||
|
||||
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
|
||||
};
|
||||
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 };
|
||||
|
||||
//! Qt widget containing V3d_View and toolbar with view manipulation buttons.
|
||||
//! Also use AIS_ViewController for redirecting user input (mouse, keyboard)
|
||||
@@ -162,7 +128,7 @@ private:
|
||||
void initViewActions();
|
||||
void initRaytraceActions();
|
||||
|
||||
QAction* RegisterAction(QString theIconPath, QString thePromt);
|
||||
QAction* RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void));
|
||||
|
||||
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_NameOfMaterial_Gold, Standard_False);
|
||||
getContext()->SetMaterial (AISBottle, Graphic3d_NOM_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_NameOfMaterial_Silver);
|
||||
aShapePrs->SetMaterial (Graphic3d_NOM_SILVER);
|
||||
aViewer.Context()->Display (aShapePrs, AIS_Shaded, 0, false);
|
||||
aViewer.View()->FitAll (0.01, false);
|
||||
aViewer.View()->Redraw();
|
||||
|
@@ -82,9 +82,9 @@ myIsXYZAxis(Standard_True)
|
||||
}
|
||||
DA->SetAxisLength(aLength,aLength,aLength);
|
||||
Quantity_Color col (Quantity_NOC_TURQUOISE);
|
||||
DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(col);
|
||||
myDrawer->SetDatumAspect(DA);
|
||||
|
||||
ComputeFields();
|
||||
@@ -207,9 +207,9 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
|
||||
myDrawer->LineAspect()->SetColor(aCol);
|
||||
|
||||
const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect();
|
||||
DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
@@ -225,9 +225,9 @@ void AIS_Axis::SetWidth(const Standard_Real aValue)
|
||||
myDrawer->LineAspect()->SetWidth(aValue);
|
||||
|
||||
const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect();
|
||||
DA->LineAspect(Prs3d_DatumParts_XAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DatumParts_YAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
@@ -253,27 +253,27 @@ void AIS_Axis::ComputeFields()
|
||||
case AIS_TOAX_XAxis:
|
||||
{
|
||||
oX.Coord(x,y,z);
|
||||
myVal = DA->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
myVal = DA->AxisLength(Prs3d_DP_XAxis);
|
||||
myDir = oX;
|
||||
myLineAspect = DA->LineAspect(Prs3d_DatumParts_XAxis);
|
||||
myLineAspect = DA->LineAspect(Prs3d_DP_XAxis);
|
||||
myText = Standard_CString ("X");
|
||||
break;
|
||||
}
|
||||
case AIS_TOAX_YAxis:
|
||||
{
|
||||
oY.Coord(x,y,z);
|
||||
myVal = DA->AxisLength(Prs3d_DatumParts_YAxis);
|
||||
myVal = DA->AxisLength(Prs3d_DP_YAxis);
|
||||
myDir = oY;
|
||||
myLineAspect = DA->LineAspect(Prs3d_DatumParts_YAxis);
|
||||
myLineAspect = DA->LineAspect(Prs3d_DP_YAxis);
|
||||
myText = Standard_CString ("Y");
|
||||
break;
|
||||
}
|
||||
case AIS_TOAX_ZAxis:
|
||||
{
|
||||
oZ.Coord(x,y,z);
|
||||
myVal = DA->AxisLength(Prs3d_DatumParts_ZAxis);
|
||||
myVal = DA->AxisLength(Prs3d_DP_ZAxis);
|
||||
myDir = oZ;
|
||||
myLineAspect = DA->LineAspect(Prs3d_DatumParts_ZAxis);
|
||||
myLineAspect = DA->LineAspect(Prs3d_DP_ZAxis);
|
||||
myText = Standard_CString ("Z");
|
||||
break;
|
||||
}
|
||||
@@ -306,9 +306,9 @@ void AIS_Axis::UnsetColor()
|
||||
myDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
|
||||
hasOwnColor = Standard_False;
|
||||
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -320,8 +320,8 @@ void AIS_Axis::UnsetWidth()
|
||||
{
|
||||
myOwnWidth = 0.0f;
|
||||
myDrawer->LineAspect()->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
@@ -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_NameOfMaterial_Plastified);
|
||||
aShadingAspect->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
aShadingAspect->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
|
||||
aShadingAspect->SetTransparency (THE_DEFAULT_TRANSPARENCY);
|
||||
aShadingAspect->SetColor (THE_DEFAULT_COLOR);
|
||||
|
@@ -60,11 +60,11 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
|
||||
case AIS_TOA_FaceBoundary:
|
||||
return Dr->FaceBoundaryAspect();
|
||||
case AIS_TOA_FirstAxis:
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis);
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
|
||||
case AIS_TOA_SecondAxis:
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis);
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DP_YAxis);
|
||||
case AIS_TOA_ThirdAxis:
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis);
|
||||
return Dr->DatumAspect()->LineAspect(Prs3d_DP_ZAxis);
|
||||
}
|
||||
Handle(Prs3d_LineAspect) bid;
|
||||
return bid;
|
||||
|
@@ -95,7 +95,7 @@ namespace
|
||||
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
|
||||
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
|
||||
theDrawer->PointAspect()->SetColor (theColor);
|
||||
for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_None; ++aPartIter)
|
||||
for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DP_None; ++aPartIter)
|
||||
{
|
||||
if (Handle(Prs3d_LineAspect) aLineAsp = theDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )aPartIter))
|
||||
{
|
||||
@@ -1002,7 +1002,13 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
|
||||
if (!myMainVwr->ActiveViews().IsEmpty())
|
||||
{
|
||||
theIObj->RecomputeTransformation (myMainVwr->ActiveViewIterator().Value()->Camera());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RecomputeSelectionOnly
|
||||
//purpose :
|
||||
@@ -2180,7 +2186,7 @@ void AIS_InteractiveContext::SetSelectionSensitivity (const Handle(AIS_Interacti
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::InitAttributes()
|
||||
{
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_Brass);
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
|
||||
myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
|
||||
|
||||
// myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);
|
||||
@@ -2197,9 +2203,9 @@ void AIS_InteractiveContext::InitAttributes()
|
||||
const Standard_Real aLength = 100.0;
|
||||
aTrihAspect->SetAxisLength (aLength, aLength, aLength);
|
||||
const Quantity_Color aColor = Quantity_NOC_LIGHTSTEELBLUE4;
|
||||
aTrihAspect->LineAspect(Prs3d_DatumParts_XAxis)->SetColor (aColor);
|
||||
aTrihAspect->LineAspect(Prs3d_DatumParts_YAxis)->SetColor (aColor);
|
||||
aTrihAspect->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor (aColor);
|
||||
aTrihAspect->LineAspect(Prs3d_DP_XAxis)->SetColor (aColor);
|
||||
aTrihAspect->LineAspect(Prs3d_DP_YAxis)->SetColor (aColor);
|
||||
aTrihAspect->LineAspect(Prs3d_DP_ZAxis)->SetColor (aColor);
|
||||
|
||||
Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect();
|
||||
const Standard_Real aPlaneLength = 200.0;
|
||||
@@ -2213,7 +2219,7 @@ void AIS_InteractiveContext::InitAttributes()
|
||||
//=======================================================================
|
||||
Standard_Real AIS_InteractiveContext::TrihedronSize() const
|
||||
{
|
||||
return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -225,6 +225,7 @@ 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),
|
||||
@@ -246,6 +247,7 @@ 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),
|
||||
@@ -585,18 +587,35 @@ 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;
|
||||
@@ -672,7 +691,10 @@ 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;
|
||||
}
|
||||
@@ -719,6 +741,173 @@ 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 :
|
||||
@@ -924,6 +1113,19 @@ 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 :
|
||||
@@ -983,11 +1185,26 @@ 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());
|
||||
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin(), mySkinMode);
|
||||
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
|
||||
@@ -996,7 +1213,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);
|
||||
myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx, mySkinMode);
|
||||
myAxes[anIt].SetTransformPersistence (TransformPersistence());
|
||||
}
|
||||
|
||||
@@ -1034,7 +1251,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
|
||||
return;
|
||||
}
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
||||
@@ -1072,7 +1289,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)
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor (myAxes[anOwner->Index()].Color());
|
||||
@@ -1108,6 +1325,25 @@ 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 :
|
||||
@@ -1121,13 +1357,9 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
return;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner;
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Translation || aMode == AIS_MM_None)
|
||||
Handle(SelectMgr_EntityOwner) anOwner;
|
||||
if (aMode == AIS_MM_Translation)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1136,23 +1368,27 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
if (aMode != AIS_MM_None)
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// 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);
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), TopLoc_Location());
|
||||
TopLoc_Location aTrsf = !myAxes[anIt].TranslatorGroup().IsNull()
|
||||
? TopLoc_Location (myAxes[anIt].TranslatorGroup()->Transformation())
|
||||
: TopLoc_Location();
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), aTrsf);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Rotation || aMode == AIS_MM_None)
|
||||
if (aMode == AIS_MM_Rotation)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1161,22 +1397,28 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
if (aMode != AIS_MM_None)
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// 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_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
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);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Scaling || aMode == AIS_MM_None)
|
||||
if (aMode == AIS_MM_Scaling)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1184,21 +1426,27 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// 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_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
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);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
if (aMode == AIS_MM_TranslationPlane)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1206,27 +1454,32 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
|
||||
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// 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_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add(aTri);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1238,15 +1491,17 @@ 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_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Real theAngle,
|
||||
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());
|
||||
@@ -1261,15 +1516,18 @@ 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);
|
||||
}
|
||||
@@ -1279,52 +1537,75 @@ 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)
|
||||
void AIS_Manipulator::Cube::Init (const gp_Ax1& thePosition,
|
||||
const Standard_ShortReal theSize,
|
||||
const ManipulatorSkin theSkinMode)
|
||||
{
|
||||
myArray = new Graphic3d_ArrayOfTriangles (12 * 3, 0, Standard_True);
|
||||
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();
|
||||
|
||||
Poly_Array1OfTriangle aPolyTriangles (1, 12);
|
||||
TColgp_Array1OfPnt aPoints (1, 36);
|
||||
NCollection_Array1<gp_Dir> aNormals (1, 12);
|
||||
myTriangulation = new Poly_Triangulation (aPoints, aPolyTriangles);
|
||||
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());
|
||||
|
||||
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;
|
||||
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_Dir aRight ((gp_Vec(aTopRight, aV7) ^ gp_Vec(aTopRight, aV2)).XYZ());
|
||||
gp_Dir aFront ((gp_Vec(aV3, aV4) ^ gp_Vec(aV3, aV5)).XYZ());
|
||||
Poly_Array1OfTriangle aPolyTriangles (1, 12);
|
||||
TColgp_Array1OfPnt aPoints (1, 36);
|
||||
myTriangulation = new Poly_Triangulation (aPoints, aPolyTriangles);
|
||||
|
||||
// Bottom
|
||||
addTriangle (0, aBottomLeft, aV2, aV3, -thePosition.Direction());
|
||||
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
|
||||
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;
|
||||
|
||||
// Front
|
||||
addTriangle (2, aV3, aV5, aV4, -aFront);
|
||||
addTriangle (3, aV3, aTopRight, aV5, -aFront);
|
||||
gp_Dir aRight ((gp_Vec(aTopRight, aV7) ^ gp_Vec(aTopRight, aV2)).XYZ());
|
||||
gp_Dir aFront ((gp_Vec(aV3, aV4) ^ gp_Vec(aV3, aV5)).XYZ());
|
||||
|
||||
// Back
|
||||
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
|
||||
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
|
||||
// Bottom
|
||||
addTriangle (0, aBottomLeft, aV2, aV3, -thePosition.Direction());
|
||||
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
|
||||
|
||||
// aTop
|
||||
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
|
||||
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
|
||||
// Front
|
||||
addTriangle (2, aV3, aV5, aV4, -aFront);
|
||||
addTriangle (3, aV3, aTopRight, aV5, -aFront);
|
||||
|
||||
// Left
|
||||
addTriangle (8, aV6, aV4, aV5, aRight);
|
||||
addTriangle (9, aBottomLeft, aV4, aV6, aRight);
|
||||
// Back
|
||||
addTriangle (4, aBottomLeft, aV7, aV2, aFront);
|
||||
addTriangle (5, aBottomLeft, aV6, aV7, aFront);
|
||||
|
||||
// Right
|
||||
addTriangle (10, aV3, aV7, aTopRight, -aRight);
|
||||
addTriangle (11, aV3, aV2, aV7, -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);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1354,15 +1635,49 @@ 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)
|
||||
{
|
||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
gp_Ax3 aSystem (thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||
myArray = aTool.CreateTriangulation (aTrsf);
|
||||
myTriangulation = aTool.CreatePolyTriangulation (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);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1400,7 +1715,8 @@ 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 Handle(Prs3d_ShadingAspect)& theAspect,
|
||||
const ManipulatorSkin theSkinMode)
|
||||
{
|
||||
if (myHasTranslation)
|
||||
{
|
||||
@@ -1408,16 +1724,66 @@ 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 (true);
|
||||
myTranslatorGroup->SetClosed (theSkinMode == ManipulatorSkin_Shaded);
|
||||
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (myHighlightTranslator.IsNull())
|
||||
{
|
||||
@@ -1437,10 +1803,11 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
if (myHasScaling)
|
||||
{
|
||||
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
||||
const Standard_ShortReal aBoxSize = theSkinMode == ManipulatorSkin_Shaded ? myBoxSize : myBoxSize * 0.5f + myIndent;
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), aBoxSize, theSkinMode);
|
||||
|
||||
myScalerGroup = thePrs->NewGroup();
|
||||
myScalerGroup->SetClosed (true);
|
||||
myScalerGroup->SetClosed (theSkinMode == ManipulatorSkin_Shaded);
|
||||
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myScalerGroup->AddPrimitiveArray (myCube.Array());
|
||||
|
||||
@@ -1461,8 +1828,11 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
|
||||
if (myHasRotation)
|
||||
{
|
||||
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
|
||||
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
|
||||
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);
|
||||
myRotatorGroup = thePrs->NewGroup ();
|
||||
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
|
||||
@@ -1492,10 +1862,17 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
else
|
||||
aXDirection = gp::DX();
|
||||
|
||||
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
|
||||
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);
|
||||
myDraggerGroup = thePrs->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = theSkinMode == ManipulatorSkin_Flat
|
||||
? theAspect->Aspect()
|
||||
: new Graphic3d_AspectFillArea3d();
|
||||
|
||||
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
||||
|
||||
@@ -1509,8 +1886,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,6 +189,13 @@ 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
|
||||
@@ -268,6 +275,18 @@ 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; }
|
||||
@@ -407,9 +426,10 @@ 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_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Real theAngle,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -428,6 +448,7 @@ 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);
|
||||
|
||||
@@ -444,7 +465,9 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Cube() { }
|
||||
~Cube() { }
|
||||
|
||||
void Init (const gp_Ax1& thePosition, const Standard_ShortReal myBoxSize);
|
||||
void Init (const gp_Ax1& thePosition,
|
||||
const Standard_ShortReal myBoxSize,
|
||||
const ManipulatorSkin theSkinMode);
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
@@ -475,6 +498,7 @@ 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);
|
||||
|
||||
@@ -499,7 +523,8 @@ 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 Handle(Prs3d_ShadingAspect)& theAspect,
|
||||
const ManipulatorSkin theSkinMode);
|
||||
|
||||
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
||||
|
||||
@@ -573,8 +598,12 @@ 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; }
|
||||
@@ -599,6 +628,8 @@ 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)
|
||||
@@ -674,17 +705,23 @@ 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.
|
||||
|
@@ -405,9 +405,9 @@ void AIS_Plane::UnsetSize()
|
||||
new Prs3d_DatumAspect();
|
||||
|
||||
myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength());
|
||||
myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DatumParts_XAxis),
|
||||
DA->AxisLength(Prs3d_DatumParts_YAxis),
|
||||
DA->AxisLength(Prs3d_DatumParts_ZAxis));
|
||||
myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DP_XAxis),
|
||||
DA->AxisLength(Prs3d_DP_YAxis),
|
||||
DA->AxisLength(Prs3d_DP_ZAxis));
|
||||
}
|
||||
|
||||
myHasOwnSize = Standard_False;
|
||||
@@ -453,9 +453,9 @@ void AIS_Plane::SetColor(const Quantity_Color &aCol)
|
||||
}
|
||||
|
||||
PA->EdgesAspect()->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
|
||||
|
||||
if(!yenavaitPA)
|
||||
myDrawer->SetPlaneAspect(PA);
|
||||
@@ -485,9 +485,9 @@ void AIS_Plane::UnsetColor()
|
||||
Quantity_Color Col = PA->EdgesAspect()->Aspect()->Color();
|
||||
myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col);
|
||||
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(Col);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(Col);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(Col);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Col);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Col);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Col);
|
||||
}
|
||||
|
||||
|
||||
@@ -542,9 +542,9 @@ void AIS_Plane::ComputeFields()
|
||||
oX.Coord(x1,y1,z1);
|
||||
oY.Coord(x2,y2,z2);
|
||||
oZ.Coord(x3,y3,z3);
|
||||
Standard_Real DS1 = DA->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
Standard_Real DS2 = DA->AxisLength(Prs3d_DatumParts_YAxis);
|
||||
Standard_Real DS3 = DA->AxisLength(Prs3d_DatumParts_ZAxis);
|
||||
Standard_Real DS1 = DA->AxisLength(Prs3d_DP_XAxis);
|
||||
Standard_Real DS2 = DA->AxisLength(Prs3d_DP_YAxis);
|
||||
Standard_Real DS3 = DA->AxisLength(Prs3d_DP_ZAxis);
|
||||
// gp_Pnt aPt2,aPt3;
|
||||
|
||||
switch (myTypeOfPlane) {
|
||||
@@ -588,7 +588,7 @@ void AIS_Plane::ComputeFields()
|
||||
void AIS_Plane::InitDrawerAttributes()
|
||||
{
|
||||
Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();
|
||||
shasp->SetMaterial(Graphic3d_NameOfMaterial_Plastified);
|
||||
shasp->SetMaterial(Graphic3d_NOM_PLASTIC);
|
||||
shasp->SetColor(Quantity_NOC_GRAY40);
|
||||
myDrawer->SetShadingAspect(shasp);
|
||||
Handle(Graphic3d_AspectFillArea3d) asf = shasp->Aspect();
|
||||
|
@@ -67,9 +67,9 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane)
|
||||
Standard_Real aLength = UnitsAPI::AnyToLS (100. ,"mm");
|
||||
DA->SetAxisLength(aLength,aLength,aLength);
|
||||
Quantity_Color col (Quantity_NOC_ROYALBLUE1);
|
||||
DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(col);
|
||||
DA->SetDrawDatumAxes(Prs3d_DatumAxes_XYAxes);
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
|
||||
DA->SetDrawDatumAxes(Prs3d_DA_XYAxis);
|
||||
myDrawer->SetDatumAspect(DA); // odl - specific is created because it is modified
|
||||
myShapes[0] = Position();
|
||||
myShapes[1] = XAxis();
|
||||
@@ -142,7 +142,7 @@ void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) {
|
||||
}
|
||||
|
||||
Standard_Real AIS_PlaneTrihedron::GetLength() const {
|
||||
return myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -156,7 +156,7 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
|
||||
aPresentation->SetDisplayPriority(5);
|
||||
// drawing axis in X direction
|
||||
gp_Pnt first, last;
|
||||
Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
|
||||
gp_Dir xDir = myPlane->Position().Ax2().XDirection();
|
||||
|
||||
gp_Pnt orig = myPlane->Position().Ax2().Location();
|
||||
@@ -166,23 +166,15 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
|
||||
first.SetCoord( xo, yo, zo );
|
||||
last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
|
||||
|
||||
DsgPrs_XYZAxisPresentation::Add (aPresentation,
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis),
|
||||
myDrawer->ArrowAspect(),
|
||||
myDrawer->TextAspect(),
|
||||
xDir, value, myXLabel.ToCString(), first, last);
|
||||
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last );
|
||||
|
||||
// drawing axis in Y direction
|
||||
value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_YAxis);
|
||||
value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
|
||||
gp_Dir yDir = myPlane->Position().Ax2().YDirection();
|
||||
|
||||
yDir.Coord( x, y, z );
|
||||
last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
|
||||
DsgPrs_XYZAxisPresentation::Add (aPresentation,
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis),
|
||||
myDrawer->ArrowAspect(),
|
||||
myDrawer->TextAspect(),
|
||||
yDir, value, myYLabel.ToCString(), first, last);
|
||||
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last );
|
||||
|
||||
aPresentation->SetInfiniteState (Standard_True);
|
||||
}
|
||||
@@ -246,8 +238,8 @@ void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
|
||||
{
|
||||
hasOwnColor=Standard_True;
|
||||
myDrawer->SetColor (aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
@@ -262,12 +254,12 @@ void ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,c
|
||||
gp_Ax2 theax(myPlane->Position().Ax2());
|
||||
PP(1) = theax.Location();
|
||||
|
||||
Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
|
||||
gp_Vec vec = theax.XDirection();
|
||||
vec *= len;
|
||||
PP(2) = PP(1).Translated(vec);
|
||||
|
||||
len = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_YAxis);
|
||||
len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
|
||||
vec = theax.YDirection();
|
||||
vec *= len;
|
||||
PP(3) = PP(1).Translated(vec);
|
||||
|
@@ -297,7 +297,7 @@ void AIS_PointCloud::UnsetColor()
|
||||
|
||||
AIS_InteractiveObject::UnsetColor();
|
||||
{
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NameOfMaterial_Brass);
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_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_NameOfMaterial_Brass);
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_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_NameOfMaterial_Plastified);
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
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_NameOfMaterial_Plastified);
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
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_NameOfMaterial_Plastified);
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
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_NameOfMaterial_Brass);
|
||||
const Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
|
||||
Graphic3d_MaterialAspect mat = aDefaultMat;
|
||||
Quantity_Color anInteriorColors[2] = {Quantity_NOC_CYAN1, Quantity_NOC_CYAN1};
|
||||
if (myDrawer->HasLink())
|
||||
|
@@ -52,32 +52,31 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent)
|
||||
: myComponent (theComponent),
|
||||
myTrihDispMode (Prs3d_DM_WireFrame),
|
||||
myHasOwnSize (Standard_False),
|
||||
: myHasOwnSize (Standard_False),
|
||||
myHasOwnTextColor (Standard_False),
|
||||
myHasOwnArrowColor (Standard_False)
|
||||
myHasOwnArrowColor (Standard_False),
|
||||
myTrihDispMode (Prs3d_DM_WireFrame),
|
||||
myComponent (theComponent)
|
||||
{
|
||||
myAutoHilight = Standard_False;
|
||||
|
||||
// selection priorities
|
||||
memset (mySelectionPriority, 0, sizeof(mySelectionPriority));
|
||||
mySelectionPriority[Prs3d_DatumParts_None] = 5; // complete trihedron: priority 5 (same as faces)
|
||||
mySelectionPriority[Prs3d_DatumParts_Origin] = 8; // origin: priority 8
|
||||
for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter)
|
||||
mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces)
|
||||
mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8
|
||||
for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
|
||||
{
|
||||
mySelectionPriority[aPartIter] = 7; // axes: priority: 7
|
||||
mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 7); // axes: priority: 7
|
||||
}
|
||||
for (int aPartIter = Prs3d_DatumParts_XOYAxis; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter)
|
||||
for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
|
||||
{
|
||||
mySelectionPriority[aPartIter] = 5; // planes: priority: 5
|
||||
mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5
|
||||
}
|
||||
myHiddenLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_WHITE, Aspect_TOL_EMPTY, 1.0f);
|
||||
|
||||
// trihedron labels
|
||||
myLabels[Prs3d_DatumParts_XAxis] = "X";
|
||||
myLabels[Prs3d_DatumParts_YAxis] = "Y";
|
||||
myLabels[Prs3d_DatumParts_ZAxis] = "Z";
|
||||
myLabel.Bind (Prs3d_DP_XAxis, "X");
|
||||
myLabel.Bind (Prs3d_DP_YAxis, "Y");
|
||||
myLabel.Bind (Prs3d_DP_ZAxis, "Z");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -97,15 +96,32 @@ void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponen
|
||||
void AIS_Trihedron::setOwnDatumAspect()
|
||||
{
|
||||
if (myDrawer->HasOwnDatumAspect())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Prs3d_DatumAspect) aNewAspect = new Prs3d_DatumAspect();
|
||||
myDrawer->SetDatumAspect (aNewAspect);
|
||||
if (!myDrawer->Link().IsNull())
|
||||
myDrawer->SetDatumAspect(aNewAspect);
|
||||
|
||||
if (myDrawer->Link().IsNull())
|
||||
return;
|
||||
|
||||
myDrawer->DatumAspect()->SetDrawArrows (myDrawer->Link()->DatumAspect()->ToDrawArrows());
|
||||
myDrawer->DatumAspect()->SetDrawLabels (myDrawer->Link()->DatumAspect()->ToDrawLabels());
|
||||
*myDrawer->DatumAspect()->TextAspect()->Aspect() =
|
||||
*myDrawer->Link()->DatumAspect()->TextAspect()->Aspect();
|
||||
*myDrawer->DatumAspect()->PointAspect()->Aspect() =
|
||||
*myDrawer->Link()->DatumAspect()->PointAspect()->Aspect();
|
||||
*myDrawer->DatumAspect()->ArrowAspect()->Aspect() =
|
||||
*myDrawer->Link()->DatumAspect()->ArrowAspect()->Aspect();
|
||||
|
||||
for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
|
||||
{
|
||||
aNewAspect->CopyAspectsFrom (myDrawer->Link()->DatumAspect());
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
|
||||
if (!aNewAspect->LineAspect(aPart).IsNull())
|
||||
*myDrawer->DatumAspect()->LineAspect(aPart)->Aspect() =
|
||||
*myDrawer->Link()->DatumAspect()->LineAspect(aPart)->Aspect();
|
||||
if (!aNewAspect->ShadingAspect(aPart).IsNull())
|
||||
*myDrawer->DatumAspect()->ShadingAspect(aPart)->Aspect() =
|
||||
*myDrawer->Link()->DatumAspect()->ShadingAspect(aPart)->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,12 +129,12 @@ void AIS_Trihedron::setOwnDatumAspect()
|
||||
//function : SetSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetSize(const Standard_Real theValue)
|
||||
void AIS_Trihedron::SetSize(const Standard_Real aValue)
|
||||
{
|
||||
myHasOwnSize = Standard_True;
|
||||
|
||||
setOwnDatumAspect();
|
||||
myDrawer->DatumAspect()->SetAxisLength (theValue, theValue, theValue);
|
||||
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
|
||||
|
||||
SetToUpdate();
|
||||
UpdateSelection();
|
||||
@@ -141,9 +157,9 @@ void AIS_Trihedron::UnsetSize()
|
||||
const Handle(Prs3d_DatumAspect) DA = myDrawer->HasLink()
|
||||
? myDrawer->Link()->DatumAspect()
|
||||
: new Prs3d_DatumAspect();
|
||||
myDrawer->DatumAspect()->SetAxisLength (DA->AxisLength (Prs3d_DatumParts_XAxis),
|
||||
DA->AxisLength (Prs3d_DatumParts_YAxis),
|
||||
DA->AxisLength (Prs3d_DatumParts_ZAxis));
|
||||
myDrawer->DatumAspect()->SetAxisLength (DA->AxisLength (Prs3d_DP_XAxis),
|
||||
DA->AxisLength (Prs3d_DP_YAxis),
|
||||
DA->AxisLength (Prs3d_DP_ZAxis));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,7 +174,7 @@ void AIS_Trihedron::UnsetSize()
|
||||
//=======================================================================
|
||||
Standard_Real AIS_Trihedron::Size() const
|
||||
{
|
||||
return myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);
|
||||
return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -194,9 +210,10 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele
|
||||
{
|
||||
case AIS_TrihedronSelectionMode_EntireObject:
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, mySelectionPriority[Prs3d_DatumParts_None]);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (
|
||||
this, mySelectionPriority.Find (Prs3d_DP_None));
|
||||
const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
|
||||
for (int aPartIter = isShadingMode ? Prs3d_DatumParts_Origin : Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis;
|
||||
for (int aPartIter = isShadingMode ? Prs3d_DP_Origin : Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis;
|
||||
++aPartIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
|
||||
@@ -210,10 +227,11 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele
|
||||
}
|
||||
case AIS_TrihedronSelectionMode_Origin:
|
||||
{
|
||||
const Prs3d_DatumParts aPart = Prs3d_DatumParts_Origin;
|
||||
const Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||
if (anAspect->DrawDatumPart (aPart))
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
|
||||
mySelectionPriority.Find (aPart));
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives(aPart);
|
||||
theSelection->Add (createSensitiveEntity (aPart, anOwner));
|
||||
}
|
||||
@@ -221,14 +239,15 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele
|
||||
}
|
||||
case AIS_TrihedronSelectionMode_Axes:
|
||||
{
|
||||
for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter)
|
||||
for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
|
||||
if (!anAspect->DrawDatumPart (aPart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
|
||||
mySelectionPriority.Find (aPart));
|
||||
theSelection->Add (createSensitiveEntity (aPart, anOwner));
|
||||
}
|
||||
break;
|
||||
@@ -237,14 +256,15 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele
|
||||
{
|
||||
// create owner for each trihedron plane
|
||||
{
|
||||
for (int aPartIter = Prs3d_DatumParts_XOYAxis; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter)
|
||||
for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
|
||||
if (!anAspect->DrawDatumPart (aPart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
|
||||
mySelectionPriority.Find (aPart));
|
||||
theSelection->Add (createSensitiveEntity (aPart, anOwner));
|
||||
}
|
||||
}
|
||||
@@ -264,7 +284,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
|
||||
Handle(AIS_TrihedronOwner) anOwner = Handle(AIS_TrihedronOwner)::DownCast (theOwner);
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
// default 0 selection mode
|
||||
/// default 0 selection mode
|
||||
Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
|
||||
thePM->Color (this, theStyle, aHiMode, NULL, Graphic3d_ZLayerId_Top);
|
||||
return;
|
||||
@@ -279,7 +299,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
|
||||
aPresentation->Clear();
|
||||
const Prs3d_DatumParts aPart = anOwner->DatumPart();
|
||||
Handle(Graphic3d_Group) aGroup = aPresentation->CurrentGroup();
|
||||
if (aPart >= Prs3d_DatumParts_XOYAxis && aPart <= Prs3d_DatumParts_XOZAxis)
|
||||
if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
|
||||
{
|
||||
// planes selection is equal in both shading and wireframe mode
|
||||
aGroup->SetGroupPrimitivesAspect (theStyle->LineAspect()->Aspect());
|
||||
@@ -292,7 +312,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aPart == Prs3d_DatumParts_Origin)
|
||||
if (aPart == Prs3d_DP_Origin)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect());
|
||||
}
|
||||
@@ -340,15 +360,14 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&
|
||||
}
|
||||
|
||||
const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart();
|
||||
if (myPartToGroup[aPart].IsNull()
|
||||
|| mySelectedParts.Contains (aPart))
|
||||
Handle(Graphic3d_Group) aGroup;
|
||||
if (mySelectedParts.Contains (aPart) || !myPartToGroup.Find (aPart, aGroup))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Graphic3d_Group)& aGroup = myPartToGroup[aPart];
|
||||
if (aPart >= Prs3d_DatumParts_XOYAxis
|
||||
&& aPart <= Prs3d_DatumParts_XOZAxis)
|
||||
if (aPart >= Prs3d_DP_XOYAxis
|
||||
&& aPart <= Prs3d_DP_XOZAxis)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect());
|
||||
}
|
||||
@@ -360,7 +379,7 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aPart == Prs3d_DatumParts_Origin)
|
||||
if (aPart == Prs3d_DP_Origin)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
|
||||
}
|
||||
@@ -386,9 +405,9 @@ void AIS_Trihedron::ClearSelected()
|
||||
anIterator.Next())
|
||||
{
|
||||
const Prs3d_DatumParts aPart = anIterator.Value();
|
||||
const Handle(Graphic3d_Group)& aGroup = myPartToGroup[aPart];
|
||||
if (aPart >= Prs3d_DatumParts_XOYAxis
|
||||
&& aPart <= Prs3d_DatumParts_XOZAxis)
|
||||
Handle(Graphic3d_Group) aGroup = myPartToGroup.Find (aPart);
|
||||
if (aPart >= Prs3d_DP_XOYAxis
|
||||
&& aPart <= Prs3d_DP_XOZAxis)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
|
||||
}
|
||||
@@ -398,7 +417,7 @@ void AIS_Trihedron::ClearSelected()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aPart == Prs3d_DatumParts_Origin)
|
||||
if (aPart == Prs3d_DP_Origin)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
|
||||
}
|
||||
@@ -418,21 +437,17 @@ void AIS_Trihedron::ClearSelected()
|
||||
void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager3d)& /*thePrsMgr*/,
|
||||
const Handle(Prs3d_Presentation)& thePrs)
|
||||
{
|
||||
for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_NB; ++aPartIter)
|
||||
{
|
||||
myPartToGroup[aPartIter].Nullify();
|
||||
}
|
||||
|
||||
myPartToGroup.Clear();
|
||||
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
|
||||
const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
|
||||
// display origin
|
||||
{
|
||||
// Origin is visualized only in shading mode
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
const Prs3d_DatumParts aPart = Prs3d_DatumParts_Origin;
|
||||
const Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||
if (anAspect->DrawDatumPart(aPart))
|
||||
{
|
||||
myPartToGroup[aPart] = aGroup;
|
||||
myPartToGroup.Bind (aPart, aGroup);
|
||||
if (isShadingMode)
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
|
||||
@@ -447,7 +462,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
|
||||
// display axes
|
||||
{
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter)
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
|
||||
if (!anAspect->DrawDatumPart (aPart))
|
||||
@@ -456,7 +471,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup();
|
||||
myPartToGroup[aPart] = anAxisGroup;
|
||||
myPartToGroup.Bind (aPart, anAxisGroup);
|
||||
if (isShadingMode)
|
||||
{
|
||||
anAxisGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
|
||||
@@ -468,21 +483,14 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
anAxisGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
|
||||
|
||||
// draw arrow
|
||||
const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart);
|
||||
Prs3d_DatumParts anArrowPart = anAspect->ArrowPartForAxis (aPart);
|
||||
if (!anAspect->DrawDatumPart (anArrowPart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) anArrowGroup = thePrs->NewGroup();
|
||||
if (isShadingMode)
|
||||
{
|
||||
anArrowGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (anArrowPart)->Aspect());
|
||||
}
|
||||
else
|
||||
{
|
||||
anArrowGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (anArrowPart)->Aspect());
|
||||
}
|
||||
anArrowGroup->SetGroupPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
|
||||
anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart));
|
||||
}
|
||||
}
|
||||
@@ -492,7 +500,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
{
|
||||
Handle(Geom_Axis2Placement) aComponent = myComponent;
|
||||
const gp_Pnt anOrigin = aComponent->Location();
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter)
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
|
||||
if (!anAspect->DrawDatumPart (aPart))
|
||||
@@ -501,23 +509,23 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
}
|
||||
|
||||
const Standard_Real anAxisLength = anAspect->AxisLength (aPart);
|
||||
const TCollection_ExtendedString& aLabel = myLabels[aPart];
|
||||
const TCollection_ExtendedString& aLabel = myLabel.Find (aPart);
|
||||
gp_Dir aDir;
|
||||
switch (aPart)
|
||||
{
|
||||
case Prs3d_DatumParts_XAxis: aDir = aComponent->XDirection(); break;
|
||||
case Prs3d_DatumParts_YAxis: aDir = aComponent->YDirection(); break;
|
||||
case Prs3d_DatumParts_ZAxis: aDir = aComponent->Direction(); break;
|
||||
case Prs3d_DP_XAxis: aDir = aComponent->XDirection(); break;
|
||||
case Prs3d_DP_YAxis: aDir = aComponent->YDirection(); break;
|
||||
case Prs3d_DP_ZAxis: aDir = aComponent->Direction(); break;
|
||||
default: break;
|
||||
}
|
||||
Handle(Graphic3d_Group) aLabelGroup = thePrs->NewGroup();
|
||||
const gp_Pnt aPoint = anOrigin.XYZ() + aDir.XYZ() * anAxisLength;
|
||||
Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect (aPart), aLabel, aPoint);
|
||||
Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect(), aLabel, aPoint);
|
||||
}
|
||||
}
|
||||
|
||||
// planes invisible group for planes selection
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XOYAxis; anAxisIter <= Prs3d_DatumParts_XOZAxis; ++anAxisIter)
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XOYAxis; anAxisIter <= Prs3d_DP_XOZAxis; ++anAxisIter)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
|
||||
if (!anAspect->DrawDatumPart(aPart))
|
||||
@@ -526,7 +534,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
myPartToGroup[aPart] = aGroup;
|
||||
myPartToGroup.Bind (aPart, aGroup);
|
||||
|
||||
aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
|
||||
aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
|
||||
@@ -543,23 +551,12 @@ void AIS_Trihedron::SetDatumPartColor (const Prs3d_DatumParts thePart,
|
||||
setOwnDatumAspect();
|
||||
|
||||
myDrawer->DatumAspect()->ShadingAspect (thePart)->SetColor (theColor);
|
||||
if (thePart != Prs3d_DatumParts_Origin)
|
||||
if (thePart != Prs3d_DP_Origin)
|
||||
{
|
||||
myDrawer->DatumAspect()->LineAspect (thePart)->SetColor (theColor);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTextColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetTextColor (const Prs3d_DatumParts thePart,
|
||||
const Quantity_Color& theColor)
|
||||
{
|
||||
setOwnDatumAspect();
|
||||
myDrawer->DatumAspect()->TextAspect (thePart)->SetColor (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTextColor
|
||||
//purpose :
|
||||
@@ -567,9 +564,7 @@ void AIS_Trihedron::SetTextColor (const Prs3d_DatumParts thePart,
|
||||
void AIS_Trihedron::SetTextColor (const Quantity_Color& theColor)
|
||||
{
|
||||
setOwnDatumAspect();
|
||||
myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_XAxis)->SetColor (theColor);
|
||||
myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_YAxis)->SetColor (theColor);
|
||||
myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_ZAxis)->SetColor (theColor);
|
||||
myDrawer->DatumAspect()->TextAspect()->SetColor (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -596,7 +591,7 @@ void AIS_Trihedron::SetOriginColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myTrihDispMode == Prs3d_DM_Shaded)
|
||||
{
|
||||
SetDatumPartColor (Prs3d_DatumParts_Origin, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_Origin, theColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,7 +601,7 @@ void AIS_Trihedron::SetOriginColor (const Quantity_Color& theColor)
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetXAxisColor (const Quantity_Color& theColor)
|
||||
{
|
||||
SetDatumPartColor (Prs3d_DatumParts_XAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_XAxis, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -615,7 +610,7 @@ void AIS_Trihedron::SetXAxisColor (const Quantity_Color& theColor)
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetYAxisColor (const Quantity_Color& theColor)
|
||||
{
|
||||
SetDatumPartColor (Prs3d_DatumParts_YAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_YAxis, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -624,7 +619,7 @@ void AIS_Trihedron::SetYAxisColor (const Quantity_Color& theColor)
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetAxisColor (const Quantity_Color& theColor)
|
||||
{
|
||||
SetDatumPartColor (Prs3d_DatumParts_ZAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_ZAxis, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -636,24 +631,10 @@ void AIS_Trihedron::SetColor (const Quantity_Color& theColor)
|
||||
hasOwnColor = Standard_True;
|
||||
myDrawer->SetColor (theColor);
|
||||
|
||||
SetDatumPartColor (Prs3d_DatumParts_Origin, theColor);
|
||||
SetDatumPartColor (Prs3d_DatumParts_XAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DatumParts_YAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DatumParts_ZAxis, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetArrowColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::SetArrowColor (const Prs3d_DatumParts thePart,
|
||||
const Quantity_Color& theColor)
|
||||
{
|
||||
setOwnDatumAspect();
|
||||
myHasOwnArrowColor = Standard_True;
|
||||
const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (thePart);
|
||||
myDrawer->DatumAspect()->ShadingAspect(anArrowPart)->SetColor (theColor);
|
||||
myDrawer->DatumAspect()->LineAspect (anArrowPart)->SetColor (theColor);
|
||||
SetDatumPartColor (Prs3d_DP_Origin, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_XAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_YAxis, theColor);
|
||||
SetDatumPartColor (Prs3d_DP_ZAxis, theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -666,11 +647,6 @@ void AIS_Trihedron::SetArrowColor (const Quantity_Color& theColor)
|
||||
|
||||
myHasOwnArrowColor = Standard_True;
|
||||
myDrawer->DatumAspect()->ArrowAspect()->SetColor (theColor);
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XArrow; anAxisIter <= Prs3d_DatumParts_ZArrow; ++anAxisIter)
|
||||
{
|
||||
myDrawer->DatumAspect()->ShadingAspect((Prs3d_DatumParts )anAxisIter)->SetColor (theColor);
|
||||
myDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )anAxisIter)->SetColor (theColor);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -679,7 +655,7 @@ void AIS_Trihedron::SetArrowColor (const Quantity_Color& theColor)
|
||||
//=======================================================================
|
||||
Quantity_Color AIS_Trihedron::TextColor() const
|
||||
{
|
||||
return myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_XAxis)->Aspect()->Color();
|
||||
return myDrawer->DatumAspect()->TextAspect()->Aspect()->Color();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -745,8 +721,8 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
}
|
||||
|
||||
if (thePart >= Prs3d_DatumParts_XOYAxis
|
||||
&& thePart <= Prs3d_DatumParts_XOZAxis)
|
||||
if (thePart >= Prs3d_DP_XOYAxis
|
||||
&& thePart <= Prs3d_DP_XOZAxis)
|
||||
{ // plane
|
||||
const gp_Pnt anXYZ1 = aPrimitives->Vertice (1);
|
||||
const gp_Pnt anXYZ2 = aPrimitives->Vertice (2);
|
||||
@@ -775,6 +751,18 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : arrayOfPrimitives
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_ArrayOfPrimitives) AIS_Trihedron::arrayOfPrimitives(
|
||||
Prs3d_DatumParts theDatumPart) const
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfPrimitives) anArray;
|
||||
myPrimitives.Find(theDatumPart, anArray);
|
||||
return anArray;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updatePrimitives
|
||||
// purpose :
|
||||
@@ -786,19 +774,16 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
const gp_Dir& theYDirection,
|
||||
const gp_Dir& theZDirection)
|
||||
{
|
||||
for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_NB; ++aPartIter)
|
||||
{
|
||||
myPrimitives[aPartIter].Nullify();
|
||||
}
|
||||
myPrimitives.Clear();
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, gp_Dir> anAxisDirs;
|
||||
anAxisDirs.Bind(Prs3d_DatumParts_XAxis, theXDirection);
|
||||
anAxisDirs.Bind(Prs3d_DatumParts_YAxis, theYDirection);
|
||||
anAxisDirs.Bind(Prs3d_DatumParts_ZAxis, theZDirection);
|
||||
anAxisDirs.Bind(Prs3d_DP_XAxis, theXDirection);
|
||||
anAxisDirs.Bind(Prs3d_DP_YAxis, theYDirection);
|
||||
anAxisDirs.Bind(Prs3d_DP_ZAxis, theZDirection);
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, gp_Pnt> anAxisPoints;
|
||||
gp_XYZ anXYZOrigin = theOrigin.XYZ();
|
||||
for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter)
|
||||
for (int anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
|
||||
anAxisPoints.Bind(aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ() *
|
||||
@@ -808,14 +793,14 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
if (theMode == Prs3d_DM_WireFrame)
|
||||
{
|
||||
// origin
|
||||
if (theAspect->DrawDatumPart(Prs3d_DatumParts_Origin))
|
||||
if (theAspect->DrawDatumPart(Prs3d_DP_Origin))
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPoints(1);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
myPrimitives[Prs3d_DatumParts_Origin] = aPrims;
|
||||
myPrimitives.Bind(Prs3d_DP_Origin, aPrims);
|
||||
}
|
||||
// axes
|
||||
for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter)
|
||||
for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter;
|
||||
if (theAspect->DrawDatumPart(aPart))
|
||||
@@ -823,16 +808,17 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
aPrims->AddVertex(anAxisPoints.Find(aPart));
|
||||
myPrimitives[aPart] = aPrims;
|
||||
myPrimitives.Bind(aPart, aPrims);
|
||||
}
|
||||
|
||||
const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart);
|
||||
Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart);
|
||||
if (theAspect->DrawDatumPart(anArrowPart))
|
||||
{
|
||||
myPrimitives[anArrowPart] = Prs3d_Arrow::DrawSegments (anAxisPoints.Find(aPart), anAxisDirs.Find(aPart),
|
||||
theAspect->ArrowAspect()->Angle(),
|
||||
theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeLengthPercent),
|
||||
(Standard_Integer) theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes));
|
||||
myPrimitives.Bind(anArrowPart,
|
||||
Prs3d_Arrow::DrawSegments(anAxisPoints.Find(aPart), anAxisDirs.Find(aPart),
|
||||
theAspect->ArrowAspect()->Angle(),
|
||||
theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent),
|
||||
(Standard_Integer) theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -840,27 +826,28 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
{
|
||||
// shading mode
|
||||
// origin
|
||||
if (theAspect->DrawDatumPart(Prs3d_DatumParts_Origin))
|
||||
if (theAspect->DrawDatumPart(Prs3d_DP_Origin))
|
||||
{
|
||||
const Standard_Real aSphereRadius = theAspect->AxisLength(Prs3d_DatumParts_XAxis) *
|
||||
theAspect->Attribute(Prs3d_DatumAttribute_ShadingOriginRadiusPercent);
|
||||
const Standard_Real aSphereRadius = theAspect->AxisLength(Prs3d_DP_XAxis) *
|
||||
theAspect->Attribute(Prs3d_DP_ShadingOriginRadiusPercent);
|
||||
const Standard_Integer aNbOfFacettes =
|
||||
(Standard_Integer)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes);
|
||||
(Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||
gp_Trsf aSphereTransform;
|
||||
aSphereTransform.SetTranslationPart(gp_Vec(gp::Origin(), theOrigin));
|
||||
myPrimitives[Prs3d_DatumParts_Origin] = Prs3d_ToolSphere::Create (aSphereRadius, aNbOfFacettes, aNbOfFacettes, aSphereTransform);
|
||||
myPrimitives.Bind(Prs3d_DP_Origin, Prs3d_ToolSphere::Create(aSphereRadius, aNbOfFacettes,
|
||||
aNbOfFacettes, aSphereTransform));
|
||||
}
|
||||
// axes
|
||||
{
|
||||
const Standard_Integer aNbOfFacettes =
|
||||
(Standard_Integer)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes);
|
||||
const Standard_Real aTubeRadiusPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingTubeRadiusPercent);
|
||||
const Standard_Real aConeLengthPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeLengthPercent);
|
||||
const Standard_Real aConeRadiusPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeRadiusPercent);
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter)
|
||||
(Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||
const Standard_Real aTubeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingTubeRadiusPercent);
|
||||
const Standard_Real aConeLengthPercent = theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
|
||||
const Standard_Real aConeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingConeRadiusPercent);
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
|
||||
const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart);
|
||||
const Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart);
|
||||
const bool aDrawArrow = theAspect->DrawDatumPart(anArrowPart);
|
||||
const Standard_Real anAxisLength = theAspect->AxisLength(aPart);
|
||||
const gp_Ax1 anAxis(theOrigin, anAxisDirs.Find(aPart));
|
||||
@@ -868,23 +855,24 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
if (theAspect->DrawDatumPart(aPart))
|
||||
{
|
||||
// draw cylinder
|
||||
myPrimitives[aPart] = Prs3d_Arrow::DrawShaded (anAxis, anAxisLength * aTubeRadiusPercent,
|
||||
aDrawArrow ? (anAxisLength - anAxisLength * aConeLengthPercent) : anAxisLength,
|
||||
0.0, 0.0, aNbOfFacettes);
|
||||
myPrimitives.Bind(aPart,
|
||||
Prs3d_Arrow::DrawShaded(anAxis, anAxisLength * aTubeRadiusPercent,
|
||||
aDrawArrow ? anAxisLength - anAxisLength * aConeLengthPercent : anAxisLength,
|
||||
0.0, 0.0, aNbOfFacettes));
|
||||
}
|
||||
|
||||
// draw arrow
|
||||
if (aDrawArrow)
|
||||
{
|
||||
myPrimitives[anArrowPart] = Prs3d_Arrow::DrawShaded (anAxis, 0.0, anAxisLength,
|
||||
anAxisLength * aConeRadiusPercent,
|
||||
anAxisLength * aConeLengthPercent, aNbOfFacettes);
|
||||
myPrimitives.Bind(anArrowPart, Prs3d_Arrow::DrawShaded(anAxis, 0.0, anAxisLength,
|
||||
anAxisLength * aConeRadiusPercent,
|
||||
anAxisLength * aConeLengthPercent, aNbOfFacettes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// planes
|
||||
for (Standard_Integer aPlaneIter = Prs3d_DatumParts_XOYAxis; aPlaneIter <= Prs3d_DatumParts_XOZAxis; ++aPlaneIter)
|
||||
for (Standard_Integer aPlaneIter = Prs3d_DP_XOYAxis; aPlaneIter <= Prs3d_DP_XOZAxis; ++aPlaneIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter;
|
||||
if (!theAspect->DrawDatumPart(aPart))
|
||||
@@ -895,25 +883,25 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(4);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
|
||||
Prs3d_DatumParts aPart1 = Prs3d_DatumParts_XAxis, aPart2 = Prs3d_DatumParts_XAxis;
|
||||
Prs3d_DatumParts aPart1 = Prs3d_DP_XAxis, aPart2 = Prs3d_DP_XAxis;
|
||||
switch(aPart)
|
||||
{
|
||||
case Prs3d_DatumParts_XOYAxis:
|
||||
case Prs3d_DP_XOYAxis:
|
||||
{
|
||||
aPart1 = Prs3d_DatumParts_XAxis;
|
||||
aPart2 = Prs3d_DatumParts_YAxis;
|
||||
aPart1 = Prs3d_DP_XAxis;
|
||||
aPart2 = Prs3d_DP_YAxis;
|
||||
break;
|
||||
}
|
||||
case Prs3d_DatumParts_YOZAxis:
|
||||
case Prs3d_DP_YOZAxis:
|
||||
{
|
||||
aPart1 = Prs3d_DatumParts_YAxis;
|
||||
aPart2 = Prs3d_DatumParts_ZAxis;
|
||||
aPart1 = Prs3d_DP_YAxis;
|
||||
aPart2 = Prs3d_DP_ZAxis;
|
||||
break;
|
||||
}
|
||||
case Prs3d_DatumParts_XOZAxis:
|
||||
case Prs3d_DP_XOZAxis:
|
||||
{
|
||||
aPart1 = Prs3d_DatumParts_XAxis;
|
||||
aPart2 = Prs3d_DatumParts_ZAxis;
|
||||
aPart1 = Prs3d_DP_XAxis;
|
||||
aPart2 = Prs3d_DP_ZAxis;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
@@ -922,7 +910,7 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
||||
aPrims->AddVertex(anAxisPoints.Find(aPart2));
|
||||
|
||||
aPrims->AddVertex(theOrigin);
|
||||
myPrimitives[aPart] = aPrims;
|
||||
myPrimitives.Bind(aPart, aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,5 +927,6 @@ void AIS_Trihedron::DumpJson (Standard_OStream& theOStream, Standard_Integer the
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSize)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextColor)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowColor)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTrihDispMode)
|
||||
}
|
||||
|
@@ -60,12 +60,12 @@ public:
|
||||
//! Initializes a trihedron entity.
|
||||
Standard_EXPORT AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent);
|
||||
|
||||
//! Returns datum display mode.
|
||||
Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; }
|
||||
|
||||
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
|
||||
void SetDatumDisplayMode (Prs3d_DatumMode theMode) { myTrihDispMode = theMode; }
|
||||
|
||||
//! Returns datum display mode.
|
||||
Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; }
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
|
||||
|
||||
@@ -76,10 +76,8 @@ public:
|
||||
//! than the default size of 100 mm. along each axis.
|
||||
Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
|
||||
|
||||
//! Returns the size of trihedron object; 100.0 by DEFAULT.
|
||||
Standard_EXPORT Standard_Real Size() const;
|
||||
|
||||
//! Sets the size of trihedron object.
|
||||
//! Sets the size aValue for the trihedron object.
|
||||
//! The default value is 100 mm.
|
||||
Standard_EXPORT void SetSize (const Standard_Real theValue);
|
||||
|
||||
//! Removes any non-default settings for size of this trihedron object.
|
||||
@@ -87,18 +85,34 @@ public:
|
||||
//! drawer is reproduced, otherwise DatumAspect becomes null.
|
||||
Standard_EXPORT void UnsetSize();
|
||||
|
||||
Standard_EXPORT Standard_Real Size() const;
|
||||
|
||||
//! Returns true if the display mode selected, aMode, is valid for trihedron datums.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE
|
||||
{
|
||||
return theMode == 0;
|
||||
}
|
||||
|
||||
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
||||
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; }
|
||||
|
||||
//! Indicates that the type of Interactive Object is datum.
|
||||
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
|
||||
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own text color
|
||||
Standard_Boolean HasTextColor() const { return myHasOwnTextColor; }
|
||||
|
||||
//! Returns trihedron text color
|
||||
Standard_EXPORT Quantity_Color TextColor() const;
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of label of trihedron axis.
|
||||
Standard_EXPORT void SetTextColor (const Prs3d_DatumParts thePart,
|
||||
const Quantity_Color& theColor);
|
||||
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own arrow color
|
||||
Standard_Boolean HasArrowColor() const { return myHasOwnArrowColor; }
|
||||
@@ -106,20 +120,17 @@ public:
|
||||
//! Returns trihedron arrow color
|
||||
Standard_EXPORT Quantity_Color ArrowColor() const;
|
||||
|
||||
//! Sets color of arrow of trihedron axes.
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of arrow of trihedron axes.
|
||||
Standard_EXPORT void SetArrowColor (const Prs3d_DatumParts thePart,
|
||||
const Quantity_Color& theColor);
|
||||
|
||||
//! Returns color of datum part: origin or some of trihedron axes.
|
||||
Standard_EXPORT Quantity_Color DatumPartColor (Prs3d_DatumParts thePart);
|
||||
//! Removes the settings for color.
|
||||
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
//! Sets color of datum part: origin or some of trihedron axes.
|
||||
//! If presentation is shading mode, this color is set for both sides of facing model
|
||||
Standard_EXPORT void SetDatumPartColor (const Prs3d_DatumParts thePart,
|
||||
const Quantity_Color& theColor);
|
||||
|
||||
//! Returns color of datum part: origin or some of trihedron axes.
|
||||
Standard_EXPORT Quantity_Color DatumPartColor (Prs3d_DatumParts thePart);
|
||||
|
||||
//! Sets color of origin.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetOriginColor (const Quantity_Color& theColor);
|
||||
@@ -142,46 +153,32 @@ public:
|
||||
//! Sets whether to draw the arrows in visualization
|
||||
Standard_EXPORT void SetDrawArrows (const Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns priority of selection for owner of the given type
|
||||
Standard_Integer SelectionPriority (Prs3d_DatumParts thePart) { return mySelectionPriority[thePart]; }
|
||||
|
||||
//! Sets priority of selection for owner of the given type
|
||||
void SetSelectionPriority (Prs3d_DatumParts thePart,
|
||||
Standard_Integer thePriority)
|
||||
{
|
||||
mySelectionPriority[thePart] = thePriority;
|
||||
mySelectionPriority.Bind (thePart, thePriority);
|
||||
}
|
||||
|
||||
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
const TCollection_ExtendedString& Label (Prs3d_DatumParts thePart) { return myLabels[thePart]; }
|
||||
//! Sets priority of selection for owner of the given type
|
||||
Standard_Integer SelectionPriority (Prs3d_DatumParts thePart)
|
||||
{
|
||||
return mySelectionPriority.Find (thePart);
|
||||
}
|
||||
|
||||
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
void SetLabel (const Prs3d_DatumParts thePart,
|
||||
const TCollection_ExtendedString& theName)
|
||||
const TCollection_ExtendedString& thePriority)
|
||||
{
|
||||
myLabels[thePart] = theName;
|
||||
myLabel.Bind (thePart, thePriority);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the display mode selected, aMode, is valid for trihedron datums.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE
|
||||
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
const TCollection_ExtendedString& Label (Prs3d_DatumParts thePart)
|
||||
{
|
||||
return theMode == 0;
|
||||
return myLabel.Find (thePart);
|
||||
}
|
||||
|
||||
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
||||
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; }
|
||||
|
||||
//! Indicates that the type of Interactive Object is datum.
|
||||
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
|
||||
|
||||
//! Removes the settings for color.
|
||||
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Method which clear all selected owners belonging
|
||||
@@ -226,7 +223,8 @@ protected:
|
||||
Standard_EXPORT void setOwnDatumAspect();
|
||||
|
||||
//! Returns primitives.
|
||||
const Handle(Graphic3d_ArrayOfPrimitives)& arrayOfPrimitives (Prs3d_DatumParts thePart) const { return myPrimitives[thePart]; }
|
||||
Standard_EXPORT Handle(Graphic3d_ArrayOfPrimitives) arrayOfPrimitives(
|
||||
Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Updates graphic groups for the current datum mode
|
||||
//! Parameters of datum position and orientation
|
||||
@@ -238,20 +236,22 @@ protected:
|
||||
const gp_Dir& theZDir);
|
||||
|
||||
protected:
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
Prs3d_DatumMode myTrihDispMode;
|
||||
Standard_Boolean myHasOwnSize;
|
||||
Standard_Boolean myHasOwnTextColor;
|
||||
Standard_Boolean myHasOwnArrowColor;
|
||||
Standard_Boolean myHasOwnDatumAspect;
|
||||
|
||||
TCollection_ExtendedString myLabels[Prs3d_DatumParts_NB];
|
||||
Standard_Integer mySelectionPriority[Prs3d_DatumParts_NB];
|
||||
Prs3d_DatumMode myTrihDispMode;
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
|
||||
Handle(Graphic3d_Group) myPartToGroup[Prs3d_DatumParts_NB];
|
||||
NCollection_DataMap<Prs3d_DatumParts, Standard_Integer> mySelectionPriority;
|
||||
NCollection_DataMap<Prs3d_DatumParts, TCollection_ExtendedString> myLabel;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
||||
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
||||
Handle(Graphic3d_AspectLine3d) myHiddenLineAspect;
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) myPrimitives[Prs3d_DatumParts_NB];
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
|
||||
|
@@ -2149,6 +2149,13 @@ 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())
|
||||
|
@@ -177,9 +177,9 @@ AIS_ViewCube::AIS_ViewCube()
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Left, "LEFT");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Right, "RIGHT");
|
||||
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_XAxis, "X");
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_YAxis, "Y");
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_ZAxis, "Z");
|
||||
myAxesLabels.Bind (Prs3d_DP_XAxis, "X");
|
||||
myAxesLabels.Bind (Prs3d_DP_YAxis, "Y");
|
||||
myAxesLabels.Bind (Prs3d_DP_ZAxis, "Z");
|
||||
|
||||
// define default size
|
||||
SetSize (70.0);
|
||||
@@ -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_NameOfMaterial_UserDefined);
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
|
||||
aMat.SetColor (Quantity_NOC_WHITE);
|
||||
aMat.SetAmbientColor (Quantity_NOC_GRAY60);
|
||||
|
||||
@@ -580,7 +580,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
{
|
||||
const Standard_Real anAxisSize = mySize + 2.0 * myBoxFacetExtension + myAxesPadding;
|
||||
const Handle(Prs3d_DatumAspect)& aDatumAspect = myDrawer->DatumAspect();
|
||||
for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter)
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
|
||||
if (!aDatumAspect->DrawDatumPart (aPart))
|
||||
@@ -591,9 +591,9 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
gp_Ax1 anAx1;
|
||||
switch (aPart)
|
||||
{
|
||||
case Prs3d_DatumParts_XAxis: anAx1 = gp_Ax1 (aLocation, gp::DX()); break;
|
||||
case Prs3d_DatumParts_YAxis: anAx1 = gp_Ax1 (aLocation, gp::DY()); break;
|
||||
case Prs3d_DatumParts_ZAxis: anAx1 = gp_Ax1 (aLocation, gp::DZ()); break;
|
||||
case Prs3d_DP_XAxis: anAx1 = gp_Ax1 (aLocation, gp::DX()); break;
|
||||
case Prs3d_DP_YAxis: anAx1 = gp_Ax1 (aLocation, gp::DY()); break;
|
||||
case Prs3d_DP_ZAxis: anAx1 = gp_Ax1 (aLocation, gp::DZ()); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
gp_Pnt aTextOrigin = anAx1.Location().Translated (gp_Vec (anAx1.Direction().X() * (anAxisSize + anArrowLength),
|
||||
anAx1.Direction().Y() * (anAxisSize + anArrowLength),
|
||||
anAx1.Direction().Z() * (anAxisSize + anArrowLength)));
|
||||
Prs3d_Text::Draw (anAxisLabelGroup, aDatumAspect->TextAspect (aPart), TCollection_ExtendedString (anAxisLabel), aTextOrigin);
|
||||
Prs3d_Text::Draw (anAxisLabelGroup, aDatumAspect->TextAspect(), TCollection_ExtendedString (anAxisLabel), aTextOrigin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -402,9 +402,9 @@ public: //! @name Style management API
|
||||
const TCollection_AsciiString& theY,
|
||||
const TCollection_AsciiString& theZ)
|
||||
{
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_XAxis, theX);
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_YAxis, theY);
|
||||
myAxesLabels.Bind (Prs3d_DatumParts_ZAxis, theZ);
|
||||
myAxesLabels.Bind (Prs3d_DP_XAxis, theX);
|
||||
myAxesLabels.Bind (Prs3d_DP_YAxis, theY);
|
||||
myAxesLabels.Bind (Prs3d_DP_ZAxis, theZ);
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
//! Sets the material for the interactive object.
|
||||
virtual void UnsetMaterial() Standard_OVERRIDE
|
||||
{
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_UserDefined);
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_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_NameOfMaterial_DEFAULT);
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_DEFAULT);
|
||||
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
|
||||
if (!theTexture.IsNull())
|
||||
{
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -76,7 +76,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
|
@@ -100,7 +100,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -80,7 +80,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class Standard_ConstructionError;
|
||||
|
||||
//! Used to find the points U(t) = U0 or V(t) = V0 in
|
||||
//! order to determine the Cn discontinuities of an
|
||||
//! Adpator_CurveOnSurface relatively to the
|
||||
//! Adpator_CurveOnSurface relativly to the
|
||||
//! discontinuities of the surface. Used to
|
||||
//! find the roots of the functions
|
||||
class Adaptor3d_InterFunc : public math_FunctionWithDerivative
|
||||
|
@@ -102,7 +102,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -146,7 +146,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real CritError (const Standard_Integer Dimension, const Standard_Integer Index) const;
|
||||
|
||||
//! Prints on the stream 'o' information on the current state
|
||||
//! Prints on the stream o informations on the current state
|
||||
//! of the object.
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
|
||||
|
@@ -2705,7 +2705,7 @@ int AdvApp2Var_MathBase::mmcvctx_(integer *ndimen,
|
||||
/* it is preferable to call a routine based on */
|
||||
/* Lagrange or Hermite interpolation depending on the case. */
|
||||
/* (for a high degree the matrix of the system can be badly */
|
||||
/* conditioned). */
|
||||
/* conditionned). */
|
||||
/* This routine returns a curve defined in (-1,1). */
|
||||
/* In general case, it is necessary to use MCVCTG. */
|
||||
/* > */
|
||||
|
@@ -1483,7 +1483,7 @@ int mamdlng_(char *,//cmdlng,
|
||||
|
||||
/* FUNCTION : */
|
||||
/* ---------- */
|
||||
/* CONTAINS INFORMATION ABOUT THE COMPOSITION OF */
|
||||
/* CONTAINS INFORMATIONS ABOUT THE COMPOSITION OF */
|
||||
/* THE EXECUTABLE AND ITS ENVIRONMENT : */
|
||||
/* - LANGUAGES */
|
||||
/* - PRESENT APPLICATIONS */
|
||||
@@ -1700,15 +1700,15 @@ int maoverf_(integer *nbentr,
|
||||
/* NLONGR*8 specific COMMON not by a routine as */
|
||||
/* the initialisation is done by DATA. */
|
||||
|
||||
/* * If NBENTR<NLONGR, a part of the buffer is transferred*/
|
||||
/* * If NBENTR<NLONGR, a part of the buffer is transfered*/
|
||||
/* DTABLE in DTABLE. */
|
||||
/* __________ */
|
||||
/* ! amorce ! * Otherwise, the entire buffer is transferred in DTABLE. */
|
||||
/* ! amorce ! * Otherwise, the entire buffer is transfered in DTABLE. */
|
||||
/* !__________! This initiates it. Then a loop is execute, which at each
|
||||
*/
|
||||
/* ! temps 1 ! iteration transfers the part of the already initialized table */
|
||||
/* !__________! in the one that was not yet initialized. */
|
||||
/* ! ! The size of the zone transferred by each call to MCRFILL
|
||||
/* ! ! The size of the zone transfered by each call to MCRFILL
|
||||
*/
|
||||
/* ! temps 2 ! is NLONGR*2**(numero_de_l'iteration). When
|
||||
*/
|
||||
|
@@ -118,7 +118,7 @@ public:
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC);
|
||||
|
||||
//! Sets periodic flag.
|
||||
//! If thePeriodic = Standard_True, algorithm tries to build periodic
|
||||
//! If thePeriodic = Standard_True, algorith tries to build periodic
|
||||
//! multicurve using corresponding C1 boundary condition for first and last multipoints.
|
||||
//! Multiline must be closed.
|
||||
Standard_EXPORT void SetPeriodic(const Standard_Boolean thePeriodic);
|
||||
|
@@ -1327,7 +1327,7 @@ void AppDef_Variational::TheMotor(
|
||||
|
||||
while(ToOptim) {
|
||||
Iter++;
|
||||
// (2.1) Save current results
|
||||
// (2.1) Save curent results
|
||||
VOCRI[0] = VALCRI[0];
|
||||
VOCRI[1] = VALCRI[1];
|
||||
VOCRI[2] = VALCRI[2];
|
||||
|
@@ -34,13 +34,13 @@ public:
|
||||
|
||||
|
||||
//! Approximation of a curve with respect of the
|
||||
//! required tolerance Tol3D.
|
||||
//! requiered tolerance Tol3D.
|
||||
Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_HCurve)& Curve, const Standard_Real Tol3d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const;
|
||||
|
||||
//! returns Standard_True if the approximation has
|
||||
//! been done within required tolerance
|
||||
//! been done within requiered tolerance
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! returns Standard_True if the approximation did come out
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real MaxError2dU() const;
|
||||
|
||||
//! returns the maximum errors relatively to the U component or the V component of the
|
||||
//! returns the maximum errors relativly to the U component or the V component of the
|
||||
//! 2d Curve
|
||||
Standard_EXPORT Standard_Real MaxError2dV() const;
|
||||
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
@@ -82,12 +82,12 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real GetLength() const;
|
||||
|
||||
//! returns original parameter corresponding S. if
|
||||
//! returns original parameter correponding S. if
|
||||
//! Case == 1 computation is performed on myC2D1 and mySurf1,
|
||||
//! otherwise it is done on myC2D2 and mySurf2.
|
||||
Standard_EXPORT Standard_Real GetUParameter (Adaptor3d_Curve& C, const Standard_Real S, const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
//! returns original parameter corresponding S.
|
||||
//! returns original parameter correponding S.
|
||||
Standard_EXPORT Standard_Real GetSParameter (const Standard_Real U) const;
|
||||
|
||||
//! if myCase != 1
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
|
||||
Standard_EXPORT void Init (Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si, Handle(TColStd_HArray1OfReal)& Ui) const;
|
||||
|
||||
//! returns curvilinear parameter corresponding U.
|
||||
//! returns curvilinear parameter correponding U.
|
||||
Standard_EXPORT Standard_Real GetSParameter (Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Length) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCurOnSur (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result, const Standard_Integer NumberOfCurve) const;
|
||||
|
@@ -76,11 +76,11 @@ public:
|
||||
//! tolerance given by the resolution on support surfaces,
|
||||
//! but if this tolerance is too large Tol2d is used.
|
||||
//! TolAngular : Tolerance (in radian) to control the angle
|
||||
//! between tangents on the section law and
|
||||
//! tangent of iso-v on approximated surface
|
||||
//! beetween tangents on the section law and
|
||||
//! tangent of iso-v on approximed surface
|
||||
//! Continuity : The continuity in v waiting on the surface
|
||||
//! Degmax : The maximum degree in v required on the surface
|
||||
//! Segmax : The maximum number of span in v required on
|
||||
//! Degmax : The maximum degree in v requiered on the surface
|
||||
//! Segmax : The maximum number of span in v requiered on
|
||||
//! the surface
|
||||
//! Warning : The continuity ci can be obtained only if Ft is Ci
|
||||
Standard_EXPORT void Perform (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const Standard_Real BoundTol, const Standard_Real Tol2d, const Standard_Real TolAngular, const GeomAbs_Shape Continuity = GeomAbs_C0, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 50);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user