@@ -18,8 +18,6 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Read GeoRSS string into geometry objects |
| 20 | 20 | * |
| 21 | - * @param string $georss - an XML feed containing geoRSS |
|
| 22 | - * |
|
| 23 | 21 | * @return Geometry|GeometryCollection |
| 24 | 22 | */ |
| 25 | 23 | public function read($gpx) {
|
@@ -80,6 +78,9 @@ discard block |
||
| 80 | 78 | return geoPHP::geometryReduce($geometries); |
| 81 | 79 | } |
| 82 | 80 | |
| 81 | + /** |
|
| 82 | + * @param string $string |
|
| 83 | + */ |
|
| 83 | 84 | protected function getPointsFromCoords($string) {
|
| 84 | 85 | $coords = array(); |
| 85 | 86 | $latlon = explode(' ',$string);
|
@@ -42,6 +42,9 @@ |
||
| 42 | 42 | return '<'.$this->nss.'gpx creator="geoPHP" version="1.0">'.$this->geometryToGPX($geometry).'</'.$this->nss.'gpx>'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $text |
|
| 47 | + */ |
|
| 45 | 48 | public function geomFromText($text) {
|
| 46 | 49 | // Change to lower-case and strip all CDATA |
| 47 | 50 | $text = strtolower($text); |
@@ -49,6 +49,9 @@ discard block |
||
| 49 | 49 | return $this->geometryToKML($geometry); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $text |
|
| 54 | + */ |
|
| 52 | 55 | public function geomFromText($text) {
|
| 53 | 56 | |
| 54 | 57 | // Change to lower-case and strip all CDATA |
@@ -184,6 +187,9 @@ discard block |
||
| 184 | 187 | return $coordinates; |
| 185 | 188 | } |
| 186 | 189 | |
| 190 | + /** |
|
| 191 | + * @param Geometry $geom |
|
| 192 | + */ |
|
| 187 | 193 | private function geometryToKML($geom) {
|
| 188 | 194 | $type = strtolower($geom->getGeomType()); |
| 189 | 195 | switch ($type) {
|
@@ -123,6 +123,9 @@ discard block |
||
| 123 | 123 | return new Polygon($components); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | + /** |
|
| 127 | + * @param string $type |
|
| 128 | + */ |
|
| 126 | 129 | function getMulti(&$mem, $type) {
|
| 127 | 130 | // Get the number of items expected in this multi out of the first 4 bytes |
| 128 | 131 | $multi_length = unpack('L',fread($mem,4));
|
@@ -196,6 +199,9 @@ discard block |
||
| 196 | 199 | } |
| 197 | 200 | } |
| 198 | 201 | |
| 202 | + /** |
|
| 203 | + * @param Geometry $point |
|
| 204 | + */ |
|
| 199 | 205 | function writePoint($point) {
|
| 200 | 206 | // Set the coords |
| 201 | 207 | $wkb = pack('dd',$point->x(), $point->y());
|
@@ -215,6 +221,9 @@ discard block |
||
| 215 | 221 | return $wkb; |
| 216 | 222 | } |
| 217 | 223 | |
| 224 | + /** |
|
| 225 | + * @param Geometry $poly |
|
| 226 | + */ |
|
| 218 | 227 | function writePolygon($poly) {
|
| 219 | 228 | // Set the number of lines in this poly |
| 220 | 229 | $wkb = pack('L',$poly->numGeometries());
|
@@ -227,6 +236,9 @@ discard block |
||
| 227 | 236 | return $wkb; |
| 228 | 237 | } |
| 229 | 238 | |
| 239 | + /** |
|
| 240 | + * @param Geometry $geometry |
|
| 241 | + */ |
|
| 230 | 242 | function writeMulti($geometry) {
|
| 231 | 243 | // Set the number of components |
| 232 | 244 | $wkb = pack('L',$geometry->numGeometries());
|
@@ -8,7 +8,6 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * Read WKT string into geometry objects |
| 10 | 10 | * |
| 11 | - * @param string $WKT A WKT string |
|
| 12 | 11 | * |
| 13 | 12 | * @return Geometry |
| 14 | 13 | */ |
@@ -184,11 +183,17 @@ discard block |
||
| 184 | 183 | else return $str; |
| 185 | 184 | } |
| 186 | 185 | |
| 186 | + /** |
|
| 187 | + * @param string $char |
|
| 188 | + */ |
|
| 187 | 189 | protected function beginsWith($str, $char) { |
| 188 | 190 | if (substr($str,0,strlen($char)) == $char) return TRUE; |
| 189 | 191 | else return FALSE; |
| 190 | 192 | } |
| 191 | 193 | |
| 194 | + /** |
|
| 195 | + * @param string $char |
|
| 196 | + */ |
|
| 192 | 197 | protected function endsWith($str, $char) { |
| 193 | 198 | if (substr($str,(0 - strlen($char))) == $char) return TRUE; |
| 194 | 199 | else return FALSE; |
@@ -193,6 +193,9 @@ |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | + /** |
|
| 197 | + * @param Point $point |
|
| 198 | + */ |
|
| 196 | 199 | public function pointOnVertex($point) { |
| 197 | 200 | foreach($this->getPoints() as $vertex) { |
| 198 | 201 | if ($point->equals($vertex)) { |
@@ -41,6 +41,10 @@ |
||
| 41 | 41 | print "Testing Done!"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | +/** |
|
| 45 | + * @param resource $connection |
|
| 46 | + * @param string $format |
|
| 47 | + */ |
|
| 44 | 48 | function test_postgis($name, $type, $geom, $connection, $format) { |
| 45 | 49 | global $table; |
| 46 | 50 | |
@@ -112,6 +112,9 @@ discard block |
||
| 112 | 112 | $geometry->m(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | +/** |
|
| 116 | + * @param string $input |
|
| 117 | + */ |
|
| 115 | 118 | function test_adapters($geometry, $format, $input) { |
| 116 | 119 | // Test adapter output and input. Do a round-trip and re-test |
| 117 | 120 | foreach (geoPHP::getAdapterMap() as $adapter_key => $adapter_class) { |
@@ -234,6 +237,9 @@ discard block |
||
| 234 | 237 | } |
| 235 | 238 | } |
| 236 | 239 | |
| 240 | +/** |
|
| 241 | + * @param string $value |
|
| 242 | + */ |
|
| 237 | 243 | function test_detection($value, $format, $file) { |
| 238 | 244 | $detected = geoPHP::detectFormat($value); |
| 239 | 245 | if ($detected != $format) { |
@@ -58,6 +58,10 @@ |
||
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | + /** |
|
| 62 | + * @param string $method_name |
|
| 63 | + * @param string|null $argument |
|
| 64 | + */ |
|
| 61 | 65 | function _methods_tester($geometry, $method_name, $argument) { |
| 62 | 66 | |
| 63 | 67 | if (!method_exists($geometry, $method_name)) { |