libosmscout  1.1.1
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 #include <osmscout/Pixel.h>
25 
26 #include <vector>
27 
28 namespace osmscout {
29  struct Segment
30  {
31  Vertex2D start;
32  double offset;
33  double length;
34  double angle;
35  };
36 
43  {
44  private:
45  double length;
46  std::vector<Segment> segments;
47  std::vector<size_t> offsetIndex; // segment offset by length 100
48  double minSegmentLength;
49  Vertex2D end;
50  double endDistance;
51 
52  public:
53  LabelPath(double minSegmentLength=5);
54  virtual ~LabelPath();
55  void AddPoint(double x,double y);
56  inline double GetLength() const {
57  return length+endDistance;
58  }
59  Vertex2D PointAtLength(double offset) const;
60  double AngleAtLength(double offset) const;
61  double AngleAtLengthDeg(double offset) const;
62 
74  bool TestAngleVariance(double startOffset, double endOffset, double maximumAngle) const;
75 
76  private:
77  const Segment& SegmentBefore(double offset) const;
78  };
79 }
80 
81 #endif /* OSMSCOUT_MAP_SIMPLIFIEDPATH_H */
double angle
Definition: LabelPath.h:34
Vertex2D start
Definition: LabelPath.h:31
Definition: Area.h:38
double GetLength() const
Definition: LabelPath.h:56
Definition: LabelPath.h:29
double length
Definition: LabelPath.h:33
Definition: LabelPath.h:42
#define OSMSCOUT_MAP_API
Definition: MapImportExport.h:45
double offset
Definition: LabelPath.h:32