class ArcServer::Geometry::Geometry

Attributes

spatialReference[RW]

Public Class Methods

build(geometry, geometryType) click to toggle source
# File lib/arcserver/geometry/geometry.rb, line 8
def self.build(geometry, geometryType)
  klass = {
      esriGeometryPoint:      ArcServer::Geometry::Point,
      esriGeometryMultipoint: ArcServer::Geometry::Multipoint,
      esriGeometryPolygon:    ArcServer::Geometry::Polygon,
      esriGeometryPolyline:   ArcServer::Geometry::Polyline,
      esriGeometryEnvelope:   ArcServer::Geometry::Envelope,
  }[geometryType.to_sym]
  klass.new(geometry) rescue nil
end
create(json) click to toggle source
# File lib/arcserver/geometry/geometry.rb, line 19
def self.create(json)

  parsed = json.is_a?(Hash) ? json : JSON.parse(json) rescue {}

  if parsed['x']
    ArcServer::Geometry::Point.new(parsed)
  elsif  parsed['paths']
    ArcServer::Geometry::Polyline.new(parsed)
  elsif parsed['rings']
    ArcServer::Geometry::Polygon.new(parsed)
  elsif parsed['points']
    ArcServer::Geometry::Multipoint.new(parsed)
  elsif parsed['ymax']
    ArcServer::Geometry::Envelope.new(parsed)
  else
    nil
  end

end

Public Instance Methods

extent() click to toggle source
# File lib/arcserver/geometry/geometry.rb, line 43
def extent
  nil
end
geometryType() click to toggle source
# File lib/arcserver/geometry/geometry.rb, line 39
def geometryType
  nil
end