module SpatialExtensions
Private Instance Methods
abstract_proximity_action(scope, target, distance) { || ... }
click to toggle source
# File lib/spatial_features/controller_helpers/spatial_extensions.rb, line 11 def abstract_proximity_action(scope, target, distance, &block) @nearby_records = scope_for_search(scope).within_buffer(target, distance, :distance => true, :intersection_area => true).order('distance_in_meters ASC, intersection_area_in_square_meters DESC, id ASC') @target = target yield if block_given? respond_to do |format| format.html { render :template => 'shared/spatial/feature_proximity', :layout => false } format.kml { render :template => 'shared/spatial/feature_proximity' } end end
abstract_refresh_geometry_action(models)
click to toggle source
# File lib/spatial_features/controller_helpers/spatial_extensions.rb, line 4 def abstract_refresh_geometry_action(models) Array.wrap(models).each do |model| model.failed_feature_update_jobs.destroy_all model.delay_update_features! end end
abstract_venn_polygons_action(scope, target) { || ... }
click to toggle source
# File lib/spatial_features/controller_helpers/spatial_extensions.rb, line 23 def abstract_venn_polygons_action(scope, target, &block) @venn_polygons = SpatialFeatures.venn_polygons(scope_for_search(scope).intersecting(target), target.class.where(:id => target), :target => target) @klass = klass_for_search(scope) @target = target yield if block_given? respond_to do |format| format.kml { render :template => 'shared/spatial/feature_venn_polygons' } end end
klass_for_search(scope_or_class)
click to toggle source
# File lib/spatial_features/controller_helpers/spatial_extensions.rb, line 35 def klass_for_search(scope_or_class) scope_or_class.is_a?(ActiveRecord::Relation) ? scope_or_class.klass : scope_or_class end
scope_for_search(scope)
click to toggle source
# File lib/spatial_features/controller_helpers/spatial_extensions.rb, line 39 def scope_for_search(scope) params.key?(:ids) ? scope.where(:id => params[:ids]) : scope end