别人贴的鹰眼源码搞不懂(10分)

  • 主题发起人 neverdeath
  • 开始时间
N

neverdeath

Unregistered / Unconfirmed
GUEST, unregistred user!
这是本论坛的帖子,我试了下不行,请教!
在With m_Fea.Parts.Item[1]do
出现 Not enough actual parameters,不知怎么回事,看了其他一些,差不多都是这样,但为什么不行么?
delphi+mapx5的鹰眼
加入两个mapx控件,然后粘贴如下代码就可以实现鹰眼

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, MapXLib_TLB;

type
TForm1 = class(TForm)
Map1: TMap;
Map2: TMap;
procedure Map1MapViewChanged(Sender: TObject);
procedure Map2MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
m_Layer:Layer;
//鹰眼图上临时图层
m_Fea:MapXLib_tlb.Feature;
//鹰眼图上反映主地图窗口位置的Feature
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Map1MapViewChanged(Sender: TObject);
var
tempFea:MapXLib_tlb.Feature;
//声明Feature变量
//tempPnts:MapXLib_tlb.Points;
//声明Points变量
tempStyle:MapXLib_tlb.Style;
//声明Style变量
begin

if map1.geoset='' then
exit;
//矩形边框还没有创建时
If m_Layer.AllFeatures.Count = 0 then

//设置矩形边框样式
begin

tempstyle:=Mapxlib_tlb.CoStyle.Create
tempStyle.RegionPattern := miPatternNoFill;
//设置Style的矩形内部填充样式
tempStyle.RegionBorderColor := 255;
//设置Style的矩形边框颜色
tempStyle.RegionBorderWidth := 1
//设置Style的矩形边框宽度
//在图层创建大小为Map1的边界的Rectangle对象
tempFea :=Map1.FeatureFactory.CreateRegion(Map1.Bounds, tempStyle)
m_Fea := m_Layer.AddFeature(tempFea,EmptyParam);//添加矩形边框
end
else
//否则,根据Map1的视野变化改变矩形边框的大小和位置
begin

With m_Fea.Parts.Item[1]do

begin

m_fea.Parts.Item[1].RemoveAll
m_fea.Parts.Item[1].AddXY(map1.Bounds.XMin ,map1.Bounds.YMin,EmptyParam );
m_fea.Parts.Item[1].AddXY(map1.Bounds.XMax ,map1.Bounds.YMin,EmptyParam );
m_fea.Parts.Item[1].AddXY(map1.Bounds.XMax ,map1.Bounds.YMax,EmptyParam );
m_fea.Parts.Item[1].AddXY(map1.Bounds.XMin, map1.Bounds.YMax,EmptyParam );
m_Fea.Update(EmptyParam,EmptyParam);
end;

m_Fea.Update(EmptyParam,EmptyParam);
//更新显示
end;

end;

procedure TForm1.Map2MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
var
ScreenX,ScreenY:Single;
MapX :do
uble;
//定义x坐标变量
MapY :do
uble;
//定义y坐标变量
begin

ScreenX :=x
ScreenY :=y
//把屏幕坐标转换为地图坐标
Map2.ConvertCoord(ScreenX,ScreenY,MapX,MapY,1 );
//设置主图的中心x坐标和y坐标
Map1.ZoomTo(map1.Zoom,MapX ,MapY);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

m_Layer := Map2.Layers.CreateLayer('Rectlayer',EmptyParam,EmptyParam,EmptyParam,EmptyParam);
//在Map2创建图层
end;

end.
 
N

neverdeath

Unregistered / Unconfirmed
GUEST, unregistred user!
看了一会别的,还没有人说两句,自己顶下吧![:(]
 
T

thebly

Unregistered / Unconfirmed
GUEST, unregistred user!
我也正在做这个 试过了 没问题的~~~不知道你的问题出在哪 说说看
 
N

neverdeath

Unregistered / Unconfirmed
GUEST, unregistred user!
这个我弄错了,可以,但是不好,我想要的是在主图上显示鹰眼图上的那一部份,放大后的效果,你觉得该怎么写呢?
 
H

hqkjack

Unregistered / Unconfirmed
GUEST, unregistred user!
我刚学些gis的东西,在安装mapx5时总是安装不上,安装mapx7后,不知道在delphi中的安装组件时为什么找不到mapx.ocx控件呀?请高手们指教,先谢谢了
 
N

neverdeath

Unregistered / Unconfirmed
GUEST, unregistred user!
接受答案了.
 

Similar threads

I
回复
0
查看
543
import
I
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
562
import
I
I
回复
0
查看
641
import
I
顶部