📄 基于mapx技术的crm应用研究.txt
字号:
if Flags = miPolyToolEnd Then
begin
pts:=points;
for i:=1 to pts.count-1 do
begin
Dist:=Dist+MainMap.Distance(pts.Item(i).X,pts.Item(i).Y,
pts.Item(i+1).X,pts.Item(i+1).Y);
end;
Dist:=Dist*1.852;
if Dist>1 then
begin
StuBar.Panels.Items[3].Text:='两地的距离为:'+FloatToStrF(Dist, ffFixed, 12, 2)+'Km';
end else begin
StuBar.Panels.Items[3].Text:='两地的距离为:'+FloatToStrF(Dist, ffFixed, 12, 4)+'Km';
end;
if pts.Count>=2 then
begin
newObj := MainMap.ControlInterface.FeatureFactory.CreateLine(points, LStyle);
RoadLyr.AddFeature(newObj);
RoadCount:=RoadCount+1;
ListBox1.Items.Add('第'+IntToStr(RoadCount)+'段路:'+FloatToStrF(Dist,ffFixed, 12, 3)+'Km');
AllDist:=AllDist+Dist;
Label3.Caption:='总路径='+FloatToStrF(AllDist,ffFixed, 12, 3)+'Km';
end else Application.MessageBox('道路至少需要两个点!','提示...',0);
end
else If Flags = miPolyToolEndEscaped then
1、专题图的实现
procedure TMainForm.ToAddThemes(style : integer; TheName : string);
function DefaultName : string;{用来生成一唯一的名称}
begin
Result := 'YYT' + FormatDateTime('YYYYMMDDHHNNSSzzz',now);
end;
var
flds : array of string; {字段列表}
oBLayer : BindLayer; {绑定图层}
ds : Dataset; {MapX数据集}
i : integer; {循环变量}
thm : theme; {MapX专题图}
str : string; {用于保存字符串}
begin
if not aqThemes.Active then
begin
Application.MessageBox('系统表没有打开!',‘提示’,0);
exit;
end;
try
{取一个唯一的名字,}
str := DefaultName;
{设置绑定图层的属性}
oBLayer := coBindLayer.Create;
progress.StepBy(2);
oBLayer.LayerName := str;
oBLayer.LayerType := miBindLayerTypeXY;
oBLayer.RefColumn1 := 'X';
oBLayer.RefColumn2 := 'Y';
ds := Mainmap.Datasets.Add(12,
aqThemes.Recordset,
str,
'ID',
EmptyParam,
oBLayer,
EmptyParam,
EmptyParam);
{组织专题图现实的数据字段,存储在字符串数组中}
SetLength(flds,aqThemes.Fields.Count - 3);
for i:=3 to aqThemes.Fields.Count - 1 do
begin
flds[i - 3] := aqThemes.Fields.Fields[i].FieldName;
end;
{实际添加专题图的过程}
thm := ds.Themes.Add(style,flds,DefaultName,EmptyParam);
{设置专题图图例标题}
thm.Legend.Title := TheName;
{记录新添加的专题图名称}
ListBox1.Items.Add(str);
btnDeleteThemes.Visible := true;
except
Application.MessageBox('创建专题图失败!',‘提示’,0);
end;
end;
2、车辆定位显示
procedure TFrmMain.AddCar(Code:String;ADate:TDateTime;Lgtd,Lttd,Spd,Rd,Hi:Double;State:Integer);
var
fNewSymbol: Variant;
fMapSymbol: Variant;
fFtrFactory : Variant;
pItem: Variant;
i:Integer;
TagInfTTargetInfo;
Fond:Boolean;
PInfTPointInfo;
begin
Fond:=False;
for i:=0 to TraceingList.Count-1 do
begin
TagInf=TraceingList[i];
if TagInfo.Code=Code then
begin
Fond:=True;
break;
end;
end;
if not Fond then
begin
for i:=0 to TraceingList.Count-1 do
begin
TagInf=TraceingList[i];
TagInfo.Traceing:=False;
end;
fFtrFactory:=MainMap.FeatureFactory;
pItem:=CreateOleObject('MapX.Point.4');
pItem.Set(Lgtd,Lttd);
fNewSymbol:=fFtrFactory.CreateSymbol(pitem,MainMap.DefaultStyle);
fMapSymbol:=Tmplyr.AddFeature(fNewSymbol);
Tmplyr.AutoLabel:=true;
fMapSymbol.KeyValue:=Code;
TagInf=New(TTargetInfo);
TagInfo.MapObj:=fMapSymbol;
TagInfo.PointRecord:=TList.Create;
PInf=New(TPointInfo);
PInfo.PX:=Lgtd;
PInfo.PY:=Lttd;
TagInfo.PointRecord.Add(PInfo);
TagInfo.Traceing:=True;
TraceingList.Add(TagInfo);
VarClear(fNewSymbol);
VarClear(fMapSymbol);
end;
TagInfo.Code:=Code;
TagInfo.Speed:=Spd;
TagInfo.Lgtd:=Lgtd;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -