8
8
< div id ="toolbar " class ="panel panel-primary "
9
9
style ="position: absolute;top: 10px;right: 10px;width: 300px;text-align: center;z-index: 800;border-radius: 4px; ">
10
10
< div class ='panel-heading '>
11
- < h5 class ='panel-title text-center '> 缺省属性 </ h5 > </ div >
11
+ < h5 class ='panel-title text-center ' data-i18n =" resources.title_defaultStyle " > </ h5 > </ div >
12
12
< div class ='panel-body content '>
13
13
< div class ='panel '>
14
14
< div class ='input-group ' style ="margin-bottom: 15px; ">
15
- < span class ='input-group-addon '> 线宽: </ span >
15
+ < span class ='input-group-addon ' data-i18n =" resources.text_lineWidth " > </ span >
16
16
< input type ='text ' class ='form-control ' id ='lineWidth ' value ='2 ' onchange ="lineWidthChanges() "/>
17
17
</ div >
18
18
< div class ='input-group ' style ="margin-bottom: 15px; ">
19
- < span class ='input-group-addon '> 线型:</ span >
20
- < select class ='form-control ' id ='lineStyle ' onchange ="lineStyleChanges() ">
21
- < option value ='0 '> 实线</ option >
22
- < option value ='1 '> 长虚线</ option >
23
- < option value ='2 '> 由点构成的直线</ option >
24
- < option value ='3 '> 由线划线段组成的直线</ option >
25
- < option value ='4 '> 由重复的线划点图案构成的直线</ option >
26
- </ select >
19
+ < span class ='input-group-addon ' data-i18n ="resources.text_lineType "> </ span >
20
+ < select class ='form-control ' id ="lineStyle " onchange ="lineStyleChanges() "> </ select >
27
21
</ div >
28
22
< div class ='input-group ' style ="margin-bottom: 15px; ">
29
- < span class ='input-group-addon '> 线色: </ span >
23
+ < span class ='input-group-addon ' data-i18n =" resources.text_lineColor " > </ span >
30
24
< input type ="text " id ="lineColor " value ="" class ='form-control '/>
31
25
< span class ='input-group-addon '> < img src ='../img/colorpicker.png ' id ="cp1 "
32
26
style ="cursor:pointer z-index: 9999; "/> </ span >
33
27
</ div >
34
28
35
29
< div class ='input-group ' style ="margin-bottom: 15px; ">
36
- < span class ='input-group-addon '> 标号宽度: </ span >
30
+ < span class ='input-group-addon ' data-i18n =" resources.text_markerWidth " > </ span >
37
31
< input type ='text ' class ='form-control ' id ='symbolWidth ' value ='40 ' onchange ="symbolWidthChanges() "/>
38
32
</ div >
39
33
< div class ='input-group ' style ="margin-bottom: 15px; ">
40
- < span class ='input-group-addon '> 标号高度: </ span >
34
+ < span class ='input-group-addon ' data-i18n =" resources.text_markerHeight " > </ span >
41
35
< input type ='text ' class ='form-control ' id ='symbolHeight ' value ='40 ' onchange ="symbolHeightChanges() "/>
42
36
</ div >
43
37
< div class ='input-group ' style ="margin-bottom: 15px; ">
44
- < span class ='input-group-addon '> 使用缺省属性: </ span >
38
+ < span class ='input-group-addon ' data-i18n =" resources.text_defaultStyle " > </ span >
45
39
< select class ='form-control ' id ='defaultStyleFlag ' onchange ="defaultStyleFlagChanges() ">
46
40
< option value ='0 '> false</ option >
47
41
< option value ='1 '> true</ option >
48
42
</ select >
49
43
</ div >
50
44
</ div >
51
- < input type ="button " class ="btn btn-default " value =" 绘制标号 " onclick ="plotSymbol() "/>
52
- < input type ="button " class ="btn btn-default " value =" 取消标绘 " onclick ="PlottingDrawCancel() "/>
45
+ < input type ="button " class ="btn btn-default " data-i18n =" [value]resources.btn_drawMarker " onclick ="plotSymbol() "/>
46
+ < input type ="button " class ="btn btn-default " data-i18n =" [value]resources.btn_cancelMarker " onclick ="PlottingDrawCancel() "/>
53
47
</ div >
54
48
</ div >
55
49
< div id ="map " style ="margin:0 auto;width: 100%;height: 100% "> </ div >
@@ -60,7 +54,9 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
60
54
var host = window . isLocal ? window . server : "http://support.supermap.com.cn:8090" ;
61
55
var url = host + "/iserver/services/map-world/rest/maps/World" ;
62
56
var serverUrl = host + "/iserver/services/plot-jingyong/rest/plot/" ;
63
- var map , symbolLibManager ;
57
+ var map , symbolLibManager , plotting ;
58
+ var item = [ "实线" , "长虚线" , "由点构成的直线" , "由线划线段组成的直线" , "由重复的线划点图案构成的直线" ] ,
59
+ select , lineStyle ;
64
60
map = L . map ( 'map' , {
65
61
preferCanvas : true ,
66
62
crs : L . CRS . EPSG4326 ,
@@ -75,7 +71,7 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
75
71
drawControl . addTo ( map ) ;
76
72
var editControl = L . supermap . plotting . editControl ( ) ;
77
73
editControl . addTo ( map ) ;
78
- var plotting = L . supermap . plotting . getControl ( map , serverUrl ) ;
74
+ plotting = L . supermap . plotting . getControl ( map , serverUrl ) ;
79
75
function loadSymbolLib ( ) {
80
76
symbolLibManager = plotting . getSymbolLibManager ( ) ;
81
77
symbolLibManager . on ( SuperMap . Plot . Event . initializecompleted , initializeCompleted ) ;
@@ -86,7 +82,8 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
86
82
}
87
83
function initHtml ( ) {
88
84
document . getElementById ( "lineWidth" ) . value = plotting . getDefaultStyle ( ) . lineWidth ;
89
- document . getElementById ( "lineStyle" ) . value = '0' ;
85
+ document . getElementById ( "lineStyle" ) . value = item [ 0 ] ;
86
+ //document.getElementById("lineStyle").value = item[plotting.getDefaultStyle().lineType];
90
87
document . getElementById ( "lineColor" ) . value = plotting . getDefaultStyle ( ) . lineColor ;
91
88
document . getElementById ( "symbolWidth" ) . value = plotting . getDefaultStyle ( ) . dotSymbolSize ;
92
89
document . getElementById ( "symbolHeight" ) . value = plotting . getDefaultStyle ( ) . dotSymbolSize ;
@@ -95,14 +92,50 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
95
92
else
96
93
document . getElementById ( "defaultStyleFlag" ) . value = 0 ;
97
94
}
95
+
96
+
97
+
98
+ function selectLineType ( ) {
99
+
100
+ var select = document . getElementById ( "lineStyle" ) ;
101
+ var type ;
102
+ for ( var i = 0 ; i < select . children . length ; i ++ ) {
103
+ if ( select . children [ i ] . selected ) {
104
+ type = select . children [ i ] . value ;
105
+
106
+ }
107
+ }
108
+ if ( type === item [ 0 ] ) {
109
+ lineStyle = 0 ;
110
+ }
111
+ else if ( type === item [ 1 ] ) {
112
+ lineStyle = 1 ;
113
+ }
114
+ else if ( type === item [ 2 ] ) {
115
+ lineStyle = 2 ;
116
+ }
117
+ else if ( type === item [ 3 ] ) {
118
+ lineStyle = 3 ;
119
+ }
120
+ else if ( type === item [ 4 ] ) {
121
+ lineStyle = 4 ;
122
+ }
123
+ var obj = new Object ( ) ;
124
+ obj . selectValue = type ;
125
+ obj . lineStyle = lineStyle ;
126
+ return obj ;
127
+ }
128
+
98
129
function lineWidthChanges ( ) {
99
130
PlottingDrawCancel ( ) ;
100
131
plotting . getDefaultStyle ( ) . lineWidth = document . getElementById ( "lineWidth" ) . value ;
101
132
}
102
133
103
134
function lineStyleChanges ( ) {
104
135
PlottingDrawCancel ( ) ;
105
- plotting . getDefaultStyle ( ) . lineType = document . getElementById ( "lineStyle" ) . value ;
136
+ var obj = selectLineType ( ) ;
137
+ plotting . getDefaultStyle ( ) . lineType = obj . lineStyle ;
138
+
106
139
}
107
140
108
141
function symbolWidthChanges ( ) {
@@ -156,8 +189,18 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
156
189
PlottingDrawCancel ( ) ;
157
190
plotting . getDefaultStyle ( ) . lineColor = document . getElementById ( "lineColor" ) . value ;
158
191
}
192
+
159
193
window . onload = function ( ) {
194
+ select = document . getElementById ( "lineStyle" ) ;
195
+ for ( var i = 0 , len = item . length ; i < len ; i ++ ) {
196
+ var options = document . createElement ( "option" ) ;
197
+ options . setAttribute ( "value" , item [ i ] ) ;
198
+ options . innerHTML = item [ i ] ;
199
+ select . appendChild ( options ) ;
200
+
201
+ }
160
202
loadSymbolLib ( ) ;
203
+
161
204
} ;
162
205
</ script >
163
206
</ body >
0 commit comments