mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
23 Commits
CR30552_1
...
CR0-PDelCS
Author | SHA1 | Date | |
---|---|---|---|
|
5c90c3a7ef | ||
|
cdc74aad9f | ||
|
306c3ea1fe | ||
|
0273a8a01e | ||
|
3828af0c3b | ||
|
e3e176358a | ||
|
24a9d1a425 | ||
|
1fcb1314a5 | ||
|
0551d229fe | ||
|
b5169952f0 | ||
|
a9d16e8a55 | ||
|
b2fbc96924 | ||
|
9765ceec03 | ||
|
9c50685d87 | ||
|
e29426afd4 | ||
|
7a1b6abbea | ||
|
88114cdb41 | ||
|
9d8bbc4755 | ||
|
13223d710e | ||
|
da113e0ffb | ||
|
6a537593a1 | ||
|
73fbbcd771 | ||
|
9c55cd84c9 |
@@ -62,7 +62,6 @@ if (WIN32)
|
||||
set (CSF_advapi32 "advapi32.lib")
|
||||
set (CSF_gdi32 "gdi32.lib")
|
||||
set (CSF_user32 "user32.lib")
|
||||
set (CSF_shell32 "shell32.lib")
|
||||
set (CSF_wsock32 "wsock32.lib")
|
||||
set (CSF_psapi "psapi.lib")
|
||||
set (CSF_d3d9 "D3D9.lib")
|
||||
|
@@ -1345,7 +1345,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_advapi32) "advapi32"
|
||||
set aLibsMap(CSF_gdi32) "gdi32"
|
||||
set aLibsMap(CSF_user32) "user32 comdlg32"
|
||||
set aLibsMap(CSF_shell32) "shell32"
|
||||
set aLibsMap(CSF_opengl32) "opengl32"
|
||||
set aLibsMap(CSF_wsock32) "wsock32"
|
||||
set aLibsMap(CSF_netapi32) "netapi32"
|
||||
|
@@ -110,7 +110,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>.\..\..\..\win32\__VCVER__\bin\__TKNAM__.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\lib;$(CSF_OPT_LIB32);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -159,7 +159,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>.\..\..\..\win32\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -206,7 +206,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>.\..\..\..\win64\__VCVER__\bin\__TKNAM__.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\lib;$(CSF_OPT_LIB64);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -255,7 +255,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>.\..\..\..\win64\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
|
@@ -103,7 +103,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\lib;$(CSF_OPT_LIB32);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>__VCReleasePDB__</GenerateDebugInformation>
|
||||
@@ -149,7 +149,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -193,7 +193,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\lib;$(CSF_OPT_LIB64);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>__VCReleasePDB__</GenerateDebugInformation>
|
||||
@@ -238,7 +238,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
||||
<AdditionalDependencies>__TKDEP__;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@@ -89,14 +89,6 @@ file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXTERNAL_SEARCH = NO")
|
||||
# Formula options
|
||||
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nMATHJAX_RELPATH = ${3RDPARTY_MATHJAX_RELATIVE_PATH}")
|
||||
|
||||
# If MSVC is used as build system, change warning format to the one recognized by MSVC
|
||||
if (MSVC)
|
||||
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nWARN_FORMAT = \"$file($line): $text\"")
|
||||
endif()
|
||||
|
||||
# Avoid Doxygen parsing messages in the build log
|
||||
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nQUIET = YES")
|
||||
|
||||
# Copy index file to provide fast access to HTML documentation
|
||||
file(COPY "${OCCT_OVERVIEW_RESOURCE_DIR}/index.html" DESTINATION "${OCCT_GENERATED_OVERVIEW_DIR}")
|
||||
|
||||
|
@@ -1091,7 +1091,7 @@ The following environment variables have become redundant:
|
||||
|
||||
* *CSF_UnitsLexicon* and *CSF_UnitsDefinition* are no more used. Units definition (*UnitsAPI/Lexi_Expr.dat* and *UnitsAPI/Units.dat*) is now embedded into source code.
|
||||
* *CSF_XSMessage* and *CSF_XHMessage* are now optional.
|
||||
English messages (XSMessage/\*XSTEP.us* and SHMessage/\*SHAPE.us*) are now embedded into source code
|
||||
English messages (XSMessage/*XSTEP.us* and SHMessage/*SHAPE.us*) are now embedded into source code
|
||||
and automatically loaded when environment variables are not set.
|
||||
* *CSF_ShadersDirectory* is not required any more, though it still can be used to load custom shaders.
|
||||
Mandatory GLSL resources are now embedded into source code.
|
||||
@@ -1678,47 +1678,3 @@ Standard_Boolean meshing_new()
|
||||
Some public methods of the class BRepFilletAPI_MakeChamfer are released from excess arguments:
|
||||
- method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
|
||||
- method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
|
||||
|
||||
@subsection upgrade_740_aspects Aspects unification
|
||||
|
||||
Fill Area, Line and Marker aspects (classes *Graphic3d_AspectFillArea3d*, *Graphic3d_AspectLine3d*, *Graphic3d_AspectMarker3d* and *Graphic3d_AspectText3d*)
|
||||
have been merged into new class *Graphic3d_Aspects* providing a single state for rendering primitives of any type.
|
||||
The old per-primitive type aspect classes have been preserved as sub-classes of *Graphic3d_Aspects* with default values close to the previous behavior.
|
||||
All aspects except Graphic3d_AspectFillArea3d define Graphic3d_TOSM_UNLIT shading model.
|
||||
|
||||
The previous approach with dedicated aspects per primitive type was handy in simplified case, but lead to confusion otherwise.
|
||||
In fact, drawing points or lines with lighting applied is a valid use case, but only *Graphic3d_AspectFillArea3d* previously defined necessary material properties.
|
||||
|
||||
As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
|
||||
Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
|
||||
For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
|
||||
~~~~
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
|
||||
aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect
|
||||
aGroup->AddPrimitiveArray (aTris);
|
||||
~~~~
|
||||
|
||||
To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
|
||||
~~~~
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
|
||||
aGroup->AddPrimitiveArray (aTris);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
|
||||
aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect
|
||||
aGroup->AddPrimitiveArray (aLines);
|
||||
~~~~
|
||||
|
||||
@subsection upgrade_740_interiorstyles Interior styles
|
||||
|
||||
* *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_EMPTY) to get previous behavior of Aspect_IS_HOLLOW style.
|
||||
* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
|
||||
|
@@ -23,7 +23,7 @@ WARNINGS = NO
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
PREDEFINED = Standard_EXPORT Standard_NODISCARD Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC
|
||||
PREDEFINED = Standard_EXPORT Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
|
@@ -16,6 +16,7 @@ WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = \\$file:\$line: \$text\
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.md *.dox
|
||||
RECURSIVE = YES
|
||||
@@ -55,6 +56,6 @@ USE_MATHJAX = YES
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
|
||||
# Define alias for inserting images in uniform way (both HTML and PDF)
|
||||
ALIASES += figure{1}="\image html \1"
|
||||
ALIASES += figure{2}="\image html \1 \2"
|
||||
ALIASES += figure{3}="\image html \1 \2"
|
||||
ALIASES += figure{1}="\image html \1 \n"
|
||||
ALIASES += figure{2}="\image html \1 \2 \n"
|
||||
ALIASES += figure{3}="\image html \1 \2 \n"
|
||||
|
@@ -16,6 +16,7 @@ WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = \\$file:\$line: \$text\
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.md *.dox
|
||||
RECURSIVE = YES
|
||||
@@ -48,6 +49,6 @@ LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
|
||||
# Define alias for inserting images in uniform way (both HTML and PDF)
|
||||
ALIASES += figure{1}="\image latex \1"
|
||||
ALIASES += figure{2}="\image latex \1 \2"
|
||||
ALIASES += figure{3}="\image latex \1 \2 width=\3"
|
||||
ALIASES += figure{1}="\image latex \1 \n"
|
||||
ALIASES += figure{2}="\image latex \1 \2 \n"
|
||||
ALIASES += figure{3}="\image latex \1 \2 width=\3 \n"
|
||||
|
@@ -178,10 +178,10 @@ if (!Interface_Static::SetRVal ("read.maxprecision.val",0.1))
|
||||
Default value is 1.
|
||||
|
||||
<h4>read.stdsameparameter.mode</h4>
|
||||
defines the using of *BRepLib\::SameParameter*. Its possible values are:
|
||||
* 0 (Off) -- *BRepLib\::SameParameter* is not called,
|
||||
* 1 (On) -- *BRepLib\::SameParameter* is called.
|
||||
*BRepLib\::SameParameter* is used through *ShapeFix_Edge\::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib\::SameParameter*.
|
||||
defines the using of *BRepLib::SameParameter*. Its possible values are:
|
||||
* 0 (Off) -- *BRepLib::SameParameter* is not called,
|
||||
* 1 (On) -- *BRepLib::SameParameter* is called.
|
||||
*BRepLib::SameParameter* is used through *ShapeFix_Edge::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib::SameParameter*.
|
||||
Read this parameter with:
|
||||
~~~~~
|
||||
Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode");
|
||||
@@ -202,7 +202,7 @@ The processor also decides to re-compute either the 3D or the 2D curve even if
|
||||
* the number of sub-curves in the 2D curve is different from the number of sub-curves in the 3D curve. This can be either due to different numbers of sub-curves given in the IGES file or because of splitting of curves during translation.
|
||||
* 3D or 2D curve is a Circular Arc (entity type 100) starting and ending in the same point (note that this case is incorrect according to the IGES standard).
|
||||
|
||||
The parameter *read.surfacecurve.mode* defines which curve (3D or 2D) is used for re-computing the other one:
|
||||
The parameter *read.surfacecurve.mode* defines which curve (3D or 2D) is used for re-computing the other one:
|
||||
* *Default(0)* use the preference flag value in the entity's Parameter Data section. The flag values are:
|
||||
* 0: no preference given,
|
||||
* 1: use 2D for 142 entities and 3D for 141 entities,
|
||||
@@ -400,12 +400,12 @@ reader.PrintTransferInfo (failsonly, mode);
|
||||
~~~~~
|
||||
displays the messages that appeared during the last invocation of *Transfer* or *TransferRoots*.
|
||||
|
||||
If *failsonly* is *IFSelect_FailOnly*, only fail messages will be output, if it is *IFSelect_FailAndWarn*, all messages will be output. Parameter “mode” can have *IFSelect_xxx* values where *xxx* can be:
|
||||
* *GeneralCount* -- gives general statistics on the transfer (number of translated IGES entities, number of fails and warnings, etc)
|
||||
* *CountByItem* -- gives the number of IGES entities with their types per message.
|
||||
* *ListByItem* -- gives the number of IGES entities with their type and DE numbers per message.
|
||||
* *ResultCount* -- gives the number of resulting OCCT shapes per type.
|
||||
* *Mapping* -- gives mapping between roots of the IGES file and the resulting OCCT shape per IGES and OCCT type.
|
||||
If *failsonly* is *IFSelect_FailOnly*, only fail messages will be output, if it is *IFSelect_FailAndWarn*, all messages will be output. Parameter “mode” can have *IFSelect_xxx* values where *xxx* can be:
|
||||
* *GeneralCount* -- gives general statistics on the transfer (number of translated IGES entities, number of fails and warnings, etc)
|
||||
* *CountByItem* -- gives the number of IGES entities with their types per message.
|
||||
* *ListByItem* -- gives the number of IGES entities with their type and DE numbers per message.
|
||||
* *ResultCount* -- gives the number of resulting OCCT shapes per type.
|
||||
* *Mapping* -- gives mapping between roots of the IGES file and the resulting OCCT shape per IGES and OCCT type.
|
||||
|
||||
@subsection occt_iges_2_4 Mapping of IGES entities to Open CASCADE Technology shapes
|
||||
|
||||
|
@@ -723,6 +723,137 @@ When you write an algorithm which operates on geometric objects, use <i> Adaptor
|
||||
As a result, you can use the algorithm with any kind of object, if you provide for this object an interface derived from *Adaptor3d* or *Adaptor2d*.
|
||||
These interfaces are easy to use: simply create an adapted curve or surface from a *Geom2d* curve, and then use this adapted curve as an argument for the algorithm? which requires it.
|
||||
|
||||
@section occt_modat_4per Concept of periodicity applied in OCCT-algorithms
|
||||
|
||||
@subsection occt_modat_4per_1 Mathematical definition
|
||||
|
||||
In math, the following definition of periodicity is applied (detailed information can be found in <a href="https://en.wikipedia.org/wiki/Periodic_function">Wikipedia</a> or on the site of <a href="http://mathworld.wolfram.com/PeriodicFunction.html">WolframMathWorld</a>):
|
||||
|
||||
A function of a real variable \f$ f(x) \f$ is said to be periodic with period \f$ T \neq 0 \f$ if<br>
|
||||
<span>1.</span> For every \f$ x \in \mathfrak{D}_{f} \f$ (\f$ \mathfrak{D}_{f} \f$ is the domain of the function \f$ f(x) \f$), the point \f$ \left (x \pm T*n \right ) \in \mathfrak{D}_{f} \f$ (where \f$ n \f$ applies positive integer values only: \f$ n=1,2,... \f$ ) and the condition
|
||||
\f[ f(x-T*n)=f(x+T*n)=f(x) \f]
|
||||
is satisfied.<br>
|
||||
<span>2.</span> For every \f$ x \notin \mathfrak{D}_{f} \f$, the point \f$ \left (x \pm T*n \right ) \notin \mathfrak{D}_{f} \f$, (where \f$ n=1,2,... \f$ ).<br>
|
||||
|
||||
@subsubsection occt_modat_4per_1_1 Example
|
||||
|
||||
For example, the tangent function \f$ f(x)=\tan(x) \f$ is periodic with least period (a least positive constant \f$ T \f$, which will be called later as period) \f$ \pi \f$ because \f$ \tan(x) \f$ is not defined only in points \f$ x=\left (\frac{\pi }{2}\pm \pi *n \right ) \f$ (where \f$ n=0,1,2,... \f$) and for other points the condition<br>
|
||||
\f[ \tan(x-\pi*n)=\tan(x+\pi*n)=\tan(x) \f]
|
||||
is satisfied.
|
||||
|
||||
As we can see from the definition, any periodic function cannot have bounded domain (because product \f$ T*n \f$ tends to infinite) but can be discontinuous. Let us look, how it is realized in OCCT.
|
||||
|
||||
@subsection occt_modat_4per_2 Periodicity of bounded curves
|
||||
|
||||
First of all, OCCT works only with continuous elements (curves and surfaces). <b>I.e. work with curves having continuity less than C0 (e.g. with any gaps) is not supported.</b>
|
||||
|
||||
In OCCT, set of bounded curves includes only Bezier curves, B-spline curves and trimmed curves. Let us consider these objects from point of view to be periodic.
|
||||
|
||||
@subsubsection occt_modat_4per_2_1 Bezier curves
|
||||
|
||||
Bezier curve is always defined in the range \f$ \mathfrak{D}=\left [ 0,1 \right ] \f$ and does not allow any analytical extension. Therefore, <b>Bezier curve cannot be periodic at all</b>.
|
||||
|
||||
@subsubsection occt_modat_4per_2_2 B-spline curve
|
||||
|
||||
OCCT can create <a href="https://en.wikiversity.org/wiki/CAGD/B-splines#Periodic_B-splines">periodic B-spline</a> and can convert any closed B-spline into periodic one. At that, any periodic B-spline is defined on the set of real numbers (\f$ \mathfrak{D}=\mathbb{R} \f$). Nevertheless, in OCCT, periodic B-splines are included in set of bounded curves, too. The class of Bounded curves does not separate periodic and not-periodic B-splines.<br>
|
||||
|
||||
However, <b>range of not-periodic B-spline must be considered as its domain</b>. I.e. if any not-periodic B-spline curve is parametrized in the range \f$ t \in \left [ 0,1 \right ] \f$ then its evaluation in the point \f$ t=1.5 \f$ is forbidden (in general). Evaluation of B-spline curve on its analytical extension can be used in some cases. However, it is out of scope of this article.
|
||||
|
||||
@subsubsection occt_modat_4per_2_3 Trimmed curve
|
||||
|
||||
OCCT-algorithms allow trimmed curve’s existing out of trim boundaries (exceptionally, if these boundaries match the domain completely). Evidently, the trimmed curve is not defined in the region where its basis curve is not defined.<br>
|
||||
|
||||
E.g. if some trimmed curve is an arc of circle and the trim boundaries are \f$ t \in \left [ \frac{\pi }{2},\pi \right ] \f$ then nothing prevents us to compute the value of this arc in the point \f$ t=\frac{3\pi}{2} \f$. Analogically, for some line trimmed in the range \f$ t \in \left [ 0,1 \right ] \f$ nothing prevents us to compute the value in the point \f$ t=100 \f$. In other words, <b>trim boundaries must not be considered as domain boundaries</b>. And curve trimmed from any periodic curve exists out of trim boundaries. Consequently, this trimmed curve can be considered as periodic curve.<br>
|
||||
|
||||
Also, let us make the final conclusion. <b>In OCCT-algorithms, trimmed curve is considered to be periodic if its basis curve is periodic. At that trim boundaries do not play any role. I.e. the curve itself can be periodic and not-closed</b>.<br>
|
||||
|
||||
@subsubsection occt_modat_4per_2_4 Trim boundaries
|
||||
|
||||
@ref occt_modat_4per_2_3 "We have just found out" that the trim boundaries are not domain boundaries. But what is their real role in OCCT-algorithms?
|
||||
|
||||
Trim boundaries define some work range of the trimmed curve. Indeed, this (default) work range exists for any OCCT-curve (not only for trimmed one). For any periodic not-trimmed curve, the work range is \f$ \mathfrak{W}=\left [ 0,T \right ) \f$ (where \f$ T \f$ is the period of the curve). For bounded not-trimmed curve, this work range matches its domain. For other not-trimmed curves (e.g. line), the work range is \f$ \mathfrak{W}=\left ( -\infty ,+\infty \right ) \f$ (i.e. matches its domain, too).
|
||||
|
||||
Operation <b><i>"TRIM"</i></b> applied to the curve allows changing its default work range (shift or reduce but not increase). <b>Setting work range greater than the default one is strictly forbidden</b>.
|
||||
|
||||
E.g. the default work range of any circle is \f$ \mathfrak{W}=\left [ 0,2\pi \right ) \f$. With <b><i>"TRIM"</i></b> operation you can create trimmed circle (i.e. arc) with work ranges \f$ \left [ 0,\pi \right ] \f$, \f$ \left [ 5\pi,\frac{11\pi}{2} \right ] \f$, \f$ \left [ 100\pi,102\pi \right ] \f$ etc. However, you must have failed to create arc with work range \f$ \left [ 50\pi,55\pi \right ] \f$, because this new work range is greater than \f$ \mathfrak{W} \f$.
|
||||
|
||||
For not-periodic B-spline curve with default work range \f$ \mathfrak{W}=\left [ 0,1 \right ] \f$, you can create trimmed B-spline curve with work ranges \f$ \left [ 0,0.1 \right ] \f$, \f$ \left [ 0.6,0.78 \right ] \f$, \f$ \left [ 0.5,1 \right ] \f$ etc. However, you must have failed to set work range to \f$ \left [ 0.8,1.5 \right ] \f$ (because the input B-spline is not defined in the range \f$ \left ( 1,1.5 \right ] \f$).
|
||||
|
||||
For a line, you can create any work range with <b><i>"TRIM"</i></b> operation. Every work range will be valid.
|
||||
|
||||
Use the method **GeomLib::AllowExtend(...)** in order to check whether the new work range can be applied to the curve. Please see documentation about this method.
|
||||
|
||||
However, what does work range bring to OCCT? The point is that the most OCCT-algorithms tend to work in work ranges of their input data. So, if you call extrema high-level tool (exactly API) then you will obtain point with parameters already adjusted in work range of the arguments. If you call surface-surface intersection algorithm (API again) then you will obtain 3D-curve and two 2D-curves, which are already in surfaces’ work ranges (you do not need any shifting them). So, correct using work ranges makes work with OCCT more convenient.
|
||||
|
||||
@subsection occt_modat_4per_3 Periodicity of curves’ adaptors
|
||||
|
||||
In OCCT, periodicity of adaptors depends on the periodicity of its curves only. Any ranges are not taken into account.
|
||||
|
||||
At that, it is useful to note the fact that adaptor’s curve is always not trimmed. I.e. if some trimmed curve is sent into some adaptor then the adaptor will store the basis (not trimmed) curve and First/Last parameters of adaptor will be set to the corresponding trim-boundaries.
|
||||
|
||||
Moreover, there are some specific adaptors in OCCT. E.g. **BRepAdaptor_CompCurve**. Periodicity of such adaptors is defined in a special way. So, it is necessary to read reference manual about these classes in order to get more clear understanding of their behavior.
|
||||
|
||||
@subsection occt_modat_4per_4 Periodicity of surfaces
|
||||
|
||||
In OCCT, surface(s) is set in parametric form by vector-function of two real variables: \f$ S(U,V) \f$. As result, term of periodicity is considered for every such variable separately (\f$ U\f$-periodic and \f$ V \f$-periodic surfaces are considered). Also, there exist bi-periodic surfaces (e.g. Toroidal surface), which are periodic in both \f$ U \f$- and \f$ V \f$-directions (OCCT does not work with univariate function of a complex argument; therefore commonly-used terms "Double periodic" or "Triple periodic" are not figured in OCCT).
|
||||
|
||||
So, \f$ U \f$-periodic surface can be defined as follows: <b>The surface \f$ S(U,V) \f$ is \f$ U \f$-periodic if for every fixed value of \f$ V \f$-argument \f$ (V=V_{0})\f$ one of the following conditions is satisfied:<br>
|
||||
<span>1.</span> For every \f$ U\in \mathbb{R} \f$, the point \f$ (U, V_{0}) \notin \mathfrak{D}_{S} \f$, where \f$ \mathfrak{D}_{S} \f$ is the domain of the surface \f$ S \f$;<br>
|
||||
<span>2.</span> Otherwise, the univariate function of real variable \f$ F(U)=S(U,V_{0} ) \f$ is periodic.</b><br>
|
||||
|
||||
V-periodic surface can be defined analogically: <b>The surface \f$ S(U,V) \f$ is \f$ V \f$-periodic if for every fixed value of \f$ U \f$-argument \f$ (U=U_{0})\f$ one of the following conditions is satisfied:<br>
|
||||
<span>1.</span> For every \f$ V\in \mathbb{R} \f$, the point \f$ (U_{0}, V) \notin \mathfrak{D}_{S} \f$, where \f$ \mathfrak{D}_{S} \f$ is the domain of the surface \f$ S \f$;<br>
|
||||
<span>2.</span> Otherwise, the univariate function of real variable \f$ F(V)=S(U_{0}, V) \f$ is periodic.</b><br>
|
||||
|
||||
All remarks made @ref occt_modat_4per_2 "above" considering bounded curves are satisfied for bounded surfaces. At that, a work range of any surface is a region in 2D (rectangular) Cartesian coordinate system taking into account permissible values of U and V parameters. The example is given @ref occt_modat_4per_5 "below".
|
||||
|
||||
There exist some methods analogical to **GeomLib::AllowExtend(...)** but can be applied to surface. These methods are called **GeomLib::AllowExtendUParameter(...)** and **GeomLib::AllowExtendVParameter(...)**.
|
||||
|
||||
@subsection occt_modat_4per_5 Special questions about periodicity of surfaces
|
||||
@subsubsection occt_modat_4per_5_1 Periodicity of a spherical surface
|
||||
|
||||
Let us consider a spherical surface having radius \f$ R \f$. It can be defined in local coordinate system (<a href="http://help.autodesk.com/view/INVNTOR/2014/ENU/?guid=GUID-FF15BB0D-5FE9-45F9-92FD-D70A3F6A8FD0">UCS</a>) by the vector function of two scalar arguments:
|
||||
\f[
|
||||
S\left ( U,V \right )=R* \begin{pmatrix}
|
||||
\cos (U)*\cos (V)\\
|
||||
\sin (U)*\cos (V)\\
|
||||
\sin (V)
|
||||
\end{pmatrix}
|
||||
\f]
|
||||
|
||||
As we can see, this function is \f$ V \f$-periodic and its \f$ V \f$-period is equal to \f$ 2\pi \f$. And it is \f$ U \f$-periodic with \f$ U \f$-period \f$ 2\pi \f$. I.e. (theoretically) the default work range of any surface with such equation is the set of 2D-points such \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, 0\leq V < 2\pi \right \} \f$.
|
||||
|
||||
However, let us take two different points in the parametric space: \f$ (0,0) \f$ and \f$ (\pi,\pi) \f$. Their 3D-images are: \f$ S\left ( 0,0 \right )=\begin{pmatrix}R & 0 & 0\end{pmatrix}^{T} \f$, \f$ S\left ( \pi,\pi \right )=\begin{pmatrix}R & 0 & 0\end{pmatrix}^{T} \f$. As we can see, 3D-points are the same. This fact is inappropriate for different points from one work range. Such result says about that the surface \f$ S(U,V) \f$ is self-interfered surface.
|
||||
|
||||
<b>Working with self-interfered elements is not supported by OCCT at all</b>. Therefore, in order to make spherical surface valid, specific domain is assigned to sphere. Namely:<br>
|
||||
|
||||
\f[ \mathfrak{D}_{S}= \left \{(U,V)|-\infty < U < +\infty , -\frac{\pi}{2}\leq V \leq \frac{\pi}{2} \right \} \f]
|
||||
|
||||
Of course, the range for V-parameter must be \f$ -\frac{\pi}{2}+2\pi n\leq V \leq \frac{\pi}{2}+2\pi n \f$ (where \f$ n \f$ applies positive integer values only: \f$ n=1,2,... \f$). However, this range is discontinuous and is not supported (see the section @ref occt_modat_4per_2). Therefore, \f$ V \f$-parameter of spherical surface is considered to be bounded. Consequently, <b>sphere is considered to be not \f$ V \f$-periodic</b>.
|
||||
|
||||
Based on this fact, the default sphere’s work range is \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, -\frac{\pi}{2}\leq V \leq \frac{\pi}{2} \right \} \f$. Please pay attention to the fact that the spherical surface is \f$ U \f$-periodic surface. Therefore, value of \f$ U \f$-parameter can be any real number (the set \f$ \mathbb{R} \f$ ). However, its work range in \f$ U \f$-direction cannot be greater than \f$ 2\pi \f$. In that way the sphere is not self-interfered (the point \f$ (\pi,\pi) \f$ is out of its domain) and is valid completely.
|
||||
|
||||
@subsubsection occt_modat_4per_5_2 Periodicity of a Surface-of-Revolution
|
||||
|
||||
@ref occt_modat_4per_5_1 "Analogical situation" exists with surface of revolution. Having taken into account all said above, let us formulate conditions when the surface of revolution is \f$ V \f$-periodic.
|
||||
|
||||
Evidently, for that case, the basis curve must be periodic curve. Additionally, revolving full curve (taken with its default work range) must not lead to create self-interfered surface of revolution (i.e. this curve must not intersect the rotation axis). In other words, <b>the valid (not self-interfered) surface of revolution must be based on closed periodic curve in order to be \f$ V \f$-periodic</b>.
|
||||
|
||||
Please note that the basis curve can be not-closed by different reasons (not only in order to avoid creating self-interfered surface of revolution), which are neither nor separated nor analyzed by OCCT. OCCT uses simple check: periodicity of basis curve and its closure. It is connected with the fact that the property of periodicity of a Surface-of-Revolution is not very important for OCCT-algorithms because almost all algorithms work only with work range of a Surface-of-Revolution (i.e. in most cases we do not need in adjusting parameters).
|
||||
|
||||
Based on the foregoing, the domain of any not \f$ V \f$-periodic surface of revolution is \f$ \mathfrak{D}_{S}= \left \{(U,V)|-\infty < U < +\infty , C_{f} \leq V \leq C_{l} \right \} \f$, where \f$ \left [C_{f},C_{l} \right ] \f$ is the work range of the basis curve (i.e. the work range of the basis curve defines the domain of the surface). The default work range of this surface is \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, C_{f} \leq V \leq C_{l} \right \} \f$.
|
||||
|
||||
Finally, it is got to be said that the constructors of surface of revolution do not check the situation when invalid result can be created. It must be done on application level (e.g. by using **GeomLib::AllowExtendVParameter(...)** method). We offer to use the following steps (which should be used only in places where you doubt in validity of created surface of revolution):
|
||||
|
||||
<span>1.</span>Create a surface of revolution with default work-range of the basis curve;<br>
|
||||
<span>2.</span>Compute new work range of the basis curve (it depends on your requirements only);<br>
|
||||
<span>3.</span>Call **GeomLib::AllowExtendVParameter(...)** method with existing surface of revolution and the new range. If the new range is valid the method will return TRUE.<br>
|
||||
|
||||
The method **GeomLib::AllowExtendVParameter(...)** works with spherical surface, too.
|
||||
|
||||
@subsection occt_modat_4per_6 Periodicity of surfaces’ adaptors
|
||||
|
||||
@ref occt_modat_4per_3 "As for curves", periodicity of adaptors depends on the periodicity of its surfaces only. All remarks about curve's adaptor are fair to surfaces.
|
||||
|
||||
@section occt_modat_5 Topology
|
||||
|
||||
|
@@ -1793,11 +1793,12 @@ Create facet attributes.
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = new Graphic3d_AspectFillArea3d();
|
||||
Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NOM_BRASS);
|
||||
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NOM_GOLD);
|
||||
aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID_WIREFRAME);
|
||||
aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
aFaceAspect->SetInteriorColor (aMyColor);
|
||||
aFaceAspect->SetDistinguishOn ();
|
||||
aFaceAspect->SetFrontMaterial (aGoldMaterial);
|
||||
aFaceAspect->SetBackMaterial (aBrassMaterial);
|
||||
aFaceAspect->SetEdgeOn();
|
||||
~~~~~
|
||||
|
||||
Create text attributes.
|
||||
|
@@ -1,68 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(glfw-occt-demo)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET glfwocct)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||
file(GLOB SOURCES
|
||||
*.h
|
||||
*.cpp
|
||||
)
|
||||
source_group ("Headers" FILES
|
||||
GlfwOcctView.h
|
||||
GlfwOcctWindow.h)
|
||||
source_group ("Sources" FILES
|
||||
GlfwOcctView.cpp
|
||||
GlfwOcctWindow.cpp
|
||||
main.cpp)
|
||||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
# Open CASCADE Technology
|
||||
find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
|
||||
if (OpenCASCADE_FOUND)
|
||||
message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_DIR}\"" )
|
||||
INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
|
||||
LINK_DIRECTORIES(${OpenCASCADE_LIBRARY_DIR})
|
||||
else()
|
||||
message (WARNING "Could not find OpenCASCADE, please set OpenCASCADE_DIR variable." )
|
||||
set (OCCT_LIBRARY_DIR)
|
||||
set (OCCT_BIN_DIR)
|
||||
endif()
|
||||
|
||||
SET(OpenCASCADE_LIBS
|
||||
TKernel
|
||||
TKService
|
||||
TKV3d
|
||||
TKOpenGl
|
||||
TKBRep
|
||||
TKGeomBase
|
||||
TKGeomAlgo
|
||||
TKG3d
|
||||
TKG2d
|
||||
TKTopAlgo
|
||||
TKPrim
|
||||
)
|
||||
|
||||
# glfw
|
||||
find_package(glfw3 REQUIRED)
|
||||
if (glfw3_FOUND)
|
||||
message (STATUS "Using glfw3 ${glfw3_VERSION}" )
|
||||
INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${GLFW_LIBRARY_DIRS})
|
||||
else()
|
||||
message (STATUS "glfw3 is not found." )
|
||||
endif()
|
||||
|
||||
add_executable(${APP_TARGET} ${SOURCES})
|
||||
target_link_libraries(
|
||||
${APP_TARGET}
|
||||
${OpenCASCADE_LIBS}
|
||||
glfw
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
@@ -1,324 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#include "GlfwOcctView.h"
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Aspect_Handle.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
// ================================================================
|
||||
// Function : GlfwOcctView
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
GlfwOcctView::GlfwOcctView()
|
||||
: myCurAction3d (CurAction3d_Nothing),
|
||||
myToRedraw (true)
|
||||
{
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : ~GlfwOcctView
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
GlfwOcctView::~GlfwOcctView()
|
||||
{
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : toView
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
GlfwOcctView* GlfwOcctView::toView (GLFWwindow* theWin)
|
||||
{
|
||||
return static_cast<GlfwOcctView*>(glfwGetWindowUserPointer (theWin));
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : errorCallback
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::errorCallback (int theError, const char* theDescription)
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error") + theError + ": " + theDescription, Message_Fail);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : run
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::run()
|
||||
{
|
||||
initWindow (800, 600, "glfw occt");
|
||||
initViewer();
|
||||
initDemoScene();
|
||||
if (myView.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myView->MustBeResized();
|
||||
myOcctWindow->Map();
|
||||
mainloop();
|
||||
cleanup();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : initWindow
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::initWindow (int theWidth, int theHeight, const char* theTitle)
|
||||
{
|
||||
glfwSetErrorCallback (GlfwOcctView::errorCallback);
|
||||
glfwInit();
|
||||
const bool toAskCoreProfile = true;
|
||||
if (toAskCoreProfile)
|
||||
{
|
||||
glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
#if defined (__APPLE__)
|
||||
glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
#endif
|
||||
glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
}
|
||||
myOcctWindow = new GlfwOcctWindow (theWidth, theHeight, theTitle);
|
||||
glfwSetWindowUserPointer (myOcctWindow->getGlfwWindow(), this);
|
||||
// window callback
|
||||
glfwSetWindowSizeCallback (myOcctWindow->getGlfwWindow(), GlfwOcctView::onResizeCallback);
|
||||
glfwSetFramebufferSizeCallback (myOcctWindow->getGlfwWindow(), GlfwOcctView::onFBResizeCallback);
|
||||
// mouse callback
|
||||
glfwSetScrollCallback (myOcctWindow->getGlfwWindow(), GlfwOcctView::onMouseScrollCallback);
|
||||
glfwSetMouseButtonCallback (myOcctWindow->getGlfwWindow(), GlfwOcctView::onMouseButtonCallback);
|
||||
glfwSetCursorPosCallback (myOcctWindow->getGlfwWindow(), GlfwOcctView::onMouseMoveCallback);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : initViewer
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::initViewer()
|
||||
{
|
||||
if (myOcctWindow.IsNull()
|
||||
|| myOcctWindow->getGlfwWindow() == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (myOcctWindow->GetDisplay(), false);
|
||||
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver);
|
||||
aViewer->SetDefaultLights();
|
||||
aViewer->SetLightOn();
|
||||
aViewer->SetDefaultTypeOfView (V3d_PERSPECTIVE);
|
||||
aViewer->ActivateGrid (Aspect_GT_Rectangular, Aspect_GDM_Lines);
|
||||
myView = aViewer->CreateView();
|
||||
myView->SetImmediateUpdate (false);
|
||||
myView->SetWindow (myOcctWindow, myOcctWindow->NativeGlContext());
|
||||
myView->ChangeRenderingParams().ToShowStats = true;
|
||||
myContext = new AIS_InteractiveContext (aViewer);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : initDemoScene
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::initDemoScene()
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myView->TriedronDisplay (Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_WIREFRAME);
|
||||
|
||||
gp_Ax2 anAxis;
|
||||
anAxis.SetLocation (gp_Pnt (0.0, 0.0, 0.0));
|
||||
Handle(AIS_Shape) aBox = new AIS_Shape (BRepPrimAPI_MakeBox (anAxis, 50, 50, 50).Shape());
|
||||
myContext->Display (aBox, AIS_Shaded, 0, false);
|
||||
anAxis.SetLocation (gp_Pnt (25.0, 125.0, 0.0));
|
||||
Handle(AIS_Shape) aCone = new AIS_Shape (BRepPrimAPI_MakeCone (anAxis, 25, 0, 50).Shape());
|
||||
myContext->Display (aCone, AIS_Shaded, 0, false);
|
||||
|
||||
TCollection_AsciiString aGlInfo;
|
||||
{
|
||||
TColStd_IndexedDataMapOfStringString aRendInfo;
|
||||
myView->DiagnosticInformation (aRendInfo, Graphic3d_DiagnosticInfo_Basic);
|
||||
for (TColStd_IndexedDataMapOfStringString::Iterator aValueIter (aRendInfo); aValueIter.More(); aValueIter.Next())
|
||||
{
|
||||
if (!aGlInfo.IsEmpty()) { aGlInfo += "\n"; }
|
||||
aGlInfo += TCollection_AsciiString(" ") + aValueIter.Key() + ": " + aValueIter.Value();
|
||||
}
|
||||
}
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("OpenGL info:\n") + aGlInfo, Message_Info);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : mainloop
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::mainloop()
|
||||
{
|
||||
while (!glfwWindowShouldClose (myOcctWindow->getGlfwWindow()))
|
||||
{
|
||||
// glfwPollEvents() for continuous rendering (immediate return if there are no new events)
|
||||
// and glfwWaitEvents() for rendering on demand (something actually happened in the viewer)
|
||||
//glfwPollEvents();
|
||||
glfwWaitEvents();
|
||||
if (!myView.IsNull())
|
||||
{
|
||||
if (myView->IsInvalidated())
|
||||
{
|
||||
myView->Redraw();
|
||||
}
|
||||
else if (myToRedraw)
|
||||
{
|
||||
myView->RedrawImmediate();
|
||||
}
|
||||
myToRedraw = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : cleanup
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::cleanup()
|
||||
{
|
||||
if (!myView.IsNull())
|
||||
{
|
||||
myView->Remove();
|
||||
}
|
||||
if (!myOcctWindow.IsNull())
|
||||
{
|
||||
myOcctWindow->Close();
|
||||
}
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onResize
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::onResize (int theWidth, int theHeight)
|
||||
{
|
||||
if (theWidth != 0
|
||||
&& theHeight != 0
|
||||
&& !myView.IsNull())
|
||||
{
|
||||
myView->Window()->DoResize();
|
||||
myView->MustBeResized();
|
||||
myView->Invalidate();
|
||||
myView->Redraw();
|
||||
//myToRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onMouseScroll
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::onMouseScroll (double theOffsetX, double theOffsetY)
|
||||
{
|
||||
if (myView.IsNull()) { return; }
|
||||
|
||||
const Graphic3d_Vec2i aPos = myOcctWindow->CursorPosition();
|
||||
myView->StartZoomAtPoint (aPos.x(), aPos.y());
|
||||
myView->ZoomAtPoint (0, 0, int(theOffsetY * 4.0), int(theOffsetY * 4.0));
|
||||
myView->Invalidate();
|
||||
myToRedraw = true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onMouseButton
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::onMouseButton (int theButton, int theAction, int theMods)
|
||||
{
|
||||
if (myView.IsNull()) { return; }
|
||||
|
||||
const Graphic3d_Vec2i aPos = myOcctWindow->CursorPosition();
|
||||
if (theAction != GLFW_PRESS)
|
||||
{
|
||||
myCurAction3d = CurAction3d_Nothing;
|
||||
return;
|
||||
}
|
||||
|
||||
myMouseMin = aPos;
|
||||
myMouseMax = aPos;
|
||||
switch (theButton)
|
||||
{
|
||||
case GLFW_MOUSE_BUTTON_RIGHT:
|
||||
{
|
||||
myCurAction3d = CurAction3d_DynamicRoation;
|
||||
myView->StartRotation (aPos.x(), aPos.y());
|
||||
break;
|
||||
}
|
||||
case GLFW_MOUSE_BUTTON_MIDDLE:
|
||||
{
|
||||
myCurAction3d = CurAction3d_DynamicPanning;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : onMouseMove
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctView::onMouseMove (int thePosX, int thePosY)
|
||||
{
|
||||
if (myView.IsNull()) { return; }
|
||||
|
||||
switch (myCurAction3d)
|
||||
{
|
||||
case CurAction3d_DynamicRoation:
|
||||
{
|
||||
myView->Rotation (thePosX, thePosY);
|
||||
myView->Invalidate();
|
||||
myToRedraw = true;
|
||||
break;
|
||||
}
|
||||
case CurAction3d_DynamicPanning:
|
||||
{
|
||||
myView->Pan (thePosX - myMouseMax.x(), -(thePosY - myMouseMax.y()));
|
||||
myView->Invalidate();
|
||||
myToRedraw = true;
|
||||
myMouseMax.SetValues (thePosX, thePosY);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
myContext->MoveTo (thePosX, thePosY, myView, false);
|
||||
myToRedraw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,125 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#ifndef _GlfwOcctView_Header
|
||||
#define _GlfwOcctView_Header
|
||||
|
||||
#include "GlfwOcctWindow.h"
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
//! Sample class creating 3D Viewer within GLFW window.
|
||||
class GlfwOcctView
|
||||
{
|
||||
public:
|
||||
enum CurAction3d
|
||||
{
|
||||
CurAction3d_Nothing,
|
||||
CurAction3d_DynamicZooming,
|
||||
CurAction3d_DynamicPanning,
|
||||
CurAction3d_DynamicRoation
|
||||
};
|
||||
|
||||
public:
|
||||
//! Default constructor.
|
||||
GlfwOcctView();
|
||||
|
||||
//! Destructor.
|
||||
~GlfwOcctView();
|
||||
|
||||
//! Main application entry point.
|
||||
void run();
|
||||
|
||||
private:
|
||||
|
||||
//! Create GLFW window.
|
||||
void initWindow (int theWidth, int theHeight, const char* theTitle);
|
||||
|
||||
//! Create 3D Viewer.
|
||||
void initViewer();
|
||||
|
||||
//! Fill 3D Viewer with a DEMO items.
|
||||
void initDemoScene();
|
||||
|
||||
//! Application event loop.
|
||||
void mainloop();
|
||||
|
||||
//! Clean up before .
|
||||
void cleanup();
|
||||
|
||||
//! @name GLWF callbacks
|
||||
private:
|
||||
//! Window resize event.
|
||||
void onResize (int theWidth, int theHeight);
|
||||
|
||||
//! Mouse scroll event.
|
||||
void onMouseScroll (double theOffsetX, double theOffsetY);
|
||||
|
||||
//! Mouse click event.
|
||||
void onMouseButton (int theButton, int theAction, int theMods);
|
||||
|
||||
//! Mouse move event.
|
||||
void onMouseMove (int thePosX, int thePosY);
|
||||
|
||||
//! @name GLWF callbacks (static functions)
|
||||
private:
|
||||
|
||||
//! GLFW callback redirecting messages into Message::DefaultMessenger().
|
||||
static void errorCallback (int theError, const char* theDescription);
|
||||
|
||||
//! Wrapper for glfwGetWindowUserPointer() returning this class instance.
|
||||
static GlfwOcctView* toView (GLFWwindow* theWin);
|
||||
|
||||
//! Window resize callback.
|
||||
static void onResizeCallback (GLFWwindow* theWin, int theWidth, int theHeight)
|
||||
{ toView(theWin)->onResize (theWidth, theHeight); }
|
||||
|
||||
//! Frame-buffer resize callback.
|
||||
static void onFBResizeCallback (GLFWwindow* theWin, int theWidth, int theHeight)
|
||||
{ toView(theWin)->onResize (theWidth, theHeight); }
|
||||
|
||||
//! Mouse scroll callback.
|
||||
static void onMouseScrollCallback (GLFWwindow* theWin, double theOffsetX, double theOffsetY)
|
||||
{ toView(theWin)->onMouseScroll (theOffsetX, theOffsetY); }
|
||||
|
||||
//! Mouse click callback.
|
||||
static void onMouseButtonCallback (GLFWwindow* theWin, int theButton, int theAction, int theMods)
|
||||
{ toView(theWin)->onMouseButton (theButton, theAction, theMods); }
|
||||
|
||||
//! Mouse move callback.
|
||||
static void onMouseMoveCallback (GLFWwindow* theWin, double thePosX, double thePosY)
|
||||
{ toView(theWin)->onMouseMove ((int )thePosX, (int )thePosY); }
|
||||
|
||||
private:
|
||||
|
||||
Handle(GlfwOcctWindow) myOcctWindow;
|
||||
Handle(V3d_View) myView;
|
||||
Handle(AIS_InteractiveContext) myContext;
|
||||
|
||||
CurAction3d myCurAction3d;
|
||||
Graphic3d_Vec2i myMouseMin;
|
||||
Graphic3d_Vec2i myMouseMax;
|
||||
bool myToRedraw;
|
||||
|
||||
};
|
||||
|
||||
#endif // _GlfwOcctView_Header
|
@@ -1,161 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#include "GlfwOcctWindow.h"
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#undef Handle // avoid name collisions in macOS headers
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#define GLFW_EXPOSE_NATIVE_NSGL
|
||||
#elif defined (_WIN32)
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#else
|
||||
#define GLFW_EXPOSE_NATIVE_X11
|
||||
#define GLFW_EXPOSE_NATIVE_GLX
|
||||
#endif
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
// ================================================================
|
||||
// Function : GlfwOcctWindow
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
GlfwOcctWindow::GlfwOcctWindow (int theWidth, int theHeight, const TCollection_AsciiString& theTitle)
|
||||
: myGlfwWindow (glfwCreateWindow (theWidth, theHeight, theTitle.ToCString(), NULL, NULL)),
|
||||
myXLeft (0),
|
||||
myYTop (0),
|
||||
myXRight (0),
|
||||
myYBottom(0)
|
||||
{
|
||||
if (myGlfwWindow != nullptr)
|
||||
{
|
||||
int aWidth = 0, aHeight = 0;
|
||||
glfwGetWindowPos (myGlfwWindow, &myXLeft, &myYTop);
|
||||
glfwGetWindowSize(myGlfwWindow, &aWidth, &aHeight);
|
||||
myXRight = myXLeft + aWidth;
|
||||
myYBottom = myYTop + aHeight;
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
myDisplay = new Aspect_DisplayConnection (glfwGetX11Display());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Close
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctWindow::Close()
|
||||
{
|
||||
if (myGlfwWindow != nullptr)
|
||||
{
|
||||
glfwDestroyWindow (myGlfwWindow);
|
||||
myGlfwWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : NativeHandle
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Aspect_Drawable GlfwOcctWindow::NativeHandle() const
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
return (Aspect_Drawable)glfwGetCocoaWindow (myGlfwWindow);
|
||||
#elif defined (_WIN32)
|
||||
return (Aspect_Drawable)glfwGetWin32Window (myGlfwWindow);
|
||||
#else
|
||||
return (Aspect_Drawable)glfwGetX11Window (myGlfwWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : NativeGlContext
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Aspect_RenderingContext GlfwOcctWindow::NativeGlContext() const
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
return (NSOpenGLContext*)glfwGetNSGLContext (myGlfwWindow);
|
||||
#elif defined (_WIN32)
|
||||
return glfwGetWGLContext (myGlfwWindow);
|
||||
#else
|
||||
return glfwGetGLXContext (myGlfwWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : IsMapped
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Standard_Boolean GlfwOcctWindow::IsMapped() const
|
||||
{
|
||||
return glfwGetWindowAttrib (myGlfwWindow, GLFW_VISIBLE) != 0;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Map
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctWindow::Map() const
|
||||
{
|
||||
glfwShowWindow (myGlfwWindow);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Unmap
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void GlfwOcctWindow::Unmap() const
|
||||
{
|
||||
glfwHideWindow (myGlfwWindow);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : DoResize
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Aspect_TypeOfResize GlfwOcctWindow::DoResize() const
|
||||
{
|
||||
if (glfwGetWindowAttrib (myGlfwWindow, GLFW_VISIBLE) == 1)
|
||||
{
|
||||
int anXPos = 0, anYPos = 0, aWidth = 0, aHeight = 0;
|
||||
glfwGetWindowPos (myGlfwWindow, &anXPos, &anYPos);
|
||||
glfwGetWindowSize(myGlfwWindow, &aWidth, &aHeight);
|
||||
*const_cast<Standard_Integer*>(&myXLeft ) = anXPos;
|
||||
*const_cast<Standard_Integer*>(&myXRight ) = anXPos + aWidth;
|
||||
*const_cast<Standard_Integer*>(&myYTop ) = anYPos;
|
||||
*const_cast<Standard_Integer*>(&myYBottom) = anYPos + aHeight;
|
||||
}
|
||||
return Aspect_TOR_UNKNOWN;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : CursorPosition
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Graphic3d_Vec2i GlfwOcctWindow::CursorPosition() const
|
||||
{
|
||||
Graphic3d_Vec2d aPos;
|
||||
glfwGetCursorPos (myGlfwWindow, &aPos.x(), &aPos.y());
|
||||
return Graphic3d_Vec2i ((int )aPos.x(), (int )aPos.y());
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#ifndef _GlfwOcctWindow_Header
|
||||
#define _GlfwOcctWindow_Header
|
||||
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_RenderingContext.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Graphic3d_Vec.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
//! GLFWwindow wrapper implementing Aspect_Window interface.
|
||||
class GlfwOcctWindow : public Aspect_Window
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(GlfwOcctWindow, Aspect_Window)
|
||||
public:
|
||||
//! Main constructor.
|
||||
GlfwOcctWindow (int theWidth, int theHeight, const TCollection_AsciiString& theTitle);
|
||||
|
||||
//! Close the window.
|
||||
virtual ~GlfwOcctWindow() { Close(); }
|
||||
|
||||
//! Close the window.
|
||||
void Close();
|
||||
|
||||
//! Return X Display connection.
|
||||
const Handle(Aspect_DisplayConnection)& GetDisplay() const { return myDisplay; }
|
||||
|
||||
//! Return GLFW window.
|
||||
GLFWwindow* getGlfwWindow() { return myGlfwWindow; }
|
||||
|
||||
//! Return native OpenGL context.
|
||||
Aspect_RenderingContext NativeGlContext() const;
|
||||
|
||||
//! Return cursor position.
|
||||
Graphic3d_Vec2i CursorPosition() const;
|
||||
|
||||
public:
|
||||
|
||||
//! Returns native Window handle
|
||||
virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns parent of native Window handle.
|
||||
virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return 0; }
|
||||
|
||||
//! Applies the resizing to the window <me>
|
||||
virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True if the window <me> is opened and False if the window is closed.
|
||||
virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
|
||||
|
||||
//! Apply the mapping change to the window <me> and returns TRUE if the window is mapped at screen.
|
||||
virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
|
||||
|
||||
//! Opens the window <me>.
|
||||
virtual void Map() const Standard_OVERRIDE;
|
||||
|
||||
//! Closes the window <me>.
|
||||
virtual void Unmap() const Standard_OVERRIDE;
|
||||
|
||||
virtual void Position (Standard_Integer& theX1, Standard_Integer& theY1,
|
||||
Standard_Integer& theX2, Standard_Integer& theY2) const Standard_OVERRIDE
|
||||
{
|
||||
theX1 = myXLeft;
|
||||
theX2 = myXRight;
|
||||
theY1 = myYTop;
|
||||
theY2 = myYBottom;
|
||||
}
|
||||
|
||||
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions.
|
||||
virtual Standard_Real Ratio() const Standard_OVERRIDE
|
||||
{
|
||||
return Standard_Real (myXRight - myXLeft) / Standard_Real (myYBottom - myYTop);
|
||||
}
|
||||
|
||||
//! Return window size.
|
||||
virtual void Size (Standard_Integer& theWidth, Standard_Integer& theHeight) const Standard_OVERRIDE
|
||||
{
|
||||
theWidth = myXRight - myXLeft;
|
||||
theHeight = myYBottom - myYTop;
|
||||
}
|
||||
|
||||
virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return NULL; }
|
||||
|
||||
protected:
|
||||
Handle(Aspect_DisplayConnection) myDisplay;
|
||||
GLFWwindow* myGlfwWindow;
|
||||
Standard_Integer myXLeft;
|
||||
Standard_Integer myYTop;
|
||||
Standard_Integer myXRight;
|
||||
Standard_Integer myYBottom;
|
||||
};
|
||||
|
||||
#endif // _GlfwOcctWindow_Header
|
@@ -1,37 +0,0 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#include "GlfwOcctView.h"
|
||||
|
||||
int main (int, char**)
|
||||
{
|
||||
GlfwOcctView anApp;
|
||||
try
|
||||
{
|
||||
anApp.run();
|
||||
}
|
||||
catch (const std::runtime_error& theError)
|
||||
{
|
||||
std::cerr << theError.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
A sample demonstrating usage of OCCT 3D Viewer within a window created using GLFW.
|
||||
|
||||
Platforms: Windows, macOS, Linux
|
||||
Required: glfw
|
@@ -14,9 +14,9 @@ Requirements for building sample:
|
||||
* Android NDK r9d or newer
|
||||
* Apache Ant 1.9.4 or higher
|
||||
* OCCT compiled under Android platform and placed in directories:
|
||||
* occt/libs/armeabi-v7a/\*.so and occt/inc/\*.hxx (libraries and include files of OCCT install)
|
||||
* android/assets/opencascade/shared/Shaders/\* (Shaders folder of OCCT install: /share/opencascade/resources/Shaders)
|
||||
* 3rdparty/include/freetype2/\*, 3rdparty/include/FreeImage.h and 3rdparty/libs/armeabi-v7a/libFreeImage.so and 3rdparty/libs/armeabi-v7a/libfreetype.so
|
||||
* occt/libs/armeabi-v7a/*.so and occt/inc/*.hxx (libraries and include files of OCCT install)
|
||||
* android/assets/opencascade/shared/Shaders/* (Shaders folder of OCCT install: /share/opencascade/resources/Shaders)
|
||||
* 3rdparty/include/freetype2/*, 3rdparty/include/FreeImage.h and 3rdparty/libs/armeabi-v7a/libFreeImage.so and 3rdparty/libs/armeabi-v7a/libfreetype.so
|
||||
|
||||
It is also possible to to correct OCCT.pri file an get resources from another tree of directories.
|
||||
|
||||
|
@@ -277,6 +277,7 @@ blend result _model 2 _model_161
|
||||
pload VISUALIZATION
|
||||
vinit Driver1/Viewer1/View1
|
||||
vsetcolorbg 200 200 255
|
||||
vdisplay -dispMode 1 result
|
||||
vdisplay result
|
||||
vfit
|
||||
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
|
||||
vsetdispmode 1
|
||||
vshowfaceboundary result 1
|
||||
|
@@ -263,6 +263,7 @@ unifysamedom result p_1
|
||||
pload VISUALIZATION
|
||||
vinit Driver1/Viewer1/View1
|
||||
vsetcolorbg 200 200 255
|
||||
vdisplay -dispMode 1 result
|
||||
vdisplay result
|
||||
vfit
|
||||
vaspects result -setFaceBoundaryDraw 1
|
||||
vsetdispmode 1
|
||||
vshowfaceboundary result 1
|
||||
|
@@ -57,7 +57,9 @@ bcommon res b9 c2
|
||||
# show result
|
||||
donly res
|
||||
trotate res 0 0 0 0 0 1 90
|
||||
vinit View1
|
||||
vdisplay -dispMode 1 res
|
||||
vaspects res -setFaceBoundaryDraw 1 -setFaceBoundaryColor WHITE -isoontriangulation 1
|
||||
vinit
|
||||
vdisplay res
|
||||
vsetdispmode 1
|
||||
vshowfaceboundary res 1 255 255 255
|
||||
vaspects -isoontriangulation 1
|
||||
vfit
|
||||
|
@@ -1222,7 +1222,7 @@ void AIS::InitLengthBetweenCurvilinearFaces (const TopoDS_Face& theFirstFace,
|
||||
BRepTopAdaptor_FClass2d aClassifier (theSecondFace, Precision::Confusion());
|
||||
|
||||
TopAbs_State aState =
|
||||
aClassifier.Perform (gp_Pnt2d (aPU, aPV), theSecondSurf->IsUPeriodic() || theSecondSurf->IsVPeriodic());
|
||||
aClassifier.Perform (gp_Pnt2d (aPU, aPV), theSecondSurf->IsUPeriodic111() || theSecondSurf->IsVPeriodic111());
|
||||
|
||||
if (aState == TopAbs_OUT || aState == TopAbs_UNKNOWN)
|
||||
{
|
||||
|
@@ -1,286 +0,0 @@
|
||||
// Created on: 2018-12-12
|
||||
// Created by: Olga SURYANINOVA
|
||||
// Copyright (c) 2018 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 <AIS_CameraFrustum.hxx>
|
||||
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Select3D_SensitiveGroup.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_CameraFrustum, AIS_InteractiveObject)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const Standard_ShortReal THE_DEFAULT_TRANSPARENCY = 0.7f;
|
||||
static const Quantity_Color THE_DEFAULT_COLOR = Quantity_NOC_WHITE;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_CameraFrustum::AIS_CameraFrustum()
|
||||
: myPoints (0, Graphic3d_Camera::FrustumVerticesNB)
|
||||
{
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect (THE_DEFAULT_COLOR, Aspect_TOL_SOLID, 1.0));
|
||||
|
||||
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
|
||||
aShadingAspect->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
aShadingAspect->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
|
||||
aShadingAspect->SetTransparency (THE_DEFAULT_TRANSPARENCY);
|
||||
aShadingAspect->SetColor (THE_DEFAULT_COLOR);
|
||||
myDrawer->SetShadingAspect (aShadingAspect);
|
||||
|
||||
myDrawer->SetTransparency (THE_DEFAULT_TRANSPARENCY);
|
||||
SetDisplayMode (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptDisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_CameraFrustum::AcceptDisplayMode (const Standard_Integer theMode) const
|
||||
{
|
||||
return theMode == AIS_Shaded || theMode == AIS_WireFrame;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCameraFrustum
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::SetCameraFrustum (const Handle(Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
if (theCamera.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
theCamera->FrustumPoints (myPoints);
|
||||
|
||||
fillTriangles();
|
||||
fillBorders();
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
AIS_InteractiveObject::SetColor (theColor);
|
||||
myDrawer->ShadingAspect()->SetColor (theColor);
|
||||
myDrawer->LineAspect()->SetColor (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::UnsetColor()
|
||||
{
|
||||
if (!HasColor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_InteractiveObject::UnsetColor();
|
||||
|
||||
myDrawer->ShadingAspect()->SetColor (THE_DEFAULT_COLOR);
|
||||
myDrawer->LineAspect()->SetColor (THE_DEFAULT_COLOR);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::UnsetTransparency()
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0f);
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : fillTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::fillTriangles()
|
||||
{
|
||||
if (myTriangles.IsNull())
|
||||
{
|
||||
const Standard_Integer aPlaneTriangleVertsNb = 2 * 3;
|
||||
const Standard_Integer aPlanesNb = 3 * 2;
|
||||
|
||||
myTriangles = new Graphic3d_ArrayOfTriangles (Graphic3d_Camera::FrustumVerticesNB, aPlaneTriangleVertsNb * aPlanesNb);
|
||||
myTriangles->SetVertice (Graphic3d_Camera::FrustumVerticesNB, gp_Pnt (0.0, 0.0, 0.0));
|
||||
|
||||
// Triangles go in order (clockwise vertices traversing for correct normal):
|
||||
// (0, 2, 1), (3, 1, 2)
|
||||
const Standard_Integer aLookup1_clockwise[] = { 0, 1, 0, 1, 0, 1 };
|
||||
const Standard_Integer aLookup2_clockwise[] = { 0, 0, 1, 1, 1, 0 };
|
||||
// Triangles go in order (counterclockwise vertices traversing for correct normal):
|
||||
// (1, 2, 0), (2, 1, 3)
|
||||
const Standard_Integer aLookup1_anticlockwise[] = { 0, 1, 0, 1, 0, 1 };
|
||||
const Standard_Integer aLookup2_anticlockwise[] = { 1, 0, 0, 0, 1, 1 };
|
||||
Standard_Integer aShifts[] = { 0, 0, 0 };
|
||||
|
||||
// Planes go in order:
|
||||
// LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR
|
||||
for (Standard_Integer aFaceIdx = 0; aFaceIdx < 3; ++aFaceIdx)
|
||||
{
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
for (Standard_Integer aPntIter = 0; aPntIter < aPlaneTriangleVertsNb; ++aPntIter)
|
||||
{
|
||||
aShifts[aFaceIdx] = i;
|
||||
if (i == 0)
|
||||
{
|
||||
aShifts[(aFaceIdx + 1) % 3] = aLookup1_clockwise[aPntIter];
|
||||
aShifts[(aFaceIdx + 2) % 3] = aLookup2_clockwise[aPntIter];
|
||||
}
|
||||
else
|
||||
{
|
||||
aShifts[(aFaceIdx + 1) % 3] = aLookup1_anticlockwise[aPntIter];
|
||||
aShifts[(aFaceIdx + 2) % 3] = aLookup2_anticlockwise[aPntIter];
|
||||
}
|
||||
|
||||
Standard_Integer anIndex = aShifts[0] * 2 * 2 + aShifts[1] * 2 + aShifts[2];
|
||||
myTriangles->AddEdge (anIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer aPointIter = 0; aPointIter < Graphic3d_Camera::FrustumVerticesNB; ++aPointIter)
|
||||
{
|
||||
const Graphic3d_Vec3d aPnt = myPoints[aPointIter];
|
||||
myTriangles->SetVertice (aPointIter + 1, gp_Pnt (aPnt.x(), aPnt.y(), aPnt.z()));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : fillBorders
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::fillBorders()
|
||||
{
|
||||
if (myBorders.IsNull())
|
||||
{
|
||||
const Standard_Integer aPlaneSegmVertsNb = 2 * 4;
|
||||
const Standard_Integer aPlanesNb = 3 * 2;
|
||||
myBorders = new Graphic3d_ArrayOfSegments (Graphic3d_Camera::FrustumVerticesNB, aPlaneSegmVertsNb * aPlanesNb);
|
||||
myBorders->SetVertice (Graphic3d_Camera::FrustumVerticesNB, gp_Pnt (0.0, 0.0, 0.0));
|
||||
|
||||
// Segments go in order:
|
||||
// (0, 2), (2, 3), (3, 1), (1, 0)
|
||||
const Standard_Integer aLookup1[] = { 0, 1, 1, 1, 1, 0, 0, 0 };
|
||||
const Standard_Integer aLookup2[] = { 0, 0, 0, 1, 1, 1, 1, 0 };
|
||||
Standard_Integer aShifts[] = { 0, 0, 0 };
|
||||
|
||||
// Planes go in order:
|
||||
// LEFT, RIGHT, BOTTOM, TOP, NEAR, FAR
|
||||
for (Standard_Integer aFaceIdx = 0; aFaceIdx < 3; ++aFaceIdx)
|
||||
{
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
for (Standard_Integer aSegmVertIter = 0; aSegmVertIter < aPlaneSegmVertsNb; ++aSegmVertIter)
|
||||
{
|
||||
aShifts[aFaceIdx] = i;
|
||||
aShifts[(aFaceIdx + 1) % 3] = aLookup1[aSegmVertIter];
|
||||
aShifts[(aFaceIdx + 2) % 3] = aLookup2[aSegmVertIter];
|
||||
|
||||
Standard_Integer anIndex = aShifts[0] * 2 * 2 + aShifts[1] * 2 + aShifts[2];
|
||||
myBorders->AddEdge (anIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer aPointIter = 0; aPointIter < Graphic3d_Camera::FrustumVerticesNB; ++aPointIter)
|
||||
{
|
||||
const Graphic3d_Vec3d aPnt = myPoints[aPointIter];
|
||||
myBorders->SetVertice (aPointIter + 1, gp_Pnt (aPnt.x(), aPnt.y(), aPnt.z()));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePrs->SetInfiniteState (true);
|
||||
if (myTriangles.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_Shaded:
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myTriangles);
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myBorders);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
switch (theMode)
|
||||
{
|
||||
case SelectionMode_Edges:
|
||||
{
|
||||
Handle(Select3D_SensitiveGroup) aSensitiveEntity = new Select3D_SensitiveGroup (anOwner);
|
||||
for (Standard_Integer anIter = 1; anIter <= myBorders->EdgeNumber(); anIter += 2)
|
||||
{
|
||||
aSensitiveEntity->Add (new Select3D_SensitiveSegment (anOwner, myBorders->Vertice (myBorders->Edge (anIter)), myBorders->Vertice(myBorders->Edge (anIter + 1))));
|
||||
}
|
||||
theSelection->Add (aSensitiveEntity);
|
||||
break;
|
||||
}
|
||||
case SelectionMode_Volume:
|
||||
{
|
||||
Handle(Select3D_SensitivePrimitiveArray) aSelArray = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aSelArray->InitTriangulation (myTriangles->Attributes(), myTriangles->Indices(), TopLoc_Location());
|
||||
theSelection->Add (aSelArray);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
// Created on: 2018-12-12
|
||||
// Created by: Olga SURYANINOVA
|
||||
// Copyright (c) 2018 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 _AIS_CameraFrustum_HeaderFile
|
||||
#define _AIS_CameraFrustum_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
|
||||
class Graphic3d_ArrayOfSegments;
|
||||
class Graphic3d_ArrayOfTriangles;
|
||||
|
||||
//! Presentation for drawing camera frustum.
|
||||
//! Default configuration is built with filling and some transparency.
|
||||
class AIS_CameraFrustum : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_CameraFrustum, AIS_InteractiveObject)
|
||||
public:
|
||||
|
||||
//! Selection modes supported by this object
|
||||
enum SelectionMode
|
||||
{
|
||||
SelectionMode_Edges = 0, //!< detect by edges (default)
|
||||
SelectionMode_Volume = 1, //!< detect by volume
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Constructs camera frustum with default configuration.
|
||||
Standard_EXPORT AIS_CameraFrustum();
|
||||
|
||||
//! Sets camera frustum.
|
||||
Standard_EXPORT void SetCameraFrustum (const Handle(Graphic3d_Camera)& theCamera);
|
||||
|
||||
//! Setup custom color.
|
||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Restore default color.
|
||||
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
//! Restore transparency setting.
|
||||
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
|
||||
|
||||
//! Return true if specified display mode is supported.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes presentation of camera frustum.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Fills triangles primitive array for camera frustum filling.
|
||||
void fillTriangles();
|
||||
|
||||
//! Fills polylines primitive array for camera frustum borders.
|
||||
void fillBorders();
|
||||
|
||||
protected:
|
||||
|
||||
NCollection_Array1<Graphic3d_Vec3d> myPoints; //!< Array of points
|
||||
Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for camera frustum filling
|
||||
Handle(Graphic3d_ArrayOfSegments) myBorders; //!< Segments for camera frustum borders
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_CameraFrustum_HeaderFile
|
@@ -107,10 +107,6 @@ AIS_ColorScale::AIS_ColorScale()
|
||||
myTextHeight (20)
|
||||
{
|
||||
SetDisplayMode (0);
|
||||
myDrawer->SetupOwnShadingAspect();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (Quantity_NOC_WHITE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -462,6 +458,15 @@ void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Standard_Integer aBarTop = myYPos + myHeight - aTitleOffset - aBarYOffset;
|
||||
const Standard_Integer aBarHeight = aBarTop - aBarBottom;
|
||||
|
||||
// draw title
|
||||
if (!myTitle.IsEmpty())
|
||||
{
|
||||
drawText (Prs3d_Root::CurrentGroup (thePrs), myTitle,
|
||||
myXPos + mySpacing,
|
||||
aBarTop + aBarYOffset,
|
||||
Graphic3d_VTA_BOTTOM);
|
||||
}
|
||||
|
||||
TColStd_SequenceOfExtendedString aLabels;
|
||||
if (myLabelType == Aspect_TOCSD_USER)
|
||||
{
|
||||
@@ -491,27 +496,11 @@ void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
aColorBreadth += aTextWidth;
|
||||
}
|
||||
|
||||
// draw title
|
||||
Handle(Graphic3d_Group) aLabelsGroup;
|
||||
if (!myTitle.IsEmpty()
|
||||
|| !aLabels.IsEmpty())
|
||||
{
|
||||
aLabelsGroup = thePrs->NewGroup();
|
||||
aLabelsGroup->SetGroupPrimitivesAspect (myDrawer->TextAspect()->Aspect());
|
||||
}
|
||||
if (!myTitle.IsEmpty())
|
||||
{
|
||||
drawText (aLabelsGroup, myTitle,
|
||||
myXPos + mySpacing,
|
||||
aBarTop + aBarYOffset,
|
||||
Graphic3d_VTA_BOTTOM);
|
||||
}
|
||||
|
||||
// draw colors
|
||||
drawColorBar (thePrs, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
|
||||
|
||||
// draw Labels
|
||||
drawLabels (aLabelsGroup, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
|
||||
drawLabels (thePrs, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -638,8 +627,7 @@ void AIS_ColorScale::drawColorBar (const Handle(Prs3d_Presentation)& thePrs,
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
|
||||
aGroup->AddPrimitiveArray (aTriangles);
|
||||
|
||||
const Quantity_Color aFgColor (hasOwnColor ? myDrawer->Color() : Quantity_NOC_WHITE);
|
||||
@@ -654,7 +642,7 @@ void AIS_ColorScale::drawColorBar (const Handle(Prs3d_Presentation)& thePrs,
|
||||
//function : drawLabels
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
|
||||
void AIS_ColorScale::drawLabels (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TColStd_SequenceOfExtendedString& theLabels,
|
||||
const Standard_Integer theBarBottom,
|
||||
const Standard_Integer theBarHeight,
|
||||
@@ -728,14 +716,14 @@ void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
|
||||
Standard_Integer aPos2 = aNbLabels - 1 - i2;
|
||||
if (aFilter && !(aPos1 % aFilter))
|
||||
{
|
||||
drawText (theGroup, theLabels.Value (i1 + 1),
|
||||
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i1 + 1),
|
||||
anXLeft, anYBottom + Standard_Integer(i1 * aStepY + anAscent),
|
||||
Graphic3d_VTA_CENTER);
|
||||
aLast1 = i1;
|
||||
}
|
||||
if (aFilter && !(aPos2 % aFilter))
|
||||
{
|
||||
drawText (theGroup, theLabels.Value (i2 + 1),
|
||||
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i2 + 1),
|
||||
anXLeft, anYBottom + Standard_Integer(i2 * aStepY + anAscent),
|
||||
Graphic3d_VTA_CENTER);
|
||||
aLast2 = i2;
|
||||
@@ -758,7 +746,7 @@ void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
|
||||
|
||||
if (i0 != -1)
|
||||
{
|
||||
drawText (theGroup, theLabels.Value (i0 + 1),
|
||||
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i0 + 1),
|
||||
anXLeft, anYBottom + Standard_Integer(i0 * aStepY + anAscent),
|
||||
Graphic3d_VTA_CENTER);
|
||||
}
|
||||
@@ -781,8 +769,8 @@ void AIS_ColorScale::drawFrame (const Handle(Prs3d_Presentation)& thePrs,
|
||||
aPrim->AddVertex (theX, theY, 0.0);
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d (theColor, Aspect_TOL_SOLID, 1.0);
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect);
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
|
||||
aGroup->SetPrimitivesAspect (anAspect);
|
||||
aGroup->AddPrimitiveArray (aPrim);
|
||||
}
|
||||
|
||||
@@ -796,6 +784,7 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
|
||||
const Graphic3d_VerticalTextAlignment theVertAlignment)
|
||||
{
|
||||
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
|
||||
theGroup->SetPrimitivesAspect (anAspect->Aspect());
|
||||
theGroup->Text (theText,
|
||||
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
|
||||
anAspect->Height(),
|
||||
|
@@ -406,7 +406,7 @@ private:
|
||||
Standard_Integer computeMaxLabelWidth (const TColStd_SequenceOfExtendedString& theLabels) const;
|
||||
|
||||
//! Draw labels.
|
||||
void drawLabels (const Handle(Graphic3d_Group)& theGroup,
|
||||
void drawLabels (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TColStd_SequenceOfExtendedString& theLabels,
|
||||
const Standard_Integer theBarBottom,
|
||||
const Standard_Integer theBarHeight,
|
||||
|
@@ -27,7 +27,6 @@ public:
|
||||
AIS_ColoredDrawer (const Handle(Prs3d_Drawer)& theLink)
|
||||
: myIsHidden (false),
|
||||
myHasOwnColor (false),
|
||||
myHasOwnTransp(false),
|
||||
myHasOwnWidth (false)
|
||||
{
|
||||
Link (theLink);
|
||||
@@ -35,15 +34,9 @@ public:
|
||||
|
||||
bool IsHidden() const { return myIsHidden; }
|
||||
void SetHidden (const bool theToHide) { myIsHidden = theToHide;}
|
||||
|
||||
bool HasOwnColor() const { return myHasOwnColor; }
|
||||
void UnsetOwnColor() { myHasOwnColor = false; }
|
||||
void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = true; }
|
||||
|
||||
bool HasOwnTransparency() const { return myHasOwnTransp; }
|
||||
void UnsetOwnTransparency() { myHasOwnTransp = false; }
|
||||
void SetOwnTransparency (Standard_Real /*theTransp*/) { myHasOwnTransp = true; }
|
||||
|
||||
bool HasOwnWidth() const { return myHasOwnWidth; }
|
||||
void UnsetOwnWidth() { myHasOwnWidth = false; }
|
||||
void SetOwnWidth (const Standard_Real /*theWidth*/) { myHasOwnWidth = true; }
|
||||
@@ -52,7 +45,6 @@ public: //! @name list of overridden properties
|
||||
|
||||
bool myIsHidden;
|
||||
bool myHasOwnColor;
|
||||
bool myHasOwnTransp;
|
||||
bool myHasOwnWidth;
|
||||
|
||||
};
|
||||
|
@@ -187,25 +187,6 @@ void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape& theShape,
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCustomTransparency
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::SetCustomTransparency (const TopoDS_Shape& theShape,
|
||||
Standard_Real theTransparency)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
|
||||
setTransparency (aDrawer, theTransparency);
|
||||
aDrawer->SetOwnTransparency (theTransparency);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCustomWidth
|
||||
//purpose :
|
||||
@@ -219,7 +200,7 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
|
||||
}
|
||||
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
|
||||
setWidth (aDrawer, theLineWidth);
|
||||
setWidth (CustomAspects (theShape), theLineWidth);
|
||||
aDrawer->SetOwnWidth (theLineWidth);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
@@ -232,6 +213,11 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
|
||||
|
||||
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
setColor (myDrawer, theColor);
|
||||
myDrawer->SetColor (theColor);
|
||||
hasOwnColor = Standard_True;
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -257,7 +243,6 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetColor (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -267,6 +252,10 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
|
||||
void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
|
||||
{
|
||||
setWidth (myDrawer, theLineWidth);
|
||||
myOwnWidth = theLineWidth;
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -288,16 +277,6 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
|
||||
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetWidth (theLineWidth);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetWidth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::UnsetWidth()
|
||||
{
|
||||
SetWidth (1.0f);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -307,20 +286,18 @@ void AIS_ColoredShape::UnsetWidth()
|
||||
|
||||
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
|
||||
{
|
||||
setTransparency (myDrawer, theValue);
|
||||
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
if (aDrawer->HasOwnTransparency())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
|
||||
if (aDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetTransparency (theValue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -329,7 +306,27 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::UnsetTransparency()
|
||||
{
|
||||
SetTransparency (0.0f);
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
if (myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
if (!HasColor()
|
||||
&& !HasMaterial()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
}
|
||||
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
|
||||
if (aDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -339,16 +336,19 @@ void AIS_ColoredShape::UnsetTransparency()
|
||||
|
||||
void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
|
||||
//myOwnMaterial = theMaterial;
|
||||
hasOwnMaterial = Standard_True;
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
//if (aDrawer->HasOwnMaterial()) continue;
|
||||
if (aDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
|
||||
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), Standard_False); // aDrawer->IsTransparent()
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetMaterial (theMaterial);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -586,7 +586,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
const DataMapOfDrawerCompd& theDrawerClosedFaces,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(Graphic3d_Group) anOpenGroup, aClosedGroup, anEdgesGroup;
|
||||
Handle(Graphic3d_Group) anOpenGroup, aClosedGroup;
|
||||
for (size_t aShType = 0; aShType <= (size_t )TopAbs_SHAPE; ++aShType)
|
||||
{
|
||||
const Standard_Boolean isClosed = aShType == TopAbs_SHAPE;
|
||||
@@ -640,7 +640,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
{
|
||||
if (aShadedGroup.IsNull())
|
||||
{
|
||||
aShadedGroup = thePrs->NewGroup();
|
||||
aShadedGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
}
|
||||
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
|
||||
@@ -649,15 +649,18 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
|
||||
if (aDrawer->FaceBoundaryDraw())
|
||||
{
|
||||
if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw, aDrawer->FaceBoundaryUpperContinuity()))
|
||||
Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw);
|
||||
if (!aBndSegments.IsNull())
|
||||
{
|
||||
if (anEdgesGroup.IsNull())
|
||||
if (aShadedGroup.IsNull())
|
||||
{
|
||||
anEdgesGroup = thePrs->NewGroup();
|
||||
aShadedGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
}
|
||||
|
||||
anEdgesGroup->SetPrimitivesAspect (aDrawer->FaceBoundaryAspect()->Aspect());
|
||||
anEdgesGroup->AddPrimitiveArray (aBndSegments);
|
||||
Handle(Graphic3d_AspectLine3d) aBoundaryAspect = aDrawer->FaceBoundaryAspect()->Aspect();
|
||||
aShadedGroup->SetPrimitivesAspect (aBoundaryAspect);
|
||||
aShadedGroup->AddPrimitiveArray (aBndSegments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,29 +715,13 @@ Standard_Boolean AIS_ColoredShape::dispatchColors (const Handle(AIS_ColoredDrawe
|
||||
{
|
||||
const TopoDS_Shape& aFace = aFaceIter.Value();
|
||||
Handle(AIS_ColoredDrawer) aFaceDrawer;
|
||||
if (aFace.ShapeType() != TopAbs_FACE
|
||||
|| !theShapeDrawerMap.Find (aFace, aFaceDrawer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aFaceDrawer->IsHidden())
|
||||
if (aFace.ShapeType() == TopAbs_FACE
|
||||
&& theShapeDrawerMap.Find (aFace, aFaceDrawer)
|
||||
&& aFaceDrawer->IsHidden())
|
||||
{
|
||||
isClosedShell = Standard_False;
|
||||
break;
|
||||
}
|
||||
else if (aFaceDrawer->HasOwnShadingAspect()
|
||||
&& aFaceDrawer->ShadingAspect()->Aspect()->AlphaMode() != Graphic3d_AlphaMode_Opaque)
|
||||
{
|
||||
if (aFaceDrawer->ShadingAspect()->Aspect()->AlphaMode() != Graphic3d_AlphaMode_BlendAuto
|
||||
|| aFaceDrawer->ShadingAspect()->Aspect()->FrontMaterial().Alpha() < 1.0f
|
||||
|| (aFaceDrawer->ShadingAspect()->Aspect()->Distinguish()
|
||||
&& aFaceDrawer->ShadingAspect()->Aspect()->BackMaterial().Alpha() < 1.0f))
|
||||
{
|
||||
isClosedShell = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -56,10 +56,6 @@ public: //! @name sub-shape aspects
|
||||
Standard_EXPORT void SetCustomColor (const TopoDS_Shape& theShape,
|
||||
const Quantity_Color& theColor);
|
||||
|
||||
//! Customize transparency of specified sub-shape
|
||||
Standard_EXPORT void SetCustomTransparency (const TopoDS_Shape& theShape,
|
||||
Standard_Real theTransparency);
|
||||
|
||||
//! Customize line width of specified sub-shape
|
||||
Standard_EXPORT void SetCustomWidth (const TopoDS_Shape& theShape,
|
||||
const Standard_Real theLineWidth);
|
||||
@@ -81,16 +77,11 @@ public: //! @name global aspects
|
||||
//! Sets transparency value.
|
||||
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the material aspect.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Removes the setting for transparency in the reconstructed compound shape.
|
||||
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
|
||||
|
||||
//! Setup line width of entire shape.
|
||||
Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE;
|
||||
//! Sets the material aspect.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
|
||||
|
||||
protected: //! @name override presentation computation
|
||||
|
||||
|
@@ -431,7 +431,6 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Standard_Integer theLabelPosition)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (myDrawer->DimensionAspect()->IsText3d())
|
||||
{
|
||||
// getting font parameters
|
||||
@@ -518,7 +517,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
aCenterOfLabel.Transform (aTextPlaneTrsf);
|
||||
|
||||
gp_Ax2 aFlippingAxes (aCenterOfLabel, GetPlane().Axis().Direction(), aTextDir);
|
||||
aGroup->SetFlippingOptions (Standard_True, aFlippingAxes);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_True, aFlippingAxes);
|
||||
|
||||
// draw text
|
||||
if (myDrawer->DimensionAspect()->IsTextShaded())
|
||||
@@ -547,14 +546,11 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
{
|
||||
myDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.0));
|
||||
}
|
||||
|
||||
myDrawer->FreeBoundaryAspect()->Aspect()->SetColor (aColor);
|
||||
|
||||
// drawing text
|
||||
if (Handle(Graphic3d_ArrayOfPrimitives) anEdges = StdPrs_WFShape::AddAllEdges (aTextShape, myDrawer))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->FreeBoundaryAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anEdges);
|
||||
}
|
||||
StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_False, gp_Ax2());
|
||||
|
||||
@@ -569,7 +565,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
// generate primitives for 2D text
|
||||
myDrawer->DimensionAspect()->TextAspect()->Aspect()->SetDisplayType (Aspect_TODT_DIMENSION);
|
||||
|
||||
Prs3d_Text::Draw (aGroup,
|
||||
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePresentation),
|
||||
myDrawer->DimensionAspect()->TextAspect(),
|
||||
theText,
|
||||
theTextPos);
|
||||
@@ -603,7 +599,6 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
|
||||
gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
|
||||
gp_Dir aTextDir = theExtensionDir;
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
@@ -635,17 +630,16 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
|
||||
aSensitiveCurve.Append (anExtStart);
|
||||
aSensitiveCurve.Append (anExtEnd);
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_True);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
Handle(Graphic3d_AspectLine3d) aDimensionLineStyle = myDrawer->DimensionAspect()->LineAspect()->Aspect();
|
||||
aGroup->SetPrimitivesAspect (aDimensionLineStyle);
|
||||
aGroup->AddPrimitiveArray (anExtPrimitive);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionLineStyle);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (anExtPrimitive);
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_False);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,6 +733,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_HCenter:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
gp_Pnt aTextPos = IsTextPositionCustom() ? myFixedTextPosition
|
||||
: (aCenterLineBegin.XYZ() + aCenterLineEnd.XYZ()) * 0.5;
|
||||
gp_Dir aTextDir = aDimensionLine.Direction();
|
||||
@@ -746,7 +742,6 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
// add text primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
|
||||
{
|
||||
thePresentation->NewGroup();
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
@@ -804,28 +799,24 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
aDimensionAspect->TextAspect()->SetVerticalJustification (aTextJustificaton);
|
||||
|
||||
// main dimension line, short extension
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal)
|
||||
@@ -834,18 +825,19 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add arrow extension lines to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// ------------------------------------------------------------------------ //
|
||||
@@ -855,48 +847,45 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_Left:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
{
|
||||
// Left extension with the text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
isArrowsExternal
|
||||
? aFirstArrowEnd
|
||||
: aFirstArrowBegin,
|
||||
aFirstExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// Left extension with the text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
isArrowsExternal
|
||||
? aFirstArrowEnd
|
||||
: aFirstArrowBegin,
|
||||
aFirstExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
|
||||
// add dimension line primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
// add central dimension line
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
|
||||
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
}
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal || theIsOneSide)
|
||||
@@ -905,11 +894,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add extension lines for external arrows
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -921,6 +910,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_Right:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// Right extension with text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
@@ -935,30 +925,27 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
// add central dimension line
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
}
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal || theIsOneSide)
|
||||
@@ -967,11 +954,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add extension lines for external arrows
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -981,7 +968,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
// add flyout lines to presentation
|
||||
if (theMode == ComputeMode_All)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
|
||||
aPrimSegments->AddVertex (theFirstPoint);
|
||||
@@ -990,8 +977,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
aPrimSegments->AddVertex (theSecondPoint);
|
||||
aPrimSegments->AddVertex (aLineEndPoint);
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
}
|
||||
|
||||
mySelectionGeom.IsComputed = Standard_True;
|
||||
|
@@ -198,21 +198,6 @@ public: //! @name highlighting management
|
||||
const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
|
||||
|
||||
//! Setup highlight style settings.
|
||||
//! It is preferred modifying existing style returned by method HighlightStyle()
|
||||
//! instead of creating a new drawer.
|
||||
//!
|
||||
//! If a new highlight style is created, its presentation Zlayer should be checked,
|
||||
//! otherwise highlighting might not work as expected.
|
||||
//! Default values are:
|
||||
//! - Prs3d_TypeOfHighlight_Dynamic: Graphic3d_ZLayerId_Top,
|
||||
//! object highlighting is drawn on top of main scene within Immediate Layers,
|
||||
//! so that V3d_View::RedrawImmediate() will be enough to see update;
|
||||
//! - Prs3d_TypeOfHighlight_LocalDynamic: Graphic3d_ZLayerId_Topmost,
|
||||
//! object parts highlighting is drawn on top of main scene within Immediate Layers
|
||||
//! with depth cleared (even overlapped geometry will be revealed);
|
||||
//! - Prs3d_TypeOfHighlight_Selected: Graphic3d_ZLayerId_UNKNOWN,
|
||||
//! object highlighting is drawn on top of main scene within the same layer
|
||||
//! as object itself (e.g. Graphic3d_ZLayerId_Default by default) and increased priority.
|
||||
void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
|
||||
const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
|
||||
|
||||
@@ -227,14 +212,6 @@ public: //! @name highlighting management
|
||||
}
|
||||
|
||||
//! Setup the style of dynamic highlighting.
|
||||
//! It is preferred modifying existing style returned by method HighlightStyle()
|
||||
//! instead of creating a new drawer.
|
||||
//!
|
||||
//! If a new highlight style is created, its presentation Zlayer should be checked,
|
||||
//! otherwise highlighting might not work as expected.
|
||||
//! Default value is Graphic3d_ZLayerId_Top,
|
||||
//! object highlighting is drawn on top of main scene within Immediate Layers,
|
||||
//! so that V3d_View::RedrawImmediate() will be enough to see update;
|
||||
void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
|
||||
|
||||
//! Returns current selection style settings.
|
||||
@@ -1285,10 +1262,6 @@ protected: //! @name internal methods
|
||||
return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
|
||||
}
|
||||
|
||||
//! Return TRUE if highlight style of owner requires full viewer redraw.
|
||||
Standard_EXPORT Standard_Boolean isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_Viewer)& theViewer) const;
|
||||
|
||||
//! Helper function that returns correct selection style for the object:
|
||||
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
|
||||
//! selection style of interactive context will be returned.
|
||||
|
@@ -293,22 +293,6 @@ void AIS_InteractiveContext::highlightWithSubintensity (const Handle(SelectMgr_E
|
||||
theOwner->HilightWithColor (myMainPM, myStyles[Prs3d_TypeOfHighlight_SubIntensity], theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isSlowHiStyle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_Viewer)& theViewer) const
|
||||
{
|
||||
if (const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()))
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aHiStyle = getHiStyle (anObj, myLastPicked);
|
||||
return aHiStyle->ZLayer() == Graphic3d_ZLayerId_UNKNOWN
|
||||
|| !theViewer->ZLayerSettings (aHiStyle->ZLayer()).IsImmediate();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MoveTo
|
||||
//purpose :
|
||||
@@ -388,11 +372,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
// method call. As result it is necessary to rehighligt it with mySelectionColor.
|
||||
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
clearDynamicHighlight();
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -408,11 +387,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
&& (!myLastPicked->IsSelected()
|
||||
|| myToHilightSelected))
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
highlightWithColor (myLastPicked, theView->Viewer());
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -431,11 +405,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
&& !myLastPicked.IsNull()
|
||||
&& myLastPicked->HasSelectable())
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
clearDynamicHighlight();
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -447,21 +416,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
if (toUpdateViewer
|
||||
&& theToRedrawOnUpdate)
|
||||
{
|
||||
if (theView->ComputedMode())
|
||||
{
|
||||
theView->Viewer()->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (theView->IsInvalidated())
|
||||
{
|
||||
theView->Viewer()->Redraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
theView->Viewer()->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
theView->Viewer()->Update();
|
||||
}
|
||||
|
||||
return aStatus;
|
||||
|
@@ -472,7 +472,33 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits );
|
||||
SynchronizeAspects();
|
||||
|
||||
// Modify existing presentations
|
||||
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
|
||||
if ( !aPrs3d.IsNull() ) {
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
if( !aStruct.IsNull() ) {
|
||||
// Workaround for issue 23115: Need to update also groups, because their
|
||||
// face aspect ALWAYS overrides the structure's.
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (aGrp.IsNull()
|
||||
|| !aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = aGrp->FillAreaAspect();
|
||||
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -596,33 +622,3 @@ void AIS_InteractiveObject::SynchronizeAspects()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap)
|
||||
{
|
||||
if (theMap.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation();
|
||||
if (aPrs3d.IsNull()
|
||||
|| aPrs3d->Presentation().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value().IsNull())
|
||||
{
|
||||
aGroupIter.ChangeValue()->ReplaceAspects (theMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -386,15 +386,6 @@ public:
|
||||
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
|
||||
Standard_EXPORT void SynchronizeAspects();
|
||||
|
||||
protected:
|
||||
|
||||
//! Replace aspects of existing (computed) presentation groups,
|
||||
//! so that the new aspects can be applied without recomputing presentation.
|
||||
//! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
|
||||
//! The recommended approach is computing presentation with necessary customized aspects,
|
||||
//! and then modify them directly followed by SynchronizeAspects() call.
|
||||
Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_ToolDisk.hxx>
|
||||
#include <Prs3d_ToolSector.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
@@ -152,19 +151,6 @@ void AIS_Manipulator::init()
|
||||
myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
myHighlightAspect->SetMaterial (aHilightMaterial);
|
||||
|
||||
Graphic3d_MaterialAspect aDraggerMaterial;
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
|
||||
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
|
||||
aDraggerMaterial.SetAmbient(1.0);
|
||||
|
||||
myDraggerHighlight = new Prs3d_ShadingAspect();
|
||||
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
||||
myDraggerHighlight->SetMaterial(aDraggerMaterial);
|
||||
|
||||
myDraggerHighlight->SetTransparency(0.5);
|
||||
|
||||
SetSize (100);
|
||||
SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
}
|
||||
@@ -184,11 +170,10 @@ Handle(Prs3d_Presentation) AIS_Manipulator::getHighlightPresentation (const Hand
|
||||
|
||||
switch (anOwner->Mode())
|
||||
{
|
||||
case AIS_MM_Translation : return myAxes[anOwner->Index()].TranslatorHighlightPrs();
|
||||
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
|
||||
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
|
||||
case AIS_MM_TranslationPlane: return myAxes[anOwner->Index()].DraggerHighlightPrs();
|
||||
case AIS_MM_None : break;
|
||||
case AIS_MM_Translation: return myAxes[anOwner->Index()].TranslatorHighlightPrs();
|
||||
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
|
||||
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
|
||||
case AIS_MM_None : break;
|
||||
}
|
||||
|
||||
return aDummyPrs;
|
||||
@@ -209,11 +194,10 @@ Handle(Graphic3d_Group) AIS_Manipulator::getGroup (const Standard_Integer theInd
|
||||
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_MM_Translation : return myAxes[theIndex].TranslatorGroup();
|
||||
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
|
||||
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
|
||||
case AIS_MM_TranslationPlane: return myAxes[theIndex].DraggerGroup();
|
||||
case AIS_MM_None : break;
|
||||
case AIS_MM_Translation: return myAxes[theIndex].TranslatorGroup();
|
||||
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
|
||||
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
|
||||
case AIS_MM_None : break;
|
||||
}
|
||||
|
||||
return aDummyGroup;
|
||||
@@ -282,10 +266,6 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
|
||||
myAxes[theAxisIndex].SetScaling (theIsEnabled);
|
||||
break;
|
||||
|
||||
case AIS_MM_TranslationPlane:
|
||||
myAxes[theAxisIndex].SetDragging(theIsEnabled);
|
||||
break;
|
||||
|
||||
case AIS_MM_None:
|
||||
break;
|
||||
}
|
||||
@@ -297,7 +277,7 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::SetPart (const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 4; ++anIt)
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
SetPart (anIt, theMode, theIsEnabled);
|
||||
}
|
||||
@@ -420,7 +400,6 @@ void AIS_Manipulator::Attach (const Handle(AIS_ManipulatorObjectSequence)& theOb
|
||||
EnableMode (AIS_MM_Rotation);
|
||||
EnableMode (AIS_MM_Translation);
|
||||
EnableMode (AIS_MM_Scaling);
|
||||
EnableMode (AIS_MM_TranslationPlane);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +493,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
const gp_Lin aLine (myStartPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
|
||||
Extrema_ExtElC anExtrema (anInputLine, aLine, Precision::Angular());
|
||||
if (!anExtrema.IsDone()
|
||||
|| anExtrema.IsParallel()
|
||||
|| anExtrema.NbExt() != 1)
|
||||
{
|
||||
// translation cannot be done co-directed with camera
|
||||
@@ -560,9 +538,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
const gp_Pnt aPosLoc = myStartPosition.Location();
|
||||
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir (myStartPosition, myCurrentIndex);
|
||||
IntAna_IntConicQuad aIntersector (anInputLine, gp_Pln (aPosLoc, aCurrAxis.Direction()), Precision::Angular(), Precision::Intersection());
|
||||
if (!aIntersector.IsDone()
|
||||
|| aIntersector.IsParallel()
|
||||
|| aIntersector.NbPoints() < 1)
|
||||
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -607,34 +583,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
myPrevState = anAngle;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_TranslationPlane:
|
||||
{
|
||||
const gp_Pnt aPosLoc = myStartPosition.Location();
|
||||
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir(myStartPosition, myCurrentIndex);
|
||||
IntAna_IntConicQuad aIntersector(anInputLine, gp_Pln(aPosLoc, aCurrAxis.Direction()), Precision::Angular(), Precision::Intersection());
|
||||
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const gp_Pnt aNewPosition = aIntersector.Point(1);
|
||||
if (!myHasStartedTransformation)
|
||||
{
|
||||
myStartPick = aNewPosition;
|
||||
myHasStartedTransformation = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (aNewPosition.Distance(myStartPick) < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Trsf aNewTrsf;
|
||||
aNewTrsf.SetTranslation(gp_Vec(myStartPick, aNewPosition));
|
||||
theTrsf *= aNewTrsf;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_None:
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -706,9 +654,8 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
|
||||
}
|
||||
}
|
||||
|
||||
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|
||||
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation)
|
||||
|| (myCurrentMode == AIS_MM_TranslationPlane && myBehaviorOnTransform.FollowDragging))
|
||||
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|
||||
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation))
|
||||
{
|
||||
gp_Pnt aPos = myStartPosition.Location().Transformed (theTrsf);
|
||||
gp_Dir aVDir = myStartPosition.Direction().Transformed (theTrsf);
|
||||
@@ -836,13 +783,8 @@ void AIS_Manipulator::DeactivateCurrentMode()
|
||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||
anAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
anAspect->SetMaterial (myDrawer->ShadingAspect()->Material());
|
||||
if (myCurrentMode == AIS_MM_TranslationPlane)
|
||||
anAspect->SetTransparency(1.0);
|
||||
else
|
||||
{
|
||||
anAspect->SetTransparency(myDrawer->ShadingAspect()->Transparency());
|
||||
anAspect->SetColor(myAxes[myCurrentIndex].Color());
|
||||
}
|
||||
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
|
||||
anAspect->SetColor (myAxes[myCurrentIndex].Color());
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->Aspect());
|
||||
}
|
||||
@@ -937,14 +879,14 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
|
||||
|
||||
// Display center
|
||||
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin());
|
||||
aGroup = thePrs->NewGroup ();
|
||||
aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myCenter.Array());
|
||||
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
// Display axes
|
||||
aGroup = thePrs->NewGroup ();
|
||||
aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
|
||||
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
|
||||
anAspectAx->SetColor (myAxes[anIt].Color());
|
||||
@@ -987,13 +929,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
|
||||
return;
|
||||
}
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
||||
}
|
||||
else
|
||||
aGroup->SetGroupPrimitivesAspect(myHighlightAspect->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
|
||||
|
||||
myCurrentIndex = anOwner->Index();
|
||||
myCurrentMode = anOwner->Mode();
|
||||
@@ -1022,20 +958,13 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency(0.5);
|
||||
aPresentation->Highlight(aStyle);
|
||||
}
|
||||
else
|
||||
aPresentation->Highlight(theStyle);
|
||||
aPresentation->Highlight (theStyle);
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
||||
aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (!aGrp.IsNull())
|
||||
if (!aGrp.IsNull()
|
||||
&& aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
|
||||
}
|
||||
@@ -1144,38 +1073,6 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
if (!myAxes[anIt].HasDragging())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
}
|
||||
|
||||
// define sensitivity by two crossed lines
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add(aTri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1291,24 +1188,6 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
|
||||
myArray->AddVertex (theP3, theNormal);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Sector
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
{
|
||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||
aTool.FillArray(myArray, myTriangulation, aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Axis
|
||||
//function : Constructor
|
||||
@@ -1329,7 +1208,6 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
|
||||
myInnerRadius (myLength + myBoxSize),
|
||||
myDiskThickness (myBoxSize * 0.5f),
|
||||
myIndent (0.2f),
|
||||
myHasDragging(Standard_True),
|
||||
myFacettesNumber (20),
|
||||
myCircleRadius (myLength + myBoxSize + myBoxSize * 0.5f * 0.5f)
|
||||
{
|
||||
@@ -1358,7 +1236,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
myAxisRadius * 1.5,
|
||||
anArrowLength,
|
||||
myFacettesNumber);
|
||||
myTranslatorGroup = thePrs->NewGroup ();
|
||||
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
|
||||
@@ -1382,7 +1260,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
||||
|
||||
myScalerGroup = thePrs->NewGroup ();
|
||||
myScalerGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myScalerGroup->AddPrimitiveArray (myCube.Array());
|
||||
|
||||
@@ -1405,7 +1283,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
{
|
||||
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
|
||||
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
|
||||
myRotatorGroup = thePrs->NewGroup ();
|
||||
myRotatorGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
|
||||
|
||||
@@ -1423,36 +1301,4 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
aGroup->AddPrimitiveArray (myCircle.Array());
|
||||
}
|
||||
}
|
||||
|
||||
if (myHasDragging)
|
||||
{
|
||||
gp_Dir aXDirection;
|
||||
if (myReferenceAxis.Direction().X() > 0)
|
||||
aXDirection = gp::DY();
|
||||
else if (myReferenceAxis.Direction().Y() > 0)
|
||||
aXDirection = gp::DZ();
|
||||
else
|
||||
aXDirection = gp::DX();
|
||||
|
||||
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
|
||||
myDraggerGroup = thePrs->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
|
||||
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
||||
|
||||
if (myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger = new Prs3d_Presentation(thePrsMgr->StructureManager());
|
||||
}
|
||||
else
|
||||
{
|
||||
myHighlightDragger->Clear();
|
||||
}
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(myHighlightDragger);
|
||||
aGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
aGroup->AddPrimitiveArray(mySector.Array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -280,14 +280,12 @@ public:
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct BehaviorOnTransform {
|
||||
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True), FollowDragging (Standard_True) {}
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
|
||||
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowDragging (const Standard_Boolean theApply) { FollowDragging = theApply; return *this; }
|
||||
|
||||
Standard_Boolean FollowTranslation;
|
||||
Standard_Boolean FollowRotation;
|
||||
Standard_Boolean FollowDragging;
|
||||
};
|
||||
|
||||
//! Sets behavior settings for transformation action carried on the manipulator,
|
||||
@@ -448,29 +446,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
class Sector : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Sector()
|
||||
: Quadric(),
|
||||
myRadius(0.0f)
|
||||
{ }
|
||||
|
||||
~Sector() { }
|
||||
|
||||
void Init(const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const Standard_Integer theSlicesNb = 5,
|
||||
const Standard_Integer theStacksNb = 5);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myRadius;
|
||||
};
|
||||
|
||||
//! The class describes on axis sub-object.
|
||||
//! It includes sub-objects itself:
|
||||
//! -rotator
|
||||
@@ -510,11 +485,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
{
|
||||
myHighlightRotator->SetTransformPersistence (theTrsfPers);
|
||||
}
|
||||
|
||||
if (!myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger->SetTransformPersistence(theTrsfPers);
|
||||
}
|
||||
}
|
||||
|
||||
void Transform (const Handle(Geom_Transformation)& theTransformation)
|
||||
@@ -533,11 +503,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
{
|
||||
myHighlightRotator->SetTransformation (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger->SetTransformation(theTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean HasTranslation() const { return myHasTranslation; }
|
||||
@@ -546,16 +511,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
Standard_Boolean HasScaling() const { return myHasScaling; }
|
||||
|
||||
Standard_Boolean HasDragging() const { return myHasDragging; }
|
||||
|
||||
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
|
||||
|
||||
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
|
||||
|
||||
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
|
||||
|
||||
void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
|
||||
|
||||
Quantity_Color Color() const { return myColor; }
|
||||
|
||||
Standard_ShortReal AxisLength() const { return myLength; }
|
||||
@@ -570,16 +531,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; }
|
||||
|
||||
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
|
||||
|
||||
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
|
||||
@@ -613,7 +570,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
public:
|
||||
|
||||
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
|
||||
const Sector& DraggerSector() const { return mySector; }
|
||||
const Disk& RotatorDisk() const { return myCircle; }
|
||||
float RotatorDiskRadius() const { return myCircleRadius; }
|
||||
const Cube& ScalerCube() const { return myCube; }
|
||||
@@ -637,14 +593,11 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Standard_ShortReal myDiskThickness;
|
||||
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
|
||||
|
||||
Standard_Boolean myHasDragging;
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myFacettesNumber;
|
||||
|
||||
gp_Pnt myArrowTipPos;
|
||||
Sector mySector;
|
||||
Disk myCircle;
|
||||
float myCircleRadius;
|
||||
Cube myCube;
|
||||
@@ -653,12 +606,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Handle(Graphic3d_Group) myTranslatorGroup;
|
||||
Handle(Graphic3d_Group) myScalerGroup;
|
||||
Handle(Graphic3d_Group) myRotatorGroup;
|
||||
Handle(Graphic3d_Group) myDraggerGroup;
|
||||
|
||||
Handle(Prs3d_Presentation) myHighlightTranslator;
|
||||
Handle(Prs3d_Presentation) myHighlightScaler;
|
||||
Handle(Prs3d_Presentation) myHighlightRotator;
|
||||
Handle(Prs3d_Presentation) myHighlightDragger;
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
|
||||
|
||||
@@ -687,9 +638,6 @@ protected: //! @name Fields for interactive transformation. Fields only for inte
|
||||
|
||||
//! Aspect used to color current detected part and current selected part.
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
||||
|
||||
//! Aspect used to color sector part when it's selected.
|
||||
Handle(Prs3d_ShadingAspect) myDraggerHighlight;
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
|
||||
|
@@ -22,8 +22,7 @@ enum AIS_ManipulatorMode
|
||||
AIS_MM_None = 0,
|
||||
AIS_MM_Translation = 1,
|
||||
AIS_MM_Rotation,
|
||||
AIS_MM_Scaling,
|
||||
AIS_MM_TranslationPlane
|
||||
AIS_MM_Scaling
|
||||
};
|
||||
|
||||
#endif
|
@@ -173,8 +173,8 @@ void AIS_PointCloudOwner::Clear (const Handle(PrsMgr_PresentationManager)& thePr
|
||||
//==================================================
|
||||
AIS_PointCloud::AIS_PointCloud()
|
||||
{
|
||||
myDrawer->SetupOwnShadingAspect();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetMarkerType (Aspect_TOM_POINT);
|
||||
// override default point style to Aspect_TOM_POINT
|
||||
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0));
|
||||
|
||||
SetDisplayMode (AIS_PointCloud::DM_Points);
|
||||
SetHilightMode (AIS_PointCloud::DM_BndBox);
|
||||
@@ -282,8 +282,52 @@ void AIS_PointCloud::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
AIS_InteractiveObject::SetColor(theColor);
|
||||
|
||||
if (!myDrawer->HasOwnPointAspect())
|
||||
{
|
||||
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, theColor, 1.0));
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->PointAspect()->Aspect() = *myDrawer->Link()->PointAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
// Override color
|
||||
myDrawer->ShadingAspect()->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
myDrawer->PointAspect() ->SetColor (theColor);
|
||||
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aPointAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -298,20 +342,34 @@ void AIS_PointCloud::UnsetColor()
|
||||
}
|
||||
|
||||
AIS_InteractiveObject::UnsetColor();
|
||||
|
||||
if (!HasWidth())
|
||||
{
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->PointAspect()->SetColor (myDrawer->HasLink()
|
||||
? myDrawer->Link()->PointAspect()->Aspect()->Color()
|
||||
: Quantity_Color (Quantity_NOC_YELLOW));
|
||||
}
|
||||
|
||||
if (HasMaterial()
|
||||
|| IsTransparent())
|
||||
{
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
|
||||
Graphic3d_MaterialAspect aMat = aDefaultMat;
|
||||
Quantity_Color aColor = aDefaultMat.Color();
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
|
||||
}
|
||||
if (HasMaterial() || myDrawer->HasLink())
|
||||
{
|
||||
aMat = AIS_GraphicTool::GetMaterial (HasMaterial() ? myDrawer : myDrawer->Link());
|
||||
}
|
||||
if (HasMaterial())
|
||||
{
|
||||
Quantity_Color aColor = aDefaultMat.AmbientColor();
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
|
||||
}
|
||||
aMat.SetColor (aColor);
|
||||
}
|
||||
if (IsTransparent())
|
||||
@@ -320,10 +378,43 @@ void AIS_PointCloud::UnsetColor()
|
||||
aMat.SetTransparency (Standard_ShortReal(aTransp));
|
||||
}
|
||||
myDrawer->ShadingAspect()->SetMaterial (aMat, myCurrentFacingModel);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
|
||||
SynchronizeAspects();
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = myDrawer->Link()->PointAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aMarkerAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -332,6 +423,14 @@ void AIS_PointCloud::UnsetColor()
|
||||
//=======================================================================
|
||||
void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
hasOwnMaterial = Standard_True;
|
||||
|
||||
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
|
||||
@@ -340,7 +439,28 @@ void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
|
||||
}
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
SynchronizeAspects();
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -354,6 +474,8 @@ void AIS_PointCloud::UnsetMaterial()
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasColor()
|
||||
|| IsTransparent())
|
||||
{
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
|
||||
myDrawer->ShadingAspect()->SetMaterial (myDrawer->HasLink() ?
|
||||
@@ -366,8 +488,33 @@ void AIS_PointCloud::UnsetMaterial()
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
hasOwnMaterial = Standard_False;
|
||||
SynchronizeAspects();
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -388,7 +535,8 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPoints);
|
||||
break;
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@@ -185,13 +184,8 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
|
||||
pa->SetTypeOfMarker(aProjTOM);
|
||||
}
|
||||
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (ProjPoint);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anArrayOfPoints);
|
||||
}
|
||||
// calcul du projete
|
||||
StdPrs_Point::Add(aPrs, new Geom_CartesianPoint(ProjPoint), myDrawer);
|
||||
|
||||
if (!myDrawer->HasOwnWireAspect()){
|
||||
myDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aCallTOL,2.));}
|
||||
@@ -203,14 +197,10 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
|
||||
}
|
||||
|
||||
// Si les points ne sont pas confondus...
|
||||
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion()))
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||
Handle(Graphic3d_ArrayOfSegments) anArrayOfLines = new Graphic3d_ArrayOfSegments (2);
|
||||
anArrayOfLines->AddVertex (ProjPoint);
|
||||
anArrayOfLines->AddVertex (BRep_Tool::Pnt(aVertex));
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anArrayOfLines);
|
||||
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion())) {
|
||||
// calcul des lignes de rappel
|
||||
BRepBuilderAPI_MakeEdge MakEd (ProjPoint,BRep_Tool::Pnt(aVertex));
|
||||
StdPrs_WFShape::Add (aPrs, MakEd.Edge(), myDrawer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -392,12 +392,13 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
|
||||
|
||||
// Draw filling
|
||||
if (IsFilling() && fillTriangles())
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup1 = thePresentation->NewGroup();
|
||||
aGroup1->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup1->AddPrimitiveArray (myTriangles);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myTriangles);
|
||||
}
|
||||
|
||||
// Draw frame
|
||||
@@ -432,7 +433,6 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myBorders);
|
||||
}
|
||||
|
@@ -77,40 +77,6 @@ static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Auxiliary macros
|
||||
#define replaceAspectWithDef(theMap, theAspect) \
|
||||
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
|
||||
{ \
|
||||
theMap.Bind (myDrawer->theAspect()->Aspect(), myDrawer->Link()->theAspect()->Aspect()); \
|
||||
}
|
||||
|
||||
// Auxiliary macros for replaceWithNewOwnAspects()
|
||||
#define replaceAspectWithOwn(theMap, theAspect) \
|
||||
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
|
||||
{ \
|
||||
theMap.Bind (myDrawer->Link()->theAspect()->Aspect(), myDrawer->theAspect()->Aspect()); \
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceWithNewOwnAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Shape::replaceWithNewOwnAspects()
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
|
||||
replaceAspectWithOwn (aReplaceMap, ShadingAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, LineAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, WireAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, FaceBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, PointAspect);
|
||||
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: AIS_Shape
|
||||
// Purpose :
|
||||
@@ -384,9 +350,78 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Quantity_Color& theColor) const
|
||||
{
|
||||
bool toRecompute = false;
|
||||
toRecompute = theDrawer->SetupOwnShadingAspect() || toRecompute;
|
||||
toRecompute = theDrawer->SetOwnLineAspects() || toRecompute;
|
||||
toRecompute = theDrawer->SetupOwnPointAspect() || toRecompute;
|
||||
if (!theDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnLineAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnWireAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnPointAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnSeenLineAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnFaceBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
// override color
|
||||
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
|
||||
@@ -410,19 +445,52 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
|
||||
const bool toRecompute = setColor (myDrawer, theColor);
|
||||
myDrawer->SetColor (theColor);
|
||||
hasOwnColor = Standard_True;
|
||||
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
if (!toRecompute)
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
SynchronizeAspects();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aPointAspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
recomputeComputed();
|
||||
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -432,31 +500,25 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
|
||||
|
||||
void AIS_Shape::UnsetColor()
|
||||
{
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!HasColor())
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
return;
|
||||
}
|
||||
|
||||
hasOwnColor = Standard_False;
|
||||
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
|
||||
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
if (!HasWidth())
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, LineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, WireAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
|
||||
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
Handle(Prs3d_LineAspect) anEmptyAsp;
|
||||
myDrawer->SetLineAspect (anEmptyAsp);
|
||||
myDrawer->SetWireAspect (anEmptyAsp);
|
||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -538,17 +600,10 @@ void AIS_Shape::UnsetColor()
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
if (myDrawer->HasOwnPointAspect())
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, PointAspect);
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
}
|
||||
replaceAspects (aReplaceMap);
|
||||
SynchronizeAspects();
|
||||
recomputeComputed();
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -559,7 +614,61 @@ void AIS_Shape::UnsetColor()
|
||||
bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Real theLineWidth) const
|
||||
{
|
||||
bool toRecompute = theDrawer->SetOwnLineAspects();
|
||||
bool toRecompute = false;
|
||||
if (!theDrawer->HasOwnLineAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnWireAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnSeenLineAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!theDrawer->HasOwnFaceBoundaryAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
// override width
|
||||
theDrawer->LineAspect()->SetWidth (theLineWidth);
|
||||
@@ -579,19 +688,16 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
||||
{
|
||||
myOwnWidth = theLineWidth;
|
||||
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!setWidth (myDrawer, theLineWidth)
|
||||
|| !myDrawer->HasLink())
|
||||
if (setWidth (myDrawer, theLineWidth))
|
||||
{
|
||||
SynchronizeAspects();
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
myRecomputeEveryPrs = false;
|
||||
myToRecomputeModes.Clear();
|
||||
SynchronizeAspects();
|
||||
}
|
||||
recomputeComputed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -601,30 +707,24 @@ void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
||||
|
||||
void AIS_Shape::UnsetWidth()
|
||||
{
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (myOwnWidth == 0.0)
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
return;
|
||||
}
|
||||
|
||||
myOwnWidth = 0.0;
|
||||
if (!HasColor())
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, LineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, WireAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
|
||||
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
const Handle(Prs3d_LineAspect) anEmptyAsp;
|
||||
myDrawer->SetLineAspect (anEmptyAsp);
|
||||
myDrawer->SetWireAspect (anEmptyAsp);
|
||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -641,8 +741,9 @@ void AIS_Shape::UnsetWidth()
|
||||
myDrawer->FaceBoundaryAspect() ->SetWidth (myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_FaceBoundary) : 1.);
|
||||
SynchronizeAspects();
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
}
|
||||
recomputeComputed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -657,7 +758,14 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
{
|
||||
const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
|
||||
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
|
||||
theDrawer->SetupOwnShadingAspect();
|
||||
if (!theDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
|
||||
|
||||
if (theToKeepColor)
|
||||
@@ -677,21 +785,37 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
|
||||
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
|
||||
setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
|
||||
hasOwnMaterial = Standard_True;
|
||||
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
{
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -701,8 +825,6 @@ void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
|
||||
void AIS_Shape::UnsetMaterial()
|
||||
{
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!HasMaterial())
|
||||
{
|
||||
return;
|
||||
@@ -726,15 +848,37 @@ void AIS_Shape::UnsetMaterial()
|
||||
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
}
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
hasOwnMaterial = Standard_False;
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -745,7 +889,15 @@ void AIS_Shape::UnsetMaterial()
|
||||
void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Real theValue) const
|
||||
{
|
||||
theDrawer->SetupOwnShadingAspect();
|
||||
if (!theDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (theDrawer->HasLink())
|
||||
{
|
||||
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
// override transparency
|
||||
theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
|
||||
}
|
||||
@@ -757,21 +909,33 @@ void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
|
||||
void AIS_Shape::SetTransparency (const Standard_Real theValue)
|
||||
{
|
||||
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
|
||||
setTransparency (myDrawer, theValue);
|
||||
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
|
||||
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
{
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -781,9 +945,6 @@ void AIS_Shape::SetTransparency (const Standard_Real theValue)
|
||||
|
||||
void AIS_Shape::UnsetTransparency()
|
||||
{
|
||||
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
@@ -794,15 +955,36 @@ void AIS_Shape::UnsetTransparency()
|
||||
|| myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -51,7 +51,7 @@
|
||||
//! To generate texture coordinates, appropriate shading attribute should be set before computing presentation in AIS_Shaded display mode:
|
||||
//! @code
|
||||
//! Handle(AIS_Shape) aPrs = new AIS_Shape();
|
||||
//! aPrs->Attributes()->SetupOwnShadingAspect();
|
||||
//! aPrs->Attributes()->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn();
|
||||
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual (Graphic3d_NOT_2D_ALUMINUM));
|
||||
//! @endcode
|
||||
@@ -316,9 +316,6 @@ protected:
|
||||
|
||||
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
|
||||
|
||||
//! Replace aspects of already computed groups from drawer link by the new own value.
|
||||
Standard_EXPORT void replaceWithNewOwnAspects();
|
||||
|
||||
public:
|
||||
|
||||
//! Compute HLR presentation for specified shape.
|
||||
|
@@ -218,6 +218,36 @@ void AIS_TexturedShape::SetColor (const Quantity_Color& theColor)
|
||||
void AIS_TexturedShape::UnsetColor()
|
||||
{
|
||||
AIS_Shape::UnsetColor();
|
||||
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
|
||||
|
||||
if (aPrsModed.Mode() != 3)
|
||||
continue;
|
||||
|
||||
Handle(Prs3d_Presentation) aPrs = aPrsModed.Presentation()->Presentation();
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
|
||||
Quantity_Color aColor;
|
||||
AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
|
||||
anAreaAsp->SetInteriorColor (aColor);
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAsp);
|
||||
}
|
||||
|
||||
updateAttributes (aPrs);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -347,6 +377,10 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (thePrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (!aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aGroup->SetGroupPrimitivesAspect (myAspect);
|
||||
}
|
||||
}
|
||||
|
@@ -108,7 +108,10 @@ void AIS_Triangulation::updatePresentation()
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -335,10 +335,6 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
|
||||
}
|
||||
aGroup->AddPrimitiveArray (arrayOfPrimitives(aPart));
|
||||
|
||||
if (aPresentation->GetZLayer() != theStyle->ZLayer())
|
||||
{
|
||||
aPresentation->SetZLayer (theStyle->ZLayer());
|
||||
}
|
||||
aPresentation->Highlight (theStyle);
|
||||
thePM->AddToImmediateList (aPresentation);
|
||||
}
|
||||
|
@@ -19,8 +19,6 @@ AIS_BadEdgeFilter.cxx
|
||||
AIS_BadEdgeFilter.hxx
|
||||
AIS_C0RegularityFilter.cxx
|
||||
AIS_C0RegularityFilter.hxx
|
||||
AIS_CameraFrustum.cxx
|
||||
AIS_CameraFrustum.hxx
|
||||
AIS_Chamf2dDimension.cxx
|
||||
AIS_Chamf2dDimension.hxx
|
||||
AIS_Chamf2dDimension.lxx
|
||||
|
@@ -129,7 +129,7 @@ Standard_Boolean Adaptor2d_Curve2d::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor2d_Curve2d::IsPeriodic() const
|
||||
Standard_Boolean Adaptor2d_Curve2d::IsPeriodic222() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor2d_Curve2d::IsPeriodic");
|
||||
}
|
||||
|
@@ -84,11 +84,11 @@ public:
|
||||
//! If <First> >= <Last>
|
||||
Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsClosed() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsPeriodic222() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real Period() const;
|
||||
Standard_EXPORT virtual Standard_Real Period() const = 0;
|
||||
|
||||
//! Computes the point of parameter U on the curve.
|
||||
Standard_EXPORT virtual gp_Pnt2d Value (const Standard_Real U) const;
|
||||
|
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
Standard_Boolean IsClosed() const;
|
||||
|
||||
Standard_Boolean IsPeriodic() const;
|
||||
Standard_Boolean IsPeriodic222() const;
|
||||
|
||||
Standard_Real Period() const;
|
||||
|
||||
|
@@ -92,9 +92,9 @@ inline Standard_Real Adaptor2d_HCurve2d::FirstParameter() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Adaptor2d_HCurve2d::IsPeriodic() const
|
||||
inline Standard_Boolean Adaptor2d_HCurve2d::IsPeriodic222() const
|
||||
{
|
||||
return Curve2d().IsPeriodic();
|
||||
return Curve2d().IsPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -161,7 +161,7 @@ Standard_Boolean Adaptor2d_Line2d::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor2d_Line2d::IsPeriodic() const
|
||||
Standard_Boolean Adaptor2d_Line2d::IsPeriodic222() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -276,9 +276,9 @@ Standard_Boolean Adaptor2d_OffsetCurve::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor2d_OffsetCurve::IsPeriodic() const
|
||||
Standard_Boolean Adaptor2d_OffsetCurve::IsPeriodic222() const
|
||||
{
|
||||
return myCurve->IsPeriodic();
|
||||
return myCurve->IsPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -106,40 +106,6 @@ Handle(Adaptor3d_HCurve) Adaptor3d_Curve::Trim(const Standard_Real , const Stand
|
||||
throw Standard_NotImplemented("Adaptor3d_Curve::Trim");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Curve::IsClosed() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Curve::IsClosed");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Curve::IsPeriodic() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Curve::IsPeriodic");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Period
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Adaptor3d_Curve::Period() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Curve::Period");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
|
@@ -86,11 +86,11 @@ public:
|
||||
//! If <First> >= <Last>
|
||||
Standard_EXPORT virtual Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsClosed() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsPeriodic222() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real Period() const;
|
||||
Standard_EXPORT virtual Standard_Real Period() const = 0;
|
||||
|
||||
//! Computes the point of parameter U on the curve.
|
||||
Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U) const;
|
||||
|
@@ -952,9 +952,9 @@ Standard_Boolean Adaptor3d_CurveOnSurface::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic() const
|
||||
Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic222() const
|
||||
{
|
||||
return myCurve->IsPeriodic();
|
||||
return myCurve->IsPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1375,12 +1375,12 @@ Handle(Geom_BSplineCurve) Adaptor3d_CurveOnSurface::BSpline() const
|
||||
Bsp2d->Weights(Weights);
|
||||
Bsp = new Geom_BSplineCurve(Poles,Weights,Knots,Mults,
|
||||
Bsp2d->Degree(),
|
||||
Bsp2d->IsPeriodic());
|
||||
Bsp2d->IsPeriodic111());
|
||||
}
|
||||
else {
|
||||
Bsp = new Geom_BSplineCurve(Poles,Knots,Mults,
|
||||
Bsp2d->Degree(),
|
||||
Bsp2d->IsPeriodic());
|
||||
Bsp2d->IsPeriodic111());
|
||||
}
|
||||
return Bsp;
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
Standard_Boolean IsClosed() const;
|
||||
|
||||
Standard_Boolean IsPeriodic() const;
|
||||
Standard_Boolean IsPeriodic222() const;
|
||||
|
||||
Standard_Real Period() const;
|
||||
|
||||
|
@@ -92,9 +92,9 @@ inline Standard_Real Adaptor3d_HCurve::FirstParameter() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Adaptor3d_HCurve::IsPeriodic() const
|
||||
inline Standard_Boolean Adaptor3d_HCurve::IsPeriodic222() const
|
||||
{
|
||||
return Curve().IsPeriodic();
|
||||
return Curve().IsPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -95,11 +95,11 @@ public:
|
||||
|
||||
Standard_Boolean IsVClosed() const;
|
||||
|
||||
Standard_Boolean IsUPeriodic() const;
|
||||
Standard_Boolean IsUPeriodic222() const;
|
||||
|
||||
Standard_Real UPeriod() const;
|
||||
|
||||
Standard_Boolean IsVPeriodic() const;
|
||||
Standard_Boolean IsVPeriodic222() const;
|
||||
|
||||
Standard_Real VPeriod() const;
|
||||
|
||||
|
@@ -168,9 +168,9 @@ inline Handle(Adaptor3d_HSurface) Adaptor3d_HSurface::VTrim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Adaptor3d_HSurface::IsUPeriodic() const
|
||||
inline Standard_Boolean Adaptor3d_HSurface::IsUPeriodic222() const
|
||||
{
|
||||
return Surface().IsUPeriodic();
|
||||
return Surface().IsUPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -188,9 +188,9 @@ inline Handle(Adaptor3d_HSurface) Adaptor3d_HSurface::VTrim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Adaptor3d_HSurface::IsVPeriodic() const
|
||||
inline Standard_Boolean Adaptor3d_HSurface::IsVPeriodic222() const
|
||||
{
|
||||
return Surface().IsVPeriodic();
|
||||
return Surface().IsVPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -80,11 +80,11 @@ public:
|
||||
|
||||
static Standard_Boolean IsVClosed (const Handle(Adaptor3d_HSurface)& S);
|
||||
|
||||
static Standard_Boolean IsUPeriodic (const Handle(Adaptor3d_HSurface)& S);
|
||||
static Standard_Boolean IsUPeriodic333 (const Handle(Adaptor3d_HSurface)& S);
|
||||
|
||||
static Standard_Real UPeriod (const Handle(Adaptor3d_HSurface)& S);
|
||||
|
||||
static Standard_Boolean IsVPeriodic (const Handle(Adaptor3d_HSurface)& S);
|
||||
static Standard_Boolean IsVPeriodic333 (const Handle(Adaptor3d_HSurface)& S);
|
||||
|
||||
static Standard_Real VPeriod (const Handle(Adaptor3d_HSurface)& S);
|
||||
|
||||
|
@@ -98,9 +98,9 @@ inline Standard_Boolean Adaptor3d_HSurfaceTool::IsVClosed(const Handle(Adaptor3d
|
||||
return S->IsVClosed();
|
||||
}
|
||||
|
||||
inline Standard_Boolean Adaptor3d_HSurfaceTool::IsUPeriodic(const Handle(Adaptor3d_HSurface)& S)
|
||||
inline Standard_Boolean Adaptor3d_HSurfaceTool::IsUPeriodic333(const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
return S->IsUPeriodic();
|
||||
return S->IsUPeriodic222();
|
||||
}
|
||||
|
||||
inline Standard_Real Adaptor3d_HSurfaceTool::UPeriod(const Handle(Adaptor3d_HSurface)& S)
|
||||
@@ -108,9 +108,9 @@ inline Standard_Real Adaptor3d_HSurfaceTool::UPeriod(const Handle(Adaptor3d_HSur
|
||||
return S->UPeriod();
|
||||
}
|
||||
|
||||
inline Standard_Boolean Adaptor3d_HSurfaceTool::IsVPeriodic(const Handle(Adaptor3d_HSurface)& S)
|
||||
inline Standard_Boolean Adaptor3d_HSurfaceTool::IsVPeriodic333(const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
return S->IsVPeriodic();
|
||||
return S->IsVPeriodic222();
|
||||
}
|
||||
|
||||
inline Standard_Real Adaptor3d_HSurfaceTool::VPeriod(const Handle(Adaptor3d_HSurface)& S)
|
||||
|
@@ -171,7 +171,7 @@ void Adaptor3d_IsoCurve::Load(const GeomAbs_IsoType Iso,
|
||||
|
||||
Standard_Real dummy = myParameter;
|
||||
|
||||
if (mySurface->IsUPeriodic()) {
|
||||
if (mySurface->IsUPeriodic222()) {
|
||||
|
||||
if (myIso == GeomAbs_IsoU) {
|
||||
ElCLib::AdjustPeriodic
|
||||
@@ -191,7 +191,7 @@ void Adaptor3d_IsoCurve::Load(const GeomAbs_IsoType Iso,
|
||||
}
|
||||
}
|
||||
|
||||
if (mySurface->IsVPeriodic()) {
|
||||
if (mySurface->IsVPeriodic222()) {
|
||||
|
||||
if (myIso == GeomAbs_IsoV) {
|
||||
ElCLib::AdjustPeriodic
|
||||
@@ -345,13 +345,13 @@ Standard_Boolean Adaptor3d_IsoCurve::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_IsoCurve::IsPeriodic() const
|
||||
Standard_Boolean Adaptor3d_IsoCurve::IsPeriodic222() const
|
||||
{
|
||||
switch (myIso) {
|
||||
case GeomAbs_IsoU:
|
||||
return mySurface->IsVPeriodic();
|
||||
return mySurface->IsVPeriodic222();
|
||||
case GeomAbs_IsoV:
|
||||
return mySurface->IsUPeriodic();
|
||||
return mySurface->IsUPeriodic222();
|
||||
case GeomAbs_NoneIso:
|
||||
default:
|
||||
break;
|
||||
|
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -179,73 +179,6 @@ Handle(Adaptor3d_HSurface) Adaptor3d_Surface::VTrim(const Standard_Real , const
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::VTrim");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Surface::IsUClosed() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::IsUClosed");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Surface::IsVClosed() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::IsVClosed");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Surface::IsUPeriodic() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::IsUPeriodic");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Adaptor3d_Surface::UPeriod() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::UPeriod");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Adaptor3d_Surface::IsVPeriodic() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::IsVPeriodic");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : VPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Adaptor3d_Surface::VPeriod() const
|
||||
{
|
||||
throw Standard_NotImplemented("Adaptor3d_Surface::VPeriod");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
|
@@ -51,7 +51,7 @@ class Adaptor3d_HCurve;
|
||||
//! the surface by algorithms which use it.
|
||||
//! A derived concrete class is provided:
|
||||
//! GeomAdaptor_Surface for a surface from the Geom package.
|
||||
//! The Surface class describes the standard behaviour
|
||||
//! The Surface class describes the standard behavior
|
||||
//! of a surface for generic algorithms.
|
||||
//!
|
||||
//! The Surface can be decomposed in intervals of any
|
||||
@@ -59,7 +59,7 @@ class Adaptor3d_HCurve;
|
||||
//! NbIntervals. A current interval can be set. Most
|
||||
//! of the methods apply to the current interval.
|
||||
//! Warning: All the methods are virtual and implemented with a
|
||||
//! raise to allow to redefined only the methods realy
|
||||
//! raise to allow to redefined only the methods really
|
||||
//! used.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline surfaces used for their evaluation are
|
||||
@@ -113,17 +113,17 @@ public:
|
||||
//! If <First> >= <Last>
|
||||
Standard_EXPORT virtual Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsUClosed() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsVClosed() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsUPeriodic222() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real UPeriod() const;
|
||||
Standard_EXPORT virtual Standard_Real UPeriod() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic222() const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real VPeriod() const;
|
||||
Standard_EXPORT virtual Standard_Real VPeriod() const = 0;
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||
|
@@ -829,7 +829,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
|
||||
if(MyImplicitFirst) {
|
||||
if(u2<binfu-0.0000000001) {
|
||||
if(ThePSurfaceTool::IsUPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsUPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
|
||||
do { TranslationU+=d; } while(u2+TranslationU < binfu);
|
||||
}
|
||||
@@ -837,7 +837,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
else if(u2>bsupu+0.0000000001) {
|
||||
if(ThePSurfaceTool::IsUPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsUPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
|
||||
do { TranslationU-=d; } while(u2+TranslationU > bsupu);
|
||||
}
|
||||
@@ -845,7 +845,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
if(v2<binfv-0.0000000001) {
|
||||
if(ThePSurfaceTool::IsVPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsVPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
|
||||
do { TranslationV+=d; } while(v2+TranslationV < binfv);
|
||||
}
|
||||
@@ -853,7 +853,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
else if(v2>bsupv+0.0000000001) {
|
||||
if(ThePSurfaceTool::IsVPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsVPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
|
||||
do { TranslationV-=d; } while(v2+TranslationV > bsupv);
|
||||
}
|
||||
@@ -865,7 +865,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
}
|
||||
else {
|
||||
if(u1<binfu-0.0000000001) {
|
||||
if(ThePSurfaceTool::IsUPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsUPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
|
||||
do { TranslationU+=d; } while(u1+TranslationU < binfu);
|
||||
}
|
||||
@@ -873,7 +873,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
else if(u1>bsupu+0.0000000001) {
|
||||
if(ThePSurfaceTool::IsUPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsUPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::UPeriod(aPSurf);
|
||||
do { TranslationU-=d; } while(u1+TranslationU > bsupu);
|
||||
}
|
||||
@@ -881,7 +881,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
if(v1<binfv-0.0000000001) {
|
||||
if(ThePSurfaceTool::IsVPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsVPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
|
||||
do { TranslationV+=d; } while(v1+TranslationV < binfv);
|
||||
}
|
||||
@@ -889,7 +889,7 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
|
||||
return(Standard_False);
|
||||
}
|
||||
else if(v1>bsupv+0.0000000001) {
|
||||
if(ThePSurfaceTool::IsVPeriodic(aPSurf)) {
|
||||
if(ThePSurfaceTool::IsVPeriodic333(aPSurf)) {
|
||||
Standard_Real d = ThePSurfaceTool::VPeriod(aPSurf);
|
||||
do { TranslationV-=d; } while(v1+TranslationV > bsupv);
|
||||
}
|
||||
|
@@ -26,11 +26,9 @@ IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient)
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__)
|
||||
myDisplay = NULL;
|
||||
myIsOwnDisplay = false;
|
||||
OSD_Environment anEnv ("DISPLAY");
|
||||
myDisplayName = anEnv.Value();
|
||||
Init (NULL);
|
||||
Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -41,8 +39,7 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__)
|
||||
if (myDisplay != NULL
|
||||
&& myIsOwnDisplay)
|
||||
if (myDisplay != NULL)
|
||||
{
|
||||
XCloseDisplay (myDisplay);
|
||||
}
|
||||
@@ -55,39 +52,38 @@ Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName)
|
||||
: myDisplay (NULL),
|
||||
myIsOwnDisplay (false)
|
||||
{
|
||||
myDisplayName = theDisplayName;
|
||||
Init (NULL);
|
||||
Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Aspect_DisplayConnection
|
||||
// function : GetDisplay
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (Display* theDisplay)
|
||||
: myDisplay (NULL),
|
||||
myIsOwnDisplay (false)
|
||||
Display* Aspect_DisplayConnection::GetDisplay()
|
||||
{
|
||||
Init (theDisplay);
|
||||
return myDisplay;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDisplayName
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString Aspect_DisplayConnection::GetDisplayName()
|
||||
{
|
||||
return myDisplayName;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_DisplayConnection::Init (Display* theDisplay)
|
||||
void Aspect_DisplayConnection::Init()
|
||||
{
|
||||
if (myDisplay != NULL
|
||||
&& myIsOwnDisplay)
|
||||
{
|
||||
XCloseDisplay (myDisplay);
|
||||
}
|
||||
myIsOwnDisplay = false;
|
||||
myAtoms.Clear();
|
||||
|
||||
myDisplay = theDisplay != NULL ? theDisplay : XOpenDisplay (myDisplayName.ToCString());
|
||||
myDisplay = XOpenDisplay (myDisplayName.ToCString());
|
||||
myAtoms.Bind (Aspect_XA_DELETE_WINDOW, XInternAtom(myDisplay, "WM_DELETE_WINDOW", False));
|
||||
|
||||
if (myDisplay == NULL)
|
||||
{
|
||||
TCollection_AsciiString aMessage;
|
||||
@@ -95,11 +91,6 @@ void Aspect_DisplayConnection::Init (Display* theDisplay)
|
||||
aMessage += myDisplayName + "\"";
|
||||
throw Aspect_DisplayConnectionDefinitionError(aMessage.ToCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
myIsOwnDisplay = theDisplay == NULL;
|
||||
myAtoms.Bind (Aspect_XA_DELETE_WINDOW, XInternAtom(myDisplay, "WM_DELETE_WINDOW", False));
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -47,37 +47,25 @@ public:
|
||||
//! screen_number - Specifies the screen to be used on that server. Optional variable.
|
||||
Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName);
|
||||
|
||||
//! Constructor wrapping existing Display instance.
|
||||
//! WARNING! it is a responsibility of application to keep this pointer
|
||||
//! valid while Aspect_DisplayConnection is alive and to close Display when it is no more needed.
|
||||
Aspect_DisplayConnection (Display* theDisplay);
|
||||
|
||||
//! @return pointer to Display structure that serves as the connection to the X server.
|
||||
Display* GetDisplay() { return myDisplay; }
|
||||
|
||||
//! @return TRUE if X Display has been allocated by this class
|
||||
Standard_Boolean IsOwnDisplay() const { return myIsOwnDisplay; }
|
||||
|
||||
Display* GetDisplay();
|
||||
|
||||
//! @return identifier(atom) for custom named property associated with windows that use current connection to X server.
|
||||
Atom GetAtom (const Aspect_XAtom theAtom) const;
|
||||
|
||||
//! @return display name for this connection.
|
||||
const TCollection_AsciiString& GetDisplayName() { return myDisplayName; }
|
||||
TCollection_AsciiString GetDisplayName();
|
||||
|
||||
//! Open connection with display specified in myDisplayName class field
|
||||
//! or takes theDisplay parameter when it is not NULL.
|
||||
//! WARNING! When external Display is specified, it is a responsibility of application
|
||||
//! to keep this pointer valid while Aspect_DisplayConnection is alive
|
||||
//! and to close Display when it is no more needed.
|
||||
//! @param theDisplay external pointer to allocated Display, or NULL if new connection should be created
|
||||
void Init (Display* theDisplay);
|
||||
private:
|
||||
|
||||
//! Open connection with display specified in myDisplayName class field.
|
||||
void Init();
|
||||
|
||||
private:
|
||||
|
||||
Display* myDisplay;
|
||||
NCollection_DataMap<Aspect_XAtom, Atom> myAtoms;
|
||||
TCollection_AsciiString myDisplayName;
|
||||
Standard_Boolean myIsOwnDisplay;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@@ -16,17 +16,23 @@
|
||||
#ifndef _Aspect_InteriorStyle_HeaderFile
|
||||
#define _Aspect_InteriorStyle_HeaderFile
|
||||
|
||||
//! Interior types for primitive faces.
|
||||
//! Definition of interior types for primitive
|
||||
//! faces.
|
||||
//!
|
||||
//! IS_EMPTY no interior.
|
||||
//! IS_HOLLOW display the boundaries of the surface.
|
||||
//! IS_HATCH display hatched with a hatch style.
|
||||
//! IS_SOLID display the interior entirely filled.
|
||||
//! IS_HIDDENLINE display in hidden lines removed.
|
||||
//! IS_POINT display only vertices.
|
||||
enum Aspect_InteriorStyle
|
||||
{
|
||||
Aspect_IS_EMPTY = -1, //!< no interior
|
||||
Aspect_IS_SOLID = 0, //!< normally filled surface interior
|
||||
Aspect_IS_HATCH, //!< hatched surface interior
|
||||
Aspect_IS_HIDDENLINE, //!< interior is filled with viewer background color
|
||||
Aspect_IS_POINT, //!< display only vertices of surface (obsolete)
|
||||
|
||||
// obsolete aliases
|
||||
Aspect_IS_HOLLOW = Aspect_IS_EMPTY, //!< transparent surface interior
|
||||
Aspect_IS_EMPTY,
|
||||
Aspect_IS_HOLLOW,
|
||||
Aspect_IS_HATCH,
|
||||
Aspect_IS_SOLID,
|
||||
Aspect_IS_HIDDENLINE,
|
||||
Aspect_IS_POINT
|
||||
};
|
||||
|
||||
#endif // _Aspect_InteriorStyle_HeaderFile
|
||||
|
@@ -285,7 +285,7 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
else
|
||||
{
|
||||
const BRepAdaptor_Surface& aBAS = myContext->SurfaceAdaptor(myF);
|
||||
if (aBAS.IsUPeriodic() || aBAS.IsVPeriodic())
|
||||
if (aBAS.IsUPeriodic222() || aBAS.IsVPeriodic222())
|
||||
{
|
||||
// The curve already exists. Adjust it for periodic cases.
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
|
@@ -1580,9 +1580,7 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
|
||||
//
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
//
|
||||
const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
|
||||
Handle(Geom_TrimmedCurve)aC3DETrim=
|
||||
new Geom_TrimmedCurve(aC3DE, aT1, aT2);
|
||||
BRep_Tool::Range(aE, aT1, aT2);
|
||||
//
|
||||
for (i=0; i<2; ++i) {
|
||||
bPC = !i ? bPC1 : bPC2;
|
||||
@@ -1602,21 +1600,15 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
|
||||
aFFWD.Orientation(TopAbs_FORWARD);
|
||||
//
|
||||
aC2D=aC2Dx1;
|
||||
if (aC2D.IsNull()) {
|
||||
if (aC2D.IsNull())
|
||||
{
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D,
|
||||
aOutFirst, aOutLast,
|
||||
aOutTol, theContext);
|
||||
}
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D,
|
||||
aOutFirst, aOutLast,
|
||||
aOutTol, theContext);
|
||||
}
|
||||
//
|
||||
if (aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D,
|
||||
aC2DA, theContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D,
|
||||
aC2DA, theContext);
|
||||
}
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA, theContext);
|
||||
//
|
||||
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
|
||||
//BRepLib::SameParameter(aE);
|
||||
|
@@ -250,22 +250,6 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
(const TopoDS_Face& theF,
|
||||
const Handle(Geom_Curve)& theC3D,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aT1 = theC3D->FirstParameter();
|
||||
Standard_Real aT2 = theC3D->LastParameter();
|
||||
//
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
(const TopoDS_Face& theF,
|
||||
const Standard_Real theFirst,
|
||||
@@ -319,7 +303,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
//
|
||||
// du
|
||||
du = 0.;
|
||||
if (aBAS.IsUPeriodic()) {
|
||||
if (aBAS.IsUPeriodic222()) {
|
||||
aUPeriod = aBAS.UPeriod();
|
||||
|
||||
//
|
||||
@@ -356,7 +340,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
|
||||
// dv
|
||||
dv = 0.;
|
||||
if (aBAS.IsVPeriodic()) {
|
||||
if (aBAS.IsVPeriodic222()) {
|
||||
Standard_Real aVPeriod, aVm, aVr, aVmid, dVm, dVr;
|
||||
//
|
||||
aVPeriod = aBAS.VPeriod();
|
||||
@@ -384,7 +368,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
Standard_Real u,v;
|
||||
u = u2 + du;
|
||||
v = v2 + dv;
|
||||
if (aBAS.IsUPeriodic()) {
|
||||
if (aBAS.IsUPeriodic222()) {
|
||||
aUPeriod = aBAS.UPeriod();
|
||||
if ((UMax - UMin - 2*aDelta) > aUPeriod) {
|
||||
if ((u > (UMin + aDelta + aUPeriod)) ||
|
||||
@@ -400,7 +384,7 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
}
|
||||
//
|
||||
u = u2 + du;
|
||||
if (aBAS.IsVPeriodic()) {
|
||||
if (aBAS.IsVPeriodic222()) {
|
||||
Standard_Real aVPeriod = aBAS.VPeriod();
|
||||
if ((VMax - VMin - 2*aDelta) > aVPeriod) {
|
||||
if ((v > (VMin + aDelta + aVPeriod)) ||
|
||||
|
@@ -45,38 +45,38 @@ public:
|
||||
//! Compute P-Curve for the edge <aE> on the face <aF>.<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void BuildPCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
|
||||
Standard_EXPORT static Standard_Boolean EdgeTangent(const TopoDS_Edge& anE,
|
||||
const Standard_Real aT,
|
||||
gp_Vec& Tau);
|
||||
|
||||
|
||||
//! Compute surface parameters <U,V> of the face <aF>
|
||||
//! for the point from the edge <aE> at parameter <aT>.<br>
|
||||
//! If <aE> has't pcurve on surface, algorithm tries to get it by
|
||||
//! projection and can
|
||||
//! raise exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void PointOnSurface(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! If the P-Curve does not exist, build it using Make2D().<br>
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void CurveOnSurface(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! If the P-Curve does not exist, build it using Make2D().<br>
|
||||
@@ -84,14 +84,14 @@ public:
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void CurveOnSurface(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Returns TRUE if the edge <aE> has P-Curve <aC>
|
||||
//! on surface <aF> .
|
||||
//! [aFirst, aLast] - range of the P-Curve
|
||||
@@ -103,30 +103,22 @@ public:
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler);
|
||||
|
||||
|
||||
//! Returns TRUE if the edge <aE> has P-Curve <aC>
|
||||
//! on surface <aF> .
|
||||
//! If the P-Curve does not exist, aC.IsNull()=TRUE.
|
||||
Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF);
|
||||
|
||||
//! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void AdjustPCurveOnFace(const TopoDS_Face& theF,
|
||||
const Handle(Geom_Curve)& theC3D,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
|
||||
//! [aT1, aT2] - range to adjust<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void AdjustPCurveOnFace(const TopoDS_Face& theF,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
|
||||
//! [aT1, aT2] - range to adjust
|
||||
@@ -135,50 +127,50 @@ public:
|
||||
const Standard_Real aT2,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
Handle(Geom2d_Curve)& aC2DA);
|
||||
|
||||
|
||||
//! Compute intermediate value in between [aFirst, aLast] .
|
||||
Standard_EXPORT static Standard_Real IntermediatePoint(const Standard_Real aFirst,
|
||||
const Standard_Real aLast);
|
||||
|
||||
|
||||
//! Compute intermediate value of parameter for the edge <anE>.
|
||||
Standard_EXPORT static Standard_Real IntermediatePoint(const TopoDS_Edge& anE);
|
||||
Standard_EXPORT static Standard_Real IntermediatePoint (const TopoDS_Edge& anE);
|
||||
|
||||
//! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! [aFirst, aLast] - range of the P-Curve<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void Make2D(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void Make2D (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void MakePCurveOnFace(const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
|
||||
//! [aT1, aT2] - range to build<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void MakePCurveOnFace(const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Attach P-Curve from the edge <aEold> on surface <aF>
|
||||
//! to the edge <aEnew>
|
||||
//! Returns 0 in case of success
|
||||
|
@@ -75,8 +75,8 @@ static
|
||||
void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
|
||||
const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft;
|
||||
Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1;
|
||||
Standard_Boolean bIsLeft;
|
||||
Standard_Real aTol, a, b, aT, anU, dU, anU1;
|
||||
Standard_Real aScPr, anV, dV, anV1;
|
||||
Standard_Real aUmin, aUmax, aVmin, aVmax;
|
||||
gp_Pnt2d aP2D;
|
||||
@@ -97,58 +97,19 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
|
||||
//
|
||||
aS->Bounds(aUmin, aUmax, aVmin, aVmax);
|
||||
//
|
||||
bIsUPeriodic=aS->IsUPeriodic();
|
||||
bIsVPeriodic=aS->IsVPeriodic();
|
||||
const Standard_Boolean bIsUPeriodic = aS->IsUPeriodic111(),
|
||||
bIsVPeriodic = aS->IsVPeriodic111();
|
||||
|
||||
const Standard_Real anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.,
|
||||
anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
|
||||
|
||||
const Standard_Boolean bIsUClosed = aS->IsUClosed(),
|
||||
bIsVClosed = aS->IsVClosed();
|
||||
//
|
||||
anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.;
|
||||
anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
|
||||
//
|
||||
if (!bIsUPeriodic && !bIsVPeriodic) {
|
||||
Standard_Boolean bIsUClosed, bIsVClosed;
|
||||
Handle(Geom_BSplineSurface) aBS;
|
||||
Handle(Geom_BezierSurface) aBZ;
|
||||
Handle(Geom_RectangularTrimmedSurface) aRTS;
|
||||
//
|
||||
bIsUClosed=Standard_False;
|
||||
bIsVClosed=Standard_False;
|
||||
aBS=Handle(Geom_BSplineSurface)::DownCast(aS);
|
||||
aBZ=Handle(Geom_BezierSurface) ::DownCast(aS);
|
||||
aRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
|
||||
//
|
||||
if (!aBS.IsNull()) {
|
||||
bIsUClosed=aBS->IsUClosed();
|
||||
bIsVClosed=aBS->IsVClosed();
|
||||
}
|
||||
else if (!aBZ.IsNull()) {
|
||||
bIsUClosed=aBZ->IsUClosed();
|
||||
bIsVClosed=aBZ->IsVClosed();
|
||||
}
|
||||
else if (!aRTS.IsNull()) {
|
||||
Handle(Geom_Surface) aSB;
|
||||
//
|
||||
aSB=aRTS->BasisSurface();
|
||||
bIsUPeriodic=aSB->IsUPeriodic();
|
||||
bIsVPeriodic=aSB->IsVPeriodic();
|
||||
//
|
||||
if (!(bIsUPeriodic || bIsVPeriodic)) {
|
||||
return;
|
||||
}
|
||||
anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.;
|
||||
anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.;
|
||||
}
|
||||
//
|
||||
if (aRTS.IsNull()) {
|
||||
if (!bIsUClosed && !bIsVClosed) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (bIsUClosed) {
|
||||
anUPeriod=aUmax-aUmin;
|
||||
}
|
||||
if (bIsVClosed) {
|
||||
anVPeriod=aVmax-aVmin;
|
||||
}
|
||||
}
|
||||
if ((!bIsUPeriodic || !bIsUClosed) &&
|
||||
(!bIsVPeriodic || !bIsVClosed))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//
|
||||
//---------------------------------------------------
|
||||
|
@@ -1182,29 +1182,6 @@ Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAbs_Shape BRep_Tool::MaxContinuity (const TopoDS_Edge& theEdge)
|
||||
{
|
||||
GeomAbs_Shape aMaxCont = GeomAbs_C0;
|
||||
for (BRep_ListIteratorOfListOfCurveRepresentation aReprIter ((*((Handle(BRep_TEdge)*)&theEdge.TShape()))->ChangeCurves());
|
||||
aReprIter.More(); aReprIter.Next())
|
||||
{
|
||||
const Handle(BRep_CurveRepresentation)& aRepr = aReprIter.Value();
|
||||
if (aRepr->IsRegularity())
|
||||
{
|
||||
const GeomAbs_Shape aCont = aRepr->Continuity();
|
||||
if ((Standard_Integer )aCont > (Standard_Integer )aMaxCont)
|
||||
{
|
||||
aMaxCont = aCont;
|
||||
}
|
||||
}
|
||||
}
|
||||
return aMaxCont;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Pnt
|
||||
//purpose : Returns the 3d point.
|
||||
|
@@ -242,9 +242,6 @@ public:
|
||||
//! Returns True if the edge has regularity on some
|
||||
//! two surfaces
|
||||
Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E);
|
||||
|
||||
//! Returns the max continuity of edge between some surfaces or GeomAbs_C0 if there no such surfaces.
|
||||
Standard_EXPORT static GeomAbs_Shape MaxContinuity (const TopoDS_Edge& theEdge);
|
||||
|
||||
//! Returns the 3d point.
|
||||
Standard_EXPORT static gp_Pnt Pnt (const TopoDS_Vertex& V);
|
||||
|
@@ -284,7 +284,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
return myWire.Closed();
|
||||
}
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic() const
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic222() const
|
||||
{
|
||||
return Standard_False;
|
||||
|
||||
|
@@ -113,7 +113,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -344,13 +344,13 @@ Standard_Boolean BRepAdaptor_Curve::IsClosed() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const
|
||||
Standard_Boolean BRepAdaptor_Curve::IsPeriodic222() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.IsPeriodic();
|
||||
return myCurve.IsPeriodic222();
|
||||
}
|
||||
else {
|
||||
return myConSurf->IsPeriodic();
|
||||
return myConSurf->IsPeriodic222();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -149,7 +149,7 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -145,11 +145,11 @@ public:
|
||||
|
||||
Standard_Boolean IsVClosed() const Standard_OVERRIDE;
|
||||
|
||||
Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
|
||||
Standard_Boolean IsUPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_Real UPeriod() const Standard_OVERRIDE;
|
||||
|
||||
Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
|
||||
Standard_Boolean IsVPeriodic222() const Standard_OVERRIDE;
|
||||
|
||||
Standard_Real VPeriod() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -121,9 +121,9 @@ inline Standard_Boolean BRepAdaptor_Surface::IsVClosed()const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsUPeriodic()const
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsUPeriodic222()const
|
||||
{
|
||||
return mySurf.IsUPeriodic();
|
||||
return mySurf.IsUPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -141,9 +141,9 @@ inline Standard_Real BRepAdaptor_Surface::UPeriod()const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsVPeriodic()const
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsVPeriodic222()const
|
||||
{
|
||||
return mySurf.IsVPeriodic();
|
||||
return mySurf.IsVPeriodic222();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -229,13 +229,13 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
|
||||
GeomAdaptor_Curve aGACurve(aCurve);
|
||||
GeomAbs_CurveType aType = aGACurve.GetType();
|
||||
Handle(Geom_Curve) aBasisCurve = aGACurve.Curve();
|
||||
Standard_Boolean isFwd = (wexp.Orientation() != TopAbs_REVERSED);
|
||||
|
||||
if (aBasisCurve->IsPeriodic()) {
|
||||
ElCLib::AdjustPeriodic
|
||||
(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
||||
Precision::PConfusion(), fpar, lpar);
|
||||
if (aGACurve.IsPeriodic222())
|
||||
{
|
||||
const Handle(Geom_Curve) &aBasisCurve = aGACurve.Curve();
|
||||
ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
||||
Precision::PConfusion(), fpar, lpar);
|
||||
}
|
||||
|
||||
if (CurveSeq.IsEmpty()) {
|
||||
@@ -353,9 +353,10 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
if (isSameCurve) {
|
||||
const Standard_Boolean isSameDir = (isFwd == IsFwdSeq.Last());
|
||||
|
||||
if (aBasisCurve->IsPeriodic()) {
|
||||
if (aGACurve.IsPeriodic222())
|
||||
{
|
||||
// Treat periodic curves.
|
||||
const Standard_Real aPeriod = aBasisCurve->Period();
|
||||
const Standard_Real aPeriod = aGACurve.Period();
|
||||
|
||||
if (isSameDir) {
|
||||
// Check if first parameter is greater then the last one.
|
||||
|
@@ -81,11 +81,11 @@ public:
|
||||
|
||||
static Standard_Boolean IsVClosed (const BRepAdaptor_Surface& S);
|
||||
|
||||
static Standard_Boolean IsUPeriodic (const BRepAdaptor_Surface& S);
|
||||
static Standard_Boolean IsUPeriodic333 (const BRepAdaptor_Surface& S);
|
||||
|
||||
static Standard_Real UPeriod (const BRepAdaptor_Surface& S);
|
||||
|
||||
static Standard_Boolean IsVPeriodic (const BRepAdaptor_Surface& S);
|
||||
static Standard_Boolean IsVPeriodic333 (const BRepAdaptor_Surface& S);
|
||||
|
||||
static Standard_Real VPeriod (const BRepAdaptor_Surface& S);
|
||||
|
||||
|
@@ -83,9 +83,9 @@ inline Standard_Boolean BRepApprox_SurfaceTool::IsVClosed(const BRepAdaptor_Surf
|
||||
return S.IsVClosed();
|
||||
}
|
||||
|
||||
inline Standard_Boolean BRepApprox_SurfaceTool::IsUPeriodic(const BRepAdaptor_Surface& S)
|
||||
inline Standard_Boolean BRepApprox_SurfaceTool::IsUPeriodic333(const BRepAdaptor_Surface& S)
|
||||
{
|
||||
return S.IsUPeriodic();
|
||||
return S.IsUPeriodic222();
|
||||
}
|
||||
|
||||
inline Standard_Real BRepApprox_SurfaceTool::UPeriod(const BRepAdaptor_Surface& S)
|
||||
@@ -93,9 +93,9 @@ inline Standard_Real BRepApprox_SurfaceTool::UPeriod(const BRepAdaptor_Surface&
|
||||
return S.UPeriod();
|
||||
}
|
||||
|
||||
inline Standard_Boolean BRepApprox_SurfaceTool::IsVPeriodic(const BRepAdaptor_Surface& S)
|
||||
inline Standard_Boolean BRepApprox_SurfaceTool::IsVPeriodic333(const BRepAdaptor_Surface& S)
|
||||
{
|
||||
return S.IsVPeriodic();
|
||||
return S.IsVPeriodic222();
|
||||
}
|
||||
|
||||
inline Standard_Real BRepApprox_SurfaceTool::VPeriod(const BRepAdaptor_Surface& S)
|
||||
|
@@ -71,8 +71,6 @@ public:
|
||||
|
||||
static Standard_Boolean IsClosed (const Handle(Adaptor2d_HCurve2d)& C);
|
||||
|
||||
static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
|
||||
|
||||
static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
|
||||
|
||||
//! Computes the point of parameter U on the curve.
|
||||
|
@@ -57,10 +57,6 @@ inline Standard_Boolean BRepBlend_HCurve2dTool::IsClosed(const Handle(Adaptor2d_
|
||||
return(C->IsClosed());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean BRepBlend_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->IsPeriodic());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real BRepBlend_HCurve2dTool::Period(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Period());
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
static Standard_Boolean IsClosed (const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C);
|
||||
static Standard_Boolean IsPeriodic666 (const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
|
@@ -57,8 +57,8 @@ inline Standard_Boolean BRepBlend_HCurveTool::IsClosed(const Handle(Adaptor3d_HC
|
||||
return(C->IsClosed());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean BRepBlend_HCurveTool::IsPeriodic(const Handle(Adaptor3d_HCurve)& C) {
|
||||
return(C->IsPeriodic());
|
||||
inline Standard_Boolean BRepBlend_HCurveTool::IsPeriodic666(const Handle(Adaptor3d_HCurve)& C) {
|
||||
return(C->IsPeriodic222());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real BRepBlend_HCurveTool::Period(const Handle(Adaptor3d_HCurve)& C) {
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <GeomLib.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#include <BndLib_Add2dCurve.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
@@ -47,6 +48,8 @@
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Extrema_ExtSS.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
//
|
||||
static Standard_Boolean CanUseEdges(const Adaptor3d_Surface& BS);
|
||||
//
|
||||
@@ -470,7 +473,6 @@ void FindExactUVBounds(const TopoDS_Face FF,
|
||||
umax = aBAS.LastUParameter();
|
||||
vmin = aBAS.FirstVParameter();
|
||||
vmax = aBAS.LastVParameter();
|
||||
Standard_Boolean isUperiodic = aBAS.IsUPeriodic(), isVperiodic = aBAS.IsVPeriodic();
|
||||
Standard_Real aT1, aT2;
|
||||
Standard_Real TolU = Max(aBAS.UResolution(Tol), Precision::PConfusion());
|
||||
Standard_Real TolV = Max(aBAS.VResolution(Tol), Precision::PConfusion());
|
||||
@@ -502,13 +504,13 @@ void FindExactUVBounds(const TopoDS_Face FF,
|
||||
aV /= Sqrt(magn);
|
||||
}
|
||||
Standard_Real u = aP.X(), v = aP.Y();
|
||||
if(isUperiodic)
|
||||
if (aBAS.IsUPeriodic222())
|
||||
{
|
||||
ElCLib::InPeriod(u, umin, umax);
|
||||
ElCLib::InPeriod(u, umin, umin + aBAS.UPeriod());
|
||||
}
|
||||
if(isVperiodic)
|
||||
if (aBAS.IsVPeriodic222())
|
||||
{
|
||||
ElCLib::InPeriod(v, vmin, vmax);
|
||||
ElCLib::InPeriod(v, vmin, vmin + aBAS.VPeriod());
|
||||
}
|
||||
//
|
||||
if(Abs(u - umin) <= TolU || Abs(u - umax) <= TolU)
|
||||
@@ -588,33 +590,33 @@ void FindExactUVBounds(const TopoDS_Face FF,
|
||||
Handle(Geom_Surface) aS = BRep_Tool::Surface(FF, aLoc);
|
||||
Standard_Real aUmin, aUmax, aVmin, aVmax;
|
||||
aS->Bounds(aUmin, aUmax, aVmin, aVmax);
|
||||
if(!aS->IsUPeriodic())
|
||||
if (!GeomLib::AllowExtendUParameter(aBAS.Surface(), umin, umax))
|
||||
{
|
||||
umin = Max(aUmin, umin);
|
||||
umax = Min(aUmax, umax);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(umax - umin > aS->UPeriod())
|
||||
const Standard_Real aDelta = (umax - umin - aBAS.UPeriod()) / 2.0;
|
||||
if (aBAS.IsUPeriodic222() && (aDelta > 0.0))
|
||||
{
|
||||
Standard_Real delta = umax - umin - aS->UPeriod();
|
||||
umin += delta/2.;
|
||||
umax -= delta/2;
|
||||
umin += aDelta;
|
||||
umax -= aDelta;
|
||||
}
|
||||
}
|
||||
//
|
||||
if(!aS->IsVPeriodic())
|
||||
if (!GeomLib::AllowExtendVParameter(aBAS.Surface(), vmin, vmax))
|
||||
{
|
||||
vmin = Max(aVmin, vmin);
|
||||
vmax = Min(aVmax, vmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vmax - vmin > aS->VPeriod())
|
||||
const Standard_Real aDelta = (vmax - vmin - aS->VPeriod()) / 2.0;
|
||||
if (aBAS.IsVPeriodic222() && (aDelta > 0.0))
|
||||
{
|
||||
Standard_Real delta = vmax - vmin - aS->VPeriod();
|
||||
vmin += delta/2.;
|
||||
vmax -= delta/2;
|
||||
vmin += aDelta;
|
||||
vmax -= aDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -414,10 +414,6 @@ static void ComputePCA(const TopoDS_Shape& theS,
|
||||
{
|
||||
BRepBndLib::Add(aST, aShapeBox);
|
||||
}
|
||||
if (aShapeBox.IsVoid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pnt aPMin = aShapeBox.CornerMin();
|
||||
gp_Pnt aPMax = aShapeBox.CornerMax();
|
||||
|
@@ -217,9 +217,9 @@ static Standard_Boolean IsClosedByIsos(const Handle(Geom_Surface)& thesurf,
|
||||
{
|
||||
Standard_Boolean isClosed = Standard_False;
|
||||
|
||||
gp_Pnt2d psurf1 = (acrv2d->IsPeriodic() ?
|
||||
gp_Pnt2d psurf1 = (acrv2d->IsPeriodic111() ?
|
||||
acrv2d->Value(f2d) : acrv2d->Value(Max(f2d,acrv2d->FirstParameter())));
|
||||
gp_Pnt2d psurf2 = (acrv2d->IsPeriodic() ?
|
||||
gp_Pnt2d psurf2 = (acrv2d->IsPeriodic111() ?
|
||||
acrv2d->Value(l2d) : acrv2d->Value(Min(l2d,acrv2d->LastParameter())));
|
||||
Handle(Geom_Curve) aCrv1;
|
||||
Handle(Geom_Curve) aCrv2;
|
||||
|
@@ -184,7 +184,7 @@ void BRepCheck_Edge::Minimum()
|
||||
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
|
||||
(myCref->Curve3D()->Transformed
|
||||
(/*myCref->Location()*/L.Transformation()));
|
||||
Standard_Boolean IsPeriodic = C3d->IsPeriodic();
|
||||
Standard_Boolean IsPeriodic = C3d->IsPeriodic111();
|
||||
Standard_Real aPeriod = RealLast();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
@@ -193,10 +193,12 @@ void BRepCheck_Edge::Minimum()
|
||||
Standard_Real f = C3d->FirstParameter(), l = C3d->LastParameter();
|
||||
if (C3d->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
|
||||
{
|
||||
// E.g. see "boolean bopfuse_complex J6" test script
|
||||
|
||||
const Handle(Geom_Curve)& aC = Handle(Geom_TrimmedCurve)::DownCast (C3d)->BasisCurve();
|
||||
f = aC->FirstParameter();
|
||||
l = aC->LastParameter();
|
||||
IsPeriodic = aC->IsPeriodic();
|
||||
IsPeriodic = aC->IsPeriodic111();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
aPeriod = aC->Period();
|
||||
@@ -224,7 +226,7 @@ void BRepCheck_Edge::Minimum()
|
||||
Sref = Handle(Geom_Surface)::DownCast
|
||||
(Sref->Transformed(myCref->Location().Transformation()));
|
||||
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
|
||||
Standard_Boolean IsPeriodic = PCref->IsPeriodic();
|
||||
Standard_Boolean IsPeriodic = PCref->IsPeriodic111();
|
||||
Standard_Real aPeriod = RealLast();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
@@ -233,10 +235,11 @@ void BRepCheck_Edge::Minimum()
|
||||
Standard_Real f = PCref->FirstParameter(), l = PCref->LastParameter();
|
||||
if (PCref->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
// E.g. see "boolean bopfuse_complex J6" test script
|
||||
const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (PCref)->BasisCurve();
|
||||
f = aC->FirstParameter();
|
||||
l = aC->LastParameter();
|
||||
IsPeriodic = aC->IsPeriodic();
|
||||
IsPeriodic = aC->IsPeriodic111();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
aPeriod = aC->Period();
|
||||
@@ -360,7 +363,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
// Modified by skv - Tue Apr 27 11:50:37 2004 End
|
||||
//
|
||||
const Handle(Geom2d_Curve)& pc = cr->PCurve();
|
||||
Standard_Boolean IsPeriodic = pc->IsPeriodic();
|
||||
Standard_Boolean IsPeriodic = pc->IsPeriodic111();
|
||||
Standard_Real aPeriod = RealLast();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
@@ -369,10 +372,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
Standard_Real fp = pc->FirstParameter(), lp = pc->LastParameter();
|
||||
if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
// E.g. see "boolean bopfuse_complex J6" test script
|
||||
|
||||
const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (pc)->BasisCurve();
|
||||
fp = aC->FirstParameter();
|
||||
lp = aC->LastParameter();
|
||||
IsPeriodic = aC->IsPeriodic();
|
||||
IsPeriodic = aC->IsPeriodic111();
|
||||
if(IsPeriodic)
|
||||
{
|
||||
aPeriod = aC->Period();
|
||||
|
@@ -997,7 +997,7 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
|
||||
//
|
||||
C1.Load(pcu);
|
||||
// To avoid exeption in Segment if C1 is BSpline - IFV
|
||||
if(!C1.IsPeriodic()) {
|
||||
if(!C1.IsPeriodic222()) {
|
||||
if(C1.FirstParameter() > first1) {
|
||||
first1 = C1.FirstParameter();
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
|
||||
if (!tabCur(j).IsNull() && last2 > first2) {
|
||||
C2.Load(tabCur(j));
|
||||
// To avoid exeption in Segment if C2 is BSpline - IFV
|
||||
if(!C2.IsPeriodic()) {
|
||||
if(!C2.IsPeriodic222()) {
|
||||
if(C2.FirstParameter() > first2) {
|
||||
first2 = C2.FirstParameter();
|
||||
}
|
||||
|
@@ -142,13 +142,6 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
}
|
||||
|
||||
IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin);
|
||||
// temporary periodic domain
|
||||
if (C.Curve()->IsPeriodic()) {
|
||||
DE.SetEquivalentParameters(C.FirstParameter(),
|
||||
C.FirstParameter() +
|
||||
C.Curve()->LastParameter() -
|
||||
C.Curve()->FirstParameter());
|
||||
}
|
||||
|
||||
Handle(Geom2d_Line) GL= new Geom2d_Line(L);
|
||||
Geom2dAdaptor_Curve CGA(GL);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user