mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
44 Commits
CR29523_v7
...
CR29003_3
Author | SHA1 | Date | |
---|---|---|---|
|
728c380e48 | ||
|
57fe037f72 | ||
|
93177d3925 | ||
|
b5d7966899 | ||
|
96a70b3f8f | ||
|
43f72b89dd | ||
|
e2b4dea253 | ||
|
b1c235dfce | ||
|
08b183fe0b | ||
|
7fbc3bc5a4 | ||
|
a8a3b37c0d | ||
|
6fd0eb0c1e | ||
|
b5cce1ab23 | ||
|
746f3d7ab2 | ||
|
ad8b073e19 | ||
|
c7ba457824 | ||
|
a966092904 | ||
|
c8fe0e2db4 | ||
|
e4f0cc46a0 | ||
|
1a6726dabb | ||
|
8c3237d451 | ||
|
048e1b3b03 | ||
|
8444aedb1d | ||
|
cd803dcd59 | ||
|
71c810df61 | ||
|
a4ab454c0f | ||
|
28c08a7d40 | ||
|
4621622641 | ||
|
bfd69b5f7b | ||
|
ca685e63ef | ||
|
d68b195fb6 | ||
|
a2560cc90c | ||
|
1136702b93 | ||
|
be7fc29e2a | ||
|
780ee4e25c | ||
|
8e0a2b19ab | ||
|
3ed88facdb | ||
|
3ba79772a0 | ||
|
fe21f79693 | ||
|
bcb8fa43ea | ||
|
4eb6e8f464 | ||
|
e3368235ea | ||
|
4514dc74e4 | ||
|
30017a480e |
@@ -68,6 +68,7 @@ FILE_TO_LIST ("adm/RESOURCES" RESOURCES)
|
||||
foreach (CurrentResource ${RESOURCES})
|
||||
get_filename_component (CurrentResource_FileName "${CurrentResource}" NAME)
|
||||
if ("${CurrentResource_FileName}" STREQUAL TObj.msg OR
|
||||
"${CurrentResource_FileName}" STREQUAL BOPAlgo.msg OR
|
||||
"${CurrentResource_FileName}" STREQUAL Units.dat OR
|
||||
"${CurrentResource}" STREQUAL XSMessage OR
|
||||
"${CurrentResource}" STREQUAL SHMessage OR
|
||||
|
@@ -655,6 +655,8 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s
|
||||
|
||||
# Generates Doxygen configuration file for Overview documentation
|
||||
proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMode ""} {DocFilesList {}} {ModulesList {}} verboseMode searchMode hhcPath mathjaxLocation graphvizPath productsPath} {
|
||||
global module_dependency
|
||||
|
||||
set inputDir [OCCDoc_GetDoxDir [OCCDoc_GetProdRootDir]]
|
||||
|
||||
set TEMPLATES_DIR [OCCDoc_GetDoxDir]/resources
|
||||
@@ -725,6 +727,16 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
|
||||
set name OCCT
|
||||
}
|
||||
|
||||
OCCDoc_LoadData "${productsPath}"
|
||||
|
||||
# Add all dependencies of modules to the graph
|
||||
set additional_modules {}
|
||||
foreach module $modules {
|
||||
set additional_modules [list {*}$additional_modules {*}$module_dependency($module)]
|
||||
}
|
||||
set modules [list {*}$modules {*}$additional_modules]
|
||||
set modules [lsort -unique $modules]
|
||||
|
||||
# Get list of header files in the specified modules
|
||||
set filelist {}
|
||||
foreach module $modules {
|
||||
|
@@ -82,6 +82,8 @@ set "VisualStudioExpressName=VCExpress"
|
||||
|
||||
if not "%DevEnvDir%" == "" (
|
||||
rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
|
||||
) else if /I "%VCFMT%" == "vc9" (
|
||||
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
|
||||
) else if /I "%VCFMT%" == "vc10" (
|
||||
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
|
||||
) else if /I "%VCFMT%" == "vc11" (
|
||||
@@ -101,12 +103,22 @@ if not "%DevEnvDir%" == "" (
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
echo Error: wrong VS identifier
|
||||
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
|
||||
echo one of:
|
||||
echo vc9 = VS 2008 ^(SP1^)
|
||||
echo vc10 = VS 2010 ^(SP3^)
|
||||
echo vc11 = VS 2012 ^(SP3^)
|
||||
echo vc12 = VS 2013 ^(SP3^)
|
||||
echo vc14 = VS 2015
|
||||
echo vc141 = VS 2017
|
||||
exit /B
|
||||
)
|
||||
|
||||
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
|
||||
if /I "%VCFMT%" == "vc10" (
|
||||
if /I "%VCFMT%" == "vc9" (
|
||||
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
set "VCPlatformToolSet=v90"
|
||||
) else if /I "%VCFMT%" == "vc10" (
|
||||
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
set "VCPlatformToolSet=v100"
|
||||
) else if /I "%VCFMT%" == "vc11" (
|
||||
@@ -126,9 +138,8 @@ if /I "%VCFMT%" == "vc10" (
|
||||
) else if /I "%VCFMT%" == "gcc" (
|
||||
rem MinGW
|
||||
) else (
|
||||
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
|
||||
echo one of: vc10 ^(VS 2010 SP3^), vc11 ^(VS 2012 SP3^), vc12 ^(VS 2013^) or vc14 ^(VS 2015^)
|
||||
exit
|
||||
echo Error: wrong VS identifier
|
||||
exit /B
|
||||
)
|
||||
|
||||
set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
|
||||
|
@@ -52,6 +52,8 @@ set "VisualStudioExpressName=VCExpress"
|
||||
|
||||
if not "%DevEnvDir%" == "" (
|
||||
rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
|
||||
) else if /I "%VCFMT%" == "vc9" (
|
||||
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
|
||||
) else if /I "%VCFMT%" == "vc10" (
|
||||
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
|
||||
) else if /I "%VCFMT%" == "vc11" (
|
||||
@@ -76,7 +78,10 @@ if not "%DevEnvDir%" == "" (
|
||||
)
|
||||
|
||||
rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
|
||||
if /I "%VCFMT%" == "vc10" (
|
||||
if /I "%VCFMT%" == "vc9" (
|
||||
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
set "VCPlatformToolSet=v90"
|
||||
) else if /I "%VCFMT%" == "vc10" (
|
||||
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
set "VCPlatformToolSet=v100"
|
||||
) else if /I "%VCFMT%" == "vc11" (
|
||||
|
@@ -24,6 +24,7 @@
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
@@ -120,7 +121,7 @@
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
ManagedExtensions="0"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
@@ -218,6 +219,7 @@
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
@@ -311,7 +313,7 @@
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
ManagedExtensions="0"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
2562
data/occ/hammer.brep
2562
data/occ/hammer.brep
File diff suppressed because one or more lines are too long
@@ -192,7 +192,11 @@ Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional
|
||||
* If the test case reports error due to an existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as a known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
|
||||
* To check expected output which should be obtained as the test result, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
|
||||
* If the test case produces error messages (contained in parse.rules), which are expected in that test and should not be considered as its failure (e.g. test for *checkshape* command), add REQUIRED statement for each error to mark it as required output.
|
||||
4. If the test uses data file(s) that are not yet present in the test database, it is possible to put them to (sub)directory pointed out by *CSF_TestDataPath* variable for running test. The files should be attached to the Mantis issue corresponding to the tested modification.
|
||||
4. To check whether the data files needed for the test are already present in the database, use DRAW command *testfile* (see below).
|
||||
If the data file is already present, use it for new test instead of adding a duplicate.
|
||||
If the data file(s) are not yet present in the test database, put them to some folder and add it to the environment variable *CSF_TestDataPath* to be found by the test system.
|
||||
Information on where the data files can be accessed by OCC team for putting to official database should be provided in comment to Mantis issue, clearly indicating how names of the files used by the test script match the actual names of the files.
|
||||
The simplest way is to attach the data files to the Mantis issue, with the same names as used by the test script.
|
||||
5. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate it to the Git branch created for the issue.
|
||||
|
||||
Example:
|
||||
@@ -218,6 +222,33 @@ fixshape result a 0.01 0.01
|
||||
checkshape result
|
||||
~~~~~
|
||||
|
||||
DRAW command testfile should be used to check the data files being used by the test for possible duplication of content or names.
|
||||
The command accepts list of paths to files being checked as single argument, and will give conclusion on each of the files, for instance:
|
||||
|
||||
~~~~~
|
||||
Draw[1]> testfile [glob /my/data/path/bug12345*]
|
||||
Collecting info on test data files repository...
|
||||
Checking new file(s)...
|
||||
|
||||
* /my/data/path/bug12345.brep: duplicate
|
||||
already present under name bug28773_1.brep
|
||||
--> //server/occt_tests_data/public/brep/bug28773_1.brep
|
||||
|
||||
* /my/data/path/cadso.brep: new file
|
||||
Warning: DOS encoding detected, consider converting to
|
||||
UNIX unless DOS line ends are needed for the test
|
||||
Warning: shape contains triangulation (946 triangles),
|
||||
consider removing them unless they are needed for the test!
|
||||
BREP size=201 KiB, nbfaces=33, nbedges=94 -> private
|
||||
|
||||
* /my/data/path/case_8_wire3.brep: already present
|
||||
--> //server/occt_tests_data/public/brep/case_8_wire3.brep
|
||||
|
||||
* /my/data/path/case_8_wire4.brep: error
|
||||
name is already used by existing file
|
||||
--> //server/occt_tests_data/public/brep/case_8_wire4.brep
|
||||
~~~~~
|
||||
|
||||
@section testmanual_2 Organization of Test Scripts
|
||||
|
||||
@subsection testmanual_2_1 General Layout
|
||||
|
@@ -28,13 +28,22 @@ https://www.opencascade.com
|
||||
License
|
||||
--------
|
||||
|
||||
Open CASCADE Technology is free software; you can redistribute it and / or
|
||||
modify it under the terms of the
|
||||
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1",
|
||||
with additional @ref occt_lgpl_exception "exception".
|
||||
Open CASCADE Technology is free software; you can redistribute it and / or modify it under the terms of the
|
||||
@ref license_lgpl_21 "GNU Lesser General Public License (LGPL) version 2.1", with additional @ref occt_lgpl_exception "exception".
|
||||
|
||||
Alternatively, Open CASCADE Technology may be used under the terms of Open
|
||||
CASCADE commercial license or contractual agreement.
|
||||
Note that LGPL imposes some obligations on the application linked with Open CASCADE Technology.
|
||||
If you wish to use OCCT in a proprietary application, please, pay special attention to address the requirements of LGPL section 6.
|
||||
At minimum the following should be considered:
|
||||
1. Add the notice visible to the users of your application clearly stating that Open CASCADE Technology is used in this application, and that they have rights in this regard according to LGPL.
|
||||
Such notice can be added in About dialog box (this is mandatory if this box contains copyright statements) or a similar place and/or in the documentation.
|
||||
The text of LGPL license should be accessible to the user.
|
||||
2. Make the copy of OCCT sources used by the application available to its users, and if necessary provide instructions on how to build it in a way compatible with the application.
|
||||
3. Ensure that the user actually can exercise the right to run your application with a modified version of OCCT.
|
||||
If the application is distributed in a form that does not allow the user to modify OCCT part (e.g. the application is linked to OCCT statically or is distributed via AppStore on iOS, GooglePlay on Android, Windows Store, etc.),
|
||||
the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT.
|
||||
|
||||
If you want to use Open CASCADE Technology without being bound by LGPL requirements,
|
||||
please <a href="https://www.opencascade.com/contact">contact Open CASCADE company</a> for a commercial license.
|
||||
|
||||
Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT
|
||||
WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and
|
||||
@@ -196,9 +205,9 @@ for which OCCT is certified to work.
|
||||
|
||||
| OS | Compiler |
|
||||
| --------- | ----------- |
|
||||
| Windows | Microsoft Visual Studio: 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> Intel C++ Composer XE 2013 SP1 <br> GCC 4.3+ (Mingw-w64)|
|
||||
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1<sup>1</sup>, 2012 Update 4, 2013 Update 5, 2015, 2017 <br> GCC 4.3+ (Mingw-w64)|
|
||||
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
|
||||
| OS X | XCode 6 or newer |
|
||||
| OS X / macOS | XCode 6 or newer |
|
||||
| Android | NDK r10, GNU gcc 4.8 or newer |
|
||||
|
||||
1) VC++ 10 64-bit is used for regular testing and for building
|
||||
|
@@ -1481,7 +1481,7 @@ General types of STEP entities imported by OCCT are listed in the table below:
|
||||
|Datum_Feature|XCAFDoc_Datum|
|
||||
|Datum_Target|XCAFDoc_Datum|
|
||||
|
||||
Processing of GD&T is realized in accordance with <a href="http://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
|
||||
Processing of GD&T is realized in accordance with <a href="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
|
||||
The general restriction is that OCCT STEP Reader imports GD&T assigned only to shapes (faces, edges, vertices, etc) or to shape groups from general shape model i.e. any constructive geometries are not translated as referenced shapes.
|
||||
|
||||
#### Dimensions
|
||||
|
@@ -91,26 +91,59 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
|
||||
|
||||
@figure{/user_guides/xde/images/xde_image006.png,"Colors and Layers",240}
|
||||
|
||||
@subsection occt_xde_1_7 Custom notes
|
||||
@subsection occt_xde_1_7 Geometric Dimensions & Tolerances (GD&T)
|
||||
|
||||
GD&T are a type of Product and Manufacturing Information (PMI) that can be either computed automatically by a CAD system,
|
||||
or entered manually by the user. For detailed information use <a href="https://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">CAx-IF Recommended Practices
|
||||
for the Representation and Presentation of Product Manufacturing Information (PMI) (AP242)</a>
|
||||
|
||||
XDE can read and write GD&T data of the following types:
|
||||
* dimensions, such as distance, length, radius and so on;
|
||||
* geometric tolerances;
|
||||
* datums, i.e a theoretically exact geometric references, such as point, line or plane, to which toleranced features are related.
|
||||
|
||||
XDE supports two presentations of GD&T data:
|
||||
* semantic presentation, i.e. data is stored in a machine-consumable way and includes all information required to understand the
|
||||
specification without the aid of any presentation elements;
|
||||
* tessellated presentation, i.e. data is displayed in a human-readable way.
|
||||
|
||||
@subsection occt_xde_1_8 Clipping planes
|
||||
|
||||
XDE supports reading from STEP and storing named planes used for clipping.
|
||||
Currently, XDE supports saving of clipping planes in XBF format only.
|
||||
|
||||
XDE provides capabilities for adding, editing and removing clipping planes.
|
||||
|
||||
@subsection occt_xde_1_9 Saved views
|
||||
|
||||
XDE supports reading from STEP views. Views allow to save information about camera parameters (position, direction, zoom factor, etc.)
|
||||
and visible shapes, PMIs, used clipping planes and notes. Currently, XDE supports saving of clipping planes in XBF format only.
|
||||
|
||||
XDE provides the following view management capabilities:
|
||||
* add/remove views;
|
||||
* set view camera parameters;
|
||||
* set visible shapes, PMIs, used clipping planes and notes.
|
||||
|
||||
@subsection occt_xde_1_10 Custom notes
|
||||
|
||||
Custom notes is a kind of application specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application specific data. Each note is provided with a timestamp and the user created it.
|
||||
Custom notes is a kind of application-specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application-specific data. Each note is provided with a timestamp and the user who created it.
|
||||
|
||||
Notes API provides the following functionality:
|
||||
* Returns total number of notes and annotated items
|
||||
* Returns labels for all notes and annotated items
|
||||
* Returns the total number of notes and annotated items;
|
||||
* Returns labels for all notes and annotated items;
|
||||
* Creates notes:
|
||||
- Comment note from a text string
|
||||
- Binary data note from a file or byte array
|
||||
* Checks if an assembly item is annotated
|
||||
* Finds a label for the annotated item
|
||||
* Returns all note labels for the annotated item
|
||||
* Add a note to item(s):
|
||||
- Assembly item
|
||||
- Assembly item attribute
|
||||
- Assembly item subshape index
|
||||
* Remove note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically)
|
||||
* Delete note(s) and removes them from annotated items
|
||||
* Get / delete orphan notes
|
||||
- Comment note from a text string;
|
||||
- Binary data note from a file or byte array;
|
||||
* Checks if an assembly item is annotated;
|
||||
* Finds a label for the annotated item;
|
||||
* Returns all note labels for the annotated item;
|
||||
* Adds a note to item(s):
|
||||
- Assembly item;
|
||||
- Assembly item attribute;
|
||||
- Assembly item subshape index;
|
||||
* Removes note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically);
|
||||
* Deletes note(s) and removes them from annotated items;
|
||||
* Gets / deletes orphan notes.
|
||||
|
||||
@section occt_xde_2 Working with XDE
|
||||
|
||||
@@ -504,7 +537,7 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
|
||||
|
||||
@figure{/user_guides/xde/images/239_xde_12_400.png,"Motor Head",240}
|
||||
|
||||
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
|
||||
In an XDE document, colors are managed by the class *XCAFDoc_ColorTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The Property itself is defined as an *XCAFDoc_Color*, sub-class of *TDF_Attribute*.
|
||||
|
||||
Colors are stored in a child of the starting document label: it is the second level (0.1.2), while Shapes are at the first level. Each color then corresponds to a dedicated label, the property itself is a Quantity_Color, which has a name and value for Red, Green, Blue. A Color may be attached to Surfaces (flat colors) or to Curves (wireframe colors), or to both. A Color may be attached to a sub-shape. In such a case, the sub-shape (and its own sub-shapes) takes its own Color as a priority.
|
||||
|
||||
@@ -627,29 +660,274 @@ To remove a Color and all the references to it (so that the related shapes will
|
||||
myColors->RemoveColor(ColLabel);
|
||||
~~~~~
|
||||
|
||||
@subsection occt_xde_2_7 Custom notes
|
||||
@subsection occt_xde_2_7 Geometric Dimensions & Tolerances (GD&T)
|
||||
|
||||
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as sub-classes of an *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
|
||||
XDE can read and write GD&T assigned to shapes or their subparts (down to the level of faces and edges) to and from STEP formats.
|
||||
|
||||
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.2.
|
||||
In an XDE document, GD&T are managed by the class *XCAFDoc_DimTolTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The GD&T entities themselves are defined as the following sub-classes of *TDF_Attribute*:
|
||||
* *XCAFDoc_Dimension* - for dimensions;
|
||||
* *XCAFDoc_GeomTolerance* - for geometric tolerances;
|
||||
* *XCAFDoc_Datum* - for geometric tolerance Datums.
|
||||
A GD&T type is identified by the attributes listed above, i.e. *XCAFDoc_DimTolTool* methods working with particular entity types check
|
||||
for presence of the corresponding attributes in passed labels. One can use methods of *XCAFDoc_DimTolTool* beginning with 'Is' for this purpose.
|
||||
|
||||
GD&T entities are stored in a child of the starting document label 0.1.4.
|
||||
Each GD&T entity then corresponds to the dedicated label, the property itself is one of access classes:
|
||||
* *XCAFDimTolObject_DimensionObject* - for dimensions;
|
||||
* *XCAFDimTolObject_GeomToleranceObject* - for geometric tolerances;
|
||||
* *XCAFDimTolObject_DatumObject* - for geometric tolerance Datums.
|
||||
|
||||
GD&Ts and Shapes are related to by Graph Nodes.
|
||||
|
||||
These definitions are common to various exchange formats, at least for STEP.
|
||||
|
||||
@subsubsection occt_xde_2_7_1 Initialization
|
||||
To query, edit, or initialize a Document to handle GD&Ts of XCAF, use:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_DimTolTool) myDimTolTool =
|
||||
XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
|
||||
~~~~~
|
||||
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document. This definition is used for all later GD&T calls and is not repeated for them.
|
||||
|
||||
@subsubsection occt_xde_2_7_2 Adding a GD&T
|
||||
*XCAFDoc_DimTolTool* provides methods to create GD&T 'empty' entities:
|
||||
* *AddDimension* - for a new dimension;
|
||||
* *AddGeomTolerance* - for a new geometric tolerance;
|
||||
* *AddDatum* - for a new geometric tolerance datum.
|
||||
|
||||
All methods create a sub-label for the corresponding GD&T entity of the tool master label and attach an attribute specific for the
|
||||
created entity.
|
||||
|
||||
Here is an example of adding a new dimension:
|
||||
~~~~~
|
||||
TDF_Label aDimLabel = myDimTolTool->AddDimension();
|
||||
if (!aDimLabel.IsNull())
|
||||
{
|
||||
// error processing
|
||||
}
|
||||
~~~~~
|
||||
A similar approach can be used for other GD&T types.
|
||||
|
||||
@subsubsection occt_xde_2_7_3 Editing a GD&T
|
||||
A newly added GD&T entity is empty. To set its data a corresponding access object should be used as it is demonstrated
|
||||
below, where the dimension becomes the linear distance between two points.
|
||||
~~~~~
|
||||
Handle(XCAFDoc_Dimension) aDimAttr;
|
||||
aDimLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimAttr);
|
||||
if (!aDimAttr.IsNull())
|
||||
{
|
||||
Handle(XCAFDimTolObjects_DimensionObject) aDimObject = aDimAttr->GetObject();
|
||||
// set dimension data
|
||||
aDimObject->SetType(XCAFDimTolObjects_DimensionType_Location_LinearDistance);
|
||||
aDimObject->SetPoint(thePnt1); // the first reference point
|
||||
aDimObject->SetPoint2(thePnt2); // the second reference point
|
||||
aDimObject->SetValue(theValue); // the distance value
|
||||
//...
|
||||
aDimAttr->SetObject(aDimObject);
|
||||
}
|
||||
~~~~~
|
||||
A similar approach can be used for other GD&T types.
|
||||
|
||||
@subsubsection occt_xde_2_7_4 Linking GD&Ts
|
||||
To link a GD&T entity with other OCAF labels (e.g. representing shapes) one should use the following methods:
|
||||
* *SetDimension* - for dimensions;
|
||||
* *SetGeomTolerance* - for geometric tolerances;
|
||||
* SetDatum - for geometric tolerance datums.
|
||||
|
||||
These methods can take a single label or a sequence of labels. All previous links will be removed.
|
||||
|
||||
The example below demonstrates linking of a dimension to sequences of shape labels:
|
||||
~~~~~
|
||||
TDF_LabelSequence aShapes1, aShapes2;
|
||||
aShapes1.Append(aShape11);
|
||||
//...
|
||||
aShapes2.Append(aShape21);
|
||||
//...
|
||||
aDGTTool->SetDimension(aShapes1, aShapes2, aDimLabel);
|
||||
~~~~~
|
||||
|
||||
In addition, a special method *SetDatumToGeomTol* should be used to link a datum with a geometric tolerance.
|
||||
|
||||
@subsubsection occt_xde_2_7_5 Finding GD&Ts and reference shapes
|
||||
|
||||
*XCAFDimTolObjects_Tool* class provides basic capabilities for searching GD&Ts linked to shapes.
|
||||
Using the tool one can get sequences of dimensions, geometric tolerances and datums linked with a shape. A series of related datums is also returned for geometric tolerances.
|
||||
|
||||
To get reference shapes for a GD&T entity one can use *GetRefShapeLabel* from *XCAFDoc_DimTolTool*.
|
||||
|
||||
*XCAFDoc_DimTolTool* provides methods to get lists of all dimensions, geometric tolerances and datums.
|
||||
|
||||
@subsubsection occt_xde_2_7_6 Storing custom data
|
||||
Every GD&T entity in XDE is represented as a label with attached attribute identifying entity type. All specific data is
|
||||
stored in sub-labels in standard OCAF attributes, such as *TDataStd_Integer*, *TDataStd_IntegerArray*, *TDataStd_RealArray* and so on.
|
||||
Sub-label tags are reserved for internal use and cannot be used for storing custom data. The following tag ranges are reserved for
|
||||
GD&T entities:
|
||||
* 1 - 17 - for dimensions;
|
||||
* 1 - 17 - for geometric tolerances;
|
||||
* 1 - 19 - for datums.
|
||||
Custom data can be stored in labels with tags beyond the ranges listed above.
|
||||
|
||||
@subsection occt_xde_2_8 Clipping planes
|
||||
|
||||
In an XDE document, Clipping planes are managed by the class *XCAFDoc_ClippingPlaneTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Clipping planes are stored in a child of the starting document label 0.1.8, where planes themselves are defined as *TDataXtd_Plane* attribute. *TDataStd_Name* attribute is used for naming.
|
||||
|
||||
To query, edit, or initialize a Document to handle clipping planes of XCAF, use:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_ClippingPlaneTool) myClipPlaneTool =
|
||||
XCAFDoc_DocumentTool::ClippingPlaneTool(Doc->Main());
|
||||
~~~~~
|
||||
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document.
|
||||
|
||||
To add a clipping plane use one of overloaded methods *AddClippingPlane*, e.g.:
|
||||
~~~~~
|
||||
gp_Pln aPln = ...
|
||||
Standard_Boolean aCapping = ...
|
||||
TDF_Label aClipPlnLbl = myClipPlaneTool->AddClippingPlane(aPln, "Name of plane", aCapping);
|
||||
if (aClipPlnLbl.IsNull())
|
||||
{
|
||||
// error processing
|
||||
}
|
||||
~~~~~
|
||||
|
||||
To remove a plane use *RemoveClippingPlane* method, e.g.:
|
||||
~~~~~
|
||||
if (!myClipPlaneTool->RemoveClippingPlane(aClipPlnLbl))
|
||||
{
|
||||
// not removed
|
||||
}
|
||||
~~~~~
|
||||
The plane will not be removed if it is referenced in at least one view.
|
||||
|
||||
To change clipping plane and its name use *UpdateClippingPlane* method, e.g.:
|
||||
~~~~~
|
||||
gp_Pln aPln = ...
|
||||
myClipPlaneTool->UpdateClippingPlane(aClipPlnLbl, aPln, "New name of plane");
|
||||
~~~~~
|
||||
|
||||
Capping property can be changed using *SetCapping* method, e.g.:
|
||||
~~~~~
|
||||
Standard_Boolean aCapping = ...
|
||||
myClipPlaneTool->SetCapping(aClipPlnLbl, aCapping);
|
||||
~~~~~
|
||||
|
||||
*XCAFDoc_ClippingPlaneTool* can be used to get all clipping plane labels and to check if a label belongs to the ClippingPlane table, e.g.:
|
||||
~~~~~
|
||||
TDF_LabelSequence aClipPlaneLbls;
|
||||
myClipPlaneTool->GetClippingPlanes(aClipPlaneLbls);
|
||||
...
|
||||
for (TDF_LabelSequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next())
|
||||
{
|
||||
if (myClipPlaneTool->IsClippingPlane(anIt.Value()))
|
||||
{
|
||||
// the label is a clipping plane
|
||||
gp_Pln aPln;
|
||||
TCollection_ExtendedString aName;
|
||||
Standard_Boolean aCapping;
|
||||
if (!myClipPlaneTool->GetClippingPlane(anIt.Value(), aPln, aName, aCapping))
|
||||
{
|
||||
// error processing
|
||||
}
|
||||
...
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
|
||||
@subsection occt_xde_2_9 Saved views
|
||||
|
||||
In an XDE document, Views are managed by the class *XCAFDoc_ViewTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. Views are stored in a child of the starting document label 0.1.7, where a view itself is defined as *XCAFDoc_View* sub-class of *TDF_Attribute*. Views and selected shapes, clipping planes, GD&Ts and notes are related to by Graph Nodes.
|
||||
|
||||
To query, edit, or initialize a Document to handle views of XCAF, use:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_ViewTool) myViewTool =
|
||||
XCAFDoc_DocumentTool::ViewTool(Doc->Main());
|
||||
~~~~~
|
||||
This call can be used at any time. When it is used for the first time, a relevant structure is added to the document.
|
||||
|
||||
To add a view use *AddView* method and an access *XCAFView_Object* object to set camera parameters, e.g.:
|
||||
~~~~~
|
||||
TDF_Label aViewLbl = myViewTool->AddView();
|
||||
if (aViewLbl.IsNull())
|
||||
{
|
||||
// error processing
|
||||
}
|
||||
Handle(XCAFDoc_View) aViewAttr;
|
||||
aViewLbl.FindAttribute(XCAFDoc_View::GetID(), aViewAttr);
|
||||
if (!aViewAttr.IsNull())
|
||||
{
|
||||
Handle(XCAFView_Object) aViewObject = aViewAttr->GetObject();
|
||||
// set view data
|
||||
aViewObject->SetType(XCAFView_ProjectionType_Parallel);
|
||||
aViewObject->SetViewDirection(theViewDir);
|
||||
aViewObject->SetZoomFactor(2.0);
|
||||
...
|
||||
aViewAttr->SetObject(aViewObject);
|
||||
}
|
||||
~~~~~
|
||||
|
||||
To set shapes, clipping planes, GD&Ts and notes selected for the view use one of overloaded *SetView* methods of *XCAFDoc_ViewTool*.
|
||||
To set only clipping planes one should use *SetClippingPlanes* method.
|
||||
~~~~~
|
||||
TDF_LabelSequence aShapes; ...
|
||||
TDF_LabelSequence aGDTs; ...
|
||||
myViewTool->SetView(aShapes, aGDTs, aViewLbl);
|
||||
TDF_LabelSequence aClippingPlanes; ...
|
||||
myViewTool->SetClippingPlanes(aClippingPlanes, aViewLbl);
|
||||
~~~~~
|
||||
|
||||
To remove a view use *RemoveView* method.
|
||||
|
||||
To get all view labels and check if a label belongs to the View table use:
|
||||
~~~~~
|
||||
TDF_LabelSequence aViewLbls;
|
||||
myViewTool->GetViewLabels(aViewLbls);
|
||||
...
|
||||
for (TDF_LabelSequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next())
|
||||
{
|
||||
if (myViewTool->IsView(anIt.Value()))
|
||||
{
|
||||
// the label is a view
|
||||
...
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
|
||||
To get shapes, clipping planes, GD&Ts or notes associated with a particular view use the following methods:
|
||||
* *GetRefShapeLabel* - returns a sequence of associated shape labels;
|
||||
* *GetRefGDTLabel* - returns a sequence of associated GDT labels;
|
||||
* *GetRefClippingPlaneLabel* - returns a sequence of associated clipping plane labels;
|
||||
* *GetRefNoteLabel* - returns a sequence of associated note labels;
|
||||
* *GetRefAnnotationLabel* - returns a sequence of associated annotated labels.
|
||||
|
||||
And vice versa, to get views that display a particular clipping plane, GD&T or note use the following methods:
|
||||
* *GetViewLabelsForShape* - returns a sequence of associated view labels for a shape;
|
||||
* *GetViewLabelsForGDT* - returns a sequence of associated view labels for a GD&T;
|
||||
* *GetViewLabelsForClippingPlane* - returns a sequence of associated view labels for a clipping plane;
|
||||
* *GetViewLabelsForNote* - returns a sequence of associated view labels for a note;
|
||||
* *GetViewLabelsForAnnotation* - returns a sequence of associated view labels for an annotated label.
|
||||
|
||||
@subsection occt_xde_2_10 Custom notes
|
||||
|
||||
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*. It works basing on the same principles as ShapeTool works with Shapes. This tool can be provided on the Main Label or on any sub-label. The Property itself is defined as sub-class of *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
|
||||
|
||||
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label, at label 0.1.9.2.
|
||||
Notes binding is done through *XCAFDoc_GraphNode* attribute.
|
||||
|
||||
@figure{/user_guides/xde/images/xde_notes001.png,"Structure of notes part of XCAF document",240}
|
||||
|
||||
@subsubsection occt_xde_2_7_1 Initialization
|
||||
@subsubsection occt_xde_2_10_1 Initialization
|
||||
|
||||
To query, edit, or initialize a Document to handle custom notes of XCAF, use:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes =
|
||||
XCAFDoc_DocumentTool::NotesTool(Doc->Main ());
|
||||
~~~~~
|
||||
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following notes calls and will not be repeated for these.
|
||||
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all later notes calls and will not be repeated for them.
|
||||
|
||||
@subsubsection occt_xde_2_7_2 Creating Notes
|
||||
@subsubsection occt_xde_2_10_2 Creating Notes
|
||||
|
||||
Before annotating a Document item a note must be created using one of the following methods of *XCAFDoc_NotesTool* class:
|
||||
- CreateComment : creates a note with a textual comment
|
||||
- CreateBinData : creates a note with arbitrary binary data, e.g. contents of a file
|
||||
- *CreateComment* : creates a note with a textual comment;
|
||||
- *CreateBinData* : creates a note with arbitrary binary data, e.g. contents of a file.
|
||||
|
||||
Both methods return an instance of *XCAFDoc_Note* class.
|
||||
~~~~~
|
||||
@@ -658,13 +936,13 @@ Handle(XCAFDoc_Note) myNote = myNotes->CreateComment("User", "Timestamp", "Hello
|
||||
~~~~~
|
||||
This code adds a child label to label 0.1.9.1 with *XCAFDoc_NoteComment* attribute.
|
||||
|
||||
@subsubsection occt_xde_2_7_3 Editing a Note
|
||||
@subsubsection occt_xde_2_10_3 Editing a Note
|
||||
An instance of *XCAFDoc_Note* class can be used for note editing.
|
||||
One may change common note data.
|
||||
~~~~~
|
||||
myNote->Set("New User", "New Timestamp");
|
||||
~~~~~
|
||||
To change specific data one need to down cast *myNote* handle to the appropriate sub-class:
|
||||
To change specific data one needs to down cast *myNote* handle to the appropriate sub-class:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote);
|
||||
if (!myCommentNote.IsNull()) {
|
||||
@@ -672,12 +950,12 @@ if (!myCommentNote.IsNull()) {
|
||||
}
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_xde_2_7_4 Adding Notes
|
||||
@subsubsection occt_xde_2_10_4 Adding Notes
|
||||
|
||||
Once a note has been created it can be bound to a Document item using the following *XCAFDoc_NotesTool* methods:
|
||||
- AddNote : binds a note to a label
|
||||
- AddNoteToAttr : binds a note to a label's attribute
|
||||
- AddNoteToSubshape : binds a note to a sub-shape
|
||||
- *AddNote* : binds a note to a label;
|
||||
- *AddNoteToAttr* : binds a note to a label's attribute;
|
||||
- *AddNoteToSubshape* : binds a note to a sub-shape.
|
||||
|
||||
All methods return a pointer to *XCAFDoc_AssemblyItemRef* attribute identifying the annotated item.
|
||||
~~~~~
|
||||
@@ -690,14 +968,14 @@ Handle(XCAFDoc_AssemblyItemRef) myRefAttr = myNotes->AddNoteToAttr(myNote->Label
|
||||
Standard_Integer theSubshape = 1;
|
||||
Handle(XCAFDoc_AssemblyItemRef) myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape);
|
||||
~~~~~
|
||||
This code adds three child labels to label 0.1.9.2 with *XCAFDoc_AssemblyItemRef* attribute with *XCAFDoc_GraphNode* attributes added to this and note labels.
|
||||
This code adds three child labels with *XCAFDoc_AssemblyItemRef* attribute to label 0.1.9.2. *XCAFDoc_GraphNode* attributes are added to the child labels and note labels.
|
||||
|
||||
@subsubsection occt_xde_2_7_5 Finding Notes
|
||||
@subsubsection occt_xde_2_10_5 Finding Notes
|
||||
|
||||
To find annotation labels under label 0.1.9.2 use the following *XCAFDoc_NotesTool* methods:
|
||||
- FindAnnotatedItem : returns an annotation label for a label
|
||||
- FindAnnotatedItemAttr : returns an annotation label for a label's attribute
|
||||
- FindAnnotatedItemSubshape : returns an annotation label for a sub-shape
|
||||
- *FindAnnotatedItem* : returns an annotation label for a label;
|
||||
- *FindAnnotatedItemAttr* : returns an annotation label for a label's attribute;
|
||||
- *FindAnnotatedItemSubshape* : returns an annotation label for a sub-shape.
|
||||
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes = ...
|
||||
@@ -711,9 +989,9 @@ TDF_Label myLabelSubshape = myNotes->FindAnnotatedItemSubshape(theLabel, theSubs
|
||||
Null label will be returned if there is no corresponding annotation.
|
||||
|
||||
To get all notes of the Document item use the following *XCAFDoc_NotesTool* methods:
|
||||
- GetNotes : outputs a sequence of note labels bound to a label
|
||||
- GetAttrNotes : outputs a sequence of note labels bound to a label's attribute
|
||||
- GetAttrSubshape : outputs a sequence of note labels bound to a sub-shape
|
||||
- *GetNotes* : outputs a sequence of note labels bound to a label;
|
||||
- *GetAttrNotes* : outputs a sequence of note labels bound to a label's attribute;
|
||||
- *GetAttrSubshape* : outputs a sequence of note labels bound to a sub-shape.
|
||||
|
||||
All these methods return the number of notes.
|
||||
~~~~~
|
||||
@@ -729,12 +1007,12 @@ TDF_LabelSequence theNotesSubshape;
|
||||
myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape);
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_xde_2_7_6 Removing Notes
|
||||
@subsubsection occt_xde_2_10_6 Removing Notes
|
||||
|
||||
To remove a note use one of the following *XCAFDoc_NotesTool* methods:
|
||||
- RemoveNote : unbinds a note from a label
|
||||
- RemoveAttrNote : unbinds a note from a label's attribute
|
||||
- RemoveSubshapeNote : unbinds a note from a sub-shape
|
||||
- *RemoveNote* : unbinds a note from a label;
|
||||
- *RemoveAttrNote* : unbinds a note from a label's attribute;
|
||||
- *RemoveSubshapeNote* : unbinds a note from a sub-shape.
|
||||
|
||||
~~~~~
|
||||
Handle(XCAFDoc_Note) myNote = ...
|
||||
@@ -746,30 +1024,31 @@ Standard_Integer theSubshape = 1;
|
||||
myNotes->RemoveSubshapeNote(myNote->Label(), theSubshape);
|
||||
~~~~~
|
||||
A note will not be deleted automatically.
|
||||
Counterpart methods to remove all notes are available too.
|
||||
Counterpart methods to remove all notes are available, too.
|
||||
|
||||
@subsubsection occt_xde_2_7_7 Deleting Notes
|
||||
@subsubsection occt_xde_2_10_7 Deleting Notes
|
||||
|
||||
To delete note(s) use the following *XCAFDoc_NotesTool* methods:
|
||||
- DeleteNote : deletes a single note
|
||||
- DeleteNotes : deletes a sequence of notes
|
||||
- DeleteAllNotes : deletes all Document notes
|
||||
- DeleteOrphanNotes : deletes notes not bound to Document items
|
||||
- *DeleteNote* : deletes a single note;
|
||||
- *DeleteNotes* : deletes a sequence of notes;
|
||||
- *DeleteAllNotes* : deletes all Document notes;
|
||||
- *DeleteOrphanNotes* : deletes notes not bound to Document items.
|
||||
|
||||
All these methods excepting the last one break all links with Document items as well.
|
||||
All these methods except for the last one break all links with Document items as well.
|
||||
|
||||
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
|
||||
@subsection occt_xde_2_11 Reading and Writing STEP or IGES
|
||||
Note that saving and restoring the document itself are standard OCAF operations. As the various previously described definitions enter into this frame, they will not be explained any further.
|
||||
The same can be said for Viewing: presentations can be defined from Shapes and Colors.
|
||||
|
||||
There are several important points to consider:
|
||||
* Previously defined Readers and Writers for dealing with Shapes only, whether Standard or Advanced, remain unchanged in their form and in their dependencies. In addition, functions other than mapping are also unchanged.
|
||||
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion.
|
||||
* XDE provides mapping with data other than Shapes. Names, Colors, Layers, GD&T, Clipping planes, Views, Validation Properties (Centroid, Volume, Area), and Assembly Structure are hierarchic with rigid motion. Currently, Clipping planes and Views writing supported for XBF format only.
|
||||
* XDE mapping is relevant for use within the Advanced level of Data Exchanges, rather than Standard ones, because a higher level of information is better suited to a higher quality of shapes. In addition, this allows to avoid the multiplicity of combinations between various options. Note that this choice is not one of architecture but of practical usage and packaging.
|
||||
* Reader and Writer classes for XDE are generally used like those for Shapes. However, their use is adapted to manage a Document rather than a Shape.
|
||||
|
||||
The packages to manage this are *IGESCAFControl* for IGES, and *STEPCAFControl* for STEP.
|
||||
@subsubsection occt_xde_2_8_1 Reading a STEP file
|
||||
|
||||
@subsubsection occt_xde_2_11_1 Reading a STEP file
|
||||
To read a STEP file by itself, use:
|
||||
|
||||
~~~~~
|
||||
@@ -790,7 +1069,7 @@ if ( !reader.Transfer ( doc ) ) {
|
||||
~~~~~
|
||||
|
||||
In addition, the reader provides methods that are applicable to document transfers and for directly querying of the data produced.
|
||||
@subsubsection occt_xde_2_8_2 Writing a STEP file
|
||||
@subsubsection occt_xde_2_11_2 Writing a STEP file
|
||||
To write a STEP file by itself, use:
|
||||
|
||||
~~~~~
|
||||
@@ -811,18 +1090,19 @@ if ( ! writer.Transfer ( Doc, mode ) ) {
|
||||
IFSelect_ReturnStatus stat = writer.Write(file-name);
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_xde_2_8_3 Reading an IGES File
|
||||
@subsubsection occt_xde_2_11_3 Reading an IGES File
|
||||
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
|
||||
@subsubsection occt_xde_2_8_4 Writing an IGES File
|
||||
@subsubsection occt_xde_2_11_4 Writing an IGES File
|
||||
Use the same procedure as for a STEP file but with IGESCAFControl instead of STEPCAFControl.
|
||||
|
||||
@subsection occt_xde_2_9 Using an XDE Document
|
||||
@subsection occt_xde_2_12 Using an XDE Document
|
||||
There are several ways of exploiting XDE data from an application, you can:
|
||||
1. Get the data relevant for the application by mapping XDE/Appli, then discard the XDE data once it has been used.
|
||||
2. Create a reference from the Application Document to the XDE Document, to have its data available as external data.
|
||||
3. Embed XDE data inside the Application Document (see the following section for details).
|
||||
4. Directly exploit XDE data such as when using file checkers.
|
||||
@subsubsection occt_xde_2_91 XDE Data inside an Application Document
|
||||
|
||||
@subsubsection occt_xde_2_12_1 XDE Data inside an Application Document
|
||||
To have XCAF data elsewhere than under label 0.1, you use the DocLabel of XDE. The method DocLabel from XCAFDoc_DocumentTool determines the relevant Label for XCAF. However, note that the default is 0.1.
|
||||
|
||||
In addition, as XDE data is defined and managed in a modular way, you can consider exclusively Assembly Structure, only Colors, and so on.
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#include <d3d9.h>
|
||||
#include <windows.h>
|
||||
|
||||
// include required OCCT headers
|
||||
@@ -619,7 +620,7 @@ public:
|
||||
}
|
||||
for (myAISContext()->InitSelected(); myAISContext()->MoreSelected(); myAISContext()->NextSelected())
|
||||
{
|
||||
myAISContext()->SetTransparency (myAISContext()->Current(), ((Standard_Real )theTrans) / 10.0, Standard_False);
|
||||
myAISContext()->SetTransparency (myAISContext()->SelectedInteractive(), ((Standard_Real )theTrans) / 10.0, Standard_False);
|
||||
}
|
||||
myAISContext()->UpdateCurrentViewer();
|
||||
}
|
||||
|
@@ -3,19 +3,24 @@
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "custom.sh" ]; then
|
||||
source "custom.sh";
|
||||
source "custom.sh" $*;
|
||||
fi
|
||||
|
||||
if [ -e "${aSamplePath}/../../../env.sh" ]; then
|
||||
source "${aSamplePath}/../../../env.sh";
|
||||
source "${aSamplePath}/../../../env.sh" $*;
|
||||
fi
|
||||
|
||||
if test "${QTDIR}" == ""; then
|
||||
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
|
||||
exit 1
|
||||
if [ "${QTDIR}" != "" ]; then
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
else
|
||||
aQMakePath=`which qmake`
|
||||
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
|
||||
if [ -x "$aQMakePath" ]; then
|
||||
echo "qmake from PATH will be used instead."
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
host=`uname -s`
|
||||
export STATION=$host
|
||||
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
qmake FuncDemo.pro
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
|
||||
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
make debug
|
||||
make -j $aNbJobs debug
|
||||
else
|
||||
make release
|
||||
make -j $aNbJobs release
|
||||
fi
|
||||
fi
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
|
||||
aSystem=`uname -s`
|
||||
|
@@ -3,20 +3,25 @@
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "custom.sh" ]; then
|
||||
source "custom.sh";
|
||||
source "custom.sh" $*;
|
||||
fi
|
||||
|
||||
if [ -e "${aSamplePath}/../../../env.sh" ]; then
|
||||
source "${aSamplePath}/../../../env.sh";
|
||||
source "${aSamplePath}/../../../env.sh" $*;
|
||||
fi
|
||||
|
||||
if test "${QTDIR}" == ""; then
|
||||
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
|
||||
exit 1
|
||||
if [ "${QTDIR}" != "" ]; then
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
else
|
||||
aQMakePath=`which qmake`
|
||||
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
|
||||
if [ -x "$aQMakePath" ]; then
|
||||
echo "qmake from PATH will be used instead."
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
host=`uname -s`
|
||||
export STATION=$host
|
||||
export RES_DIR=${aSamplePath}/${STATION}/res
|
||||
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
qmake IESample.pro
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
|
||||
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
make debug
|
||||
make -j $aNbJobs debug
|
||||
else
|
||||
make release
|
||||
make -j $aNbJobs release
|
||||
fi
|
||||
fi
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
|
||||
aSystem=`uname -s`
|
||||
|
@@ -3,20 +3,25 @@
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "custom.sh" ]; then
|
||||
source "custom.sh";
|
||||
source "custom.sh" $*;
|
||||
fi
|
||||
|
||||
if [ -e "${aSamplePath}/../../../env.sh" ]; then
|
||||
source "${aSamplePath}/../../../env.sh";
|
||||
source "${aSamplePath}/../../../env.sh" $*;
|
||||
fi
|
||||
|
||||
if test "${QTDIR}" == ""; then
|
||||
echo "Environment variable \"QTDIR\" not defined. Define it in \"custom.sh\" script."
|
||||
exit 1
|
||||
if [ "${QTDIR}" != "" ]; then
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
else
|
||||
aQMakePath=`which qmake`
|
||||
echo "Environment variable \"QTDIR\" not defined.. Define it in \"custom.sh\" script."
|
||||
if [ -x "$aQMakePath" ]; then
|
||||
echo "qmake from PATH will be used instead."
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
host=`uname -s`
|
||||
export STATION=$host
|
||||
export RES_DIR=${aSamplePath}/${STATION}/res
|
||||
|
||||
export PATH=${QTDIR}/bin:${PATH}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
qmake Tutorial.pro
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$MACOSX_USE_GLX" == "true" ]; then
|
||||
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
make debug
|
||||
make -j $aNbJobs debug
|
||||
else
|
||||
make release
|
||||
make -j $aNbJobs release
|
||||
fi
|
||||
fi
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
export aSamplePath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh"; fi
|
||||
if [ -e "${aSamplePath}/env.sh" ]; then source "${aSamplePath}/env.sh" $*; fi
|
||||
cd $aSamplePath
|
||||
|
||||
aSystem=`uname -s`
|
||||
|
@@ -59,7 +59,7 @@ vdimension ad_1 -angle -shapes as_38 as_49 -color black
|
||||
vdimension ad_2 -angle -shapes bs_24 bs_25 -color black
|
||||
vdimension ad_3 -angle -shapes as_48 as_43 -color black
|
||||
|
||||
puts "Changing text and arrow paramaters of dimensions..."
|
||||
puts "Changing text and arrow parameters of dimensions..."
|
||||
foreach i $aList {
|
||||
vdimparam $i -text 3d sh 6 -arrowlength 4 -arrowangle $anArrAngle
|
||||
}
|
||||
|
@@ -495,9 +495,9 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
|
||||
aTypOfSel, aPriority, aDeflection, aDeviationAngle);
|
||||
|
||||
Handle(SelectMgr_SelectableObject) aThis (this);
|
||||
for (theSelection->Init(); theSelection->More(); theSelection->Next())
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->BaseSensitive()->OwnerId());
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
|
||||
anOwner->Set (aThis);
|
||||
}
|
||||
|
||||
|
@@ -164,54 +164,10 @@ void AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (myShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
thePresentation->SetDisplayPriority (4);
|
||||
StdPrs_WFShape::Add (thePresentation, theShape, myDrawer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Handle(Prs3d_Drawer) aDefaultDrawer = GetContext()->DefaultDrawer();
|
||||
if (aDefaultDrawer->DrawHiddenLine())
|
||||
{
|
||||
myDrawer->EnableDrawHiddenLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->DisableDrawHiddenLine();
|
||||
}
|
||||
|
||||
Aspect_TypeOfDeflection aPrevDeflection = aDefaultDrawer->TypeOfDeflection();
|
||||
aDefaultDrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||
|
||||
// process HLRAngle and HLRDeviationCoefficient()
|
||||
Standard_Real aPrevAngle = myDrawer->HLRAngle();
|
||||
Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
|
||||
if (myDrawer->IsAutoTriangulation() &&
|
||||
Abs (aNewAngle - aPrevAngle) > Precision::Angular())
|
||||
{
|
||||
BRepTools::Clean (theShape);
|
||||
}
|
||||
|
||||
myDrawer->SetHLRAngle (aNewAngle);
|
||||
myDrawer->SetHLRDeviationCoefficient (aDefaultDrawer->HLRDeviationCoefficient());
|
||||
StdPrs_HLRPolyShape::Add (thePresentation, theShape, myDrawer, theProjector);
|
||||
aDefaultDrawer->SetTypeOfDeflection (aPrevDeflection);
|
||||
}
|
||||
}
|
||||
AIS_Shape::computeHlrPresentation (theProjector, thePrs, theShape, myDrawer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -277,9 +233,9 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
myReference->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive()->BaseSensitive());
|
||||
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive());
|
||||
if (!aSensitive.IsNull())
|
||||
{
|
||||
// Get the copy of SE3D
|
||||
@@ -304,38 +260,28 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
Shapes2EntitiesMap;
|
||||
|
||||
if (!myReference->HasSelection (theMode))
|
||||
{
|
||||
myReference->RecomputePrimitives (theMode);
|
||||
|
||||
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
|
||||
if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full)
|
||||
{
|
||||
myReference->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
Handle(StdSelect_BRepOwner) anOwner;
|
||||
TopLoc_Location aDummyLoc;
|
||||
|
||||
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
|
||||
// Fill in the map of subshapes and corresponding sensitive entities associated with aMode
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
|
||||
SensitiveList aSEList;
|
||||
TopoDS_Shape aSubShape;
|
||||
|
||||
// Fill in the map of subshapes and corresponding
|
||||
// sensitive entities associated with aMode
|
||||
for (aRefSel->Init(); aRefSel->More(); aRefSel->Next())
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive());
|
||||
if(!aSE.IsNull())
|
||||
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
{
|
||||
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
|
||||
if(!anOwner.IsNull())
|
||||
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
|
||||
{
|
||||
aSubShape = anOwner->Shape();
|
||||
const TopoDS_Shape& aSubShape = anOwner->Shape();
|
||||
if(!aShapes2EntitiesMap.IsBound (aSubShape))
|
||||
{
|
||||
aShapes2EntitiesMap.Bind (aSubShape, aSEList);
|
||||
aShapes2EntitiesMap.Bind (aSubShape, SensitiveList());
|
||||
}
|
||||
aShapes2EntitiesMap (aSubShape).Append (aSE);
|
||||
}
|
||||
@@ -345,20 +291,14 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
// Fill in selection from aShapes2EntitiesMap
|
||||
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
aSEList = aMapIt.Value();
|
||||
anOwner = new StdSelect_BRepOwner (aMapIt.Key(),
|
||||
this,
|
||||
aSEList.First()->OwnerId()->Priority(),
|
||||
Standard_True);
|
||||
const SensitiveList& aSEList = aMapIt.Value();
|
||||
Handle(StdSelect_BRepOwner) anOwner = new StdSelect_BRepOwner (aMapIt.Key(), this, aSEList.First()->OwnerId()->Priority(), Standard_True);
|
||||
anOwner->SetLocation (Transformation());
|
||||
|
||||
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
|
||||
{
|
||||
aSE = aListIt.Value();
|
||||
|
||||
aNewSE = aSE->GetConnected();
|
||||
Handle(Select3D_SensitiveEntity) aSE = aListIt.Value();
|
||||
Handle(Select3D_SensitiveEntity) aNewSE = aSE->GetConnected();
|
||||
aNewSE->Set (anOwner);
|
||||
|
||||
theSelection->Add (aNewSE);
|
||||
}
|
||||
}
|
||||
|
@@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
|
||||
Handle(AIS_InteractiveContext) aNullContext;
|
||||
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
|
||||
const Handle(AIS_InteractiveObject)& anObj = anObjIter.Key();
|
||||
anObj->SetContext (aNullContext);
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
||||
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -692,15 +692,13 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
|
||||
Display (anObj, Standard_False);
|
||||
isFound = Standard_True;
|
||||
}
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
@@ -717,17 +715,12 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
mySelection->Init();
|
||||
while (mySelection->More())
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
|
||||
Erase (anObj, Standard_False);
|
||||
isFound = Standard_True;
|
||||
|
||||
mySelection->Init();
|
||||
}
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
@@ -2858,15 +2851,14 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
|
||||
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
|
||||
|
||||
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
|
||||
? myLocalContexts(myCurLocalIndex)->Selection()
|
||||
: mySelection;
|
||||
Bnd_Box aBndSelected;
|
||||
|
||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
|
||||
if (anObj->IsInfinite())
|
||||
{
|
||||
|
@@ -564,7 +564,9 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
||||
clearDynamicHighlight();
|
||||
if (myWasLastMain && !myLastinMain.IsNull())
|
||||
{
|
||||
if (!myLastinMain->IsSelected() || myLastinMain->IsForcedHilight())
|
||||
if (!myLastinMain->IsSelected()
|
||||
|| myLastinMain->IsForcedHilight()
|
||||
|| NbSelected() > 1)
|
||||
{
|
||||
SetSelected (myLastinMain, Standard_False);
|
||||
if(toUpdateViewer)
|
||||
@@ -1013,10 +1015,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
Display (theObject, Standard_False);
|
||||
}
|
||||
if (!theObject->HasSelection (theObject->GlobalSelectionMode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
@@ -1037,9 +1036,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
return;
|
||||
}
|
||||
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) aSelOwner = mySelection->Value();
|
||||
const Handle(SelectMgr_EntityOwner)& aSelOwner = aSelIter.Value();
|
||||
if (!myFilters->IsOk (aSelOwner))
|
||||
{
|
||||
continue;
|
||||
@@ -1137,22 +1136,26 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveOb
|
||||
const Standard_Boolean theToUpdateViewer)
|
||||
{
|
||||
if (theObject.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer);
|
||||
}
|
||||
|
||||
const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode();
|
||||
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
|
||||
if (!myObjects.IsBound (theObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setContextToObject (theObject);
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
||||
return;
|
||||
|
||||
AddOrRemoveSelected (anOwner, theToUpdateViewer);
|
||||
if (!anOwner.IsNull()
|
||||
&& anOwner->HasSelectable())
|
||||
{
|
||||
AddOrRemoveSelected (anOwner, theToUpdateViewer);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddOrRemoveSelected
|
||||
@@ -1193,8 +1196,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
|
||||
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
|
||||
if (theOwner->IsSelected())
|
||||
@@ -1239,19 +1241,18 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
||||
|
||||
const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode();
|
||||
const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes();
|
||||
Standard_Boolean isGlobalModeActivated = Standard_False;
|
||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
|
||||
{
|
||||
if (aModeIter.Value() == aGlobalSelMode)
|
||||
{
|
||||
isGlobalModeActivated = Standard_True;
|
||||
break;
|
||||
if (Handle(SelectMgr_EntityOwner) aGlobOwner = theObj->GlobalSelOwner())
|
||||
{
|
||||
return aGlobOwner->IsSelected();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated || theObj->GlobalSelOwner().IsNull())
|
||||
return Standard_False;
|
||||
|
||||
return theObj->GlobalSelOwner()->IsSelected();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1261,12 +1262,11 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
||||
Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
|
||||
{
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner);
|
||||
|
||||
if (theOwner.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
return theOwner->IsSelected();
|
||||
}
|
||||
return !theOwner.IsNull()
|
||||
&& theOwner->IsSelected();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1390,37 +1390,44 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
|
||||
const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Integer theMode) const
|
||||
{
|
||||
if ( theIObj.IsNull() )
|
||||
return;
|
||||
if (theIObj.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
if ( theMode == -1 )
|
||||
ActivatedModes( theIObj, aModes );
|
||||
if (theMode == -1)
|
||||
{
|
||||
ActivatedModes (theIObj, aModes);
|
||||
}
|
||||
else
|
||||
aModes.Append( theMode );
|
||||
{
|
||||
aModes.Append (theMode);
|
||||
}
|
||||
|
||||
if (theOwners.IsNull())
|
||||
theOwners = new SelectMgr_IndexedMapOfOwner();
|
||||
|
||||
TColStd_ListIteratorOfListOfInteger anItr( aModes );
|
||||
for (; anItr.More(); anItr.Next() )
|
||||
{
|
||||
int aMode = anItr.Value();
|
||||
if ( !theIObj->HasSelection( aMode ) )
|
||||
continue;
|
||||
theOwners = new SelectMgr_IndexedMapOfOwner();
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
|
||||
|
||||
for ( aSel->Init(); aSel->More(); aSel->Next() )
|
||||
for (TColStd_ListIteratorOfListOfInteger anItr (aModes); anItr.More(); anItr.Next())
|
||||
{
|
||||
const int aMode = anItr.Value();
|
||||
const Handle(SelectMgr_Selection)& aSel = theIObj->Selection (aMode);
|
||||
if (aSel.IsNull())
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
|
||||
if ( aEntity.IsNull() )
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) aOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId());
|
||||
if ( !aOwner.IsNull() )
|
||||
theOwners->Add( aOwner );
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
|
||||
{
|
||||
theOwners->Add (aOwner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1431,13 +1438,11 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_InteractiveContext::NbSelected()
|
||||
{
|
||||
Standard_Integer aNbSelected = 0;
|
||||
for (InitSelected(); MoreSelected(); NextSelected())
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
aNbSelected++;
|
||||
return myLocalContexts (myCurLocalIndex)->Selection()->Extent();
|
||||
}
|
||||
|
||||
return aNbSelected;
|
||||
return mySelection->Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -202,9 +202,8 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
|
||||
{
|
||||
if (myActiveObjects.IsBound (anInteractive))
|
||||
{
|
||||
if (anInteractive->HasSelection (ActivationMode))
|
||||
if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
|
||||
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
|
||||
{
|
||||
if (!myMainVS->Contains (anInteractive))
|
||||
@@ -864,24 +863,26 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
|
||||
|
||||
void AIS_LocalContext::LoadContextObjects()
|
||||
{
|
||||
AIS_ListIteratorOfListOfInteractive It;
|
||||
if(myLoadDisplayed) {
|
||||
AIS_ListOfInteractive LL;
|
||||
myCTX->DisplayedObjects(LL,Standard_True);
|
||||
Handle(AIS_LocalStatus) Att;
|
||||
for (It.Initialize(LL);It.More();It.Next()){
|
||||
const Handle(AIS_InteractiveObject)& anObj = It.Value();
|
||||
Att= new AIS_LocalStatus();
|
||||
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
|
||||
Att->SetTemporary(Standard_False);
|
||||
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
|
||||
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
|
||||
}
|
||||
myActiveObjects.Bind(anObj,Att);
|
||||
if (!myLoadDisplayed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_ListOfInteractive LL;
|
||||
myCTX->DisplayedObjects(LL,Standard_True);
|
||||
for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObj = It.Value();
|
||||
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
|
||||
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
|
||||
Att->SetTemporary(Standard_False);
|
||||
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
|
||||
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
|
||||
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
|
||||
}
|
||||
myActiveObjects.Bind(anObj,Att);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -91,8 +91,8 @@ public:
|
||||
Standard_Boolean AcceptErase() const;
|
||||
|
||||
Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
|
||||
|
||||
const Handle(AIS_Selection) Selection() const;
|
||||
|
||||
const Handle(AIS_Selection)& Selection() const { return mySelection; }
|
||||
|
||||
Standard_EXPORT void Terminate (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
@@ -18,9 +18,6 @@
|
||||
|
||||
#include <SelectMgr_OrFilter.hxx>
|
||||
|
||||
inline const Handle(AIS_Selection) AIS_LocalContext::Selection() const
|
||||
{return mySelection;}
|
||||
|
||||
inline void AIS_LocalContext::SetAutomaticHilight(const Standard_Boolean aStatus)
|
||||
{myAutoHilight = aStatus;}
|
||||
|
||||
|
@@ -804,13 +804,10 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
{
|
||||
// 1. Collect selectable entities
|
||||
SelectMgr_IndexedMapOfOwner aValidOwners;
|
||||
|
||||
const TColStd_ListOfInteger& aModes = SelectionModes (theIO);
|
||||
|
||||
TColStd_ListIteratorOfListOfInteger aModeIter (aModes);
|
||||
for (; aModeIter.More(); aModeIter.Next())
|
||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
|
||||
{
|
||||
int aMode = aModeIter.Value();
|
||||
const int aMode = aModeIter.Value();
|
||||
if (!theIO->HasSelection(aMode))
|
||||
{
|
||||
continue;
|
||||
@@ -821,24 +818,16 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode);
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
const Handle(SelectMgr_Selection)& aSelection = theIO->Selection (aMode);
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
|
||||
if (anEntity.IsNull())
|
||||
if (Handle(SelectBasics_SensitiveEntity) anEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
continue;
|
||||
if (Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId()))
|
||||
{
|
||||
aValidOwners.Add (anOwner);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
|
||||
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aValidOwners.Add(anOwner);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,22 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
|
||||
|
||||
IMPLEMENT_HSEQUENCE(AIS_ManipulatorObjectSequence)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Return Ax1 for specified direction of Ax2.
|
||||
static gp_Ax1 getAx1FromAx2Dir (const gp_Ax2& theAx2,
|
||||
int theIndex)
|
||||
{
|
||||
switch (theIndex)
|
||||
{
|
||||
case 0: return gp_Ax1 (theAx2.Location(), theAx2.XDirection());
|
||||
case 1: return gp_Ax1 (theAx2.Location(), theAx2.YDirection());
|
||||
case 2: return theAx2.Axis();
|
||||
}
|
||||
throw Standard_ProgramError ("AIS_Manipulator - Invalid axis index");
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : init
|
||||
//purpose :
|
||||
@@ -384,22 +400,19 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
// Initialize start reference data
|
||||
if (!myHasStartedTransformation)
|
||||
{
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
myStartTrsfs.Clear();
|
||||
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
for (AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
myStartTrsfs.Append (anObjects->Value (anIt)->LocalTransformation());
|
||||
myStartTrsfs.Append (anObjIter.Value()->LocalTransformation());
|
||||
}
|
||||
myStartPosition = myPosition;
|
||||
}
|
||||
|
||||
// Get 3d point with projection vector
|
||||
Graphic3d_Vec3d anInputPoint;
|
||||
Graphic3d_Vec3d aProj;
|
||||
Graphic3d_Vec3d anInputPoint, aProj;
|
||||
theView->ConvertWithProj (theMaxX, theMaxY, anInputPoint.x(), anInputPoint.y(), anInputPoint.z(), aProj.x(), aProj.y(), aProj.z());
|
||||
gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
|
||||
gp_Pnt aNewPosition = gp::Origin();
|
||||
|
||||
const gp_Lin anInputLine (gp_Pnt (anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir (aProj.x(), aProj.y(), aProj.z()));
|
||||
switch (myCurrentMode)
|
||||
{
|
||||
case AIS_MM_Translation:
|
||||
@@ -410,7 +423,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
|
||||
gp_Pnt aP1, aP2;
|
||||
anExtrema.NearestPoints (aP1, aP2);
|
||||
aNewPosition = aP2;
|
||||
const gp_Pnt aNewPosition = aP2;
|
||||
|
||||
if (!myHasStartedTransformation)
|
||||
{
|
||||
@@ -427,26 +440,28 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
gp_Trsf aNewTrsf;
|
||||
aNewTrsf.SetTranslation (gp_Vec(myStartPick, aNewPosition));
|
||||
theTrsf *= aNewTrsf;
|
||||
break;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_Rotation:
|
||||
{
|
||||
const gp_Pnt aPosLoc = myStartPosition.Location();
|
||||
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir (myStartPosition, myCurrentIndex);
|
||||
|
||||
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
|
||||
Handle(Geom_Surface) aSurface = new Geom_Plane (myPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
|
||||
Handle(Geom_Surface) aSurface = new Geom_Plane (aPosLoc, aCurrAxis.Direction());
|
||||
GeomAPI_IntCS aIntersector (anInputCurve, aSurface);
|
||||
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aNewPosition = aIntersector.Point (1);
|
||||
|
||||
const gp_Pnt aNewPosition = aIntersector.Point (1);
|
||||
if (!myHasStartedTransformation)
|
||||
{
|
||||
myStartPick = aNewPosition;
|
||||
myHasStartedTransformation = Standard_True;
|
||||
gp_Dir aStartAxis = gce_MakeDir (myPosition.Location(), myStartPick);
|
||||
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(myPosition.Location(), aNewPosition), myAxes[myCurrentIndex].Position().Direction());
|
||||
gp_Dir aStartAxis = gce_MakeDir (aPosLoc, myStartPick);
|
||||
myPrevState = aStartAxis.AngleWithRef (gce_MakeDir(aPosLoc, aNewPosition), aCurrAxis.Direction());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -455,17 +470,17 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Dir aStartAxis = myPosition.Location().IsEqual (myStartPick, Precision::Confusion())
|
||||
? myAxes[(myCurrentIndex + 1) % 3].Position().Direction()
|
||||
: gce_MakeDir (myPosition.Location(), myStartPick);
|
||||
gp_Dir aStartAxis = aPosLoc.IsEqual (myStartPick, Precision::Confusion())
|
||||
? getAx1FromAx2Dir (myStartPosition, (myCurrentIndex + 1) % 3).Direction()
|
||||
: gce_MakeDir (aPosLoc, myStartPick);
|
||||
|
||||
gp_Dir aCurrentAxis = gce_MakeDir (myPosition.Location(), aNewPosition);
|
||||
Standard_Real anAngle = aStartAxis.AngleWithRef (aCurrentAxis, myAxes[myCurrentIndex].Position().Direction());
|
||||
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_ShortReal aSign = myPrevState > 0 ? -1.0f : 1.0f;
|
||||
Standard_Real aSign = myPrevState > 0 ? -1.0 : 1.0;
|
||||
anAngle = aSign * (M_PI * 2 - anAngle);
|
||||
}
|
||||
|
||||
@@ -475,10 +490,10 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
}
|
||||
|
||||
gp_Trsf aNewTrsf;
|
||||
aNewTrsf.SetRotation (myAxes[myCurrentIndex].Position(), anAngle);
|
||||
aNewTrsf.SetRotation (aCurrAxis, anAngle);
|
||||
theTrsf *= aNewTrsf;
|
||||
myPrevState = anAngle;
|
||||
break;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_Scaling:
|
||||
{
|
||||
@@ -486,7 +501,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
Handle(Geom_Curve) anInputCurve = new Geom_Line (anInputLine);
|
||||
Handle(Geom_Curve) aCurve = new Geom_Line (aLine);
|
||||
GeomAPI_ExtremaCurveCurve anExtrema (anInputCurve, aCurve);
|
||||
gp_Pnt aTmp;
|
||||
gp_Pnt aNewPosition, aTmp;
|
||||
anExtrema.NearestPoints (aTmp, aNewPosition);
|
||||
|
||||
if (!myHasStartedTransformation)
|
||||
@@ -508,13 +523,14 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
aNewTrsf.SetScale (myPosition.Location(), aCoeff);
|
||||
|
||||
theTrsf = aNewTrsf;
|
||||
break;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_None:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -544,18 +560,19 @@ void AIS_Manipulator::StopTransform (const Standard_Boolean theToApply)
|
||||
}
|
||||
|
||||
myHasStartedTransformation = Standard_False;
|
||||
|
||||
if (!theToApply)
|
||||
if (theToApply)
|
||||
{
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
|
||||
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
|
||||
{
|
||||
anObjects->Value (anIt)->SetLocalTransformation (myStartTrsfs(anIt));
|
||||
}
|
||||
|
||||
SetPosition (myStartPosition);
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
|
||||
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
|
||||
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
||||
{
|
||||
anObjIter.ChangeValue()->SetLocalTransformation (aTrsfIter.Value());
|
||||
}
|
||||
SetPosition (myStartPosition);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -569,11 +586,14 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
|
||||
for (Standard_Integer anIt = anObjects->Lower(); anIt <= anObjects->Upper(); ++anIt)
|
||||
{
|
||||
anObjects->Value (anIt)->SetLocalTransformation (theTrsf * myStartTrsfs(anIt));
|
||||
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
|
||||
AIS_ManipulatorObjectSequence::Iterator anObjIter (*anObjects);
|
||||
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
|
||||
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
||||
{
|
||||
anObjIter.ChangeValue()->SetLocalTransformation (theTrsf * aTrsfIter.Value());
|
||||
}
|
||||
}
|
||||
|
||||
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|
||||
@@ -613,10 +633,9 @@ void AIS_Manipulator::SetPosition (const gp_Ax2& thePosition)
|
||||
|| !myPosition.XDirection().IsEqual (thePosition.XDirection(), Precision::Angular()))
|
||||
{
|
||||
myPosition = thePosition;
|
||||
myAxes[0].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.XDirection()));
|
||||
myAxes[1].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.YDirection()));
|
||||
myAxes[2].SetPosition (gp_Ax1 (myPosition.Location(), myPosition.Direction()));
|
||||
|
||||
myAxes[0].SetPosition (getAx1FromAx2Dir (thePosition, 0));
|
||||
myAxes[1].SetPosition (getAx1FromAx2Dir (thePosition, 1));
|
||||
myAxes[2].SetPosition (getAx1FromAx2Dir (thePosition, 2));
|
||||
updateTransformation();
|
||||
}
|
||||
}
|
||||
|
@@ -215,18 +215,18 @@ public:
|
||||
//! @return true if manipulator is attached to some interactive object (has owning object).
|
||||
Standard_Boolean IsAttached() const { return HasOwner(); }
|
||||
|
||||
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
|
||||
//! @return true if some part of manipulator is selected (transformation mode is active, and owning object can be transformed).
|
||||
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
|
||||
|
||||
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
|
||||
|
||||
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
|
||||
gp_Trsf StartTransformation() const { return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf(); }
|
||||
|
||||
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
|
||||
gp_Trsf StartTransformation (Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
|
||||
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
|
||||
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
|
||||
return !myStartTrsfs.IsEmpty() ? myStartTrsfs (theIndex) : gp_Trsf();
|
||||
}
|
||||
|
||||
public: //! @name Configuration of graphical transformations
|
||||
@@ -245,7 +245,7 @@ public: //! @name Configuration of graphical transformations
|
||||
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
|
||||
//! @warning this interactive object does not support custom transformation persistence when
|
||||
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
|
||||
//! presentations are overriden by this class.
|
||||
//! presentations are overridden by this class.
|
||||
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa ZoomPersistence mode,
|
||||
//! silently does nothing in release mode.
|
||||
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
|
||||
@@ -298,17 +298,17 @@ public:
|
||||
public: //! @name Presentation computation
|
||||
|
||||
//! Fills presentation.
|
||||
//! @note Manipulator presentation does not use display mode and for all modes has the same presenatation.
|
||||
//! @note Manipulator presentation does not use display mode and for all modes has the same presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
//! Computes selection sensitive zones (triangulation) for manipulator.
|
||||
//! @param theNode [in] Seldction mode that is treated as transformation mode.
|
||||
//! @param theNode [in] Selection mode that is treated as transformation mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overriden methods.
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
||||
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -352,7 +352,7 @@ protected:
|
||||
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||
using AIS_InteractiveObject::SetLocalTransformation; // hide visibility
|
||||
|
||||
protected: //! @name Auxilliary classes to fill presentation with proper primitives
|
||||
protected: //! @name Auxiliary classes to fill presentation with proper primitives
|
||||
|
||||
class Quadric
|
||||
{
|
||||
@@ -616,16 +616,16 @@ protected:
|
||||
|
||||
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 manipualtor object. it displayes its location and position of its axes.
|
||||
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
|
||||
|
||||
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
|
||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
|
||||
|
||||
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
||||
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
||||
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
|
||||
|
||||
protected: //! @name Fields for interactive trnasformation. Fields only for internal needs. They do not have public interface.
|
||||
protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface.
|
||||
|
||||
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
|
||||
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
|
||||
@@ -633,7 +633,7 @@ protected: //! @name Fields for interactive trnasformation. Fields only for inte
|
||||
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
|
||||
Standard_Real myPrevState; //! Previous value of angle during rotation.
|
||||
|
||||
//! Aspect used to colour current detected part and current selected part.
|
||||
//! Aspect used to color current detected part and current selected part.
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
||||
public:
|
||||
|
||||
|
@@ -30,14 +30,13 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive,AIS_InteractiveObjec
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_MultipleConnectedInteractive
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
|
||||
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
|
||||
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
|
||||
{
|
||||
myHasOwnPresentations = Standard_False;
|
||||
myAssemblyOwner = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -213,53 +212,27 @@ Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() co
|
||||
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
if (theMode == 0)
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aChild->HasSelection (theMode))
|
||||
{
|
||||
aChild->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
|
||||
aChild->ComputeSelection (aSelection, theMode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalSelOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_EntityOwner) AIS_MultipleConnectedInteractive::GlobalSelOwner() const
|
||||
{
|
||||
return myAssemblyOwner;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_Integer theMode) const
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aChild->HasSelection (theMode))
|
||||
return Standard_False;
|
||||
}
|
||||
{
|
||||
aChild->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
|
||||
aChild->ComputeSelection (aSelection, theMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -72,12 +72,11 @@ public:
|
||||
//! may be decomposed into sub-shapes for dynamic selection.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
|
||||
//! Returns common entity owner if the object is an assembly
|
||||
virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
|
||||
|
||||
//! Returns true if a selection corresponding to the selection mode theMode was computed for all
|
||||
//! children of multiple connected interactive object.
|
||||
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
|
||||
|
||||
//! Assigns interactive context.
|
||||
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
|
||||
@@ -142,6 +141,10 @@ private:
|
||||
//! Computes the selection for whole subtree in scene hierarchy.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
|
||||
|
@@ -41,6 +41,7 @@ void AIS_Selection::Clear()
|
||||
{
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <HLRBRep.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Precision.hxx>
|
||||
@@ -157,14 +159,11 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
OCC_CATCH_SIGNALS
|
||||
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "AIS_Shape::Compute() failed" << endl;
|
||||
cout << "a Shape should be incorrect : No Compute can be maked on it " << endl;
|
||||
#endif
|
||||
// presentation of the bounding box is calculated
|
||||
// Compute(aPresentationManager,aPrs,2);
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString()
|
||||
+ "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
|
||||
+ anException.GetMessageString() + ")", Message_Fail);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -191,11 +190,11 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
|
||||
myUVOrigin, myUVRepeat, myUVScale);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
|
||||
#endif
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString()
|
||||
+ "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
|
||||
+ anException.GetMessageString() + ")", Message_Fail);
|
||||
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
|
||||
}
|
||||
}
|
||||
@@ -227,150 +226,88 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose : Hidden Line Removal
|
||||
//function : computeHlrPresentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer)
|
||||
{
|
||||
Compute(aProjector,aPresentation,myshape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Geom_Transformation)& TheTrsf,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
const TopLoc_Location& loc = myshape.Location();
|
||||
TopoDS_Shape shbis = myshape.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
|
||||
Compute(aProjector,aPresentation,shbis);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const TopoDS_Shape& SH)
|
||||
{
|
||||
if (SH.ShapeType() == TopAbs_COMPOUND) {
|
||||
TopoDS_Iterator anExplor (SH);
|
||||
|
||||
if (!anExplor.More()) // Shape vide -> Assemblage vide.
|
||||
return;
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
|
||||
if (defdrawer->DrawHiddenLine())
|
||||
{myDrawer->EnableDrawHiddenLine();}
|
||||
else {myDrawer->DisableDrawHiddenLine();}
|
||||
|
||||
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
|
||||
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
// coefficients for calculation
|
||||
Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
|
||||
Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
|
||||
Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
|
||||
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
|
||||
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
BRepTools::Clean(SH);
|
||||
thePrs->SetDisplayPriority (4);
|
||||
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
|
||||
return;
|
||||
}
|
||||
case TopAbs_COMPOUND:
|
||||
{
|
||||
TopoDS_Iterator anExplor (theShape);
|
||||
if (!anExplor.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Handle(Prs3d_Drawer)& aDefDrawer = theDrawer->Link();
|
||||
if (aDefDrawer->DrawHiddenLine())
|
||||
{
|
||||
try {
|
||||
theDrawer->EnableDrawHiddenLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
theDrawer->DisableDrawHiddenLine();
|
||||
}
|
||||
|
||||
const Aspect_TypeOfDeflection aPrevDef = aDefDrawer->TypeOfDeflection();
|
||||
aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
if (theDrawer->IsAutoTriangulation())
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (theShape, theDrawer, Standard_True);
|
||||
}
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
switch (TypeOfHLR()) {
|
||||
switch (theDrawer->TypeOfHLR())
|
||||
{
|
||||
case Prs3d_TOH_Algo:
|
||||
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
|
||||
StdPrs_HLRShape::Add (thePrs, theShape, theDrawer, theProjector);
|
||||
break;
|
||||
case Prs3d_TOH_PolyAlgo:
|
||||
default:
|
||||
StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
|
||||
StdPrs_HLRPolyShape::Add (thePrs, theShape, theDrawer, theProjector);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
|
||||
#endif
|
||||
StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString()
|
||||
+ "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
|
||||
+ anException.GetMessageString() + ")", Message_Fail);
|
||||
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
|
||||
}
|
||||
}
|
||||
|
||||
defdrawer->SetTypeOfDeflection (prevdef);
|
||||
aDefDrawer->SetTypeOfDeflection (aPrevDef);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectionType
|
||||
//purpose : gives the type according to the Index of Selection Mode
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_ShapeEnum AIS_Shape::SelectionType(const Standard_Integer aMode)
|
||||
{
|
||||
switch(aMode){
|
||||
case 1:
|
||||
return TopAbs_VERTEX;
|
||||
case 2:
|
||||
return TopAbs_EDGE;
|
||||
case 3:
|
||||
return TopAbs_WIRE;
|
||||
case 4:
|
||||
return TopAbs_FACE;
|
||||
case 5:
|
||||
return TopAbs_SHELL;
|
||||
case 6:
|
||||
return TopAbs_SOLID;
|
||||
case 7:
|
||||
return TopAbs_COMPSOLID;
|
||||
case 8:
|
||||
return TopAbs_COMPOUND;
|
||||
case 0:
|
||||
default:
|
||||
return TopAbs_SHAPE;
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SelectionType
|
||||
//purpose : gives the SelectionMode according to the Type od Decomposition...
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_Shape::SelectionMode(const TopAbs_ShapeEnum aType)
|
||||
{
|
||||
switch(aType){
|
||||
case TopAbs_VERTEX:
|
||||
return 1;
|
||||
case TopAbs_EDGE:
|
||||
return 2;
|
||||
case TopAbs_WIRE:
|
||||
return 3;
|
||||
case TopAbs_FACE:
|
||||
return 4;
|
||||
case TopAbs_SHELL:
|
||||
return 5;
|
||||
case TopAbs_SOLID:
|
||||
return 6;
|
||||
case TopAbs_COMPSOLID:
|
||||
return 7;
|
||||
case TopAbs_COMPOUND:
|
||||
return 8;
|
||||
case TopAbs_SHAPE:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
@@ -393,7 +330,8 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
// POP protection against crash in low layers
|
||||
|
||||
Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
|
||||
try {
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,
|
||||
this,
|
||||
@@ -402,9 +340,14 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
aDeflection,
|
||||
myDrawer->HLRAngle(),
|
||||
myDrawer->IsAutoTriangulation());
|
||||
} catch ( Standard_Failure ) {
|
||||
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
|
||||
if ( aMode == 0 ) {
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString()
|
||||
+ "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
|
||||
+ anException.GetMessageString() + ")", Message_Fail);
|
||||
if (aMode == 0)
|
||||
{
|
||||
aSelection->Clear();
|
||||
Bnd_Box B = BoundingBox();
|
||||
Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
|
||||
|
@@ -211,23 +211,42 @@ public:
|
||||
//! Returns the transparency attributes of the shape accordingly to
|
||||
//! the current facing model;
|
||||
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
|
||||
|
||||
//! Activates the same TopAbs shape enumerations as
|
||||
//! those used by SelectionMode assigning a type to the mode aDecompositionMode.
|
||||
Standard_EXPORT static TopAbs_ShapeEnum SelectionType (const Standard_Integer aDecompositionMode);
|
||||
|
||||
//! Establishes an equivalence between a mode and the
|
||||
//! type, aShapeType, of selection. The correspondences are as follows:
|
||||
//! - mode 0 - Shape
|
||||
//! - mode 1 - Vertex
|
||||
//! - mode 2 - Edge
|
||||
//! - mode 3 - Wire
|
||||
//! - mode 4 - Face
|
||||
//! - mode 5 - Shell
|
||||
//! - mode 6 - Solid
|
||||
//! - mode 7 - Compsolid
|
||||
//! - mode 8 - Compound
|
||||
Standard_EXPORT static Standard_Integer SelectionMode (const TopAbs_ShapeEnum aShapeType);
|
||||
|
||||
//! Return shape type for specified selection mode.
|
||||
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
|
||||
{
|
||||
switch (theSelMode)
|
||||
{
|
||||
case 1: return TopAbs_VERTEX;
|
||||
case 2: return TopAbs_EDGE;
|
||||
case 3: return TopAbs_WIRE;
|
||||
case 4: return TopAbs_FACE;
|
||||
case 5: return TopAbs_SHELL;
|
||||
case 6: return TopAbs_SOLID;
|
||||
case 7: return TopAbs_COMPSOLID;
|
||||
case 8: return TopAbs_COMPOUND;
|
||||
case 0: return TopAbs_SHAPE;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
}
|
||||
|
||||
//! Return selection mode for specified shape type.
|
||||
static Standard_Integer SelectionMode (const TopAbs_ShapeEnum theShapeType)
|
||||
{
|
||||
switch (theShapeType)
|
||||
{
|
||||
case TopAbs_VERTEX: return 1;
|
||||
case TopAbs_EDGE: return 2;
|
||||
case TopAbs_WIRE: return 3;
|
||||
case TopAbs_FACE: return 4;
|
||||
case TopAbs_SHELL: return 5;
|
||||
case TopAbs_SOLID: return 6;
|
||||
case TopAbs_COMPSOLID: return 7;
|
||||
case TopAbs_COMPOUND: return 8;
|
||||
case TopAbs_SHAPE: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public: //! @name methods to alter texture mapping properties
|
||||
|
||||
@@ -256,13 +275,31 @@ public: //! @name methods to alter texture mapping properties
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
//! Compute normal presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute projected presentation.
|
||||
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
|
||||
{
|
||||
computeHlrPresentation (theProjector, thePrs, myshape, myDrawer);
|
||||
}
|
||||
|
||||
//! Compute projected presentation with transformation.
|
||||
virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
|
||||
{
|
||||
const TopLoc_Location& aLoc = myshape.Location();
|
||||
const TopoDS_Shape aShape = myshape.Located (TopLoc_Location (theTrsf->Trsf()) * aLoc);
|
||||
computeHlrPresentation (theProjector, thePrs, aShape, myDrawer);
|
||||
}
|
||||
|
||||
//! Compute selection.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||
|
||||
@@ -274,9 +311,13 @@ protected:
|
||||
|
||||
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
|
||||
|
||||
private:
|
||||
public:
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape);
|
||||
//! Compute HLR presentation for specified shape.
|
||||
Standard_EXPORT static void computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -67,3 +67,12 @@ Warning: Removal of internal boundaries among Faces has failed
|
||||
|
||||
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
|
||||
Warning: Removal of internal boundaries among Edges has failed
|
||||
|
||||
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
|
||||
Warning: Intersection of pair of shapes has failed
|
||||
|
||||
.BOPAlgo_AlertBuildingPCurveFailed
|
||||
Warning: Building 2D curve of edge on face has failed
|
||||
|
||||
.BOPAlgo_AlertAcquiredSelfIntersection
|
||||
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered
|
||||
|
@@ -78,4 +78,14 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
|
||||
//! Some edges are too small and have no valid range
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
|
||||
|
||||
//! Intersection of pair of shapes has failed
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertIntersectionOfPairOfShapesFailed)
|
||||
|
||||
//! Building 2D curve of edge on face has failed
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBuildingPCurveFailed)
|
||||
|
||||
//! Some sub-shapes of some of the argument become connected through
|
||||
//! other shapes and the argument became self-interfered
|
||||
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertAcquiredSelfIntersection)
|
||||
|
||||
#endif // _BOPAlgo_Alerts_HeaderFile
|
||||
|
@@ -69,4 +69,13 @@ static const char BOPAlgo_BOPAlgo_msg[] =
|
||||
"Warning: Removal of internal boundaries among Faces has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
|
||||
"Warning: Removal of internal boundaries among Edges has failed\n";
|
||||
"Warning: Removal of internal boundaries among Edges has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
|
||||
"Warning: Intersection of pair of shapes has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertBuildingPCurveFailed\n"
|
||||
"Warning: Building 2D curve of edge on face has failed\n"
|
||||
"\n"
|
||||
".BOPAlgo_AlertAcquiredSelfIntersection\n"
|
||||
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n";
|
||||
|
@@ -87,13 +87,19 @@ class TopoDS_Face;
|
||||
//! - *Gluing options* - allows to speed up the calculation on the special
|
||||
//! cases, in which some sub-shapes are coincide.<br>
|
||||
//!
|
||||
//! The algorithm returns the following Warning statuses:<br>
|
||||
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
|
||||
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
|
||||
//! The algorithm returns the following Warning statuses:
|
||||
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;
|
||||
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
|
||||
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
|
||||
//! valid range so it cannot be split;<br>
|
||||
//! valid range so it cannot be split;
|
||||
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
|
||||
//! of small edges.<br>
|
||||
//! of small edges;
|
||||
//! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
|
||||
//! sub-shapes has failed;
|
||||
//! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected
|
||||
//! through other shapes;
|
||||
//! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
|
||||
//! on the faces has failed.
|
||||
//!
|
||||
//! The algorithm returns the following Error alerts:
|
||||
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
|
||||
@@ -290,6 +296,7 @@ protected:
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
|
||||
const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
|
||||
@@ -474,6 +481,8 @@ protected:
|
||||
//! In case self-interference is found the warning is added.
|
||||
Standard_EXPORT void CheckSelfInterference();
|
||||
|
||||
//! Adds the warning about failed intersection of pair of sub-shapes
|
||||
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
|
||||
|
||||
BOPCol_ListOfShape myArguments;
|
||||
BOPDS_PDS myDS;
|
||||
|
@@ -112,7 +112,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
}
|
||||
//
|
||||
if (aLE.Extent() > 1) {
|
||||
// Add warning
|
||||
// Add the acquired self-interference warning:
|
||||
// The same common block contains several edges from one argument
|
||||
TopoDS_Compound aWC;
|
||||
aBB.MakeCompound(aWC);
|
||||
//
|
||||
@@ -122,7 +123,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
aBB.Add(aWC, aE1);
|
||||
}
|
||||
//
|
||||
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
|
||||
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,7 +169,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
for (j = 1; j <= aNbC; ++j) {
|
||||
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
|
||||
if (aMCS.Extent() > 1) {
|
||||
// Add self-interference warning
|
||||
// Add acquired self-interference warning:
|
||||
// Several faces from one argument contain the same vertex or edge
|
||||
TopoDS_Compound aWC;
|
||||
aBB.MakeCompound(aWC);
|
||||
//
|
||||
@@ -177,7 +179,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
|
||||
const TopoDS_Shape& aSx = aMCS(iS);
|
||||
aBB.Add(aWC, aSx);
|
||||
}
|
||||
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
|
||||
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
@@ -27,6 +28,7 @@
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPDS_VectorOfInterfVE.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
@@ -110,7 +112,16 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
};
|
||||
//
|
||||
protected:
|
||||
@@ -267,6 +278,11 @@ void BOPAlgo_PaveFiller::IntersectVE
|
||||
for (i = 0; i < aNbVE; ++i) {
|
||||
const BOPAlgo_VertexEdge& aVESolver = aVVE(i);
|
||||
if (aVESolver.Flag() != 0) {
|
||||
if (aVESolver.HasErrors())
|
||||
{
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aVESolver.Vertex(), aVESolver.Edge());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -491,3 +507,19 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: AddIntersectionFailedWarning
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2)
|
||||
{
|
||||
// Create the warn shape
|
||||
TopoDS_Compound aWC;
|
||||
BRep_Builder().MakeCompound(aWC);
|
||||
BRep_Builder().Add(aWC, theS1);
|
||||
BRep_Builder().Add(aWC, theS2);
|
||||
// Add the warning
|
||||
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
|
||||
}
|
@@ -93,7 +93,16 @@ class BOPAlgo_EdgeEdge :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_EdgeEdge::Perform();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_EdgeEdge::Perform();
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -229,7 +238,11 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
Bnd_Box aBB1, aBB2;
|
||||
//
|
||||
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
|
||||
if (!anEdgeEdge.IsDone()) {
|
||||
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) {
|
||||
// Warn about failed intersection of sub-shapes
|
||||
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
|
||||
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
|
||||
AddIntersectionFailedWarning(aE1, aE2);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
@@ -107,7 +108,16 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -212,7 +222,12 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
|
||||
//
|
||||
iFlag=aVertexFace.Flag();
|
||||
if (iFlag) {
|
||||
if (iFlag != 0) {
|
||||
if (aVertexFace.HasErrors())
|
||||
{
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aVertexFace.Vertex(), aVertexFace.Face());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@@ -103,7 +103,16 @@ class BOPAlgo_EdgeFace :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_EdgeFace::Perform();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_EdgeFace::Perform();
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -258,7 +267,9 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
for (k=0; k < aNbEdgeFace; ++k) {
|
||||
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
|
||||
if (!aEdgeFace.IsDone()) {
|
||||
if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) {
|
||||
// Warn about failed intersection of sub-shapes
|
||||
AddIntersectionFailedWarning(aEdgeFace.Edge(), aEdgeFace.Face());
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@@ -144,7 +144,16 @@ class BOPAlgo_FaceFace :
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -263,10 +272,12 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
for (k = 0; k < aNbFaceFace; ++k) {
|
||||
BOPAlgo_FaceFace& aFaceFace = aVFaceFace(k);
|
||||
aFaceFace.Indices(nF1, nF2);
|
||||
if (!aFaceFace.IsDone()) {
|
||||
if (!aFaceFace.IsDone() || aFaceFace.HasErrors()) {
|
||||
BOPDS_InterfFF& aFF = aFFs.Append1();
|
||||
aFF.SetIndices(nF1, nF2);
|
||||
aFF.Init(0, 0);
|
||||
// Warn about failed intersection of faces
|
||||
AddIntersectionFailedWarning(aFaceFace.Face1(), aFaceFace.Face2());
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -373,6 +384,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
|
||||
BOPCol_IndexedMapOfShape aMicroEdges(100, aAllocator);
|
||||
BOPCol_IndexedMapOfShape aVertsOnRejectedPB;
|
||||
//
|
||||
for (i=0; i<aNbFF; ++i) {
|
||||
//
|
||||
@@ -557,6 +569,19 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
if (!bInBothFaces) {
|
||||
aMPBAdd.Add(aPBOut);
|
||||
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
|
||||
// Try fusing the vertices of the existing pave block
|
||||
// with the vertices put on the real section curve (except
|
||||
// for technological vertices, which will be removed)
|
||||
Standard_Integer nVOut1, nVOut2;
|
||||
aPBOut->Indices(nVOut1, nVOut2);
|
||||
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV1);
|
||||
}
|
||||
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV2);
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -639,7 +664,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
// post treatment
|
||||
MakeSDVerticesFF(aDMVLV, aDMNewSD);
|
||||
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
|
||||
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aVertsOnRejectedPB, aAllocator);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
@@ -697,6 +722,7 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
Standard_Integer aNbS = theMSCPB.Extent();
|
||||
@@ -724,8 +750,9 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
|
||||
//
|
||||
Standard_Integer aNbME = theMicroEdges.Extent();
|
||||
Standard_Integer aNbVOnRPB = theVertsOnRejectedPB.Extent();
|
||||
// 0
|
||||
if (aNbS==1 && (aNbME == 0)) {
|
||||
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
|
||||
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
|
||||
//
|
||||
@@ -824,6 +851,20 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
aBB.UpdateVertex(aVerts[1], aTolV2 + aDist);
|
||||
}
|
||||
}
|
||||
|
||||
// Add vertices put on the real section curves to unify them with the
|
||||
// vertices of the edges, by which these sections curves have been rejected
|
||||
for (Standard_Integer i = 1; i <= aNbVOnRPB; ++i)
|
||||
{
|
||||
TopoDS_Shape aVer = theVertsOnRejectedPB(i);
|
||||
Standard_Integer iVer = myDS->Index(aVer);
|
||||
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
|
||||
if (pSD)
|
||||
aVer = myDS->Shape(*pSD);
|
||||
|
||||
if (anAddedSD.Add(aVer))
|
||||
aLS.Append(aVer);
|
||||
}
|
||||
//
|
||||
// 2 Fuse shapes
|
||||
aPF.SetProgressIndicator(myProgressIndicator);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Alerts.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
@@ -241,28 +242,37 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
iErr=1;
|
||||
if (!myEz.IsNull()) {
|
||||
TopoDS_Edge aSpz;
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
|
||||
myV2, myT2, aSpz);
|
||||
iErr=1;
|
||||
if (!myEz.IsNull()) {
|
||||
TopoDS_Edge aSpz;
|
||||
//
|
||||
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
|
||||
myV2, myT2, aSpz);
|
||||
//
|
||||
iErr=
|
||||
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
|
||||
myE,
|
||||
myF,
|
||||
myContext);
|
||||
}
|
||||
//
|
||||
iErr=
|
||||
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
|
||||
myE,
|
||||
myF,
|
||||
myContext);
|
||||
if (iErr) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
|
||||
}
|
||||
//
|
||||
if (myFlag) {
|
||||
UpdateVertices(myE, myF);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (iErr) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
|
||||
}
|
||||
//
|
||||
if (myFlag) {
|
||||
UpdateVertices(myE, myF);
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -676,6 +686,20 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
//======================================================
|
||||
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
|
||||
//======================================================
|
||||
|
||||
// Add warnings of the failed projections
|
||||
Standard_Integer aNb = aVMPC.Extent();
|
||||
for (i = 0; i < aNb; ++i)
|
||||
{
|
||||
if (aVMPC(i).HasErrors())
|
||||
{
|
||||
TopoDS_Compound aWC;
|
||||
BRep_Builder().MakeCompound(aWC);
|
||||
BRep_Builder().Add(aWC, aVMPC(i).Edge());
|
||||
BRep_Builder().Add(aWC, aVMPC(i).Face());
|
||||
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdateVertices
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@@ -52,6 +53,11 @@ static
|
||||
const Standard_Real aP2,
|
||||
TopoDS_Edge& aNewEdge);
|
||||
|
||||
static
|
||||
Standard_Boolean AddSplitPoint(const Handle(BOPDS_PaveBlock)& thePBD,
|
||||
const BOPDS_Pave& thePave,
|
||||
const Standard_Real theTol);
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessDE
|
||||
//purpose :
|
||||
@@ -304,25 +310,30 @@ void BOPAlgo_PaveFiller::ProcessDE()
|
||||
}
|
||||
// Intersection
|
||||
Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInt, aTolInt);
|
||||
if (!aGInter.IsDone()) {
|
||||
continue;
|
||||
if (aGInter.IsDone() && aGInter.NbPoints())
|
||||
{
|
||||
// Analyze intersection points
|
||||
Standard_Integer i, aNbPoints = aGInter.NbPoints();
|
||||
for (i = 1; i <= aNbPoints; ++i) {
|
||||
Standard_Real aX = aGInter.Point(i).ParamOnFirst();
|
||||
aPave.SetParameter(aX);
|
||||
AddSplitPoint(aPBD, aPave, aTolCmp);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Analyze intersection points
|
||||
Standard_Integer i, aNbPoints = aGInter.NbPoints();
|
||||
for (i = 1; i <= aNbPoints; ++i) {
|
||||
Standard_Real aX = aGInter.Point(i).ParamOnFirst();
|
||||
if (aX - aTD1 < aTolCmp || aTD2 - aX < aTolCmp) {
|
||||
continue;
|
||||
else
|
||||
{
|
||||
// If the intersection did not succeed, try the projection of the end point
|
||||
// of the curve corresponding to the vertex of degenerated edge
|
||||
Standard_Real aT = (nVD == aPB->Pave1().Index() ?
|
||||
aPB->Pave1().Parameter() : aPB->Pave2().Parameter());
|
||||
gp_Pnt2d aP2d = aC2D->Value(aT);
|
||||
Geom2dAPI_ProjectPointOnCurve aProj2d(aP2d, aC2DDE, aTD1, aTD2);
|
||||
if (aProj2d.NbPoints())
|
||||
{
|
||||
Standard_Real aX = aProj2d.LowerDistanceParameter();
|
||||
aPave.SetParameter(aX);
|
||||
AddSplitPoint(aPBD, aPave, aTolCmp);
|
||||
}
|
||||
//
|
||||
Standard_Integer anInd;
|
||||
if (aPBD->ContainsParameter(aX, aTolCmp, anInd)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aPave.SetParameter(aX);
|
||||
aPBD->AppendExtPave1(aPave);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,3 +365,34 @@ void BOPAlgo_PaveFiller::ProcessDE()
|
||||
BB.UpdateEdge(E, aTol);
|
||||
aNewEdge=E;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: AddSplitPoint
|
||||
// purpose: Validates the point represented by the pave <thePave>
|
||||
// for the Pave Block <thePBD>.
|
||||
// In case the point passes the checks it is added as an
|
||||
// Extra Pave to the Pave Block for further splitting of the latter.
|
||||
// Returns TRUE if the point is added, otherwise returns FALSE.
|
||||
//=======================================================================
|
||||
Standard_Boolean AddSplitPoint(const Handle(BOPDS_PaveBlock)& thePBD,
|
||||
const BOPDS_Pave& thePave,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Standard_Real aTD1, aTD2;
|
||||
thePBD->Range(aTD1, aTD2);
|
||||
|
||||
Standard_Real aT = thePave.Parameter();
|
||||
// Check that the parameter is inside the Pave Block
|
||||
if (aT - aTD1 < theTol || aTD2 - aT < theTol)
|
||||
return Standard_False;
|
||||
|
||||
// Check that the pave block does not contain the same parameter
|
||||
Standard_Integer anInd;
|
||||
if (thePBD->ContainsParameter(aT, theTol, anInd))
|
||||
return Standard_False;
|
||||
|
||||
// Add the point as an Extra pave to the Pave Block for further
|
||||
// splitting of the latter
|
||||
thePBD->AppendExtPave1(thePave);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -235,6 +235,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
//
|
||||
aTimer.Stop();
|
||||
//
|
||||
BOPTest::ReportAlerts(aChecker);
|
||||
//
|
||||
iErr=aChecker.HasErrors();
|
||||
//
|
||||
const BOPDS_DS& aDS=*(aChecker.PDS());
|
||||
|
@@ -1888,6 +1888,8 @@ Standard_Boolean GetFaceDir(const TopoDS_Edge& aE,
|
||||
bFound = BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
(aE, aF, aT, aDt, aPx, aDN, theContext);
|
||||
aProjPL.Perform(aPx);
|
||||
Standard_ASSERT_RETURN(aProjPL.IsDone(),
|
||||
"GetFaceDir: Project point on plane is failed", Standard_False);
|
||||
aPx = aProjPL.NearestPoint();
|
||||
gp_Vec aVec(aP, aPx);
|
||||
aDB.SetXYZ(aVec.XYZ());
|
||||
|
@@ -2865,7 +2865,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
|
||||
const Standard_Boolean GlobalEnlargeVfirst,
|
||||
const Standard_Boolean GlobalEnlargeVlast)
|
||||
{
|
||||
const Standard_Real coeff = 4.;
|
||||
const Standard_Real coeff = 2.; //4.;
|
||||
const Standard_Real TolApex = 1.e-5;
|
||||
|
||||
Standard_Boolean SurfaceChange = Standard_False;
|
||||
@@ -3248,7 +3248,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
||||
const Standard_Boolean UpdatePCurve,
|
||||
const Standard_Boolean enlargeU,
|
||||
const Standard_Boolean enlargeVfirst,
|
||||
const Standard_Boolean enlargeVlast)
|
||||
const Standard_Boolean enlargeVlast,
|
||||
const Standard_Boolean UseInfini)
|
||||
{
|
||||
//---------------------------
|
||||
// extension de la geometrie.
|
||||
@@ -3270,8 +3271,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
|
||||
}
|
||||
|
||||
S->Bounds (US1,US2,VS1,VS2);
|
||||
UU1 = VV1 = - TheInfini;
|
||||
UU2 = VV2 = TheInfini;
|
||||
if (UseInfini)
|
||||
{
|
||||
UU1 = VV1 = - TheInfini;
|
||||
UU2 = VV2 = TheInfini;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real FaceDU = UF2 - UF1;
|
||||
Standard_Real FaceDV = VF2 - VF1;
|
||||
UU1 = UF1 - FaceDU;
|
||||
UU2 = UF2 + FaceDU;
|
||||
VV1 = VF1 - FaceDV;
|
||||
VV2 = VF2 + FaceDV;
|
||||
}
|
||||
|
||||
if (CanExtentSurface) {
|
||||
SurfaceChange = EnlargeGeometry( S, UU1, UU2, VV1, VV2, isVV1degen, isVV2degen, UF1, UF2, VF1, VF2,
|
||||
@@ -4148,4 +4161,4 @@ void PerformPlanes(const TopoDS_Face& theFace1,
|
||||
Standard_Boolean IsInf(const Standard_Real theVal)
|
||||
{
|
||||
return (theVal > TheInfini*0.9);
|
||||
}
|
||||
}
|
||||
|
@@ -104,7 +104,14 @@ public:
|
||||
//! if <UpdatePCurve> is TRUE, update the pcurves of the
|
||||
//! edges of <F> on the new surface.if the surface has been changed,
|
||||
//! Returns True if The Surface of <NF> has changed.
|
||||
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
|
||||
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
|
||||
TopoDS_Face& NF,
|
||||
const Standard_Boolean ChangeGeom,
|
||||
const Standard_Boolean UpDatePCurve = Standard_False,
|
||||
const Standard_Boolean enlargeU = Standard_True,
|
||||
const Standard_Boolean enlargeVfirst = Standard_True,
|
||||
const Standard_Boolean enlargeVlast = Standard_True,
|
||||
const Standard_Boolean UseInfini = Standard_True);
|
||||
|
||||
Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);
|
||||
|
||||
|
1295
src/BRepOffsetAPI/BRepOffsetAPI_PatchFaces.cxx
Normal file
1295
src/BRepOffsetAPI/BRepOffsetAPI_PatchFaces.cxx
Normal file
File diff suppressed because it is too large
Load Diff
122
src/BRepOffsetAPI/BRepOffsetAPI_PatchFaces.hxx
Normal file
122
src/BRepOffsetAPI/BRepOffsetAPI_PatchFaces.hxx
Normal file
@@ -0,0 +1,122 @@
|
||||
// Created on: 2012-08-06
|
||||
// Created by: jgv@ROLEX
|
||||
// Copyright (c) 2012-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepOffsetAPI_PatchFaces_HeaderFile
|
||||
#define _BRepOffsetAPI_PatchFaces_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_DataMapOfOrientedShapeShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! Describes functions to replace some faces in a shape
|
||||
//! by patches
|
||||
class BRepOffsetAPI_PatchFaces : public BRepBuilderAPI_MakeShape
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! General constructor.
|
||||
Standard_EXPORT BRepOffsetAPI_PatchFaces(const TopoDS_Shape& aShape);
|
||||
|
||||
//! Adds the patch face for the face in the shape.
|
||||
Standard_EXPORT void AddPatchFace (const TopoDS_Face& theFace, const TopoDS_Face& thePatchFace);
|
||||
|
||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void UpdateEdgesAndVertex(const TopoDS_Edge& thePrevEdge,
|
||||
TopoDS_Edge& thePrevNewEdge,
|
||||
const TopoDS_Edge& theCurEdge,
|
||||
TopoDS_Edge& theCurNewEdge,
|
||||
TopoDS_Vertex& theCurVertex,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Face& theNewFace,
|
||||
TopoDS_Face& theBoundedNewFace);
|
||||
|
||||
Standard_EXPORT void PutVertexToEdge(const TopoDS_Vertex& theVertex,
|
||||
//const TopoDS_Vertex& theProVertex,
|
||||
const TopAbs_Orientation theProVertexOrientation,
|
||||
TopoDS_Edge& theEdge,
|
||||
const TopoDS_Edge& theProEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const gp_Pnt2d& Pnt2dOnConstEdge,
|
||||
const Standard_Real theParamOnEdge);
|
||||
|
||||
Standard_EXPORT void ProjectVertexOnNewEdge_2d(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theNewEdge,
|
||||
const TopoDS_Face& theNewFace,
|
||||
Standard_Real& theParamOnConst,
|
||||
Standard_Real& theParam,
|
||||
gp_Pnt& thePntOnConst,
|
||||
gp_Pnt& thePnt,
|
||||
gp_Pnt& thePntSol,
|
||||
gp_Pnt2d& thePnt2d,
|
||||
Standard_Real& theTolReached);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsMoreThan3Edges(const TopoDS_Vertex& theVertex);
|
||||
|
||||
|
||||
TopoDS_Shape myInitialShape;
|
||||
|
||||
TopTools_IndexedDataMapOfShapeShape myFacePatchFace;
|
||||
TopTools_IndexedDataMapOfShapeShape myFaceNewFace;
|
||||
TopTools_DataMapOfShapeShape myNewFaceBoundedFace;
|
||||
TopTools_DataMapOfShapeShape myEdgeNewEdge;
|
||||
//TopTools_DataMapOfOrientedShapeShape myOrientedEdgeNewEdge;
|
||||
TopTools_DataMapOfShapeShape myVertexNewVertex;
|
||||
TopTools_MapOfShape myTangentEdges;
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
|
||||
TopTools_DataMapOfShapeListOfShape myVFmap;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepOffsetAPI_PatchFaces_HeaderFile
|
@@ -27,3 +27,5 @@ BRepOffsetAPI_SequenceOfSequenceOfShape.hxx
|
||||
BRepOffsetAPI_Sewing.hxx
|
||||
BRepOffsetAPI_ThruSections.cxx
|
||||
BRepOffsetAPI_ThruSections.hxx
|
||||
BRepOffsetAPI_PatchFaces.cxx
|
||||
BRepOffsetAPI_PatchFaces.hxx
|
||||
|
@@ -62,6 +62,8 @@
|
||||
#include <DBRep_DrawableShape.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
|
||||
#include <BRepOffsetAPI_PatchFaces.hxx>
|
||||
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <ChFi3d_FilletShape.hxx>
|
||||
|
||||
@@ -2287,6 +2289,36 @@ static Standard_Integer ComputeSimpleOffset(Draw_Interpretor& theCommands,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : patchfaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer patchfaces(Draw_Interpretor& /*di*/,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 5) return 1;
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get(a[2]);
|
||||
if (aShape.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape aLocalFace = DBRep::Get(a[3], TopAbs_FACE);
|
||||
if (aLocalFace.IsNull()) return 1;
|
||||
TopoDS_Face aFace = TopoDS::Face(aLocalFace);
|
||||
|
||||
TopoDS_Shape aLocalNewFace = DBRep::Get(a[4], TopAbs_FACE);
|
||||
if (aLocalNewFace.IsNull()) return 1;
|
||||
TopoDS_Face aNewFace = TopoDS::Face(aLocalNewFace);
|
||||
|
||||
BRepOffsetAPI_PatchFaces Builder(aShape);
|
||||
Builder.AddPatchFace(aFace, aNewFace);
|
||||
Builder.Build();
|
||||
|
||||
TopoDS_Shape Result = Builder.Shape();
|
||||
DBRep::Set(a[1], Result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FeatureCommands
|
||||
//purpose :
|
||||
@@ -2435,4 +2467,7 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
|
||||
theCommands.Add("offsetshapesimple",
|
||||
"offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
|
||||
__FILE__, ComputeSimpleOffset);
|
||||
|
||||
theCommands.Add("patchfaces", "patchfaces res shape face newface",
|
||||
__FILE__,patchfaces,g);
|
||||
}
|
||||
|
@@ -874,6 +874,21 @@ void BRepTools::Clean(const TopoDS_Shape& theShape)
|
||||
|
||||
aBuilder.UpdateFace(aFace, aNullTriangulation);
|
||||
}
|
||||
|
||||
// Iterate over all edges seeking for 3d polygons
|
||||
Handle (Poly_Polygon3D) aNullPoly3d;
|
||||
TopExp_Explorer aEdgeIt (theShape, TopAbs_EDGE);
|
||||
for (; aEdgeIt.More (); aEdgeIt.Next ())
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge (aEdgeIt.Current ());
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle (Poly_Polygon3D) aPoly3d = BRep_Tool::Polygon3D (aEdge, aLoc);
|
||||
if (aPoly3d.IsNull ())
|
||||
continue;
|
||||
|
||||
aBuilder.UpdateEdge (aEdge, aNullPoly3d);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -598,6 +598,13 @@ const TopoDS_Edge& BRepTools_WireExplorer::Current()const
|
||||
//=======================================================================
|
||||
TopAbs_Orientation BRepTools_WireExplorer::Orientation() const
|
||||
{
|
||||
if (myVertex.IsNull()
|
||||
&& !myEdge.IsNull())
|
||||
{
|
||||
// infinite edge
|
||||
return TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
TopoDS_Iterator it(myEdge,Standard_False);
|
||||
while (it.More()) {
|
||||
if (myVertex.IsSame(it.Value()))
|
||||
|
@@ -215,21 +215,21 @@ BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree
|
||||
{
|
||||
const std::pair<int, int> aNode = aQueue.front();
|
||||
|
||||
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, std::get<0> (aNode)));
|
||||
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, std::get<0> (aNode)));
|
||||
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, opencascade::std::get<0> (aNode)));
|
||||
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, opencascade::std::get<0> (aNode)));
|
||||
|
||||
BVH_Vec4i aNodeInfo;
|
||||
if (this->IsOuter (std::get<0> (aNode))) // is leaf node
|
||||
if (this->IsOuter (opencascade::std::get<0> (aNode))) // is leaf node
|
||||
{
|
||||
aNodeInfo = BVH_Vec4i (1 /* leaf flag */,
|
||||
this->BegPrimitive (std::get<0> (aNode)), this->EndPrimitive (std::get<0> (aNode)), std::get<1> (aNode) /* level */);
|
||||
this->BegPrimitive (opencascade::std::get<0> (aNode)), this->EndPrimitive (opencascade::std::get<0> (aNode)), opencascade::std::get<1> (aNode) /* level */);
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_Vector<int> aGrandChildNodes;
|
||||
|
||||
const int aLftChild = Child<0> (std::get<0> (aNode));
|
||||
const int aRghChild = Child<1> (std::get<0> (aNode));
|
||||
const int aLftChild = Child<0> (opencascade::std::get<0> (aNode));
|
||||
const int aRghChild = Child<1> (opencascade::std::get<0> (aNode));
|
||||
if (this->IsOuter (aLftChild)) // is leaf node
|
||||
{
|
||||
aGrandChildNodes.Append (aLftChild);
|
||||
@@ -252,13 +252,13 @@ BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree
|
||||
|
||||
for (int aNodeIdx = 0; aNodeIdx < aGrandChildNodes.Size(); ++aNodeIdx)
|
||||
{
|
||||
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), std::get<1> (aNode) + 1));
|
||||
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), opencascade::std::get<1> (aNode) + 1));
|
||||
}
|
||||
|
||||
aNodeInfo = BVH_Vec4i (0 /* inner flag */,
|
||||
aNbNodes, aGrandChildNodes.Size() - 1, std::get<1> (aNode) /* level */);
|
||||
aNbNodes, aGrandChildNodes.Size() - 1, opencascade::std::get<1> (aNode) /* level */);
|
||||
|
||||
aQBVH->myDepth = Max (aQBVH->myDepth, std::get<1> (aNode) + 1);
|
||||
aQBVH->myDepth = Max (aQBVH->myDepth, opencascade::std::get<1> (aNode) + 1);
|
||||
|
||||
aNbNodes += aGrandChildNodes.Size();
|
||||
}
|
||||
|
@@ -247,7 +247,14 @@ namespace BVH
|
||||
if (Size (theArray) == theCount)
|
||||
{
|
||||
#ifdef _STD_VECTOR_SHRINK
|
||||
|
||||
#if(defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
BVH_ArrayNt aTmpArray(theArray);
|
||||
theArray.swap(aTmpArray);
|
||||
#else
|
||||
theArray.shrink_to_fit();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@@ -222,6 +222,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
|
||||
|
||||
// 2a. Retrieve data from the stream:
|
||||
myRelocTable.Clear();
|
||||
myRelocTable.SetHeaderData(aHeaderData);
|
||||
mySections.Clear();
|
||||
myPAtt.Init();
|
||||
Handle(TDF_Data) aData = new TDF_Data();
|
||||
@@ -248,7 +249,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
|
||||
for (; anIterS.More(); anIterS.Next()) {
|
||||
BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue();
|
||||
if (aCurSection.IsPostRead() == Standard_False) {
|
||||
theIStream.seekg ((streampos) aCurSection.Offset());
|
||||
theIStream.seekg ((std::streamsize)aCurSection.Offset());
|
||||
if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS))
|
||||
ReadShapeSection (aCurSection, theIStream);
|
||||
else
|
||||
@@ -320,7 +321,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
|
||||
for (; aSectIter.More(); aSectIter.Next()) {
|
||||
BinLDrivers_DocumentSection& aCurSection = aSectIter.ChangeValue();
|
||||
if (aCurSection.IsPostRead()) {
|
||||
theIStream.seekg ((streampos) aCurSection.Offset());
|
||||
theIStream.seekg ((std::streamsize)aCurSection.Offset());
|
||||
ReadSection (aCurSection, theDoc, theIStream);
|
||||
}
|
||||
}
|
||||
@@ -531,4 +532,3 @@ Standard_Boolean BinLDrivers_DocumentRetrievalDriver::CheckDocumentVersion(
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -160,7 +160,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
|
||||
const uint64_t theOffset)
|
||||
{
|
||||
const uint64_t aSectionEnd = (uint64_t) theStream.tellp();
|
||||
theStream.seekp(myValue[0]);
|
||||
theStream.seekp((std::streamsize)myValue[0]);
|
||||
myValue[0] = theOffset;
|
||||
myValue[1] = aSectionEnd - theOffset;
|
||||
uint64_t aVal[3] = {
|
||||
@@ -175,7 +175,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
|
||||
#endif
|
||||
|
||||
theStream.write((char *)&aVal[0], 3*sizeof(uint64_t));
|
||||
theStream.seekp(aSectionEnd);
|
||||
theStream.seekp((std::streamsize)aSectionEnd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -429,6 +429,11 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
|
||||
Standard_Integer aObjNb = 1;
|
||||
Standard_Integer aShemaVer = 1;
|
||||
|
||||
// Store the name and version of the application that has created the
|
||||
// document.
|
||||
theData->SetApplicationVersion(theDoc->Application()->Version());
|
||||
theData->SetApplicationName(theDoc->Application()->Name());
|
||||
|
||||
aHeader.einfo += FSD_BinaryFile::WriteInfo (theOStream,
|
||||
aObjNb,
|
||||
BinLDrivers::StorageVersion(),
|
||||
|
49
src/BinObjMgt/BinObjMgt_RRelocationTable.cxx
Normal file
49
src/BinObjMgt/BinObjMgt_RRelocationTable.cxx
Normal file
@@ -0,0 +1,49 @@
|
||||
// Created on: 2017-08-22
|
||||
// Created by: Benjamin BIHLER
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetHeaderData
|
||||
//purpose : getter for the file header data
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Storage_HeaderData)& BinObjMgt_RRelocationTable::GetHeaderData() const
|
||||
{
|
||||
return myHeaderData;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetHeaderData
|
||||
//purpose : setter for the file header data
|
||||
//=======================================================================
|
||||
|
||||
void BinObjMgt_RRelocationTable::SetHeaderData(
|
||||
const Handle(Storage_HeaderData)& theHeaderData)
|
||||
{
|
||||
myHeaderData = theHeaderData;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose : The relocation table is cleared before/after reading in a document.
|
||||
// : In this case the reference to the file header data should also be
|
||||
// : cleared, because it is specific to the document.
|
||||
//=======================================================================
|
||||
void BinObjMgt_RRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
|
||||
{
|
||||
myHeaderData.Nullify();
|
||||
TColStd_DataMapOfIntegerTransient::Clear(doReleaseMemory);
|
||||
}
|
@@ -17,8 +17,36 @@
|
||||
#define _BinObjMgt_RRelocationTable_HeaderFile
|
||||
|
||||
#include <TColStd_DataMapOfIntegerTransient.hxx>
|
||||
#include <Storage_HeaderData.hxx>
|
||||
|
||||
typedef TColStd_DataMapOfIntegerTransient BinObjMgt_RRelocationTable;
|
||||
//! Retrieval relocation table is modeled as a child class of
|
||||
//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
|
||||
//! header section. With that attribute drivers have access to the file header
|
||||
//! section.
|
||||
class BinObjMgt_RRelocationTable : public TColStd_DataMapOfIntegerTransient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Returns a handle to the header data of the file that is begin read
|
||||
Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
|
||||
|
||||
//! Sets the storage header data.
|
||||
//!
|
||||
//! @param theHeaderData header data of the file that is begin read
|
||||
Standard_EXPORT void SetHeaderData(
|
||||
const Handle(Storage_HeaderData)& theHeaderData);
|
||||
|
||||
Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Handle(Storage_HeaderData) myHeaderData;
|
||||
};
|
||||
|
||||
#endif // _BinObjMgt_RRelocationTable_HeaderFile
|
||||
|
@@ -7,5 +7,6 @@ BinObjMgt_PExtChar.hxx
|
||||
BinObjMgt_PInteger.hxx
|
||||
BinObjMgt_PReal.hxx
|
||||
BinObjMgt_PShortReal.hxx
|
||||
BinObjMgt_RRelocationTable.cxx
|
||||
BinObjMgt_RRelocationTable.hxx
|
||||
BinObjMgt_SRelocationTable.hxx
|
||||
|
@@ -103,3 +103,25 @@ void CDM_Application::EndOfUpdate
|
||||
message+=aDocument->Presentation();
|
||||
Write(message.ToExtString());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose : returns the application name
|
||||
//=======================================================================
|
||||
|
||||
TCollection_ExtendedString CDM_Application::Name() const
|
||||
{
|
||||
// Default: empty
|
||||
return TCollection_ExtendedString();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Version
|
||||
//purpose : returns the application version
|
||||
//=======================================================================
|
||||
|
||||
TCollection_AsciiString CDM_Application::Version() const
|
||||
{
|
||||
// Default: empty
|
||||
return TCollection_AsciiString();
|
||||
}
|
||||
|
@@ -24,12 +24,14 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_ExtString.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
class CDM_Reference;
|
||||
class CDM_MetaData;
|
||||
class CDM_Document;
|
||||
class Resource_Manager;
|
||||
class CDM_MessageDriver;
|
||||
class TCollection_ExtendedString;
|
||||
|
||||
|
||||
class CDM_Application;
|
||||
@@ -60,6 +62,11 @@ public:
|
||||
//! writes the string in the application MessagerDriver.
|
||||
Standard_EXPORT void Write (const Standard_ExtString aString);
|
||||
|
||||
//! Returns the application name.
|
||||
Standard_EXPORT virtual TCollection_ExtendedString Name() const;
|
||||
|
||||
//! Returns the application version.
|
||||
Standard_EXPORT virtual TCollection_AsciiString Version() const;
|
||||
|
||||
friend class CDM_Reference;
|
||||
friend class CDM_MetaData;
|
||||
|
@@ -34,6 +34,14 @@ IMPLEMENT_STANDARD_RTTIEXT(Cocoa_Window,Aspect_Window)
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
//
|
||||
#else
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
|
||||
// replacements for macOS versions before 10.12
|
||||
#define NSWindowStyleMaskResizable NSResizableWindowMask
|
||||
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
||||
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||
#endif
|
||||
|
||||
static Standard_Integer getScreenBottom()
|
||||
{
|
||||
Cocoa_LocalPool aLocalPool;
|
||||
@@ -95,7 +103,7 @@ Cocoa_Window::Cocoa_Window (const Standard_CString theTitle,
|
||||
myYBottom = myYTop + thePxHeight;
|
||||
|
||||
Cocoa_LocalPool aLocalPool;
|
||||
NSUInteger aWinStyle = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
|
||||
NSUInteger aWinStyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;
|
||||
NSRect aRectNs = NSMakeRect (float(myXLeft), float(myYTop), float(thePxWidth), float(thePxHeight));
|
||||
myHWindow = [[NSWindow alloc] initWithContentRect: aRectNs
|
||||
styleMask: aWinStyle
|
||||
|
@@ -18,6 +18,25 @@
|
||||
#include <Draw_Window.hxx>
|
||||
#include <Cocoa_LocalPool.hxx>
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
|
||||
// replacements for macOS versions before 10.12
|
||||
#define NSEventTypeLeftMouseDown NSLeftMouseDown
|
||||
#define NSEventTypeRightMouseDown NSRightMouseDown
|
||||
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
|
||||
#define NSEventTypeMouseMoved NSMouseMoved
|
||||
|
||||
#define NSEventMaskLeftMouseDragged NSLeftMouseDraggedMask
|
||||
#define NSEventMaskMouseMoved NSMouseMovedMask
|
||||
#define NSEventMaskLeftMouseDown NSLeftMouseDownMask
|
||||
#define NSEventMaskRightMouseDown NSRightMouseDownMask
|
||||
|
||||
#define NSWindowStyleMaskResizable NSResizableWindowMask
|
||||
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
||||
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||
|
||||
#define NSCompositingOperationSourceOver NSCompositeSourceOver
|
||||
#endif
|
||||
|
||||
@interface Draw_CocoaView : NSView
|
||||
{
|
||||
NSImage* myImage;
|
||||
@@ -53,7 +72,7 @@
|
||||
|
||||
[myImage drawInRect: aBounds
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
operation: NSCompositingOperationSourceOver
|
||||
fraction: 1
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
@@ -199,7 +218,7 @@ void Draw_Window::Init (const Standard_Integer& theXLeft, const Standard_Integer
|
||||
if (myWindow == NULL)
|
||||
{
|
||||
NSRect aRectNs = NSMakeRect (theXLeft, anYTop, theWidth, theHeight);
|
||||
NSUInteger aWinStyle = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
|
||||
NSUInteger aWinStyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;
|
||||
|
||||
myWindow = [[NSWindow alloc] initWithContentRect: aRectNs
|
||||
styleMask: aWinStyle
|
||||
@@ -580,11 +599,11 @@ void GetNextEvent (Standard_Boolean theWait,
|
||||
{
|
||||
Cocoa_LocalPool aLocalPool;
|
||||
|
||||
unsigned int anEventMatchMask = NSLeftMouseDownMask | NSRightMouseDownMask;
|
||||
unsigned int anEventMatchMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown;
|
||||
|
||||
if (!theWait)
|
||||
{
|
||||
anEventMatchMask = anEventMatchMask | NSMouseMovedMask | NSLeftMouseDraggedMask;
|
||||
anEventMatchMask = anEventMatchMask | NSEventMaskMouseMoved | NSEventMaskLeftMouseDragged;
|
||||
Draw_IsInZoomingMode = Standard_True;
|
||||
}
|
||||
|
||||
@@ -604,15 +623,15 @@ void GetNextEvent (Standard_Boolean theWait,
|
||||
|
||||
NSEventType anEventType = [anEvent type];
|
||||
|
||||
if (anEventType == NSLeftMouseDown)
|
||||
if (anEventType == NSEventTypeLeftMouseDown)
|
||||
{
|
||||
theButton = 1;
|
||||
}
|
||||
else if (anEventType == NSRightMouseDown)
|
||||
else if (anEventType == NSEventTypeRightMouseDown)
|
||||
{
|
||||
theButton = 3;
|
||||
}
|
||||
else if ((anEventType == NSMouseMoved || anEventType == NSLeftMouseDragged) && !theWait)
|
||||
else if ((anEventType == NSEventTypeMouseMoved || anEventType == NSEventTypeLeftMouseDragged) && !theWait)
|
||||
{
|
||||
theButton = 0;
|
||||
}
|
||||
|
@@ -800,20 +800,29 @@ proc testdiff {dir1 dir2 args} {
|
||||
|
||||
# Procedure to check data file before adding it to repository
|
||||
help testfile {
|
||||
Check data file and prepare it for putting to test data files repository.
|
||||
Use: testfile [filelist]
|
||||
Checks specified data files for putting them into the test data files repository.
|
||||
|
||||
Use: testfile filelist
|
||||
|
||||
Will report if:
|
||||
- data file (non-binary) is in DOS encoding (CR/LF)
|
||||
- same data file (with same or another name) already exists in the repository
|
||||
- another file with the same name already exists
|
||||
Note that names are assumed to be case-insensitive (for Windows).
|
||||
Note that names are considered to be case-insensitive (for compatibility
|
||||
with Windows).
|
||||
|
||||
Unless the file is already in the repository, tries to load it, reports
|
||||
the recognized file format, file size, number of faces and edges in the
|
||||
loaded shape (if any), and makes snapshot (in the temporary directory).
|
||||
loaded shape (if any), information contained its triangulation, and makes
|
||||
snapshot (in the temporary directory).
|
||||
|
||||
Finally it advises whether the file should be put to public section of the
|
||||
repository.
|
||||
|
||||
Use: testfile -check
|
||||
|
||||
If "-check" is given as an argument, then procedure will check files already
|
||||
located in the repository (for possible duplicates and for DOS encoding).
|
||||
}
|
||||
proc testfile {filelist} {
|
||||
global env
|
||||
@@ -823,8 +832,11 @@ proc testfile {filelist} {
|
||||
error "Environment variable CSF_TestDataPath must be defined!"
|
||||
}
|
||||
|
||||
set checkrepo f
|
||||
if { "$filelist" == "-check" } { set checkrepo t }
|
||||
|
||||
# build registry of existing data files (name -> path) and (size -> path)
|
||||
puts "Checking available test data files..."
|
||||
puts "Collecting info on test data files repository..."
|
||||
foreach dir [_split_path $env(CSF_TestDataPath)] {
|
||||
while {[llength $dir] != 0} {
|
||||
set curr [lindex $dir 0]
|
||||
@@ -833,89 +845,143 @@ proc testfile {filelist} {
|
||||
foreach file [glob -nocomplain -directory $curr -type f *] {
|
||||
set name [file tail $file]
|
||||
set name_lower [string tolower $name]
|
||||
set size [file size $file]
|
||||
|
||||
# check that the file is not in DOS encoding
|
||||
if { [_check_dos_encoding $file] } {
|
||||
puts "Warning: file $file is in DOS encoding; was this intended?"
|
||||
}
|
||||
_check_file_format $file
|
||||
|
||||
# check if file with the same name is present twice or more
|
||||
if { [info exists names($name_lower)] } {
|
||||
puts "Error: more than one file with name $name is present in the repository:"
|
||||
if { [_diff_files $file $names($name_lower)] } {
|
||||
puts "(files are different by content)"
|
||||
} else {
|
||||
puts "(files are same by content)"
|
||||
if { $checkrepo } {
|
||||
if { [_check_dos_encoding $file] } {
|
||||
puts "Warning: file $file is in DOS encoding; was this intended?"
|
||||
}
|
||||
puts "--> $file"
|
||||
puts "--> $names($name_lower)"
|
||||
continue
|
||||
}
|
||||
_check_file_format $file
|
||||
|
||||
# check if file with the same name is present twice or more
|
||||
if { [info exists names($name_lower)] } {
|
||||
puts "Error: more than one file with name $name is present in the repository:"
|
||||
if { [_diff_files $file $names($name_lower)] } {
|
||||
puts "(files are different by content)"
|
||||
} else {
|
||||
puts "(files are same by content)"
|
||||
}
|
||||
puts "--> $file"
|
||||
puts "--> $names($name_lower)"
|
||||
continue
|
||||
}
|
||||
|
||||
# check if file with the same content exists
|
||||
set size [file size $file]
|
||||
if { [info exists sizes($size)] } {
|
||||
foreach other $sizes($size) {
|
||||
if { ! [_diff_files $file $other] } {
|
||||
puts "Warning: two files with the same content found:"
|
||||
puts "--> $file"
|
||||
puts "--> $other"
|
||||
# check if file with the same content exists
|
||||
if { [info exists sizes($size)] } {
|
||||
foreach other $sizes($size) {
|
||||
if { ! [_diff_files $file $other] } {
|
||||
puts "Warning: two files with the same content found:"
|
||||
puts "--> $file"
|
||||
puts "--> $other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# add the file to the registry
|
||||
set names($name_lower) $file
|
||||
lappend names($name_lower) $file
|
||||
lappend sizes($size) $file
|
||||
}
|
||||
}
|
||||
}
|
||||
if { [llength $filelist] <= 0 } { return }
|
||||
if { $checkrepo || [llength $filelist] <= 0 } { return }
|
||||
|
||||
# check the new files
|
||||
set has_images f
|
||||
puts "Checking new file(s)..."
|
||||
foreach file $filelist {
|
||||
# check for DOS encoding
|
||||
if { [_check_dos_encoding $file] } {
|
||||
puts "$file: Warning: DOS encoding detected"
|
||||
}
|
||||
|
||||
set name [file tail $file]
|
||||
set name_lower [string tolower $name]
|
||||
set found f
|
||||
|
||||
# check for presence of the file with same name
|
||||
if { [info exists names($name_lower)] } {
|
||||
if { [_diff_files $file $names($name_lower)] } {
|
||||
puts "$file: Error: name is already used by existing file\n--> $names($name_lower)"
|
||||
} else {
|
||||
puts "$file: OK: already in the repository \n--> $names($name_lower)"
|
||||
continue
|
||||
set found f
|
||||
foreach other $names($name_lower) {
|
||||
# avoid comparing the file with itself
|
||||
if { [file normalize $file] == [file normalize $other] } {
|
||||
continue
|
||||
}
|
||||
# compare content
|
||||
if { [_diff_files $file $other] } {
|
||||
puts "\n* $file: error\n name is already used by existing file\n --> $other"
|
||||
} else {
|
||||
puts "\n* $file: already present \n --> $other"
|
||||
}
|
||||
set found t
|
||||
break
|
||||
}
|
||||
if { $found } { continue }
|
||||
}
|
||||
|
||||
# get size of the file; if it is in DOS encoding and less than 1 MB,
|
||||
# estimate also its size in UNIX encoding to be able to find same
|
||||
# file if already present but in UNIX encoding
|
||||
set sizeact [file size $file]
|
||||
set sizeunx ""
|
||||
set isdos [_check_dos_encoding $file]
|
||||
if { $isdos && $sizeact < 10000000 } {
|
||||
set fd [open $file r]
|
||||
fconfigure $fd -translation crlf
|
||||
set sizeunx [string length [read $fd]]
|
||||
close $fd
|
||||
}
|
||||
|
||||
# check if file with the same content exists
|
||||
set size [file size $file]
|
||||
if { [info exists sizes($size)] } {
|
||||
set found f
|
||||
foreach size "$sizeact $sizeunx" {
|
||||
if { [info exists sizes($size)] } {
|
||||
foreach other $sizes($size) {
|
||||
# avoid comparing the file with itself
|
||||
if { [file normalize $file] == [file normalize $other] } {
|
||||
continue
|
||||
}
|
||||
# compare content
|
||||
if { ! [_diff_files $file $other] } {
|
||||
puts "$file: OK: the same file is already present under name [file tail $other]\n--> $other"
|
||||
puts "\n* $file: duplicate \n already present under name [file tail $other]\n --> $other"
|
||||
set found t
|
||||
break
|
||||
}
|
||||
}
|
||||
if { $found } { continue }
|
||||
if { $found } { break }
|
||||
}
|
||||
}
|
||||
if { $found } { continue }
|
||||
|
||||
# file is not present yet, so to be analyzed
|
||||
puts "\n* $file: new file"
|
||||
|
||||
# add the file to the registry as if it were added to the repository,
|
||||
# to report possible duplicates among the currently processed files
|
||||
lappend names($name_lower) $file
|
||||
if { "$sizeunx" != "" } {
|
||||
lappend sizes($sizeunx) $file
|
||||
} else {
|
||||
lappend sizes($sizeact) $file
|
||||
}
|
||||
|
||||
# first of all, complain if it is in DOS encoding
|
||||
if { $isdos } {
|
||||
puts " Warning: DOS encoding detected, consider converting to"
|
||||
puts " UNIX unless DOS line ends are needed for the test"
|
||||
}
|
||||
|
||||
# try to read the file
|
||||
set format [_check_file_format $file]
|
||||
if { [catch {uplevel load_data_file $file $format a}] } {
|
||||
puts "$file: Error: Cannot read as $format file"
|
||||
puts " Warning: Cannot read as $format file"
|
||||
continue
|
||||
}
|
||||
|
||||
# warn if shape contains triangulation
|
||||
pload MODELING
|
||||
if { "$format" != "STL" &&
|
||||
[regexp {contains\s+([0-9]+)\s+triangles} [uplevel trinfo a] res nbtriangles] &&
|
||||
$nbtriangles != 0 } {
|
||||
puts " Warning: shape contains triangulation ($nbtriangles triangles),"
|
||||
puts " consider removing them unless they are needed for the test!"
|
||||
}
|
||||
|
||||
# get number of faces and edges
|
||||
set edges 0
|
||||
set faces 0
|
||||
@@ -928,16 +994,10 @@ proc testfile {filelist} {
|
||||
set dir public
|
||||
} else {
|
||||
set dir private
|
||||
# check if one of names of that file corresponds to typical name for
|
||||
# MDTV bugs or has extension .rle, this should be old model
|
||||
if { [regexp -nocase {.*(cts|ats|pro|buc|ger|fra|usa|uki)[0-9]+.*} $name] ||
|
||||
[regexp -nocase {[.]rle\y} $name] } {
|
||||
set dir old
|
||||
}
|
||||
}
|
||||
|
||||
# add stats
|
||||
puts "$file: $format size=[expr $size / 1024] KiB, nbfaces=$faces, nbedges=$edges -> $dir"
|
||||
puts " $format size=[expr $size / 1024] KiB, nbfaces=$faces, nbedges=$edges -> $dir"
|
||||
|
||||
set tmpdir [_get_temp_dir]
|
||||
file mkdir $tmpdir/$dir
|
||||
@@ -945,6 +1005,7 @@ proc testfile {filelist} {
|
||||
# make snapshot
|
||||
pload AISV
|
||||
uplevel vdisplay a
|
||||
uplevel vsetdispmode 1
|
||||
uplevel vfit
|
||||
uplevel vzfit
|
||||
uplevel vdump $tmpdir/$dir/[file rootname [file tail $file]].png
|
||||
@@ -1517,7 +1578,7 @@ proc _html_highlight {status line} {
|
||||
|
||||
# Internal procedure to generate HTML page presenting log of the tests
|
||||
# execution in tabular form, with links to reports on individual cases
|
||||
proc _log_html_summary {logdir log totals regressions improvements total_time} {
|
||||
proc _log_html_summary {logdir log totals regressions improvements skipped total_time} {
|
||||
global _test_case_regexp
|
||||
|
||||
# create missing directories as needed
|
||||
@@ -1564,7 +1625,7 @@ proc _log_html_summary {logdir log totals regressions improvements total_time} {
|
||||
}
|
||||
|
||||
# print regressions and improvements
|
||||
foreach featured [list $regressions $improvements] {
|
||||
foreach featured [list $regressions $improvements $skipped] {
|
||||
if { [llength $featured] <= 1 } { continue }
|
||||
set status [string trim [lindex $featured 0] { :}]
|
||||
puts $fd "<h2>$status</h2>"
|
||||
@@ -1671,13 +1732,16 @@ proc _log_summarize {logdir log {total_time {}}} {
|
||||
set totals {}
|
||||
set improvements {Improvements:}
|
||||
set regressions {Failed:}
|
||||
set skipped {Skipped:}
|
||||
if { [info exists stat] } {
|
||||
foreach status [lsort [array names stat]] {
|
||||
lappend totals [list [llength $stat($status)] $status]
|
||||
|
||||
# separately count improvements (status starting with IMP) and regressions (all except IMP, OK, BAD, and SKIP)
|
||||
# separately count improvements (status starting with IMP), skipped (status starting with SKIP) and regressions (all except IMP, OK, BAD, and SKIP)
|
||||
if { [regexp -nocase {^IMP} $status] } {
|
||||
eval lappend improvements $stat($status)
|
||||
} elseif { [regexp -nocase {^SKIP} $status] } {
|
||||
eval lappend skipped $stat($status)
|
||||
} elseif { $status != "OK" && ! [regexp -nocase {^BAD} $status] && ! [regexp -nocase {^SKIP} $status] } {
|
||||
eval lappend regressions $stat($status)
|
||||
}
|
||||
@@ -1692,6 +1756,9 @@ proc _log_summarize {logdir log {total_time {}}} {
|
||||
if { [llength $regressions] > 1 } {
|
||||
_log_and_puts log [join $regressions "\n "]
|
||||
}
|
||||
if { [llength $skipped] > 1 } {
|
||||
_log_and_puts log [join $skipped "\n "]
|
||||
}
|
||||
if { [llength $improvements] == 1 && [llength $regressions] == 1 } {
|
||||
_log_and_puts log "No regressions"
|
||||
}
|
||||
@@ -1701,7 +1768,7 @@ proc _log_summarize {logdir log {total_time {}}} {
|
||||
|
||||
# save log to files
|
||||
if { $logdir != "" } {
|
||||
_log_html_summary $logdir $log $totals $regressions $improvements $total_time
|
||||
_log_html_summary $logdir $log $totals $regressions $improvements $skipped $total_time
|
||||
_log_save $logdir/tests.log [join $log "\n"] "Tests summary"
|
||||
}
|
||||
|
||||
@@ -2340,7 +2407,7 @@ proc load_data_file {file format shape} {
|
||||
DRAW { uplevel restore $file $shape }
|
||||
IGES { pload XSDRAW; uplevel igesbrep $file $shape * }
|
||||
STEP { pload XSDRAW; uplevel stepread $file __a *; uplevel renamevar __a_1 $shape }
|
||||
STL { pload XSDRAW; uplevel readstl $shape $file }
|
||||
STL { pload XSDRAW; uplevel readstl $shape $file triangulation }
|
||||
default { error "Cannot read $format file $file" }
|
||||
}
|
||||
}
|
||||
|
@@ -89,14 +89,14 @@ public:
|
||||
//! isSenseMarker indicates whether to render the
|
||||
//! sense glyph (arrow) for curves or not
|
||||
Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Geom_Geometry)& G, const Standard_Boolean isSenseMarker = Standard_True);
|
||||
template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename std::enable_if<std::is_base_of<Geom_Geometry, T>::value>::type * = 0) { Set (Name, (const Handle(Geom_Geometry)&)Arg); }
|
||||
template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename opencascade::std::enable_if<opencascade::std::is_base_of<Geom_Geometry, T>::value>::type * = 0) { Set (Name, (const Handle(Geom_Geometry)&)Arg); }
|
||||
|
||||
//! Sets <C> in the variable <Name>. Overwrite the
|
||||
//! variable if already set.
|
||||
//! isSenseMarker indicates whether to render the
|
||||
//! sense glyph (arrow) for curves or not
|
||||
Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Geom2d_Curve)& C, const Standard_Boolean isSenseMarker = Standard_True);
|
||||
template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename std::enable_if<std::is_base_of<Geom2d_Curve, T>::value>::type * = 0) { Set (Name, (const Handle(Geom2d_Curve)&)Arg); }
|
||||
template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename opencascade::std::enable_if<opencascade::std::is_base_of<Geom2d_Curve, T>::value>::type * = 0) { Set (Name, (const Handle(Geom2d_Curve)&)Arg); }
|
||||
|
||||
//! Sets <T> in the variable <Name>. Overwrite the
|
||||
//! variable if already set.
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,241 +17,59 @@
|
||||
#ifndef _FSD_CmpFile_HeaderFile
|
||||
#define _FSD_CmpFile_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <FSD_FStream.hxx>
|
||||
#include <FSD_File.hxx>
|
||||
#include <Storage_BaseDriver.hxx>
|
||||
#include <Storage_Error.hxx>
|
||||
#include <Storage_OpenMode.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Storage_Position.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <TColStd_SequenceOfExtendedString.hxx>
|
||||
#include <Standard_Character.hxx>
|
||||
#include <Standard_ExtCharacter.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_ShortReal.hxx>
|
||||
#include <Standard_Size.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
class Storage_StreamTypeMismatchError;
|
||||
class Storage_StreamFormatError;
|
||||
class Storage_StreamWriteError;
|
||||
class Storage_StreamExtCharParityError;
|
||||
class TCollection_AsciiString;
|
||||
class TCollection_ExtendedString;
|
||||
class Storage_BaseDriver;
|
||||
|
||||
|
||||
|
||||
class FSD_CmpFile : public Storage_BaseDriver
|
||||
class FSD_CmpFile : public FSD_File
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT FSD_CmpFile();
|
||||
|
||||
Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsEnd();
|
||||
|
||||
//! return position in the file. Return -1 upon error.
|
||||
Standard_EXPORT Storage_Position Tell();
|
||||
|
||||
Standard_EXPORT static Storage_Error IsGoodFileType (const TCollection_AsciiString& aName);
|
||||
|
||||
|
||||
Standard_EXPORT Storage_Error Open(const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
|
||||
|
||||
Standard_EXPORT static Storage_Error IsGoodFileType(const TCollection_AsciiString& aName);
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteInfoSection();
|
||||
|
||||
Standard_EXPORT void WriteInfo (const Standard_Integer nbObj, const TCollection_AsciiString& dbVersion, const TCollection_AsciiString& date, const TCollection_AsciiString& schemaName, const TCollection_AsciiString& schemaVersion, const TCollection_ExtendedString& appName, const TCollection_AsciiString& appVersion, const TCollection_ExtendedString& objectType, const TColStd_SequenceOfAsciiString& userInfo);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteInfoSection();
|
||||
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadInfoSection();
|
||||
|
||||
Standard_EXPORT void ReadInfo (Standard_Integer& nbObj, TCollection_AsciiString& dbVersion, TCollection_AsciiString& date, TCollection_AsciiString& schemaName, TCollection_AsciiString& schemaVersion, TCollection_ExtendedString& appName, TCollection_AsciiString& appVersion, TCollection_ExtendedString& objectType, TColStd_SequenceOfAsciiString& userInfo);
|
||||
|
||||
Standard_EXPORT void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadInfoSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteCommentSection();
|
||||
|
||||
Standard_EXPORT void WriteComment (const TColStd_SequenceOfExtendedString& userComments);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteCommentSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadCommentSection();
|
||||
|
||||
Standard_EXPORT void ReadComment (TColStd_SequenceOfExtendedString& userComments);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadCommentSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteTypeSection();
|
||||
|
||||
Standard_EXPORT void SetTypeSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteTypeSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadTypeSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer TypeSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadTypeSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteRootSection();
|
||||
|
||||
Standard_EXPORT void SetRootSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteRootSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadRootSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer RootSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadRootSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteRefSection();
|
||||
|
||||
Standard_EXPORT void SetRefSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteRefSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadRefSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer RefSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadRefSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteDataSection();
|
||||
|
||||
Standard_EXPORT void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType);
|
||||
|
||||
|
||||
Standard_EXPORT void WritePersistentObjectHeader(const Standard_Integer aRef, const Standard_Integer aType);
|
||||
|
||||
Standard_EXPORT void BeginWritePersistentObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void BeginWriteObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void EndWriteObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void EndWritePersistentObjectData();
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteDataSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadDataSection();
|
||||
|
||||
Standard_EXPORT void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType);
|
||||
|
||||
|
||||
Standard_EXPORT void ReadPersistentObjectHeader(Standard_Integer& aRef, Standard_Integer& aType);
|
||||
|
||||
Standard_EXPORT void BeginReadPersistentObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void BeginReadObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void EndReadObjectData();
|
||||
|
||||
|
||||
Standard_EXPORT void EndReadPersistentObjectData();
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadDataSection();
|
||||
|
||||
Standard_EXPORT void SkipObject();
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutReference (const Standard_Integer aValue);
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutCharacter (const Standard_Character aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Character aValue)
|
||||
{
|
||||
return PutCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
|
||||
{
|
||||
return PutExtCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutInteger (const Standard_Integer aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Integer aValue)
|
||||
{
|
||||
return PutInteger(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Boolean aValue)
|
||||
{
|
||||
return PutBoolean(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutReal (const Standard_Real aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Real aValue)
|
||||
{
|
||||
return PutReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
|
||||
{
|
||||
return PutShortReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetReference (Standard_Integer& aValue);
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetCharacter (Standard_Character& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Character& aValue)
|
||||
{
|
||||
return GetCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
|
||||
{
|
||||
return GetExtCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetInteger (Standard_Integer& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Integer& aValue)
|
||||
{
|
||||
return GetInteger(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
|
||||
{
|
||||
return GetBoolean(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetReal (Standard_Real& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Real& aValue)
|
||||
{
|
||||
return GetReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
{
|
||||
return GetShortReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_Error Close();
|
||||
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~FSD_CmpFile()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
~FSD_CmpFile()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
Standard_EXPORT static Standard_CString MagicNumber();
|
||||
|
||||
@@ -259,36 +77,19 @@ Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
//! read from the current position to the end of line.
|
||||
Standard_EXPORT void ReadLine (TCollection_AsciiString& buffer);
|
||||
|
||||
//! read from the current position to the next white space or end of line.
|
||||
Standard_EXPORT void ReadWord (TCollection_AsciiString& buffer);
|
||||
|
||||
Standard_EXPORT void ReadLine(TCollection_AsciiString& buffer);
|
||||
|
||||
//! read extended chars (unicode) from the current position to the end of line.
|
||||
Standard_EXPORT void ReadExtendedLine (TCollection_ExtendedString& buffer);
|
||||
|
||||
Standard_EXPORT void ReadExtendedLine(TCollection_ExtendedString& buffer);
|
||||
|
||||
//! write from the current position to the end of line.
|
||||
Standard_EXPORT void WriteExtendedLine (const TCollection_ExtendedString& buffer);
|
||||
|
||||
//! read <rsize> character from the current position.
|
||||
Standard_EXPORT void ReadChar (TCollection_AsciiString& buffer, const Standard_Size rsize);
|
||||
|
||||
Standard_EXPORT void WriteExtendedLine(const TCollection_ExtendedString& buffer);
|
||||
|
||||
//! read from the first none space character position to the end of line.
|
||||
Standard_EXPORT void ReadString (TCollection_AsciiString& buffer);
|
||||
|
||||
Standard_EXPORT void FlushEndOfLine();
|
||||
|
||||
Standard_EXPORT Storage_Error FindTag (const Standard_CString aTag);
|
||||
Standard_EXPORT void ReadString(TCollection_AsciiString& buffer);
|
||||
|
||||
private:
|
||||
|
||||
void RaiseError (const Handle(Standard_Type)& theFailure);
|
||||
|
||||
private:
|
||||
|
||||
FSD_FStream myStream;
|
||||
};
|
||||
|
||||
#endif // _FSD_CmpFile_HeaderFile
|
||||
|
@@ -28,7 +28,7 @@ const Standard_CString MAGICNUMBER = "FSDFILE";
|
||||
const Standard_CString ENDOFNORMALEXTENDEDSECTION = "BEGIN_REF_SECTION";
|
||||
const Standard_Integer SIZEOFNORMALEXTENDEDSECTION = 16;
|
||||
|
||||
//#define USEOSDREAL 1
|
||||
#define USEOSDREAL 1
|
||||
|
||||
//=======================================================================
|
||||
//function : FSD_File
|
||||
@@ -175,20 +175,6 @@ void FSD_File::FlushEndOfLine()
|
||||
{
|
||||
TCollection_AsciiString aDummy;
|
||||
ReadLine (aDummy); // flush is nothing more than to read till the line-break
|
||||
/* static char Buffer[8192];
|
||||
char c;
|
||||
Standard_Boolean IsEnd = Standard_False;
|
||||
|
||||
while (!IsEnd && !FSD_File::IsEnd()) {
|
||||
Buffer[0] = '\0';
|
||||
myStream.get(Buffer,8192,'\n');
|
||||
|
||||
if (myStream.get(c) && c != '\n') {
|
||||
}
|
||||
else {
|
||||
IsEnd = Standard_True;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -609,7 +595,7 @@ Storage_BaseDriver& FSD_File::GetShortReal(Standard_ShortReal& aValue)
|
||||
if (!(myStream >> realbuffer)) throw Storage_StreamTypeMismatchError();
|
||||
if (!OSD::CStringToReal(realbuffer,r)) throw Storage_StreamTypeMismatchError();
|
||||
|
||||
aValue = r;
|
||||
aValue = (Standard_ShortReal)r;
|
||||
|
||||
return *this;
|
||||
#else
|
||||
|
@@ -68,194 +68,195 @@ public:
|
||||
//! The function returns Storage_VSOk if the file
|
||||
//! is opened correctly, or any other value of the
|
||||
//! Storage_Error enumeration which specifies the problem encountered.
|
||||
Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
|
||||
Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsEnd();
|
||||
Standard_EXPORT virtual Standard_Boolean IsEnd();
|
||||
|
||||
//! return position in the file. Return -1 upon error.
|
||||
Standard_EXPORT Storage_Position Tell();
|
||||
Standard_EXPORT virtual Storage_Position Tell();
|
||||
|
||||
Standard_EXPORT static Storage_Error IsGoodFileType (const TCollection_AsciiString& aName);
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteInfoSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteInfoSection();
|
||||
|
||||
Standard_EXPORT void WriteInfo (const Standard_Integer nbObj, const TCollection_AsciiString& dbVersion, const TCollection_AsciiString& date, const TCollection_AsciiString& schemaName, const TCollection_AsciiString& schemaVersion, const TCollection_ExtendedString& appName, const TCollection_AsciiString& appVersion, const TCollection_ExtendedString& objectType, const TColStd_SequenceOfAsciiString& userInfo);
|
||||
Standard_EXPORT virtual void WriteInfo (const Standard_Integer nbObj, const TCollection_AsciiString& dbVersion, const TCollection_AsciiString& date, const TCollection_AsciiString& schemaName, const TCollection_AsciiString& schemaVersion, const TCollection_ExtendedString& appName, const TCollection_AsciiString& appVersion, const TCollection_ExtendedString& objectType, const TColStd_SequenceOfAsciiString& userInfo);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteInfoSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteInfoSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadInfoSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadInfoSection();
|
||||
|
||||
Standard_EXPORT void ReadInfo (Standard_Integer& nbObj, TCollection_AsciiString& dbVersion, TCollection_AsciiString& date, TCollection_AsciiString& schemaName, TCollection_AsciiString& schemaVersion, TCollection_ExtendedString& appName, TCollection_AsciiString& appVersion, TCollection_ExtendedString& objectType, TColStd_SequenceOfAsciiString& userInfo);
|
||||
Standard_EXPORT virtual void ReadInfo (Standard_Integer& nbObj, TCollection_AsciiString& dbVersion, TCollection_AsciiString& date, TCollection_AsciiString& schemaName, TCollection_AsciiString& schemaVersion, TCollection_ExtendedString& appName, TCollection_AsciiString& appVersion, TCollection_ExtendedString& objectType, TColStd_SequenceOfAsciiString& userInfo);
|
||||
|
||||
Standard_EXPORT void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
|
||||
Standard_EXPORT virtual void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadInfoSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadInfoSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteCommentSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteCommentSection();
|
||||
|
||||
Standard_EXPORT void WriteComment (const TColStd_SequenceOfExtendedString& userComments);
|
||||
Standard_EXPORT virtual void WriteComment (const TColStd_SequenceOfExtendedString& userComments);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteCommentSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteCommentSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadCommentSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadCommentSection();
|
||||
|
||||
Standard_EXPORT void ReadComment (TColStd_SequenceOfExtendedString& userComments);
|
||||
Standard_EXPORT virtual void ReadComment (TColStd_SequenceOfExtendedString& userComments);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadCommentSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadCommentSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteTypeSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteTypeSection();
|
||||
|
||||
Standard_EXPORT void SetTypeSectionSize (const Standard_Integer aSize);
|
||||
Standard_EXPORT virtual void SetTypeSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName);
|
||||
Standard_EXPORT virtual void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteTypeSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteTypeSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadTypeSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadTypeSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer TypeSectionSize();
|
||||
Standard_EXPORT virtual Standard_Integer TypeSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName);
|
||||
Standard_EXPORT virtual void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadTypeSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadTypeSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteRootSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteRootSection();
|
||||
|
||||
Standard_EXPORT void SetRootSectionSize (const Standard_Integer aSize);
|
||||
Standard_EXPORT virtual void SetRootSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType);
|
||||
Standard_EXPORT virtual void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteRootSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteRootSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadRootSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadRootSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer RootSectionSize();
|
||||
Standard_EXPORT virtual Standard_Integer RootSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
|
||||
Standard_EXPORT virtual void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadRootSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadRootSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteRefSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteRefSection();
|
||||
|
||||
Standard_EXPORT void SetRefSectionSize (const Standard_Integer aSize);
|
||||
Standard_EXPORT virtual void SetRefSectionSize (const Standard_Integer aSize);
|
||||
|
||||
Standard_EXPORT void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum);
|
||||
Standard_EXPORT virtual void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum);
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteRefSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteRefSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadRefSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadRefSection();
|
||||
|
||||
Standard_EXPORT Standard_Integer RefSectionSize();
|
||||
Standard_EXPORT virtual Standard_Integer RefSectionSize();
|
||||
|
||||
Standard_EXPORT void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum);
|
||||
Standard_EXPORT virtual void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum);
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadRefSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadRefSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginWriteDataSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginWriteDataSection();
|
||||
|
||||
Standard_EXPORT void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType);
|
||||
Standard_EXPORT virtual void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType);
|
||||
|
||||
Standard_EXPORT void BeginWritePersistentObjectData();
|
||||
Standard_EXPORT virtual void BeginWritePersistentObjectData();
|
||||
|
||||
Standard_EXPORT void BeginWriteObjectData();
|
||||
Standard_EXPORT virtual void BeginWriteObjectData();
|
||||
|
||||
Standard_EXPORT void EndWriteObjectData();
|
||||
Standard_EXPORT virtual void EndWriteObjectData();
|
||||
|
||||
Standard_EXPORT void EndWritePersistentObjectData();
|
||||
Standard_EXPORT virtual void EndWritePersistentObjectData();
|
||||
|
||||
Standard_EXPORT Storage_Error EndWriteDataSection();
|
||||
Standard_EXPORT virtual Storage_Error EndWriteDataSection();
|
||||
|
||||
Standard_EXPORT Storage_Error BeginReadDataSection();
|
||||
Standard_EXPORT virtual Storage_Error BeginReadDataSection();
|
||||
|
||||
Standard_EXPORT void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType);
|
||||
Standard_EXPORT virtual void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType);
|
||||
|
||||
Standard_EXPORT void BeginReadPersistentObjectData();
|
||||
Standard_EXPORT virtual void BeginReadPersistentObjectData();
|
||||
|
||||
Standard_EXPORT void BeginReadObjectData();
|
||||
Standard_EXPORT virtual void BeginReadObjectData();
|
||||
|
||||
Standard_EXPORT void EndReadObjectData();
|
||||
Standard_EXPORT virtual void EndReadObjectData();
|
||||
|
||||
Standard_EXPORT void EndReadPersistentObjectData();
|
||||
Standard_EXPORT virtual void EndReadPersistentObjectData();
|
||||
|
||||
Standard_EXPORT Storage_Error EndReadDataSection();
|
||||
Standard_EXPORT virtual Storage_Error EndReadDataSection();
|
||||
|
||||
Standard_EXPORT void SkipObject();
|
||||
Standard_EXPORT virtual void SkipObject();
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutReference (const Standard_Integer aValue);
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutReference (const Standard_Integer aValue);
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutCharacter (const Standard_Character aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Character aValue)
|
||||
{
|
||||
return PutCharacter(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutCharacter (const Standard_Character aValue);
|
||||
|
||||
Storage_BaseDriver& operator << (const Standard_Character aValue)
|
||||
{
|
||||
return PutCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
|
||||
{
|
||||
return PutExtCharacter(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
|
||||
{
|
||||
return PutExtCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutInteger (const Standard_Integer aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Integer aValue)
|
||||
{
|
||||
return PutInteger(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutInteger (const Standard_Integer aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Integer aValue)
|
||||
{
|
||||
return PutInteger(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Boolean aValue)
|
||||
{
|
||||
return PutBoolean(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Boolean aValue)
|
||||
{
|
||||
return PutBoolean(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutReal (const Standard_Real aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Real aValue)
|
||||
{
|
||||
return PutReal(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutReal (const Standard_Real aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_Real aValue)
|
||||
{
|
||||
return PutReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
|
||||
{
|
||||
return PutShortReal(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue);
|
||||
Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
|
||||
{
|
||||
return PutShortReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetReference (Standard_Integer& aValue);
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetReference (Standard_Integer& aValue);
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetCharacter (Standard_Character& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Character& aValue)
|
||||
{
|
||||
return GetCharacter(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetCharacter (Standard_Character& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Character& aValue)
|
||||
{
|
||||
return GetCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
|
||||
{
|
||||
return GetExtCharacter(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
|
||||
{
|
||||
return GetExtCharacter(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetInteger (Standard_Integer& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Integer& aValue)
|
||||
{
|
||||
return GetInteger(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetInteger (Standard_Integer& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Integer& aValue)
|
||||
{
|
||||
return GetInteger(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
|
||||
{
|
||||
return GetBoolean(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
|
||||
{
|
||||
return GetBoolean(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetReal (Standard_Real& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Real& aValue)
|
||||
{
|
||||
return GetReal(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetReal (Standard_Real& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_Real& aValue)
|
||||
{
|
||||
return GetReal(aValue);
|
||||
}
|
||||
|
||||
Standard_EXPORT Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
{
|
||||
return GetShortReal(aValue);
|
||||
}
|
||||
Standard_EXPORT virtual Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue);
|
||||
Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
{
|
||||
return GetShortReal(aValue);
|
||||
}
|
||||
|
||||
|
||||
//! Closes the file driven by this driver. This file was
|
||||
@@ -263,7 +264,7 @@ Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
//! The function returns Storage_VSOk if the
|
||||
//! closure is correctly done, or any other value of
|
||||
//! the Storage_Error enumeration which specifies the problem encountered.
|
||||
Standard_EXPORT Storage_Error Close();
|
||||
Standard_EXPORT virtual Storage_Error Close();
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~FSD_File()
|
||||
@@ -274,34 +275,30 @@ Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
|
||||
Standard_EXPORT static Standard_CString MagicNumber();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
|
||||
//! read from the current position to the end of line.
|
||||
Standard_EXPORT void ReadLine (TCollection_AsciiString& buffer);
|
||||
Standard_EXPORT virtual void ReadLine (TCollection_AsciiString& buffer);
|
||||
|
||||
//! read from the current position to the next white space or end of line.
|
||||
Standard_EXPORT void ReadWord (TCollection_AsciiString& buffer);
|
||||
Standard_EXPORT virtual void ReadWord (TCollection_AsciiString& buffer);
|
||||
|
||||
//! read extended chars (unicode) from the current position to the end of line.
|
||||
Standard_EXPORT void ReadExtendedLine (TCollection_ExtendedString& buffer);
|
||||
Standard_EXPORT virtual void ReadExtendedLine (TCollection_ExtendedString& buffer);
|
||||
|
||||
//! write from the current position to the end of line.
|
||||
Standard_EXPORT void WriteExtendedLine (const TCollection_ExtendedString& buffer);
|
||||
Standard_EXPORT virtual void WriteExtendedLine (const TCollection_ExtendedString& buffer);
|
||||
|
||||
//! read <rsize> character from the current position.
|
||||
Standard_EXPORT void ReadChar (TCollection_AsciiString& buffer, const Standard_Size rsize);
|
||||
Standard_EXPORT virtual void ReadChar (TCollection_AsciiString& buffer, const Standard_Size rsize);
|
||||
|
||||
//! read from the first none space character position to the end of line.
|
||||
Standard_EXPORT void ReadString (TCollection_AsciiString& buffer);
|
||||
Standard_EXPORT virtual void ReadString (TCollection_AsciiString& buffer);
|
||||
|
||||
Standard_EXPORT void FlushEndOfLine();
|
||||
|
||||
Standard_EXPORT Storage_Error FindTag (const Standard_CString aTag);
|
||||
|
||||
private:
|
||||
Standard_EXPORT virtual void FlushEndOfLine();
|
||||
|
||||
Standard_EXPORT virtual Storage_Error FindTag (const Standard_CString aTag);
|
||||
|
||||
|
||||
FSD_FStream myStream;
|
||||
|
@@ -265,7 +265,7 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
TopoDS_Face aFaceDraft;
|
||||
myBuilder.MakeFace (aFaceDraft, mySurface, myPrecision);
|
||||
TopoDS_Compound aFaceCompDraft;
|
||||
|
||||
// Get orientation is useless since it doesn't retrieve any in-font information and just computes orientation.
|
||||
// Because it fails in some cases - leave this to ShapeFix.
|
||||
@@ -277,7 +277,7 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
const short anEndIndex = anOutline.contours[aContour];
|
||||
const short aPntsNb = (anEndIndex - aStartIndex) + 1;
|
||||
aStartIndex = anEndIndex + 1;
|
||||
if (aPntsNb < 3)
|
||||
if (aPntsNb < 3 && !myIsSingleLine)
|
||||
{
|
||||
// closed contour can not be constructed from < 3 points
|
||||
continue;
|
||||
@@ -289,7 +289,8 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
gp_XY aPntCurr = readFTVec (aPntList[aPntsNb - 1], myScaleUnits);
|
||||
gp_XY aPntNext = readFTVec (aPntList[0], myScaleUnits);
|
||||
|
||||
Standard_Integer aLinePnts = (FT_CURVE_TAG(aTags[aPntsNb - 1]) == FT_Curve_Tag_On) ? 1 : 0;
|
||||
bool isLineSeg = !myIsSingleLine
|
||||
&& FT_CURVE_TAG(aTags[aPntsNb - 1]) == FT_Curve_Tag_On;
|
||||
gp_XY aPntLine1 = aPntCurr;
|
||||
|
||||
// see http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-6.html
|
||||
@@ -303,10 +304,10 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
// process tags
|
||||
if (FT_CURVE_TAG(aTags[aPntId]) == FT_Curve_Tag_On)
|
||||
{
|
||||
if (aLinePnts < 1)
|
||||
if (!isLineSeg)
|
||||
{
|
||||
aPntLine1 = aPntCurr;
|
||||
aLinePnts = 1;
|
||||
isLineSeg = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -315,7 +316,7 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
if (aLen <= myPrecision)
|
||||
{
|
||||
aPntLine1 = aPntCurr;
|
||||
aLinePnts = 1;
|
||||
isLineSeg = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
}
|
||||
else if (FT_CURVE_TAG(aTags[aPntId]) == FT_Curve_Tag_Conic)
|
||||
{
|
||||
aLinePnts = 0;
|
||||
isLineSeg = false;
|
||||
gp_XY aPntPrev2 = aPntPrev;
|
||||
gp_XY aPntNext2 = aPntNext;
|
||||
|
||||
@@ -378,7 +379,7 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
else if (FT_CURVE_TAG(aTags[aPntId]) == FT_Curve_Tag_Cubic
|
||||
&& FT_CURVE_TAG(aTags[(aPntId + 1) % aPntsNb]) == FT_Curve_Tag_Cubic)
|
||||
{
|
||||
aLinePnts = 0;
|
||||
isLineSeg = false;
|
||||
my4Poles.SetValue (1, aPntPrev);
|
||||
my4Poles.SetValue (2, aPntCurr);
|
||||
my4Poles.SetValue (3, aPntNext);
|
||||
@@ -411,7 +412,8 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
|
||||
const gp_Pnt2d aFirstPnt = aDraft2d->StartPoint();
|
||||
const gp_Pnt2d aLastPnt = aDraft2d->EndPoint();
|
||||
if (!aFirstPnt.IsEqual (aLastPnt, myPrecision))
|
||||
if (!myIsSingleLine
|
||||
&& !aFirstPnt.IsEqual (aLastPnt, myPrecision))
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aLine = GCE2d_MakeSegment (aLastPnt, aFirstPnt);
|
||||
myConcatMaker.Add (aLine, myPrecision);
|
||||
@@ -438,7 +440,8 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
TopExp::Vertices (aWireMaker.Wire(), aFirstV, aLastV);
|
||||
gp_Pnt aFirstPoint = BRep_Tool::Pnt (aFirstV);
|
||||
gp_Pnt aLastPoint = BRep_Tool::Pnt (aLastV);
|
||||
if (!aFirstPoint.IsEqual (aLastPoint, myPrecision))
|
||||
if (!myIsSingleLine
|
||||
&& !aFirstPoint.IsEqual (aLastPoint, myPrecision))
|
||||
{
|
||||
aWireMaker.Add (BRepLib_MakeEdge (aFirstV, aLastV));
|
||||
}
|
||||
@@ -450,31 +453,64 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
}
|
||||
|
||||
TopoDS_Wire aWireDraft = aWireMaker.Wire();
|
||||
//if (anOrient == FT_ORIENTATION_FILL_LEFT)
|
||||
//{
|
||||
// According to the TrueType specification, clockwise contours must be filled
|
||||
aWireDraft.Reverse();
|
||||
//}
|
||||
myBuilder.Add (aFaceDraft, aWireDraft);
|
||||
if (!myIsSingleLine)
|
||||
{
|
||||
//if (anOrient == FT_ORIENTATION_FILL_LEFT)
|
||||
//{
|
||||
// According to the TrueType specification, clockwise contours must be filled
|
||||
aWireDraft.Reverse();
|
||||
//}
|
||||
if (aFaceDraft.IsNull())
|
||||
{
|
||||
myBuilder.MakeFace (aFaceDraft, mySurface, myPrecision);
|
||||
}
|
||||
myBuilder.Add (aFaceDraft, aWireDraft);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aFaceCompDraft.IsNull())
|
||||
{
|
||||
myBuilder.MakeCompound (aFaceCompDraft);
|
||||
}
|
||||
myBuilder.Add (aFaceCompDraft, aWireDraft);
|
||||
}
|
||||
}
|
||||
|
||||
myFixer.Init (aFaceDraft);
|
||||
myFixer.Perform();
|
||||
theShape = myFixer.Result();
|
||||
if (!theShape.IsNull()
|
||||
&& theShape.ShapeType() != TopAbs_FACE)
|
||||
if (!aFaceDraft.IsNull())
|
||||
{
|
||||
// shape fix can not fix orientation within the single call
|
||||
TopoDS_Compound aComp;
|
||||
myBuilder.MakeCompound (aComp);
|
||||
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
myFixer.Init (aFaceDraft);
|
||||
myFixer.Perform();
|
||||
TopoDS_Shape aFixResult = myFixer.Result();
|
||||
if (!aFixResult.IsNull()
|
||||
&& aFixResult.ShapeType() != TopAbs_FACE)
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face (aFaceIter.Current());
|
||||
myFixer.Init (aFace);
|
||||
myFixer.Perform();
|
||||
myBuilder.Add (aComp, myFixer.Result());
|
||||
// shape fix can not fix orientation within the single call
|
||||
if (aFaceCompDraft.IsNull())
|
||||
{
|
||||
myBuilder.MakeCompound (aFaceCompDraft);
|
||||
}
|
||||
for (TopExp_Explorer aFaceIter (aFixResult, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face (aFaceIter.Current());
|
||||
myFixer.Init (aFace);
|
||||
myFixer.Perform();
|
||||
myBuilder.Add (aFaceCompDraft, myFixer.Result());
|
||||
}
|
||||
theShape = aFaceCompDraft;
|
||||
}
|
||||
theShape = aComp;
|
||||
else if (!aFaceCompDraft.IsNull())
|
||||
{
|
||||
myBuilder.Add (aFaceCompDraft, aFixResult);
|
||||
theShape = aFaceCompDraft;
|
||||
}
|
||||
else
|
||||
{
|
||||
theShape = aFixResult;
|
||||
}
|
||||
}
|
||||
else if (!aFaceCompDraft.IsNull())
|
||||
{
|
||||
theShape = aFaceCompDraft;
|
||||
}
|
||||
|
||||
myCache.Bind (theChar, theShape);
|
||||
|
@@ -33,6 +33,7 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
|
||||
myFTFace (NULL),
|
||||
myPointSize (0U),
|
||||
myLoadFlags (FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL),
|
||||
myIsSingleLine(false),
|
||||
myKernAdvance(new FT_Vector()),
|
||||
myUChar (0U)
|
||||
{
|
||||
@@ -118,9 +119,12 @@ bool Font_FTFont::Init (const NCollection_String& theFontName,
|
||||
{
|
||||
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
|
||||
const Handle(TCollection_HAsciiString) aFontName = new TCollection_HAsciiString (theFontName.ToCString());
|
||||
Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, theFontAspect, thePointSize);
|
||||
return !aRequestedFont.IsNull()
|
||||
&& Font_FTFont::Init (aRequestedFont->FontPath()->ToCString(), thePointSize, theResolution);
|
||||
if (Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, theFontAspect, thePointSize))
|
||||
{
|
||||
myIsSingleLine = aRequestedFont->IsSingleStrokeFont();
|
||||
return Font_FTFont::Init (aRequestedFont->FontPath()->ToCString(), thePointSize, theResolution);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -73,6 +73,13 @@ public:
|
||||
const unsigned int thePointSize,
|
||||
const unsigned int theResolution);
|
||||
|
||||
//! Return TRUE if this is single-stroke (one-line) font, FALSE by default.
|
||||
//! Such fonts define single-line glyphs instead of closed contours, so that they are rendered incorrectly by normal software.
|
||||
bool IsSingleStrokeFont() const { return myIsSingleLine; }
|
||||
|
||||
//! Set if this font should be rendered as single-stroke (one-line).
|
||||
void SetSingleStrokeFont (bool theIsSingleLine) { myIsSingleLine = theIsSingleLine; }
|
||||
|
||||
//! Release currently loaded font.
|
||||
Standard_EXPORT virtual void Release();
|
||||
|
||||
@@ -159,6 +166,7 @@ protected:
|
||||
NCollection_String myFontPath; //!< font path
|
||||
unsigned int myPointSize; //!< point size set by FT_Set_Char_Size
|
||||
int32_t myLoadFlags; //!< default load flags
|
||||
bool myIsSingleLine;//!< single stroke font flag, FALSE by default
|
||||
|
||||
Image_PixMap myGlyphImg; //!< cached glyph plane
|
||||
FT_Vector* myKernAdvance; //!< buffer variable
|
||||
|
@@ -218,6 +218,8 @@ static Handle(Font_SystemFont) checkFont (const Handle(Font_FTLibrary)& theFTLib
|
||||
Handle(TCollection_HAsciiString) aFontName = new TCollection_HAsciiString (aFontFace->family_name);
|
||||
Handle(TCollection_HAsciiString) aFontPath = new TCollection_HAsciiString (theFontPath);
|
||||
aResult = new Font_SystemFont (aFontName, anAspect, aFontPath);
|
||||
// automatically identify some known single-line fonts
|
||||
aResult->SetSingleStrokeFont (aFontName->String().StartsWith ("OLF "));
|
||||
}
|
||||
|
||||
FT_Done_Face (aFontFace);
|
||||
|
@@ -13,126 +13,113 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// Updated:
|
||||
|
||||
#include <Font_SystemFont.hxx>
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Font_SystemFont,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Font_SystemFont, Standard_Transient)
|
||||
|
||||
Font_SystemFont::Font_SystemFont():
|
||||
MyFontName(),
|
||||
MyFontAspect(Font_FA_Undefined),
|
||||
MyFaceSize(-1),
|
||||
MyVerification(Standard_False)
|
||||
// =======================================================================
|
||||
// function : Font_SystemFont
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Font_SystemFont::Font_SystemFont()
|
||||
: myFontAspect (Font_FA_Undefined),
|
||||
myFaceSize (-1),
|
||||
myIsSingleLine (Standard_False),
|
||||
myIsDefined (Standard_False)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
Font_SystemFont::Font_SystemFont( const Handle(TCollection_HAsciiString)& FontName,
|
||||
const Font_FontAspect FontAspect,
|
||||
const Handle(TCollection_HAsciiString)& FilePath ):
|
||||
MyFontName(FontName),
|
||||
MyFontAspect(FontAspect),
|
||||
MyFaceSize(-1),
|
||||
MyFilePath(FilePath),
|
||||
MyVerification(Standard_True)
|
||||
// =======================================================================
|
||||
// function : Font_SystemFont
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Font_SystemFont::Font_SystemFont (const Handle(TCollection_HAsciiString)& theFontName,
|
||||
const Font_FontAspect theFontAspect,
|
||||
const Handle(TCollection_HAsciiString)& theFilePath)
|
||||
: myFontName (theFontName),
|
||||
myFontAspect (theFontAspect),
|
||||
myFaceSize (-1),
|
||||
myFilePath (theFilePath),
|
||||
myIsSingleLine (Standard_False),
|
||||
myIsDefined (Standard_True)
|
||||
{
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Font_SystemFont
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Font_SystemFont::Font_SystemFont (const Handle(TCollection_HAsciiString)& theXLFD,
|
||||
const Handle(TCollection_HAsciiString)& theFilePath) :
|
||||
MyFontAspect(Font_FA_Regular),
|
||||
MyFaceSize(-1),
|
||||
MyFilePath(theFilePath)
|
||||
const Handle(TCollection_HAsciiString)& theFilePath)
|
||||
: myFontAspect (Font_FA_Regular),
|
||||
myFaceSize (-1),
|
||||
myFilePath (theFilePath),
|
||||
myIsSingleLine (Standard_False),
|
||||
myIsDefined (Standard_True)
|
||||
{
|
||||
MyVerification = Standard_True;
|
||||
if (theXLFD.IsNull())
|
||||
if (theXLFD.IsNull()
|
||||
|| theXLFD->IsEmpty())
|
||||
{
|
||||
MyVerification = Standard_False; // empty font description handler
|
||||
}
|
||||
if (theXLFD->IsEmpty())
|
||||
{
|
||||
MyVerification = Standard_False; // empty font description
|
||||
myIsDefined = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
if (MyVerification)
|
||||
myFontName = theXLFD->Token ("-", 2);
|
||||
const TCollection_AsciiString& aXLFD = theXLFD->String();
|
||||
|
||||
// Getting font size for fixed size fonts
|
||||
if (aXLFD.Search ("-0-0-0-0-") >= 0)
|
||||
{
|
||||
MyFontName = theXLFD->Token ("-", 2);
|
||||
TCollection_AsciiString aXLFD (theXLFD->ToCString());
|
||||
myFaceSize = -1; // Scalable font
|
||||
}
|
||||
else
|
||||
{
|
||||
myFaceSize = aXLFD.Token ("-", 7).IntegerValue();
|
||||
}
|
||||
|
||||
// Getting font size for fixed size fonts
|
||||
if (aXLFD.Search ("-0-0-0-0-") >= 0)
|
||||
MyFaceSize = -1; // Scalable font
|
||||
else
|
||||
//TODO catch exeption
|
||||
MyFaceSize = aXLFD.Token ("-", 7).IntegerValue();
|
||||
|
||||
// Detect font aspect
|
||||
if (aXLFD.Token ("-", 3).IsEqual ("bold") &&
|
||||
(aXLFD.Token ("-", 4).IsEqual ("i") || aXLFD.Token ("-", 4).IsEqual ("o")))
|
||||
{
|
||||
MyFontAspect = Font_FA_BoldItalic;
|
||||
}
|
||||
else if (aXLFD.Token ("-", 3).IsEqual ("bold"))
|
||||
{
|
||||
MyFontAspect = Font_FA_Bold;
|
||||
}
|
||||
else if (aXLFD.Token ("-", 4).IsEqual ("i") || aXLFD.Token ("-", 4).IsEqual ("o"))
|
||||
{
|
||||
MyFontAspect = Font_FA_Italic;
|
||||
}
|
||||
// Detect font aspect
|
||||
if (aXLFD.Token ("-", 3).IsEqual ("bold")
|
||||
&& (aXLFD.Token ("-", 4).IsEqual ("i")
|
||||
|| aXLFD.Token ("-", 4).IsEqual ("o")))
|
||||
{
|
||||
myFontAspect = Font_FA_BoldItalic;
|
||||
}
|
||||
else if (aXLFD.Token ("-", 3).IsEqual ("bold"))
|
||||
{
|
||||
myFontAspect = Font_FA_Bold;
|
||||
}
|
||||
else if (aXLFD.Token ("-", 4).IsEqual ("i")
|
||||
|| aXLFD.Token ("-", 4).IsEqual ("o"))
|
||||
{
|
||||
myFontAspect = Font_FA_Italic;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Font_SystemFont::IsValid() const{
|
||||
if ( !MyVerification)
|
||||
return Standard_False;
|
||||
|
||||
if ( MyFontAspect == Font_FA_Undefined )
|
||||
return Standard_False;
|
||||
|
||||
if ( MyFontName->IsEmpty() || !MyFontName->IsAscii() )
|
||||
return Standard_False;
|
||||
|
||||
OSD_Path path;
|
||||
return path.IsValid( MyFilePath->String() );
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) Font_SystemFont::FontPath() const{
|
||||
return MyFilePath;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) Font_SystemFont::FontName() const{
|
||||
return MyFontName;
|
||||
}
|
||||
|
||||
Font_FontAspect Font_SystemFont::FontAspect() const{
|
||||
return MyFontAspect;
|
||||
}
|
||||
|
||||
Standard_Integer Font_SystemFont::FontHeight() const {
|
||||
return MyFaceSize;
|
||||
}
|
||||
|
||||
Standard_Boolean Font_SystemFont::IsEqual(const Handle(Font_SystemFont)& theOtherFont) const
|
||||
// =======================================================================
|
||||
// function : IsValid
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Font_SystemFont::IsValid() const
|
||||
{
|
||||
if (!MyFontName->IsSameString (theOtherFont->FontName(), Standard_False))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (MyFontAspect != theOtherFont->FontAspect())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (MyFaceSize != theOtherFont->FontHeight())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
return myIsDefined
|
||||
&& myFontAspect != Font_FA_Undefined
|
||||
&& !myFontName->IsEmpty()
|
||||
&& OSD_Path::IsValid (myFilePath->String());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsEqual
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Font_SystemFont::IsEqual (const Handle(Font_SystemFont)& theOtherFont) const
|
||||
{
|
||||
return myFontName->IsSameString (myFontName, Standard_False)
|
||||
&& myFontAspect == theOtherFont->myFontAspect
|
||||
&& myFaceSize == theOtherFont->myFaceSize;
|
||||
}
|
||||
|
@@ -25,76 +25,60 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
|
||||
class Font_SystemFont;
|
||||
DEFINE_STANDARD_HANDLE(Font_SystemFont, Standard_Transient)
|
||||
|
||||
//! Structure for store of Font System Information
|
||||
//! This class stores information about the font, which is merely a file path and cached metadata about the font.
|
||||
class Font_SystemFont : public Standard_Transient
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Font_SystemFont, Standard_Transient)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates empty font object
|
||||
//! Creates an empty font object.
|
||||
Standard_EXPORT Font_SystemFont();
|
||||
|
||||
//! Creates a new font object.
|
||||
Standard_EXPORT Font_SystemFont (const Handle(TCollection_HAsciiString)& theFontName,
|
||||
const Font_FontAspect theFontAspect,
|
||||
const Handle(TCollection_HAsciiString)& theFilePath);
|
||||
|
||||
//! Creates a font object and initialize class fields with values taken from XLFD (X Logical Font Description)
|
||||
Standard_EXPORT Font_SystemFont (const Handle(TCollection_HAsciiString)& theXLFD,
|
||||
const Handle(TCollection_HAsciiString)& theFilePath);
|
||||
|
||||
//! Returns font family name.
|
||||
const Handle(TCollection_HAsciiString)& FontName() const { return myFontName; }
|
||||
|
||||
//! Creates Font object initialized with <FontName> as name
|
||||
//! <FontAspect>.... TODO
|
||||
Standard_EXPORT Font_SystemFont(const Handle(TCollection_HAsciiString)& theFontName, const Font_FontAspect theFontAspect, const Handle(TCollection_HAsciiString)& theFilePath);
|
||||
//! Returns font file path.
|
||||
const Handle(TCollection_HAsciiString)& FontPath() const { return myFilePath; }
|
||||
|
||||
//! Creates Font object and initialize class fields with
|
||||
//! values taken from XLFD (X Logical Font Description)
|
||||
Standard_EXPORT Font_SystemFont(const Handle(TCollection_HAsciiString)& theXLFD, const Handle(TCollection_HAsciiString)& theFilePath);
|
||||
|
||||
//! Returns font family name
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) FontName() const;
|
||||
|
||||
//! Returns font file path
|
||||
//! Level: Public
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) FontPath() const;
|
||||
|
||||
//! Returns font aspect
|
||||
//! Level: Public
|
||||
Standard_EXPORT Font_FontAspect FontAspect() const;
|
||||
|
||||
//! Returns font height
|
||||
//! If returned value is equal -1 it means that font is resizable
|
||||
//! Level: Public
|
||||
Standard_EXPORT Standard_Integer FontHeight() const;
|
||||
//! Returns font aspect.
|
||||
Font_FontAspect FontAspect() const { return myFontAspect; }
|
||||
|
||||
//! Returns font height.
|
||||
//! If returned value is equal -1 it means that font is resizable.
|
||||
Standard_Integer FontHeight() const { return myFaceSize; }
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsValid() const;
|
||||
|
||||
//! Return true if the FontName, FontAspect and FontSize are the same.
|
||||
//! Level: Public
|
||||
Standard_EXPORT Standard_Boolean IsEqual (const Handle(Font_SystemFont)& theOtherFont) const;
|
||||
|
||||
//! Return TRUE if this is single-stroke (one-line) font, FALSE by default.
|
||||
//! Such fonts define single-line glyphs instead of closed contours, so that they are rendered incorrectly by normal software.
|
||||
Standard_Boolean IsSingleStrokeFont() const { return myIsSingleLine; }
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Font_SystemFont,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
//! Set if this font should be rendered as single-stroke (one-line).
|
||||
void SetSingleStrokeFont (Standard_Boolean theIsSingleLine) { myIsSingleLine = theIsSingleLine; }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) MyFontName;
|
||||
Font_FontAspect MyFontAspect;
|
||||
Standard_Integer MyFaceSize;
|
||||
Handle(TCollection_HAsciiString) MyFilePath;
|
||||
Standard_Boolean MyVerification;
|
||||
|
||||
Handle(TCollection_HAsciiString) myFontName;
|
||||
Font_FontAspect myFontAspect;
|
||||
Standard_Integer myFaceSize;
|
||||
Handle(TCollection_HAsciiString) myFilePath;
|
||||
Standard_Boolean myIsSingleLine; //!< single stroke font flag, FALSE by default
|
||||
Standard_Boolean myIsDefined;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Font_SystemFont, Standard_Transient)
|
||||
|
||||
#endif // _Font_SystemFont_HeaderFile
|
||||
|
@@ -169,7 +169,8 @@ static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters,
|
||||
Parameters.Append (U1);
|
||||
Points.Append (Pdeb);
|
||||
|
||||
D1 (C, U2, Pfin, Dfin);
|
||||
Standard_Real aDecreasedU2 = U2 - Epsilon(U2) * 10.;
|
||||
D1 (C, aDecreasedU2, Pfin, Dfin);
|
||||
QuasiFleche (C, Deflection * Deflection,
|
||||
U1, Pdeb,
|
||||
Ddeb,
|
||||
|
@@ -125,7 +125,10 @@
|
||||
//epa test
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <BRepAdaptor_HCompCurve.hxx>
|
||||
#include <GeomLProp_CLProps.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
@@ -835,10 +838,10 @@ static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const
|
||||
#include <math_MultipleVarFunction.hxx>
|
||||
#include <math_BrentMinimum.hxx>
|
||||
|
||||
static Standard_Real CompLocalDev(const Handle(Geom_Curve)& theCurve,
|
||||
static Standard_Real CompLocalDev(const Adaptor3d_Curve& theCurve,
|
||||
const Standard_Real u1, const Standard_Real u2);
|
||||
|
||||
static void ComputeDeviation(const Handle(Geom_Curve)& theCurve,
|
||||
static void ComputeDeviation(const Adaptor3d_Curve& theCurve,
|
||||
const Handle(Geom_BSplineCurve)& thePnts,
|
||||
Standard_Real& theDmax,
|
||||
Standard_Real& theUfMax,
|
||||
@@ -870,19 +873,18 @@ static void ComputeDeviation(const Handle(Geom_Curve)& theCurve,
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real CompLocalDev(const Handle(Geom_Curve)& theCurve,
|
||||
Standard_Real CompLocalDev(const Adaptor3d_Curve& theCurve,
|
||||
const Standard_Real u1, const Standard_Real u2)
|
||||
{
|
||||
math_Vector aLowBorder(1,1);
|
||||
math_Vector aUppBorder(1,1);
|
||||
math_Vector aSteps(1,1);
|
||||
GeomAdaptor_Curve TCurve(theCurve);
|
||||
//
|
||||
aLowBorder(1) = u1;
|
||||
aUppBorder(1) = u2;
|
||||
aSteps(1) =(aUppBorder(1) - aLowBorder(1)) * 0.01; // Run PSO on even distribution with 100 points.
|
||||
//
|
||||
GCPnts_DistFunction aFunc1(TCurve, u1, u2);
|
||||
GCPnts_DistFunction aFunc1(theCurve, u1, u2);
|
||||
//
|
||||
Standard_Real aValue;
|
||||
math_Vector aT(1,1);
|
||||
@@ -935,11 +937,28 @@ static Standard_Integer crvpoints (Draw_Interpretor& di, Standard_Integer /*n*/,
|
||||
Standard_Integer i, nbp;
|
||||
Standard_Real defl;
|
||||
|
||||
Handle(Adaptor3d_HCurve) aHCurve;
|
||||
Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]);
|
||||
if (C.IsNull())
|
||||
{
|
||||
// try getting a wire
|
||||
TopoDS_Wire aWire = TopoDS::Wire(DBRep::Get(a[2], TopAbs_WIRE));
|
||||
if (aWire.IsNull())
|
||||
{
|
||||
cout << "cannot evaluate the argument " << a[2] << " as a curve" << endl;
|
||||
return 1;
|
||||
}
|
||||
BRepAdaptor_CompCurve aCompCurve(aWire);
|
||||
aHCurve = new BRepAdaptor_HCompCurve(aCompCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
aHCurve = new GeomAdaptor_HCurve(C);
|
||||
}
|
||||
|
||||
defl = Draw::Atof(a[3]);
|
||||
|
||||
GeomAdaptor_Curve GAC(C);
|
||||
GCPnts_QuasiUniformDeflection PntGen(GAC, defl);
|
||||
GCPnts_QuasiUniformDeflection PntGen(aHCurve->Curve(), defl);
|
||||
|
||||
if(!PntGen.IsDone()) {
|
||||
di << "Points generation failed\n";
|
||||
@@ -976,7 +995,7 @@ static Standard_Integer crvpoints (Draw_Interpretor& di, Standard_Integer /*n*/,
|
||||
Standard_Integer imax = 0;
|
||||
|
||||
//check deviation
|
||||
ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax);
|
||||
ComputeDeviation(aHCurve->Curve(), aPnts, dmax, ufmax, ulmax, imax);
|
||||
di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << imax << "\n";
|
||||
|
||||
return 0;
|
||||
@@ -992,14 +1011,30 @@ static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, co
|
||||
Standard_Integer i, nbp;
|
||||
Standard_Real defl, angle = Precision::Angular();
|
||||
|
||||
Handle(Adaptor3d_HCurve) aHCurve;
|
||||
Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]);
|
||||
if (C.IsNull())
|
||||
{
|
||||
// try getting a wire
|
||||
TopoDS_Wire aWire = TopoDS::Wire(DBRep::Get(a[2], TopAbs_WIRE));
|
||||
if (aWire.IsNull())
|
||||
{
|
||||
cout << "cannot evaluate the argument " << a[2] << " as a curve" << endl;
|
||||
return 1;
|
||||
}
|
||||
BRepAdaptor_CompCurve aCompCurve(aWire);
|
||||
aHCurve = new BRepAdaptor_HCompCurve(aCompCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
aHCurve = new GeomAdaptor_HCurve(C);
|
||||
}
|
||||
defl = Draw::Atof(a[3]);
|
||||
|
||||
if(n > 3)
|
||||
angle = Draw::Atof(a[4]);
|
||||
|
||||
GeomAdaptor_Curve GAC(C);
|
||||
GCPnts_TangentialDeflection PntGen(GAC, angle, defl, 2);
|
||||
GCPnts_TangentialDeflection PntGen(aHCurve->Curve(), angle, defl, 2);
|
||||
|
||||
nbp = PntGen.NbPoints();
|
||||
di << "Nb points : " << nbp << "\n";
|
||||
@@ -1031,7 +1066,7 @@ static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, co
|
||||
Standard_Integer imax = 0;
|
||||
|
||||
//check deviation
|
||||
ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax);
|
||||
ComputeDeviation(aHCurve->Curve(), aPnts, dmax, ufmax, ulmax, imax);
|
||||
//
|
||||
di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << imax << "\n";
|
||||
|
||||
@@ -1399,7 +1434,7 @@ static Standard_Integer mypoints (Draw_Interpretor& di, Standard_Integer /*n*/,
|
||||
Standard_Real dmax = 0., ufmax = 0., ulmax = 0.;
|
||||
Standard_Integer imax = 0;
|
||||
|
||||
ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax);
|
||||
ComputeDeviation(GeomAdaptor_Curve(C),aPnts,dmax,ufmax,ulmax,imax);
|
||||
di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << imax << "\n";
|
||||
|
||||
return 0;
|
||||
@@ -1804,12 +1839,12 @@ void GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
intersection,g);
|
||||
|
||||
theCommands.Add("crvpoints",
|
||||
"crvpoints result curv deflection",
|
||||
"crvpoints result <curve or wire> deflection",
|
||||
__FILE__,
|
||||
crvpoints,g);
|
||||
|
||||
theCommands.Add("crvtpoints",
|
||||
"crvtpoints result curv deflection angular deflection - tangential deflection points",
|
||||
"crvtpoints result <curve or wire> deflection angular deflection - tangential deflection points",
|
||||
__FILE__,
|
||||
crvtpoints,g);
|
||||
|
||||
|
@@ -1,22 +1,13 @@
|
||||
Graphic3d_ArrayOfPoints.cxx
|
||||
Graphic3d_ArrayOfPoints.hxx
|
||||
Graphic3d_ArrayOfPolygons.cxx
|
||||
Graphic3d_ArrayOfPolygons.hxx
|
||||
Graphic3d_ArrayOfPolylines.cxx
|
||||
Graphic3d_ArrayOfPolylines.hxx
|
||||
Graphic3d_ArrayOfPrimitives.cxx
|
||||
Graphic3d_ArrayOfPrimitives.hxx
|
||||
Graphic3d_ArrayOfQuadrangles.cxx
|
||||
Graphic3d_ArrayOfQuadrangles.hxx
|
||||
Graphic3d_ArrayOfQuadrangleStrips.cxx
|
||||
Graphic3d_ArrayOfQuadrangleStrips.hxx
|
||||
Graphic3d_ArrayOfSegments.cxx
|
||||
Graphic3d_ArrayOfSegments.hxx
|
||||
Graphic3d_ArrayOfTriangleFans.cxx
|
||||
Graphic3d_ArrayOfTriangleFans.hxx
|
||||
Graphic3d_ArrayOfTriangles.cxx
|
||||
Graphic3d_ArrayOfTriangles.hxx
|
||||
Graphic3d_ArrayOfTriangleStrips.cxx
|
||||
Graphic3d_ArrayOfTriangleStrips.hxx
|
||||
Graphic3d_AspectFillArea3d.cxx
|
||||
Graphic3d_AspectFillArea3d.hxx
|
||||
|
@@ -1,25 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPoints,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfPoints::Graphic3d_ArrayOfPoints (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasVNormals)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POINTS, theMaxVertexs, 0, 0, theHasVNormals, theHasVColors, Standard_False, Standard_False)
|
||||
{}
|
@@ -15,52 +15,25 @@
|
||||
#ifndef _Graphic3d_ArrayOfPoints_HeaderFile
|
||||
#define _Graphic3d_ArrayOfPoints_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfPoints;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPoints, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains points array definition
|
||||
//! Contains points array definition.
|
||||
class Graphic3d_ArrayOfPoints : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPoints, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of points,
|
||||
//! a single pixel point is drawn at each vertex.
|
||||
//! Creates an array of points, a single pixel point is drawn at each vertex.
|
||||
//! The array must be filled using the AddVertex(Point) method.
|
||||
//! When <hasVColors> is TRUE , you must use only AddVertex(Point,Color) method.
|
||||
//! When <hasVNormals> is TRUE , you must use only AddVertex(Point,Normal) method.
|
||||
Standard_EXPORT Graphic3d_ArrayOfPoints(const Standard_Integer maxVertexs, const Standard_Boolean hasVColors = Standard_False, const Standard_Boolean hasVNormals = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPoints,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! @param theHasVColors when TRUE, AddVertex(Point,Color) should be used for specifying vertex color
|
||||
//! @param theHasVNormals when TRUE, AddVertex(Point,Normal) should be used for specifying vertex normal
|
||||
Graphic3d_ArrayOfPoints (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Boolean theHasVColors = Standard_False,
|
||||
const Standard_Boolean theHasVNormals = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POINTS, theMaxVertexs, 0, 0, theHasVNormals, theHasVColors, Standard_False, Standard_False) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPoints, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfPoints_HeaderFile
|
||||
|
@@ -1,29 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfPolygons::Graphic3d_ArrayOfPolygons (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxBounds,
|
||||
const Standard_Integer theMaxEdges,
|
||||
const Standard_Boolean theHasVNormals,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasFColors,
|
||||
const Standard_Boolean theHasVTexels)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYGONS, theMaxVertexs, theMaxBounds, theMaxEdges, theHasVNormals, theHasVColors, theHasFColors, theHasVTexels)
|
||||
{}
|
@@ -15,130 +15,91 @@
|
||||
#ifndef _Graphic3d_ArrayOfPolygons_HeaderFile
|
||||
#define _Graphic3d_ArrayOfPolygons_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfPolygons;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains polygons array definition
|
||||
//! Contains polygons array definition.
|
||||
//! WARNING! Polygon primitives might be unsupported by graphics library.
|
||||
//! Triangulation should be used instead of quads for better compatibility.
|
||||
class Graphic3d_ArrayOfPolygons : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of polygons,
|
||||
//! a polygon can be filled as:
|
||||
//! 1) creating a single polygon defined with his vertexs.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolygons(7)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x7,y7,z7)
|
||||
//! 2) creating separate polygons defined with a predefined
|
||||
//! number of bounds and the number of vertex per bound.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolygons(7,2)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x5,y5,z5)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x7,y7,z7)
|
||||
//! 3) creating a single indexed polygon defined with his vertex
|
||||
//! ans edges.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolygons(4,0,6)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(4)
|
||||
//! 4) creating separate polygons defined with a predefined
|
||||
//! number of bounds and the number of edges per bound.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolygons(6,4,14)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! myArray->AddVertex(x2,y2,z2)
|
||||
//! myArray->AddVertex(x3,y3,z3)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddVertex(x5,y5,z5)
|
||||
//! myArray->AddVertex(x6,y6,z6)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(6)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(6)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(4)
|
||||
//! <maxVertexs> defined the maximun allowed vertex number in the array.
|
||||
//! <maxBounds> defined the maximun allowed bound number in the array.
|
||||
//! <maxEdges> defined the maximun allowed edge number in the array.
|
||||
//! Warning:
|
||||
//! When <hasVNormals> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Normal)
|
||||
//! or AddVertex(Point,Normal,Color)
|
||||
//! or AddVertex(Point,Normal,Texel) methods.
|
||||
//! When <hasVColors> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Color)
|
||||
//! or AddVertex(Point,Normal,Color) methods.
|
||||
//! When <hasTexels> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Texel)
|
||||
//! or AddVertex(Point,Normal,Texel) methods.
|
||||
//! When <hasBColors> is TRUE , <maxBounds> must be > 0 and
|
||||
//! you must use the
|
||||
//! AddBound(number,Color) method.
|
||||
//! Warning:
|
||||
//! the user is responsible about the orientation of the polygon
|
||||
//! depending of the order of the created vertex or edges and this
|
||||
//! orientation must be coherent with the vertex normal optionnaly
|
||||
//! given at each vertex (See the Orientate() methods).
|
||||
Standard_EXPORT Graphic3d_ArrayOfPolygons(const Standard_Integer maxVertexs, const Standard_Integer maxBounds = 0, const Standard_Integer maxEdges = 0, const Standard_Boolean hasVNormals = Standard_False, const Standard_Boolean hasVColors = Standard_False, const Standard_Boolean hasBColors = Standard_False, const Standard_Boolean hasTexels = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Creates an array of polygons, a polygon can be filled as:
|
||||
//! 1) Creating a single polygon defined with his vertexes, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolygons (7);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x7, y7, z7);
|
||||
//! @endcode
|
||||
//! 2) Creating separate polygons defined with a predefined number of bounds and the number of vertex per bound, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolygons (7, 2);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x5, y5, z5);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x7, y7, z7);
|
||||
//! @endcode
|
||||
//! 3) Creating a single indexed polygon defined with his vertex ans edges, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolygons (4, 0, 6);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (4);
|
||||
//! @endcode
|
||||
//! 4) Creating separate polygons defined with a predefined number of bounds and the number of edges per bound, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolygons (6, 4, 14);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! myArray->AddVertex (x2, y2, z2);
|
||||
//! myArray->AddVertex (x3, y3, z3);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddVertex (x5, y5, z5);
|
||||
//! myArray->AddVertex (x6, y6, z6);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (6);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (6);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (4);
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxBounds defines the maximum allowed bound number in the array
|
||||
//! @param theMaxEdges defines the maximum allowed edge number in the array
|
||||
Graphic3d_ArrayOfPolygons (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxBounds = 0,
|
||||
const Standard_Integer theMaxEdges = 0,
|
||||
const Standard_Boolean theHasVNormals = Standard_False,
|
||||
const Standard_Boolean theHasVColors = Standard_False,
|
||||
const Standard_Boolean theHasBColors = Standard_False,
|
||||
const Standard_Boolean theHasVTexels = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYGONS, theMaxVertexs, theMaxBounds, theMaxEdges, theHasVNormals, theHasVColors, theHasBColors, theHasVTexels) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfPolygons_HeaderFile
|
||||
|
@@ -1,27 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolylines,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfPolylines::Graphic3d_ArrayOfPolylines (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxBounds,
|
||||
const Standard_Integer theMaxEdges,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasFColors)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYLINES, theMaxVertexs, theMaxBounds, theMaxEdges, Standard_False, theHasVColors, theHasFColors, Standard_False)
|
||||
{}
|
@@ -15,119 +15,89 @@
|
||||
#ifndef _Graphic3d_ArrayOfPolylines_HeaderFile
|
||||
#define _Graphic3d_ArrayOfPolylines_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfPolylines;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPolylines, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains polylines array definition
|
||||
//! Contains polylines array definition.
|
||||
class Graphic3d_ArrayOfPolylines : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolylines, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of polylines,
|
||||
//! a polyline can be filled as:
|
||||
//! 1) creating a single polyline defined with his vertexs.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolylines(7)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x7,y7,z7)
|
||||
//! 2) creating separate polylines defined with a predefined
|
||||
//! number of bounds and the number of vertex per bound.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolylines(7,2)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x5,y5,z5)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x7,y7,z7)
|
||||
//! 3) creating a single indexed polyline defined with his vertex
|
||||
//! ans edges.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolylines(4,0,6)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(4)
|
||||
//! 4) creating separate polylines defined with a predefined
|
||||
//! number of bounds and the number of edges per bound.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfPolylines(6,4,14)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! myArray->AddVertex(x2,y2,z2)
|
||||
//! myArray->AddVertex(x3,y3,z3)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddBound(3)
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddVertex(x5,y5,z5)
|
||||
//! myArray->AddVertex(x6,y6,z6)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(6)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(6)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(4)
|
||||
//!
|
||||
//! <maxVertexs> defined the maximun allowed vertex number in the array.
|
||||
//! <maxBounds> defined the maximun allowed bound number in the array.
|
||||
//! <maxEdges> defined the maximun allowed edge number in the array.
|
||||
//! Warning:
|
||||
//! When <hasVColors> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Color)
|
||||
//! or AddVertex(Point,Normal,Color) methods.
|
||||
//! When <hasBColors> is TRUE , <maxBounds> must be > 0 and
|
||||
//! you must use the
|
||||
//! AddBound(number,Color) method.
|
||||
Standard_EXPORT Graphic3d_ArrayOfPolylines(const Standard_Integer maxVertexs, const Standard_Integer maxBounds = 0, const Standard_Integer maxEdges = 0, const Standard_Boolean hasVColors = Standard_False, const Standard_Boolean hasBColors = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolylines,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Creates an array of polylines, a polyline can be filled as:
|
||||
//! 1) Creating a single polyline defined with his vertexes, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolylines (7);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x7, y7, z7);
|
||||
//! @endcode
|
||||
//! 2) Creating separate polylines defined with a predefined number of bounds and the number of vertex per bound, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolylines (7, 2);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x5, y5, z5);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x7, y7, z7);
|
||||
//! @endcode
|
||||
//! 3) Creating a single indexed polyline defined with his vertex and edges, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolylines (4, 0, 6);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (4);
|
||||
//! @endcode
|
||||
//! 4) creating separate polylines defined with a predefined number of bounds and the number of edges per bound, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfPolylines (6, 4, 14);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! myArray->AddVertex (x2, y2, z2);
|
||||
//! myArray->AddVertex (x3, y3, z3);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddBound (3);
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddVertex (x5, y5, z5);
|
||||
//! myArray->AddVertex (x6, y6, z6);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (6);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (6);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (4);
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxBounds defines the maximum allowed bound number in the array
|
||||
//! @param theMaxEdges defines the maximum allowed edge number in the array
|
||||
//! @param theHasVColors when TRUE AddVertex(Point,Color) or AddVertex(Point,Normal,Color) should be used to specify per-vertex color values
|
||||
//! @param theHasBColors when TRUE AddBound(number,Color) should be used to specify sub-group color
|
||||
Graphic3d_ArrayOfPolylines (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxBounds = 0,
|
||||
const Standard_Integer theMaxEdges = 0,
|
||||
const Standard_Boolean theHasVColors = Standard_False,
|
||||
const Standard_Boolean theHasBColors = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYLINES, theMaxVertexs, theMaxBounds, theMaxEdges, Standard_False, theHasVColors, theHasBColors, Standard_False) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPolylines, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfPolylines_HeaderFile
|
||||
|
@@ -14,6 +14,16 @@
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangleStrips.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangleFans.hxx>
|
||||
#include <Graphic3d_ArrayOfQuadrangles.hxx>
|
||||
#include <Graphic3d_ArrayOfQuadrangleStrips.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
|
||||
#include <NCollection_AlignedAllocator.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
@@ -22,6 +32,16 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPrimitives, Standard_Transient)
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPoints, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfSegments, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolylines, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfTriangles, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfTriangleStrips, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfTriangleFans, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangles, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangleStrips, Graphic3d_ArrayOfPrimitives)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ArrayOfPrimitives
|
||||
// purpose :
|
||||
@@ -246,14 +266,18 @@ Standard_CString Graphic3d_ArrayOfPrimitives::StringType() const
|
||||
switch (myType)
|
||||
{
|
||||
case Graphic3d_TOPA_POINTS: return "ArrayOfPoints";
|
||||
case Graphic3d_TOPA_POLYLINES: return "ArrayOfPolylines";
|
||||
case Graphic3d_TOPA_SEGMENTS: return "ArrayOfSegments";
|
||||
case Graphic3d_TOPA_POLYGONS: return "ArrayOfPolygons";
|
||||
case Graphic3d_TOPA_POLYLINES: return "ArrayOfPolylines";
|
||||
case Graphic3d_TOPA_TRIANGLES: return "ArrayOfTriangles";
|
||||
case Graphic3d_TOPA_QUADRANGLES: return "ArrayOfQuadrangles";
|
||||
case Graphic3d_TOPA_TRIANGLESTRIPS: return "ArrayOfTriangleStrips";
|
||||
case Graphic3d_TOPA_QUADRANGLESTRIPS: return "ArrayOfQuadrangleStrips";
|
||||
case Graphic3d_TOPA_TRIANGLEFANS: return "ArrayOfTriangleFans";
|
||||
case Graphic3d_TOPA_LINES_ADJACENCY: return "ArrayOfLinesAdjacency";
|
||||
case Graphic3d_TOPA_LINE_STRIP_ADJACENCY: return "ArrayOfLineStripAdjacency";
|
||||
case Graphic3d_TOPA_TRIANGLES_ADJACENCY: return "ArrayOfTrianglesAdjacency";
|
||||
case Graphic3d_TOPA_TRIANGLE_STRIP_ADJACENCY: return "ArrayOfTriangleStripAdjacency";
|
||||
case Graphic3d_TOPA_QUADRANGLES: return "ArrayOfQuadrangles";
|
||||
case Graphic3d_TOPA_QUADRANGLESTRIPS: return "ArrayOfQuadrangleStrips";
|
||||
case Graphic3d_TOPA_POLYGONS: return "ArrayOfPolygons";
|
||||
case Graphic3d_TOPA_UNDEFINED: return "UndefinedArray";
|
||||
}
|
||||
return "UndefinedArray";
|
||||
@@ -293,6 +317,18 @@ Standard_Integer Graphic3d_ArrayOfPrimitives::ItemNumber() const
|
||||
case Graphic3d_TOPA_TRIANGLEFANS: return !myBounds.IsNull()
|
||||
? myAttribs->NbElements - 2 * myBounds->NbBounds
|
||||
: myAttribs->NbElements - 2;
|
||||
case Graphic3d_TOPA_LINES_ADJACENCY: return myIndices.IsNull() || myIndices->NbElements < 1
|
||||
? myAttribs->NbElements / 4
|
||||
: myIndices->NbElements / 4;
|
||||
case Graphic3d_TOPA_LINE_STRIP_ADJACENCY: return !myBounds.IsNull()
|
||||
? myAttribs->NbElements - 4 * myBounds->NbBounds
|
||||
: myAttribs->NbElements - 4;
|
||||
case Graphic3d_TOPA_TRIANGLES_ADJACENCY: return myIndices.IsNull() || myIndices->NbElements < 1
|
||||
? myAttribs->NbElements / 6
|
||||
: myIndices->NbElements / 6;
|
||||
case Graphic3d_TOPA_TRIANGLE_STRIP_ADJACENCY: return !myBounds.IsNull()
|
||||
? myAttribs->NbElements - 4 * myBounds->NbBounds
|
||||
: myAttribs->NbElements - 4;
|
||||
case Graphic3d_TOPA_UNDEFINED: return -1;
|
||||
}
|
||||
return -1;
|
||||
@@ -407,6 +443,20 @@ Standard_Boolean Graphic3d_ArrayOfPrimitives::IsValid()
|
||||
return Standard_False;
|
||||
}
|
||||
break;
|
||||
case Graphic3d_TOPA_LINES_ADJACENCY:
|
||||
case Graphic3d_TOPA_LINE_STRIP_ADJACENCY:
|
||||
if (nvertexs < 4)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
break;
|
||||
case Graphic3d_TOPA_TRIANGLES_ADJACENCY:
|
||||
case Graphic3d_TOPA_TRIANGLE_STRIP_ADJACENCY:
|
||||
if (nvertexs < 6)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
break;
|
||||
case Graphic3d_TOPA_UNDEFINED:
|
||||
default:
|
||||
return Standard_False;
|
||||
|
@@ -24,28 +24,41 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class Quantity_Color;
|
||||
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPrimitives, Standard_Transient)
|
||||
|
||||
//! This class furnish services to defined and fill an
|
||||
//! array of primitives compatible with the use of
|
||||
//! the OPENGl glDrawArrays() or glDrawElements() functions.
|
||||
//! NOTE that the main goal of this kind of primitive
|
||||
//! is to avoid multiple copies of datas between
|
||||
//! each layer of the software.
|
||||
//! So the array datas exist only one time and the use
|
||||
//! of SetXxxxxx() methods enable to change dynamically
|
||||
//! the aspect of this primitive.
|
||||
//! This class furnish services to defined and fill an array of primitives
|
||||
//! which can be passed directly to graphics rendering API.
|
||||
//!
|
||||
//! Advantages are :
|
||||
//! 1) Decrease strongly the loading time.
|
||||
//! 2) Decrease strongly the display time using optimized Opengl
|
||||
//! primitives.
|
||||
//! 3) Enable to change dynamically the components of the primitive
|
||||
//! (vertice,normal,color,texture coordinates).
|
||||
//! 4) Add true triangle and quadrangle strips or fans capabilities.
|
||||
//! The basic interface consists of the following parts:
|
||||
//! 1) Specifying primitive type.
|
||||
//! WARNING! Particular primitive types might be unsupported by specific hardware/graphics API (like quads and polygons).
|
||||
//! It is always preferred using one of basic types having maximum compatibility:
|
||||
//! Point, Triangle (or Triangle strip), Segment aka Lines (or Polyline aka Line Strip).
|
||||
//! Primitive strip types can be used to reduce memory usage as alternative to Indexed arrays.
|
||||
//! 2) Vertex array.
|
||||
//! - Specifying the (maximum) number of vertexes within array.
|
||||
//! - Specifying the vertex attributes, complementary to mandatory vertex Position (normal, color, UV texture coordinates).
|
||||
//! - Defining vertex values by using various versions of AddVertex() or SetVertex*() methods.
|
||||
//! 3) Index array (optional).
|
||||
//! - Specifying the (maximum) number of indexes (edges).
|
||||
//! - Defining index values by using AddEdge() method; the index value should be within number of defined Vertexes.
|
||||
//!
|
||||
//! Indexed array allows sharing vertex data across Primitives and thus reducing memory usage,
|
||||
//! since index size is much smaller then size of vertex with all its attributes.
|
||||
//! It is a preferred way for defining primitive array and main alternative to Primitive Strips for optimal memory usage,
|
||||
//! although it is also possible (but unusual) defining Indexed Primitive Strip.
|
||||
//! Note that it is NOT possible sharing Vertex Attributes partially (e.g. share Position, but have different Normals);
|
||||
//! in such cases Vertex should be entirely duplicated with all Attributes.
|
||||
//! 4) Bounds array (optional).
|
||||
//! - Specifying the (maximum) number of bounds.
|
||||
//! - Defining bounds using AddBound() methods.
|
||||
//!
|
||||
//! Bounds allow splitting Primitive Array into sub-groups.
|
||||
//! This is useful only in two cases - for specifying per-group color and for restarting Primitive Strips.
|
||||
//! WARNING! Bounds within Primitive Array break rendering batches into parts (additional for loops),
|
||||
//! affecting rendering performance negatively (increasing CPU load).
|
||||
|
||||
class Graphic3d_ArrayOfPrimitives : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPrimitives, Standard_Transient)
|
||||
|
@@ -1,28 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfQuadrangleStrips.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangleStrips,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfQuadrangleStrips::Graphic3d_ArrayOfQuadrangleStrips (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxStrips,
|
||||
const Standard_Boolean theHasVNormals,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasSColors,
|
||||
const Standard_Boolean theHasVTexels)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLESTRIPS, theMaxVertexs, theMaxStrips, 0, theHasVNormals, theHasVColors, theHasSColors, theHasVTexels)
|
||||
{}
|
@@ -15,72 +15,49 @@
|
||||
#ifndef _Graphic3d_ArrayOfQuadrangleStrips_HeaderFile
|
||||
#define _Graphic3d_ArrayOfQuadrangleStrips_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfQuadrangleStrips;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfQuadrangleStrips, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains quadrangles strip array definition
|
||||
//! Contains quadrangles strip array definition.
|
||||
//! WARNING! Quadrangle primitives might be unsupported by graphics library.
|
||||
//! Triangulation should be used instead of quads for better compatibility.
|
||||
class Graphic3d_ArrayOfQuadrangleStrips : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangleStrips, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of quadrangle strips,
|
||||
//! a polygon can be filled as:
|
||||
//! 1) creating a single strip defined with his vertexs.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangleStrips(7)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x7,y7,z7)
|
||||
//! 2) creating separate strips defined with a predefined
|
||||
//! number of strips and the number of vertex per strip.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangleStrips(8,2)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddBound(4)
|
||||
//! myArray->AddVertex(x5,y5,z5)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x8,y8,z8)
|
||||
//!
|
||||
//! <maxVertexs> defined the maximun allowed vertex number in the array.
|
||||
//! <maxStrips> defined the maximun allowed strip number in the array.
|
||||
//! The number of quadrangle really drawn is :
|
||||
//! VertexNumber()/2-Min(1,BoundNumber())
|
||||
Standard_EXPORT Graphic3d_ArrayOfQuadrangleStrips(const Standard_Integer maxVertexs, const Standard_Integer maxStrips = 0, const Standard_Boolean hasVNormals = Standard_False, const Standard_Boolean hasVColors = Standard_False, const Standard_Boolean hasSColors = Standard_False, const Standard_Boolean hasTexels = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangleStrips,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Creates an array of quadrangle strips, a polygon can be filled as:
|
||||
//! 1) Creating a single strip defined with his vertexes, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangleStrips (7);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x7, y7, z7);
|
||||
//! @endcode
|
||||
//! 2) Creating separate strips defined with a predefined number of strips and the number of vertex per strip, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangleStrips (8, 2);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddBound (4);
|
||||
//! myArray->AddVertex (x5, y5, z5);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x8, y8, z8);
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxStrips defines the maximum allowed strip number in the array
|
||||
//! The number of quadrangle really drawn is: VertexNumber()/2 - Min(1, BoundNumber()).
|
||||
Graphic3d_ArrayOfQuadrangleStrips (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxStrips = 0,
|
||||
const Standard_Boolean theHasVNormals = Standard_False,
|
||||
const Standard_Boolean theHasVColors = Standard_False,
|
||||
const Standard_Boolean theHasSColors = Standard_False,
|
||||
const Standard_Boolean theHasVTexels = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLESTRIPS, theMaxVertexs, theMaxStrips, 0, theHasVNormals, theHasVColors, theHasSColors, theHasVTexels) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfQuadrangleStrips, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfQuadrangleStrips_HeaderFile
|
||||
|
@@ -1,28 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfQuadrangles.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangles,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfQuadrangles::Graphic3d_ArrayOfQuadrangles (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxEdges,
|
||||
const Standard_Boolean theHasVNormals,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasVTexels)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLES, theMaxVertexs, 0, theMaxEdges, theHasVNormals, theHasVColors, Standard_False, theHasVTexels)
|
||||
{}
|
@@ -15,90 +15,50 @@
|
||||
#ifndef _Graphic3d_ArrayOfQuadrangles_HeaderFile
|
||||
#define _Graphic3d_ArrayOfQuadrangles_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_OutOfRange;
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfQuadrangles;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfQuadrangles, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains quatrangles array definition
|
||||
//! Contains quadrangles array definition.
|
||||
//! WARNING! Quadrangle primitives might be unsupported by graphics library.
|
||||
//! Triangulation should be used instead of quads for better compatibility.
|
||||
class Graphic3d_ArrayOfQuadrangles : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangles, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of quadrangles,
|
||||
//! a quadrangle can be filled as:
|
||||
//! 1) creating a set of quadrangles defined with his vertexs.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangles(8)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x8,y8,z8)
|
||||
//! 3) creating a set of indexed quadrangles defined with his vertex
|
||||
//! ans edges.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangles(6,8)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x6,y6,z6)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(5)
|
||||
//! myArray->AddEdge(6)
|
||||
//!
|
||||
//! <maxVertexs> defined the maximun allowed vertex number in the array.
|
||||
//! <maxEdges> defined the maximun allowed edge number in the array.
|
||||
//! Warning:
|
||||
//! When <hasVNormals> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Normal)
|
||||
//! or AddVertex(Point,Normal,Color)
|
||||
//! or AddVertex(Point,Normal,Texel) methods.
|
||||
//! When <hasVColors> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Color)
|
||||
//! or AddVertex(Point,Normal,Color) methods.
|
||||
//! When <hasTexels> is TRUE , you must use one of
|
||||
//! AddVertex(Point,Texel)
|
||||
//! or AddVertex(Point,Normal,Texel) methods.
|
||||
//! Warning:
|
||||
//! the user is responsible about the orientation of the quadrangle
|
||||
//! depending of the order of the created vertex or edges and this
|
||||
//! orientation must be coherent with the vertex normal optionnaly
|
||||
//! given at each vertex (See the Orientate() methods).
|
||||
Standard_EXPORT Graphic3d_ArrayOfQuadrangles(const Standard_Integer maxVertexs, const Standard_Integer maxEdges = 0, const Standard_Boolean hasVNormals = Standard_False, const Standard_Boolean hasVColors = Standard_False, const Standard_Boolean hasTexels = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfQuadrangles,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Creates an array of quadrangles, a quadrangle can be filled as:
|
||||
//! 1) Creating a set of quadrangles defined with his vertexes, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangles (8);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x8, y8, z8);
|
||||
//! @endcode
|
||||
//! 2) Creating a set of indexed quadrangles defined with his vertex ans edges, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfQuadrangles (6, 8);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x6, y6, z6);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (5);
|
||||
//! myArray->AddEdge (6);
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxEdges defines the maximum allowed edge number in the array (for indexed array)
|
||||
Graphic3d_ArrayOfQuadrangles (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxEdges = 0,
|
||||
const Standard_Boolean theHasVNormals = Standard_False,
|
||||
const Standard_Boolean theHasVColors = Standard_False,
|
||||
const Standard_Boolean theHasVTexels = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLES, theMaxVertexs, 0, theMaxEdges, theHasVNormals, theHasVColors, Standard_False, theHasVTexels) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfQuadrangles, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfQuadrangles_HeaderFile
|
||||
|
@@ -1,25 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfSegments,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfSegments::Graphic3d_ArrayOfSegments (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxEdges,
|
||||
const Standard_Boolean theHasVColors)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_SEGMENTS, theMaxVertexs, 0, theMaxEdges, Standard_False, theHasVColors, Standard_False, Standard_False)
|
||||
{}
|
@@ -15,76 +15,47 @@
|
||||
#ifndef _Graphic3d_ArrayOfSegments_HeaderFile
|
||||
#define _Graphic3d_ArrayOfSegments_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
class Graphic3d_ArrayOfSegments;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfSegments, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
//! Contains segments array definition
|
||||
//! Contains segments array definition.
|
||||
class Graphic3d_ArrayOfSegments : public Graphic3d_ArrayOfPrimitives
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfSegments, Graphic3d_ArrayOfPrimitives)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an array of segments,
|
||||
//! a segment can be filled as:
|
||||
//! 1) creating a set of segments defined with his vertexs.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfSegments(4)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! 2) creating a set of indexed segments defined with his vertex
|
||||
//! ans edges.
|
||||
//! i.e:
|
||||
//! myArray = Graphic3d_ArrayOfSegments(4,0,8)
|
||||
//! myArray->AddVertex(x1,y1,z1)
|
||||
//! ....
|
||||
//! myArray->AddVertex(x4,y4,z4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(3)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(2)
|
||||
//! myArray->AddEdge(4)
|
||||
//! myArray->AddEdge(1)
|
||||
//! myArray->AddEdge(3)
|
||||
//!
|
||||
//! <maxVertexs> defined the maximun allowed vertex number in the array.
|
||||
//! <maxEdges> defined the maximun allowed edge number in the array.
|
||||
//! Warning:
|
||||
//! When <hasVColors> is TRUE , you must use only
|
||||
//! AddVertex(Point,Color) method
|
||||
Standard_EXPORT Graphic3d_ArrayOfSegments(const Standard_Integer maxVertexs, const Standard_Integer maxEdges = 0, const Standard_Boolean hasVColors = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfSegments,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Creates an array of segments, a segment can be filled as:
|
||||
//! 1) Creating a set of segments defined with his vertexes, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfSegments (4);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! @endcode
|
||||
//! 2) Creating a set of indexed segments defined with his vertex and edges, i.e:
|
||||
//! @code
|
||||
//! myArray = Graphic3d_ArrayOfSegments (4, 0, 8);
|
||||
//! myArray->AddVertex (x1, y1, z1);
|
||||
//! ....
|
||||
//! myArray->AddVertex (x4, y4, z4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (3);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (2);
|
||||
//! myArray->AddEdge (4);
|
||||
//! myArray->AddEdge (1);
|
||||
//! myArray->AddEdge (3);
|
||||
//! @endcode
|
||||
//! @param theMaxVertexs defines the maximum allowed vertex number in the array
|
||||
//! @param theMaxEdges defines the maximum allowed edge number in the array
|
||||
//! @param theHasVColors when TRUE, AddVertex(Point,Color) should be used for specifying vertex color
|
||||
Graphic3d_ArrayOfSegments (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxEdges = 0,
|
||||
const Standard_Boolean theHasVColors = Standard_False)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_SEGMENTS, theMaxVertexs, 0, theMaxEdges, Standard_False, theHasVColors, Standard_False, Standard_False) {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfSegments, Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
#endif // _Graphic3d_ArrayOfSegments_HeaderFile
|
||||
|
@@ -1,28 +0,0 @@
|
||||
// Created on: 2001-01-04
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangleFans.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfTriangleFans,Graphic3d_ArrayOfPrimitives)
|
||||
|
||||
Graphic3d_ArrayOfTriangleFans::Graphic3d_ArrayOfTriangleFans (const Standard_Integer theMaxVertexs,
|
||||
const Standard_Integer theMaxFans,
|
||||
const Standard_Boolean theHasVNormals,
|
||||
const Standard_Boolean theHasVColors,
|
||||
const Standard_Boolean theHasFColors,
|
||||
const Standard_Boolean theHasVTexels)
|
||||
: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_TRIANGLEFANS, theMaxVertexs, theMaxFans, 0, theHasVNormals, theHasVColors, theHasFColors, theHasVTexels)
|
||||
{}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user