WSF
wizard/lib/source/map/Platform.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2018 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef PLATFORM_HPP
13#define PLATFORM_HPP
14
15#include <QString>
16#include <QTextCursor>
17
18#include "UtCallbackHolder.hpp"
19#include "ViExport.hpp"
20#include "WkfPlatform.hpp"
21#include "WsfPM_Platform.hpp"
22#include "route/WkfAttachmentRoute.hpp"
23#include "route/WkfRouteBrowserInterface.hpp"
24
25namespace wizard
26{
27class ProxyChange;
28class Editor;
29
31{
33 QString mRouteName;
34};
35
36class VI_EXPORT Platform : public wkf::Platform
37{
38public:
39 Platform(const std::string& aName, unsigned int aId, WsfPM_Platform& aPlatform);
40 ~Platform() override;
41
42 void GotoDefinition();
45 const WsfPM_Platform& GetPlatform() const noexcept { return mPlatform; }
48 WsfPM_Platform& GetPlatform() noexcept { return mPlatform; }
49 bool CheckPlatformDataChange(const QString& aDataName, const QString& aDataValue);
50 void PlatformInitialize();
51
52 void RemovePlatformFromEditor();
53 const std::vector<std::pair<Editor*, UtTextDocumentRange>> GetEditRanges();
54 void UpdateRoute(const wkf::RouteBrowserInterface::RouteInfo& aRouteInfo);
55
56 void AddNewRouteInText(const wkf::RouteBrowserInterface::RouteInfo& aRouteInfo);
57 void AddQueuedOperation(int aIndex, bool aIsInsertion)
58 {
59 mQueuedOperations.emplace_back(std::pair<int, bool>(aIndex, aIsInsertion));
60 }
61 void RemoveWaypointFromEditor(wkf::AttachmentRoute* aRoutePtr, int aWaypointIndex = -1);
62
66 const std::vector<unsigned int>& GetSelectedWaypoints() { return mSelectedWaypoints; }
67 void ClearSelectedWaypoints() { mSelectedWaypoints.clear(); }
70 void UpdateSelectedWaypoints(wkf::AttachmentRoute* aRoute) noexcept;
71 void HandleQueuedDeleteWaypoint();
72 void ResetDeletedIndex() { mWaitingForDelete = -1; }
73
78 UtTextDocumentRange GetAttributeDocumentRange(WsfPProxyNode aAttrNode);
82 UtTextDocumentRange GetAttributeRangeByName(const QString& aAttribute);
83 void AddWaypointToEditor(const wkf::RouteBrowserInterface::WaypointInfo& aWaypointInfo, const int aWaypointIndex = -1);
84
85 size_t GetDtedId() const { return mDtedId; }
86
89 bool PlatformHasMover() const noexcept;
90
93 bool IsRouteable() const noexcept;
94
97 bool PlatformHasRoute() const noexcept;
98
101 bool IsUsingGlobalRoute() const noexcept;
102
106 WsfPM_Route GetProxyRoute() const noexcept;
107
110 void Wrap() noexcept;
111
114 void Unwrap() noexcept;
115
118 bool IsWrapped() const noexcept;
119
120private:
121 void OnProxyModified(const ProxyChange& aProxyChange);
122 void OnGlobalRouteListChange(const wizard::ProxyChange& aProxyChange);
123 void ProxyUpdate();
124 void SetupGroupings();
125
126 bool CheckPositionChanged(const UtLatPos& aLatValue, const UtLonPos& aLonValue);
127 bool CheckLatitudeChanged(const QString& aDataValue);
128 bool CheckLongitudeChanged(const QString& aDataValue);
129 bool CheckAltitudeChanged(const QString& aDataValue);
133 bool CheckHeadingChanged();
137 bool IsValidUnitForHeading(const QString& aUnitStr) const noexcept;
138 bool CheckTypeChanged(const QString& aDataValue);
139
140 void AttributeChanged(const QString& aDataName, const QString& aDataValue);
141
142 void UpdatePlatformInTextEditor(const QString& aNewLine);
143 void AddNewAttributeInText(const QString& aAttributeName, const QString& aDataValue);
144
148 QString ConstructTextToAppendForPlatform(const QTextCursor& aStartCursor,
149 const QTextCursor& aEndCursor,
150 const QString& aAttributeName,
151 const QString& aDataValue) const noexcept;
152
153 void AddNewRouteInText(wkf::AttachmentRoute* aRoutePtr);
154 void UpdateTextRange();
155 void ReplaceTabs(QStringList& aList);
156
158 void UpdateEditorInfo() noexcept;
159
163 Editor* GetEditor() noexcept;
164
165 unsigned int mId;
166 WsfPM_Platform mPlatform;
167 size_t mDtedId;
168
169 Editor* mEditorPtr = nullptr;
170 Editor* mEditPlatformEditorPtr = nullptr;
171 std::string mFileName = "";
172 UtTextDocumentRange mPlatformTextRange;
173
174 UtCallbackHolder mProxyCallbacks;
175 bool mDirty;
176 bool mWrapped;
177 double mSimTime;
178 double mLastLat;
179 double mLastLon;
180
182 std::vector<std::pair<int, bool>> mQueuedOperations;
184 int mWaitingForDelete; // index of a waypoint scheduled for deletion, -1 if no such waypoint exists
185 std::vector<unsigned int> mSelectedWaypoints;
186};
187} // namespace wizard
188
189VA_DECLARE_OBJECT_TYPE(wizard::Platform)
190#endif
#define VI_EXPORT
Definition ViExport.hpp:38
Definition WsfPM_Platform.hpp:34
Definition WsfPM_Route.hpp:25
Definition WsfPProxyNode.hpp:60
Definition Editor.hpp:57
Definition wizard/lib/source/map/Platform.hpp:37
Platform(const std::string &aName, unsigned int aId, WsfPM_Platform &aPlatform)
Definition wizard/lib/source/map/Platform.cpp:66
size_t GetDtedId() const
Definition wizard/lib/source/map/Platform.hpp:85
void ResetDeletedIndex()
Definition wizard/lib/source/map/Platform.hpp:72
void ClearSelectedWaypoints()
Definition wizard/lib/source/map/Platform.hpp:67
void GotoDefinition()
Definition wizard/lib/source/map/Platform.cpp:1212
void AddQueuedOperation(int aIndex, bool aIsInsertion)
Definition wizard/lib/source/map/Platform.hpp:57
const std::vector< unsigned int > & GetSelectedWaypoints()
Definition wizard/lib/source/map/Platform.hpp:66
const WsfPM_Platform & GetPlatform() const noexcept
Definition wizard/lib/source/map/Platform.hpp:45
WsfPM_Platform & GetPlatform() noexcept
Definition wizard/lib/source/map/Platform.hpp:48
Records a change to proxy data.
Definition ProxyChange.hpp:21
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185
Definition Runner.hpp:22
Definition ActionManager.hpp:28
Definition wizard/lib/source/map/Platform.hpp:31
QString mPlatformName
Definition wizard/lib/source/map/Platform.hpp:32
QString mRouteName
Definition wizard/lib/source/map/Platform.hpp:33
Copyrights Multiple, All Rights Reserved