取得指定圖素的幾何
指定圖素Id
圖素幾何,若id沒有找到指定的圖素則回傳為null
取得指定圖素的參數
指定圖素id
傳回圖素設定的參數。 Point種類:PointEntityParameter。 Polyline種類:PolylineEntityParameter。 Polygon種類:PolygonEntityParameter。 PolygonSet種類:PolygonSetEntityParameter。 Text種類:TextEntityParameter。
新增批量點圖素
參數
回呼函式,function(featureId)
Optional
LaterAddToSource: boolean = false是否之後手動加入圖素,true則不會將圖素加入圖層,預設為false
Optional
ReturnType: string = ""回呼函式傳入型態,"SELF"則傳入Feature物件,預設傳入Feature ID
//可以設定參數有:Point, FillColor, Radius, RadiusUnit, SymbolUrl, SymbolSize, SymbolRotation(弧度), TextStyle, Tooltip。
//如果有需要文字標籤,先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
var callback = function(featureId){}
//新增圓點
this.VectorLayer.NewBatchPoint([{ 'Point': new GeoPoint(163887.80, 2600000), 'FillColor': 'argb(0,0,0,1)', 'Radius': 1000, 'RadiusUnit': UNIT.MAP, 'TextStyle': text },...], callback);
//新增符號
this.VectorLayer.NewBatchPoint([{ 'Point': new GeoPoint(165000, 2650000), 'SymbolUrl': 'http://127.0.0.1:8080/台灣全圖_84TM2.jpg', 'SymbolSize': new CSize(48, 48), 'TextStyle': text },...], callback);
新增點,若要大量新增則請使用NewBatchPoint
圖素設定參數
顏色。
是否稍後再加入。
點座標。
半徑。
作畫單位。
回傳型態,"SELF"為ol.Feature。
圖片旋轉角度(弧度)。
圖片大小。
圖片來源。
文字樣式。
提示文字。
傳回圖素ID(預設)或圖素本身
//可以設定參數有:Point, FillColor, Radius, RadiusUnit, SymbolUrl, SymbolSize, SymbolRotation(弧度), TextStyle, Tooltip, LaterAddToSource, ReturnType。
//如果有需要文字標籤,先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
//新增圓點
this.VectorLayer.NewPoint({ 'Point': new GeoPoint(163887.80, 2600000), 'FillColor': 'argb(0,0,0,1)', 'Radius': 1000, 'RadiusUnit': UNIT.MAP, 'TextStyle': text });
//新增符號
this.VectorLayer.NewPoint({ 'Point': new GeoPoint(165000, 2650000), 'SymbolUrl': 'http://127.0.0.1:8080/台灣全圖_84TM2.jpg', 'SymbolSize': new CSize(48, 48), 'TextStyle': text });
//回傳型態
this.VectorLayer.NewPoint({ ..., ReturnType: 'SELF' }); 則回傳Feature物件,預設回傳Feature ID。
點中心位置
顏色
Optional
unit: number圖素大小單位 UNIT.MAP:半徑以公尺為單位, UNIT.PIXEL:半徑以螢幕上的像素為單位,不給預設為UNIT.PIXEL
Optional
textStyle: CTextStyle標籤樣式,沒指定就不顯示標籤
傳回圖素ID
新增點圖素(圓形顏色)
var id = CVectorLayer.NewPoint_Color(new GeoPoint(), '#FFFFFF', 10, UNIT.PIXEL);
var id = CVectorLayer.NewPoint_Color(new GeoPoint(), 'rgb(0,0,0)', 10000, UNIT.MAP);
var id = CVectorLayer.NewPoint_Color(new GeoPoint(), 'rgb(0,0,0)', 10, UNIT.PIXEL, text);
點中心位置
符號圖片的連結
Optional
size: CSize符號大小,沒給則用符號圖片本身的大小
Optional
textStyle: CTextStyle標籤樣式,沒指定就不顯示標籤
傳回圖素ID
新增點-符號圖素
var id = CVectorLayer.NewPoint_Symbol(new GeoPoint(), 'http://127.0.0.1:8080/Position48.png', new CSize(128,128), text );
var id = CVectorLayer.NewPoint_Symbol(new GeoPoint(), 'http://127.0.0.1:8080/Position48.png');
新增面圖素
圖素設定參數
外框顏色
外框寬度
塗滿顏色
Optional
textStyle: CTextStyle標籤樣式,沒指定就不顯示標籤
Rest
...args: any傳回圖素ID(預設)或圖素本身
var id = CVectorLayer.NewPolygon(new GeoPolygon(buffer), '#FFFFFF', 5, 'rgb(255,0,0)' );
var id = CVectorLayer.NewPolygon(new GeoPolygon(buffer), '#FFFFFF', 5, 'rgb(255,0,0)', new CTextStyle()); //使用預設的文字樣式
新增面圖素
圖素設定參數。
面顏色。
是否稍後再加入。
虛線間隔或開啟虛線。
面幾何。
回傳型態,"SELF"為ol.Feature。
邊線顏色。
邊線寬。
文字樣式。
提示文字。
傳回圖素ID(預設)或圖素本身
//可以設定參數有:Polygon, StrokeColor, StrokeWidth, FillColor, TextStyle,Tooltip, LaterAddToSource, LineDash, ReturnType。
//如果有需要文字標籤,先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
//新增面圖素
this.VectorLayer.NewPolygonByParam({ 'Polygon': new GeoPolygon(buffer) , 'StrokeColor': '#FFFFFF', 'StrokeWidth': 5, 'FillColor': 'rgba(255,0,0,0.5)', 'TextStyle': text, 'LineDash' : [4,8]});
新增多面圖素
多面圖素
外框顏色
外框寬度
塗滿顏色
Optional
NullInside: boolean是否要空心,預設為true
Rest
...args: any傳回圖素ID(預設)或圖素本身
var id = CVectorLayer.NewPolygonSet(new GeoPolygonSet(buffer), '#FFFFFF', 5, 'rgb(255,0,0)' );
var id = CVectorLayer.NewPolygonSet(new GeoPolygonSet(buffer), '#FFFFFF', 5, 'rgb(255,0,0)', '' , true); 不顯示標籤
var id = CVectorLayer.NewPolygonSet(new GeoPolygonSet(buffer), '#FFFFFF', 5, 'rgb(255,0,0)', text, true);顯示標籤
新增多面圖素
圖素設定參數。
面顏色。
是否稍後再加入。
虛線間隔或開啟虛線。
是否不畫面。
多面幾何。
回傳型態,"SELF"為ol.Feature。
邊線顏色。
邊線寬。
文字樣式。
提示文字。
Rest
...args: any傳回圖素ID(預設)或圖素本身
//可以設定參數有:PolygonSet, StrokeColor, StrokeWidth, FillColor, TextStyle, NullInside, Tooltip, LaterAddToSource, LineDash, ReturnType。
//如果有需要文字標籤,先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
//新增線圖素
this.VectorLayer.NewPolygonSetByParam({ 'PolygonSet': pgs2 , 'StrokeColor': '#FF00FF', 'StrokeWidth': 5, 'FillColor': 'rgb(255,0,0)', 'TextStyle': text, 'NullInside': true, 'LineDash' : [4,8]});
新增聚合線圖素
線條
線條寬度
Optional
textStyle: CTextStyle標籤樣式,沒指定就不顯示標籤
Rest
...args: any傳回圖素ID(預設)或圖素本身
var id = CVectorLayer.NewPolyline(new GeoPolyline(buffer), '#FFFFFF', 5 );
var id = CVectorLayer.NewPolyline(new GeoPolyline(buffer), '#FFFFFF', 5, text);
新增聚合線圖素
圖素設定參數
是否稍後再加入。
虛線間隔或開啟虛線。
聚合線幾何。
回傳型態,"SELF"為ol.Feature。
是否顯示箭頭。
邊線顏色。
邊線寬。
文字樣式。
提示文字。
傳回圖素ID(預設)或圖素本身
//可以設定參數有:Polyline, StrokeColor, StrokeWidth, TextStyle, ShowArrow,Tooltip, LaterAddToSource, LineDash, ReturnType。
//如果有需要文字標籤,先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
//新增線圖素
this.VectorLayer.NewPolylineByParam({ 'Polyline': new GeoPolyline(buffer), 'StrokeColor': 'black', 'StrokeWidth': 5, 'TextStyle': text, 'ShowArrow': true, 'LineDash' : [4,8] });
新增文字圖素
Optional
bShowPoint: boolean是否要顯示圓點,預設false
Optional
PointColor: string圓點顏色,不給預設紅色
Optional
PointRadius: number圓點半徑,不給預設為1
Optional
PointUnit: number半徑單位類型,UNIT.MAP:半徑以公尺為單位, UNIT.PIXEL:半徑以螢幕上的像素單位,不給預設為UNIT.PIXEL
Rest
...args: any傳回圖素ID(預設)或圖素本身
var id = CVectorLayer.NewText(new GeoPoint(5,5), text);
var id = CVectorLayer.NewText(new GeoPoint(5,5), text, false) 不顯示圓點
var id = CVectorLayer.NewText(new GeoPoint(5,5), text, true, '#FF0000', 20, UNIT.PIXEL) 顯示圓點
新增文字圖素。
圖素設定參數。
是否稍後再加入。
幾何點。
圓點顏色。
圓點半徑。
圓點半徑單位類型。
回傳型態,"SELF"為ol.Feature。
是否顯示圓點。
標籤樣式
提示文字。
傳回圖素ID
//可以設定參數有:Point, ShowPoint, PointFillColor, PointRadius, PointRadiusUnit, TextStyle, Tooltip, LaterAddToSource,ReturnType。
//先建立文字樣式物件
var text = new CTextStyle();
text.Text = "jgoah-ih;fjaghaihf-kajsnvoahgihufkjakhgqaihf";
text.ContentStyle = 'Shorten';
text.Weight = 'bold';
text.FillColor = 'yellow'
text.Baseline = 'middle';
text.StrokeColor = 'rgba(0,0,0,0.5)';
text.StrokeWidth = 3;
text.Rotation = 1.57;
text.Size = 12;
//新增文字圖素
this.VectorLayer.NewTextByParam({
'Point': new GeoPoint(175000, 2542575.6165581764), 'TextStyle': text, 'ShowPoint': true, 'PointFillColor': '#00FF00', 'PointRadius': 100, 'PointRadiusUnit': UNIT.PIXEL,
'Tooltip': "<table><tbody><tr><td colspan=\"2\">關渡觀測站</td></tr><tr><td>HOUR_3</td><td>0.00</td></tr><tr><td>HOUR_6</td><td>-999.00</td></tr><tr><td>HOUR_12</td><td>-999.00</td></tr><tr><td>HOUR_24</td><td>-999.00</td></tr><tr><td>MIN_10</td><td>0.00</td></tr><tr><td>NOW</td><td>0.00</td></tr></tbody></table><br>"
});
在圖層上搜尋固定範圍(螢幕上5px)內的圖素Id
輸入點(世界坐標)
圖素Id陣列
在圖層上搜尋範圍內的圖素Id
輸入幾何(世界坐標)
搜索半徑(單位:公尺)
圖素Id陣列
在圖層上搜尋指定幾何範圍內的圖素Id
輸入幾何(世界坐標)
圖素Id陣列
更新與指定圖素相關的參數 點圖素間的轉換,需要給完整資訊,可以參考NewPoint_Color和NewPoint_Symbol(symbol轉color需要指定SymbolUrl為空字串) 不要顯示文字的話Text給空字串或TextStyle.Text給空字串,如果有指定TextStyle,以TextStyle為主
指定圖素id
需要變更的參數。 Point種類:PointEntityParameter。 Polyline種類:PolylineEntityParameter。 Polygon種類:PolygonEntityParameter。 PolygonSet種類:PolygonSetEntityParameter。 Text種類:TextEntityParameter。
回傳更新是否成功
Generated using TypeDoc
向量圖層 不能直接呼叫CVectorLayer的建構函式,您應該從已經存在的CMapDocument物件,透過NewVectorLayer新增CVectorLayer
Param: MapDocument
地圖文件。
Param: Obj
圖層設定。
Example