1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

35 Commits

Author SHA1 Message Date
nds
87e7c67105 0032077: Visualization - setting custom default frame buffer object for OpenGl context 2021-01-22 17:47:30 +03:00
sshutina
4fd4c96c2f 0032068: Inspectors - Last command don't have the time value 2021-01-19 19:17:54 +03:00
sshutina
cb3bf16180 0031959: Inspectors - Statistics by name 2021-01-14 09:41:08 +03:00
mpv
d511b727e3 0031921: Application Framework - reading OCAF data from several threads is not possible
Make myLastFoundChild field of TDF_LabelNode that can be changed during accessing to different sub-labels in different threads as atomic (only for newer versions of compilers which support this "atomic").

Added definition of Standard_ATOMIC macro to the Standard_Macro.hxx

(cherry picked from commit e80a307718)
2021-01-14 00:07:18 +03:00
age
724fe4d711 0031987: Visualization - Slow rectangular selection on models with big number of sensitives
(cherry picked from commit 726a195668)
2021-01-14 00:06:30 +03:00
age
d79a0af187 0030737: Visualization - implementing new selection schemes in context
Improved AIS_SelectionScheme_ReplaceExtra scheme (now is a part of AIS_SelectionScheme_Replace)
Replaced AIS_NListOfEntityOwner with AIS_NArray1OfEntityOwner
Fixed bug with incorrect highlighting in xor mode (select several times the same objects)
Fixed selections filters
Cherry picked a new highlighting logic from 75cf82505b
2020-12-22 14:52:46 +03:00
nds
b157d88ccb 0030737: Visualization - implementing new selection schemes in context
AIS_SelectionScheme_ReplaceExtra introduce
2020-12-22 13:45:15 +03:00
nds
318bf93ea9 0030737: Visualization - implementing new selection schemes in context
AIS_SelectionScheme enumeration is defined to set which selection behaviour is used in Select of context
AIS_InteractiveContext is corrected to use single Select method instead of combination of Select/ShiftSelect methods with a selection scheme parameter.
Upgrade: Select() -> SelectDetected/Rectangle/Polygon(AIS_SelectionScheme_Replace), ShiftSelect -> SelectDetected/Rectangle/Polygon(AIS_SelectionScheme_XOR)
2020-12-22 13:45:02 +03:00
age
8fa465a463 Revert "0030737: Visualization - implementing new selection schemes in context"
This reverts commit 502194e4fc.
2020-12-22 13:43:01 +03:00
nds
b34d24534d 0031350: Inspectors - property view in DFBrowser for DumpJson
(cherry picked from commit 19b5d8465313c119c9d2f344041e67883226ec61)
2020-11-19 10:03:40 +03:00
nds
dee527369c 0031945: Foundation Classes - unique names of alerts of message report in DumpJson 2020-11-19 10:03:27 +03:00
nds
1bd8dfa582 0031944: Foundation Classes - mutex for message level
(cherry picked from commit 0f07a04a85dedd375a5383f3cb0031c0a6d6b329)
2020-11-19 10:03:18 +03:00
nds
a463065302 0031362: Inspectors - MessageView plugin for message alerts
- OSD_Timer in message alert,
- DumpJson correction,
- Selection owner should be dumped in selector. Sensitive entities might be used in the same owner, that leads to lots of the same dump in the result stream.

(cherry picked from commit e8bde810616e61cbe925981176681f2840234fa4)
2020-11-19 10:02:34 +03:00
age
50013cf4a3 0031757: Visualization - Prebuild BVH for Select3D_SensitiveEntity in separate threads 2020-09-17 11:43:55 +03:00
age
808868370b 0031716: Visualization, Select3D_SensitiveSet::matches() - avoid building BVH in case of full overlapping by the volume 2020-09-17 11:43:55 +03:00
kgv
e91225a089 0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with Graphic3d_TOSM_UNLIT shading model
Prs3d_ShadingAspect::SetTransparency() now sets transparency also to interior color.
AIS_RubberBand now uses Graphic3d_TOSM_UNLIT.

(cherry picked from commit cc07d3180c48e31308d71c3f3b0108e1026fd4ca)
2020-07-23 00:45:47 +03:00
nds
9804a28dd2 0031678: Visualization - text color becomes lighter than in 7.3.0
(cherry picked from commit 1855383438db33933106aa5848ac00569731a407)
2020-07-21 18:24:20 +03:00
nds
b51929ad8f 0029451: Information Message Alert to debug an algorithm or object functionality 2020-06-21 12:42:42 +03:00
nds
b96cd2e422 0031579: Visualization - OpenGl_CappingAlgo performance on some clipping planes
(cherry picked from commit 61d75276ea924e0fd22de0a2a927bce1d554de99)
2020-06-03 11:09:52 +03:00
nds
0fcf0a687b 0029451: Information Message Alert to debug an algorithm or object functionality 2020-05-26 19:14:16 +03:00
snn
3613704c7a 0030988: Add possibility to attach multiple files to notes
- Swap child/father in RemoveFromGroup method of NotesTool.

(cherry picked from commit 7c0ec2e214)
2020-05-16 12:11:33 +03:00
nds
8ec5b8fd57 0029451: Information Message Alert to debug an algorithm or object functionality 2020-05-16 12:10:08 +03:00
nds
b4a5214bd2 0031326: Foundation Classes - Init from Json for base OCCT classes
(cherry picked from commit 39f197676cb85d2b84ad0ff15266eed118cbbaff)
(cherry picked from commit 4a5e30db5bbdfc7a77a03d1e55e8a3bee5d79d2d)
2020-05-15 21:52:15 +03:00
sshutina
9358c97d65 0031354: Visualization - Dump improvement for V3d, Graphic3d, Aspect
(cherry picked from commit 0a9f129d67748f59a40e7758d271e87ae4d535de)

# Conflicts:
#	src/Graphic3d/Graphic3d_CView.cxx
#	src/Graphic3d/Graphic3d_WorldViewProjState.hxx
#	src/SelectMgr/SelectMgr_TriangularFrustumSet.cxx
#	src/SelectMgr/SelectMgr_TriangularFrustumSet.hxx
2020-05-15 21:51:35 +03:00
nds
ada40fab8f 0030784: Visualization - check if selectable of owner in internal container in AIS_InteractiveContext before using
(cherry picked from commit 707e554dba56681d110b164cb4ea8b47723e7007)
2020-05-15 21:47:43 +03:00
nds
974ff986e1 0031221: Visualization - selection filter in context
(cherry picked from commit 0ef1e0394c44f7cb1753634f53e6ef0e8cda86ad)

# Conflicts:
#	src/AIS/AIS_InteractiveContext_1.cxx
(cherry picked from commit 53bbb3d99268d9aa89affe051ff82b51539a9946)
2020-05-15 21:47:30 +03:00
nds
35536f899d 0031197: Visualization - SetTransformPersistence for highlight, select presentations
(cherry picked from commit df3644aa35)
(cherry picked from commit 33ffefa2f7)
(cherry picked from commit 59433e7b4e49362dc1741dc00178ccec64c6cc5d)
2020-05-15 21:46:31 +03:00
nds
1a716308ea 0030791: Visualization - possibility to display materials by different hatching style for clipping
(cherry picked from commit ab39c2510fa4c9a568deb226cca37fe22c3162c4)

# Conflicts:
#	src/ViewerTest/ViewerTest_ViewerCommands.cxx
2020-05-15 21:46:09 +03:00
nds
8758ba290f 0030537: Visualization - wrapping text in font text formatter
Font_TextFormatter inherits Standard_Transient, now it is given as a handle in functions.
Graphic3d_Text - extended with Font_TextFormatter to be able to have it filled out of text render. If it is not defined here, the default text formatter of context is used.
OpenGl_Context - has default Font_TextFormatter for rendering OpenGl_Text.
2020-05-15 21:42:53 +03:00
nds
86ba800ae8 0030737: Visualization - implementing new selection schemes in context
(cherry picked from commit 8ac88685123f50caef2b53010da626b4682d9bd4)
2020-05-15 21:41:29 +03:00
snn
0a63642bc5 0030988: Add possibility to attach multiple files to notes
Implemented

(cherry picked from commit 9640291ff0)

# Conflicts:
#	src/XCAFDoc/XCAFDoc_AssemblyItemId.cxx
#	src/XCAFDoc/XCAFDoc_NoteBinData.cxx
#	src/XCAFDoc/XCAFDoc_NoteComment.cxx
#	src/XCAFDoc/XCAFDoc_NotesTool.cxx
#	src/XmlMXCAFDoc/XmlMXCAFDoc.cxx
(cherry picked from commit c5d24136ed56ae680dae4f544399a94998ee0962)
2020-05-15 21:37:14 +03:00
snn
57caa76519 0030392: XCAFDoc_GraphNode doesn't copy backward links
(cherry picked from commit 6131065fae)
(cherry picked from commit 713624228050b8f7db4d8b2e22c7edfd8c832471)
(cherry picked from commit b7fb7db6ae)
(cherry picked from commit 68be9e7b9c)
(cherry picked from commit 6bc54a6b6fc335b802959d612f0ed4edbb5d5c33)
2020-05-15 21:36:30 +03:00
nds
c7b1056827 refs 474:Possibility to create and play animations 2020-05-15 21:35:46 +03:00
nds
a7d082c424 refs #355: Add possibility to hide clipping plane
(cherry picked from commit ca1f82f6c6860a2e1995d7d9a66ce8c152e9d3cc)
(cherry picked from commit 61f39b4dc7)
(cherry picked from commit 7b08ab936a5f6091651fc0311c5c255bd0dc9cb0)

# Conflicts:
#	src/XCAFDoc/XCAFDoc.hxx
(cherry picked from commit 72e4a10556)
(cherry picked from commit 37d575793d)
(cherry picked from commit 6964d28a314f847255d1d1cb015dcbd68b3ec1aa)
2020-05-15 21:33:50 +03:00
nds
e6a3685503 XCAFDoc/View fixes to store in the view: image, parts transparency, notes, notes positions 2020-05-15 21:32:25 +03:00
467 changed files with 20114 additions and 4511 deletions

View File

@@ -1,4 +1,4 @@
TModelingData TKShapeView
TModelingData TKShapeView TKMessageModel TKMessageView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
data/images/hatch_1_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

BIN
data/images/hatch_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

BIN
data/images/hatch_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

BIN
data/images/hatch_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

BIN
data/images/hatch_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

BIN
data/images/hatch_6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

BIN
data/images/hatch_7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

BIN
data/images/hatch_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#3D3ACF"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#DDDDDD"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#DDDDDD"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#3D3ACF"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,27 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -830,10 +830,8 @@ myContext->MoveTo (thePixelX, thePixelY, myView, true);
Dynamic detection and selection are put into effect in a straightforward way. There are only a few conventions and functions to be familiar with:
* *AIS_InteractiveContext::MoveTo* -- passes mouse position to Interactive Context selectors.
* *AIS_InteractiveContext::Select* -- stores what has been detected at the last *MoveTo*. Replaces the previously selected object. Empties the stack if nothing has been detected at the last move.
* *AIS_InteractiveContext::ShiftSelect* -- if the object detected at the last move was not already selected, it is added to the list of the selected objects. If not, it is withdrawn. Nothing happens if you click on an empty area.
* *AIS_InteractiveContext::Select* -- selects everything found in the surrounding area.
* *AIS_InteractiveContext::ShiftSelect* -- selects what was not previously in the list of selected, deselects those already present.
* *AIS_InteractiveContext::SelectDetected* -- stores what has been detected at the last *MoveTo*. Changes the previously selected object. Depending on the selection scheme, the selection is enriched, replaced or other.
* *AIS_InteractiveContext::SelectPoint/SelectRectangle/SelectPolygon* -- Applies selection to point, rectangular or surrounding area. Changes the previously selected object. Depending on the selection scheme, the selection is enriched, replaced or other.
Highlighting of detected and selected entities is automatically managed by the Interactive Context. The Highlight colors are those dealt with above. You can nonetheless disconnect this automatic mode if you want to manage this part yourself:
~~~~~
@@ -870,6 +868,17 @@ for (myAISCtx->InitSelected(); myAISCtx->MoreSelected(); myAISCtx->NextSelected(
}
~~~~~
@subsubsection occt_visu_3_4_7 Selection schemes
Select* methods of AIS_InteractiveContext accept some selection scheme as parameter. The table below describes available selection schemes.
| Type | Reaction on click | | Type | Reaction on click |
| :----- | :----- | :----- | :----- | :----- |
| AIS_SelectionScheme_Replace | @figure{visualization_selection_scheme_replace.svg, ""} | | AIS_SelectionScheme_XOR | @figure{visualization_selection_scheme_XOR.svg, ""} |
| AIS_SelectionScheme_Add | @figure{visualization_selection_scheme_add.svg, ""} | | AIS_SelectionScheme_Clear | @figure{visualization_selection_scheme_clear.svg, ""} |
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | AIS_SelectionScheme_ReplaceExtra | @figure{visualization_selection_scheme_replaceExtra.svg, ""} |
@subsection occt_visu_3_5 Standard Interactive Object Classes
Interactive Objects are selectable and viewable objects connecting graphic representation and the underlying reference geometry.
@@ -1410,7 +1419,7 @@ aView->Update();
@subsubsection occt_visu_4_4_5 Perspective Projection
**Field of view (FOVy)** -- defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
**Field of view (FOVy)** -- defines the field of camera view by y axis in degrees (45° is default).
@figure{camera_perspective.png,"Perspective frustum",420}
@@ -1432,7 +1441,7 @@ There are two types of IOD:
* _Graphic3d_Camera::IODType_Absolute_ : Intraocular distance is defined as an absolute value.
* _Graphic3d_Camera::IODType_Relative_ : Intraocular distance is defined relative to the camera focal length (as its coefficient).
**Field of view (FOV)** -- defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
**Field of view (FOV)** -- defines the field of camera view by y axis in degrees (45° is default).
**ZFocus** -- defines the distance to the point of stereographic focus.

View File

@@ -245,7 +245,10 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->Select (theX1, theY1, theX2, theY2, myView(), Standard_True);
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView());
myAISContext()->UpdateCurrentViewer();
}
}
@@ -256,7 +259,8 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->Select (Standard_True);
myAISContext()->SelectDetected();
myAISContext()->UpdateCurrentViewer();
}
}
@@ -278,7 +282,11 @@ public:
{
if ((!myAISContext().IsNull()) && (!myView().IsNull()))
{
myAISContext()->ShiftSelect (theX1, theY1, theX2, theY2, myView(), Standard_True);
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView(),
AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
}
}
@@ -289,7 +297,8 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->ShiftSelect (Standard_True);
myAISContext()->SelectDetected (AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
}
}

