FlightGear next
PolyLine.hxx
Go to the documentation of this file.
1
3
4// Written by James Turner, started 2013.
5//
6// Copyright (C) 2013 James Turner <zakalawe@mac.com>
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License as
10// published by the Free Software Foundation; either version 2 of the
11// License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22#ifndef FG_POLY_LINE_HXX
23#define FG_POLY_LINE_HXX
24
25#include <vector>
26
27#include <simgear/sg_inlines.h>
28#include <simgear/structure/SGSharedPtr.hxx>
29#include <simgear/math/SGMath.hxx>
30#include <simgear/math/SGBox.hxx>
31#include <simgear/math/SGGeometryFwd.hxx>
32
33namespace flightgear
34{
35
36typedef std::vector<SGGeod> SGGeodVec;
37
38class PolyLine;
39
40typedef SGSharedPtr<PolyLine> PolyLineRef;
41typedef std::vector<PolyLineRef> PolyLineList;
42
52class PolyLine : public SGReferenced
53{
54public:
55 virtual ~PolyLine();
56
57 enum Type
58 {
66 // airspace types in the future
68 };
69
70 Type type() const
71 { return m_type; }
72
76 unsigned int numPoints() const;
77
78 SGGeod point(unsigned int aIndex) const;
79
80 const SGGeodVec& points() const
81 { return m_data; }
82
89 static PolyLineList createChunked(Type aTy, const SGGeodVec& aRawPoints);
90
91 static PolyLineRef create(Type aTy, const SGGeodVec& aRawPoints);
92
93 static void bulkAddToSpatialIndex(PolyLineList::const_iterator begin,
94 PolyLineList::const_iterator end);
95
100 static PolyLineList linesNearPos(const SGGeod& aPos, double aRangeNm, Type aTy);
101
103 {
104 public:
105 virtual bool pass(Type aTy) const = 0;
106 };
107
108 static PolyLineList linesNearPos(const SGGeod& aPos, double aRangeNm, const TypeFilter& aFilter);
109
110 SGBoxd cartesianBox() const;
111
112 void addToSpatialIndex() const;
113
114private:
115
116 PolyLine(Type aTy, const SGGeodVec& aPoints);
117
118 Type m_type;
119 SGGeodVec m_data;
120
121};
122
123
124
125} // of namespace flightgear
126
127#endif
virtual bool pass(Type aTy) const =0
unsigned int numPoints() const
number of points in this line - at least two.
Definition PolyLine.cxx:49
void addToSpatialIndex() const
Definition PolyLine.cxx:112
SGGeod point(unsigned int aIndex) const
Definition PolyLine.cxx:54
static PolyLineList linesNearPos(const SGGeod &aPos, double aRangeNm, Type aTy)
retrieve all the lines within a range of a search point.
Definition PolyLine.cxx:143
@ RIVER
state / province / country / department
Definition PolyLine.hxx:63
@ REGIONAL_BOUNDARY
aka a border
Definition PolyLine.hxx:62
static void bulkAddToSpatialIndex(PolyLineList::const_iterator begin, PolyLineList::const_iterator end)
Definition PolyLine.cxx:103
Type type() const
Definition PolyLine.hxx:70
SGBoxd cartesianBox() const
Definition PolyLine.cxx:118
const SGGeodVec & points() const
Definition PolyLine.hxx:80
static PolyLineList createChunked(Type aTy, const SGGeodVec &aRawPoints)
create poly line objects from raw input points and a type.
Definition PolyLine.cxx:60
static PolyLineRef create(Type aTy, const SGGeodVec &aRawPoints)
Definition PolyLine.cxx:98
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53
std::vector< PolyLineRef > PolyLineList
Definition PolyLine.hxx:41
std::vector< SGGeod > SGGeodVec
Definition PolyLine.hxx:36
SGSharedPtr< PolyLine > PolyLineRef
Definition PolyLine.hxx:40