Class GeoRuby::SimpleFeatures::GeometryFactory
In: lib/geo_ruby/simple_features/geometry_factory.rb
Parent: Object

Creates a new geometry according to constructions received from a parser, for example EWKBParser.

Methods

Attributes

geometry  [R]  the built geometry

Public Class methods

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 18
18:       def initialize
19:         @geometry_stack = []
20:       end

Public Instance methods

abort a geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 74
74:       def abort_geometry
75:         reset
76:       end

add a 2D point to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 26
26:       def add_point_x_y(x,y)
27:         @geometry_stack.last.set_x_y(x,y)
28:       end

add a 2D point with M to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 42
42:       def add_point_x_y_m(x,y,m)
43:         @geometry_stack.last.set_x_y(x,y)
44:         @geometry_stack.last.m=m
45:       end

add a 3D point to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 34
34:       def add_point_x_y_z(x,y,z)
35:         @geometry_stack.last.set_x_y_z(x,y,z)
36:       end

add a 3D point with M to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 51
51:       def add_point_x_y_z_m(x,y,z,m)
52:         @geometry_stack.last.set_x_y_z(x,y,z)
53:         @geometry_stack.last.m=m
54:       end

add 2D points to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 30
30:       def add_points_x_y(xy)
31:         xy.each_slice(2) {|slice| add_point_x_y(*slice)}
32:       end

add 2D points with M to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 47
47:       def add_points_x_y_m(xym)
48:         xym.each_slice(3) {|slice| add_point_x_y_m(*slice)}
49:       end

add 3D points to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 38
38:       def add_points_x_y_z(xyz)
39:         xyz.each_slice(3) {|slice| add_point_x_y_z(*slice)}
40:       end

add 3D points with M to the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 56
56:       def add_points_x_y_z_m(xyzm)
57:         xyzm.each_slice(4) {|slice| add_point_x_y_z_m(*slice)}
58:       end

begin a geometry of type geometry_type

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 60
60:       def begin_geometry(geometry_type,srid=DEFAULT_SRID)
61:         geometry= geometry_type::new(srid)
62:         @geometry= geometry if @geometry.nil?
63:         @geometry_stack << geometry
64:       end

terminates the current geometry

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 66
66:       def end_geometry(with_z=false,with_m=false)
67:         @geometry=@geometry_stack.pop
68:         @geometry.with_z=with_z
69:         @geometry.with_m=with_m
70:         #add the newly defined geometry to its parent if there is one
71:         @geometry_stack.last << geometry if !@geometry_stack.empty?
72:       end

resets the factory

[Source]

    # File lib/geo_ruby/simple_features/geometry_factory.rb, line 22
22:       def reset
23:         @geometry_stack = []
24:       end

[Validate]