View File

@@ -262,7 +262,10 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->Select (theX1, theY1, theX2, theY2, myView(), Standard_True);
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView());
myAISContext()->UpdateCurrentViewer();
}
}
@@ -273,7 +276,8 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->Select (Standard_True);
myAISContext()->SelectDetected();
myAISContext()->UpdateCurrentViewer();
}
}
@@ -295,7 +299,11 @@ public:
{
if (!myAISContext().IsNull() && !myView().IsNull())
{
myAISContext()->ShiftSelect (theX1, theY1, theX2, theY2, myView(), Standard_True);
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView(),
AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
}
}
@@ -306,7 +314,8 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->ShiftSelect (Standard_True);
myAISContext()->SelectDetected (AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
}
}

View File

@@ -244,7 +244,8 @@ void CGeometryDoc::InputEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/,
const Handle(V3d_View)& /*aView*/)
{
myAISContext2D->Select(Standard_True);
myAISContext2D->SelectDetected();
myAISContext2D->UpdateCurrentViewer();
}
//-----------------------------------------------------------------------------------------
@@ -352,7 +353,8 @@ void CGeometryDoc::InputEvent (const Standard_Integer /*theMouseX*/,
const Standard_Integer /*theMouseY*/,
const Handle(V3d_View)& /*theView*/)
{
myAISContext->Select (Standard_True);
myAISContext->SelectDetected();
myAISContext2D->UpdateCurrentViewer();
}
//-----------------------------------------------------------------------------------------

View File

