Skip to content

Commit d7f7bc1

Browse files
committed
A large set of changes that help allow WKT for int64_t type geometeries, modified some strategies, made it so that the clipper would use mapnik geometries.
1 parent edda6cb commit d7f7bc1

17 files changed

+849
-463
lines changed

deps/clipper/include/clipper.hpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#define clipper_hpp
3636

3737
#include <mapnik/config.hpp>
38+
#include <mapnik/geometry.hpp>
3839

3940
#define CLIPPER_VERSION "6.2.6"
4041

@@ -46,7 +47,7 @@
4647
//#define use_xyz
4748

4849
//use_lines: Enables line clipping. Adds a very minor cost to performance.
49-
//#define use_lines
50+
#define use_lines
5051

5152
//use_deprecated: Enables temporary support for the obsolete functions
5253
//#define use_deprecated
@@ -76,37 +77,41 @@ enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
7677
static cInt const loRange = 0x7FFF;
7778
static cInt const hiRange = 0x7FFF;
7879
#else
79-
typedef signed long long cInt;
80+
typedef std::int64_t cInt;
8081
static cInt const loRange = 0x3FFFFFFF;
8182
static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
82-
typedef signed long long long64; //used by Int128 class
83-
typedef unsigned long long ulong64;
83+
typedef std::int64_t long64; //used by Int128 class
84+
typedef std::uint64_t ulong64;
8485

8586
#endif
86-
87+
/*
8788
struct IntPoint {
88-
cInt X;
89-
cInt Y;
89+
cInt x;
90+
cInt y;
9091
#ifdef use_xyz
91-
cInt Z;
92+
cInt z;
9293
IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {};
9394
#else
94-
IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {};
95+
IntPoint(cInt x_ = 0, cInt y_ = 0): x(x_), y(y_) {};
9596
#endif
9697
9798
friend inline bool operator== (const IntPoint& a, const IntPoint& b)
9899
{
99-
return a.X == b.X && a.Y == b.Y;
100+
return a.x == b.x && a.y == b.y;
100101
}
101102
friend inline bool operator!= (const IntPoint& a, const IntPoint& b)
102103
{
103-
return a.X != b.X || a.Y != b.Y;
104+
return a.x != b.x || a.y != b.y;
104105
}
105-
};
106+
};*/
107+
108+
typedef mapnik::geometry::point<cInt> IntPoint;
109+
106110
//------------------------------------------------------------------------------
107111

108-
typedef std::vector< IntPoint > Path;
109-
typedef std::vector< Path > Paths;
112+
//typedef std::vector< IntPoint > Path;
113+
typedef mapnik::geometry::line_string<cInt> Path;
114+
typedef mapnik::geometry::multi_line_string<cInt> Paths;
110115

111116
inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;}
112117
inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;}
@@ -117,10 +122,10 @@ std::ostream& operator <<(std::ostream &s, const Paths &p);
117122

118123
struct DoublePoint
119124
{
120-
double X;
121-
double Y;
122-
DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
123-
DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
125+
double x;
126+
double y;
127+
DoublePoint(double x_ = 0, double y_ = 0) : x(x_), y(y_) {}
128+
DoublePoint(IntPoint ip) : x((double)ip.x), y((double)ip.y) {}
124129
};
125130
//------------------------------------------------------------------------------
126131

@@ -189,7 +194,7 @@ void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
189194

190195
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
191196
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
192-
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
197+
MAPNIK_DECL void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
193198

194199
void ReversePath(Path& p);
195200
void ReversePaths(Paths& p);

0 commit comments

Comments
 (0)