Y
yangzhuotang
Unregistered / Unconfirmed
GUEST, unregistred user!
var
flds:CMapXFields;
lyrNew:CMapXLayer;
ftrNew:MapXLib_TLB.Feature;
ptNew:MapXLib_TLB.Point;
ff: MapXLib_TLB.FeatureFactory;
li :MapXLib_TLB.LayerInfo;
rvs:MapXLib_TLB.RowValues;
ds: MapXLib_TLB.DataSet;
sFilePath:string;
begin
sFilePath:=ExtractFilePath(paramstr(0))+'mycustomers.tab';
Map1.Layers.CreateLayer('mycustomers',sFilePath,1,emptyparam,emptyparam);
Map1.Layers.Remove(1);
ff:=Map1.FeatureFactory;
flds:=CoFields.Create;
flds.AddStringField('Company',50);
flds.AddStringField('City',50);
flds.AddStringField('state',2);
flds.AddNumericField('Order_Amt',12,2);
li:=CoLayerInfo.Create;
li.type_:=miLayerInfoTypeTab;
//li.type_:=miLayerInfoTypeNewTable;
li.AddParameter('FileSpec',sFilePath);
li.AddParameter('Name','mycustomers');
li.AddParameter('Fields',flds);
Map1.Layers.Add(li,1);
lyrNew:=CoLayer.Create;
lyrNew:=Map1.Layers.Item(1);
ds:=Codataset.Create;
ds:=Map1.Datasets.Add(miDataSetLayer,lyrNew,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam);
rvs:=CoRowValues.Create;
rvs :=ds.RowValues[0];
ADOTable1.First;
while not ADOTable1.EOFdo
begin
rvs.Item('Company').Value:=ADOTable1.Fields.FieldByName('Company').Value;
rvs.Item('City').Value:=ADOTable1.Fields.FieldByName('City').Value;
rvs.Item('state').Value:=ADOTable1.Fields.FieldByName('state').Value;
rvs.Item('Order_Amt').Value:=ADOTable1.Fields.FieldByName('Order_Amt').Value;
//ptNew.Set_(rs.Fields.Item['X'],rs.Fields.Item['Y']);
ptNew.Set_(ADOTable1.Fields.FieldByName('X').Value.Value,ADOTable1.Fields.FieldByName('Y').Value);
ftrNew:=ff.CreateSymbol(ptNew,emptyparam);
lyrNew.AddFeature(ftrNew,rvs);
ADOTable1.Next
end;
end;
flds:CMapXFields;
lyrNew:CMapXLayer;
ftrNew:MapXLib_TLB.Feature;
ptNew:MapXLib_TLB.Point;
ff: MapXLib_TLB.FeatureFactory;
li :MapXLib_TLB.LayerInfo;
rvs:MapXLib_TLB.RowValues;
ds: MapXLib_TLB.DataSet;
sFilePath:string;
begin
sFilePath:=ExtractFilePath(paramstr(0))+'mycustomers.tab';
Map1.Layers.CreateLayer('mycustomers',sFilePath,1,emptyparam,emptyparam);
Map1.Layers.Remove(1);
ff:=Map1.FeatureFactory;
flds:=CoFields.Create;
flds.AddStringField('Company',50);
flds.AddStringField('City',50);
flds.AddStringField('state',2);
flds.AddNumericField('Order_Amt',12,2);
li:=CoLayerInfo.Create;
li.type_:=miLayerInfoTypeTab;
//li.type_:=miLayerInfoTypeNewTable;
li.AddParameter('FileSpec',sFilePath);
li.AddParameter('Name','mycustomers');
li.AddParameter('Fields',flds);
Map1.Layers.Add(li,1);
lyrNew:=CoLayer.Create;
lyrNew:=Map1.Layers.Item(1);
ds:=Codataset.Create;
ds:=Map1.Datasets.Add(miDataSetLayer,lyrNew,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam);
rvs:=CoRowValues.Create;
rvs :=ds.RowValues[0];
ADOTable1.First;
while not ADOTable1.EOFdo
begin
rvs.Item('Company').Value:=ADOTable1.Fields.FieldByName('Company').Value;
rvs.Item('City').Value:=ADOTable1.Fields.FieldByName('City').Value;
rvs.Item('state').Value:=ADOTable1.Fields.FieldByName('state').Value;
rvs.Item('Order_Amt').Value:=ADOTable1.Fields.FieldByName('Order_Amt').Value;
//ptNew.Set_(rs.Fields.Item['X'],rs.Fields.Item['Y']);
ptNew.Set_(ADOTable1.Fields.FieldByName('X').Value.Value,ADOTable1.Fields.FieldByName('Y').Value);
ftrNew:=ff.CreateSymbol(ptNew,emptyparam);
lyrNew.AddFeature(ftrNew,rvs);
ADOTable1.Next
end;
end;