1
0
Fork 0

- I forgor to include my preliminary support to allow triangleJRS to return

success / failure.  I have some local changes to the lib to support it, but
  they aren't verified.  Checking in the support, that always returns success.
- allow clipper and GPC libraries to be included together.
  I need clipper for expanding polys, but I'm still using GPC for clipping.
This commit is contained in:
Peter Sadrozinski 2012-01-22 13:39:17 -05:00 committed by Christian Schmitt
parent 37a46c4075
commit 00afd0cb17
5 changed files with 9 additions and 32 deletions

View file

@ -273,9 +273,9 @@ void TGPolygon::shift( double lon, double lat ) {
void TGPolygon::write( const string& file ) const { void TGPolygon::write( const string& file ) const {
FILE *fp = fopen( file.c_str(), "w" ); FILE *fp = fopen( file.c_str(), "w" );
fprintf(fp, "%d\n", poly.size()); fprintf(fp, "%ld\n", poly.size());
for ( int i = 0; i < (int)poly.size(); ++i ) { for ( int i = 0; i < (int)poly.size(); ++i ) {
fprintf(fp, "%d\n", poly[i].size()); fprintf(fp, "%ld\n", poly[i].size());
for ( int j = 0; j < (int)poly[i].size(); ++j ) { for ( int j = 0; j < (int)poly[i].size(); ++j ) {
fprintf(fp, "%.6f %.6f\n", poly[i][j].x(), poly[i][j].y()); fprintf(fp, "%.6f %.6f\n", poly[i][j].x(), poly[i][j].y());
} }

View file

@ -55,43 +55,21 @@ class TGPolygon;
* when turned on * when turned on
*/ */
#define CLIP_NATIVE 0
#ifdef CLIP_GPC
extern "C" { extern "C" {
#include <gpc.h> #include <gpc.h>
} }
#if CLIP_NATIVE // optimization apparently causing errors
typedef gpc_polygon ClipPolyType;
#else
typedef TGPolygon ClipPolyType;
#endif
#endif /* CLIP_GPC */
#ifdef CLIP_CLIPPER
#include "clipper.hpp" #include "clipper.hpp"
using namespace ClipperLib; using namespace ClipperLib;
#if CLIP_NATIVE // optimization apparently causing errors
typedef Polygons ClipPolyType;
#else
typedef TGPolygon ClipPolyType;
#endif
#endif /* CLIP_CLIPPER */
#define FG_MAX_VERTICES 1500000 #define FG_MAX_VERTICES 1500000
typedef TGPolygon ClipPolyType;
typedef std::vector < point_list > polytype; typedef std::vector < point_list > polytype;
typedef polytype::iterator polytype_iterator; typedef polytype::iterator polytype_iterator;
typedef polytype::const_iterator const_polytype_iterator; typedef polytype::const_iterator const_polytype_iterator;
class TGPolygon { class TGPolygon {
private: private:

View file

@ -12945,7 +12945,7 @@ void statistics()
#ifdef TRILIBRARY #ifdef TRILIBRARY
void triangulate(triswitches, in, out, vorout) int triangulate(triswitches, in, out, vorout)
char *triswitches; char *triswitches;
struct triangulateio *in; struct triangulateio *in;
struct triangulateio *out; struct triangulateio *out;
@ -13261,7 +13261,6 @@ char **argv;
#endif /* not REDUCED */ #endif /* not REDUCED */
triangledeinit(); triangledeinit();
#ifndef TRILIBRARY
return 0; return 0;
#endif /* not TRILIBRARY */
} }

View file

@ -286,10 +286,10 @@ struct triangulateio {
}; };
#ifdef ANSI_DECLARATORS #ifdef ANSI_DECLARATORS
void triangulate(char *, struct triangulateio *, struct triangulateio *, int triangulate(char *, struct triangulateio *, struct triangulateio *,
struct triangulateio *); struct triangulateio *);
#else /* not ANSI_DECLARATORS */ #else /* not ANSI_DECLARATORS */
void triangulate(); int triangulate();
#endif /* not ANSI_DECLARATORS */ #endif /* not ANSI_DECLARATORS */

View file

@ -245,13 +245,13 @@ int main( int argc, char **argv ) {
geod = SGGeod::fromDegM( geod_nodes[i].x(), geod_nodes[i].y(), geod_nodes[i].z() ); geod = SGGeod::fromDegM( geod_nodes[i].x(), geod_nodes[i].y(), geod_nodes[i].z() );
SGVec3d cart = SGVec3d::fromGeod(geod); SGVec3d cart = SGVec3d::fromGeod(geod);
cout << cart << endl; cout << cart << endl;
wgs84_nodes.push_back( cart ); wgs84_nodes.push_back( cart );
} }
// bounding sphere // bounding sphere
SGBucket b( (x0 + x2) / 2, (y0 + y2) / 2 ); SGBucket b( (x0 + x2) / 2, (y0 + y2) / 2 );
SGSphered d; SGSphered d;
for ( i = 0; i < wgs84_nodes.size(); ++i ) { for ( i = 0; i < (int)wgs84_nodes.size(); ++i ) {
d.expandBy(wgs84_nodes[ i ]); d.expandBy(wgs84_nodes[ i ]);
} }