API Documentation
Loading...
Searching...
No Matches
SelectionController.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: SelectionController
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/SelectionArea.h>
34#include <NDEVR/SnapController.h>
35#if NDEVR_VIEWPORT
36namespace NDEVR
37{
38 enum SubSelectionMode
39 {
40 e_single_model
41 , e_vertex_rectangle_selection
42 , e_vertex_polygon_selection
43 , e_no_selection
44 , e_sub_selection_size
45 };
46
47 /**--------------------------------------------------------------------------------------------------
48 \brief Allows user to select data in a DesignObjectLookup
49 **/
50 class NDEVR_DESIGN_API SelectionController : public SnapController
51 {
52 public:
53 explicit SelectionController(DesignObjectLookup* manager);
54 virtual ~SelectionController(){}
55 virtual void begin() override;
56 virtual void finish() override;
57 virtual void cancel() override;
58 bool isInvertedSelection() const;
59 void setInvertedSelection(bool is_inside);
60 void setSubSelectionMode(const SubSelectionMode& mode);
61 uint04 addMask(const SelectionArea<3, fltp08>& mask);
62 uint04 addCurrentAsMask();
63 void setThemeCameraBackgroundColor(const RGBColor& color);//used if no default
64 void updateCameraBackgrounds();
65 void setCameraShowGrid(bool show_grid);
66 void setCameraShowEnvironment(bool show_grid);
67 void removeMask(uint04 mask_index);
68 void highlightMask(uint04 mask_index);
69 void clearMaskHighlight();
70
71 const Buffer<SelectionArea<3, fltp08>>& masks() const;
72 void setMaskEnabled(uint04 index, bool enabled);
73
74 void updateSelectionInfo();
75 SubSelectionMode subSelectionMode() const {return m_sub_selection_mode;}
76 TranslatedString defaultHint(const TranslatedString& action_hint) const;
77 String currentSelectionHint() const;
78 virtual bool processMouseEvent(const MouseEvent& mouse_event, DesignObjectLookup* lookup, Camera* camera) override;
79 virtual bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
80 //Returns true if the user has completed the selection
81 bool selectionComplete() const {return m_selection_complete;}
82 UUID currentSelection() const;
83 void clear(bool clear_selection, bool clear_masks);
84 void setHideMaskExclusion(bool is_hidden);
85 bool darkensMaskExclusion() const { return m_darken_mask_exclusion; }
86 void darkenMaskExclusion(bool darken);
87
88 void setPreModelFilter(const std::function<bool(const Model&)>& pre_model_filter);//Prevents testing for selection, returns true if should test
89 void setPreGeometryFilter(const std::function<bool(const Model&, const Geometry&)>& pre_geometry_filter);//Prevents testing for selection. returns true if should test
90 void setSelectionFilter(const std::function<bool(const Model&)>& selection_filter);//Once a selection is made, filters the appropriate parent, returns true if selectable
91 void setIsEditSelection(bool is_edit_selection);
92 protected:
93 void setSelectionMaskInfo(const SelectionInfo& info);
94 void updateSelectionMask();
95 void clearSelection();
96 void clearMasks();
97 protected:
98 UUID m_current_selection;
99 SelectionInfo m_selection_info;
100 SelectionInfo m_selection_mask_info;//Used only to select mask objects
101 SelectionInfo m_selection_highlight_info;//used to go back to old highlight
102 SubSelectionMode m_sub_selection_mode;
103 Buffer<UUID> m_last_mask_geometries;
104 Buffer<UUID> m_last_selection_geometries;
105 bool m_inverted_selection;
106 bool m_temp_inverted;
107 bool m_selection_complete;
108 bool m_is_edit_selection;
109 bool m_hide_mask_exclusion;
110 bool m_darken_mask_exclusion;
111 uint04 m_highlighted_mask;
112 };
113}
114#endif
115
116
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96