設定面圖徵

設定面圖徵

包含一個面範圍的幾何資料,必須藉由APITEFill類別的方法加以呈現,並決定面幾何資料的樣式,包含是否顯示、是否可點擊、填色顏色及透明度、筆畫顏色寬度及透明度、堆疊順序等,以及滑鼠的觸發事件。值得注意的是,只要是面幾何資料都可以用TEFill類別的方法呈現,亦即面資料結構(TEPolygon)、圓形資料結構(TECircle)、矩形資料結構(TEEnvelope)都可以使用TEFill繪製出來,以下即以一個矩形資料的繪製做為範例。

        function InitWnd() {

                   var pBody = document.getElementById("TGMap");

            tg3dEarth = newTGOS.TEOnlineMap(pBody,{

                           viewpoint: newTGOS.TEViewpoint(121.55345,25.04628, 5000, 0, 0)

                   }, function(){

                           var path = [];

                           path[0] = newTGOS.TEPoint(121.54892,25.04157);

                           path[1] = newTGOS.TEPoint(121.54903,25.05172);

                           path[2] = newTGOS.TEPoint(121.55384,25.05414);

                           path[3] = newTGOS.TEPoint(121.55787,25.05149);

                           path[4] = newTGOS.TEPoint(121.55757,25.04142);

                           path[5] = newTGOS.TEPoint(121.54892,25.04157);

                           var lineStr =new TGOS.TELineString(path);

                           var ring = newTGOS.TELinearRing(lineStr);

                           var polygon =new TGOS.TEPolygon([ring]);

                           testpoly = newTGOS.TEFill(tg3dEarth, polygon, {  //繪出pathlineStr的面圖徵

                                   fillColor:'#0000aa',

                                   fillOpacity:0.8,

                                   strokeColor: '#00aa00',

                                   strokeWeight: 1,

                                   strokeOpacity: 0.9

                           });

                   });

            }

          

        function changeSWeight() {

            var sw = Number(document.getElementById("strokeWeight").value); //設定外框寬度變數值來源

                   testpoly.setStrokeWeight(sw);  //設定外框寬度

        }

           function changeSColor() {

                   var sc = document.getElementById("strokeColor").value; //設定外框顏色變數值來源

                   testpoly.setStrokeColor(sc);  //設定外框顏色

           }

           functionchangeSOpacity() {

                   var so = Number(document.getElementById("strokeOpacity").value); //設定外框透明度變數值來源

                   testpoly.setStrokeOpacity(so);  //設定外框透明度

           }

           function changeFColor() {

                   var fc = document.getElementById("fillColor").value; //設定填色顏色變數值來源

                   testpoly.setFillColor(fc);  //設定填色顏色

           }

           functionchangeFOpacity() {

                   var fo = Number(document.getElementById("fillOpacity").value); //設定填色透明度變數值來源

                   testpoly.setOpacity(fo);  //設定填色透明度

           }

 

 

 

回到上方