blacklight_heatmaps 0.3.0 → 0.4.0

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: adcba0150eab159cf8394afa9b77f9bd9ef21c77
4
- data.tar.gz: 8d2e36ea948118384a245cc56b3ade2c5b760687
3
+ metadata.gz: 95fbd5c293e3bb1b0934cbb0ef75129609552d54
4
+ data.tar.gz: 6fc4101c575417ab48559edab0c74f31de41e7d8
5
5
  SHA512:
6
- metadata.gz: c3ec478fb3d1030edef201bbe1abe1112137ae152c861942760da1bb7dec6b9beb25b269b1123cb7ca07c9a836e44784ba137e95c43867b3cc4115a21acd06b0
7
- data.tar.gz: 869ca21a48da8934de63b2e0ef2fa31d906bd950b6cf64763bc1816c20dcf153d4c965766afb918153d97af5943d6d19b1df81e1a0ba55827bfa93c4278a495a
6
+ metadata.gz: 3df2e19e19eb7468961118cc60714f8c7311baf88d894877b4284937f20c1c148ff4c7f58dda756d91d40c5217f3aea911a2f9241f2c5588f52ffffbe209d8cf
7
+ data.tar.gz: 6f483cdf059e4276bdc9d86a7190f88a701ed0258f78239a8ecfef600d149db11a4fab826f7c71c55d91aa39f45ffbebcebb198ed4ad9cc81ff00c5538228fbd
@@ -4,4 +4,5 @@
4
4
  //= require leaflet_solr_heatmap
5
5
  //= require blacklight_heatmaps/blacklight_heatmaps
6
6
  //= require blacklight_heatmaps/basemaps
7
+ //= require blacklight_heatmaps/icons
7
8
  //= require_tree ./viewers
@@ -0,0 +1,7 @@
1
+ BlacklightHeatmaps.Icons = {
2
+ default: new L.Icon({
3
+ iconUrl: '<%= asset_path 'marker-icon.png'%>',
4
+ iconRetinaUrl: '<%= asset_path 'marker-icon-2x.png'%>',
5
+ shadowUrl: '<%= asset_path 'marker-shadow.png'%>'
6
+ })
7
+ };
@@ -21,7 +21,13 @@ Blacklight.onLoad(function () {
21
21
  $el.data().basemapProvider
22
22
  ).addTo(map);
23
23
 
24
- var features = L.geoJson(features).addTo(map);
24
+ var features = L.geoJson(features, {
25
+ pointToLayer: function(feature, latlng) {
26
+ return L.marker(latlng, {
27
+ icon: BlacklightHeatmaps.Icons.default
28
+ })
29
+ }
30
+ }).addTo(map);
25
31
 
26
32
  map.fitBounds(features.getBounds());
27
33
  },
@@ -15,6 +15,7 @@ module BlacklightHeatmaps
15
15
  if blacklight_params[:bbox]
16
16
  solr_parameters['facet.heatmap'] = geometry_field
17
17
  solr_parameters['facet.heatmap.geom'] = bbox_as_range
18
+ solr_parameters['facet.heatmap.distErrPct'] = dist_err_pct
18
19
  solr_parameters[:bq] ||= []
19
20
  solr_parameters[:bq] << "#{geometry_field}:\"IsWithin(#{bbox_as_envelope})\""
20
21
  solr_parameters[:fq] ||= []
@@ -23,6 +24,10 @@ module BlacklightHeatmaps
23
24
  solr_parameters
24
25
  end
25
26
 
27
+ def dist_err_pct
28
+ blacklight_config.heatmap_distErrPct || 0.15
29
+ end
30
+
26
31
  def geometry_field
27
32
  blacklight_config.geometry_field
28
33
  end
@@ -1,3 +1,3 @@
1
1
  module BlacklightHeatmaps
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -13,6 +13,7 @@ module BlacklightHeatmaps
13
13
  inject_into_file 'app/controllers/catalog_controller.rb', after: 'configure_blacklight do |config|' do
14
14
  "\n # BlacklightHeatmaps configuration values" \
15
15
  "\n config.geometry_field = :geo_srpt" \
16
+ "\n config.heatmap_distErrPct = 0.15 # Default Solr value" \
16
17
  "\n # Basemaps configured include: 'positron', 'darkMatter', 'OpenStreetMap.HOT'" \
