Skip to content

Commit cb7578b

Browse files
committed
2 parents 0cfc3a9 + 7e7d2b4 commit cb7578b

13 files changed

Lines changed: 579 additions & 289 deletions

File tree

‎build/webpack.config.base.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ module.exports = {
6565
echarts: 'function(){try{return echarts}catch(e){return {}}}()',
6666
mapv: 'function(){try{return mapv}catch(e){return {}}}()',
6767
'@antv/g6': 'function(){try{return G6}catch(e){return {}}}()',
68-
'@tensorflow/tfjs': 'function(){try{return tf}catch(e){return {}}}()'
68+
'@tensorflow/tfjs': 'function(){try{return tf}catch(e){return {}}}()',
69+
'video.js': 'function(){try{return videojs}catch(e){return {}}}()',
70+
'flv.js': 'function(){try{return flvjs}catch(e){return {}}}()',
71+
'videojs-flvjs-es6': 'function(){try{return;}catch(e){return {}}}()'
6972
},
7073

7174
module: {

‎build/webpack.config.mapboxgl.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ module.exports = {
2929
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
3030
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
3131
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
32-
'video.js': 'function(){try{return videojs}catch(e){return {}}}()',
33-
'flv.js': 'function(){try{return flvjs}catch(e){return {}}}()',
3432
'@turf/turf': "function(){try{return turf}catch(e){return {}}}()",
3533
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()'
3634
})

‎examples/leaflet/knowledgeGraph_shortestpath.html‎

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<meta charset="utf-8" />
1212
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
1313
<title data-i18n="resources.title_knowledgeGraphMap"></title>
14-
<script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
14+
<script type="text/javascript" include="jquery,bootstrap,widgets" src="../js/include-web.js"></script>
1515
<style>
1616
body {
1717
margin: 0;
@@ -24,29 +24,19 @@
2424
width: 100%;
2525
height: 100%;
2626
}
27-
.short-path-panel {
28-
position: fixed;
29-
top: 60px;
30-
right: 30px;
31-
display: flex;
32-
flex-direction: column;
33-
align-items: center;
34-
justify-content: center;
35-
width: 350px;
36-
padding: 15px;
37-
background-color: antiquewhite;
38-
border: 1px solid gray;
39-
}
4027
.node-item {
4128
display: inline-flex;
4229
width: 100%;
4330
margin-top: 15px;
4431
}
45-
.node-item input {
32+
.node-item .form-control {
4633
width: 150px;
34+
border-radius: 0 4px 4px 0;
4735
}
48-
.node-item button {
49-
margin: 0 5px;
36+
37+
.node-item .btn {
38+
padding: 0 8px;
39+
margin-left: 10px;
5040
}
5141
.buttons {
5242
display: inline-flex;
@@ -56,33 +46,60 @@
5646
}
5747
#analysis {
5848
width: 80px;
59-
margin-right: 10px;
6049
}
6150
#reset {
6251
width: 80px;
52+
margin-right: 10px;
53+
}
54+
.panel-default {
55+
position: fixed;
56+
top: 60px;
57+
right: 30px;
58+
width: 380px;
59+
margin: 15px 15px 0 0;
60+
}
61+
62+
.input-group {
63+
margin-bottom: 15px;
64+
}
65+
.node-title {
66+
width: 80px;
67+
line-height: unset;
6368
}
6469
</style>
6570
</head>
6671

