lib/terraformer/coordinate.rb in terraformer-0.0.6 vs lib/terraformer/coordinate.rb in terraformer-0.0.7
- old
+ new
@@ -38,14 +38,16 @@
case
when Array === _x
raise ArgumentError if _y
self.x = _x[0]
self.y = _x[1]
+ self.z = _x[2] if _x[2]
when Numeric === _x || String === _x
raise ArgumentError unless _y
self.x = _x
self.y = _y
+ self.z = _z if _z
else
raise ArgumentError.new "invalid argument: #{_x}"
end
end
@@ -67,10 +69,14 @@
def z
self[2]
end
- [:z=, :<<, :*, :&, :|].each do |sym|
+ def z= _z
+ self[2] = Coordinate.big_decimal _z
+ end
+
+ [:<<, :*, :&, :|].each do |sym|
define_method(sym){|*a| raise NotImplementedError }
end
def to_geographic
xerd = (x / EARTH_RADIUS).to_deg