Class: FieldView::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/fieldview/feature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_feature_object) ⇒ Feature

Returns a new instance of Feature.



5
6
7
8
9
10
# File 'lib/fieldview/feature.rb', line 5

def initialize(json_feature_object)
  # Use RGEO??
  self.type = json_feature_object[:type]
  self.coordinates = json_feature_object[:coordinates]
  self.data = json_feature_object
end

Instance Attribute Details

#coordinatesObject

Returns the value of attribute coordinates.



3
4
5
# File 'lib/fieldview/feature.rb', line 3

def coordinates
  @coordinates
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/fieldview/feature.rb', line 3

def data
  @data
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/fieldview/feature.rb', line 3

def type
  @type
end

Instance Method Details

#multi_polygon?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fieldview/feature.rb', line 16

def multi_polygon?()
  return !!(self.type =~ /\Amultipolygon\z/i)
end

#point?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/fieldview/feature.rb', line 12

def point?()
  return !!(self.type =~ /\Apoint\z/i)
end

#polygon?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fieldview/feature.rb', line 20

def polygon?()
  return !!(self.type =~ /\Apolygon\z/i)
end