@@ -4816,7 +4816,9 @@ void CModelingDoc::InputEvent(const Standard_Integer /*x*/,
const Standard_Integer /*y*/,
const Handle(V3d_View)& /*aView*/)
{
myAISContext->Select (Standard_True);
myAISContext->SelectDetected();
myAISContext->UpdateCurrentViewer();
if (myState == SELECT_EDGE_PLATE_TGTES_1) {
myAISContext->InitSelected();
if (myAISContext->MoreSelected()) {

View File

@@ -506,7 +506,7 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/,
Quantity_Color CSFColor;
COLORREF MSColor;
myAISContext->Select (Standard_True);
myAISContext->SelectDetected();
// Change the color of a selected face in a user cylinder
if (myState == FACE_COLOR)

View File

@@ -328,7 +328,9 @@ void CHLRView3D::DragEvent(const Standard_Integer x ,
}
if (TheState == 0)
GetDocument()->GetAISContext()->Select(theButtonDownX,theButtonDownY,x,y,myView);
GetDocument()->GetAISContext()->SelectRectangle(Graphic3d_Vec2i (theButtonDownX,theButtonDownY),
Graphic3d_Vec2i (x,y),
myView);
}
//-----------------------------------------------------------------------------------------
@@ -337,7 +339,7 @@ void CHLRView3D::DragEvent(const Standard_Integer x ,
void CHLRView3D::InputEvent(const Standard_Integer x ,
const Standard_Integer y )
{
GetDocument()->GetAISContext()->Select();
GetDocument()->GetAISContext()->SelectDetected();
}
//-----------------------------------------------------------------------------------------
@@ -375,7 +377,10 @@ void CHLRView3D::MultiDragEvent(const Standard_Integer x ,
}
if (TheState == 0)
GetDocument()->GetAISContext()->ShiftSelect(theButtonDownX,theButtonDownY,x,y,myView);
GetDocument()->GetAISContext()->SelectRectangle(Graphic3d_Vec2i (theButtonDownX,theButtonDownY),
Graphic3d_Vec2i (x,y),
myView,
AIS_SelectionScheme_XOR);
}
@@ -385,6 +390,6 @@ void CHLRView3D::MultiDragEvent(const Standard_Integer x ,
void CHLRView3D::MultiInputEvent(const Standard_Integer x ,
const Standard_Integer y )
{
GetDocument()->GetAISContext()->ShiftSelect();
GetDocument()->GetAISContext()->SelectDetected(AIS_SelectionScheme_XOR);
}

View File

@@ -111,9 +111,10 @@ void OCC_3dBaseDoc::DragEvent (const Standard_Integer theMouseX,
}
case 1:
{
myAISContext->Select (aStartDragX, aStartDragY,
theMouseX, theMouseY,
theView, Standard_True);
myAISContext->SelectRectangle (Graphic3d_Vec2i (aStartDragX, aStartDragY),
Graphic3d_Vec2i (theMouseX, theMouseY),
theView);
myAISContext->UpdateCurrentViewer();
break;
}
};
@@ -127,7 +128,8 @@ void OCC_3dBaseDoc::InputEvent (const Standard_Integer theMouseX,
const Handle(V3d_View)& theView)
{
myAISContext->MoveTo (theMouseX, theMouseY, theView, Standard_False);
myAISContext->Select (Standard_True);
myAISContext->SelectDetected();
myAISContext->UpdateCurrentViewer();
}
//-----------------------------------------------------------------------------------------
@@ -175,9 +177,10 @@ void OCC_3dBaseDoc::ShiftDragEvent (const Standard_Integer theMouseX,
if (theState == 0)
{
// button up
myAISContext->ShiftSelect (aStartDragX, aStartDragY,
theMouseX, theMouseY,
theView, Standard_True);
myAISContext->SelectRectangle (Graphic3d_Vec2i (aStartDragX, aStartDragY),
Graphic3d_Vec2i (theMouseX, theMouseY),
theView, AIS_SelectionScheme_XOR);
myAISContext->UpdateCurrentViewer();
}
}
@@ -188,7 +191,8 @@ void OCC_3dBaseDoc::ShiftInputEvent (const Standard_Integer /*theMouseX*/,
const Standard_Integer /*theMouseY*/,
const Handle(V3d_View)& /*theView*/)
{
myAISContext->ShiftSelect (Standard_True);
myAISContext->SelectDetected (AIS_SelectionScheme_XOR);
myAISContext->UpdateCurrentViewer();
}
//-----------------------------------------------------------------------------------------

View File

@@ -637,6 +637,11 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
{
aShadedGroup = thePrs->NewGroup();
aShadedGroup->SetClosed (isClosed);
if (isClosed)
{
if (aDrawer->HasOwnFillCappingAspect())
aShadedGroup->SetGroupPrimitivesAspect (aDrawer->FillCappingAspect());
}
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
aShadedGroup->AddPrimitiveArray (aTriangles);

View File

@@ -39,6 +39,8 @@
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <Quantity_Color.hxx>
#include <SelectMgr_AndFilter.hxx>
#include <SelectMgr_DisabledObjectsFilter.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_OrFilter.hxx>
@@ -128,7 +130,7 @@ myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
myFilters(new SelectMgr_AndFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myCurDetected(0),
myCurHighlighted(0),
@@ -136,6 +138,8 @@ myPickingStrategy (SelectMgr_PickingStrategy_FirstAcceptable),
myAutoHilight(Standard_True),
myIsAutoActivateSelMode(Standard_True)
{
myFilters->Add (new SelectMgr_DisabledObjectsFilter());
mgrSelector = new SelectMgr_SelectionManager (myMainSel);
myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
@@ -2405,6 +2409,15 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
theObject->SetTransformPersistence (theTrsfPers);
UpdateOnTransformPersistence (theObject);
}
//=======================================================================
//function : UpdateOnTransformPersistence
//purpose :
//=======================================================================
void AIS_InteractiveContext::UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theObject)
{
if (!myObjects.IsBound (theObject))
{
return;

View File

@@ -25,10 +25,12 @@
#include <AIS_ListOfInteractive.hxx>
#include <AIS_Selection.hxx>
#include <AIS_SelectionModesConcurrency.hxx>
#include <AIS_SelectionScheme.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
#include <AIS_TypeOfIso.hxx>
#include <Aspect_TypeOfFacingModel.hxx>
#include <Graphic3d_Vec2.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHighlight.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
@@ -46,7 +48,7 @@
class SelectMgr_SelectionManager;
class V3d_Viewer;
class SelectMgr_OrFilter;
class SelectMgr_AndFilter;
class V3d_View;
class TopLoc_Location;
class TCollection_ExtendedString;
@@ -344,6 +346,11 @@ public: //! @name object local transformation management
Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
const Handle(Graphic3d_TransformPers)& theTrsfPers);
//! Updates displayed interactive object by checking and recomputing its flagged as "to be recomputed" presentation and selection structures.
//! This method does not force any recomputation on its own.
//! The method recomputes selections even if they are loaded without activation in particular selector.
Standard_EXPORT void UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theIObj);
Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
const Graphic3d_TransModeFlags& theFlag,
@@ -470,8 +477,49 @@ public: //! @name Selection management
return AddSelect (theObject->GlobalSelOwner());
}
//! Selects objects within the bounding rectangle.
//! Viewer should be explicitly redrawn after selection.
//! @param thePntMin [in] rectangle lower point (in pixels)
//! @param thePntMax [in] rectangle upper point (in pixels)
//! @param theView [in] active view where rectangle is defined
//! @param theSelScheme [in] selection scheme
//! @return picking status
//! @sa StdSelect_ViewerSelector3d::AllowOverlapDetection()
Standard_EXPORT AIS_StatusOfPick SelectRectangle (const Graphic3d_Vec2i& thePntMin,
const Graphic3d_Vec2i& thePntMax,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
//! Select everything found in the polygon defined by bounding polyline.
//! Viewer should be explicitly redrawn after selection.
//! @param thePolyline [in] polyline defining polygon bounds (in pixels)
//! @param theView [in] active view where polyline is defined
//! @param theSelScheme [in] selection scheme
//! @return picking status
Standard_EXPORT AIS_StatusOfPick SelectPolygon (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
//! Selects the topmost object picked by the point in the view,
//! Viewer should be explicitly redrawn after selection.
//! @param thePnt [in] point pixel coordinates within the view
//! @param theView [in] active view where point is defined
//! @param theSelScheme [in] selection scheme
//! @return picking status
Standard_EXPORT AIS_StatusOfPick SelectPoint (const Graphic3d_Vec2i& thePnt,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
//! Select and hilights the previous detected via AIS_InteractiveContext::MoveTo() method;
//! unhilights the previous picked.
//! Viewer should be explicitly redrawn after selection.
//! @param theSelScheme [in] selection scheme
//! @return picking status
Standard_EXPORT AIS_StatusOfPick SelectDetected (const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
//! The objects detected are passed to the main viewer, which is then updated.
Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking AIS_SelectionScheme_Replace should be called instead")
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
@@ -480,27 +528,32 @@ public: //! @name Selection management
const Standard_Boolean theToUpdateViewer);
//! polyline selection; clears the previous picked list
Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking AIS_SelectionScheme_Replace should be called instead")
Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer);
//! Stores and hilights the previous detected; Unhilights the previous picked.
//! @sa MoveTo().
Standard_DEPRECATED("This method is deprecated - SelectDetected() taking AIS_SelectionScheme_Replace should be called instead")
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
//! Adds the last detected to the list of previous picked.
//! If the last detected was already declared as picked, removes it from the Picked List.
//! @sa MoveTo().
Standard_DEPRECATED("This method is deprecated - SelectDetected() taking AIS_SelectionScheme_XOR should be called instead")
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
//! Adds the last detected to the list of previous picked.
//! If the last detected was already declared as picked, removes it from the Picked List.
Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking AIS_SelectionScheme_XOR should be called instead")
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer);
//! Rectangle of selection; adds new detected entities into the picked list,
//! removes the detected entities that were already stored.
Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking AIS_SelectionScheme_XOR should be called instead")
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
@@ -511,6 +564,13 @@ public: //! @name Selection management
//! Returns bounding box of selected objects.
Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
//! Sets list of owner selected/deselected using specified selection scheme.
//! @param theOwners owners to change selection state
//! @param theSelScheme selection scheme
//! @return picking status
Standard_EXPORT AIS_StatusOfPick Select (const AIS_NArray1OfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme);
//! Fits the view correspondingly to the bounds of selected objects.
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
@@ -736,13 +796,20 @@ public: //! @name management of active Selection Modes
public: //! @name Selection Filters management
//! Returns the list of filters active in a local context.
Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
//! Allows you to set the filter.
Standard_EXPORT void SetFilter (const Handle(SelectMgr_Filter)& theFilter);
//! Allows you to add the filter.
//! Returns the filter. Use with global is in false to get the filter, that is set with SetFilter.
//! If global filter is true, it returns whole filter used in the context (with an internal default filter)
Standard_EXPORT Handle(SelectMgr_Filter) Filter (const Standard_Boolean isGlobalFilter = Standard_False) const;
//! Returns the list of filters active in a local context.
Standard_EXPORT SelectMgr_ListOfFilter Filters() const;
//! Allows you to add the filter. Default filter here is Or filter.
Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& theFilter);
//! Removes a filter from context.
//! Removes a filter from context. Default filter here is Or filter
Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& theFilter);
//! Remove all filters from context.
@@ -1361,7 +1428,7 @@ protected: //! @name internal fields
Handle(SelectMgr_EntityOwner) myLastPicked;
Standard_Boolean myToHilightSelected;
Handle(AIS_Selection) mySelection;
Handle(SelectMgr_OrFilter) myFilters;
Handle(SelectMgr_AndFilter) myFilters;
Handle(Prs3d_Drawer) myDefaultDrawer;
Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
TColStd_SequenceOfInteger myDetectedSeq;

View File

@@ -31,8 +31,11 @@
#include <Prs3d_Presentation.hxx>
#include <Quantity_Color.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectMgr_AndFilter.hxx>
#include <SelectMgr_DisabledObjectsFilter.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_FilterReaction.hxx>
#include <SelectMgr_OrFilter.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SelectionManager.hxx>
@@ -123,7 +126,12 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
return;
}
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, theDispMode);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theObj);
if (!aStatusPtr)
{
return;
}
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, (*aStatusPtr)->DisplayMode());
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
if (aGlobOwner.IsNull())
@@ -172,20 +180,16 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_GlobalStatus) aStatus;
if (!myObjects.Find (anInteractive, aStatus))
{
continue;
}
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
if (anOwner->IsAutoHilight())
{
anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
if (aStatus->IsSubIntensityOn())
if (aStatusPtr && (*aStatusPtr)->IsSubIntensityOn())
{
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
}
}
@@ -194,10 +198,11 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
{
anObjToClear.Add (anInteractive);
}
if (anOwner == anInteractive->GlobalSelOwner())
if (aStatusPtr && anOwner == anInteractive->GlobalSelOwner())
{
aStatus->SetHilightStatus (Standard_False);
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
(*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
{
@@ -335,7 +340,8 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
Handle(SelectMgr_DisabledObjectsFilter) anObjectsFilter = Handle(SelectMgr_DisabledObjectsFilter)::DownCast (myFilters->StoredFilters().First());
anObjectsFilter->SetDisabledObjects (theView->View()->HiddenObjects());
myMainSel->Pick (theXPix, theYPix, theView);
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
@@ -347,7 +353,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
{
Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aDetIter);
if (anOwner.IsNull()
|| !myFilters->IsOk (anOwner))
|| !myFilters->IsOk (anOwner, SelectMgr_FilterReaction_Highlight))
{
if (myPickingStrategy == SelectMgr_PickingStrategy_OnlyTopmost)
{
@@ -482,95 +488,100 @@ AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(SelectMgr_Entit
}
//=======================================================================
//function : Select
//purpose :
//function : SelectRectangle
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::SelectRectangle (const Graphic3d_Vec2i& thePntMin,
const Graphic3d_Vec2i& thePntMax,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
throw Standard_ProgramError ("AIS_InteractiveContext::SelectRectangle() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
myLastActiveView = theView.get();
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner)& aCurOwner = myMainSel->Picked (aPickIter);
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
continue;
myMainSel->Pick (thePntMin.x(), thePntMin.y(), thePntMax.x(), thePntMax.y(), theView);
mySelection->Select (aCurOwner);
AIS_NArray1OfEntityOwner aPickedOwners;
if (myMainSel->NbPicked() > 0)
{
aPickedOwners.Resize (1, myMainSel->NbPicked(), Standard_False);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aPickedOwners.ChangeValue (aPickIter) = myMainSel->Picked (aPickIter);
}
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : Select
//purpose : Selection by polyline
//function : SelectPolygon
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::SelectPolygon (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
throw Standard_ProgramError ("AIS_InteractiveContext::SelectPolygon() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
myLastActiveView = theView.get();
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
mySelection->Select (anOwner);
AIS_NArray1OfEntityOwner aPickedOwners;
if (myMainSel->NbPicked() > 0)
{
aPickedOwners.Resize (1, myMainSel->NbPicked(), Standard_False);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aPickedOwners.ChangeValue (aPickIter) = myMainSel->Picked (aPickIter);
}
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : Select
//purpose :
//function : SelectPoint
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::SelectPoint (const Graphic3d_Vec2i& thePnt,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme)
{
if (!myLastPicked.IsNull())
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::SelectPoint() - invalid argument");
}
myLastActiveView = theView.get();
myMainSel->Pick (thePnt.x(), thePnt.y(), theView);
AIS_NArray1OfEntityOwner aPickedOwners;
if (myMainSel->NbPicked() > 0)
{
aPickedOwners.Resize (1, myMainSel->NbPicked(), Standard_False);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aPickedOwners.ChangeValue (aPickIter) = myMainSel->Picked (aPickIter);
}
}
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : SelectDetected
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::SelectDetected (const AIS_SelectionScheme theSelScheme)
{
if (theSelScheme == AIS_SelectionScheme_Replace && !myLastPicked.IsNull())
{
Graphic3d_Vec2i aMousePos (-1, -1);
if (myMainSel->GetManager().GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point)
@@ -582,54 +593,76 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
{
return AIS_SOP_NothingSelected;
}
if (myAutoHilight)
{
clearDynamicHighlight();
}
if (!myLastPicked->IsSelected()
|| myLastPicked->IsForcedHilight()
|| NbSelected() > 1)
{
SetSelected (myLastPicked, Standard_False);
if(toUpdateViewer)
{
UpdateCurrentViewer();
}
}
}
else
AIS_NArray1OfEntityOwner aPickedOwners(1, 1);
aPickedOwners.ChangeValue (1) = myLastPicked;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer)
{
AIS_StatusOfPick aStatus = SelectRectangle (Graphic3d_Vec2i (theXPMin, theYPMin),
Graphic3d_Vec2i (theXPMax, theYPMax),
theView);
if (theToUpdateViewer)
{
ClearSelected (toUpdateViewer);
UpdateCurrentViewer();
}
return aStatus;
}
Standard_Integer aSelNum = NbSelected();
//=======================================================================
//function : Select
//purpose : Selection by polyline
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer)
{
AIS_StatusOfPick aStatus = SelectPolygon (thePolyline, theView);
if (theToUpdateViewer)
{
UpdateCurrentViewer();
}
return aStatus;
}
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean theToUpdateViewer)
{
AIS_StatusOfPick aStatus = SelectDetected();
if (theToUpdateViewer)
{
UpdateCurrentViewer();
}
return aStatus;
}
//=======================================================================
//function : ShiftSelect
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean theToUpdateViewer)
{
if (myAutoHilight)
AIS_StatusOfPick aStatus = SelectDetected (AIS_SelectionScheme_XOR);
if (theToUpdateViewer)
{
clearDynamicHighlight();
UpdateCurrentViewer();
}
if (!myLastPicked.IsNull())
{
AddOrRemoveSelected (myLastPicked, toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return aStatus;
}
//=======================================================================
@@ -641,39 +674,17 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const Standard_Boolean theToUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
AIS_StatusOfPick aStatus = SelectRectangle (Graphic3d_Vec2i (theXPMin, theYPMin),
Graphic3d_Vec2i (theXPMax, theYPMax),
theView,
AIS_SelectionScheme_XOR);
if (theToUpdateViewer)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
UpdateCurrentViewer();
}
myLastActiveView = theView.get();
if (myAutoHilight)
{
UnhilightSelected (Standard_False);
}
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
mySelection->Select (anOwner);
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return aStatus;
}
//=======================================================================
@@ -682,31 +693,78 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const Standard_Boolean theToUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
AIS_StatusOfPick aStatus = SelectPolygon (thePolyline, theView, AIS_SelectionScheme_XOR);
if (theToUpdateViewer)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
UpdateCurrentViewer();
}
return aStatus;
}
myLastActiveView = theView.get();
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_NArray1OfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme)
{
NCollection_IndexedMap<Handle(SelectMgr_EntityOwner)> aSelOwnerMap (myAutoHilight ? mySelection->Objects().Size() : 0);
if (myAutoHilight)
{
UnhilightSelected (Standard_False);
}
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
clearDynamicHighlight();
mySelection->Select (anOwner);
// collect currently selected owners
for (AIS_NListOfEntityOwner::Iterator anOwnerIter (mySelection->Objects()); anOwnerIter.More(); anOwnerIter.Next())
{
aSelOwnerMap.Add (anOwnerIter.Value());
}
}
mySelection->SelectOwners (theOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
// collect lists of owners to unhighlight (unselected) and to highlight (selected)
AIS_NListOfEntityOwner anOwnersToUnhighlight, anOwnersToHighlight;
for (AIS_NListOfEntityOwner::Iterator anOwnerIter (mySelection->Objects()); anOwnerIter.More(); anOwnerIter.Next())
{
// add newly selected owners
const Handle(SelectMgr_EntityOwner)& anOwner = anOwnerIter.Value();
if (!aSelOwnerMap.RemoveKey (anOwner))
{
// newly selected owner
anOwnersToHighlight.Append (anOwner);
}
else
{
// already selected owner
if (!anOwner->IsAutoHilight()
&& theSelScheme != AIS_SelectionScheme_XOR
&& theSelScheme != AIS_SelectionScheme_Add)
{
// hack to perform AIS_InteractiveObject::ClearSelected() before highlighting
anOwnersToUnhighlight.Append (anOwner);
anOwnersToHighlight.Append (anOwner);
}
else if (anOwner->IsForcedHilight()
|| !anOwner->IsAutoHilight())
{
anOwnersToHighlight.Append (anOwner);
}
}
}
for (NCollection_IndexedMap<Handle(SelectMgr_EntityOwner)>::Iterator anOwnerIter (aSelOwnerMap); anOwnerIter.More(); anOwnerIter.Next())
{
// owners removed from selection
const Handle(SelectMgr_EntityOwner)& anOwner = anOwnerIter.Value();
anOwnersToUnhighlight.Append (anOwner);
}
unhighlightOwners (anOwnersToUnhighlight);
highlightOwners (anOwnersToHighlight);
}
Standard_Integer aSelNum = NbSelected();
@@ -746,11 +804,13 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
continue;
if (anOwner == anObj->GlobalSelOwner())
{
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
(*aStatusPtr)->SetHilightStatus (Standard_True);
(*aStatusPtr)->SetHilightStyle (anObjSelStyle);
}
if (!anOwner->IsAutoHilight())
{
@@ -768,7 +828,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
}
else
{
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, (*aStatusPtr)->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
@@ -860,7 +920,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& aSelOwner = aSelIter.Value();
if (!myFilters->IsOk (aSelOwner))
if (!myFilters->IsOk (aSelOwner, SelectMgr_FilterReaction_Select))
{
continue;
}
@@ -872,7 +932,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
}
if (aSelOwner == aSelectable->GlobalSelOwner())
{
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable);
if (aStatusPtr)
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
}
@@ -906,7 +968,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
const Standard_Boolean theToUpdateViewer)
{
if (theOwner.IsNull() || !theOwner->HasSelectable() || !myFilters->IsOk (theOwner))
if (theOwner.IsNull() || !theOwner->HasSelectable() || !myFilters->IsOk (theOwner, SelectMgr_FilterReaction_Select))
return;
const Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
@@ -982,7 +1044,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (theOwner.IsNull() || !theOwner->HasSelectable())
return;
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
if (!myFilters->IsOk(theOwner, SelectMgr_FilterReaction_Select) && !theOwner->IsSelected())
return;
mySelection->Select (theOwner);
@@ -990,7 +1052,13 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (!myObjects.IsBound(anObj)) // e.g. AIS_ViewCubeFlat is not displayed
return;
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
return;
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
@@ -1001,7 +1069,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
(*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}

View File

@@ -30,6 +30,7 @@
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_OrFilter.hxx>
#include <SelectMgr_AndFilter.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <Standard_Transient.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
@@ -264,22 +265,74 @@ void AIS_InteractiveContext::SubIntensityOff (const Handle(AIS_InteractiveObject
}
}
//=======================================================================
//function : SetFilter
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetFilter (const Handle(SelectMgr_Filter)& theFilter)
{
Handle(SelectMgr_Filter) aDefFilter = myFilters->StoredFilters().First();
if (myFilters->StoredFilters().Size() < 2)
{
myFilters->Clear();
myFilters->Add (aDefFilter);
}
myFilters->Add (theFilter);
}
//=======================================================================
//function : Filter
//purpose :
//=======================================================================
Handle(SelectMgr_Filter) AIS_InteractiveContext::Filter (const Standard_Boolean isGlobalFilter) const
{
if (isGlobalFilter)
return myFilters;
if (myFilters->StoredFilters().Size() < 2)
return NULL;
SelectMgr_ListIteratorOfListOfFilter anIterator (myFilters->StoredFilters());
anIterator.Next();
return anIterator.Value();
}
//=======================================================================
//function : AddFilter
//purpose :
//=======================================================================
void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& theFilter)
{
myFilters->Add(aFilter);
Handle(SelectMgr_Filter) aFilter = Filter();
if (aFilter.IsNull())
SetFilter (new SelectMgr_OrFilter());
Handle (SelectMgr_CompositionFilter) aCompositeFilter = Handle(SelectMgr_CompositionFilter)::DownCast (aFilter);
if (aCompositeFilter.IsNull())
return;
if (aCompositeFilter->IsIn (theFilter))
return;
aCompositeFilter->Add (theFilter);
}
//=======================================================================
//function : RemoveFilter
//purpose :
//=======================================================================
void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& theFilter)
{
myFilters->Remove(aFilter);
Handle(SelectMgr_Filter) aFilter = Filter();
if (aFilter.IsNull())
return;
Handle (SelectMgr_CompositionFilter) aCompositeFilter = Handle(SelectMgr_CompositionFilter)::DownCast (aFilter);
if (aCompositeFilter.IsNull())
return;
aCompositeFilter->Remove (theFilter);
}
//=======================================================================
@@ -289,16 +342,24 @@ void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilte
void AIS_InteractiveContext::RemoveFilters()
{
myFilters->Clear();
SetFilter (NULL);
}
//=======================================================================
//function : Filters
//purpose :
//=======================================================================
const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
SelectMgr_ListOfFilter AIS_InteractiveContext::Filters() const
{
return myFilters->StoredFilters();
Handle(SelectMgr_Filter) aFilter = Filter();
if (aFilter.IsNull())
return SelectMgr_ListOfFilter();
Handle (SelectMgr_CompositionFilter) aCompositeFilter = Handle(SelectMgr_CompositionFilter)::DownCast (aFilter);
if (aCompositeFilter.IsNull())
return SelectMgr_ListOfFilter();
return aCompositeFilter->StoredFilters();
}
//=======================================================================

