<< Click to Display Table of Contents >>

設定面圖徵

 

檢視範例

範例下載

 

 

<說明>

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

 

 

<範例>

         var earth_;

         var testpoly;

         var sw;

         var sc;

         var so;

         var fc;

         var fo;

       function documentLoad() {

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

           earth_ = new SuperGIS.3D API(pBody,{

                         viewpoint: new SuperGIS.SGEViewpoint(121.55345, 25.04628, 5000, 0, 0)

                 }, function(){

                         var path = [];

                         path[0] = new SuperGIS.SGEPoint(121.54892, 25.04157);

                         path[1] = new SuperGIS.SGEPoint(121.54903, 25.05172);

                         path[2] = new SuperGIS.SGEPoint(121.55384, 25.05414);

                         path[3] = new SuperGIS.SGEPoint(121.55787, 25.05149);

                         path[4] = new SuperGIS.SGEPoint(121.55757, 25.04142);

                         path[5] = new SuperGIS.SGEPoint(121.54892, 25.04157);

                         var lineStr = new SuperGIS.SGELineString(path);

                         var ring = new SuperGIS.SGELinearRing(lineStr);

                         var polygon = new SuperGIS.SGEPolygon([ring]);

                         testpoly = new SuperGIS.SGEFill(earth_, polygon, { //繪出path為lineStr的面圖徵

                                 fillColor: '#0000aa',

                                 fillOpacity: 0.8,

                                 strokeColor: '#00aa00',

                                 strokeWeight: 1,

                                 strokeOpacity: 0.9

                         });

                 });

           

       }

          function pointArrayToPath(pts){

           var path = [];

           var pathIndex = 0;

           var paintIndex = 0;

           while(paintIndex < pts.length){

               path[pathIndex] = new TGOS.TEPoint(pts[paintIndex],pts[paintIndex+1],pts[paintIndex+2]);

               pathIndex++;

               paintIndex += 3;

           }

           return path;

       }

         

         

       function changeSWeight() {

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

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

       }

         function changeSColor() {

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

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

         }

         function changeSOpacity() {

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

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

         }

         function changeFColor() {

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

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

         }

         function changeFOpacity() {

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

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

         }

 

 

 

 


© 2017 Supergeo Technologies Inc.