Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hotfix for bbox issue in b1

  • Loading branch information...
commit b7e42b46f7f121e7844c293b676d8b96615c3c27 1 parent 899660d
@ryanttb ryanttb authored
View
105 docs/jquery.geo-1.0b1.js
@@ -1,4 +1,4 @@
-/*! jQuery Geo - v1.0b1 - 2012-07-29
+/*! jQuery Geo - v1.0b1.0.1 - 2012-08-01
* http://jquerygeo.com
* Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */
@@ -3502,7 +3502,7 @@ $.Widget.prototype = {
pointParts,
i = 0;
- if ( lineString.length > 1 ) {
+ if ( lineString && lineString.length > 1 ) {
pointStrings = lineString[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g );
for ( ; i < pointStrings.length; i++ ) {
@@ -3526,7 +3526,7 @@ $.Widget.prototype = {
pointParts,
i = 0;
- if ( polygon.length > 1 ) {
+ if ( polygon && polygon.length > 1 ) {
pointStrings = polygon[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g );
for ( ; i < pointStrings.length; i++ ) {
@@ -3543,13 +3543,92 @@ $.Widget.prototype = {
}
}
+ function multiPointParseUntagged(wkt) {
+ var multiSomething;
+
+ if ( wkt.indexOf( "((" ) === -1 ) {
+ multiSomething = lineStringParseUntagged( wkt );
+ } else {
+ multiSomething = multiLineStringParseUntagged( wkt );
+ multiSomething.coordinates = $.geo._allCoordinates( multiSomething );
+ }
+
+ multiSomething.type = "MultiPoint";
+
+ return multiSomething;
+ }
+
+ function multiLineStringParseUntagged(wkt) {
+ var lineStringsWkt = wkt.substr( 1, wkt.length - 2 ),
+ lineStrings = lineStringsWkt.split( ")),((" ),
+ i = 0,
+ multiLineString = {
+ type: "MultiLineString",
+ coordinates: [ ]
+ };
+
+ for ( ; i < lineStrings.length; i++ ) {
+ multiLineString.coordinates.push( lineStringParseUntagged( lineStrings[ i ] ).coordinates );
+ }
+
+ return multiLineString;
+ }
+
+ function multiPolygonParseUntagged(wkt) {
+ var polygonsWkt = wkt.substr( 1, wkt.length - 2 ),
+ polygons = polygonsWkt.split( ")),((" ),
+ i = 0,
+ multiPolygon = {
+ type: "MultiPolygon",
+ coordinates: [ ]
+ };
+
+ for ( ; i < polygons.length; i++ ) {
+ multiPolygon.coordinates.push( polygonParseUntagged( polygons[ i ] ).coordinates );
+ }
+
+ return multiPolygon;
+ }
+
+ function geometryCollectionParseUntagged( wkt ) {
+ var geometriesWkt = wkt.substr( 1, wkt.length - 2 ),
+ geometries = geometriesWkt.match( /\),[a-zA-Z]/g ),
+ geometryCollection = {
+ type: "GeometryCollection",
+ geometries: [ ]
+ },
+ curGeom,
+ i = 0, curStart = 0, curLen;
+
+ if ( geometries && geometries.length > 0 ) {
+ for ( ; i < geometries.length; i++ ) {
+ curLen = geometriesWkt.indexOf( geometries[ i ], curStart ) - curStart + 1;
+ curGeom = parse( geometriesWkt.substr( curStart, curLen ) );
+ if ( curGeom ) {
+ geometryCollection.geometries.push( curGeom );
+ }
+ curStart += curLen + 1;
+ }
+
+ // one more
+ curGeom = parse( geometriesWkt.substr( curStart ) );
+ if ( curGeom ) {
+ geometryCollection.geometries.push( curGeom );
+ }
+
+ return geometryCollection;
+ } else {
+ return null;
+ }
+ }
+
function parse(wkt) {
wkt = $.trim(wkt);
- var typeIndex = wkt.indexOf( " " ),
- untagged = wkt.substr( typeIndex + 1 );
+ var typeIndex = wkt.indexOf( "(" ),
+ untagged = wkt.substr( typeIndex );
- switch (wkt.substr(0, typeIndex).toUpperCase()) {
+ switch ($.trim(wkt.substr(0, typeIndex)).toUpperCase()) {
case "POINT":
return pointParseUntagged( untagged );
@@ -3559,6 +3638,18 @@ $.Widget.prototype = {
case "POLYGON":
return polygonParseUntagged( untagged );
+ case "MULTIPOINT":
+ return multiPointParseUntagged( untagged );
+
+ case "MULTILINESTRING":
+ return multiLineStringParseUntagged( untagged );
+
+ case "MULTIPOLYGON":
+ return multiPolygonParseUntagged( untagged );
+
+ case "GEOMETRYCOLLECTION":
+ return geometryCollectionParseUntagged( untagged );
+
default:
return null;
}
@@ -4443,7 +4534,7 @@ $.Widget.prototype = {
this._setCenterAndSize( center, pixelSize, false, refresh );
}
- value = this._getBbox();
+ value = this._getBbox( center, pixelSize );
break;
case "bboxMax":
View
4 docs/jquery.geo-1.0b1.min.js
2 additions, 2 deletions not shown
View
105 docs/jquery.geo-test.js
@@ -1,4 +1,4 @@
-/*! jQuery Geo - v1.0b1 - 2012-07-29
+/*! jQuery Geo - v1.0b1.0.1 - 2012-08-01
* http://jquerygeo.com
* Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */
@@ -3502,7 +3502,7 @@ $.Widget.prototype = {
pointParts,
i = 0;
- if ( lineString.length > 1 ) {
+ if ( lineString && lineString.length > 1 ) {
pointStrings = lineString[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g );
for ( ; i < pointStrings.length; i++ ) {
@@ -3526,7 +3526,7 @@ $.Widget.prototype = {
pointParts,
i = 0;
- if ( polygon.length > 1 ) {
+ if ( polygon && polygon.length > 1 ) {
pointStrings = polygon[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g );
for ( ; i < pointStrings.length; i++ ) {
@@ -3543,13 +3543,92 @@ $.Widget.prototype = {
}
}
+ function multiPointParseUntagged(wkt) {
+ var multiSomething;
+
+ if ( wkt.indexOf( "((" ) === -1 ) {
+ multiSomething = lineStringParseUntagged( wkt );
+ } else {
+ multiSomething = multiLineStringParseUntagged( wkt );
+ multiSomething.coordinates = $.geo._allCoordinates( multiSomething );
+ }
+
+ multiSomething.type = "MultiPoint";
+
+ return multiSomething;
+ }
+
+ function multiLineStringParseUntagged(wkt) {
+ var lineStringsWkt = wkt.substr( 1, wkt.length - 2 ),
+ lineStrings = lineStringsWkt.split( ")),((" ),
+ i = 0,
+ multiLineString = {
+ type: "MultiLineString",
+ coordinates: [ ]
+ };
+
+ for ( ; i < lineStrings.length; i++ ) {
+ multiLineString.coordinates.push( lineStringParseUntagged( lineStrings[ i ] ).coordinates );
+ }
+
+ return multiLineString;
+ }
+
+ function multiPolygonParseUntagged(wkt) {
+ var polygonsWkt = wkt.substr( 1, wkt.length - 2 ),
+ polygons = polygonsWkt.split( ")),((" ),
+ i = 0,
+ multiPolygon = {
+ type: "MultiPolygon",
+ coordinates: [ ]
+ };
+
+ for ( ; i < polygons.length; i++ ) {
+ multiPolygon.coordinates.push( polygonParseUntagged( polygons[ i ] ).coordinates );
+ }
+
+ return multiPolygon;
+ }
+
+ function geometryCollectionParseUntagged( wkt ) {
+ var geometriesWkt = wkt.substr( 1, wkt.length - 2 ),
+ geometries = geometriesWkt.match( /\),[a-zA-Z]/g ),
+ geometryCollection = {
+ type: "GeometryCollection",
+ geometries: [ ]
+ },
+ curGeom,
+ i = 0, curStart = 0, curLen;
+
+ if ( geometries && geometries.length > 0 ) {
+ for ( ; i < geometries.length; i++ ) {
+ curLen = geometriesWkt.indexOf( geometries[ i ], curStart ) - curStart + 1;
+ curGeom = parse( geometriesWkt.substr( curStart, curLen ) );
+ if ( curGeom ) {
+ geometryCollection.geometries.push( curGeom );
+ }
+ curStart += curLen + 1;
+ }
+
+ // one more
+ curGeom = parse( geometriesWkt.substr( curStart ) );
+ if ( curGeom ) {
+ geometryCollection.geometries.push( curGeom );
+ }
+
+ return geometryCollection;
+ } else {
+ return null;
+ }
+ }
+
function parse(wkt) {
wkt = $.trim(wkt);
- var typeIndex = wkt.indexOf( " " ),
- untagged = wkt.substr( typeIndex + 1 );
+ var typeIndex = wkt.indexOf( "(" ),
+ untagged = wkt.substr( typeIndex );
- switch (wkt.substr(0, typeIndex).toUpperCase()) {
+ switch ($.trim(wkt.substr(0, typeIndex)).toUpperCase()) {
case "POINT":
return pointParseUntagged( untagged );
@@ -3559,6 +3638,18 @@ $.Widget.prototype = {
case "POLYGON":
return polygonParseUntagged( untagged );
+ case "MULTIPOINT":
+ return multiPointParseUntagged( untagged );
+
+ case "MULTILINESTRING":
+ return multiLineStringParseUntagged( untagged );
+
+ case "MULTIPOLYGON":
+ return multiPolygonParseUntagged( untagged );
+
+ case "GEOMETRYCOLLECTION":
+ return geometryCollectionParseUntagged( untagged );
+
default:
return null;
}
@@ -4443,7 +4534,7 @@ $.Widget.prototype = {
this._setCenterAndSize( center, pixelSize, false, refresh );
}
- value = this._getBbox();
+ value = this._getBbox( center, pixelSize );
break;
case "bboxMax":
View
4 docs/jquery.geo-test.min.js
2 additions, 2 deletions not shown
View
2  js/jquery.geo.geomap.js
@@ -361,7 +361,7 @@
this._setCenterAndSize( center, pixelSize, false, refresh );
}
- value = this._getBbox();
+ value = this._getBbox( center, pixelSize );
break;
case "bboxMax":
View
2  package.json
@@ -2,7 +2,7 @@
"name": "jquery.geo",
"title": "jQuery Geo",
"description": "An interactive mapping and spatial analysis plugin.",
- "version": "1.0b1",
+ "version": "1.0b1.0.1",
"homepage": "http://jquerygeo.com",
"author": {
"name": "Ryan Westphal",
Please sign in to comment.
Something went wrong with that request. Please try again.