View File

@@ -23,7 +23,7 @@
#include <Quantity_Color.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_OrFilter.hxx>
#include <SelectMgr_AndFilter.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>

View File

@@ -18,6 +18,7 @@
#include <AIS_InteractiveContext.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectFillCapping.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
@@ -83,6 +84,17 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
}
}
//-----------------------------------------------------------------------------
void AIS_InteractiveObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
SelectMgr_SelectableObject::SetTransformPersistence (theTrsfPers);
if (!GetContext().IsNull())
{
GetContext()->UpdateOnTransformPersistence (this);
}
}
//=======================================================================
//function : HasPresentation
//purpose :

View File

@@ -108,6 +108,11 @@ public:
//! Returns the context pointer to the interactive context.
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
//! Sets up Transform Persistence defining a special Local Coordinate system where this object should be located.
//! Updates the presentation in context if it is not NULL
//! @sa Graphic3d_TransformPers class description
Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
//! Returns TRUE when this object has a presentation in the current DisplayMode()
Standard_EXPORT Standard_Boolean HasPresentation() const;

View File

@@ -0,0 +1,24 @@
// Created on: 2003-05-04
// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
// Copyright (c) 2003-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_NArray1Transient_HeaderFile
#define _AIS_NArray1Transient_HeaderFile
#include <SelectMgr_EntityOwner.hxx>
#include <NCollection_Array1.hxx>
typedef NCollection_Array1<Handle(SelectMgr_EntityOwner)> AIS_NArray1OfEntityOwner;
#endif

View File

@@ -44,6 +44,7 @@ AIS_RubberBand::AIS_RubberBand()
myDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0));
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (1.0);
@@ -66,6 +67,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
myDrawer->SetLineAspect (new Prs3d_LineAspect (theLineColor, theLineType, theWidth));
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (1.0);
@@ -91,6 +93,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
myDrawer->ShadingAspect()->SetColor (theFillColor);
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
myDrawer->ShadingAspect()->SetTransparency (theTransparency);

View File

@@ -15,6 +15,8 @@
#include <AIS_Selection.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_SelectionScheme.hxx>
#include <SelectMgr_Filter.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
@@ -130,3 +132,132 @@ AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)&
theObject->SetSelected (Standard_True);
return AIS_SS_Added;
}
//=======================================================================
//function : SelectOwners
//purpose :
//=======================================================================
void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwners,
const AIS_SelectionScheme theSelScheme,
const Handle(SelectMgr_Filter)& theFilter)
{
switch (theSelScheme)
{
case AIS_SelectionScheme_UNKNOWN:
{
return;
}
case AIS_SelectionScheme_ReplaceExtra:
{
// If picked owners is equivalent to the selected then just clear selected
// Else go to AIS_SelectionScheme_Replace
if (thePickedOwners.Size() == myresult.Size())
{
Standard_Boolean isTheSame = Standard_True;
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
if (!myResultMap.IsBound (aSelIter.Value()))
{
isTheSame = Standard_False;
break;
}
}
if (isTheSame)
{
Clear();
return;
}
}
}
case AIS_SelectionScheme_Replace:
{
Clear();
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
appendOwner (aSelIter.Value(), theFilter);
}
return;
}
case AIS_SelectionScheme_Add:
{
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
appendOwner (aSelIter.Value(), theFilter);
}
return;
}
case AIS_SelectionScheme_Remove:
{
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
if (myResultMap.IsBound (aSelIter.Value()))
{
Select (aSelIter.Value());
}
}
return;
}
case AIS_SelectionScheme_XOR:
{
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
if (anOwner.IsNull()
|| !anOwner->HasSelectable()
|| !theFilter->IsOk (anOwner, SelectMgr_FilterReaction_Select))
{
continue;
}
Select (anOwner);
}
return;
}
case AIS_SelectionScheme_Clear:
{
Clear();
return;
}
}
}
//=======================================================================
//function : appendOwner
//purpose :
//=======================================================================
AIS_SelectStatus AIS_Selection::appendOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter)
{
if (theOwner.IsNull()
|| !theOwner->HasSelectable()
|| !theFilter->IsOk (theOwner, SelectMgr_FilterReaction_Select))
{
return AIS_SS_NotDone;
}
return AddSelect (theOwner);
}
//=======================================================================
//function : XOROwner
//purpose :
//=======================================================================
AIS_SelectStatus AIS_Selection::XOROwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const AIS_NListOfEntityOwner& thePreviousSelected,
const Handle(SelectMgr_Filter)& theFilter)
{
if (theOwner.IsNull() || !theOwner->HasSelectable() || !theFilter->IsOk (theOwner, SelectMgr_FilterReaction_Select))
return AIS_SS_NotDone;
if (thePreviousSelected.Contains (theOwner)) // was selected, should not be now
{
if (theOwner->IsSelected())
return Select (theOwner); // deselect
}
else
{
return AddSelect (theOwner); // was not selected, should be now
}
return AIS_SS_NotDone;
}

View File

@@ -18,10 +18,14 @@
#define _AIS_Selection_HeaderFile
#include <AIS_NListOfEntityOwner.hxx>
#include <AIS_NArray1OfEntityOwner.hxx>
#include <AIS_SelectionScheme.hxx>
#include <AIS_SelectStatus.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
class SelectMgr_Filter;
//! Class holding the list of selected owners.
class AIS_Selection : public Standard_Transient
{
@@ -75,7 +79,33 @@ public:
//! Return selected object at iterator position.
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
private:
//! Select or deselect owners depending on the selection scheme.
//! @param theOwners [in] elements to change selection state
//! @param theSelScheme [in] selection scheme, defines how owner is selected
//! @param theFilter [in] context filter to skip not acceptable owners
Standard_EXPORT virtual void SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwners,
const AIS_SelectionScheme theSelScheme,
const Handle(SelectMgr_Filter)& theFilter);
protected:
//! Append the owner into the current selection if filter is Ok.
//! @param theOwner [in] element to change selection state
//! @param theFilter [in] context filter to skip not acceptable owners
//! @return result of selection
Standard_EXPORT virtual AIS_SelectStatus appendOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter);
//! XOR the owner to the current selection if filter is Ok.
//! \param theOwner element to change selection state
//! \param thePreviousSelected previous selected objects
//! \param theFilter context filter to skip not acceptable owners
//! \return result of selection
Standard_EXPORT virtual AIS_SelectStatus XOROwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const AIS_NListOfEntityOwner& thePreviousSelected,
const Handle(SelectMgr_Filter)& theFilter);
protected:
AIS_NListOfEntityOwner myresult;
AIS_NListOfEntityOwner::Iterator myIterator;

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2019 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_SelectionScheme_HeaderFile
#define _AIS_SelectionScheme_HeaderFile
//! Sets selection schemes for interactive contexts.
enum AIS_SelectionScheme
{
AIS_SelectionScheme_UNKNOWN = -1, //!< undefined scheme
AIS_SelectionScheme_Replace = 0, //!< clears current selection and select detected objects
AIS_SelectionScheme_Add, //!< adds detected object to current selection
AIS_SelectionScheme_Remove, //!< removes detected object from the current selection
AIS_SelectionScheme_XOR, //!< performs XOR for detected objects, other selected not touched
AIS_SelectionScheme_Clear, //!< clears current selection
AIS_SelectionScheme_ReplaceExtra, //!< replace with one difference: if result of replace is an empty,
//!< and current selection contains detected element, it will be selected
};
#endif // _AIS_SelectionScheme_HeaderFile

View File

