【old】mapX距离工具源码,delphi7+mapx5.0

delphi7+mapx5开发的测量距离工具,界面和mapinfo一样,使用十分简单。

Author: 杜长宇 junqilian@163.com
Purpose: 量距离工具
History: 2005-05-21

开发环境: delphi7+mapX 5.02.38
windows XP Sp2

许可:
您可以自由的使用本代码进行学习或非商业、商业应用,
你可以自由更改本代码以便更适合你的应用,但请保留原作者版权信息;
如果你对本代码作过修改优化,请添加详细注释后重新发布到网上,并发给原作者一份拷贝,以利于大家共同进步;

用法:
1、主程序中uses TDistanceToolClass;
2、在主程序窗体中放置ToolButtonDistance
3、添加事件处理函数,形如:
procedure TForm1.ToolButtonDistanceClick(Sender: TObject);
var
m_MapDistanceTool : TDistanceTool;
begin
m_MapDistanceTool := TDistanceTool.Create;
m_MapDistanceTool.CreateDistanceTool(map1);
Map1.CurrentTool := m_MapDistanceTool.GetToolNum;
end;

突然想起来上传的代码里可能有个函数没包含进去,其实也很简单了,我把代码贴出来。

{-----------------------------------------------------------------------------
Procedure: TdchyMapModule.GetChineseMapUnit
Author: duchangyu
Date: 02-六月-2005
Arguments: var currentMap: TMap; mapUnit: TOleEnum
Result: string

得到中文的地图单位字符串
-----------------------------------------------------------------------------}

function TdchyMapModule.GetChineseMapUnit(var currentMap: TMap;
mapUnit: TOleEnum): string;
begin
case mapUnit of
miUnitMile : result := '英里';
miUnitKilometer : result := '千米';
miUnitInch : result := '英寸';
miUnitFoot : result := '英尺';
miUnitYard : result := '码';
miUnitMillimeter : result := '毫米';
miUnitCentimeter : result := '厘米';
miUnitMeter : result := '米';
miUnitSurveyFoot : result := 'SurveyFoot';
miUnitNauticalMile : result := '海里';
miUnitTwip : result := '缇';
miUnitPoint : result := '点';
miUnitPica : result := 'Pica';
miUnitDegree : result := '度';
miUnitLink : result := 'Link';
miUnitChain : result := 'Chain';
miUnitRod : result := 'Rod';
end;
end;


以下内容只有回复后才可以浏览

{-----------------------------------------------------------------------------
Procedure: TdchyMapModule.AutoPan
Author: duchangyu
Date: 02-六月-2005
Arguments: var m_pMap: TMap; mapX, mapY, deltaXScale, deltaYScale: double
Result: None

鼠标到底地图边界时自动移图
-----------------------------------------------------------------------------}

procedure TdchyMapModule.AutoPan(var m_pMap: TMap; mapX, mapY,
deltaXScale, deltaYScale: double);
var
maxX, maxY, minX, minY: double;
deltaX, deltaY: double;
begin
// 当mapX,mapY点到达屏幕距边界还有1/deltaXScale水平和1/deltaYScale垂直时,自动移动屏幕1/deltaXScale(水平)和1/deltaYScale(垂直)
maxX := m_pMap.Bounds.XMax;
minX := m_pMap.Bounds.XMin;
maxY := m_pMap.Bounds.YMax;
minY := m_pMap.Bounds.YMin;
deltaX := (maxX - minX) / deltaXScale;
deltaY := (maxY - minY) / deltaYScale;
if (mapX < minX + deltaX) then
m_pMap.CenterX := m_pMap.CenterX - (minX - mapX) - deltaX
else if (mapX > maxX - deltaX) then
m_pMap.CenterX := m_pMap.CenterX + (mapX - maxX) + deltaX;
if (mapY < minY + deltaY) then
m_pMap.CenterY := m_pMap.CenterY - (minY - mapY) - deltaY
else if (mapY > maxY - deltaY) then
m_pMap.CenterY := m_pMap.CenterY + (mapY - maxY) + deltaY;

end;

 

 

2005527114030697.rar


Related Posts Plugin for WordPress, Blogger...