kmz_compressor 2.0.11 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a016ad49b9311b3f886bef8fc9ddbaf789fdafb
|
4
|
+
data.tar.gz: b42020c3acdd4a0a483737f4d54f0d2ee656b9fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2feb0c49d00e5dd6e9a240ed63e46dfdca0e9ff48eecc5cb47df58bf7141154e34893eed1149546c09f616da108ce8d0fc80632704d83465baadbe5204084479
|
7
|
+
data.tar.gz: f479543d56fdfe774562ed292e4ecc0f7614f50c29238c0b8b15f0c9beb2c74a644e27a8f49d0c8d69b117da9a5a842e1d329e99bc852f880b352f42dd5069a0
|
@@ -49,11 +49,12 @@ window.MapLayerManager = function(map){
|
|
49
49
|
|
50
50
|
// Generates the url of the cached KMZ for the given kmlURL
|
51
51
|
function cachedKMZURL(kmlURL){
|
52
|
-
var url =
|
53
|
-
|
52
|
+
var url = urlToObject(kmlURL)
|
53
|
+
url.href = '/kmz/' + hex_sha256(kmlURL) + '.kmz'
|
54
|
+
return url.href
|
54
55
|
}
|
55
56
|
|
56
|
-
function centerWhenLoaded(layerNamez){
|
57
|
+
function centerWhenLoaded(layerNamez, options){
|
57
58
|
layerNamez = makeArray(layerNamez)
|
58
59
|
|
59
60
|
var handler = function(){
|
@@ -64,7 +65,7 @@ window.MapLayerManager = function(map){
|
|
64
65
|
|
65
66
|
if (areLayersLoaded(layerNamez)){
|
66
67
|
$(map.getDiv()).unbind(layerLoadedEventName, handler)
|
67
|
-
centerOnLayers(layerNamez);
|
68
|
+
centerOnLayers(layerNamez, options);
|
68
69
|
}
|
69
70
|
}
|
70
71
|
|
@@ -138,7 +139,7 @@ window.MapLayerManager = function(map){
|
|
138
139
|
return true
|
139
140
|
}
|
140
141
|
|
141
|
-
function centerOnLayers(layerNames){
|
142
|
+
function centerOnLayers(layerNames, options){
|
142
143
|
var bounds;
|
143
144
|
layerNames = makeArray(layerNames)
|
144
145
|
sweep() // Discard old layers before we generate the bounds
|
@@ -154,8 +155,14 @@ window.MapLayerManager = function(map){
|
|
154
155
|
bounds.union(layer.kml.getDefaultViewport());
|
155
156
|
}
|
156
157
|
}
|
158
|
+
var checkZoom = options.maxZoom && map.getZoom() <= options.maxZoom
|
159
|
+
|
157
160
|
if (bounds){
|
158
|
-
|
161
|
+
map.fitBounds(bounds)
|
162
|
+
}
|
163
|
+
|
164
|
+
if (checkZoom && map.getZoom() > options.maxZoom){
|
165
|
+
map.setZoom(options.maxZoom)
|
159
166
|
}
|
160
167
|
}
|
161
168
|
|
@@ -217,8 +224,8 @@ window.MapLayerManager = function(map){
|
|
217
224
|
// Replace spaces with pluses so we don't have problems with some things turning them into %20s and some not
|
218
225
|
// Matches the middleware process
|
219
226
|
function sanitizeURI(uri){
|
220
|
-
var url =
|
221
|
-
var pathname = decodeURI(url.pathname)
|
227
|
+
var url = urlToObject(uri)
|
228
|
+
var pathname = ('/' + decodeURI(url.pathname)).replace(/^\/+/, '/').trim() // Ensure there is a leading slash (IE doesn't provide one, Chrome does, FF does)
|
222
229
|
var search = decodeURIComponent(url.search.replace(/\+/g, '%20')).trim().replace(/^\?/, '') // Ensure all "plus spaces" are hex encoded spaces
|
223
230
|
|
224
231
|
output = pathname
|
@@ -236,8 +243,9 @@ window.MapLayerManager = function(map){
|
|
236
243
|
return encodeURIComponent(kv).replace(/'/g, '%27')
|
237
244
|
}).join('=')
|
238
245
|
}).join('&')
|
246
|
+
url.href = output
|
239
247
|
|
240
|
-
return url.
|
248
|
+
return url.href
|
241
249
|
}
|
242
250
|
|
243
251
|
function closeInfowindowsExcept(layerName){
|
@@ -268,6 +276,10 @@ window.MapLayerManager = function(map){
|
|
268
276
|
}
|
269
277
|
}
|
270
278
|
|
279
|
+
function urlToObject(url){
|
280
|
+
return $('<a>').attr('href', url)[0]
|
281
|
+
}
|
282
|
+
|
271
283
|
// INIT
|
272
284
|
|
273
285
|
// Because google events sometimes get missed, we ensure we're up to date every now and again
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kmz_compressor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Wallace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- README.rdoc
|
58
58
|
- app/assets/javascripts/kmz_compressor.js
|
59
59
|
- app/assets/javascripts/kmz_compressor/map_layer_manager.js
|
60
|
+
- app/assets/javascripts/kmz_compressor/polyfills.js
|
60
61
|
- app/assets/javascripts/kmz_compressor/sha2.js
|
61
62
|
- lib/kmz_compressor.rb
|
62
63
|
- lib/kmz_compressor/engine.rb
|
@@ -82,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
83
|
version: '0'
|
83
84
|
requirements: []
|
84
85
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.4.1
|
86
87
|
signing_key:
|
87
88
|
specification_version: 4
|
88
89
|
summary: Rack Middleware which retrieves KML from Rails and produces KMZ for the client.
|