@@ -117,7 +117,7 @@ class MapViewData {
117
117
* @returns {MapViewData } mapViewAta
118
118
*/
119
119
static buildFromGeoJson ( geoJson ) {
120
- const mapViewAta = new MapViewData ( )
120
+ const mapViewData = new MapViewData ( )
121
121
122
122
for ( const fKey in geoJson . features ) {
123
123
const feature = {
@@ -128,23 +128,29 @@ class MapViewData {
128
128
}
129
129
switch ( geoJson . features [ fKey ] . geometry . type ) {
130
130
case 'LineString' :
131
- mapViewAta . routes . push ( feature )
131
+ mapViewData . routes . push ( feature )
132
132
break
133
133
case 'Point' : {
134
- const lat = feature . geometry . coordinates [ 0 ]
135
- const lon = feature . geometry . coordinates [ 1 ]
136
- // TODO: OPTIMIZATION - load jobs and vehicles
137
- const place = new Place ( lat , lon , feature . properties . label , { properties : feature . properties } )
138
- feature . latlngs = feature . geometry . coordinates
139
- mapViewAta . places . push ( place )
134
+ if ( feature . properties . label . includes ( 'Job' ) ) {
135
+ mapViewData . jobs . push ( Job . fromGeoJsonObject ( feature ) )
136
+ } else {
137
+ const lat = feature . geometry . coordinates [ 0 ]
138
+ const lon = feature . geometry . coordinates [ 1 ]
139
+ const place = new Place ( lat , lon , feature . properties . label , { properties : feature . properties } )
140
+ feature . latlngs = feature . geometry . coordinates
141
+ mapViewData . places . push ( place )
142
+ }
140
143
break
141
144
}
145
+ case 'MultiPoint' :
146
+ mapViewData . vehicles . push ( Vehicle . fromGeoJsonObject ( feature ) )
147
+ break
142
148
case 'Polygon' :
143
- mapViewAta . polygons . push ( feature )
149
+ mapViewData . polygons . push ( feature )
144
150
break
145
151
}
146
152
}
147
- return mapViewAta
153
+ return mapViewData
148
154
}
149
155
150
156
/**
0 commit comments