This class implements the factory for the simple cartesian implementation.
Create a new simple cartesian factory.
See RGeo::Cartesian.simple_factory for a list of supported options.
# File lib/rgeo/cartesian/factory.rb, line 54 def initialize(opts_={}) @has_z = opts_[:has_z_coordinate] ? true : false @has_m = opts_[:has_m_coordinate] ? true : false @proj4 = opts_[:proj4] if CoordSys::Proj4.supported? if @proj4.kind_of?(::String) || @proj4.kind_of?(::Hash) @proj4 = CoordSys::Proj4.create(@proj4) end else @proj4 = nil end srid_ = opts_[:srid] @coord_sys = opts_[:coord_sys] if @coord_sys.kind_of?(::String) @coord_sys = CoordSys::CS.create_from_wkt(@coord_sys) rescue nil end if (!@proj4 || !@coord_sys) && srid_ && (db_ = opts_[:srs_database]) entry_ = db_.get(srid_.to_i) if entry_ @proj4 ||= entry_.proj4 @coord_sys ||= entry_.coord_sys end end srid_ ||= @coord_sys.authority_code if @coord_sys @srid = srid_.to_i @lenient_assertions = opts_[:uses_lenient_assertions] ? true : false @buffer_resolution = opts_[:buffer_resolution].to_i @buffer_resolution = 1 if @buffer_resolution < 1 wkt_generator_ = opts_[:wkt_generator] case wkt_generator_ when ::Hash @wkt_generator = WKRep::WKTGenerator.new(wkt_generator_) else @wkt_generator = WKRep::WKTGenerator.new(:convert_case => :upper) end wkb_generator_ = opts_[:wkb_generator] case wkb_generator_ when ::Hash @wkb_generator = WKRep::WKBGenerator.new(wkb_generator_) else @wkb_generator = WKRep::WKBGenerator.new end wkt_parser_ = opts_[:wkt_parser] case wkt_parser_ when ::Hash @wkt_parser = WKRep::WKTParser.new(self, wkt_parser_) else @wkt_parser = WKRep::WKTParser.new(self) end wkb_parser_ = opts_[:wkb_parser] case wkb_parser_ when ::Hash @wkb_parser = WKRep::WKBParser.new(self, wkb_parser_) else @wkb_parser = WKRep::WKBParser.new(self) end end
See RGeo::Feature::Factory#collection
# File lib/rgeo/cartesian/factory.rb, line 307 def collection(elems_) GeometryCollectionImpl.new(self, elems_) rescue nil end
See RGeo::Feature::Factory#coord_sys
# File lib/rgeo/cartesian/factory.rb, line 342 def coord_sys @coord_sys end
Equivalence test.
# File lib/rgeo/cartesian/factory.rb, line 116 def eql?(rhs_) rhs_.is_a?(self.class) && @srid == rhs_.srid && @has_z == rhs_.property(:has_z_coordinate) && @has_m == rhs_.property(:has_m_coordinate) && @proj4.eql?(rhs_.proj4) end
Standard hash code
# File lib/rgeo/cartesian/factory.rb, line 127 def hash @hash ||= [@srid, @has_z, @has_m, @proj4].hash end
See RGeo::Feature::Factory#line
# File lib/rgeo/cartesian/factory.rb, line 286 def line(start_, end_) LineImpl.new(self, start_, end_) rescue nil end
See RGeo::Feature::Factory#line_string
# File lib/rgeo/cartesian/factory.rb, line 279 def line_string(points_) LineStringImpl.new(self, points_) rescue nil end
See RGeo::Feature::Factory#linear_ring
# File lib/rgeo/cartesian/factory.rb, line 293 def linear_ring(points_) LinearRingImpl.new(self, points_) rescue nil end
See RGeo::Feature::Factory#multi_line_string
# File lib/rgeo/cartesian/factory.rb, line 321 def multi_line_string(elems_) MultiLineStringImpl.new(self, elems_) rescue nil end
See RGeo::Feature::Factory#multi_point
# File lib/rgeo/cartesian/factory.rb, line 314 def multi_point(elems_) MultiPointImpl.new(self, elems_) rescue nil end
See RGeo::Feature::Factory#multi_polygon
# File lib/rgeo/cartesian/factory.rb, line 328 def multi_polygon(elems_) MultiPolygonImpl.new(self, elems_) rescue nil end
See RGeo::Feature::Factory#parse_wkb
# File lib/rgeo/cartesian/factory.rb, line 265 def parse_wkb(str_) @wkb_parser.parse(str_) end
See RGeo::Feature::Factory#parse_wkt
# File lib/rgeo/cartesian/factory.rb, line 258 def parse_wkt(str_) @wkt_parser.parse(str_) end
See RGeo::Feature::Factory#point
# File lib/rgeo/cartesian/factory.rb, line 272 def point(x_, y_, *extra_) PointImpl.new(self, x_, y_, *extra_) rescue nil end
See RGeo::Feature::Factory#polygon
# File lib/rgeo/cartesian/factory.rb, line 300 def polygon(outer_ring_, inner_rings_=nil) PolygonImpl.new(self, outer_ring_, inner_rings_) rescue nil end
See RGeo::Feature::Factory#proj4
# File lib/rgeo/cartesian/factory.rb, line 335 def proj4 @proj4 end
See RGeo::Feature::Factory#property
# File lib/rgeo/cartesian/factory.rb, line 238 def property(name_) case name_ when :has_z_coordinate @has_z when :has_m_coordinate @has_m when :uses_lenient_assertions @lenient_assertions when :buffer_resolution @buffer_resolution when :is_cartesian true else nil end end
Returns the SRID.
# File lib/rgeo/cartesian/factory.rb, line 231 def srid @srid end