1
0
Fork 0

Maintenance: pavement

SPDX tags.
header guard.
move initialization of mControl to the initializer-list.
This commit is contained in:
scttgs0 2023-05-22 23:29:09 -05:00
parent f107b459ec
commit 9f444afa39

View file

@ -1,32 +1,18 @@
// pavement.hxx - class to represent complex taxiway specified in v850 apt.dat
//
// Copyright (C) 2009 Frederic Bouvier
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
/*
* SPDX-FileName: pavement.hxx
* SPDX-FileComment: class to represent complex taxiway specified in v850 apt.dat
* SPDX-FileCopyrightText: Copyright (C) 2009 Frederic Bouvier
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef FG_PAVEMENT_HXX
#define FG_PAVEMENT_HXX
#pragma once
#include <Navaids/positioned.hxx>
class FGPavement : public FGPositioned
{
public:
/*
/*
* 111 = Node (simple point).
* 112 = Node with Bezier control point.
* 113 = Node (close loop) point (to close a pavement boundary).
@ -34,50 +20,48 @@ public:
* 115 = Node (end) point to terminate a linear feature (so has no descriptive codes).
* 116 = Node (end) point with Bezier control point, to terminate a linear feature (so has no descriptive codes).
*/
struct NodeBase : public SGReferenced
{
SGGeod mPos;
bool mClose;
bool mLoop;
int mPaintCode;
int mLightCode;
virtual ~NodeBase(){} // To enable RTTI
};
struct SimpleNode : public NodeBase //111,113,115
{
SimpleNode(const SGGeod &aPos, bool aClose, bool aLoop, int aPaintCode, int aLightCode) {
mPos = aPos;
mClose = aClose;
mLoop = aLoop;
mPaintCode = aPaintCode;
mLightCode = aLightCode;
}
};
struct BezierNode : public NodeBase //112,114,116
{
BezierNode(const SGGeod &aPos, const SGGeod &aCtrlPt, bool aClose, bool aLoop, int aPaintCode, int aLightCode) {
mPos = aPos;
mClose = aClose;
mLoop = aLoop;
mControl = aCtrlPt;
mPaintCode = aPaintCode;
mLightCode = aLightCode;
}
SGGeod mControl;
};
typedef std::vector<SGSharedPtr<NodeBase> > NodeList;
struct NodeBase : public SGReferenced {
SGGeod mPos;
bool mClose;
bool mLoop;
int mPaintCode;
int mLightCode;
virtual ~NodeBase() {} // To enable RTTI
};
struct SimpleNode : public NodeBase //111,113,115
{
SimpleNode(const SGGeod& aPos, bool aClose, bool aLoop, int aPaintCode, int aLightCode)
{
mPos = aPos;
mClose = aClose;
mLoop = aLoop;
mPaintCode = aPaintCode;
mLightCode = aLightCode;
}
};
struct BezierNode : public NodeBase //112,114,116
{
BezierNode(const SGGeod& aPos, const SGGeod& aCtrlPt, bool aClose, bool aLoop, int aPaintCode, int aLightCode) : mControl{aCtrlPt}
{
mPos = aPos;
mClose = aClose;
mLoop = aLoop;
mPaintCode = aPaintCode;
mLightCode = aLightCode;
}
SGGeod mControl;
};
typedef std::vector<SGSharedPtr<NodeBase>> NodeList;
FGPavement(PositionedID aGuid, const std::string& aIdent, const SGGeod& aPos);
FGPavement(PositionedID aGuid, const std::string& aIdent, const SGGeod& aPos);
void addNode(const SGGeod &aPos, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0);
void addBezierNode(const SGGeod &aPos, const SGGeod &aCtrlPt, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0);
void addNode(const SGGeod& aPos, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0);
void addBezierNode(const SGGeod& aPos, const SGGeod& aCtrlPt, bool aClose = false, bool aLoop = false, int paintCode = 0, int lightCode = 0);
const NodeList &getNodeList() const { return mNodes; }
const NodeList& getNodeList() const { return mNodes; }
private:
NodeList mNodes;
NodeList mNodes;
};
#endif // of FG_PAVEMENT_HXX