| 1 | /* |
| 2 | * SPDX-FileName: pavement.hxx |
| 3 | * SPDX-FileComment: class to represent complex taxiway specified in v850 apt.dat |
| 4 | * SPDX-FileCopyrightText: Copyright (C) 2009 Frederic Bouvier |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <Navaids/positioned.hxx> |
| 11 | |
| 12 | class FGPavement : public FGPositioned |
| 13 | { |
| 14 | public: |
| 15 | /* |
| 16 | * 111 = Node (simple point). |
| 17 | * 112 = Node with Bezier control point. |
| 18 | * 113 = Node (close loop) point (to close a pavement boundary). |
| 19 | * 114 = Node (close loop) point with Bezier control point (to close a pavement boundary). |
| 20 | * 115 = Node (end) point to terminate a linear feature (so has no descriptive codes). |
| 21 | * 116 = Node (end) point with Bezier control point, to terminate a linear feature (so has no descriptive codes). |
| 22 | */ |
| 23 | struct NodeBase : public SGReferenced { |
| 24 | SGGeod mPos; |
| 25 | bool mClose; |
| 26 | bool mLoop; |
| 27 | int mPaintCode; |
| 28 | int mLightCode; |
| 29 | virtual ~NodeBase() {} // To enable RTTI |
| 30 | }; |
| 31 | struct SimpleNode : public NodeBase //111,113,115 |
| 32 | { |
| 33 | SimpleNode(const SGGeod& aPos, bool aClose, bool aLoop, int aPaintCode, int aLightCode) |
| 34 | { |
| 35 | mPos = aPos; |
| 36 | mClose = aClose; |
| 37 | mLoop = aLoop; |
| 38 | mPaintCode = aPaintCode; |
| 39 | mLightCode = aLightCode; |
| 40 | } |
| 41 | }; |
| 42 | struct BezierNode : public NodeBase //112,114,116 |
| 43 | { |
| 44 | BezierNode(const SGGeod& aPos, const SGGeod& aCtrlPt, bool aClose, bool aLoop, int aPaintCode, int aLightCode) : mControl{aCtrlPt} |
| 45 | { |
| 46 | mPos = aPos; |
| 47 | mClose = aClose; |
| 48 | mLoop = aLoop; |
| 49 | mPaintCode = aPaintCode; |
| 50 | mLightCode = aLightCode; |
| 51 | } |
| 52 | SGGeod mControl; |
| 53 | }; |
| 54 | typedef std::vector<SGSharedPtr<NodeBase>> NodeList; |
| 55 | |
| 56 | |
| 57 | FGPavement(PositionedID aGuid, const std::string& aIdent, const SGGeod& aPos); |
| 58 | |
| 59 | void addNode(const SGGeod& aPos, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0); |
| 60 | void addBezierNode(const SGGeod& aPos, const SGGeod& aCtrlPt, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0); |
| 61 | |
| 62 | const NodeList& getNodeList() const { return mNodes; } |
| 63 | |
| 64 | |
| 65 | private: |
| 66 | NodeList mNodes; |
| 67 | }; |