0029800: Upgrade Guide - TInspector correction documentation
[occt.git] / dox / user_guides / inspector / inspector.md
1 Inspector  {#occt_user_guides__inspector}
2 ===============================
3
4 @tableofcontents
5  
6 @section occt_inspector_1 Introduction
7
8 This manual explains how to use the Inspector.
9
10 @subsection occt_inspector_1_1 Overview
11 Inspector is a Qt-based library that provides functionality to interactively inspect low-level content of the OCAF data model, OCCT viewer and Modeling Data.
12 This component is aimed to assist the developers of OCCT-based applications to debug the problematic situations that occur in their applications.
13
14 Inspector has a plugin-oriented architecture. The current release contains the following plugins:
15
16 | Plugin | OCCT component | Root class of OCCT investigated component |
17 | :----- | :----- | :----- |
18 | @ref occt_inspector_2_2 "DFBrowser"| OCAF | *TDocStd_Application* |
19 | @ref occt_inspector_2_3 "VInspector"| Visualization | *AIS_InteractiveContext* |
20 | @ref occt_inspector_2_4 "ShapeView"| Modeling Data | *TopoDS_Shape* |
21
22
23 Each plugin implements logic of a corresponding OCCT component.
24
25 Each of the listed plugins is embedded in the common framework, thus it is possible to manage, which plugins should be loaded by the Inspector, and to extend their number by implementing a new plugin.
26
27
28 @subsection occt_inspector_1_3 Getting started
29
30 There are two launch modes:
31 1. Launch **TInspectorEXE** executable sample. For more details see @ref occt_inspector_4_1 "TInspectorEXE" section;
32 2. Launch DRAW, load plugin INSPECTOR, and use *tinspector* command.
33    For more details see @ref occt_inspector_4_2 "Launch in DRAW Test Harness" section.
34
35
36 Note. If you have no Inspector library in your build directory, please, make sure that OCCT is compiled with *BUILD_Inspector* 
37 option ON. For more details see @ref occt_inspector_5 "Build procedure".
38
39
40 @section occt_inspector_2 Inspector Plugins
41
42 @subsection occt_inspector_2_1 Overview
43
44 Inspector consists of the following components:
45   * <b>buttons</b> to activate the corresponding plugin;
46   * <b>view area</b> to visualize the plugin content.
47
48 @figure{tinspector_elements.svg,"Plugins placement in Inspector",360}
49
50 @subsection occt_inspector_2_2 DFBrowser Plugin
51
52 @subsubsection occt_inspector_2_2_1 Overview
53
54 @figure{dfbrowser.png, "DFBrowser"}
55
56 This plugin visualizes the content of *TDocStd_Application* in a tree view. It shows application documents, 
57 the hierarchy of *TDF_Labels*, the content of *TDF_Attributes* and interconnection between attributes (e.g. references).
58 Additionally there is a 3D view to visualize *TopoDS_Shape* elements stored in the document.
59
60 @subsubsection occt_inspector_2_2_2 Elements
61
62 @figure{dfbrowser_elements.svg, "DFBrowser Elements",360}
63
64 <b>OCAF tree view</b>
65
66 Each OCAF element has own tree view item:
67
68 | Type | Tree item | Text | Description |
69 | :----- | :----- | :----- | :----- |
70 | *TDocStd_Application* | Application | *TDocStd_Application* | The root of tree view. Its children are documents.|
71 | *TDocStd_Document* | Document | entry : name | A child of *Application* item. Its children are *Label* and *Attribute* items.<br> Text view is an entry of the root label and the value of *TDataStd_Name* attribute for the label if it exists. |
72 | *TDF_Label* | Label | entry : name | A child of a *Document* or another *Label* item. Its children and text view are the same as for Document item. |
73 | *TDF_Attribute* | Attribute | attribute type [additional information] | A child of a *Label*. It has no children. <br> Text view is the attribute type *(DynamicType()->Name()* of *TDF_Attribute*) and additional information (a combination of attribute values). |
74
75
76 Additional information about TDF_Attributes:
77
78 | Type | Text |
79 | :----- | :----- |
80 | *TDocStd_Owner* | [storage format] |
81 | *TDataStd_AsciiString*,<br> *TDataStd_Name*,<br> *TDataStd_Real*,<br> other *Simple* type attributes | [value] |
82 | *TDataStd_BooleanList*,<br> *TDataStd_ExtStringList*,<br> other *List* attributes | [value_1 ... value_n] |
83 | *TDataStd_BooleanArray*,<br> *TDataStd_ByteArray*,<br> other *Array* type attributes | [value_1 ... value_n] |
84 | *TDataStd_TreeNode* | [tree node ID  ==> Father()->Label()] (if it has a father) or <br> [tree node ID <== First()->Label()] (if it has NO father)|
85 | *TDataStd_TreeNode(XDE)* | [XDE tree node ID  ==> Father()->Label()] (if it has a father), <br> [XDE tree Node ID <== label_1, ..., label_n] (if it has NO father)|
86 | *TNaming_NamedShape* | [shape type : evolution] |
87 | *TNaming_UsedShapes* | [map extent] |
88
89
90 Custom color of items:
91
92 | OCAF element Type | Color |
93 | :----- | :----- |
94 | *TDF_Label* | <b>dark green</b>, if the label has *TDataStd_Name* attribute, <br><b>light grey</b> if the label is empty (has no attributes on all levels of  hierarchy),<br> <b>black</b> otherwise. |
95 | *TNaming_NamedShape* | <b>dark gray</b> for *TopAbs_FORWARD* orientation of *TopoDS_Shape*, <br> <b>gray</b> for *TopAbs_REVERSED* orientation of *TopoDS_Shape*, <br> <b>black</b> for other orientation. |
96
97
98 Context pop-up menu:
99 | Action | Functionality |
100 | :----- | :----- |
101 | Expand | Expands the next two levels under the selected item. |
102 | Expand All | Expands the whole tree of the selected item. |
103 | Collapse All | Collapses the whole tree of the selected item. |
104
105
106 <b>Property Panel</b>
107
108 Property panel is used to display the content of *Label* or *Attribute* tree view items or Search result view.
109 The information is usually shown in one or several tables.
110
111 *TDF_Attribute* has the following content in the Property Panel:
112
113 <table>
114 <tr><th>Type</th><th>Description</th><th>Content</th></tr>
115 <tr><td><i>TDF_Label</i></td>
116     <td> a table of [entry or attribute name, value]</td>
117     <td>@figure{property_panel_label.png, "",140}</td></tr>
118 <tr><td><i>TDocStd_Owner</i>,<br> Simple type attributes, <br> List type attributes</td>
119     <td>a table of [method name, value]</td>
120     <td>@figure{property_panel_simple_type.png, "",140}</td></tr>
121 <tr><td><i>TDataStd_BooleanArray</i>,<br> <i>TDataStd_ByteArray</i>,<br> other Array type attributes</td>
122     <td>2 controls: <br> - a table of [array bound, value], <br> - a table of [method name, value] </td>
123     <td>@figure{property_panel_array.png, "",140}</td></tr>
124 <tr><td><i>TDataStd_TreeNode</i></td>
125     <td>2 controls: <br> - a table of [Tree ID, value] (visible only if Tree ID() != ID() ), <br> - a tree view of tree nodes starting from *Root()* of the tree node. The current tree node has <b>dark blue</b> text.</td>
126     <td>@figure{property_panel_tree_node.png, "",140} </td></tr>
127 <tr><td><i>TDataStd_NamedData</i></td>
128     <td>tab bar of attribute elements, each tab has a table of [name, value]</td>
129     <td>@figure{property_panel_named_data.png, "",140}</td></tr>
130 <tr><td><i>TNaming_UsedShapes</i></td>
131     <td>a table of all shapes handled by the framework</td>
132     <td>@figure{property_panel_tnaming_used_shapes.png, "",140}</td></tr>
133 <tr><td><i>TNaming_NamedShape</i></td>
134     <td>2 controls: <br> - a table of [method name, value] including CurrentShape/OriginalShape methods result of <i>TNaming_Tools</i>, <br> - an evolution table. <br> Tables contain buttons for @ref occt_shape_export "TopoDS_Shape export".</td>
135     <td>@figure{property_panel_tnaming_named_shape.png, "",140}</td></tr>
136 <tr><td><i>TNaming_Naming</i></td>
137     <td>2 controls: <br> - a table of <i>TNaming_Name</i> values,<br> - a table of [method name, value]</td>
138     <td>@figure{property_panel_tnaming_naming.png, "",140}</td></tr>
139 </table>
140
141
142 <b>Dump view</b>
143
144 @figure{dump_attribute.png, "Dump of TDF_Attribute",200}
145
146 Dump view shows the result of <b>TDF_Attribute::Dump()</b> or <b>TDF_Label::Dump()</b> of the selected tree view item.
147
148 <b>3D view</b>
149
150 3D View visualizes *TopoDS_Shape* elements of OCAF attribute via AIS facilities.
151
152 DFBrowser creates two kinds of presentations depending on the selection place:
153
154 <table>
155 <tr><th>Kind</th><th>Source object</th><th>Visualization properties</th><th>View</th></tr>
156 <tr><td>Main presentation</td>
157     <td>Tree view item:<br> *TPrsStd_AISPresentation*,<br> *TNaming_NamedShape*,<br> *TNaming_Naming*</td>
158     <td>Color: a default color for shape type of the current *TopoDS_Shape*.</td>
159     <td>@figure{display_main_presentation.png, "",100}</td></tr>
160 <tr><td>Additional presentation</td>
161     <td>References in Property panel</td>
162     <td>Color: white</td>
163     <td>@figure{display_additional_presentation.png, "",100}</td></tr>
164 </table>
165
166
167
168 <b>Tree Navigation</b>
169
170 Tree Navigation shows a path to the item selected in the tree view.
171 The path is a sequence of label entries and attribute type names.
172 Each element in the path is selectable - simply click on it to select the corresponding tree view item.
173
174 Navigation control has buttons to go to the previous and the next selected tree view items.
175
176
177 <b>Update Button</b>
178
179 Update button synchronizes content of tree view to the current content of OCAF document that could be modified outside.
180
181 <b>Search</b>
182
183 The user can search OCAF element by typing:
184   * *TDF_Label* entry,
185   * *TDF_Attribute* name,
186   * *TDataStd_Name* and *TDataStd_Comment* attributes value.
187
188 @figure{search.png,"Search",360}
189
190 As soon as the user confirms the typed criteria, the Property panel is filled by all satisfied values.
191 The user can click a value to highlight the corresponding tree view item. By double click the item will be selected.
192
193
194 @subsubsection occt_inspector_2_2_3 Elements cooperation
195
196 <b>Tree item selection</b>
197
198 Selection of tree view item updates content of the following controls:
199   * Navigation line;
200   * Property Panel;
201   * 3D View (if it is possible to create an interactive presentation);
202   * Dump View.
203
204 @figure{dfbrowser_selection_in_tree_view.svg,"",360}
205
206 <b>Property Panel item selection </b>
207
208 If the property panel shows content of *TDF_Label*:
209   * selection of the table row highlights the corresponding item in the tree view,
210   * double click on the table row selects this item in the tree view.
211
212 If the property panel shows content of *TDF_Attribute* that has reference to another attribute, selection of this reference:
213   * highlights the referenced item in the tree view,
214   * displays additional presentation in the 3D view if it can be created.
215
216 @figure{property_panel_item_selection.svg,"",360}
217
218 Attributes having references:
219
220 | Type | Reference | Additional presentation
221 | :----- | :----- | :----- |
222 | *TDF_Reference* | *TDF_Label* | |
223 | *TDataStd_ReferenceArray*, <br> *TDataStd_ReferenceList*, <br> *TNaming_Naming* | One or several *TDF_Label* in a container. | |
224 | *TDataStd_TreeNode* | *TDF_Label* | |
225 | *TNaming_NamedShape* | *TDF_Label* in Evolution table |  *TopoDS_Shapes* selected in the property panel tables. |
226 | *TNaming_UsedShapes* | one or several *TNaming_NamedShape* | *TopoDS_Shapes* of the selected *TNaming_NamedShape*. |
227
228
229 @subsubsection occt_shape_export TopoDS_Shape export
230
231 Property panel of *TNaming_NamedShape* attribute has controls to export *TopoDS_Shape* to:
232   * BREP. **Save file** dialog is open to enter the result file name,
233   * @ref occt_inspector_2_4 "ShapeView" plugin. The dialog for exporting element to ShapeView allows activating this plugin immediately.
234
235
236 @subsection occt_inspector_2_3 VInspector Plugin
237
238 @subsubsection occt_inspector_2_3_1 Overview
239
240 @figure{vinspector.png, "VInspector",360}
241
242 This plugin visualizes interactive objects displayed in *AIS_InteractiveContext* in a tree view with computed selection
243 components for each presentation. It shows the selected elements in the context and allows selecting these elements.
244
245 @subsubsection occt_inspector_2_3_2 Elements
246
247 @figure{vinspector_elements.svg,"VInspector Elements",360}
248
249 <b>Presentations tree view</b>
250
251 This view shows presentations and selection computed on them. Also, the view has columns with information about the state of visualization elements.
252
253 VInspector tree items.
254
255 | Type | Description |
256 | :----- | :----- |
257 | *AIS_InteractiveContext* | The root of tree view. Its children are interactive objects obtained by *DisplayedObjects* and *ErasedObjects* methods.|
258 | *AIS_InteractiveObject* | A child of *AIS_InteractiveContext* item. Its children are *SelectMgr_Selection* obtained by iteration on *CurrentSelection*.  |
259 | *SelectMgr_Selection* | A child of *AIS_InteractiveObject*. Its children are *SelectMgr_SensitiveEntity* obtaining by iteration on *Sensitive*. |
260 | *SelectMgr_SensitiveEntity* | A child of *SelectMgr_Selection*. Its children are *SelectMgr_SensitiveEntity* obtaining by iteration on *OwnerId*. |
261 | *SelectBasics_EntityOwner* | A child of *SelectMgr_SensitiveEntity*. It has no children. |
262
263
264 Custom color of tree view items:
265
266 | OCAF element Type | Column | What | Color |
267 | :----- | :----- | :----- | :----- |
268 | *AIS_InteractiveObject* | 0 | Text | <b>dark gray</b> in *ErasedObjects* list of *AIS_InteractiveContext*,<br> <b>black</b> otherwise |
269 | *AIS_InteractiveObject*, <br> *SelectMgr_SensitiveEntity*, <br> *SelectBasics_EntityOwner*| 1 | Background | <b>dark blue</b>, if there is a selected owner under the item, <br> <b>black</b> otherwise |
270 | *SelectMgr_Selection*,<br> *SelectMgr_SensitiveEntity*,<br> *electBasics_EntityOwner* | all | Text | <b>dark gray</b>, if *SelectionState* of *SelectMgr_Selection* is not *SelectMgr_SOS_Activated*,<br> <b>black</b> otherwise |
271
272
273 Context popup menu in tree view:
274 | Action | Item | Functionality |
275 | :----- | :----- | :----- |
276 | Export to ShapeView | *AIS_InteractiveObject* | Exports *TopoDS_Shape* of the *AIS_Interactive* presentation to ShapeView plugin. <br> It should be *AIS_Shape* presentation and ShapeView plugin should be registered in Inspector<br> Dialog about exporting element to ShapeView is shown with a possibility to activate this plugin immediately. |
277 | Show | *AIS_InteractiveObject* | Displays presentation in *AIS_InteractiveContext*. |
278 | Hide | *AIS_InteractiveObject* | Erases presentation from *AIS_InteractiveContext*. |
279
280 <b>Update</b>
281
282 This button synchronizes the plugin content with the current state of *AIS_InteractiveContext* and updates the presence of items and their current selection.
283
284 <b>Selection controls</b>
285
286 Selection controls switch on/off the possibility to set selection in the context from VInspector plugin.
287
288 | Action | Tree view item | Functionality |
289 | :----- | :----- | :----- |
290 | Select Presentations | *AIS_InteractiveObject* | Calls *AddOrRemoveSelected* of interactive object for the selected item. |
291 | Select Owners | *SelectMgr_EntityOwner* or <br> *SelectMgr_SensitiveEntity* | Calls *AddOrRemoveSelected* of *SelectMgr_EntityOwner* for the selected item. |
292
293 Please, note that the initial selection in the context will be cleared.
294 If the button is toggled, the button selection is active. Only one button may be toggled at the moment.
295
296
297 <b>History view</b>
298
299 At present, the History view is under implementation and may be used only in a custom application where Inspector is loaded.
300
301 To fill this view, *VInspectorAPI_CallBack* should be redefined in the application and send signals about some actions applied to the context.
302 After that, the call back should be given as a parameter in the plugin.
303 If done, new items will be created in the history view for each action.
304
305 @subsubsection occt_inspector_2_3_3 Elements cooperation
306
307 *VInspector* marks the presentations currently selected in *AIS_InteractiveContext* with a blue background in tree items. Use **Update** button to synchronize VInspector selected items state to the context.
308
309 It is also possible to perform selection in the context using "Selection controls" VInspector feature. However, this operation should be performed carefully as
310 it clears the current selection in *AIS_InteractiveContext*.
311
312 Selection change:
313 | From | To | Action | Result |
314 | :----- | :----- | :----- | :----- |
315 | *AIS_InteractiveContext* | VInspector | Performs selection in *AIS_InteractiveContext*. | Click **Update** button in VInspector and check **Selection** column: <br> *AIS_InteractiveContext* item contains some selected objects, <br> the value of some *AIS_InteractiveObject* is filled if they are selected for this presentation or its entity owner. |
316 | VInspector | *AIS_InteractiveContext* | Activates one of Selection controls and selects one or several elements in the tree view. | The objects become selected in *AIS_InteractiveContext*. |
317
318 @subsubsection occt_inspector_2_3_4 VInspector tree view columns
319
320 Use context pop-up menu on the tree view header to select, which columns should be displayed.
321 @figure{vinspector_tree_columns.png, "Vinspector tree header context menu",360}
322
323 @subsection occt_inspector_2_4 ShapeView Plugin
324
325 @subsubsection occt_inspector_2_4_1 Overview
326
327 @figure{shapeview.png, "ShapeView",360}
328
329 This plugin visualizes content of *TopoDS_Shape* in a tree view.
330
331 @subsubsection occt_inspector_2_4_2 Elements
332
333 @figure{shapeview_elements.svg,"ShapeView Elements",360}
334
335 <b>TopoDS_Shape View</b>
336
337 The view elements are *TopoDS_Shape* objects.
338 The shape is exploded into sub-shapes using *TopoDS_Iterator* of the *TopoDS_Shape*.
339 Children sub-shapes are presented in the view as children of the initial shape.
340 By iterating recursively through all shapes we obtain a tree view of items shown in the ShapeView.
341
342 The columns of the View show some information about *TopoDS_Shape* of the item.
343 The first column allows changing the visibility of the item shape in the 3D view.
344
345 Context pop-up menu in tree view:
346 | Action | Functionality |
347 | :----- | :----- |
348 | Load BREP file | Opens the selected file and appends the resulting *TopoDS_Shape* into the tree view. |
349 | Remove all shape items | Clears tree view. |
350 | BREP view | Shows the text view with BREP content of the selected item. Creates the BREP file in a temporary directory of the plugin. |
351 | Close All BREP views | Closes all opened text views. |
352 | BREP directory | Displays the folder, where temporary BREP files have been stored. |
353
354 @subsubsection occt_inspector_2_4_3 Elements cooperation
355
356 Selection of one or several items in *TopoDS_Shape* View creates its *AIS_Shape* presentation and displays it in the 3D View.
357
358 @subsubsection occt_inspector_2_4_4 ShapeView tree view columns
359
360 Use context pop-up menu on the tree view header to select, which columns should be displayed.
361 @figure{shapeview_tree_columns.png, "ShapeView tree header context menu",360}
362
363
364 @section occt_inspector_3 Common controls
365
366 @subsection occt_inspector_3_1 Tree View
367
368 This control shows presentation hierarchy of the investigated OCCT element, e.g. *TDocStd_Application* for DFBrowser, see @ref occt_inspector_1_1 "Overview".
369 The first column contains the name, other columns are informative.
370
371 The tree view has a context menu with plugin-specific actions.
372
373 @subsubsection occt_inspector_3_1_1 Tree View preferences
374
375 It is possible to define visibility and width of columns.
376 This option is available in a view that contains more than one column,
377  e.g. @ref occt_inspector_2_3_4 "VInspector tree view columns"
378  and @ref occt_inspector_2_4_4 "ShapeView tree view columns".
379
380 @figure{treeview_preferences.svg, "Preferences schema",360}
381
382
383 @subsection occt_inspector_3_2 3D View
384
385 @subsubsection occt_inspector_3_2_1 Overview
386
387 @figure{3DView.png, "3D View",360}
388
389 This control for OCCT 3D viewer creates visualization view components and allows performing some user actions in the view.
390
391
392 @subsubsection occt_inspector_3_2_2 Elements
393
394 @figure{3DView_elements.svg,"3DView Elements",360}
395
396 3D View contains the following elements:
397 | Element | Functionality |
398 | :----- | :----- |
399 | 3D view | V3d viewer with mouse events processing. |
400 | Context | Allows choosing another context that should be used in the plugin. The following contexts are available:<br> **Own** - the context of this view, <br> **External** - the context of the @ref occt_inspector_4_3 "external application", which initializes the plugin, <br> **None** - the visualization is not performed at all (useful if the presentation is too complex). |
401 | Multi/Single | The buttons define what to do with the previously displayed objects: <br> **Multi** displays new presentations together with already displayed ones, <br> **Single** removes all previously displayed presentations. |
402 | Clean | Removes all displayed presentations. |
403 | Fit All,<br> Fit Area,<br> Zoom,<br> Pan,<br> Rotation | Scene manipulation actions<br> (Fit All is checkable. If checked(by double click), display/hide of new objects will perform **Fit All** of the scene.) |
404 | Display Mode | Sets *AIS_Shading* or *AIS_WireFrame* display mode for all presentations. |
405
406 Context popup menu:
407 | Action | Functionality |
408 | :----- | :----- |
409 | Set View Orientation | Shows the list of available *V3d_View* projections. Selection of an item with change the view. |
410
411 @figure{3DView_set_orientation.png,"Set view orientation",360}
412
413 @subsubsection occt_inspector_3_2_3 3D View preferences.
414 View preferences store the current view orientation.
415
416 @subsection occt_inspector_3_3 Preferences context menu
417
418 @figure{preferences.png,"Plugin preferences",360}
419
420 Context menu contains:
421 | Element | Functionality |
422 | :----- | :----- |
423 | Tree Level Line,<br> PropertyPanel,<br> Dump, <br> View| Names of dock widgets in the active plugin. If the button is checked, dock widget is visible. |
424 | Store Preferences | Creates ".tinspector.xml" preferences file with the current settings for each plugin.<br> This file is created in TEMP/TMP directory (by default) or in a user-defined directory. |
425 | Remove Preferences | Removes preferences file. After the Inspector is restarted, default values will be applied. |
426
427
428 The following controls have store/restore preferences:
429 | Element | Preferences |
430 | :----- | :----- |
431 | Geometry| Inspector window size and position. <br>State of dockable widgets : visibility, position, size.|
432 | @ref occt_inspector_3_1_1 "Tree View preferences"| Columns visible in the tree view and their width. |
433 | @ref occt_inspector_3_2_3 "3D View preferences"| 3D view camera direction. |
434
435 @section occt_inspector_4 Getting Started
436
437 @subsection occt_inspector_4_1 TInspectorEXE sample
438
439 This sample allows trying Inspector functionality.
440
441 Use *inspector.bat* script file placed in a binary directory of OCCT to launch it.
442
443 This script accepts the names of plugin's DLL that should be loaded. By default it loads all plugins described above.
444
445
446 @figure{TStandaloneEXE.png, "TStandaloneEXE",360}
447
448 Click on the Open button shows the dialog to select a file.
449 @figure{TStandaloneEXE_open.png, "",360}
450
451 Depending on the active plugin, it is possible to select the following files in the dialog:<br>
452 - DFBRowser: OCAF document or STEP files;
453 - VInspector: BREP files;
454 - ShapeView: BREP files.
455
456 Click the file name in the proposed directory and enter it manually or using **Browse** button.
457
458 By default, TInspectorEXE opens the following files for plugins:
459 | Plugin DLL library name | Files |
460 | :----- | :----- |
461 | TKDFBrowser | step/screw.step |
462 | TKVInspector | occ/hammer.brep |
463 | TKShapeView | occ/face1.brep, <br> occ/face2.brep |
464
465 These files are found relatively to *CSF_OCCTDataPath*.
466
467 @subsubsection occt_inspector_4_1_1 TInspectorEXE preferences
468 The application stores recently loaded files. On the application start, the last file is activated.
469 **Open file** dialog contains recently loaded files.
470 Selection of a new file updates the container of recently loaded files and rewrites preferences.
471
472 Source code of *TIspectorEXE* is a good sample for @ref occt_inspector_4_3 "using the Inspector in a custom application".
473
474 @subsection occt_inspector_4_2 How to launch the Inspector in DRAW Test Harness
475
476 *TKToolsDraw* plugin provides DRAW commands for Qt tools. Use *INSPECTOR* parameter of @ref occt_draw_1_3_3 "pload" 
477 command to download the commands of this library. It contains *tinspector* command to start Inspector under DRAW.
478 See more detailed description of the @ref occt_draw_13_1 "tinspector" command.
479
480 The simple code to start Inspector with all plugins loaded:
481
482 ~~~~~
483 pload INSPECTOR
484 tinspector
485 ~~~~~
486
487 @figure{drawexe_tinspector.png,"tinspector",360}
488
489 This command does the following:
490 - all available Plugins are presented in the Inspector. These are @ref occt_inspector_2_2 "DFBrowser", @ref occt_inspector_2_3 "VInspector" and  @ref occt_inspector_2_4 "ShapeView";
491 - DFBrowser is the active plugin;
492 - OCAF tree is empty.
493
494 After this, we should create objects in DRAW and update *tinspector*.
495 The examples of using Inspector in DRAW can be found in OCCT source directory /tests/tools.
496
497 @subsection occt_inspector_4_3 How to use the Inspector in a custom application
498
499 The example of using the Inspector in a custom application is presented in OCCT qt sample - <b>FuncDemo</b>.
500 For building qt samples, switch on *BUILD_SAMPLES_QT* variable in @ref build_cmake_conf "Configuration process".
501
502 In general, the following steps should be taken:
503 * Set dependencies to OCCT and Qt in the application (Header and Link);
504 * Create an instance of *TInspector_Communicator*;
505 * Register the plugins of interest in the communicator by DLL library name;
506 * Initialize the communicator with objects that will be investigated;
507 * Set visible true for the communicator.
508
509
510
511 Here is an example of C++ implementation:
512 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
513
514 #include <inspector/TInspector_Communicator.hxx>
515
516 static TInspector_Communicator* MyTCommunicator;
517
518 void CreateInspector()
519 {
520   NCollection_List<Handle(Standard_Transient)> aParameters;
521   //... append parameters in the list
522
523   if (!MyTCommunicator)
524   {
525     MyTCommunicator = new TInspector_Communicator();
526
527     MyTCommunicator->RegisterPlugin ("TKDFBrowser");
528     MyTCommunicator->RegisterPlugin ("TKVInspector");
529     MyTCommunicator->RegisterPlugin ("TKShapeView");
530
531     MyTCommunicator->Init (aParameters);
532     MyTCommunicator->Activate ("TKDFBrowser");
533   }
534   MyTCommunicator->SetVisible (true);
535 }
536 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
537
538 Give one the following objects for a plugin using a container of parameters:
539
540 | Plugin | to be initialized by |
541 | :----- | :----- |
542 | *TKDFBrowser* | *TDocStd_Application* |
543 | *TKVInspector* | *AIS_InteractiveContext* |
544 | *TKShapeView* | *TopoDS_TShape* |
545
546
547 @section occt_inspector_5 Build procedure
548
549
550 @subsection occt_inspector_5_1 Building with CMake within OCCT
551
552 By default the Inspector compilation is off.
553 To compile it, set the *BUILD_Inspector* flag to "ON". See @ref build_cmake_conf "Configuration process".
554
555 When this option is switched ON, MS Visual Studio project has an additional tree of folders:
556
557 @figure{VStudio_projects.png,"Inspector packages in MS Visual Studio",160}
558
559
560 @section occt_inspector_6 Sources and packaging
561
562 OCCT sources are extended by the /tools directory.
563
564 Distribution of plugin packages :
565 | Source packages | Plugin |
566 | :----- | :----- |
567 | *DFBrowser*, <br> *DFBrowserPane*, <br> *DFBrowserPaneXDE*, <br> *TKDFBrowser* | DFBrowser |
568 | *VInspector*, <br> *TKVInspector*  | VInspector |
569 | *ShapeView*, <br> *TKShapeView* | ShapeView |
570
571 Other packages:
572 | Source packages| Used in |
573 | :----- | :----- |
574 | *TInspectorAPI*, <br> *TKInspectorAPI* | Interface for connection to plugin. |
575 | *TreeModel*, <br> *TKTreeView* | Items-oriented model to simplify work with GUI tree control. |
576 | *View*, <br> *TKView* | 3D View component. |
577 | *TInspector*, <br> *TKTInspector*  | Inspector window, where plugins are placed. |
578 | *ToolsDraw*, <br> *TKToolsDraw* | Plugin for DRAW to start Inspector. |
579
580
581 In MSVC studio, a separate folder contains Inspector projects.
582
583 @section occt_inspector_7 Glossary
584 * **Component** -- a part of OCCT , e.g. OCAF, VISUALIZATION, MODELING and others. 
585 * **Plugin** -- a library that is loaded in some executable/library. Here, the plugins are:
586   * DFBrowser,
587   * ShapeView,
588   * VInspector.