6772
<body>
6873
<div id="knowledgeGraph"></div>
69-
<div class="short-path-panel">
70-
<div class="title" data-i18n="resources.text_graphmap_shortest_analysis"></div>
71-
<div class="node-item start-node">
72-
<span data-i18n="resources.text_startNode"></span> <input class="start" disabled /><button
73-
id="select-start-node"
74-
data-i18n="resources.text_selectStartNode"
75-
></button>
74+
<div class="panel panel-default">
75+
<div class="panel-heading">
76+
<h3 class="panel-title" data-i18n="resources.text_graphmap_shortest_analysis"></h3>
7677
</div>
77-
<div class="node-item end-node">
78-
<span data-i18n="resources.text_endeNode"></span><input class="end" disabled /><button
79-
id="select-end-node"
80-
data-i18n="resources.text_selectEndNode"
81-
></button>
82-
</div>
83-
<div class="buttons">
84-
<button id="analysis" data-i18n="resources.text_analysis"></button>
85-
<button id="reset" data-i18n="resources.text_reset"></button>
78+
<div class="panel-body">
79+
<div class="node-item start-node">
80+
<span class="input-group-addon node-title" data-i18n="resources.text_startNode"></span>
81+
<input type="text" class="start form-control" disabled />
82+
<input
83+
type="button"
84+
id="select-start-node"
85+
class="btn btn-primary"
86+
data-i18n="[value]resources.text_selectStartNode"
87+
/>
88+
</div>
89+
<div class="node-item end-node">
90+
<span class="input-group-addon node-title" data-i18n="resources.text_endeNode"></span>
91+
<input type="text" class="end form-control" disabled />
92+
<input
93+
type="button"
94+
id="select-end-node"
95+
class="btn btn-primary"
96+
data-i18n="[value]resources.text_selectEndNode"
97+
/>
98+
</div>
99+
<div class="buttons" align="center">
100+
<input type="button" id="reset" class="btn" data-i18n="[value]resources.text_reset" />
101+
<input type="button" id="analysis" class="btn btn-primary" data-i18n="[value]resources.text_analysis" />
102+
</div>
86103
</div>
87104
</div>
88105
<script type="text/javascript" include="g6" src="../../dist/leaflet/include-leaflet.js"></script>
@@ -142,8 +159,13 @@
142159
}
143160

