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 class NDEVR_DESIGN_API SelectionController : public SnapController
47 {
48 public:
49 explicit SelectionController(DesignObjectLookup* manager);
50 virtual ~SelectionController(){}
51 virtual void begin() override;
52 virtual void finish() override;
53 virtual void cancel() override;
54 bool isInvertedSelection() const;
55 void setInvertedSelection(bool is_inside);
56 void setSubSelectionMode(const SubSelectionMode& mode);
57 uint04 addMask(const SelectionArea<3, fltp08>& mask);
58 uint04 addCurrentAsMask();
59 void setThemeCameraBackgroundColor(const RGBColor& color);//used if no default
60 void updateCameraBackgrounds();
61 void setCameraShowGrid(bool show_grid);
62 void setCameraShowEnvironment(bool show_grid);
63 void removeMask(uint04 mask_index);
64 void highlightMask(uint04 mask_index);
65 void clearMaskHighlight();
66
67 const Buffer<SelectionArea<3, fltp08>>& masks() const;
68 void setMaskEnabled(uint04 index, bool enabled);
69
70 void updateSelectionInfo();
71 SubSelectionMode subSelectionMode() const {return m_sub_selection_mode;}
72 TranslatedString defaultHint(const TranslatedString& action_hint) const;
73 String currentSelectionHint() const;
74 virtual bool processMouseEvent(const MouseEvent& mouse_event, DesignObjectLookup* lookup, Camera* camera) override;
75 virtual bool processKeyEvent(const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera) override;
76 //Returns true if the user has completed the selection
77 bool selectionComplete() const {return m_selection_complete;}
78 UUID currentSelection() const;
79 void clear(bool clear_selection, bool clear_masks);
80 void setHideMaskExclusion(bool is_hidden);
81 bool darkensMaskExclusion() const { return m_darken_mask_exclusion; }
82 void darkenMaskExclusion(bool darken);
83
84 void setPreModelFilter(const std::function<bool(const Model&)>& pre_model_filter);//Prevents testing for selection, returns true if should test
85 void setPreGeometryFilter(const std::function<bool(const Model&, const Geometry&)>& pre_geometry_filter);//Prevents testing for selection. returns true if should test
86 void setSelectionFilter(const std::function<bool(const Model&)>& selection_filter);//Once a selection is made, filters the appropriate parent, returns true if selectable
87 void setIsEditSelection(bool is_edit_selection);
88 protected:
89 void setSelectionMaskInfo(const SelectionInfo& info);
90 void updateSelectionMask();
91 void clearSelection();
92 void clearMasks();
93 protected:
94 UUID m_current_selection;
95 SelectionInfo m_selection_info;
96 SelectionInfo m_selection_mask_info;//Used only to select mask objects
97 SelectionInfo m_selection_highlight_info;//used to go back to old highlight
98 SubSelectionMode m_sub_selection_mode;
99 Buffer<UUID> m_last_mask_geometries;
100 Buffer<UUID> m_last_selection_geometries;
101 bool m_inverted_selection;
102 bool m_temp_inverted;
103 bool m_selection_complete;
104 bool m_is_edit_selection;
105 bool m_hide_mask_exclusion;
106 bool m_darken_mask_exclusion;
107 uint04 m_highlighted_mask;
108 };
109}
110#endif
111
112
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
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:120