0029807: [Regression to 7.0.0] Impossible to cut cone from prism
[occt.git] / tools / VInspector / VInspector_Tools.hxx
CommitLineData
14bbbdcb 1// Created on: 2017-06-16
2// Created by: Natalia ERMOLAEVA
3// Copyright (c) 2017 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef VInspector_Tools_H
17#define VInspector_Tools_H
18
19#include <AIS_InteractiveContext.hxx>
20#include <SelectMgr_EntityOwner.hxx>
21#include <Standard.hxx>
22#include <TCollection_AsciiString.hxx>
23#include <TopAbs_Orientation.hxx>
24#include <TopAbs_ShapeEnum.hxx>
25#include <TopLoc_Location.hxx>
26#include <TopoDS_Shape.hxx>
27
0cb512c0 28#include <inspector/VInspector_CallBackMode.hxx>
29#include <inspector/VInspector_SelectionType.hxx>
14bbbdcb 30
130eb114 31#include <Standard_WarningsDisable.hxx>
14bbbdcb 32#include <QList>
33#include <QVariant>
130eb114 34#include <Standard_WarningsRestore.hxx>
14bbbdcb 35
36//! \class VInspector_Tools
37//! The class that gives auxiliary methods for Visualization elements manipulation
38class VInspector_Tools
39{
40
41public:
42
43 //! Returns string value of enumeration value
44 //! \param theType a shape type
45 //! \return text value
46 Standard_EXPORT static TCollection_AsciiString GetShapeTypeInfo (const TopAbs_ShapeEnum& theType);
47
48 //! Convert pointer to string value
49 //! \param thePointer a pointer
50 //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
51 //! \return the string value
52 Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const Handle(Standard_Transient)& thePointer,
53 const bool isShortInfo);
54
55 //! Returns number of selected owners for presentation
56 //! \param theContext an interactive context
57 //! \param theObject a presentation
58 //! \param theShapeInfoOnly if true, only BRep owners are taken
59 Standard_EXPORT static int SelectedOwners (const Handle(AIS_InteractiveContext)& theContext,
60 const Handle(AIS_InteractiveObject)& theObject,
61 const bool theShapeInfoOnly);
62
63 //! Returns true if the owner is selected in the context
64 //! \param theContext an interactive context
65 //! \param theOwner a selectable owner
66 //! \return boolean value
67 Standard_EXPORT static bool IsOwnerSelected (const Handle(AIS_InteractiveContext)& theContext,
68 const Handle(SelectBasics_EntityOwner)& theOwner);
69
70 //! Returns all owners present in the context
71 //! \param theContext an interactive context
72 //! \return container of owners
73 Standard_EXPORT static NCollection_List<Handle(SelectBasics_EntityOwner)> ContextOwners (
74 const Handle(AIS_InteractiveContext)& theContext);
75
76 //! Returns active owners in main selector of context
77 //! \param theContext an interactive context
78 //! \param theEmptySelectableOwners container of owners with NULL presentation or not displayed presentation
79 //! \return container of owners
80 Standard_EXPORT static NCollection_List<Handle(SelectBasics_EntityOwner)> ActiveOwners (
81 const Handle(AIS_InteractiveContext)& theContext,
82 NCollection_List<Handle(SelectBasics_EntityOwner)>& theEmptySelectableOwners);
83
84 //! Unhighlight selected, set selected the owners
85 //! \param theContext an interactive context
86 //! \param theOwners a container of owners
87 Standard_EXPORT static void AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveContext)& theContext,
88 const NCollection_List<Handle(SelectBasics_EntityOwner)>& theOwners);
89
90 //! Unhighlight selected, set selected presentations
91 //! \param theContext an interactive context
92 //! \param thePresentations a container of presentations
93 Standard_EXPORT static void AddOrRemovePresentations (const Handle(AIS_InteractiveContext)& theContext,
94 const NCollection_List<Handle(AIS_InteractiveObject)>& thePresentations);
95
96 //! Returns information about presentation: Dynamic Type, Pointer info, Shape type info
97 //! \param theObject a presentation
98 //! \return container of values
99 Standard_EXPORT static QList<QVariant> GetInfo (Handle(AIS_InteractiveObject)& theObject);
100
101 //! Returns information about current highlight: Names, Owners, Pointers, Owners
102 //! \param theContext an interactive context
103 //! \return container of values
104 Standard_EXPORT static QList<QVariant> GetHighlightInfo (const Handle(AIS_InteractiveContext)& theContext);
105
106 //! Returns information about current selection: Names, Owners, Pointers, Owners
107 //! \param theContext an interactive context
108 //! \return container of values
109 Standard_EXPORT static QList<QVariant> GetSelectedInfo (const Handle(AIS_InteractiveContext)& theContext);
110
111 //! Returns the first pointer of selection in the context
112 Standard_EXPORT static QString GetSelectedInfoPointers (const Handle(AIS_InteractiveContext)& theContext);
113
114 //! Returns string information of call back mode
115 //! \param theMode type of selection
116 //! \param theValue a value in selection enumeration
117 //! \return information text
118 Standard_EXPORT static TCollection_AsciiString ToName (const VInspector_SelectionType theType, const int theValue);
119
120 //! Returns selection information
121 //! \param theMode a selection mode
122 //! \param thePresentation a presentation
123 //! \return text value
124 Standard_EXPORT static TCollection_AsciiString SelectionModeToName (int theMode, const Handle(AIS_InteractiveObject)& thePresentation);
125
126 //! Returns text of orientation
127 //! \param theOrientation an orientation value
128 //! \return text value
129 Standard_EXPORT static TCollection_AsciiString OrientationToName (const TopAbs_Orientation& theOrientation);
130
131 //! Returns text of orientation
132 //! \param theLocation a location value
133 //! \return text value
134 Standard_EXPORT static TCollection_AsciiString LocationToName (const TopLoc_Location& theLocation);
135
136 //! Read Shape using BREP reader
137 //! \param theFileName a file name
138 //! \return shape or NULL
139 Standard_EXPORT static TopoDS_Shape ReadShape (const TCollection_AsciiString& theFileName);
140};
141
142#endif