| Path: | lib/gm_plugin/helper.rb |
| Last Update: | Fri Jan 05 13:02:22 Romance Standard Time 2007 |
Creates a GPolyline object from a georuby line string. Assumes the points of the line strings are stored in Longitude(x)/Latitude(y) order.
# File lib/gm_plugin/helper.rb, line 4 4: def self.from_georuby(line_string,color = nil,weight = nil,opacity = nil) 5: GPolyline.new(line_string.points.collect { |point| GLatLng.new([point.y,point.x])},color,weight,opacity) 6: end
Creates a GMarker object from a georuby point. Accepts the same options as the GMarker constructor. Assumes the points of the line strings are stored in Longitude(x)/Latitude(y) order.
# File lib/gm_plugin/helper.rb, line 11
11: def self.from_georuby(point,options = {})
12: GMarker.new([point.y,point.x],options)
13: end
Creates a GLatLng object from a georuby point. Assumes the points of the line strings are stored in Longitude(x)/Latitude(y) order.
# File lib/gm_plugin/helper.rb, line 18
18: def self.from_georuby(point,unbounded = nil)
19: GLatLng.new([point.y,point.x],unbounded)
20: end
Creates a GLatLng object from a georuby point. Assumes the points of the line strings are stored in Longitude(x)/Latitude(y) order.
# File lib/gm_plugin/helper.rb, line 25
25: def self.from_georuby(envelope)
26: GLatLngBounds.new(GLatLng.from_georuby(envelope.lower_corner),
27: GLatLng.from_georuby(envelope.upper_corner))
28: end
Creates a GPolygon object from a georuby polygon or line string. Assumes the points of the line strings are stored in Longitude(x)/Latitude(y) order.
# File lib/gm_plugin/helper.rb, line 33
33: def self.from_georuby(ls_or_p, stroke_color="#000000",stroke_weight=1,stroke_opacity=1.0,color="#ff0000",opacity=1.0)
34: if ls_or_p.is_a?(GeoRuby::SimpleFeatures::LineString)
35: GPolygon.new(ls_or_p.collect { |point| GLatLng.new([point.y,point.x])},stroke_color,stroke_weight,stroke_opacity,color,opacity)
36: else
37: GPolygon.new(ls_or_p[0].collect { |point| GLatLng.new([point.y,point.x])},stroke_color,stroke_weight,stroke_opacity,color,opacity)
38: end
39: end