libosmscout 1.1.1
Loading...
Searching...
No Matches
LabelPath.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_MAP_SIMPLIFIEDPATH_H
2#define OSMSCOUT_MAP_SIMPLIFIEDPATH_H
3
4/*
5 This source is part of the libosmscout-map library
6 Copyright (C) 2017 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
24
25#include <vector>
26
27#include <osmscout/Pixel.h>
28
29namespace osmscout {
30 struct Segment
31 {
32 Vertex2D start;
33 double offset;
34 double length;
35 double angle;
36 };
37
44 {
45 private:
46 double length;
47 std::vector<Segment> segments;
48 std::vector<size_t> offsetIndex; // segment offset by length 100
49 double minSegmentLength;
50 Vertex2D end;
51 double endDistance;
52
53 public:
54 explicit LabelPath(double minSegmentLength=5);
55 virtual ~LabelPath();
56 void AddPoint(const Vertex2D& point);
57 double GetLength() const {
58 return length+endDistance;
59 }
60 Vertex2D PointAtLength(double offset) const;
61 double AngleAtLength(double offset) const;
62 double AngleAtLengthDeg(double offset) const;
63
75 bool TestAngleVariance(double startOffset, double endOffset, double maximumAngle) const;
76
77 private:
78 const Segment& SegmentBefore(double offset) const;
79 };
80}
81
82#endif /* OSMSCOUT_MAP_SIMPLIFIEDPATH_H */
#define OSMSCOUT_MAP_API
Definition MapImportExport.h:45
double AngleAtLength(double offset) const
bool TestAngleVariance(double startOffset, double endOffset, double maximumAngle) const
Vertex2D PointAtLength(double offset) const
void AddPoint(const Vertex2D &point)
LabelPath(double minSegmentLength=5)
double GetLength() const
Definition LabelPath.h:57
double AngleAtLengthDeg(double offset) const
Definition Area.h:39
Definition LabelPath.h:31
double offset
Definition LabelPath.h:33
double length
Definition LabelPath.h:34
double angle
Definition LabelPath.h:35
Vertex2D start
Definition LabelPath.h:32