Method: RGeo::Geographic::Factory#initialize
- Defined in:
- lib/rgeo/geographic/factory.rb
#initialize(impl_prefix, opts = {}) ⇒ Factory
:nodoc:
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rgeo/geographic/factory.rb', line 28 def initialize(impl_prefix, opts = {}) # :nodoc: @impl_prefix = impl_prefix @point_class = Geographic.const_get("#{impl_prefix}PointImpl") @line_string_class = Geographic.const_get("#{impl_prefix}LineStringImpl") @linear_ring_class = Geographic.const_get("#{impl_prefix}LinearRingImpl") @line_class = Geographic.const_get("#{impl_prefix}LineImpl") @polygon_class = Geographic.const_get("#{impl_prefix}PolygonImpl") @geometry_collection_class = Geographic.const_get("#{impl_prefix}GeometryCollectionImpl") @multi_point_class = Geographic.const_get("#{impl_prefix}MultiPointImpl") @multi_line_string_class = Geographic.const_get("#{impl_prefix}MultiLineStringImpl") @multi_polygon_class = Geographic.const_get("#{impl_prefix}MultiPolygonImpl") @support_z = opts[:has_z_coordinate] ? true : false @support_m = opts[:has_m_coordinate] ? true : false @coordinate_dimension = 2 @coordinate_dimension += 1 if @support_z @coordinate_dimension += 1 if @support_m @spatial_dimension = @support_z ? 3 : 2 srid = opts.fetch(:srid, 4326).to_i coord_sys_info = ImplHelper::Utils.setup_coord_sys(srid, opts[:coord_sys], opts[:coord_sys_class]) @coord_sys = coord_sys_info[:coord_sys] @srid = coord_sys_info[:srid] @buffer_resolution = opts[:buffer_resolution].to_i @buffer_resolution = 1 if @buffer_resolution < 1 wkt_generator = opts[:wkt_generator] @wkt_generator = case wkt_generator when Hash WKRep::WKTGenerator.new(wkt_generator) else WKRep::WKTGenerator.new(convert_case: :upper) end wkb_generator = opts[:wkb_generator] @wkb_generator = case wkb_generator when Hash WKRep::WKBGenerator.new(wkb_generator) else WKRep::WKBGenerator.new end wkt_parser = opts[:wkt_parser] @wkt_parser = case wkt_parser when Hash WKRep::WKTParser.new(self, wkt_parser) else WKRep::WKTParser.new(self) end wkb_parser = opts[:wkb_parser] @wkb_parser = case wkb_parser when Hash WKRep::WKBParser.new(self, wkb_parser) else WKRep::WKBParser.new(self) end @projector = nil end |