spatial_features 1.6.0 → 1.6.1
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: c4613b63bcb5c5ac6eff245ae9c2cda4ef38b948
|
4
|
+
data.tar.gz: 7f6d3a777c72868e754a3d452dc1f086bea2d194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caea9449c010f38ed4648254d3a67383be6cbcf79171c34e50e0a61af422da01561261a22e96c54ca3d4fa928f10b9aa92aefba28061337fe231168e5cb861d0
|
7
|
+
data.tar.gz: aed8dea2e9ed4344aec3fb8aa4886143734cedc95a33677b9b642e62c377220ec482269626cb540dc9507a5def1863c48e1fd9da58923a9f1acf8fb50ed84e1d
|
@@ -2,6 +2,18 @@ module SpatialFeatures
|
|
2
2
|
mattr_accessor :default_cache_buffer_in_meters
|
3
3
|
self.default_cache_buffer_in_meters = 100
|
4
4
|
|
5
|
+
def self.update_proximity(*klasses)
|
6
|
+
klasses.permutation(2).each do |klass, clazz|
|
7
|
+
klass.without_spatial_cache(clazz).find_each do |record|
|
8
|
+
cache_record_proximity(record, clazz)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
klasses.each do |klass|
|
13
|
+
update_stale_spatial_cache(klass)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
5
17
|
def self.update_spatial_cache(scope)
|
6
18
|
scope.with_stale_spatial_cache.includes(:spatial_cache).find_each do |record|
|
7
19
|
record.spatial_cache.each do |spatial_cache|
|
@@ -9,6 +9,8 @@ module SpatialFeatures
|
|
9
9
|
scope :with_features, lambda { joins(:features).uniq }
|
10
10
|
scope :without_features, lambda { joins("LEFT OUTER JOIN features ON features.spatial_model_type = '#{name}' AND features.spatial_model_id = #{table_name}.id").where("features.id IS NULL") }
|
11
11
|
|
12
|
+
scope :with_spatial_cache, lambda {|klass| joins(:spatial_cache).where(:spatial_caches => { :intersection_model_type => klass }).uniq }
|
13
|
+
scope :without_spatial_cache, lambda {|klass| where.not(:id => with_spatial_cache(klass)) }
|
12
14
|
scope :with_stale_spatial_cache, lambda { joins(:spatial_cache).where("#{table_name}.features_hash != spatial_caches.features_hash").uniq } if has_spatial_features_hash?
|
13
15
|
|
14
16
|
has_many :spatial_cache, :as => :spatial_model, :dependent => :delete_all
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spatial_features
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
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: 2016-
|
12
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|