Class: Orders

Inherits:
Object
  • Object
show all
Defined in:
lib/arcgis_vrps/orders.rb

Instance Method Summary collapse

Instance Method Details

#addOrders(xCoordinate, yCoordinate, orderAttributeObj) ⇒ Object

Longitude => xCoordinate, Latitude => yCoordinate



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/arcgis_vrps/orders.rb', line 3

def addOrders (xCoordinate, yCoordinate, orderAttributeObj)
  my_order = {
        :geometry => {
              :x => xCoordinate,
              :y => yCoordinate
            },
            :attributes => orderAttributeObj
       }
  if @orderArr.nil?
    @orderArr = []
  end
  
  @orderArr.push(my_order)
end

#getBasicOrderAttributeObj(orderName) ⇒ Object

Get basic Orders Attribute Object from the param passed in



23
24
25
26
27
28
29
# File 'lib/arcgis_vrps/orders.rb', line 23

def getBasicOrderAttributeObj (orderName)
  orderAttributeObj =  {
    :Name => orderName
  }

  return orderAttributeObj
end

#getOrderArrObject



18
19
20
# File 'lib/arcgis_vrps/orders.rb', line 18

def getOrderArr
  return @orderArr
end

#getOrderAttributeObj(orderName, serviceTime) ⇒ Object

Get orders attribute object from the param passed in timeWindow* refers to the time that the service serviceTime specify how much time to be spent there. value is as per time_units def getOrderAttributeObj (orderName, serviceTime, timeWindowStart1, timeWindowEnd1, maxViolationTime1)



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/arcgis_vrps/orders.rb', line 35

def getOrderAttributeObj (orderName, serviceTime)
  # if maxViolationTime1.nil?

  #  orderAttributeObj = {

  #    :Name => orderName,

  #    :ServiceTime => serviceTime,

  #    :TimeWindowStart1 => timeWindowStart1,

  #    :TimeWindowEnd1 => timeWindowEnd1

  #  }

  # else

  #  orderAttributeObj = {

  #    :Name => orderName,

  #    :ServiceTime => serviceTime,

  #    :TimeWindowStart1 => timeWindowStart1,

  #    :TimeWindowEnd1 => timeWindowEnd1,

  #    :MaxViolationTime1 => maxViolationTime1

  #  }

  # end

  
  orderAttributeObj =  {
    :Name => orderName,
    :ServiceTime => serviceTime
  }

  return orderAttributeObj
end

#getOrderObj(wkid) ⇒ Object

return orderAttributeObj end



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/arcgis_vrps/orders.rb', line 75

def getOrderObj (wkid)
  if wkid.nil?
    orderObj = {
      :features => @orderArr
    }
  else
    orderObj = {
      :spatialReference => {
        :wkid => wkid
      },
      :features => @orderArr
    }
  end

  return orderObj
end