@@ -176,10 +176,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
try
{
OCC_CATCH_SIGNALS
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
myUVOrigin, myUVRepeat, myUVScale);
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myDrawer->FillCappingAspect());
}
catch (Standard_Failure const& anException)
{

View File

@@ -110,7 +110,7 @@ AIS_ViewController::AIS_ViewController()
myAnchorPointPrs2->SetZLayer (Graphic3d_ZLayerId_Topmost);
myAnchorPointPrs2->SetMutable (true);
myRubberBand = new AIS_RubberBand (Quantity_NOC_LIGHTBLUE, Aspect_TOL_SOLID, Quantity_NOC_LIGHTBLUE, 0.4, 1.0);
myRubberBand = new AIS_RubberBand (Quantity_NOC_LIGHTBLUE, Aspect_TOL_SOLID, Quantity_NOC_LIGHTBLUE4, 0.5, 1.0);
myRubberBand->SetZLayer (Graphic3d_ZLayerId_TopOSD);
myRubberBand->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_UPPER));
myRubberBand->SetDisplayMode (0);
@@ -2377,14 +2377,7 @@ void AIS_ViewController::handleSelectionPick (const Handle(AIS_InteractiveContex
ResetPreviousMoveTo();
}
if (myGL.Selection.IsXOR)
{
theCtx->ShiftSelect (false);
}
else
{
theCtx->Select (false);
}
theCtx->SelectDetected (myGL.Selection.IsXOR ? AIS_SelectionScheme_XOR : AIS_SelectionScheme_Replace);
// selection affects all Views
theView->Viewer()->Invalidate();
@@ -2486,18 +2479,10 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
else
{
theCtx->MainSelector()->AllowOverlapDetection (aPnt1.y() != Min (aPnt1.y(), aPnt2.y()));
if (myGL.Selection.IsXOR)
{
theCtx->ShiftSelect (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
else
{
theCtx->Select (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
theCtx->SelectRectangle (Graphic3d_Vec2i (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y())),
Graphic3d_Vec2i (Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y())),
theView,
myGL.Selection.IsXOR ? AIS_SelectionScheme_XOR : AIS_SelectionScheme_Replace);
theCtx->MainSelector()->AllowOverlapDetection (false);
}
}
@@ -2512,14 +2497,8 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
aPolyIter.ChangeValue() = gp_Pnt2d (aNewPnt.x(), -aNewPnt.y());
}
if (myGL.Selection.IsXOR)
{
theCtx->ShiftSelect (aPolyline, theView, false);
}
else
{
theCtx->Select (aPolyline, theView, false);
}
theCtx->SelectPolygon (aPolyline, theView,
myGL.Selection.IsXOR ? AIS_SelectionScheme_XOR : AIS_SelectionScheme_Replace);
theCtx->MainSelector()->AllowOverlapDetection (false);
}
}

View File

@@ -73,6 +73,7 @@ AIS_MultipleConnectedInteractive.hxx
AIS_MultipleConnectedInteractive.lxx
AIS_NavigationMode.hxx
AIS_NListOfEntityOwner.hxx
AIS_NArray1OfEntityOwner.hxx
AIS_Plane.cxx
AIS_Plane.hxx
AIS_PlaneTrihedron.cxx
@@ -88,6 +89,7 @@ AIS_Selection.cxx
AIS_Selection.hxx
AIS_SelectStatus.hxx
AIS_SelectionModesConcurrency.hxx
AIS_SelectionScheme.hxx
AIS_SequenceOfInteractive.hxx
AIS_Shape.cxx
AIS_Shape.hxx

View File

@@ -23,6 +23,7 @@
#include <Aspect_Background.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Dump.hxx>
//-Aliases
//-Global data definitions
@@ -56,3 +57,12 @@ Quantity_Color Aspect_Background::Color () const {
return (MyColor);
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_Background::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyColor)
}

View File

@@ -46,6 +46,9 @@ public:
//! Returns the colour of the window background <me>.
Standard_EXPORT Quantity_Color Color() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -140,3 +140,20 @@ void Aspect_CircularGrid::Init () {
myAlpha = M_PI / Standard_Real(myDivisionNumber);
myA1 = Cos(myAlpha); myB1=Sin(myAlpha);
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_CircularGrid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Aspect_Grid)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRadiusStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDivisionNumber)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlpha)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myA1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myB1)
}

View File

@@ -55,6 +55,9 @@ public:
Standard_EXPORT Standard_Integer DivisionNumber() const;
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
private:

View File

@@ -18,6 +18,8 @@
#include <Aspect_GenId.hxx>
#include <Aspect_IdentDefinitionError.hxx>
#include <Standard_Dump.hxx>
// =======================================================================
// function : Aspect_GenId
// purpose :
@@ -114,3 +116,21 @@ Standard_Boolean Aspect_GenId::Next (Standard_Integer& theId)
theId = myLowerBound + myLength - myFreeCount - 1;
return Standard_True;
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_GenId::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFreeCount)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLowerBound)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpperBound)
for (TColStd_ListOfInteger::Iterator anIter (myFreeIds); anIter.More(); anIter.Next())
{
Standard_Integer aFreeId = anIter.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aFreeId)
}
}

View File

@@ -72,6 +72,9 @@ public:
//! Returns the upper identifier in range.
Standard_Integer Upper() const { return myUpperBound; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
private:

View File

@@ -55,3 +55,15 @@ Aspect_GradientFillMethod Aspect_GradientBackground::BgGradientFillMethod( ) con
{
return MyGradientMethod;
}
// =======================================================================
// function : DumpJson
// purpose :
// =======================================================================
void Aspect_GradientBackground::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Aspect_Background)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyColor2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyGradientMethod)
}

View File

@@ -51,6 +51,9 @@ public:
//! Returns the current gradient background fill mode.
Standard_EXPORT Aspect_GradientFillMethod BgGradientFillMethod() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

View File

@@ -104,3 +104,22 @@ void Aspect_Grid::SetDrawMode (const Aspect_GridDrawMode theDrawMode)
myDrawMode = theDrawMode;
UpdateDisplay();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_Grid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRotationAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myXOrigin)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myYOrigin)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColor)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTenthColor)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActive)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawMode)
}

View File

@@ -96,6 +96,9 @@ public:
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0;
Standard_EXPORT virtual void Init() = 0;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:

View File

@@ -155,3 +155,25 @@ Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
const Standard_Real beta) const {
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_RectangularGrid::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS(theOStream, theDepth, Aspect_Grid)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myXStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myYStep)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFirstAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySecondAngle)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, a1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, b1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, c1)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, a2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, b2)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, c2)
}

View File

@@ -67,6 +67,9 @@ public:
Standard_EXPORT Standard_Real SecondAngle() const;
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
private:

View File

@@ -92,3 +92,18 @@ void Aspect_Window::SetBackground (const Quantity_Color& theFirstColor,
{
MyGradientBackground.SetColors (theFirstColor, theSecondColor, theFillMethod);
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Aspect_Window::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyBackground)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &MyGradientBackground)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyBackgroundFillMethod)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, MyIsVirtual)
}

View File

@@ -114,6 +114,9 @@ public:
//! on platforms implementing thread-unsafe connections to display.
//! NULL can be passed instead otherwise.
virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) { (void )theDisp; }
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(Aspect_Window,Standard_Transient)

View File

@@ -149,7 +149,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
if (aDistTool.IsDone())
{
if (aDistTool.DistValue() < myDistRef - myEps)
@@ -194,7 +194,8 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (Extrema_ExtFlag_MINMAX)
myFlag (Extrema_ExtFlag_MINMAX),
myAlgo (Extrema_ExtAlgo_Grad)
{
//
}
@@ -205,14 +206,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
//=======================================================================
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);
@@ -227,14 +230,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Standard_Real theDeflection,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (theDeflection),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);

View File

@@ -18,6 +18,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <BRepExtrema_SolutionElem.hxx>
#include <BRepExtrema_SupportType.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Extrema_ExtFlag.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
@@ -38,9 +39,9 @@ class BRepExtrema_DistShapeShape
Standard_EXPORT BRepExtrema_DistShapeShape();
//! computation of the minimum distance (value and pair of points) using default deflection <br>
//! Default value is Precision::Confusion(). <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
//! create tool and load both shapes into it <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
void SetDeflection(const Standard_Real theDeflection)
{
@@ -128,6 +129,11 @@ class BRepExtrema_DistShapeShape
myFlag = F;
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
@@ -150,6 +156,7 @@ private:
Standard_Boolean myIsInitS1;
Standard_Boolean myIsInitS2;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
Bnd_SeqOfBox myBV1;
Bnd_SeqOfBox myBV2;
Bnd_SeqOfBox myBE1;

View File

@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{

View File

@@ -16,6 +16,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Precision.hxx>
#include <Standard_DefineAlloc.hxx>
@@ -38,8 +39,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -50,8 +52,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef, const Standard_Real aDeflection,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -80,6 +83,11 @@ class BRepExtrema_DistanceSS
{
myFlag = F;
}
//! sets the flag controlling ...
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
@@ -122,6 +130,7 @@ class BRepExtrema_DistanceSS
Standard_Boolean myModif;
Standard_Real myEps;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
};
#endif

View File

@@ -32,9 +32,9 @@
//=======================================================================
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
Initialize(TheFace,TheFlag);
Initialize(TheFace,TheFlag,TheAlgo);
Perform(TheVertex,TheFace);
}
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
//=======================================================================
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
// cette surface doit etre en champ. Extrema ne fait
// pas de copie et prend seulement un pointeur dessus.
@@ -60,6 +60,7 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
Standard_Real U1, U2, V1, V2;
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
myExtPS.SetFlag(TheFlag);
myExtPS.SetAlgo(TheAlgo);
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
}

View File

@@ -21,6 +21,7 @@
#include <Extrema_SequenceOfPOnSurf.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
class TopoDS_Vertex;
class TopoDS_Face;
@@ -37,10 +38,12 @@ class BRepExtrema_ExtPF
{}
//! It calculates all the distances. <br>
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
//! An exception is raised if the fields have not been initialized. <br>
//! Be careful: this method uses the Face only for classify not for the fields. <br>
@@ -76,6 +79,11 @@ class BRepExtrema_ExtPF
myExtPS.SetFlag(F);
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myExtPS.SetAlgo(A);
}
private:
Extrema_ExtPS myExtPS;

View File

@@ -23,7 +23,6 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <GCPnts.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
@@ -179,6 +178,39 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
namespace
{
static void fillParams (const TColStd_Array1OfReal& theKnots,
Standard_Integer theDegree,
Standard_Real theParMin,
Standard_Real theParMax,
NCollection_Vector<Standard_Real>& theParams)
{
Standard_Real aPrevPar = theParMin;
theParams.Append (aPrevPar);
Standard_Integer aNbP = Max (theDegree, 1);
for (Standard_Integer i = 1;
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
{
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
continue;
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
for (Standard_Integer k = 1; k <= aNbP ; ++k)
{
Standard_Real aPar = theKnots (i) + k * aStep;
if (aPar > theParMax - Precision::PConfusion())
break;
if (aPar > aPrevPar + Precision::PConfusion())
{
theParams.Append (aPar);
aPrevPar = aPar;
}
}
}
theParams.Append (theParMax);
}
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real> theParams,
@@ -326,13 +358,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aKnots.SetValue (1, GC->FirstParameter());
aKnots.SetValue (2, GC->LastParameter());
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_BSplineCurve:
{
Handle(Geom_BSplineCurve) GC = c.BSpline();
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_Line:
@@ -359,7 +391,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aBounds.SetValue (1, dfUf);
aBounds.SetValue (2, dfUl);
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
}
}

View File

@@ -77,7 +77,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
if (n == 5)
aDeflection = Draw::Atof(a[4]);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection, Extrema_ExtFlag_MIN);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
if (dst.IsDone())
{

View File

@@ -617,9 +617,9 @@ static Standard_Integer getedgeregul
//=======================================================================
static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 3 || n > 4) {
if (n < 3 || n > 5) {
di << "Project point on the face.\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax]\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
return 1;
}
// get face
@@ -642,6 +642,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
//
// get projection options
// default values;
Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
//
for (Standard_Integer i = 3; i < n; ++i) {
@@ -654,6 +655,12 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
else if (!strcasecmp(a[i], "-minmax")) {
anExtFlag = Extrema_ExtFlag_MINMAX;
}
else if (!strcasecmp(a[i], "-t")) {
anExtAlgo = Extrema_ExtAlgo_Tree;
}
else if (!strcasecmp(a[i], "-g")) {
anExtAlgo = Extrema_ExtAlgo_Grad;
}
}
//
// get surface
@@ -670,6 +677,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
GeomAPI_ProjectPointOnSurf aProjPS;
aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
// set the options
aProjPS.SetExtremaAlgo(anExtAlgo);
aProjPS.SetExtremaFlag(anExtFlag);
// perform projection
aProjPS.Perform(aP);
@@ -758,7 +766,7 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
theCommands.Add ("projponf",
"projponf face pnt [extrema flag: -min/-max/-minmax]\n"
"projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
"\t\tProject point on the face.",
__FILE__, projponf, g);
}

View File

