Revision: 7541
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7541&view=rev
Author:   gbiggs
Date:     2009-03-24 18:50:06 +0000 (Tue, 24 Mar 2009)

Log Message:
-----------
Merged changeset 7300 from 2-1-patches to fix geos casting problems

Modified Paths:
--------------
    code/player/trunk/libplayercore/CMakeLists.txt
    code/player/trunk/server/drivers/vectormap/CMakeLists.txt
    code/player/trunk/server/drivers/vectormap/dbconn.cc
    code/player/trunk/server/drivers/vectormap/vec2map.cc

Added Paths:
-----------
    code/player/trunk/libplayercore/player_geos.h

Property Changed:
----------------
    code/player/trunk/


Property changes on: code/player/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/code/player/branches/release-2-1-patches:6672-6673,6738,6834,6886,6905,6930,6936,6946,6951,6955,6975,6979-6981,6985,6987-6996,7087-7088,7204,7226,7230,7248,7250-7252,7256,7262-7263,7276
/code/player/trunk:6985
   + 
/code/player/branches/release-2-1-patches:6672-6673,6738,6834,6886,6905,6930,6936,6946,6951,6955,6975,6979-6981,6985,6987-6996,7087-7088,7204,7226,7230,7248,7250-7252,7256,7262-7263,7276,7300
/code/player/trunk:6985

Modified: code/player/trunk/libplayercore/CMakeLists.txt
===================================================================
--- code/player/trunk/libplayercore/CMakeLists.txt      2009-03-24 15:56:04 UTC 
(rev 7540)
+++ code/player/trunk/libplayercore/CMakeLists.txt      2009-03-24 18:50:06 UTC 
(rev 7541)
@@ -130,6 +130,7 @@
                                    playercommon.h
                                    ${playerconfig_h}
                                    playercore.h
+                                   player_geos.h
                                    player.h
                                    ${player_interfaces_h}
                                    playertime.h

Copied: code/player/trunk/libplayercore/player_geos.h (from rev 7300, 
code/player/branches/release-2-1-patches/libplayercore/player_geos.h)
===================================================================
--- code/player/trunk/libplayercore/player_geos.h                               
(rev 0)
+++ code/player/trunk/libplayercore/player_geos.h       2009-03-24 18:50:06 UTC 
(rev 7541)
@@ -0,0 +1,18 @@
+#ifndef PLAYER_GEOS_H_
+#define PLAYER_GEOS_H_
+
+#ifndef GEOS_VERSION_MAJOR
+#include <stddef.h>
+#include <geos_c.h>
+#endif
+
+// workaround gcc 4.2's confusion over typedeffed constants
+#if GEOS_VERSION_MAJOR >= 3
+typedef const struct GEOSCoordSeq_t * const_GEOSCoordSeq;
+typedef const struct GEOSGeom_t * const_GEOSGeom;
+#else
+typedef struct GEOSCoordSeq_t * const_GEOSCoordSeq;
+typedef struct GEOSGeom_t * const_GEOSGeom;
+#endif
+
+#endif /* PLAYER_GEOS_H_ */

Modified: code/player/trunk/server/drivers/vectormap/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/vectormap/CMakeLists.txt   2009-03-24 
15:56:04 UTC (rev 7540)
+++ code/player/trunk/server/drivers/vectormap/CMakeLists.txt   2009-03-24 
18:50:06 UTC (rev 7541)
@@ -13,11 +13,11 @@
 
 IF (HAVE_GEOS)
     IF (HAVE_STL)
