Repository navigation
Expand file tree
/
Copy pathAnalystTools.js
More file actions
91 lines (87 loc) · 2.24 KB
/
Copy pathAnalystTools.js
File metadata and controls
91 lines (87 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
60
61
62
63
64
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
import {
STransportationAnalyst,
// SFacilityAnalyst,
} from 'imobile_for_reactnative'
import { Analyst_Types } from '../containers/analystView/AnalystType'
import { getLanguage } from '../language'
async function analyst(type) {
let result
switch (type) {
case Analyst_Types.OPTIMAL_PATH:
result = STransportationAnalyst.findPath({
weightName: 'length',
})
break
case Analyst_Types.CONNECTIVITY_ANALYSIS:
result = STransportationAnalyst.findPath({
weightName: 'length',
})
// result = await SFacilityAnalyst.findPathFromNodes()
break
case Analyst_Types.FIND_TSP_PATH:
result = STransportationAnalyst.findTSPPath({
weightName: 'length',
})
break
}
return result
}
async function clear(type) {
let result
switch (type) {
case Analyst_Types.OPTIMAL_PATH:
result = await STransportationAnalyst.clear()
break
case Analyst_Types.CONNECTIVITY_ANALYSIS:
result = await STransportationAnalyst.clear()
// result = await SFacilityAnalyst.clear()
break
case Analyst_Types.FIND_TSP_PATH:
result = await STransportationAnalyst.clear()
break
}
return result
}
function showMsg(type, isSuccess, language = 'CN') {
let msg = ''
switch (type) {
case Analyst_Types.OPTIMAL_PATH:
msg =
!isSuccess &&
getLanguage(language).Analyst_Prompt.NOT_FIND_SUITABLE_PATH
break
case Analyst_Types.CONNECTIVITY_ANALYSIS:
msg = isSuccess
? getLanguage(language).Analyst_Prompt.TWO_NODES_ARE_CONNECTED
: getLanguage(language).Analyst_Prompt.TWO_NODES_ARE_NOT_CONNECTED
break
case Analyst_Types.FIND_TSP_PATH:
msg =
!isSuccess &&
getLanguage(language).Analyst_Prompt.NOT_FIND_SUITABLE_PATH
break
case -1:
default:
msg = getLanguage(language).Analyst_Prompt.ANALYZING_FAILED
}
// msg &&
// Toast.show(msg, {
// duration: Toast.DURATION.TOAST_LONG,
// })
msg &&
GLOBAL.bubblePane &&
GLOBAL.bubblePane.addBubble(
{
title: msg,
type: isSuccess ? 'success' : 'error',
},
// !isSuccess && {
// top: 60,
// },
)
}
export default {
analyst,
clear,
showMsg,
}