geo_works 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +34 -0
- data/.csslintrc +2 -0
- data/.engine_cart.yml +1 -0
- data/.eslintignore +1 -0
- data/.eslintrc +8 -0
- data/.fcrepo_wrapper +3 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +105 -0
- data/.solr_wrapper +7 -0
- data/.travis.yml +33 -0
- data/CONTRIBUTING.md +159 -0
- data/Gemfile +48 -0
- data/LICENSE +202 -0
- data/README.md +143 -0
- data/Rakefile +25 -0
- data/app/assets/images/geo_works/.keep +0 -0
- data/app/assets/images/geo_works/images/geocoder.png +0 -0
- data/app/assets/images/geo_works/images/move-handle.png +0 -0
- data/app/assets/images/geo_works/images/resize-handle.png +0 -0
- data/app/assets/images/geo_works/images/throbber.gif +0 -0
- data/app/assets/javascripts/geo_works/Control.Geocoder.js +1056 -0
- data/app/assets/javascripts/geo_works/application.js +4 -0
- data/app/assets/javascripts/geo_works/bounding_box_selector.js +107 -0
- data/app/assets/javascripts/geo_works/es6-modules.js +7 -0
- data/app/assets/javascripts/geo_works/geo_works_boot.es6 +8 -0
- data/app/assets/javascripts/geo_works/leaflet-boundingbox.js +467 -0
- data/app/assets/javascripts/geo_works/relationships.js +3 -0
- data/app/assets/javascripts/geo_works/relationships/child_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/parent_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/related_works.es6 +187 -0
- data/app/assets/stylesheets/geo_works/Control.Geocoder.scss +104 -0
- data/app/assets/stylesheets/geo_works/application.css +18 -0
- data/app/assets/stylesheets/geo_works/bounding_box.scss +15 -0
- data/app/assets/stylesheets/geo_works/leaflet-boundingbox.scss +17 -0
- data/app/assets/stylesheets/geo_works/related_works.scss +29 -0
- data/app/assets/stylesheets/geo_works/thumbnails.scss +13 -0
- data/app/controllers/concerns/geo_works/events_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/file_sets_controller_behavior.rb +31 -0
- data/app/controllers/concerns/geo_works/geoblacklight_controller_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/image_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/raster_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/vector_works_controller_behavior.rb +9 -0
- data/app/forms/geo_works/basic_geo_metadata_form.rb +9 -0
- data/app/forms/geo_works/external_metadata_file_form.rb +8 -0
- data/app/forms/geo_works/georeferenced_form.rb +9 -0
- data/app/forms/hyrax/image_work_form.rb +7 -0
- data/app/forms/hyrax/raster_work_form.rb +8 -0
- data/app/forms/hyrax/vector_work_form.rb +8 -0
- data/app/helpers/geo_works/application_helper.rb +4 -0
- data/app/helpers/geo_works/bounding_box_helper.rb +73 -0
- data/app/helpers/geo_works/file_set_actions_helper.rb +31 -0
- data/app/helpers/geo_works/geo_works_helper.rb +22 -0
- data/app/helpers/geo_works/populate_metadata_helper.rb +7 -0
- data/app/jobs/geoblacklight_job.rb +10 -0
- data/app/jobs/geoserver_delivery_job.rb +36 -0
- data/app/models/concerns/geo_works/ability.rb +12 -0
- data/app/models/concerns/geo_works/basic_geo_metadata.rb +21 -0
- data/app/models/concerns/geo_works/external_metadata_file_behavior.rb +31 -0
- data/app/models/concerns/geo_works/extractors/fgdc_helper.rb +9 -0
- data/app/models/concerns/geo_works/extractors/fgdc_metadata_extractor.rb +114 -0
- data/app/models/concerns/geo_works/extractors/iso19139_helper.rb +50 -0
- data/app/models/concerns/geo_works/extractors/mods_helper.rb +15 -0
- data/app/models/concerns/geo_works/file_set_metadata.rb +15 -0
- data/app/models/concerns/geo_works/file_set_presenter_behavior.rb +7 -0
- data/app/models/concerns/geo_works/geo_file_format_behavior.rb +37 -0
- data/app/models/concerns/geo_works/geo_file_set_behavior.rb +11 -0
- data/app/models/concerns/geo_works/georeferenced_behavior.rb +18 -0
- data/app/models/concerns/geo_works/image_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/image_work_behavior.rb +69 -0
- data/app/models/concerns/geo_works/metadata_extraction_helper.rb +27 -0
- data/app/models/concerns/geo_works/raster_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/raster_work_behavior.rb +82 -0
- data/app/models/concerns/geo_works/solr_document_behavior.rb +46 -0
- data/app/models/concerns/geo_works/vector_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/vector_work_behavior.rb +78 -0
- data/app/presenters/geo_works/geo_works_show_presenter.rb +48 -0
- data/app/presenters/geo_works/image_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/raster_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/vector_work_show_presenter.rb +5 -0
- data/app/processors/geo_works/geoblacklight_event_processor.rb +29 -0
- data/app/processors/geo_works/geoblacklight_event_processor/delete_processor.rb +13 -0
- data/app/processors/geo_works/geoblacklight_event_processor/processor.rb +28 -0
- data/app/processors/geo_works/geoblacklight_event_processor/unknown_event.rb +15 -0
- data/app/processors/geo_works/geoblacklight_event_processor/update_processor.rb +15 -0
- data/app/processors/geo_works/processors/base_geo_processor.rb +81 -0
- data/app/processors/geo_works/processors/gdal.rb +49 -0
- data/app/processors/geo_works/processors/image.rb +66 -0
- data/app/processors/geo_works/processors/ogr.rb +19 -0
- data/app/processors/geo_works/processors/raster.rb +26 -0
- data/app/processors/geo_works/processors/raster/aig.rb +40 -0
- data/app/processors/geo_works/processors/raster/base.rb +41 -0
- data/app/processors/geo_works/processors/raster/dem.rb +29 -0
- data/app/processors/geo_works/processors/raster/info.rb +52 -0
- data/app/processors/geo_works/processors/rendering.rb +79 -0
- data/app/processors/geo_works/processors/vector.rb +24 -0
- data/app/processors/geo_works/processors/vector/base.rb +44 -0
- data/app/processors/geo_works/processors/vector/info.rb +84 -0
- data/app/processors/geo_works/processors/vector/shapefile.rb +20 -0
- data/app/processors/geo_works/processors/zip.rb +29 -0
- data/app/renderers/geo_works/coverage_renderer.rb +39 -0
- data/app/runners/geo_works/runners/raster_derivatives.rb +9 -0
- data/app/runners/geo_works/runners/vector_derivatives.rb +9 -0
- data/app/schemas/geo_works/basic_geo_metadata_optional.rb +40 -0
- data/app/schemas/geo_works/basic_geo_metadata_required.rb +25 -0
- data/app/schemas/geo_works/file_set_metadata_required.rb +5 -0
- data/app/services/geo_works/authority_service.rb +29 -0
- data/app/services/geo_works/delivery/geoserver.rb +118 -0
- data/app/services/geo_works/delivery_service.rb +11 -0
- data/app/services/geo_works/discovery.rb +4 -0
- data/app/services/geo_works/discovery/abstract_document.rb +37 -0
- data/app/services/geo_works/discovery/document_builder.rb +46 -0
- data/app/services/geo_works/discovery/document_builder/basic_metadata_builder.rb +71 -0
- data/app/services/geo_works/discovery/document_builder/composite_builder.rb +21 -0
- data/app/services/geo_works/discovery/document_builder/date_builder.rb +53 -0
- data/app/services/geo_works/discovery/document_builder/document_helper.rb +10 -0
- data/app/services/geo_works/discovery/document_builder/document_path.rb +91 -0
- data/app/services/geo_works/discovery/document_builder/layer_info_builder.rb +65 -0
- data/app/services/geo_works/discovery/document_builder/references_builder.rb +101 -0
- data/app/services/geo_works/discovery/document_builder/slug_builder.rb +24 -0
- data/app/services/geo_works/discovery/document_builder/spatial_builder.rb +37 -0
- data/app/services/geo_works/discovery/document_builder/wxs.rb +76 -0
- data/app/services/geo_works/discovery/geoblacklight_document.rb +152 -0
- data/app/services/geo_works/events_generator.rb +24 -0
- data/app/services/geo_works/events_generator/composite_generator.rb +18 -0
- data/app/services/geo_works/events_generator/geoblacklight_event_generator.rb +53 -0
- data/app/services/geo_works/events_generator/geoserver_event_generator.rb +33 -0
- data/app/services/geo_works/file_set_derivatives_service.rb +67 -0
- data/app/services/geo_works/image_format_service.rb +6 -0
- data/app/services/geo_works/metadata_format_service.rb +6 -0
- data/app/services/geo_works/raster_format_service.rb +6 -0
- data/app/services/geo_works/vector_format_service.rb +6 -0
- data/app/services/hyrax/curation_concern.rb +18 -0
- data/app/values/geo_works/coverage.rb +36 -0
- data/app/values/geo_works/time_period.rb +30 -0
- data/app/views/geo_works/_attribute_rows.html.erb +4 -0
- data/app/views/geo_works/_form_progress.html.erb +50 -0
- data/app/views/geo_works/_guts4form.html.erb +47 -0
- data/app/views/geo_works/_member.html.erb +11 -0
- data/app/views/geo_works/_metadata.html.erb +13 -0
- data/app/views/geo_works/_relationships.html.erb +12 -0
- data/app/views/geo_works/_representative_media.html.erb +5 -0
- data/app/views/geo_works/file_sets/_form.html.erb +48 -0
- data/app/views/geo_works/file_sets/actions/_default_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_image_actions.html.erb +22 -0
- data/app/views/geo_works/file_sets/actions/_metadata_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_raster_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/actions/_vector_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/media_display/_geo.html.erb +16 -0
- data/app/views/geo_works/file_sets/new.html.erb +12 -0
- data/app/views/geo_works/related/_child_member.html.erb +13 -0
- data/app/views/geo_works/related/_child_works.html.erb +24 -0
- data/app/views/geo_works/related/_external_metadata_file_member.html.erb +11 -0
- data/app/views/geo_works/related/_external_metadata_files.html.erb +24 -0
- data/app/views/geo_works/related/_geo_files.html.erb +24 -0
- data/app/views/geo_works/related/_new_child_member.html.erb +22 -0
- data/app/views/geo_works/related/_new_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_works.html.erb +22 -0
- data/app/views/hyrax/image_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/image_works/_form.html.erb +16 -0
- data/app/views/hyrax/image_works/_image_actions.html.erb +11 -0
- data/app/views/hyrax/image_works/_image_work.html.erb +2 -0
- data/app/views/hyrax/image_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/image_works/show.html.erb +31 -0
- data/app/views/hyrax/raster_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/raster_works/_form.html.erb +16 -0
- data/app/views/hyrax/raster_works/_raster_actions.html.erb +11 -0
- data/app/views/hyrax/raster_works/_raster_work.html.erb +2 -0
- data/app/views/hyrax/raster_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/raster_works/show.html.erb +31 -0
- data/app/views/hyrax/vector_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/vector_works/_form.html.erb +16 -0
- data/app/views/hyrax/vector_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/vector_works/_vector_actions.html.erb +11 -0
- data/app/views/hyrax/vector_works/_vector_work.html.erb +2 -0
- data/app/views/hyrax/vector_works/show.html.erb +31 -0
- data/app/views/records/edit_fields/_coverage.html.erb +3 -0
- data/app/views/records/edit_fields/_should_populate_metadata.html.erb +10 -0
- data/app/vocabs/geo_works/geo_terms.rb +12 -0
- data/config/discovery/geoblacklight-schema.json +214 -0
- data/config/fcrepo_wrapper_test.yml +3 -0
- data/config/geoblacklight.yml +12 -0
- data/config/geoserver.yml +27 -0
- data/config/initializers/geo_server.rb +17 -0
- data/config/initializers/geoblacklight_config.rb +18 -0
- data/config/initializers/simpler_tiles.rb +65 -0
- data/config/locales/image_work.en.yml +8 -0
- data/config/locales/raster_work.en.yml +8 -0
- data/config/locales/vector_work.en.yml +8 -0
- data/config/routes.rb +24 -0
- data/config/simpler_tiles.yml +24 -0
- data/config/solr_wrapper_test.yml +7 -0
- data/docker-compose-full.yml +30 -0
- data/docker-compose.yml +9 -0
- data/geo_works.gemspec +44 -0
- data/lib/generators/geo_works/install_generator.rb +152 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/image_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/raster_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/vector_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/config/authorities/image_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/metadata_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/raster_formats.yml +13 -0
- data/lib/generators/geo_works/templates/config/authorities/vector_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/initializers/hyrax_derivative_path_monkey_patch.rb +18 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/file_sets_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/image_works_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/raster_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/vector_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/geo_works.js +1 -0
- data/lib/generators/geo_works/templates/geo_works.scss +3 -0
- data/lib/generators/geo_works/templates/models/file_set.rb +4 -0
- data/lib/generators/geo_works/templates/models/image_work.rb +7 -0
- data/lib/generators/geo_works/templates/models/raster_work.rb +8 -0
- data/lib/generators/geo_works/templates/models/vector_work.rb +8 -0
- data/lib/generators/geo_works/templates/presenters/file_set_presenter.rb +3 -0
- data/lib/generators/geo_works/templates/spec/actor_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/controller_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/model_spec.rb.erb +9 -0
- data/lib/geo_works.rb +9 -0
- data/lib/geo_works/engine.rb +4 -0
- data/lib/geo_works/version.rb +3 -0
- data/lib/tasks/geo_works_tasks.rake +4 -0
- data/run-docker.sh +16 -0
- data/solr/config/_rest_managed.json +3 -0
- data/solr/config/admin-extra.html +31 -0
- data/solr/config/elevate.xml +36 -0
- data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/config/protwords.txt +21 -0
- data/solr/config/schema.xml +372 -0
- data/solr/config/scripts.conf +24 -0
- data/solr/config/solrconfig.xml +321 -0
- data/solr/config/spellings.txt +2 -0
- data/solr/config/stopwords.txt +58 -0
- data/solr/config/stopwords_en.txt +58 -0
- data/solr/config/synonyms.txt +31 -0
- data/solr/config/xslt/example.xsl +132 -0
- data/solr/config/xslt/example_atom.xsl +67 -0
- data/solr/config/xslt/example_rss.xsl +66 -0
- data/solr/config/xslt/luke.xsl +337 -0
- data/spec/controllers/file_sets_controller_spec.rb +70 -0
- data/spec/controllers/image_works_controller_spec.rb +40 -0
- data/spec/controllers/raster_works_controller_spec.rb +36 -0
- data/spec/controllers/vector_works_controller_spec.rb +69 -0
- data/spec/factories/collections.rb +17 -0
- data/spec/factories/external_metadata_files.rb +20 -0
- data/spec/factories/image_files.rb +32 -0
- data/spec/factories/image_works.rb +69 -0
- data/spec/factories/permission_templates.rb +41 -0
- data/spec/factories/raster_files.rb +35 -0
- data/spec/factories/raster_works.rb +88 -0
- data/spec/factories/sipity_entities.rb +7 -0
- data/spec/factories/users.rb +26 -0
- data/spec/factories/vector_files.rb +31 -0
- data/spec/factories/vector_works.rb +84 -0
- data/spec/factories/workflow_states.rb +6 -0
- data/spec/factories/workflows.rb +6 -0
- data/spec/features/create_image_work_spec.rb +34 -0
- data/spec/features/create_raster_work_spec.rb +35 -0
- data/spec/features/create_vector_work_spec.rb +34 -0
- data/spec/features/image_work_show_spec.rb +62 -0
- data/spec/features/raster_work_show_spec.rb +62 -0
- data/spec/features/vector_work_show_spec.rb +61 -0
- data/spec/forms/geo_works/basic_geo_metadata_form_spec.rb +31 -0
- data/spec/forms/geo_works/external_metadata_file_form_spec.rb +30 -0
- data/spec/forms/geo_works/georeferenced_form_spec.rb +33 -0
- data/spec/forms/hyrax/image_work_form_spec.rb +11 -0
- data/spec/forms/hyrax/raster_work_form_spec.rb +17 -0
- data/spec/forms/hyrax/vector_work_form_spec.rb +17 -0
- data/spec/helpers/bounding_box_helper_spec.rb +39 -0
- data/spec/helpers/geo_works/file_set_actions_helper_spec.rb +70 -0
- data/spec/helpers/geo_works/populate_metadata_helper_spec.rb +31 -0
- data/spec/helpers/geo_works_helper_spec.rb +30 -0
- data/spec/jobs/geoblacklight_job_spec.rb +18 -0
- data/spec/jobs/geoserver_delivery_job_spec.rb +45 -0
- data/spec/models/concerns/basic_geo_metadata_spec.rb +21 -0
- data/spec/models/concerns/geo_works/file_set/derivatives_spec.rb +102 -0
- data/spec/models/concerns/geo_works/file_set/geo_file_format_behavior_spec.rb +56 -0
- data/spec/models/external_metadata_file_spec.rb +118 -0
- data/spec/models/file_set_spec.rb +9 -0
- data/spec/models/image_file_spec.rb +48 -0
- data/spec/models/image_work_spec.rb +71 -0
- data/spec/models/raster_file_spec.rb +48 -0
- data/spec/models/raster_work_spec.rb +122 -0
- data/spec/models/solr_document_spec.rb +41 -0
- data/spec/models/vector_file_spec.rb +48 -0
- data/spec/models/vector_work_spec.rb +109 -0
- data/spec/presenters/file_set_presenter_spec.rb +13 -0
- data/spec/presenters/geo_works_show_presenter_spec.rb +46 -0
- data/spec/presenters/image_work_show_presenter_spec.rb +51 -0
- data/spec/presenters/raster_work_show_presenter_spec.rb +74 -0
- data/spec/presenters/vector_work_show_presenter_spec.rb +41 -0
- data/spec/processors/geo_works/geoblacklight_event_processor_spec.rb +80 -0
- data/spec/processors/geo_works/processors/base_geo_processor_spec.rb +115 -0
- data/spec/processors/geo_works/processors/gdal_spec.rb +59 -0
- data/spec/processors/geo_works/processors/image_spec.rb +64 -0
- data/spec/processors/geo_works/processors/ogr_spec.rb +36 -0
- data/spec/processors/geo_works/processors/raster/aig_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/raster/dem_spec.rb +30 -0
- data/spec/processors/geo_works/processors/raster/info_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/processor_spec.rb +39 -0
- data/spec/processors/geo_works/processors/rendering_spec.rb +64 -0
- data/spec/processors/geo_works/processors/vector/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/vector/info_spec.rb +50 -0
- data/spec/processors/geo_works/processors/vector/processor_spec.rb +28 -0
- data/spec/processors/geo_works/processors/vector/shapefile_spec.rb +17 -0
- data/spec/processors/geo_works/processors/zip_spec.rb +39 -0
- data/spec/renderers/geo_works/coverage_renderer_spec.rb +21 -0
- data/spec/services/geo_works/delivery/geoserver_spec.rb +117 -0
- data/spec/services/geo_works/delivery_service_spec.rb +24 -0
- data/spec/services/geo_works/discovery/abstract_document_spec.rb +23 -0
- data/spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb +35 -0
- data/spec/services/geo_works/discovery/document_builder/wxs_spec.rb +71 -0
- data/spec/services/geo_works/discovery/document_builder_spec.rb +220 -0
- data/spec/services/geo_works/discovery/geoblacklight_document_spec.rb +20 -0
- data/spec/services/geo_works/event_generator_spec.rb +18 -0
- data/spec/services/geo_works/events_generator/geoblacklight_event_generator_spec.rb +84 -0
- data/spec/services/geo_works/events_generator/geoserver_event_generator_spec.rb +22 -0
- data/spec/services/geo_works/raster_format_service_spec.rb +13 -0
- data/spec/services/hyrax/derivative_path_spec.rb +26 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/support/backport_test.rb +14 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/database_cleaner.rb +18 -0
- data/spec/support/factory_girl.rb +3 -0
- data/spec/support/features.rb +14 -0
- data/spec/support/features/session_helpers.rb +40 -0
- data/spec/support/fixture_reader.rb +7 -0
- data/spec/support/helpers/controller_level_helpers.rb +27 -0
- data/spec/support/views/test_view_helpers.rb +10 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +24 -0
- data/spec/values/coverage_spec.rb +40 -0
- data/tasks/geo_works.rake +39 -0
- data/template.rb +10 -0
- metadata +789 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
function boundingBoxSelector(options) {
|
2
|
+
var inputId = options.inputId;
|
3
|
+
var initialBounds;
|
4
|
+
var coverage = options.coverage;
|
5
|
+
if (!coverage && inputId ) {
|
6
|
+
var coverage = $(inputId).val();
|
7
|
+
}
|
8
|
+
|
9
|
+
if (coverage) {
|
10
|
+
initialBounds = coverageToBounds(coverage);
|
11
|
+
updateBboxInputs(initialBounds);
|
12
|
+
} else {
|
13
|
+
initialBounds = L.latLngBounds([[-50, -100], [72, 100]]);
|
14
|
+
};
|
15
|
+
|
16
|
+
var map = L.map('bbox', {
|
17
|
+
maxBounds: [[-100, -180], [100, 180]],
|
18
|
+
touchZoom: false,
|
19
|
+
scrollWheelZoom: false
|
20
|
+
}).fitBounds(initialBounds);
|
21
|
+
|
22
|
+
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
|
23
|
+
maxZoom: 18
|
24
|
+
}).addTo(map);
|
25
|
+
L.Control.geocoder({ position: 'topleft' }).addTo(map);
|
26
|
+
|
27
|
+
if (options.readonly) {
|
28
|
+
new L.Rectangle(initialBounds, { color: 'white', weight: 2, opacity: 0.9 }).addTo(map);
|
29
|
+
} else {
|
30
|
+
boundingBox = new L.BoundingBox({ bounds: initialBounds,
|
31
|
+
buttonPosition: 'topright', }).addTo(map);
|
32
|
+
|
33
|
+
boundingBox.on('change', function() {
|
34
|
+
$(inputId).val(boundsToCoverage(this.getBounds()));
|
35
|
+
updateBboxInputs(this.getBounds())
|
36
|
+
});
|
37
|
+
|
38
|
+
boundingBox.enable();
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
function clampBounds(bounds) {
|
43
|
+
try {
|
44
|
+
n = valBetween(bounds.getNorth(), -90, 90);
|
45
|
+
e = valBetween(bounds.getEast(), -180, 180);
|
46
|
+
s = valBetween(bounds.getSouth(), -90, 90);
|
47
|
+
w = valBetween(bounds.getWest(), -180, 180);
|
48
|
+
return L.latLngBounds([s, w], [n, e]);
|
49
|
+
}
|
50
|
+
catch (err) {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
function valBetween(val, min, max) {
|
56
|
+
return (Math.min(max, Math.max(min, val)));
|
57
|
+
};
|
58
|
+
|
59
|
+
function coverageToBounds(coverage) {
|
60
|
+
try {
|
61
|
+
n = String(coverage).match(/northlimit=([\.\d\-]+)/m);
|
62
|
+
e = String(coverage).match(/eastlimit=([\.\d\-]+)/m);
|
63
|
+
s = String(coverage).match(/southlimit=([\.\d\-]+)/m);
|
64
|
+
w = String(coverage).match(/westlimit=([\.\d\-]+)/m);
|
65
|
+
|
66
|
+
if (n && e && s && w) {
|
67
|
+
return L.latLngBounds([s[1], w[1]], [n[1], e[1]]);
|
68
|
+
} else {
|
69
|
+
return null;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
catch (err) {
|
73
|
+
return null;
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
function boundsToCoverage(bounds) {
|
78
|
+
try {
|
79
|
+
bounds = clampBounds(bounds);
|
80
|
+
n = bounds.getNorth().toFixed(6);
|
81
|
+
e = bounds.getEast().toFixed(6);
|
82
|
+
s = bounds.getSouth().toFixed(6);
|
83
|
+
w = bounds.getWest().toFixed(6);
|
84
|
+
|
85
|
+
if (n && e && s && w) {
|
86
|
+
return 'northlimit=' + n + '; ' +
|
87
|
+
'eastlimit=' + e + '; ' +
|
88
|
+
'southlimit=' + s + '; ' +
|
89
|
+
'westlimit=' + w + '; ' +
|
90
|
+
'units=degrees; ' +
|
91
|
+
'projection=EPSG:4326';
|
92
|
+
} else {
|
93
|
+
return '';
|
94
|
+
}
|
95
|
+
}
|
96
|
+
catch (err) {
|
97
|
+
return '';
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
function updateBboxInputs(bounds) {
|
102
|
+
bounds = clampBounds(bounds);
|
103
|
+
$('#bbox-north').val(bounds.getNorth().toFixed(6));
|
104
|
+
$('#bbox-east').val(bounds.getEast().toFixed(6));
|
105
|
+
$('#bbox-south').val(bounds.getSouth().toFixed(6));
|
106
|
+
$('#bbox-west').val(bounds.getWest().toFixed(6));
|
107
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import ChildWorks from "geo_works/relationships/child_works"
|
2
|
+
import ParentWorks from "geo_works/relationships/parent_works"
|
3
|
+
export default class Initializer {
|
4
|
+
constructor() {
|
5
|
+
this.child_works = new ChildWorks('#child-works')
|
6
|
+
this.parent_works = new ParentWorks('#parent-works')
|
7
|
+
}
|
8
|
+
}
|
@@ -0,0 +1,467 @@
|
|
1
|
+
/*
|
2
|
+
* Leaflet.boundingbox (Modified from Leaflet.locationfilter)
|
3
|
+
* Copyright (C) 2012, Tripbirds.com
|
4
|
+
* Copyright (C) 2014, Eliot Jordan
|
5
|
+
* Licensed under the MIT License.
|
6
|
+
*/
|
7
|
+
|
8
|
+
L.LatLngBounds.prototype.modify = function(map, amount) {
|
9
|
+
var sw = this.getSouthWest(),
|
10
|
+
ne = this.getNorthEast(),
|
11
|
+
swPoint = map.latLngToLayerPoint(sw),
|
12
|
+
nePoint = map.latLngToLayerPoint(ne);
|
13
|
+
|
14
|
+
sw = map.layerPointToLatLng(new L.Point(swPoint.x-amount, swPoint.y+amount));
|
15
|
+
ne = map.layerPointToLatLng(new L.Point(nePoint.x+amount, nePoint.y-amount));
|
16
|
+
|
17
|
+
return new L.LatLngBounds(sw, ne);
|
18
|
+
};
|
19
|
+
|
20
|
+
L.Control.Button = L.Class.extend({
|
21
|
+
initialize: function(options) {
|
22
|
+
L.Util.setOptions(this, options);
|
23
|
+
},
|
24
|
+
|
25
|
+
addTo: function(container) {
|
26
|
+
container.addButton(this);
|
27
|
+
return this;
|
28
|
+
},
|
29
|
+
|
30
|
+
onAdd: function (buttonContainer) {
|
31
|
+
this._buttonContainer = buttonContainer;
|
32
|
+
this._button = L.DomUtil.create('a', this.options.className, this._buttonContainer.getContainer());
|
33
|
+
this._button.href = '#';
|
34
|
+
this.setText(this.options.text);
|
35
|
+
|
36
|
+
var that = this;
|
37
|
+
this._onClick = function(event) {
|
38
|
+
that.options.onClick.call(that, event);
|
39
|
+
};
|
40
|
+
|
41
|
+
L.DomEvent
|
42
|
+
.on(this._button, 'click', L.DomEvent.stopPropagation)
|
43
|
+
.on(this._button, 'mousedown', L.DomEvent.stopPropagation)
|
44
|
+
.on(this._button, 'dblclick', L.DomEvent.stopPropagation)
|
45
|
+
.on(this._button, 'click', L.DomEvent.preventDefault)
|
46
|
+
.on(this._button, 'click', this._onClick, this);
|
47
|
+
},
|
48
|
+
|
49
|
+
remove: function() {
|
50
|
+
L.DomEvent.off(this._button, "click", this._onClick);
|
51
|
+
this._buttonContainer.getContainer().removeChild(this._button);
|
52
|
+
},
|
53
|
+
|
54
|
+
setText: function(text) {
|
55
|
+
this._button.title = text;
|
56
|
+
this._button.innerHTML = text;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
L.Control.ButtonContainer = L.Control.extend({
|
61
|
+
options: {
|
62
|
+
position: 'topright'
|
63
|
+
},
|
64
|
+
|
65
|
+
getContainer: function() {
|
66
|
+
if (!this._container) {
|
67
|
+
this._container = L.DomUtil.create('div', this.options.className);
|
68
|
+
}
|
69
|
+
return this._container;
|
70
|
+
},
|
71
|
+
|
72
|
+
onAdd: function (map) {
|
73
|
+
this._map = map;
|
74
|
+
return this.getContainer();
|
75
|
+
},
|
76
|
+
|
77
|
+
addButton: function(button) {
|
78
|
+
button.onAdd(this);
|
79
|
+
},
|
80
|
+
|
81
|
+
addClass: function(className) {
|
82
|
+
L.DomUtil.addClass(this.getContainer(), className);
|
83
|
+
},
|
84
|
+
|
85
|
+
removeClass: function(className) {
|
86
|
+
L.DomUtil.removeClass(this.getContainer(), className);
|
87
|
+
}
|
88
|
+
});
|
89
|
+
|
90
|
+
L.BoundingBox = L.Class.extend({
|
91
|
+
includes: L.Mixin.Events,
|
92
|
+
|
93
|
+
options: {
|
94
|
+
adjustButton: {
|
95
|
+
text: "Select Area"
|
96
|
+
},
|
97
|
+
buttonPosition: 'topright'
|
98
|
+
},
|
99
|
+
|
100
|
+
initialize: function(options) {
|
101
|
+
L.Util.setOptions(this, options);
|
102
|
+
},
|
103
|
+
|
104
|
+
addTo: function(map) {
|
105
|
+
map.addLayer(this);
|
106
|
+
return this;
|
107
|
+
},
|
108
|
+
|
109
|
+
onAdd: function(map) {
|
110
|
+
this._map = map;
|
111
|
+
|
112
|
+
if (this.options.adjustButton) {
|
113
|
+
this._initializeButtonContainer();
|
114
|
+
}
|
115
|
+
|
116
|
+
if (this.options.enable) {
|
117
|
+
this.enable();
|
118
|
+
}
|
119
|
+
},
|
120
|
+
|
121
|
+
onRemove: function(map) {
|
122
|
+
this.disable();
|
123
|
+
if (this._buttonContainer) {
|
124
|
+
this._buttonContainer.removeFrom(map);
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
/* Get the current filter bounds */
|
129
|
+
getBounds: function() {
|
130
|
+
return new L.LatLngBounds(this._sw, this._ne);
|
131
|
+
},
|
132
|
+
|
133
|
+
setBounds: function(bounds) {
|
134
|
+
this._nw = bounds.getNorthWest();
|
135
|
+
this._ne = bounds.getNorthEast();
|
136
|
+
this._sw = bounds.getSouthWest();
|
137
|
+
this._se = bounds.getSouthEast();
|
138
|
+
if (this.isEnabled()) {
|
139
|
+
this._draw();
|
140
|
+
this.fire("change", {bounds: bounds});
|
141
|
+
}
|
142
|
+
},
|
143
|
+
|
144
|
+
_setBounds: function(bounds) {
|
145
|
+
this.setBounds(bounds);
|
146
|
+
this._map.fitBounds(bounds);
|
147
|
+
},
|
148
|
+
|
149
|
+
isEnabled: function() {
|
150
|
+
return this._enabled;
|
151
|
+
},
|
152
|
+
|
153
|
+
/* Draw a rectangle */
|
154
|
+
_drawRectangle: function(bounds, options) {
|
155
|
+
options = options || {};
|
156
|
+
var defaultOptions = {
|
157
|
+
stroke: false,
|
158
|
+
fill: true,
|
159
|
+
fillColor: "black",
|
160
|
+
fillOpacity: 0.3,
|
161
|
+
clickable: false
|
162
|
+
};
|
163
|
+
options = L.Util.extend(defaultOptions, options);
|
164
|
+
var rect = new L.Rectangle(bounds, options);
|
165
|
+
rect.addTo(this._layer);
|
166
|
+
return rect;
|
167
|
+
},
|
168
|
+
|
169
|
+
/* Draw a draggable marker */
|
170
|
+
_drawImageMarker: function(point, options) {
|
171
|
+
var marker = new L.Marker(point, {
|
172
|
+
icon: new L.DivIcon({
|
173
|
+
iconAnchor: options.anchor,
|
174
|
+
iconSize: options.size,
|
175
|
+
className: options.className
|
176
|
+
}),
|
177
|
+
draggable: true
|
178
|
+
});
|
179
|
+
marker.addTo(this._layer);
|
180
|
+
return marker;
|
181
|
+
},
|
182
|
+
|
183
|
+
/* Draw a move marker. Sets up drag listener that updates the
|
184
|
+
filter corners and redraws the filter when the move marker is
|
185
|
+
moved */
|
186
|
+
_drawMoveMarker: function(point) {
|
187
|
+
var that = this;
|
188
|
+
this._moveMarker = this._drawImageMarker(point, {
|
189
|
+
"className": "location-filter move-marker",
|
190
|
+
"anchor": [-10, -10],
|
191
|
+
"size": [13,13]
|
192
|
+
});
|
193
|
+
this._moveMarker.on('drag', function(e) {
|
194
|
+
var markerPos = that._moveMarker.getLatLng(),
|
195
|
+
latDelta = markerPos.lat-that._nw.lat,
|
196
|
+
lngDelta = markerPos.lng-that._nw.lng;
|
197
|
+
that._nw = new L.LatLng(that._nw.lat+latDelta, that._nw.lng+lngDelta, true);
|
198
|
+
that._ne = new L.LatLng(that._ne.lat+latDelta, that._ne.lng+lngDelta, true);
|
199
|
+
that._sw = new L.LatLng(that._sw.lat+latDelta, that._sw.lng+lngDelta, true);
|
200
|
+
that._se = new L.LatLng(that._se.lat+latDelta, that._se.lng+lngDelta, true);
|
201
|
+
that._draw();
|
202
|
+
});
|
203
|
+
this._setupDragendListener(this._moveMarker);
|
204
|
+
return this._moveMarker;
|
205
|
+
},
|
206
|
+
|
207
|
+
/* Draw a resize marker */
|
208
|
+
_drawResizeMarker: function(point, latFollower, lngFollower, otherPos) {
|
209
|
+
return this._drawImageMarker(point, {
|
210
|
+
"className": "location-filter resize-marker",
|
211
|
+
"anchor": [7, 6],
|
212
|
+
"size": [13, 12]
|
213
|
+
});
|
214
|
+
},
|
215
|
+
|
216
|
+
/* Track moving of the given resize marker and update the markers
|
217
|
+
given in options.moveAlong to match the position of the moved
|
218
|
+
marker. Update filter corners and redraw the filter */
|
219
|
+
_setupResizeMarkerTracking: function(marker, options) {
|
220
|
+
var that = this;
|
221
|
+
marker.on('drag', function(e) {
|
222
|
+
var curPosition = marker.getLatLng(),
|
223
|
+
latMarker = options.moveAlong.lat,
|
224
|
+
lngMarker = options.moveAlong.lng;
|
225
|
+
// Move follower markers when this marker is moved
|
226
|
+
latMarker.setLatLng(new L.LatLng(curPosition.lat, latMarker.getLatLng().lng, true));
|
227
|
+
lngMarker.setLatLng(new L.LatLng(lngMarker.getLatLng().lat, curPosition.lng, true));
|
228
|
+
// Sort marker positions in nw, ne, sw, se order
|
229
|
+
var corners = [that._nwMarker.getLatLng(),
|
230
|
+
that._neMarker.getLatLng(),
|
231
|
+
that._swMarker.getLatLng(),
|
232
|
+
that._seMarker.getLatLng()];
|
233
|
+
corners.sort(function(a, b) {
|
234
|
+
if (a.lat != b.lat)
|
235
|
+
return b.lat-a.lat;
|
236
|
+
else
|
237
|
+
return a.lng-b.lng;
|
238
|
+
});
|
239
|
+
// Update corner points and redraw everything except the resize markers
|
240
|
+
that._nw = corners[0];
|
241
|
+
that._ne = corners[1];
|
242
|
+
that._sw = corners[2];
|
243
|
+
that._se = corners[3];
|
244
|
+
that._draw({repositionResizeMarkers: false});
|
245
|
+
});
|
246
|
+
this._setupDragendListener(marker);
|
247
|
+
},
|
248
|
+
|
249
|
+
/* Emit a change event whenever dragend is triggered on the
|
250
|
+
given marker */
|
251
|
+
_setupDragendListener: function(marker) {
|
252
|
+
var that = this;
|
253
|
+
marker.on('dragend', function(e) {
|
254
|
+
that.fire("change", {bounds: that.getBounds()});
|
255
|
+
});
|
256
|
+
},
|
257
|
+
|
258
|
+
/* Create bounds for the mask rectangles and the location
|
259
|
+
filter rectangle */
|
260
|
+
_calculateBounds: function() {
|
261
|
+
var mapBounds = this._map.getBounds(),
|
262
|
+
outerBounds = new L.LatLngBounds(
|
263
|
+
new L.LatLng(mapBounds.getSouthWest().lat-0.1,
|
264
|
+
mapBounds.getSouthWest().lng-0.1, true),
|
265
|
+
new L.LatLng(mapBounds.getNorthEast().lat+0.1,
|
266
|
+
mapBounds.getNorthEast().lng+0.1, true)
|
267
|
+
);
|
268
|
+
|
269
|
+
// The south west and north east points of the mask */
|
270
|
+
this._osw = outerBounds.getSouthWest();
|
271
|
+
this._one = outerBounds.getNorthEast();
|
272
|
+
|
273
|
+
// Bounds for the mask rectangles
|
274
|
+
this._northBounds = new L.LatLngBounds(new L.LatLng(this._ne.lat, this._osw.lng, true), this._one);
|
275
|
+
this._westBounds = new L.LatLngBounds(new L.LatLng(this._sw.lat, this._osw.lng, true), this._nw);
|
276
|
+
this._eastBounds = new L.LatLngBounds(this._se, new L.LatLng(this._ne.lat, this._one.lng, true));
|
277
|
+
this._southBounds = new L.LatLngBounds(this._osw, new L.LatLng(this._sw.lat, this._one.lng, true));
|
278
|
+
},
|
279
|
+
|
280
|
+
/* Initializes rectangles and markers */
|
281
|
+
_initialDraw: function() {
|
282
|
+
if (this._initialDrawCalled) {
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
|
286
|
+
this._layer = new L.LayerGroup();
|
287
|
+
|
288
|
+
// Calculate filter bounds
|
289
|
+
this._calculateBounds();
|
290
|
+
|
291
|
+
// Create rectangles
|
292
|
+
this._northRect = this._drawRectangle(this._northBounds);
|
293
|
+
this._westRect = this._drawRectangle(this._westBounds);
|
294
|
+
this._eastRect = this._drawRectangle(this._eastBounds);
|
295
|
+
this._southRect = this._drawRectangle(this._southBounds);
|
296
|
+
this._innerRect = this._drawRectangle(this.getBounds(), {
|
297
|
+
fillOpacity: 0,
|
298
|
+
stroke: true,
|
299
|
+
color: "white",
|
300
|
+
weight: 1,
|
301
|
+
opacity: 0.9
|
302
|
+
});
|
303
|
+
|
304
|
+
// Create resize markers
|
305
|
+
this._nwMarker = this._drawResizeMarker(this._nw);
|
306
|
+
this._neMarker = this._drawResizeMarker(this._ne);
|
307
|
+
this._swMarker = this._drawResizeMarker(this._sw);
|
308
|
+
this._seMarker = this._drawResizeMarker(this._se);
|
309
|
+
|
310
|
+
// Setup tracking of resize markers. Each marker has pair of
|
311
|
+
// follower markers that must be moved whenever the marker is
|
312
|
+
// moved. For example, whenever the north west resize marker
|
313
|
+
// moves, the south west marker must move along on the x-axis
|
314
|
+
// and the north east marker must move on the y axis
|
315
|
+
this._setupResizeMarkerTracking(this._nwMarker, {moveAlong: {lat: this._neMarker, lng: this._swMarker}});
|
316
|
+
this._setupResizeMarkerTracking(this._neMarker, {moveAlong: {lat: this._nwMarker, lng: this._seMarker}});
|
317
|
+
this._setupResizeMarkerTracking(this._swMarker, {moveAlong: {lat: this._seMarker, lng: this._nwMarker}});
|
318
|
+
this._setupResizeMarkerTracking(this._seMarker, {moveAlong: {lat: this._swMarker, lng: this._neMarker}});
|
319
|
+
|
320
|
+
// Create move marker
|
321
|
+
this._moveMarker = this._drawMoveMarker(this._nw);
|
322
|
+
|
323
|
+
this._initialDrawCalled = true;
|
324
|
+
},
|
325
|
+
|
326
|
+
/* Reposition all rectangles and markers to the current filter bounds. */
|
327
|
+
_draw: function(options) {
|
328
|
+
options = L.Util.extend({repositionResizeMarkers: true}, options);
|
329
|
+
|
330
|
+
// Calculate filter bounds
|
331
|
+
this._calculateBounds();
|
332
|
+
|
333
|
+
// Reposition rectangles
|
334
|
+
this._northRect.setBounds(this._northBounds);
|
335
|
+
this._westRect.setBounds(this._westBounds);
|
336
|
+
this._eastRect.setBounds(this._eastBounds);
|
337
|
+
this._southRect.setBounds(this._southBounds);
|
338
|
+
this._innerRect.setBounds(this.getBounds());
|
339
|
+
|
340
|
+
// Reposition resize markers
|
341
|
+
if (options.repositionResizeMarkers) {
|
342
|
+
this._nwMarker.setLatLng(this._nw);
|
343
|
+
this._neMarker.setLatLng(this._ne);
|
344
|
+
this._swMarker.setLatLng(this._sw);
|
345
|
+
this._seMarker.setLatLng(this._se);
|
346
|
+
}
|
347
|
+
|
348
|
+
// Reposition the move marker
|
349
|
+
this._moveMarker.setLatLng(this._nw);
|
350
|
+
},
|
351
|
+
|
352
|
+
/* Adjust the location filter to the current map bounds */
|
353
|
+
_adjustToMap: function() {
|
354
|
+
this.setBounds(this._map.getBounds());
|
355
|
+
this._map.zoomOut();
|
356
|
+
},
|
357
|
+
|
358
|
+
/* Enable the location filter */
|
359
|
+
enable: function() {
|
360
|
+
if (this._enabled) {
|
361
|
+
return;
|
362
|
+
}
|
363
|
+
|
364
|
+
// Initialize corners
|
365
|
+
var bounds;
|
366
|
+
if (this._sw && this._ne) {
|
367
|
+
bounds = new L.LatLngBounds(this._sw, this._ne);
|
368
|
+
} else if (this.options.bounds) {
|
369
|
+
bounds = this.options.bounds;
|
370
|
+
} else {
|
371
|
+
bounds = this._map.getBounds();
|
372
|
+
}
|
373
|
+
this._map.invalidateSize();
|
374
|
+
this._nw = bounds.getNorthWest();
|
375
|
+
this._ne = bounds.getNorthEast();
|
376
|
+
this._sw = bounds.getSouthWest();
|
377
|
+
this._se = bounds.getSouthEast();
|
378
|
+
|
379
|
+
|
380
|
+
// Update buttons
|
381
|
+
if (this._buttonContainer) {
|
382
|
+
this._buttonContainer.addClass("enabled");
|
383
|
+
}
|
384
|
+
|
385
|
+
if (this.options.adjustButton) {
|
386
|
+
this._createAdjustButton();
|
387
|
+
}
|
388
|
+
|
389
|
+
// Draw filter
|
390
|
+
this._initialDraw();
|
391
|
+
this._draw();
|
392
|
+
|
393
|
+
// Set up map move event listener
|
394
|
+
var that = this;
|
395
|
+
this._moveHandler = function() {
|
396
|
+
that._draw();
|
397
|
+
};
|
398
|
+
this._map.on("move", this._moveHandler);
|
399
|
+
|
400
|
+
// Add the filter layer to the map
|
401
|
+
this._layer.addTo(this._map);
|
402
|
+
|
403
|
+
// Zoom out the map if necessary
|
404
|
+
var mapBounds = this._map.getBounds();
|
405
|
+
bounds = new L.LatLngBounds(this._sw, this._ne).modify(this._map, 10);
|
406
|
+
if (!mapBounds.contains(bounds.getSouthWest()) || !mapBounds.contains(bounds.getNorthEast())) {
|
407
|
+
this._map.fitBounds(bounds);
|
408
|
+
}
|
409
|
+
|
410
|
+
this._enabled = true;
|
411
|
+
|
412
|
+
// Fire the enabled event
|
413
|
+
this.fire("enabled");
|
414
|
+
},
|
415
|
+
|
416
|
+
/* Disable the location filter */
|
417
|
+
disable: function() {
|
418
|
+
if (!this._enabled) {
|
419
|
+
return;
|
420
|
+
}
|
421
|
+
|
422
|
+
// Update buttons
|
423
|
+
if (this._buttonContainer) {
|
424
|
+
this._buttonContainer.removeClass("enabled");
|
425
|
+
}
|
426
|
+
|
427
|
+
if (this._adjustButton) {
|
428
|
+
this._adjustButton.remove();
|
429
|
+
}
|
430
|
+
|
431
|
+
// Remove event listener
|
432
|
+
this._map.off("move", this._moveHandler);
|
433
|
+
|
434
|
+
// Remove rectangle layer from map
|
435
|
+
this._map.removeLayer(this._layer);
|
436
|
+
|
437
|
+
this._enabled = false;
|
438
|
+
|
439
|
+
// Fire the disabled event
|
440
|
+
this.fire("disabled");
|
441
|
+
},
|
442
|
+
|
443
|
+
/* Create a button that allows the user to adjust the location
|
444
|
+
filter to the current zoom */
|
445
|
+
_createAdjustButton: function() {
|
446
|
+
var that = this;
|
447
|
+
this._adjustButton = new L.Control.Button({
|
448
|
+
className: "adjust-button",
|
449
|
+
text: this.options.adjustButton.text,
|
450
|
+
|
451
|
+
onClick: function(event) {
|
452
|
+
that._adjustToMap();
|
453
|
+
that.fire("adjustToZoomClick");
|
454
|
+
}
|
455
|
+
}).addTo(this._buttonContainer);
|
456
|
+
},
|
457
|
+
|
458
|
+
// Create the button container
|
459
|
+
_initializeButtonContainer: function() {
|
460
|
+
var that = this;
|
461
|
+
this._buttonContainer = new L.Control.ButtonContainer({
|
462
|
+
className: "location-filter button-container leaflet-bar",
|
463
|
+
position: this.options.buttonPosition
|
464
|
+
});
|
465
|
+
this._buttonContainer.addTo(this._map);
|
466
|
+
}
|
467
|
+
});
|