88< div id ="toolbar " class ="panel panel-primary "
99 style ="position: absolute;top: 10px;right: 10px;width: 300px;text-align: center;z-index: 800;border-radius: 4px; ">
1010 < 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 >
1212 < div class ='panel-body content '>
1313 < div class ='panel '>
1414 < 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 >
1616 < input type ='text ' class ='form-control ' id ='lineWidth ' value ='2 ' onchange ="lineWidthChanges() "/>
1717 </ div >
1818 < 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 >
2721 </ div >
2822 < 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 >
3024 < input type ="text " id ="lineColor " value ="" class ='form-control '/>
3125 < span class ='input-group-addon '> < img src ='../img/colorpicker.png ' id ="cp1 "
3226 style ="cursor:pointer z-index: 9999; "/> </ span >
3327 </ div >
3428
3529 < 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 >
3731 < input type ='text ' class ='form-control ' id ='symbolWidth ' value ='40 ' onchange ="symbolWidthChanges() "/>
3832 </ div >
3933 < 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 >
4135 < input type ='text ' class ='form-control ' id ='symbolHeight ' value ='40 ' onchange ="symbolHeightChanges() "/>
4236 </ div >
4337 < 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 >
4539 < select class ='form-control ' id ='defaultStyleFlag ' onchange ="defaultStyleFlagChanges() ">
4640 < option value ='0 '> false</ option >
4741 < option value ='1 '> true</ option >
4842 </ select >
4943 </ div >
5044 </ 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() "/>
5347 </ div >
5448</ div >
5549< div id ="map " style ="margin:0 auto;width: 100%;height: 100% "> </ div >
@@ -60,7 +54,9 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
6054 var host = window . isLocal ? window . server : "http://support.supermap.com.cn:8090" ;
6155 var url = host + "/iserver/services/map-world/rest/maps/World" ;
6256 var serverUrl = host + "/iserver/services/plot-jingyong/rest/plot/" ;
63- var map , symbolLibManager ;
57+ var map , symbolLibManager , plotting ;
58+ var item = [ "实线" , "长虚线" , "由点构成的直线" , "由线划线段组成的直线" , "由重复的线划点图案构成的直线" ] ,
59+ select , lineStyle ;
6460 map = L . map ( 'map' , {
6561 preferCanvas : true ,
6662 crs : L . CRS . EPSG4326 ,
@@ -75,7 +71,7 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
7571 drawControl . addTo ( map ) ;
7672 var editControl = L . supermap . plotting . editControl ( ) ;
7773 editControl . addTo ( map ) ;
78- var plotting = L . supermap . plotting . getControl ( map , serverUrl ) ;
74+ plotting = L . supermap . plotting . getControl ( map , serverUrl ) ;
7975 function loadSymbolLib ( ) {
8076 symbolLibManager = plotting . getSymbolLibManager ( ) ;
8177 symbolLibManager . on ( SuperMap . Plot . Event . initializecompleted , initializeCompleted ) ;
@@ -86,7 +82,8 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
8682 }
8783 function initHtml ( ) {
8884 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];
9087 document . getElementById ( "lineColor" ) . value = plotting . getDefaultStyle ( ) . lineColor ;
9188 document . getElementById ( "symbolWidth" ) . value = plotting . getDefaultStyle ( ) . dotSymbolSize ;
9289 document . getElementById ( "symbolHeight" ) . value = plotting . getDefaultStyle ( ) . dotSymbolSize ;
@@ -95,14 +92,50 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
9592 else
9693 document . getElementById ( "defaultStyleFlag" ) . value = 0 ;
9794 }
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+
98129 function lineWidthChanges ( ) {
99130 PlottingDrawCancel ( ) ;
100131 plotting . getDefaultStyle ( ) . lineWidth = document . getElementById ( "lineWidth" ) . value ;
101132 }
102133
103134 function lineStyleChanges ( ) {
104135 PlottingDrawCancel ( ) ;
105- plotting . getDefaultStyle ( ) . lineType = document . getElementById ( "lineStyle" ) . value ;
136+ var obj = selectLineType ( ) ;
137+ plotting . getDefaultStyle ( ) . lineType = obj . lineStyle ;
138+
106139 }
107140
108141 function symbolWidthChanges ( ) {
@@ -156,8 +189,18 @@ <h5 class='panel-title text-center'>缺省属性</h5></div>
156189 PlottingDrawCancel ( ) ;
157190 plotting . getDefaultStyle ( ) . lineColor = document . getElementById ( "lineColor" ) . value ;
158191 }
192+
159193 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+ }
160202 loadSymbolLib ( ) ;
203+
161204 } ;
162205</ script >
163206</ body >
0 commit comments