@@ -201,6 +201,51 @@ public:
}
}
//! Inits the content of me into the stream
Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
{
Standard_Integer aPos = theStreamPos;
Standard_Integer anIsInited = 0;
OCCT_INIT_FIELD_VALUE_INTEGER (theSStream, aPos, anIsInited);
myIsInited = anIsInited != 0;
int n = Min (N, 3);
if (n == 1)
{
Standard_Real aValue;
OCCT_INIT_FIELD_VALUE_REAL (theSStream, aPos, aValue);
myMinPoint[0] = (T)aValue;
}
if (n == 2)
{
Standard_Real aValue1, aValue2;
OCCT_INIT_VECTOR_CLASS (theSStream, "MinPoint", aPos, n, &aValue1, &aValue2);
myMinPoint[0] = (T)aValue1;
myMinPoint[1] = (T)aValue2;
OCCT_INIT_VECTOR_CLASS (theSStream, "MaxPoint", aPos, n, &aValue1, &aValue2);
myMaxPoint[0] = (T)aValue1;
myMaxPoint[1] = (T)aValue2;
}
if (n == 3)
{
Standard_Real aValue1, aValue2, aValue3;
OCCT_INIT_VECTOR_CLASS (theSStream, "MinPoint", aPos, n, &aValue1, &aValue2, &aValue3);
myMinPoint[0] = (T)aValue1;
myMinPoint[1] = (T)aValue2;
myMinPoint[2] = (T)aValue3;
OCCT_INIT_VECTOR_CLASS (theSStream, "MaxPoint", aPos, n, &aValue1, &aValue2, &aValue3);
myMaxPoint[0] = (T)aValue1;
myMaxPoint[1] = (T)aValue2;
myMaxPoint[2] = (T)aValue3;
}
theStreamPos = aPos;
return Standard_True;
}
public:
//! Checks if the Box is out of the other box.

View File

@@ -66,18 +66,6 @@ public: //! @name Adding elements in BVH
BVH_Object<NumType, Dimension>::myIsDirty = Standard_True;
}
//! Allows to update the box of the element while the tree is not yet built
virtual void UpdateBox (const Standard_Integer theId, const BVH_Box<NumType, Dimension>& theNewBox)
{
if (BVH_Object<NumType, Dimension>::myIsDirty)
{
if (theId >= 0 && theId < Size())
{
myBoxes[theId] = theNewBox;
}
}
}
public: //! @name BVH construction
//! BVH construction

View File

@@ -84,7 +84,7 @@ public: //! @name Necessary overrides for BVH construction
//! Returns the bounding box with the given index.
virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
{
return this->myBoxes[myIndices[theIndex]];
return myBoxes[myIndices[theIndex]];
}
//! Swaps indices of two specified boxes.
@@ -97,7 +97,7 @@ public: //! @name Necessary overrides for BVH construction
//! Returns the Element with the index theIndex.
virtual DataType Element (const Standard_Integer theIndex) const
{
return this->myElements[myIndices[theIndex]];
return myElements[myIndices[theIndex]];
}
protected: //! @name Fields

View File

@@ -88,24 +88,6 @@ public: //! @name Point-Box Square distance
return aDist;
}
//! Computes Max square distance between point and bounding box
static T PointBoxMaxSquareDistance (const BVH_VecNt& thePoint,
const BVH_VecNt& theCMin,
const BVH_VecNt& theCMax)
{
T aDist = 0;
for (int i = 0; i < N; ++i)
{
T dmin = 0, dmax = 0;
if (thePoint[i] > theCMin[i]) { dmin = thePoint[i] - theCMin[i]; }
if (thePoint[i] < theCMax[i]) { dmax = theCMax[i] - thePoint[i]; }
T d = dmin > dmax ? dmin : dmax;
d *= d;
aDist += d;
}
return aDist;
}
public: //! @name Point-Box projection
//! Computes projection of point on bounding box
@@ -128,6 +110,7 @@ public: //! @name Point-Box projection
{
return thePoint.cwiseMax (theCMin).cwiseMin (theCMax);
}
public: //! @name Point-Triangle Square distance
//! Computes square distance between point and triangle

View File

@@ -35,8 +35,6 @@
#include <BinMXCAFDoc_MaterialToolDriver.hxx>
#include <BinMXCAFDoc_NoteDriver.hxx>
#include <BinMXCAFDoc_NoteBalloonDriver.hxx>
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
#include <BinMXCAFDoc_NotesToolDriver.hxx>
#include <BinMXCAFDoc_ShapeToolDriver.hxx>
#include <BinMXCAFDoc_ViewDriver.hxx>
@@ -81,8 +79,7 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_VisMaterialDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBalloonDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_NoteDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_ViewDriver (theMsgDrv));
theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver (theMsgDrv));

View File

@@ -42,6 +42,9 @@ class BinMXCAFDoc_DimTolToolDriver;
class BinMXCAFDoc_MaterialToolDriver;
class BinMXCAFDoc_ViewDriver;
class BinMXCAFDoc_ViewToolDriver;
class BinMXCAFDoc_AnimationDriver;
class BinMXCAFDoc_AnimationToolDriver;
@@ -89,6 +92,9 @@ friend class BinMXCAFDoc_DimTolToolDriver;
friend class BinMXCAFDoc_MaterialToolDriver;
friend class BinMXCAFDoc_ViewDriver;
friend class BinMXCAFDoc_ViewToolDriver;
friend class BinMXCAFDoc_AnimationDriver;
friend class BinMXCAFDoc_AnimationToolDriver;
};

View File

@@ -0,0 +1,112 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 <BinMXCAFDoc_AnimationDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <XCAFDoc_Animation.hxx>
# include <TColStd_HArray1OfByte.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
static Standard_Boolean getByteArray(const BinObjMgt_Persistent& theSource, Handle(TColStd_HArray1OfByte)& theArray)
{
Standard_Integer aFirstInd, aLastInd;
if (!(theSource >> aFirstInd >> aLastInd))
return Standard_False;
if (aLastInd < aFirstInd)
return Standard_False;
theArray.reset(new TColStd_HArray1OfByte(aFirstInd, aLastInd - aFirstInd + 1));
theSource.GetByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
return Standard_True;
}
static void putByteArray(BinObjMgt_Persistent& theTarget, const Handle(TColStd_HArray1OfByte)& theArray)
{
if (theArray.IsNull())
return;
const Standard_Integer aFirstInd = theArray->Lower();
const Standard_Integer aLastInd = theArray->Upper();
if (aLastInd < aFirstInd)
return;
theTarget << aFirstInd << aLastInd;
theTarget.PutByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BinMXCAFDoc_AnimationDriver::BinMXCAFDoc_AnimationDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Animation)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_AnimationDriver::NewEmpty() const
{
return new XCAFDoc_Animation();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_AnimationDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theTarget);
Standard_Real aDensity;
TCollection_AsciiString aName;
if (!(theSource >> aName))
return Standard_False;
Handle(TColStd_HArray1OfByte) anImage, anAnimation;
if (!getByteArray(theSource, anImage) || anImage.IsNull())
return Standard_False;
if (!getByteArray(theSource, anAnimation) || anAnimation.IsNull())
return Standard_False;
anAtt->Set(new TCollection_HAsciiString(aName), anImage, anAnimation);
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
void BinMXCAFDoc_AnimationDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theSource);
Handle(TCollection_HAsciiString) aName = anAtt->GetName();
if (!aName.IsNull())
theTarget << aName->String();
putByteArray(theTarget, anAtt->GetImage());
putByteArray(theTarget, anAtt->GetAnimation());
}

View File

@@ -0,0 +1,72 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 _BinMXCAFDoc_AnimationDriver_HeaderFile
#define _BinMXCAFDoc_AnimationDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMXCAFDoc_AnimationDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationDriver, BinMDF_ADriver)
class BinMXCAFDoc_AnimationDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMXCAFDoc_AnimationDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMXCAFDoc_AnimationDriver_HeaderFile

View File

@@ -0,0 +1,65 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 <BinMXCAFDoc_AnimationToolDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <XCAFDoc_AnimationTool.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_AnimationToolDriver::BinMXCAFDoc_AnimationToolDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AnimationTool)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_AnimationToolDriver::NewEmpty() const
{
return new XCAFDoc_AnimationTool();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_AnimationToolDriver::Paste
(const BinObjMgt_Persistent& /*theSource*/,
const Handle(TDF_Attribute)& /*theTarget*/,
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
{
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void BinMXCAFDoc_AnimationToolDriver::Paste
(const Handle(TDF_Attribute)& /*theSource*/,
BinObjMgt_Persistent& /*theTarget*/,
BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
}

View File

@@ -0,0 +1,50 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 _BinMXCAFDoc_AnimationToolDriver_HeaderFile
#define _BinMXCAFDoc_AnimationToolDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMXCAFDoc_AnimationToolDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
class BinMXCAFDoc_AnimationToolDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMXCAFDoc_AnimationToolDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste(const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
};
#endif // _BinMXCAFDoc_AnimationToolDriver_HeaderFile

View File

@@ -20,14 +20,14 @@
#include <BinMXCAFDoc_NoteBalloonDriver.hxx>
#include <XCAFDoc_NoteBalloon.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
{
}
@@ -40,13 +40,52 @@ Handle(TDF_Attribute) BinMXCAFDoc_NoteBalloonDriver::NewEmpty() const
return new XCAFDoc_NoteBalloon();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_NoteBalloonDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
{
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
return Standard_False;
Handle(XCAFDoc_NoteBalloon) aNote = Handle(XCAFDoc_NoteBalloon)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
TCollection_ExtendedString aComment;
if (!(theSource >> aComment))
return Standard_False;
aNote->Set(aComment);
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void BinMXCAFDoc_NoteBalloonDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const
{
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
Handle(XCAFDoc_NoteBalloon) aNote = Handle(XCAFDoc_NoteBalloon)::DownCast(theSource);
if (!aNote.IsNull())
theTarget << aNote->Get();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver,
Standard_CString theName)
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, theName)
: BinMXCAFDoc_NoteDriver(theMsgDriver, theName)
{
}

View File

@@ -16,20 +16,28 @@
#ifndef _BinMXCAFDoc_NoteBalloonDriver_HeaderFile
#define _BinMXCAFDoc_NoteBalloonDriver_HeaderFile
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
#include <BinMXCAFDoc_NoteDriver.hxx>
class BinMXCAFDoc_NoteBalloonDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
class BinMXCAFDoc_NoteBalloonDriver : public BinMXCAFDoc_NoteCommentDriver
class BinMXCAFDoc_NoteBalloonDriver : public BinMXCAFDoc_NoteDriver
{
public:
Standard_EXPORT BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
Standard_EXPORT Standard_Boolean Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
protected:

View File

@@ -1,96 +0,0 @@
// Created on: 2017-02-13
// Created by: Eugeny NIKONOV
// Copyright (c) 2005-2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TColStd_HArray1OfByte.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
#include <XCAFDoc_NoteBinData.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteBinDataDriver::BinMXCAFDoc_NoteBinDataDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_NoteBinDataDriver::NewEmpty() const
{
return new XCAFDoc_NoteBinData();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_NoteBinDataDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
{
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
return Standard_False;
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
TCollection_ExtendedString aTitle;
TCollection_AsciiString aMIMEtype;
Standard_Integer nbSize;
if (!(theSource >> aTitle >> aMIMEtype >> nbSize))
return Standard_False;
Handle(TColStd_HArray1OfByte) aData;
if (nbSize > 0)
{
aData.reset(new TColStd_HArray1OfByte(1, nbSize));
theSource.GetByteArray(&aData->ChangeFirst(), nbSize);
}
aNote->Set(aTitle, aMIMEtype, aData);
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void BinMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const
{
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
if (!aNote.IsNull())
{
theTarget << aNote->Title() << aNote->MIMEtype() << aNote->Size();
if (aNote->Size() > 0)
theTarget.PutByteArray(&aNote->Data()->ChangeFirst(), aNote->Size());
}
}

View File

@@ -1,44 +0,0 @@
// Created on: 2017-02-13
// Created by: Sergey NIKONOV
// Copyright (c) 2005-2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
#define _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
#include <BinMXCAFDoc_NoteDriver.hxx>
class BinMXCAFDoc_NoteBinDataDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
class BinMXCAFDoc_NoteBinDataDriver : public BinMXCAFDoc_NoteDriver
{
public:
Standard_EXPORT BinMXCAFDoc_NoteBinDataDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
};
#endif // _BinMXCAFDoc_NoteBinDataDriver_HeaderFile

View File

@@ -1,91 +0,0 @@
// Created on: 2017-02-13
// Created by: Eugeny NIKONOV
// Copyright (c) 2005-2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
#include <XCAFDoc_NoteComment.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_NoteCommentDriver::NewEmpty() const
{
return new XCAFDoc_NoteComment();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_NoteCommentDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
{
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
return Standard_False;
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
TCollection_ExtendedString aComment;
if (!(theSource >> aComment))
return Standard_False;
aNote->Set(aComment);
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void BinMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const
{
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
if (!aNote.IsNull())
theTarget << aNote->Comment();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver,
Standard_CString theName)
: BinMXCAFDoc_NoteDriver(theMsgDriver, theName)
{
}

View File

@@ -1,49 +0,0 @@
// Created on: 2017-02-13
// Created by: Sergey NIKONOV
// Copyright (c) 2005-2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMXCAFDoc_NoteCommentDriver_HeaderFile
#define _BinMXCAFDoc_NoteCommentDriver_HeaderFile
#include <BinMXCAFDoc_NoteDriver.hxx>
class BinMXCAFDoc_NoteCommentDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
class BinMXCAFDoc_NoteCommentDriver : public BinMXCAFDoc_NoteDriver
{
public:
Standard_EXPORT BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
protected:
BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver,
Standard_CString theName);
};
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile

View File

@@ -22,6 +22,24 @@
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Note)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_NoteDriver::NewEmpty() const
{
return new XCAFDoc_Note();
}
//=======================================================================
//function :
//purpose :

View File

@@ -35,6 +35,10 @@ class BinMXCAFDoc_NoteDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMXCAFDoc_NoteDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;

View File

@@ -39,10 +39,6 @@ BinMXCAFDoc_NoteDriver.cxx
BinMXCAFDoc_NoteDriver.hxx
BinMXCAFDoc_NoteBalloonDriver.cxx
BinMXCAFDoc_NoteBalloonDriver.hxx
BinMXCAFDoc_NoteCommentDriver.cxx
BinMXCAFDoc_NoteCommentDriver.hxx
BinMXCAFDoc_NoteBinDataDriver.cxx
BinMXCAFDoc_NoteBinDataDriver.hxx
BinMXCAFDoc_NotesToolDriver.cxx
BinMXCAFDoc_NotesToolDriver.hxx
BinMXCAFDoc_ShapeToolDriver.cxx
@@ -57,3 +53,7 @@ BinMXCAFDoc_VisMaterialToolDriver.cxx
BinMXCAFDoc_VisMaterialToolDriver.hxx
BinMXCAFDoc_VolumeDriver.cxx
BinMXCAFDoc_VolumeDriver.hxx
BinMXCAFDoc_AnimationDriver.cxx
BinMXCAFDoc_AnimationDriver.hxx
BinMXCAFDoc_AnimationToolDriver.cxx
BinMXCAFDoc_AnimationToolDriver.hxx

View File

@@ -983,3 +983,21 @@ void Bnd_Box::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Gap)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Flags)
}
//=======================================================================
//function : InitFromJson
//purpose :
//=======================================================================
Standard_Boolean Bnd_Box::InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
{
Standard_Integer aPos = theStreamPos;
OCCT_INIT_VECTOR_CLASS (theSStream, "CornerMin", aPos, 3, &Xmin, &Ymin, &Zmin)
OCCT_INIT_VECTOR_CLASS (theSStream, "CornerMax", aPos, 3, &Xmax, &Ymax, &Zmax)
OCCT_INIT_FIELD_VALUE_REAL (theSStream, aPos, Gap);
OCCT_INIT_FIELD_VALUE_INTEGER (theSStream, aPos, Flags);
theStreamPos = aPos;
return Standard_True;
}

View File

@@ -305,6 +305,9 @@ public:
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
//! Inits the content of me into the stream
Standard_EXPORT Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);
protected:
//! Bit flags.

View File

@@ -150,12 +150,12 @@ void CDM_MetaData::UnsetIsReadOnly() {
//function : DumpJson
//purpose :
//=======================================================================
void CDM_MetaData::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
void CDM_MetaData::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRetrieved)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDocument)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDocument)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myFolder)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName)

