swift
Loading...
Searching...
No Matches
interpolationrenderingsetup.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATIONRENDERINGSETUP_H
7#define SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATIONRENDERINGSETUP_H
8
9#include <QString>
10
12#include "misc/pq/angle.h"
13#include "misc/pq/length.h"
16#include "misc/valueobject.h"
17
18SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::simulation, CInterpolationAndRenderingSetupGlobal)
19SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::simulation, CInterpolationAndRenderingSetupPerCallsign)
20
21namespace swift::misc
22{
23 namespace network
24 {
25 class CClient;
26 }
27 namespace simulation
28 {
31 {
32 public:
35 {
36 IndexLogInterpolation = CPropertyIndexRef::GlobalIndexCInterpolatioRenderingSetup,
37 IndexSimulatorDebugMessages,
38 IndexForceFullInterpolation,
39 IndexSendGndFlagToSimulator,
40 IndexEnabledAircraftParts,
41 IndexInterpolatorMode,
42 IndexInterpolatorModeAsString,
43 IndexFixSceneryOffset,
44 IndexPitchOnGround
45 };
46
49 {
50 Spline,
51 Linear
52 };
53
56
59
61 bool logInterpolation() const { return m_logInterpolation; }
62
64 bool setLogInterpolation(bool log);
65
68
71
73 bool setEnabledAircraftParts(bool enabled);
74
76 bool maskEnabledAircraftParts(bool mask);
77
80
83
85 bool setSendingGndFlagToSimulator(bool sendFLag);
86
89
92
95
97 bool setPitchOnGround(const physical_quantities::CAngle &pitchOnGround);
98
100 void consolidateWithClient(const network::CClient &client);
101
104
107
109 bool setInterpolatorMode(InterpolatorMode mode);
110
112 bool setInterpolatorMode(const QString &mode);
113
115 QString convertToQString(bool i18n = false) const;
116
118 QVariant propertyByIndex(CPropertyIndexRef index) const;
119
121 void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
122
124 static const QString &modeToString(InterpolatorMode mode);
125
126 protected:
129
131 static bool canHandleIndex(int index);
132
133 bool m_logInterpolation = false;
137 bool m_sendGndToSim = true;
138 bool m_fixSceneryOffset = false;
139 int m_interpolatorMode = static_cast<int>(Spline);
142 };
143
146 public CValueObject<CInterpolationAndRenderingSetupGlobal>,
148 {
149 public:
152 {
153 IndexMaxRenderedAircraft = CInterpolationAndRenderingSetupBase::IndexFixSceneryOffset + 1,
154 IndexMaxRenderedDistance
155 };
156
159
161 static int InfiniteAircraft();
162
164 int getMaxRenderedAircraft() const;
165
167 bool setMaxRenderedAircraft(int maxRenderedAircraft);
168
171
174
176 bool isRenderingEnabled() const;
177
179 bool isRenderingRestricted() const;
180
182 physical_quantities::CLength getMaxRenderedDistance() const { return m_maxRenderedDistance; }
183
185 bool isMaxDistanceRestricted() const;
186
188 bool isMaxAircraftRestricted() const;
189
191 void clearAllRenderingRestrictions();
192
194 void disableRendering();
195
197 QString getRenderRestrictionText() const;
198
200 void setBaseValues(const CInterpolationAndRenderingSetupBase &baseValues);
201
203 QString convertToQString(bool i18n = false) const;
204
206 QVariant propertyByIndex(CPropertyIndexRef index) const;
207
209 void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
210
211 private:
212 int m_maxRenderedAircraft = InfiniteAircraft();
213 physical_quantities::CLength m_maxRenderedDistance { 0, nullptr };
214
216 CInterpolationAndRenderingSetupGlobal,
217 SWIFT_METAMEMBER(logInterpolation),
218 SWIFT_METAMEMBER(simulatorDebugMessages),
219 SWIFT_METAMEMBER(forceFullInterpolation),
220 SWIFT_METAMEMBER(sendGndToSim),
221 SWIFT_METAMEMBER(enabledAircraftParts),
222 SWIFT_METAMEMBER(fixSceneryOffset),
223 SWIFT_METAMEMBER(interpolatorMode),
224 SWIFT_METAMEMBER(pitchOnGround),
225 SWIFT_METAMEMBER(maxRenderedAircraft),
226 SWIFT_METAMEMBER(maxRenderedDistance));
227 };
228
231 public CValueObject<CInterpolationAndRenderingSetupPerCallsign>,
233 {
234 public:
237 {
238 IndexCallsign = CInterpolationAndRenderingSetupGlobal::IndexMaxRenderedDistance + 1
239 };
240
243
246 const CInterpolationAndRenderingSetupGlobal &globalSetup);
247
250
252 bool isEqualToGlobal(const CInterpolationAndRenderingSetupGlobal &globalSetup) const;
253
255 const aviation::CCallsign &getCallsign() const { return m_callsign; }
256
258 void setCallsign(const aviation::CCallsign &callsign) { m_callsign = callsign; }
259
261 bool isNull() const { return m_callsign.isEmpty(); }
262
264 QVariant propertyByIndex(CPropertyIndexRef index) const;
265
267 void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
268
271
272 private:
273 aviation::CCallsign m_callsign;
274
277 SWIFT_METAMEMBER(logInterpolation),
278 SWIFT_METAMEMBER(simulatorDebugMessages),
279 SWIFT_METAMEMBER(forceFullInterpolation),
280 SWIFT_METAMEMBER(sendGndToSim),
281 SWIFT_METAMEMBER(enabledAircraftParts),
282 SWIFT_METAMEMBER(fixSceneryOffset),
283 SWIFT_METAMEMBER(interpolatorMode),
284 SWIFT_METAMEMBER(pitchOnGround));
285 };
286 } // namespace simulation
287} // namespace swift::misc
288
292
293#endif // SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATIONRENDERINGSETUP_H
Value object encapsulating a list of property indexes.
Non-owning reference to a CPropertyIndex with a subset of its features.
Value object encapsulating information of a callsign.
Definition callsign.h:30
Another client software.
Definition client.h:27
Physical unit angle (radians, degrees).
Definition angle.h:23
Physical unit length (length).
Definition length.h:18
Value object for interpolator and rendering base class.
const physical_quantities::CAngle & getPitchOnGround() const
Force a given pitch on ground.
void setFixingSceneryOffset(bool fix)
Enable fix scenery offset if it has been detected.
physical_quantities::CAngle m_pitchOnGround
pitch angle on ground
static const QString & modeToString(InterpolatorMode mode)
Interpolator mode as string.
bool isFixingSceneryOffset() const
Fix scenery offset if it has been detected.
bool m_simulatorDebugMessages
Debug messages of simulator (aka plugin).
bool isAircraftPartsEnabled() const
Aircraft parts enabled (still requires the other aircraft to send parts).
bool m_forceFullInterpolation
always do a full interpolation, even if aircraft is not moving
void setSimulatorDebuggingMessages(bool debug)
Debugging messages for simulation.
bool showSimulatorDebugMessages() const
Debugging messages for simulation.
bool isForcingFullInterpolation() const
Full interpolation (skip optimizations like checking if aircraft moves etc.).
bool setMaxRenderedDistance(const physical_quantities::CLength &distance)
Max.distance for rendering.
physical_quantities::CLength getMaxRenderedDistance() const
Max.distance for rendering.
bool setMaxRenderedAircraft(int maxRenderedAircraft)
Max.number of aircraft rendered.
Value object for interpolator and rendering per callsign.
bool isEqualToGlobal(const CInterpolationAndRenderingSetupGlobal &globalSetup) const
Equal to global setup?
void setCallsign(const aviation::CCallsign &callsign)
Set callsign.
CPropertyIndexList unequalToGlobal(const CInterpolationAndRenderingSetupGlobal &globalSetup) const
Properties unequal to global setup.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition valueobject.h:65