Revision: 7300
http://playerstage.svn.sourceforge.net/playerstage/?rev=7300&view=rev
Author: thjc
Date: 2009-01-25 03:16:31 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
added a player geos wrapper so we can build with gcc 4.3
Modified Paths:
--------------
code/player/branches/release-2-1-patches/libplayercore/Makefile.am
code/player/branches/release-2-1-patches/server/drivers/vectormap/dbconn.cc
code/player/branches/release-2-1-patches/server/drivers/vectormap/vec2map.cc
Added Paths:
-----------
code/player/branches/release-2-1-patches/libplayercore/player_geos.h
Property Changed:
----------------
code/player/branches/release-2-1-patches/
Property changes on: code/player/branches/release-2-1-patches
___________________________________________________________________
Modified: svn:mergeinfo
- /code/player/trunk:7062,7081,7166-7169,7188,7207,7246
+ /code/player/trunk:7062,7081,7166-7169,7188,7207,7246,7297-7298
Modified: code/player/branches/release-2-1-patches/libplayercore/Makefile.am
===================================================================
--- code/player/branches/release-2-1-patches/libplayercore/Makefile.am
2009-01-25 02:59:56 UTC (rev 7299)
+++ code/player/branches/release-2-1-patches/libplayercore/Makefile.am
2009-01-25 03:16:31 UTC (rev 7300)
@@ -53,6 +53,7 @@
playerconfig.h \
playercore.h \
playertime.h \
+ player_geos.h \
plugins.h \
wallclocktime.h \
error.h \
Added: code/player/branches/release-2-1-patches/libplayercore/player_geos.h
===================================================================
--- code/player/branches/release-2-1-patches/libplayercore/player_geos.h
(rev 0)
+++ code/player/branches/release-2-1-patches/libplayercore/player_geos.h
2009-01-25 03:16:31 UTC (rev 7300)
@@ -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/branches/release-2-1-patches/server/drivers/vectormap/dbconn.cc
===================================================================
--- code/player/branches/release-2-1-patches/server/drivers/vectormap/dbconn.cc
2009-01-25 02:59:56 UTC (rev 7299)
+++ code/player/branches/release-2-1-patches/server/drivers/vectormap/dbconn.cc
2009-01-25 03:16:31 UTC (rev 7300)
@@ -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/branches/release-2-1-patches/server/drivers/vectormap/vec2map.cc
===================================================================
---
code/player/branches/release-2-1-patches/server/drivers/vectormap/vec2map.cc
2009-01-25 02:59:56 UTC (rev 7299)
+++
code/player/branches/release-2-1-patches/server/drivers/vectormap/vec2map.cc
2009-01-25 03:16:31 UTC (rev 7300)
@@ -1,6 +1,6 @@
/*
* Player - One Hell of a Robot Server
- * Copyright (C) 2004 Brian Gerkey [email protected]
+ * Copyright (C) 2004 Brian Gerkey [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@
- Default: ""
- Do not draw feature with that name on final grid map
-...@par Example
+...@par Example
@verbatim
driver
@@ -91,10 +91,8 @@
#include <pthread.h>
#include <libplayercore/playercore.h>
#ifdef HAVE_GEOS
-#ifndef GEOS_VERSION
-#include <geos_c.h>
+#include <player_geos.h>
#endif
-#endif
#define EPS 0.00001
#define MAXFABS(a, b) ((fabs(a) > fabs(b)) ? fabs(a) : fabs(b))
@@ -103,7 +101,7 @@
class Vec2Map : public Driver
{
- public:
+ public:
// Constructor; need that
Vec2Map(ConfigFile * cf, int section);
@@ -114,7 +112,7 @@
virtual int Shutdown();
// This method will be invoked on each incoming message
- virtual int ProcessMessage(QueuePointer & resp_queue,
+ virtual int ProcessMessage(QueuePointer & resp_queue,
player_msghdr * hdr,
void * data);
@@ -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);
@@ -223,7 +221,7 @@
////////////////////////////////////////////////////////////////////////////////
// Set up the device. Return 0 if things go well, and -1 otherwise.
int Vec2Map::Setup()
-{
+{
// Retrieve the handle to the vectormap device.
this->vectormap_dev = deviceTable->GetDevice(this->vectormap_addr);
if (!(this->vectormap_dev))
@@ -251,7 +249,7 @@
{
// Stop and join the driver thread
StopThread();
-
+
// Unsubscribe from the vectormap
this->vectormap_dev->Unsubscribe(this->InQueue);
@@ -260,7 +258,7 @@
////////////////////////////////////////////////////////////////////////////////
// Main function for device thread
-void Vec2Map::Main()
+void Vec2Map::Main()
{
struct timespec tspec;
@@ -271,7 +269,7 @@
this->InQueue->Wait();
pthread_testcancel();
-
+
// Process incoming messages
ProcessMessages();
@@ -283,9 +281,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;
@@ -411,10 +409,10 @@
if (over(static_cast<int>(x), 0, width)) break;
if (over(static_cast<int>(y), 0, height)) break;
cells[(static_cast<int>(y) * width) + (static_cast<int>(x))] = 1;
- }
+ }
}
-int Vec2Map::ProcessMessage(QueuePointer & resp_queue,
+int Vec2Map::ProcessMessage(QueuePointer & resp_queue,
player_msghdr * hdr,
void * data)
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit