File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,7 @@ class GeoJsonImporter {
2727 mapViewData . isRouteData = true
2828 mapViewData . origin = constants . dataOrigins . fileImporter
2929 mapViewData . timestamp = context . options . timestamp
30- if ( mapViewData . polygons . length > 0 ) {
31- mapViewData . mode = constants . modes . isochrones
32- } else if ( mapViewData . jobs . length > 0 ) {
33- mapViewData . mode = constants . modes . optimization
34- } else {
35- mapViewData . mode = mapViewData . places . length === 1 ? constants . modes . roundTrip : constants . modes . directions
36- }
30+ mapViewData . mode = context . getMode ( mapViewData )
3731 } else {
3832 reject ( Error ( 'invalid-file-content' ) )
3933 }
@@ -44,6 +38,23 @@ class GeoJsonImporter {
4438 } )
4539 }
4640
41+ /**
42+ * Set mode for mapViewData
43+ * @param mapViewData
44+ * @returns {* } mode
45+ */
46+ getMode ( mapViewData ) {
47+ let mode
48+ if ( mapViewData . polygons . length > 0 ) {
49+ mode = constants . modes . isochrones
50+ } else if ( mapViewData . jobs . length > 0 ) {
51+ mode = constants . modes . optimization
52+ } else {
53+ mode = mapViewData . places . length === 1 ? constants . modes . roundTrip : constants . modes . directions
54+ }
55+ return mode
56+ }
57+
4758 /**
4859 * Parse the file content to an object
4960 * @returns {Object }
You can’t perform that action at this time.
0 commit comments