主题:[原创]组件map3.5升级到mapx5.0
问:怎么对lay.AddFeature(myf),nodedata.feature.Update,lay.selection.SelectByPoint(CenterX,CenterY,miselectionnew)加相关参数?
/此类为树上某结点data所指类型,用于记住该结点的有关信息
type
Tnodedata=class
objectoid:integer; //对象id
parentoid:integer; //父对象id
objectcode:string; //对象的统一编码(可见的)
trafficcode:integer; //管理对象的业务编码
objectname:string; //对象名
objecttabname:string; //对象表名称
status:string; //对象状态
sort:string; //类型
longitude:double; //经度
latitude:double; //纬度
objectlevel:integer; //结点所在的层数
objectpath:string; //对象路径
feature:feature;
projectid:string;
bmp:Tbitmap;
islink:integer; //是否链路:0设备、1链路、2子网
end;
procedure Tfrmmain.FillDynamicLayer(node:TTreenode); //画图上对象并与结点相联系
var
nodedata: Tnodedata;
objectname: string;
objecttabname: string;
objectoid,parentoid: integer;
LayerName: string;
LayerFile: string;
lay: layer;
s: style;
myf: feature;
myp: point;
myps: points;
x,y: double;
begin
nodedata := Tnodedata(node.Data);
objecttabname := nodedata.objecttabname;
objectname := nodedata.objectname;
objectoid := nodedata.objectoid;
parentoid := nodedata.parentoid;
x := nodedata.longitude;
y := nodedata.latitude;
myp := createcomobject(class_point) as point;
myps := createcomobject(class_points) as points;
s := createcomobject(class_style) as style;
LayerName := 'oid' + intTostr(objectoid);
LayerFile := 'templay\' + LayerName + '.tab';
if (objecttabname = 'NONE') or (objecttabname = 'TTRAFFIC') or (objecttabname = 'TTFUNCTION') or (objecttabname = 'TSUBNET') then //如果是根结点、业务类型或子网则生成图层
begin
map1.oleobject.Layers.CreateLayer(LayerName,LayerFile,1);
lay:= map1.ControlInterface.Layers.Item[LayerName];//lay:= map1.ControlInterface.Layers.Item(LayerName);
lay.Visible := false;
lay.AutoLabel := false;
lay.LabelProperties.Offset := 9;
lay.LabelProperties.Position := 7;
end;
if (objecttabname = 'TTRAFFIC') or (objecttabname = 'TTFUNCTION') then //业务或功能
begin
LayerName := 'oid'+intTostr(parentoid);
lay := map1.ControlInterface.Layers.Item[LayerName];//lay := map1.ControlInterface.Layers.Item(LayerName);
myp.Set_(x,y);
s.SymbolType := 1;
s.SymbolBitmapName := 'oid0.bmp';
s.SymbolBitmapTransparent := true;
s.SymbolBitmapOverrideColor := false;
s.SymbolBitmapSize := 36;
myf := map1.ControlInterface.FeatureFactory.CreateSymbol(myp,s);
myf.KeyValue := objectname + intTostr(objectoid);
myf := lay.AddFeature(myf); //????????????????????????????????
lay.Refresh;
nodedata.feature := myf;
end
else if (objecttabname = 'TOBJECTINSTANCE') or (objecttabname = 'TSUBNET') then //如果是设备对象结点
begin
if (nodedata.islink = 0) or (nodedata.islink = 2) then //如果不是链路,链路在TLINEOBJECT表中显示
begin
LayerName := 'oid'+intTostr(parentoid);
lay := map1.ControlInterface.Layers.Item[LayerName];//lay := map1.ControlInterface.Layers.Item(LayerName);
myp.Set_(x,y);
s.SymbolType := 1;
AddBmpToDir(node);
s.SymbolBitmapName := 'oid' + intTostr(nodedata.objectoid) + '.bmp';
s.SymbolBitmapTransparent := true;
s.SymbolBitmapOverrideColor := false;
s.SymbolBitmapSize := 36;
myf := map1.ControlInterface.FeatureFactory.CreateSymbol(myp,s);
myf.KeyValue := objectname + intTostr(objectoid); //确定图标的关键值
myf := lay.AddFeature(myf);
lay.Refresh;
nodedata.feature := myf;
end;
end;
end;