View File

@@ -17,6 +17,7 @@
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <Message.hxx>
#include <TDocStd_Document.hxx>
#include <TDF_Label.hxx>
#include <TCollection_AsciiString.hxx>
@@ -34,6 +35,7 @@
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <Standard_DomainError.hxx>
#include <XmlDrivers_MessageReportStorage.hxx>
//=======================================================================
@@ -147,11 +149,81 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
}
return 0;
}
di << "TDocStd_DumpCommand : Error\n";
std::cerr << "TDocStd_DumpCommand : Error\n";
return 1;
}
//=======================================================================
//function : DDocStd_ReadMessageReport
//=======================================================================
static Standard_Integer DDocStd_ReadMessageReport (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 2)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
TCollection_ExtendedString aFileName (theArgVec[1]);
Handle(Message_Report) aReport = Message::DefaultReport (Standard_False);
if (aReport.IsNull())
{
std::cerr << "Error: Message_Report is not created.\n";
return 0;
}
Handle(Message_ReportWriter) aWriter = aReport->MessageWriter();
if (aWriter.IsNull())
{
aWriter = new XmlDrivers_MessageReportStorage();
aWriter->SetFileName (aFileName);
aReport->SetMessageWriter (aWriter);
}
if (!aWriter->ImportReport (aReport))
{
std::cerr << "Error: Message_Report can not be exported in " << aFileName << ".\n";
return 0;
}
return 0;
}
//=======================================================================
//function : DDocStd_WriteMessageReport
//=======================================================================
static Standard_Integer DDocStd_WriteMessageReport (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 2)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
TCollection_ExtendedString aFileName (theArgVec[1]);
Handle(Message_Report) aReport = Message::DefaultReport (Standard_False);
if (aReport.IsNull())
{
std::cerr << "Error: Message_Report is not created.\n";
return 0;
}
Handle(Message_ReportWriter) aWriter = aReport->MessageWriter();
if (aWriter.IsNull())
{
aWriter = new XmlDrivers_MessageReportStorage();
aWriter->SetFileName (aFileName);
aReport->SetMessageWriter (aWriter);
}
if (!aWriter->ExportReport (aReport))
{
std::cerr << "Error: Message_Report can not be exported in " << aFileName << ".\n";
return 0;
}
return 0;
}
//=======================================================================
//function : ModificationCommands
@@ -174,5 +246,15 @@ void DDocStd::ToolsCommands(Draw_Interpretor& theCommands)
"DumpCommand (DOC)",
__FILE__, DDocStd_DumpCommand, g);
}
theCommands.Add ("ReadMessageReport",
"ReadMessageReport FileName"
"\nRestores content of the default Message_Report from the file. This file is an XML document."
"\nIt might be restored into report using ReadMessageReport."
__FILE__, DDocStd_ReadMessageReport, g);
theCommands.Add ("WriteMessageReport",
"WriteMessageReport FileName"
"\nStores the default Message_Report into a file. This is an XML document."
"\nIt might be restored into report using ReadMessageReport."
__FILE__, DDocStd_WriteMessageReport, g);
}

View File

@@ -425,6 +425,7 @@ void Draw_Appli(int argc, char** argv, const FDraw_InitAppli Draw_InitAppli)
// standard commands
// *****************************************************************
Draw::BasicCommands(theCommands);
Draw::MessageCommands(theCommands);
Draw::VariableCommands(theCommands);
Draw::UnitCommands(theCommands);
if (!Draw_Batch) Draw::GraphicCommands(theCommands);

View File

@@ -132,6 +132,9 @@ public:
//! Defines Draw basic commands
Standard_EXPORT static void BasicCommands (Draw_Interpretor& I);
//! Defines Draw message commands
Standard_EXPORT static void MessageCommands (Draw_Interpretor& I);
//! Defines Draw variables handling commands.
Standard_EXPORT static void VariableCommands (Draw_Interpretor& I);

View File

@@ -23,6 +23,7 @@
void Draw::Commands (Draw_Interpretor& theCommands)
{
Draw::BasicCommands(theCommands);
Draw::MessageCommands(theCommands);
Draw::VariableCommands(theCommands);
Draw::GraphicCommands(theCommands);
Draw::PloadCommands(theCommands);

View File

@@ -18,10 +18,6 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Bnd_OBB.hxx>
#include <Bnd_Box.hxx>
#include <Draw_Box.hxx>
// This file defines global functions not declared in any public header,
// intended for use from debugger prompt (Command Window in Visual Studio)
@@ -44,47 +40,3 @@ Standard_EXPORT const char* Draw_Eval (const char *theCommandStr)
return anException.GetMessageString();
}
}
//=======================================================================
//function : DBRep_SetOBB
//purpose : Draw OBB
//=======================================================================
Standard_EXPORT const char* Draw_SetOBB(const char* theNameStr, void* theBox)
{
if (theNameStr == 0 || theBox == 0)
{
return "Error: name or box is null";
}
try {
Bnd_OBB B = *(Bnd_OBB*)theBox;
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
Draw::Set (theNameStr, DB);
return theNameStr;
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
}
}
//=======================================================================
//function : DBRep_SetBox
//purpose : Draw Box
//=======================================================================
Standard_EXPORT const char* Draw_SetBox(const char* theNameStr, void* theBox)
{
if (theNameStr == 0 || theBox == 0)
{
return "Error: name or box is null";
}
try {
Bnd_Box B = *(Bnd_Box*)theBox;
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
Draw::Set (theNameStr, DB);
return theNameStr;
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
}
}

View File

@@ -0,0 +1,266 @@
// Copyright (c) 2020 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 <Draw.hxx>
#include <Draw_Printer.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Message_PrinterOStream.hxx>
#include <Message_PrinterSystemLog.hxx>
#include <Message_PrinterToReport.hxx>
#include <Message_Report.hxx>
#include <Standard_Dump.hxx>
//==============================================================================
//function : printerType
//purpose :
//==============================================================================
Standard_Boolean printerType (const TCollection_AsciiString& theTypeName,
Handle(Standard_Type)& theType)
{
if (theTypeName == "ostream")
{
theType = STANDARD_TYPE(Message_PrinterOStream);
}
else if (theTypeName == "systemlog")
{
theType = STANDARD_TYPE(Message_PrinterSystemLog);
}
else if (theTypeName == "report")
{
theType = STANDARD_TYPE(Message_PrinterToReport);
}
else if (theTypeName == "draw")
{
theType = STANDARD_TYPE(Draw_Printer);
}
else
return Standard_False;
return Standard_True;
}
//==============================================================================
//function : createPrinter
//purpose :
//==============================================================================
Handle(Message_Printer) createPrinter (const Handle(Standard_Type)& theType, Draw_Interpretor& theDI)
{
const Standard_CString aTypeName = theType->Name();
if (aTypeName == STANDARD_TYPE(Message_PrinterOStream)->Name())
{
return new Message_PrinterOStream();
}
else if (aTypeName == STANDARD_TYPE(Message_PrinterSystemLog)->Name())
{
return new Message_PrinterSystemLog ("draw_messages");
}
else if (aTypeName == STANDARD_TYPE(Message_PrinterToReport)->Name())
{
Handle(Message_PrinterToReport) aMessagePrinter = new Message_PrinterToReport();
const Handle(Message_Report)& aReport = Message::DefaultReport (Standard_True);
aMessagePrinter->SetReport (aReport);
return aMessagePrinter;
}
else if (aTypeName == STANDARD_TYPE(Draw_Printer)->Name())
{
return new Draw_Printer (theDI);
}
return Handle(Message_Printer)();
}
//==============================================================================
//function : SendMessage
//purpose :
//==============================================================================
static Standard_Integer SendMessage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 2)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
const Handle(Message_Messenger)& aMessenger = Message::DefaultMessenger();
Handle(Standard_Type) aPrinterType;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArg (theArgVec[anArgIter]);
anArg.LowerCase();
aMessenger->Send (anArg);
}
return 0;
}
//==============================================================================
//function : DumpMessenger
//purpose :
//==============================================================================
static Standard_Integer DumpMessenger (Draw_Interpretor& theDI, Standard_Integer, const char**)
{
Standard_SStream aStream;
const Handle(Message_Messenger)& aMessenger = Message::DefaultMessenger();
aMessenger->DumpJson (aStream);
theDI << "Message_Messenger\n";
theDI << Standard_Dump::FormatJson (aStream);
return 0;
}
//==============================================================================
//function : SetMessagePrinter
//purpose :
//==============================================================================
static Standard_Integer SetMessagePrinter (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 2)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
const Handle(Message_Messenger)& aMessenger = Message::DefaultMessenger();
Handle(Standard_Type) aPrinterType;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArg (theArgVec[anArgIter]);
anArg.LowerCase();
if (anArg == "-clear")
{
aMessenger->ChangePrinters().Clear();
}
else if (anArg == "-type"
&& anArgIter + 1 < theArgNb)
{
TCollection_AsciiString aVal (theArgVec[++anArgIter]);
if (!printerType (aVal, aPrinterType))
{
std::cout << "Syntax error: unknown printer type '" << aVal << "'\n";
return 1;
}
if (aMessenger->HasPrinter (aPrinterType))
continue;
aMessenger->AddPrinter (createPrinter (aPrinterType, theDI));
}
else
{
std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
return 1;
}
}
return 0;
}
//==============================================================================
//function : SetReportMetric
//purpose :
//==============================================================================
static Standard_Integer SetReportMetric(Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 1)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
const Handle(Message_Report)& aReport = Message::DefaultReport (Standard_True);
if (aReport.IsNull())
return 1;
aReport->ClearMetrics();
for (int i = 1; i < theArgNb; i++)
{
Standard_Integer aMetricId = Draw::Atoi (theArgVec[i]);
if (aMetricId < Message_MetricType_UserTimeCPU || aMetricId > Message_MetricType_MemHeapUsage)
{
std::cout << "Unrecognized message metric: " << aMetricId << std::endl;
return 1;
}
aReport->SetActiveMetric ((Message_MetricType)aMetricId, Standard_True);
}
return 0;
}
//==============================================================================
//function : PrintReport
//purpose :
//==============================================================================
static Standard_Integer PrintReport(Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb < 1)
{
std::cout << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
const Handle(Message_Report)& aReport = Message::DefaultReport (Standard_True);
if (aReport.IsNull())
return 1;
if (theArgNb > 1) // default messenger
{
aReport->SendMessages (Message::DefaultMessenger());
}
else // stream
{
Standard_SStream aSStream;
aReport->Dump (aSStream);
theDI << aSStream;
}
return 0;
}
void Draw::MessageCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean Done = Standard_False;
if (Done) return;
Done = Standard_True;
std::ios::sync_with_stdio();
const char* group = "DRAW Message Commands";
theCommands.Add("SetMessagePrinter",
"SetMessagePrinter [-type ostream|systemlog|report|draw] [-clear]"
"\n\t\t: Sets printer into messenger or remove all printers."
"\n : Option -type set type of printer. Printers are applyed with And combination."
"\n : Option -clear remove all printers in messenger",
__FILE__, SetMessagePrinter, group);
theCommands.Add("DumpMessenger",
"DumpMessenger"
"\n Prints DumpJson information about Messenger.\n",
__FILE__, DumpMessenger, group);
theCommands.Add("SendMessage",
"SendMessage text [text ...]"
"\n Sends the text into the messenger.\n",
__FILE__, SendMessage, group);
theCommands.Add("SetReportMetric", "SetReportMetric [metric...] \n Activate report metrics, deactivate all if there are no parameters.\n",
__FILE__, SetReportMetric, group);
theCommands.Add("PrintReport", "PrintReport [messenger] \n Send report content to default messenger or stream (if parameter is absent).\n",
__FILE__, PrintReport, group);
}