17
18
  "\n config.basemap_provider = 'positron'" \
18
19
  "\n config.show.partials.insert(1, :show_leaflet_map)" \
data/spec/examples.txt ADDED
@@ -0,0 +1,31 @@
1
+ example_id | status | run_time |
2
+ --------------------------------------------------------------------------------------- | ------ | --------------- |
3
+ ./spec/features/configurable_basemap_spec.rb[1:1] | passed | 0.43154 seconds |
4
+ ./spec/features/configurable_basemap_spec.rb[1:2:1] | passed | 0.50186 seconds |
5
+ ./spec/features/configurable_basemap_spec.rb[1:3:1] | passed | 0.48439 seconds |
6
+ ./spec/features/index_page_map_spec.rb[1:1] | passed | 8.17 seconds |
7
+ ./spec/features/show_page_map_spec.rb[1:1] | passed | 0.63302 seconds |
8
+ ./spec/features/show_page_map_spec.rb[1:2] | passed | 0.4363 seconds |
9
+ ./spec/helpers/blacklight/maps_helper_spec.rb[1:1:1] | passed | 0.00677 seconds |
10
+ ./spec/helpers/blacklight/maps_helper_spec.rb[1:2:1] | passed | 0.00646 seconds |
11
+ ./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:1:1] | passed | 0.00016 seconds |
12
+ ./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:2:1] | passed | 0.003 seconds |
13
+ ./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:3:1] | passed | 0.00034 seconds |
14
+ ./spec/models/concerns/blacklight_heatmaps/bounding_box_spec.rb[1:4:1] | passed | 0.00071 seconds |
15
+ ./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:1:1] | passed | 0.00026 seconds |
16
+ ./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:2:1] | passed | 0.00019 seconds |
17
+ ./spec/models/concerns/blacklight_heatmaps/geometry_parser_spec.rb[1:1:3:1] | passed | 0.00176 seconds |
18
+ ./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:1:1] | passed | 0.00076 seconds |
19
+ ./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:2:1] | passed | 0.00031 seconds |
20
+ ./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:3:1] | passed | 0.00078 seconds |
21
+ ./spec/models/concerns/blacklight_heatmaps/geometry_solr_document_spec.rb[1:4:1] | passed | 0.01206 seconds |
22
+ ./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:1:1] | passed | 0.00024 seconds |
23
+ ./spec/models/concerns/blacklight_heatmaps/point_spec.rb[1:2:1] | passed | 0.00037 seconds |
24
+ ./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:1:1] | passed | 0.00098 seconds |
25
+ ./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:1:2:1] | passed | 0.00281 seconds |
26
+ ./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:2:1] | passed | 0.00109 seconds |
27
+ ./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:3:1] | passed | 0.00731 seconds |
28
+ ./spec/models/concerns/blacklight_heatmaps/solr_facet_heatmap_behavior_spec.rb[1:4:1] | passed | 0.00165 seconds |
29
+ ./spec/views/catalog/_document_heatmaps.html.erb_spec.rb[1:1] | passed | 0.0363 seconds |
30
+ ./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:1:1] | passed | 0.00699 seconds |
31
+ ./spec/views/catalog/_show_leaflet_map_default.html.erb_spec.rb[1:2:1] | passed | 0.04711 seconds |
@@ -32,6 +32,8 @@ describe BlacklightHeatmaps::SolrFacetHeatmapBehavior do
32
32
  .to eq :geo_srpt
33
33
  expect(subject.add_solr_facet_heatmap(solr_params)['facet.heatmap.geom'])
34
34
  .to eq '["1 2" TO "4 3"]'
35
+ expect(subject.add_solr_facet_heatmap(solr_params)['facet.heatmap.distErrPct'])
36
+ .to eq 0.15
35
37
  expect(subject.add_solr_facet_heatmap(solr_params)[:bq])
36
38
  .to include(boost: 'stuff')
37
39
  expect(subject.add_solr_facet_heatmap(solr_params)[:bq])
@@ -334,7 +334,9 @@ L.SolrHeatmap = L.GeoJSON.extend({
334
334
  }
335
335
 
336
336
  var bounds = this._map.getBounds();
337
- return [bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth()].join(',');
337
+ var wrappedSw = bounds.getSouthWest().wrap();
338
+ var wrappedNe = bounds.getNorthEast().wrap();
339
+ return [wrappedSw.lng, bounds.getSouth(), wrappedNe.lng, bounds.getNorth()].join(',');
338
340
  },