144161
function setShortestPath({ startID, endID }) {
145-
graphmap.findShortestPath({ startID, endID }, () => {
146-
graphmap.clearHighlight();
162+
graphmap.findShortestPath({ startID, endID }, (res) => {
163+
if (res.type === 'processCompleted' && res.result.succeed) {
164+
const { nodeIDs, edgeIDs } = res.result;
165+
if (nodeIDs.length === 0 && edgeIDs.length === 0) {
166+
widgets.alert.showAlert(resources.text_no_shortestPath);
167+
}
168+
}
147169
});
148170
}
149171
</script>

‎examples/locales/en-US/resources.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,10 @@ window.examplesResources = {
738738
"title_videoLayer":"Video Layer",
739739

740740
"text_graphmap_shortest_analysis": "Shortest Path Analysis",
741-
"text_startNode": "start node:",
742-
"text_endeNode": "end node:",
741+
"text_startNode": "start node",
742+
"text_endeNode": "end node",
743743
"text_analysis": "Analysis",
744+
"text_no_shortestPath": "Analysis result: No shortest path",
744745
"text_selectStartNode": "Capture Start Node",
745746
"text_selectEndNode": "Capture End Node",
746747
"text_district_search": "Administrative region search",

‎examples/locales/zh-CN/resources.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@ window.examplesResources = {
692692
"title_dataAttributes": "属性表",
693693

694694
"text_graphmap_shortest_analysis": "最短路径分析",
695-
"text_startNode": "开始节点:",
696-
"text_endeNode": "结束节点: ",
695+
"text_startNode": "开始节点",
696+
"text_endeNode": "结束节点",
697697
"text_analysis": "分析",
698+
"text_no_shortestPath": "分析结果:无最短路径",
698699
"text_selectStartNode": "捕捉开始节点",
699700
"text_selectEndNode": "捕捉结束节点",
700701
"title_videoLayer":"视频图层",

‎examples/mapboxgl/knowledgeGraph_shortestpath.html‎

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<meta charset="utf-8" />
1212
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
1313
<title data-i18n="resources.title_knowledgeGraphMap"></title>
14-
<script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
14+
<script type="text/javascript" include="jquery,bootstrap,widgets" src="../js/include-web.js"></script>
1515
<style>
1616
body {
1717
margin: 0;
@@ -25,29 +25,19 @@
2525
width: 100%;
2626
height: 100%;
2727
}
28-
.short-path-panel {
29-
position: fixed;
30-
top: 60px;
31-
right: 30px;
32-
display: flex;
33-
flex-direction: column;
34-
align-items: center;
35-
justify-content: center;
36-
width: 350px;
37-
padding: 15px;
38-
background-color: antiquewhite;
39-
border: 1px solid gray;
40-
}
4128
.node-item {
4229
display: inline-flex;
4330
width: 100%;
4431
margin-top: 15px;
4532
}
46-
.node-item input {
33+
.node-item .form-control {
4734
width: 150px;
35+
border-radius: 0 4px 4px 0;
4836
}
49-
.node-item button {
50-
margin: 0 5px;
37+
38+
.node-item .btn {
39+
padding: 0 8px;
40+
margin-left: 10px;
5141
}
5242
.buttons {
5343
display: inline-flex;
@@ -57,33 +47,60 @@
5747
}
5848
#analysis {
5949
width: 80px;
60-
margin-right: 10px;
6150
}
6251
#reset {
6352
width: 80px;
53+
margin-right: 10px;
54+
}
55+
.panel-default {
56+
position: fixed;
57+
top: 60px;
58+
right: 30px;
59+
width: 380px;
60+
margin: 15px 15px 0 0;
61+
}
62+
63+
.input-group {
64+
margin-bottom: 15px;
65+
}
66+
.node-title {
67+
width: 80px;
68+
line-height: unset;
6469
}
6570
</style>
6671
</head>
6772

6873
<body>
6974
<div id="knowledgeGraph"></div>
70-
<div class="short-path-panel">
71-
<div class="title" data-i18n="resources.text_graphmap_shortest_analysis"></div>
72-
<div class="node-item start-node">
73-
<span data-i18n="resources.text_startNode"></span> <input class="start" disabled /><button
74-
id="select-start-node"
75-
data-i18n="resources.text_selectStartNode"
76-
></button>
77-
</div>
78-
<div class="node-item end-node">
79-
<span data-i18n="resources.text_endeNode"></span><input class="end" disabled /><button
80-
id="select-end-node"
81-
data-i18n="resources.text_selectEndNode"
82-
></button>
75+
<div class="panel panel-default">
76+
<div class="panel-heading">
77+
<h3 class="panel-title" data-i18n="resources.text_graphmap_shortest_analysis"></h3>
8378
</div>
84-
<div class="buttons">
85-
<button id="analysis" data-i18n="resources.text_analysis"></button>
86-
<button id="reset" data-i18n="resources.text_reset"></button>
79+
<div class="panel-body">
80+
<div class="node-item start-node">
81+
<span class="input-group-addon node-title" data-i18n="resources.text_startNode"></span>
82+
<input type="text" class="start form-control" disabled />
83+
<input
84+
type="button"
85+
id="select-start-node"
86+
class="btn btn-primary"
87+
data-i18n="[value]resources.text_selectStartNode"
88+
/>
89+
</div>
90+
<div class="node-item end-node">
91+
<span class="input-group-addon node-title" data-i18n="resources.text_endeNode"></span>
92+
<input type="text" class="end form-control" disabled />
93+
<input
94+
type="button"
95+
id="select-end-node"
96+
class="btn btn-primary"
97+
data-i18n="[value]resources.text_selectEndNode"
98+
/>
99+
</div>
100+
<div class="buttons" align="center">
101+
<input type="button" id="reset" class="btn" data-i18n="[value]resources.text_reset" />
102+
<input type="button" id="analysis" class="btn btn-primary" data-i18n="[value]resources.text_analysis" />
103+
</div>
87104
</div>
88105
</div>
89106
<script type="text/javascript" include="g6" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
@@ -143,8 +160,14 @@
143160
}
144161

145162
function setShortestPath({ startID, endID }) {
146-
graphmap.clearHighlight();
147-
graphmap.findShortestPath({ startID, endID });
163+
graphmap.findShortestPath({ startID, endID }, (res) => {
164+
if (res.type === 'processCompleted' && res.result.succeed) {
165+
const { nodeIDs, edgeIDs } = res.result;
166+
if (nodeIDs.length === 0 && edgeIDs.length === 0) {
167+
widgets.alert.showAlert(resources.text_no_shortestPath);
168+
}
169+
}
170+
});
148171
}
149172
</script>
150173
</body>

0 commit comments

Comments
 (0)