DELPHI+MAPX怎样做轨迹回放?(100分)

  • 主题发起人 主题发起人 x-dsl
  • 开始时间 开始时间
X

x-dsl

Unregistered / Unconfirmed
GUEST, unregistred user!
就是有一组经纬度,要按这组经纬度用小图标显示出目标行驶的路径。谢谢各位帮忙,最好贴代码
 
//====(自定义函数)========by 郭秀双==========================================================
//功能:急救车轨迹回放显示
// 参数:Num:车号,sign:标志位(保留)
Function Tfm_angel.Draw_AmbuletTracker(Num:string;sign:integer):integer;
var
X1,Y1,X2,Y2:double;
//=============================
pnt : mapxlib_tlb.point;
pnts : mapxlib_tlb.points;
feafrc : mapxlib_tlb.featurefactory;
ftr : mapxlib_tlb.feature;
// ftrs : cmapxfeatures;
newstyle : mapxlib_tlb.style;
Num_Id:string;
begin

X1:=0;
Y1:=0;
X2:=0;
Y2:=0;
if length(num)=1 then

Num_Id:='00'+num
else
if length(num)=2 then

Num_Id:='0'+num
else

Num_Id:=num
dm.ADOQ_Share.Close;
dm.ADOQ_Share.SQL.Clear;
dm.ADOQ_Share.SQL.Add('select * from Ambulet_Locus where 编号='''+trim(Num_Id)+''' order by 定位时间 ASC');
dm.ADOQ_Share.Open;
if dm.ADOQ_Share.RecordCount<=0 then

begin

Application.MessageBox('历史记录中没有此车的定位信息!','轨迹回放',MB_ICONINFORMATION+MB_OK);
exit;
end
else

begin

If mapx.Layers.Item(1).name='temp' then

begin

mapx.Layers.Remove ('temp');
end;

mapx.Layers.CreateLayer('temp', EmptyParam,1, EmptyParam, EmptyParam);
Mapx.Layers.Item(1).Editable := True;
Mapx.Layers.InsertionLayer := Mapx.Layers.Item(1);

while not dm.ADOQ_Share.Eofdo

begin

//========前一个点=====================================
X1:=dm.ADOQ_Share.fieldbyname('X坐标').AsFloat;
Y1:=dm.ADOQ_Share.fieldbyname('Y坐标').AsFloat;
dm.ADOQ_Share.Next;
if not dm.ADOQ_Share.Eof then

begin

//========后一个点=====================================
X2:=dm.ADOQ_Share.fieldbyname('X坐标').AsFloat;
Y2:=dm.ADOQ_Share.fieldbyname('Y坐标').AsFloat;
end
else

begin

exit;
//跳出循环回放完毕
end;

//==数据库中只存在一条记录==================================
if (x2=0) and (y2=0) then

begin

mapx.ZoomTo(mapx.Zoom,X1,Y1);
fm_ambulet_status.Draw_sign(1);
end
else

begin

mapx.ZoomTo(mapx.Zoom,X2,Y2);
//showmessage(floattostr(x1)+floattostr(x2));
pnt:= copoint.Create;
newstyle := costyle.Create;
newstyle.LineStyle := miPenSolid;
newstyle.LineColor :=miColorred;// rgb(0,254,1);
newstyle.LineWidthUnit := miStyleUnitPixel;
newstyle.LineWidth := 5;
pnts := copoints.Create;
pnt.Set_(X1,Y1);
pnts.Add(pnt,1);
pnt.Set_(mapx.CenterX,mapx.CenterY);
pnts.Add(pnt,2);
//创建矩形
feafrc := mapx.FeatureFactory;
ftr := feafrc.CreateLine(pnts,newstyle);
mapx.Layers.Item(1).addfeature(ftr,emptyparam);
end;

//==========================================================
end;

end;

end;
 

Similar threads

A
回复
9
查看
451
agangr
A
A
回复
11
查看
371
agangr
A
A
回复
6
查看
622
beyondair
B
后退
顶部