[mapserver-commits] r9359 - in trunk/mapserver: . mapscript/php3
svn at osgeo.org
svn at osgeo.org
Wed Sep 30 23:27:56 EDT 2009
Author: dmorissette
Date: 2009-09-30 23:27:54 -0400 (Wed, 30 Sep 2009)
New Revision: 9359
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapscript/php3/php_mapscript.c
Log:
Added layer.resultsGetShape() to PHP MapScript for use with single pass queries (#3069)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-09-30 22:40:19 UTC (rev 9358)
+++ trunk/mapserver/HISTORY.TXT 2009-10-01 03:27:54 UTC (rev 9359)
@@ -16,6 +16,8 @@
- Fixed a couple of issues with Oracle Spatial and single pass queries (#3069)
+- Added layer.resultsGetShape() to PHP MapScript for use with queries (#3069)
+
- Fixed query maps under the new single pass query process (#3069)
- WFS Client seg fault (OGR layer not opened) (#3136)
Modified: trunk/mapserver/mapscript/php3/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.c 2009-09-30 22:40:19 UTC (rev 9358)
+++ trunk/mapserver/mapscript/php3/php_mapscript.c 2009-10-01 03:27:54 UTC (rev 9359)
@@ -211,6 +211,7 @@
DLEXPORT void php3_ms_lyr_close(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_lyr_getShape(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_lyr_getFeature(INTERNAL_FUNCTION_PARAMETERS);
+DLEXPORT void php3_ms_lyr_resultsGetShape(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_lyr_getExtent(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_lyr_getMetaData(INTERNAL_FUNCTION_PARAMETERS);
DLEXPORT void php3_ms_lyr_setMetaData(INTERNAL_FUNCTION_PARAMETERS);
@@ -821,6 +822,7 @@
{"close", php3_ms_lyr_close, NULL},
{"getshape", php3_ms_lyr_getShape, NULL},
{"getfeature", php3_ms_lyr_getFeature, NULL},
+ {"resultsgetshape", php3_ms_lyr_resultsGetShape, NULL},
{"getextent", php3_ms_lyr_getExtent, NULL},
{"getmetadata", php3_ms_lyr_getMetaData, NULL},
{"setmetadata", php3_ms_lyr_setMetaData, NULL},
@@ -8111,17 +8113,9 @@
pval *pThis, *pTileId, *pShapeId ;
layerObj *self=NULL;
shapeObj *poShape;
-
-
-#ifdef PHP4
HashTable *list=NULL;
-#endif
-#ifdef PHP4
pThis = getThis();
-#else
- getThis(&pThis);
-#endif
if (pThis == NULL ||
getParameters(ht, 2, &pTileId, &pShapeId) != SUCCESS)
@@ -8222,7 +8216,67 @@
}
/* }}} */
+/**********************************************************************
+ * layer->resultsGetShape()
+ **********************************************************************/
+/* {{{ proto shapeObj layer.resultsGetShape(shapeindex, [tileindex])
+ Retrieve shapeObj from a resultset by index. */
+
+DLEXPORT void php3_ms_lyr_resultsGetShape(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *pThis, *pTileId=NULL, *pShapeId ;
+ layerObj *self=NULL;
+ shapeObj *poShape;
+ int numArgs, nTileId = -1;
+ HashTable *list=NULL;
+
+ pThis = getThis();
+ numArgs = ARG_COUNT(ht);
+ if (pThis == NULL || (numArgs != 1 && numArgs != 2) ||
+ getParameters(ht, numArgs, &pShapeId, &pTileId) != SUCCESS)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(pShapeId);
+
+ if (numArgs >= 2)
+ {
+ convert_to_long(pTileId);
+ nTileId = pTileId->value.lval;
+ }
+
+ /* Create a new shapeObj to hold the result
+ * Note that the type used to create the shape (MS_NULL) does not matter
+ * at this point since it will be set by SHPReadShape().
+ */
+ if ((poShape = shapeObj_new(MS_SHAPE_NULL)) == NULL)
+ {
+ _phpms_report_mapserver_error(E_WARNING);
+ php3_error(E_ERROR, "Failed creating new shape (out of memory?)");
+ RETURN_FALSE;
+ }
+
+ self = (layerObj *)_phpms_fetch_handle(pThis, PHPMS_GLOBAL(le_mslayer),
+ list TSRMLS_CC);
+
+ if (self == NULL ||
+ msLayerResultsGetShape(self, poShape, nTileId,
+ pShapeId->value.lval) != MS_SUCCESS)
+ {
+ _phpms_report_mapserver_error(E_ERROR);
+ shapeObj_destroy(poShape);
+ RETURN_FALSE;
+ }
+
+ /* Return valid object */
+ _phpms_build_shape_object(poShape, PHPMS_GLOBAL(le_msshape_new), self,
+ list, return_value TSRMLS_CC);
+}
+/* }}} */
+
+
/**********************************************************************
* layer->getExtent()
**********************************************************************/
More information about the mapserver-commits
mailing list