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 {
27
27
mapViewData . isRouteData = true
28
28
mapViewData . origin = constants . dataOrigins . fileImporter
29
29
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 )
37
31
} else {
38
32
reject ( Error ( 'invalid-file-content' ) )
39
33
}
@@ -44,6 +38,23 @@ class GeoJsonImporter {
44
38
} )
45
39
}
46
40
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
+
47
58
/**
48
59
* Parse the file content to an object
49
60
* @returns {Object }
You can’t perform that action at this time.
0 commit comments