lib/rgeo/geography/factory.rb in rgeo-0.1.13 vs lib/rgeo/geography/factory.rb in rgeo-0.1.14
- old
+ new
@@ -49,11 +49,17 @@
def initialize(namespace_, opts_={}) # :nodoc:
@namespace = namespace_
@opts = opts_.dup
- @projector = @namespace.const_get(:Projector).new(self, opts_) rescue nil
+ if @namespace.const_defined?(:Projector)
+ @projector = @namespace.const_get(:Projector).new(self, opts_)
+ else
+ @projector = nil
+ end
+ @support_z = opts_[:support_z_coordinate] ? true : false
+ @support_m = opts_[:support_m_coordinate] ? true : false
end
# Equivalence test.
@@ -124,27 +130,41 @@
def projection_limits_window
@projector ? (@projection_limits_window ||= @projector.limits_window) : nil
end
+ # See ::RGeo::Features::Factory#has_capability?
+
+ def has_capability?(name_)
+ case name_
+ when :z_coordinate
+ @support_z
+ when :m_coordinate
+ @support_m
+ else
+ nil
+ end
+ end
+
+
# See ::RGeo::Features::Factory#parse_wkt
def parse_wkt(str_)
- ImplHelpers::Serialization.parse_wkt(str_, self)
+ WKRep::WKTParser.new(self, :support_higher_dimensions => true).parse(str_)
end
# See ::RGeo::Features::Factory#parse_wkb
def parse_wkb(str_)
- ImplHelpers::Serialization.parse_wkb(str_, self)
+ WKRep::WKBParser.new(self).parse(str_)
end
# See ::RGeo::Features::Factory#point
- def point(x_, y_)
- @namespace.const_get(:PointImpl).new(self, x_, y_) rescue nil
+ def point(x_, y_, *extra_)
+ @namespace.const_get(:PointImpl).new(self, x_, y_, *extra_) rescue nil
end
# See ::RGeo::Features::Factory#line_string