339
341
 
340
342
  _mapViewToEnvelope: function () {
@@ -343,7 +345,9 @@ L.SolrHeatmap = L.GeoJSON.extend({
343
345
  }
344
346
 
345
347
  var bounds = this._map.getBounds();
346
- return ':"Intersects(ENVELOPE(' + bounds.getWest() + ', ' + bounds.getEast() + ', ' + bounds.getNorth() + ', ' + bounds.getSouth() + '))"';
348
+ var wrappedSw = bounds.getSouthWest().wrap();
349
+ var wrappedNe = bounds.getNorthEast().wrap();
350
+ return ':"Intersects(ENVELOPE(' + wrappedSw.lng + ', ' + wrappedNe.lng + ', ' + bounds.getNorth() + ', ' + bounds.getSouth() + '))"';
347
351
  },
348
352
 
349
353
  _mapViewToWkt: function () {
@@ -352,7 +356,9 @@ L.SolrHeatmap = L.GeoJSON.extend({
352
356
  }
353
357
 
354
358
  var bounds = this._map.getBounds();
355
- return '["' + bounds.getWest() + ' ' + bounds.getSouth() + '" TO "' + bounds.getEast() + ' ' + bounds.getNorth() + '"]';
359
+ var wrappedSw = bounds.getSouthWest().wrap();
360
+ var wrappedNe = bounds.getNorthEast().wrap();
361
+ return '["' + wrappedSw.lng + ' ' + bounds.getSouth() + '" TO "' + wrappedNe.lng + ' ' + bounds.getNorth() + '"]';
356
362
  },
357
363
 
358
364
  _solrQuery: function () {
@@ -364,16 +370,6 @@ L.solrHeatmap = function (url, options) {
364
370
  return new L.SolrHeatmap(url, options);
365
371
  };
366
372
 
367
- L.LatLngBounds.prototype.getWest = function () {
368
- var west = this._southWest.lng;
369
- return west < -180 ? -180 : west;
370
- };
371
-
372
- L.LatLngBounds.prototype.getEast = function () {
373
- var east = this._northEast.lng;
374
- return east > 180 ? 180 : east;
375
- };
376
-
377
373
  // Check if L.MarkerCluster is included
378
374
  if (typeof L.MarkerCluster !== 'undefined') {
379
375
  L.MarkerCluster.prototype.initialize = function (group, zoom, a, b) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_heatmaps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Reed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2017-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -169,6 +169,7 @@ files:
169
169
  - app/assets/javascripts/blacklight_heatmaps/basemaps.js
170
170
  - app/assets/javascripts/blacklight_heatmaps/blacklight_heatmaps.js
171
171
  - app/assets/javascripts/blacklight_heatmaps/default.js
172
+ - app/assets/javascripts/blacklight_heatmaps/icons.js.erb
172
173
  - app/assets/javascripts/blacklight_heatmaps/viewers/index.js
173
174
  - app/assets/javascripts/blacklight_heatmaps/viewers/show.js
174
175
  - app/assets/stylesheets/blacklight_heatmaps/default.scss
@@ -192,6 +193,7 @@ files:
192
193
  - lib/generators/blacklight_heatmaps/templates/blacklight_heatmaps.js
193
194
  - lib/generators/blacklight_heatmaps/templates/blacklight_heatmaps.scss
194
195
  - lib/tasks/blacklight_heatmaps_tasks.rake
196
+ - spec/examples.txt
195
197
  - spec/features/configurable_basemap_spec.rb
196
198
  - spec/features/index_page_map_spec.rb
197
199
  - spec/features/show_page_map_spec.rb
@@ -229,11 +231,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
231
  version: '0'
230
232
  requirements: []
231
233
  rubyforge_project:
232
- rubygems_version: 2.5.1
234
+ rubygems_version: 2.6.8
233
235
  signing_key:
234
236
  specification_version: 4
235
237
  summary: Search and view Blacklight resources on a map.
236
238
  test_files:
239
+ - spec/examples.txt
237
240
  - spec/features/configurable_basemap_spec.rb
238
241
  - spec/features/index_page_map_spec.rb
239
242
  - spec/features/show_page_map_spec.rb