-        PLAYERDRIVER_OPTION (vec2map build_vec2map OFF "const problems to be 
fixed soon (I hope)")
+        PLAYERDRIVER_OPTION (vec2map build_vec2map ON)
     ELSE (HAVE_STL)
         PLAYERDRIVER_OPTION (vec2map build_vec2map OFF "STL not found")
     ENDIF (HAVE_STL)
 ELSE (HAVE_GEOS)
     PLAYERDRIVER_OPTION (vec2map build_vec2map OFF "Geos not found")
 ENDIF (HAVE_GEOS)
-PLAYERDRIVER_ADD_DRIVER (vec2map build_vec2map LINKFLAGS "-lgeos" SOURCES 
vec2map.cc)
+PLAYERDRIVER_ADD_DRIVER (vec2map build_vec2map LINKFLAGS "-lgeos -lgeos_c" 
SOURCES vec2map.cc)

Modified: code/player/trunk/server/drivers/vectormap/dbconn.cc
===================================================================
--- code/player/trunk/server/drivers/vectormap/dbconn.cc        2009-03-24 
15:56:04 UTC (rev 7540)
+++ code/player/trunk/server/drivers/vectormap/dbconn.cc        2009-03-24 
18:50:06 UTC (rev 7541)
@@ -6,10 +6,8 @@
 #include <cctype>
 #include "dbconn.h"
 #ifdef HAVE_GEOS
-#ifndef GEOS_VERSION_MAJOR
-#include <geos_c.h>
+#include <libplayercore/player_geos.h>
 #endif
-#endif
 
 using namespace std;
 
@@ -69,7 +67,7 @@
     cerr << "No extent value found." << endl;
     cerr << "GetVectorMapInfo() failed" << endl;
   }
- 
+
   uint32_t length = PQgetlength(res, 0, 0);
   uint8_t * wkb = new uint8_t[length];
   assert(wkb);
@@ -280,7 +278,7 @@
       }
       if (PQresultStatus(res) != PGRES_COMMAND_OK) PLAYER_ERROR1("%s", 
PQresultErrorMessage(res));
       PQclear(res);
-      return -1;      
+      return -1;
     }
     PQclear(res);
   }
@@ -314,13 +312,13 @@
     printf("GEOSGeomFromWKB_buf returned NULL!\n");
     return res;
   }
-  GEOSGeom linestring = GEOSGetExteriorRing(polygon);
+  const_GEOSGeom linestring = GEOSGetExteriorRing(polygon);
   if (linestring == NULL)
   {
     printf("GEOSGetExteriorRing returned NULL!\n");
     return res;
   }
-  GEOSCoordSeq coords = GEOSGeom_getCoordSeq(linestring);
+  const_GEOSCoordSeq coords = GEOSGeom_getCoordSeq(linestring);
   if (coords == NULL)
   {
     printf("GEOSGeom_getCoordSeq returned NULL!\n");

Modified: code/player/trunk/server/drivers/vectormap/vec2map.cc
===================================================================
--- code/player/trunk/server/drivers/vectormap/vec2map.cc       2009-03-24 
15:56:04 UTC (rev 7540)
+++ code/player/trunk/server/drivers/vectormap/vec2map.cc       2009-03-24 
18:50:06 UTC (rev 7541)
@@ -91,10 +91,8 @@
 #include <pthread.h>
 #include <libplayercore/playercore.h>
 #ifdef HAVE_GEOS
-#ifndef GEOS_VERSION
-#include <geos_c.h>
+#include <libplayercore/player_geos.h>
 #endif
-#endif
 
 #define EPS 0.00001
 #define MAXFABS(a, b) ((fabs(a) > fabs(b)) ? fabs(a) : fabs(b))
@@ -124,7 +122,7 @@
 
     // some helper functions
 #ifdef HAVE_GEOS
-    void dumpFeature(GEOSGeom geom, vector<player_segment_t> & segments);
+    void dumpFeature(const_GEOSGeom geom, vector<player_segment_t> & segments);
 #endif
     void line(int a, int b, int c, int d, int8_t * cells, int maxx, int maxy);
     int over(int x, int min, int max);
@@ -274,9 +272,9 @@
 }
 
 #ifdef HAVE_GEOS
-void Vec2Map::dumpFeature(GEOSGeom geom, vector<player_segment_t> & segments)
+void Vec2Map::dumpFeature(const_GEOSGeom geom, vector<player_segment_t> & 
segments)
 {
-    GEOSCoordSeq seq;
+    const_GEOSCoordSeq seq;
     double x0, y0, x1, y1;
     unsigned int numcoords;
     player_segment_t segment;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to