API Documentation
Loading...
Searching...
No Matches
StationModel.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: StationModel
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Model.h>
34#include <NDEVR/TextConstructor.h>
35#if NDEVR_STATION_MODEL
36namespace NDEVR
37{
38 class Text;
39 class TextConstructor;
40 class DesignObjectLookup;
41 /**--------------------------------------------------------------------------------------------------
42 \brief A Model which contains a single point marker that is easily adjusted by the end user.
43 **/
44 class NDEVR_DESIGN_API StationModel : public Model
45 {
46 public:
47 enum StationLayout
48 {
49 e_line
50 , e_spiral
51 , e_block
52 };
53 enum OrientationMode
54 {
55 e_none
56 , e_angle
57 , e_back_point
58 , e_two_point
59 };
60 public:
61 StationModel();
62 explicit StationModel(const Model& model, const DynamicPointer<TextConstructor>& text_constructor = DynamicPointer<TextConstructor>());
63 void hideGrid() {};
64 void setLocation(const Vector<3, fltp08>& location);
65 Vertex<3, fltp08> getLocation() const;
66 bool isRectangular() const;
67 bool isCircular() const;
68 void setRectangular(bool rectangular, const void* lock = nullptr);
69 void setPreferredSegmentDistance(fltp08 distance);
70 void setCircular(bool circular, const void* lock = nullptr);
71 void update(const void* lock_ptr = nullptr);
72 void update(DesignObjectLookup* lookup);
73 void setFont(const Font& font);
74 fltp08 preferredSegmentDistance() const;
75 fltp08 stationRadius() const;
76 Model stationLayer() const;
77 bool areAxisLabelsVisible() const;
78 bool areDistanceLabelsVisible() const;
79 bool isDistanceLineworkVisible() const;
80 bool isAxesLineworkVisible() const;
81 void setupRectangular();
82 void setupCircular();
83 void setTextFaceCamera(bool face_camera);
84 static TranslatedString DefaultStationName(uint04 station_number);
85 static StationModel CreateDefault(DesignObjectLookup* lookup);
86 static StationModel CreateDefault(Model& parent);
87 static StationModel CreateDefault(const Buffer<Model>& other_stations, Model parent = Model());
88 static Vertex<3, fltp08> CalculateDefaultLocation(const StationModel& new_station, const Buffer<Model>& other_stations, StationLayout layout = StationLayout::e_spiral, Vector<3, fltp08> starting_offset = DefaultStationLocation());
89 static Vertex<3, fltp08> DefaultStationLocation();
90 DynamicPointer<TextConstructor> textConstructor() const;
91 void ensureModelFormat();
92 Model stationVisuals() const;
93 Text stationTitle() const;
94 Model circles() const;
95 Model distanceText() const;
96 Model boldCircles() const;
97 Model axis() const;
98 Model azimuthModel();
99 Text text0Degree();
100 Text text90Degree();
101 Text text180Degree();
102 Text text270Degree();
103 const Text text0Degree() const;
104 const Text text90Degree() const;
105 const Text text180Degree() const;
106 const Text text270Degree() const;
107 Model rectangleRoot() const;
108 void invalidateVisuals(const void* lock = nullptr);
109 void invalidateFont(const void* lock = nullptr);
110 static constexpr const char* TypeName() { return "station"; }
111 //If parent is row type, return row, otherwise invalid model
112 Model getRow() const;
113 Model getPattern() const;
114 uint04 getRowNumber() const;
115 uint04 getHoleNumber() const;
116 void setRowNumber(uint04 number);
117 void setHoleNumber(uint04 number);
118 void setAllowHeadingAdjustment(bool allow);
119 bool allowHeadingAdjustment() const;
120 void setAllowPlannedDeployment(bool allow);
121 bool allowPlannedDeployment() const;
122 void setAllowRelativePosition(bool allow);
123 bool allowRelativePositionAdjustment() const;
124 private:
125 void setDistanceTextVisible(bool visible, const void* lock = nullptr);
126 void setTitleVisible(bool visible, const void* lock = nullptr);
127 void setAxesLabelsVisible(bool visible, const void* lock = nullptr);
128 void setDistanceLineworkVisible(bool visible, const void* lock = nullptr);
129 void setAxesLineworkVisible(bool visible, const void* lock = nullptr);
130 bool shouldShowTitle(bool is_selected) const;
131 bool shouldShowDistanceText(bool is_selected) const;
132 bool shouldShowDistanceLinework(bool is_selected) const;
133 bool shouldShowAxes(bool is_selected) const;
134 bool shouldShowAxesText(bool is_selected) const;
135 void updateVisualModels(bool is_selected, bool coord_space_changed, const Bounds<3, fltp08>& bounds, fltp08 station_radius, const void* lock_ptr);
136 void initializeStation();
137 void setupStationVisuals();
138 void updateTitle(const void* lock_ptr);
139 void updateAxisText();
140 void setupAxis();
141 uint04 circleGeoIndex() const;
142 void setupAzimuthModel();
143 void updateAllDistanceText(fltp08 station_radius, fltp08 epsilon, fltp08 text_size, bool force, bool selected);
144 void updateRings(fltp08 station_radius, fltp08 epsilon);
145 void updateRing(uint04 normal_index, fltp08 distance);
146 void updateBoldRing(uint04 bold_index, fltp08 distance);
147 void updateDistanceText(uint04 text_index, fltp08 distance, fltp08 bold_scale, bool make_bold, bool force);
148 private:
149 DynamicPointer<TextConstructor> m_text_constructor;
150 mutable uint04 m_circle_geometry_index;
151 mutable fltp08 m_preferred_segment_distance;
152
153 };
154}
155#endif
#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
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
@ e_line
Definition RangeSensor.h:41