class RGeo::Geos::ZMFactory

A factory for Geos that handles both Z and M.

Public Class Methods

create(opts_={}) click to toggle source

Create a new factory. Returns nil if the GEOS implementation is not supported.

# File lib/rgeo/geos/zm_factory.rb, line 72
def create(opts_={})
  return nil unless Geos.supported?
  new(opts_)
end

Public Instance Methods

==(rhs_) click to toggle source
Alias for: eql?
buffer_resolution() click to toggle source

Returns the resolution used by buffer calculations on geometries created by this factory

# File lib/rgeo/geos/zm_factory.rb, line 256
def buffer_resolution
  @zfactory.buffer_resolution
end
collection(elems_) click to toggle source

See RGeo::Feature::Factory#collection

# File lib/rgeo/geos/zm_factory.rb, line 360
def collection(elems_)
  _create_feature(ZMGeometryCollectionImpl, @zfactory.collection(elems_), @mfactory.collection(elems_))
end
coord_sys() click to toggle source

See RGeo::Feature::Factory#coord_sys

# File lib/rgeo/geos/zm_factory.rb, line 395
def coord_sys
  @zfactory.coord_sys
end
eql?(rhs_) click to toggle source

Factory equivalence test.

# File lib/rgeo/geos/zm_factory.rb, line 284
def eql?(rhs_)
  rhs_.is_a?(ZMFactory) && rhs_.z_factory == @zfactory
end
Also aliased as: ==
hash() click to toggle source

Standard hash code

# File lib/rgeo/geos/zm_factory.rb, line 292
def hash
  @hash ||= [@zfactory, @mfactory].hash
end
lenient_multi_polygon_assertions?() click to toggle source

Returns true if this factory is lenient with MultiPolygon assertions

# File lib/rgeo/geos/zm_factory.rb, line 263
def lenient_multi_polygon_assertions?
  @zfactory.lenient_multi_polygon_assertions?
end
line(start_, end_) click to toggle source

See RGeo::Feature::Factory#line

# File lib/rgeo/geos/zm_factory.rb, line 339
def line(start_, end_)
  _create_feature(ZMLineImpl, @zfactory.line(start_, end_), @mfactory.line(start_, end_))
end
line_string(points_) click to toggle source

See RGeo::Feature::Factory#line_string

# File lib/rgeo/geos/zm_factory.rb, line 332
def line_string(points_)
  _create_feature(ZMLineStringImpl, @zfactory.line_string(points_), @mfactory.line_string(points_))
end
linear_ring(points_) click to toggle source

See RGeo::Feature::Factory#linear_ring

# File lib/rgeo/geos/zm_factory.rb, line 346
def linear_ring(points_)
  _create_feature(ZMLinearRingImpl, @zfactory.linear_ring(points_), @mfactory.linear_ring(points_))
end
m_factory() click to toggle source

Returns the m-only factory corresponding to this factory.

# File lib/rgeo/geos/zm_factory.rb, line 277
def m_factory
  @mfactory
end
multi_line_string(elems_) click to toggle source

See RGeo::Feature::Factory#multi_line_string

# File lib/rgeo/geos/zm_factory.rb, line 374
def multi_line_string(elems_)
  _create_feature(ZMMultiLineStringImpl, @zfactory.multi_line_string(elems_), @mfactory.multi_line_string(elems_))
end
multi_point(elems_) click to toggle source

See RGeo::Feature::Factory#multi_point

# File lib/rgeo/geos/zm_factory.rb, line 367
def multi_point(elems_)
  _create_feature(ZMMultiPointImpl, @zfactory.multi_point(elems_), @mfactory.multi_point(elems_))
end
multi_polygon(elems_) click to toggle source

See RGeo::Feature::Factory#multi_polygon

# File lib/rgeo/geos/zm_factory.rb, line 381
def multi_polygon(elems_)
  _create_feature(ZMMultiPolygonImpl, @zfactory.multi_polygon(elems_), @mfactory.multi_polygon(elems_))
end
override_cast(original_, ntype_, flags_) click to toggle source

See RGeo::Feature::Factory#override_cast

# File lib/rgeo/geos/zm_factory.rb, line 402
def override_cast(original_, ntype_, flags_)
  return nil unless Geos.supported?
  keep_subtype_ = flags_[:keep_subtype]
  #force_new_ = flags_[:force_new]
  project_ = flags_[:project]
  type_ = original_.geometry_type
  ntype_ = type_ if keep_subtype_ && type_.include?(ntype_)
  case original_
  when ZMGeometryMethods
    # Optimization if we're just changing factories, but to
    # another ZM factory.
    if original_.factory != self && ntype_ == type_ &&
        (!project_ || original_.factory.proj4 == @proj4)
    then
      zresult_ = original_.z_geometry.dup
      zresult_._set_factory(@zfactory)
      mresult_ = original_.m_geometry.dup
      mresult_._set_factory(@mfactory)
      return original_.class.create(self, zresult_, mresult_)
    end
    # LineString conversion optimization.
    if (original_.factory != self || ntype_ != type_) &&
        (!project_ || original_.factory.proj4 == @proj4) &&
        type_.subtype_of?(Feature::LineString) && ntype_.subtype_of?(Feature::LineString)
    then
      klass_ = Factory::IMPL_CLASSES[ntype_]
      zresult_ = klass_._copy_from(@zfactory, original_.z_geometry)
      mresult_ = klass_._copy_from(@mfactory, original_.m_geometry)
      return ZMLineStringImpl.create(self, zresult_, mresult_)
    end
  end
  false
end
parse_wkb(str_) click to toggle source

See RGeo::Feature::Factory#parse_wkb

# File lib/rgeo/geos/zm_factory.rb, line 318
def parse_wkb(str_)
  @wkb_parser.parse(str_)
end
parse_wkt(str_) click to toggle source

See RGeo::Feature::Factory#parse_wkt

# File lib/rgeo/geos/zm_factory.rb, line 311
def parse_wkt(str_)
  @wkt_parser.parse(str_)
end
point(x_, y_, z_=0, m_=0) click to toggle source

See RGeo::Feature::Factory#point

# File lib/rgeo/geos/zm_factory.rb, line 325
def point(x_, y_, z_=0, m_=0)
  _create_feature(ZMPointImpl, @zfactory.point(x_, y_, z_), @mfactory.point(x_, y_, m_))
end
polygon(outer_ring_, inner_rings_=nil) click to toggle source

See RGeo::Feature::Factory#polygon

# File lib/rgeo/geos/zm_factory.rb, line 353
def polygon(outer_ring_, inner_rings_=nil)
  _create_feature(ZMPolygonImpl, @zfactory.polygon(outer_ring_, inner_rings_), @mfactory.polygon(outer_ring_, inner_rings_))
end
proj4() click to toggle source

See RGeo::Feature::Factory#proj4

# File lib/rgeo/geos/zm_factory.rb, line 388
def proj4
  @zfactory.proj4
end
property(name_) click to toggle source

See RGeo::Feature::Factory#property

# File lib/rgeo/geos/zm_factory.rb, line 299
def property(name_)
  case name_
  when :has_z_coordinate, :has_m_coordinate, :is_cartesian
    true
  else
    nil
  end
end
srid() click to toggle source

Returns the SRID of geometries created by this factory.

# File lib/rgeo/geos/zm_factory.rb, line 248
def srid
  @zfactory.srid
end
z_factory() click to toggle source

Returns the z-only factory corresponding to this factory.

# File lib/rgeo/geos/zm_factory.rb, line 270
def z_factory
  @zfactory
end