Class: FtcEventsClient::Geometry

Inherits:
Object
  • Object
show all
Defined in:
lib/ftc_events_client/models/geometry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Geometry

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/ftc_events_client/models/geometry.rb', line 135

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FtcEventsClient::Geometry` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FtcEventsClient::Geometry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'factory')
    self.factory = attributes[:'factory']
  end

  if attributes.key?(:'user_data')
    self.user_data = attributes[:'user_data']
  end

  if attributes.key?(:'srid')
    self.srid = attributes[:'srid']
  end

  if attributes.key?(:'geometry_type')
    self.geometry_type = attributes[:'geometry_type']
  end

  if attributes.key?(:'ogc_geometry_type')
    self.ogc_geometry_type = attributes[:'ogc_geometry_type']
  end

  if attributes.key?(:'precision_model')
    self.precision_model = attributes[:'precision_model']
  end

  if attributes.key?(:'coordinate')
    self.coordinate = attributes[:'coordinate']
  end

  if attributes.key?(:'coordinates')
    if (value = attributes[:'coordinates']).is_a?(Array)
      self.coordinates = value
    end
  end

  if attributes.key?(:'num_points')
    self.num_points = attributes[:'num_points']
  end

  if attributes.key?(:'num_geometries')
    self.num_geometries = attributes[:'num_geometries']
  end

  if attributes.key?(:'is_simple')
    self.is_simple = attributes[:'is_simple']
  end

  if attributes.key?(:'is_valid')
    self.is_valid = attributes[:'is_valid']
  end

  if attributes.key?(:'is_empty')
    self.is_empty = attributes[:'is_empty']
  end

  if attributes.key?(:'area')
    self.area = attributes[:'area']
  end

  if attributes.key?(:'length')
    self.length = attributes[:'length']
  end

  if attributes.key?(:'centroid')
    self.centroid = attributes[:'centroid']
  end

  if attributes.key?(:'interior_point')
    self.interior_point = attributes[:'interior_point']
  end

  if attributes.key?(:'point_on_surface')
    self.point_on_surface = attributes[:'point_on_surface']
  end

  if attributes.key?(:'dimension')
    self.dimension = attributes[:'dimension']
  end

  if attributes.key?(:'boundary')
    self.boundary = attributes[:'boundary']
  end

  if attributes.key?(:'boundary_dimension')
    self.boundary_dimension = attributes[:'boundary_dimension']
  end

  if attributes.key?(:'envelope')
    self.envelope = attributes[:'envelope']
  end

  if attributes.key?(:'envelope_internal')
    self.envelope_internal = attributes[:'envelope_internal']
  end

  if attributes.key?(:'is_rectangle')
    self.is_rectangle = attributes[:'is_rectangle']
  end
end

Instance Attribute Details

#areaObject

Returns the value of attribute area.



42
43
44
# File 'lib/ftc_events_client/models/geometry.rb', line 42

def area
  @area
end

#boundaryObject

Returns the value of attribute boundary.



54
55
56
# File 'lib/ftc_events_client/models/geometry.rb', line 54

def boundary
  @boundary
end

#boundary_dimensionObject

Returns the value of attribute boundary_dimension.



56
57
58
# File 'lib/ftc_events_client/models/geometry.rb', line 56

def boundary_dimension
  @boundary_dimension
end

#centroidObject

Returns the value of attribute centroid.



46
47
48
# File 'lib/ftc_events_client/models/geometry.rb', line 46

def centroid
  @centroid
end

#coordinateObject

Returns the value of attribute coordinate.



28
29
30
# File 'lib/ftc_events_client/models/geometry.rb', line 28

def coordinate
  @coordinate
end

#coordinatesObject

Returns the value of attribute coordinates.



30
31
32
# File 'lib/ftc_events_client/models/geometry.rb', line 30

def coordinates
  @coordinates
end

#dimensionObject

Returns the value of attribute dimension.



52
53
54
# File 'lib/ftc_events_client/models/geometry.rb', line 52

def dimension
  @dimension
end

#envelopeObject

Returns the value of attribute envelope.



58
59
60
# File 'lib/ftc_events_client/models/geometry.rb', line 58

def envelope
  @envelope
end

#envelope_internalObject

Returns the value of attribute envelope_internal.



60
61
62
# File 'lib/ftc_events_client/models/geometry.rb', line 60

def envelope_internal
  @envelope_internal
end

#factoryObject

Returns the value of attribute factory.



16
17
18
# File 'lib/ftc_events_client/models/geometry.rb', line 16

def factory
  @factory
end

#geometry_typeObject

Returns the value of attribute geometry_type.



22
23
24
# File 'lib/ftc_events_client/models/geometry.rb', line 22

def geometry_type
  @geometry_type
end

#interior_pointObject

Returns the value of attribute interior_point.



48
49
50
# File 'lib/ftc_events_client/models/geometry.rb', line 48

def interior_point
  @interior_point
end

#is_emptyObject

Returns the value of attribute is_empty.



40
41
42
# File 'lib/ftc_events_client/models/geometry.rb', line 40

def is_empty
  @is_empty
end

#is_rectangleObject

Returns the value of attribute is_rectangle.



62
63
64
# File 'lib/ftc_events_client/models/geometry.rb', line 62

def is_rectangle
  @is_rectangle
end

#is_simpleObject

Returns the value of attribute is_simple.



36
37
38
# File 'lib/ftc_events_client/models/geometry.rb', line 36

def is_simple
  @is_simple
end

#is_validObject

Returns the value of attribute is_valid.



38
39
40
# File 'lib/ftc_events_client/models/geometry.rb', line 38

def is_valid
  @is_valid
end

#lengthObject

Returns the value of attribute length.



44
45
46
# File 'lib/ftc_events_client/models/geometry.rb', line 44

def length
  @length
end

#num_geometriesObject

Returns the value of attribute num_geometries.



34
35
36
# File 'lib/ftc_events_client/models/geometry.rb', line 34

def num_geometries
  @num_geometries
end

#num_pointsObject

Returns the value of attribute num_points.



32
33
34
# File 'lib/ftc_events_client/models/geometry.rb', line 32

def num_points
  @num_points
end

#ogc_geometry_typeObject

Returns the value of attribute ogc_geometry_type.



24
25
26
# File 'lib/ftc_events_client/models/geometry.rb', line 24

def ogc_geometry_type
  @ogc_geometry_type
end

#point_on_surfaceObject

Returns the value of attribute point_on_surface.



50
51
52
# File 'lib/ftc_events_client/models/geometry.rb', line 50

def point_on_surface
  @point_on_surface
end

#precision_modelObject

Returns the value of attribute precision_model.



26
27
28
# File 'lib/ftc_events_client/models/geometry.rb', line 26

def precision_model
  @precision_model
end

#sridObject

Returns the value of attribute srid.



20
21
22
# File 'lib/ftc_events_client/models/geometry.rb', line 20

def srid
  @srid
end

#user_dataObject

Returns the value of attribute user_data.



18
19
20
# File 'lib/ftc_events_client/models/geometry.rb', line 18

def user_data
  @user_data
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/ftc_events_client/models/geometry.rb', line 65

def self.attribute_map
  {
    :'factory' => :'factory',
    :'user_data' => :'userData',
    :'srid' => :'srid',
    :'geometry_type' => :'geometryType',
    :'ogc_geometry_type' => :'ogcGeometryType',
    :'precision_model' => :'precisionModel',
    :'coordinate' => :'coordinate',
    :'coordinates' => :'coordinates',
    :'num_points' => :'numPoints',
    :'num_geometries' => :'numGeometries',
    :'is_simple' => :'isSimple',
    :'is_valid' => :'isValid',
    :'is_empty' => :'isEmpty',
    :'area' => :'area',
    :'length' => :'length',
    :'centroid' => :'centroid',
    :'interior_point' => :'interiorPoint',
    :'point_on_surface' => :'pointOnSurface',
    :'dimension' => :'dimension',
    :'boundary' => :'boundary',
    :'boundary_dimension' => :'boundaryDimension',
    :'envelope' => :'envelope',
    :'envelope_internal' => :'envelopeInternal',
    :'is_rectangle' => :'isRectangle'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



306
307
308
# File 'lib/ftc_events_client/models/geometry.rb', line 306

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



125
126
127
128
129
130
131
# File 'lib/ftc_events_client/models/geometry.rb', line 125

def self.openapi_nullable
  Set.new([
    :'user_data',
    :'geometry_type',
    :'coordinates',
  ])
end

.openapi_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/ftc_events_client/models/geometry.rb', line 95

def self.openapi_types
  {
    :'factory' => :'Object',
    :'user_data' => :'Object',
    :'srid' => :'Object',
    :'geometry_type' => :'Object',
    :'ogc_geometry_type' => :'Object',
    :'precision_model' => :'Object',
    :'coordinate' => :'Object',
    :'coordinates' => :'Object',
    :'num_points' => :'Object',
    :'num_geometries' => :'Object',
    :'is_simple' => :'Object',
    :'is_valid' => :'Object',
    :'is_empty' => :'Object',
    :'area' => :'Object',
    :'length' => :'Object',
    :'centroid' => :'Object',
    :'interior_point' => :'Object',
    :'point_on_surface' => :'Object',
    :'dimension' => :'Object',
    :'boundary' => :'Object',
    :'boundary_dimension' => :'Object',
    :'envelope' => :'Object',
    :'envelope_internal' => :'Object',
    :'is_rectangle' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ftc_events_client/models/geometry.rb', line 262

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      factory == o.factory &&
      user_data == o.user_data &&
      srid == o.srid &&
      geometry_type == o.geometry_type &&
      ogc_geometry_type == o.ogc_geometry_type &&
      precision_model == o.precision_model &&
      coordinate == o.coordinate &&
      coordinates == o.coordinates &&
      num_points == o.num_points &&
      num_geometries == o.num_geometries &&
      is_simple == o.is_simple &&
      is_valid == o.is_valid &&
      is_empty == o.is_empty &&
      area == o.area &&
      length == o.length &&
      centroid == o.centroid &&
      interior_point == o.interior_point &&
      point_on_surface == o.point_on_surface &&
      dimension == o.dimension &&
      boundary == o.boundary &&
      boundary_dimension == o.boundary_dimension &&
      envelope == o.envelope &&
      envelope_internal == o.envelope_internal &&
      is_rectangle == o.is_rectangle
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/ftc_events_client/models/geometry.rb', line 336

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    FtcEventsClient.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/ftc_events_client/models/geometry.rb', line 405

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/ftc_events_client/models/geometry.rb', line 313

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


293
294
295
# File 'lib/ftc_events_client/models/geometry.rb', line 293

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



299
300
301
# File 'lib/ftc_events_client/models/geometry.rb', line 299

def hash
  [factory, user_data, srid, geometry_type, ogc_geometry_type, precision_model, coordinate, coordinates, num_points, num_geometries, is_simple, is_valid, is_empty, area, length, centroid, interior_point, point_on_surface, dimension, boundary, boundary_dimension, envelope, envelope_internal, is_rectangle].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



249
250
251
252
# File 'lib/ftc_events_client/models/geometry.rb', line 249

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



381
382
383
# File 'lib/ftc_events_client/models/geometry.rb', line 381

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/ftc_events_client/models/geometry.rb', line 387

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



375
376
377
# File 'lib/ftc_events_client/models/geometry.rb', line 375

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



256
257
258
# File 'lib/ftc_events_client/models/geometry.rb', line 256

def valid?
  true
end