View File

@@ -15,6 +15,7 @@
#include <Draw_Printer.hxx>
#include <Standard_Dump.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
@@ -44,3 +45,12 @@ void Draw_Printer::send (const TCollection_AsciiString& theString,
*myTcl << theString << "\n";
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Draw_Printer::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
}

View File

@@ -32,6 +32,8 @@ public:
//! Creates a printer connected to the interpretor.
Standard_EXPORT Draw_Printer (Draw_Interpretor& theTcl);
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
protected:
//! Send a string message with specified trace level.

View File

@@ -43,6 +43,7 @@ Draw_Marker2D.hxx
Draw_Marker3D.cxx
Draw_Marker3D.hxx
Draw_MarkerShape.hxx
Draw_MessageCommands.cxx
Draw_Number.cxx
Draw_Number.hxx
Draw_PInterp.hxx

View File

@@ -0,0 +1,27 @@
// Created on: 1991-02-26
// Created by: Isabelle GRIGNON
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Extrema_ExtAlgo_HeaderFile
#define _Extrema_ExtAlgo_HeaderFile
enum Extrema_ExtAlgo
{
Extrema_ExtAlgo_Grad,
Extrema_ExtAlgo_Tree
};
#endif // _Extrema_ExtAlgo_HeaderFile

View File

@@ -17,16 +17,12 @@
#ifndef _Extrema_ExtFlag_HeaderFile
#define _Extrema_ExtFlag_HeaderFile
//! Enumeration describes the objective for extrema algorithms.
//! Generally:
//! - *Extrema_ExtFlag_MIN* - means that only minimal solutions are required
//! - *Extrema_ExtFlag_MAX* - means that only maximal solutions are required
//! - *Extrema_ExtFlag_MINMAX* - means that all solutions are required
enum Extrema_ExtFlag
{
Extrema_ExtFlag_MIN,
Extrema_ExtFlag_MAX,
Extrema_ExtFlag_MINMAX
Extrema_ExtFlag_MIN,
Extrema_ExtFlag_MAX,
Extrema_ExtFlag_MINMAX
};
#endif // _Extrema_ExtFlag_HeaderFile

View File

@@ -144,7 +144,7 @@ void Extrema_ExtPExtS::MakePreciser (Standard_Real& U,
}
//=============================================================================
Extrema_ExtPExtS::Extrema_ExtPExtS (const Handle (Extrema_GenExtPS)& theExtPS)
Extrema_ExtPExtS::Extrema_ExtPExtS()
: myuinf(0.0),
myusup(0.0),
mytolu(0.0),
@@ -153,8 +153,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const Handle (Extrema_GenExtPS)& theExtPS)
mytolv(0.0),
myIsAnalyticallyComputable(Standard_False),
myDone(Standard_False),
myNbExt(0),
myExtPS (theExtPS)
myNbExt(0)
{
}
@@ -167,8 +166,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
const Standard_Real theVmin,
const Standard_Real theVsup,
const Standard_Real theTolU,
const Standard_Real theTolV,
const Handle(Extrema_GenExtPS)& theExtPS)
const Standard_Real theTolV)
: myuinf(theUmin),
myusup(theUsup),
mytolu(theTolU),
@@ -178,8 +176,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
myS (theS),
myIsAnalyticallyComputable(Standard_False),
myDone(Standard_False),
myNbExt(0),
myExtPS (theExtPS)
myNbExt(0)
{
Initialize (theS,
theUmin,
@@ -196,8 +193,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt& theP,
const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
const Standard_Real theTolU,
const Standard_Real theTolV,
const Handle(Extrema_GenExtPS)& theExtPS)
const Standard_Real theTolV)
: myuinf(theS->FirstUParameter()),
myusup(theS->LastUParameter()),
mytolu(theTolU),
@@ -207,8 +203,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
myS (theS),
myIsAnalyticallyComputable(Standard_False),
myDone(Standard_False),
myNbExt(0),
myExtPS (theExtPS)
myNbExt(0)
{
Initialize (theS,
theS->FirstUParameter(),
@@ -258,18 +253,15 @@ void Extrema_ExtPExtS::Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtr
if (!myIsAnalyticallyComputable)
{
if (myExtPS.IsNull())
myExtPS = new Extrema_GenExtPS();
myExtPS->Initialize (theS->ChangeSurface(),
32,
32,
theUinf,
theUsup,
theVinf,
theVsup,
theTolU,
theTolV);
myExtPS.Initialize (theS->ChangeSurface(),
32,
32,
theUinf,
theUsup,
theVinf,
theVsup,
theTolU,
theTolV);
}
}
@@ -288,9 +280,11 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
myNbExt = 0;
if (!myIsAnalyticallyComputable) {
myExtPS->Perform(P);
myDone = myExtPS->IsDone();
myNbExt = myExtPS->NbExt();
myExtPS.Perform(P);
myDone = myExtPS.IsDone();
// modified by NIZHNY-EAP Wed Nov 17 12:59:08 1999 ___BEGIN___
myNbExt = myExtPS.NbExt();
// modified by NIZHNY-EAP Wed Nov 17 12:59:09 1999 ___END___
return;
}
@@ -449,8 +443,10 @@ Standard_Boolean Extrema_ExtPExtS::IsDone () const { return myDone; }
Standard_Integer Extrema_ExtPExtS::NbExt () const
{
if (!IsDone()) { throw StdFail_NotDone(); }
return myNbExt;
if (myIsAnalyticallyComputable)
return myNbExt;
else
return myExtPS.NbExt();
}
//=============================================================================
@@ -466,7 +462,7 @@ Standard_Real Extrema_ExtPExtS::SquareDistance (const Standard_Integer N) const
return mySqDist[N-1];
// modified by NIZHNY-MKK Thu Sep 18 14:48:42 2003.END
else
return myExtPS->SquareDistance(N);
return myExtPS.SquareDistance(N);
}
//=============================================================================
@@ -483,7 +479,7 @@ const Extrema_POnSurf& Extrema_ExtPExtS::Point (const Standard_Integer N) const
}
// modified by NIZHNY-MKK Thu Sep 18 14:47:43 2003.END
else
return myExtPS->Point(N);
return myExtPS.Point(N);
}
//=============================================================================

View File

@@ -50,21 +50,15 @@ class Extrema_ExtPExtS : public Standard_Transient
public:
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPExtS(const Handle(Extrema_GenExtPS)& theExtPS);
Standard_EXPORT Extrema_ExtPExtS();
//! It calculates all the distances between a point
//! from gp and a Surface.
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
//! It calculates all the distances between a point
//! from gp and a Surface.
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV);
//! Initializes the fields of the algorithm.
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
@@ -109,12 +103,13 @@ private:
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
gp_Vec myDirection;
gp_Ax2 myPosition;
Extrema_GenExtPS myExtPS;
Standard_Boolean myIsAnalyticallyComputable;
Standard_Boolean myDone;
Standard_Integer myNbExt;
Standard_Real mySqDist[4];
Extrema_POnSurf myPoint[4];
Handle(Extrema_GenExtPS) myExtPS;
};

View File

@@ -208,9 +208,7 @@ static Standard_Boolean IsExtremum (const Standard_Real U, const Standard_Real V
//purpose :
//=======================================================================
Extrema_ExtPRevS::Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS)
:
myExtPS (theExtPS)
Extrema_ExtPRevS::Extrema_ExtPRevS()
{
myvinf = myvsup = 0.0;
mytolv = Precision::Confusion();
@@ -235,10 +233,7 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
const Standard_Real theVmin,
const Standard_Real theVsup,
const Standard_Real theTolU,
const Standard_Real theTolV,
const Handle(Extrema_GenExtPS)& theExtPS)
:
myExtPS (theExtPS)
const Standard_Real theTolV)
{
Initialize (theS,
theUmin,
@@ -258,10 +253,7 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt& theP,
const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
const Standard_Real theTolU,
const Standard_Real theTolV,
const Handle(Extrema_GenExtPS)& theExtPS)
:
myExtPS (theExtPS)
const Standard_Real theTolV)
{
Initialize (theS,
theS->FirstUParameter(),
@@ -313,18 +305,15 @@ void Extrema_ExtPRevS::Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution
aNbv = 100;
}
if (myExtPS.IsNull())
myExtPS = new Extrema_GenExtPS();
myExtPS->Initialize (theS->ChangeSurface(),
aNbu,
aNbv,
theUmin,
theUsup,
theVmin,
theVsup,
theTolU,
theTolV);
myExtPS.Initialize (theS->ChangeSurface(),
aNbu,
aNbv,
theUmin,
theUsup,
theVmin,
theVsup,
theTolU,
theTolV);
}
}
//=======================================================================
@@ -337,11 +326,11 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
myDone = Standard_False;
myNbExt = 0;
if (!myIsAnalyticallyComputable)
{
myExtPS->Perform(P);
myDone = myExtPS->IsDone();
myNbExt = myExtPS->NbExt();
if (!myIsAnalyticallyComputable) {
myExtPS.Perform(P);
myDone = myExtPS.IsDone();
myNbExt = myExtPS.NbExt();
return;
}
@@ -566,7 +555,7 @@ Standard_Real Extrema_ExtPRevS::SquareDistance(const Standard_Integer N) const
if (myIsAnalyticallyComputable)
return mySqDist[N-1];
else
return myExtPS->SquareDistance(N);
return myExtPS.SquareDistance(N);
}
//=======================================================================
//function : Point
@@ -582,7 +571,7 @@ const Extrema_POnSurf& Extrema_ExtPRevS::Point(const Standard_Integer N) const
if (myIsAnalyticallyComputable)
return myPoint[N-1];
else
return myExtPS->Point(N);
return myExtPS.Point(N);
}

View File

@@ -45,21 +45,16 @@ class Extrema_ExtPRevS : public Standard_Transient
public:
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS = NULL);
Standard_EXPORT Extrema_ExtPRevS();
//! It calculates all the distances between a point
//! from gp and a SurfacePtr from Adaptor3d.
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
//! It calculates all the distances between a point
//! from gp and a SurfacePtr from Adaptor3d.
//! theExtPS is used to compute the solutions in case
//! it cannot be found analytically.
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV);
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
@@ -95,12 +90,13 @@ private:
Standard_Real myvsup;
Standard_Real mytolv;
gp_Ax2 myPosition;
Extrema_GenExtPS myExtPS;
Standard_Boolean myIsAnalyticallyComputable;
Standard_Boolean myDone;
Standard_Integer myNbExt;
Standard_Real mySqDist[8];
Extrema_POnSurf myPoint[8];
Handle(Extrema_GenExtPS) myExtPS;
};

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