[PATCH] Exporting mapserver's labelPoint() function to mapscript
Hello, while developing a mapscript application in ruby, i needed the
labelPoint() function into my application code: I am generating SVG polygons on
top of a mapserver-generated bitmap, and i need to place labels on these
polygons, and mapserver already implement the scanlines stuff in fast C code,
and i didn't want to reinvent the wheel :).
So, here it goes a small patch that adds a labelPoint() call to the Shape
object, defined in mapscript/swiginc/shape.i:
Maybe this could be useful to some other folk seeking for similar functionality.
Thank you for your software!
Marcello
--- shape.i.orig 2006-12-06 16:31:57.543102371 +0100
+++ shape.i 2006-12-06 16:32:33.498636299 +0100
@@ -172,6 +172,23 @@
return -1;
}
+ pointObj *labelPoint()
+ {
+ pointObj *point = (pointObj *)calloc(1, sizeof(pointObj));
+ if (point == NULL) {
+ msSetError(MS_MEMERR, "Failed to allocate memory for point",
"labelPoint()");
+ return NULL;
+ }
+
+ if(self->type == MS_SHAPE_POLYGON &&
+ msPolygonLabelPoint(self, point, -1) == MS_SUCCESS) {
+ return point;
+ }
+
+ free(point);
+ return NULL;
+ }
+
double distanceToPoint(pointObj *point)
{
return msDistancePointToShape(point, self); /* should there be a GEOS
version of this? */
Change History
(6)
Component: |
MapScript-SWIG → MapScript-PHP
|
Owner: |
changed from sdlime to mapserverbugs
|
Status: |
assigned → new
|
Version: |
4.10 → 5.0
|
Cc: |
mapserver-bugs@… added
|
Owner: |
changed from mapserverbugs to dmorissette
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|