靴
靴子
Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个线图层,在线图层中定一点,然后查找距这一点一定范围内的线的和一个圆的交点,但是就是通不过IntersectFeatures。我的代码如下:
procedure TForm1.Button3Click(Sender: TObject);
var
vl_ftrs : cmapxfeatures;//图层中所有的图元
vl_pnt : cmapxPoint;
ftrac : cmapxfeaturefactory;
ftr : cmapxfeature;
vl_ftrInterSect : cmapxfeature;//得到和半径相交的图元
vl_lyr1 : cmapxlayer;
begin
vl_lyr1 := map1.Layers.Item[1];//线图元所在的图层
vl_pnt := coPoint.Create;
vl_pnt.Set_(strtofloat(edit1.Text),strtofloat(edit2.Text));
ftrac := map1.FeatureFactory;
ftr :=ftrac.CreateCircularRegion(1,vl_pnt,strtofloat(edit3.text),7,24,map1.DefaultStyle);
vl_ftrs := vl_lyr1.SearchWithinDistance(vl_pnt,strtofloat(edit3.text),7,1);
showmessage(inttostr(vl_ftrs.Count));
vl_ftrInterSect := ftrac.IntersectFeatures(ftr,vl_ftrs)
showmessage(inttostr(vl_ftrInterSect.Parts.Count));
end;
procedure TForm1.Button3Click(Sender: TObject);
var
vl_ftrs : cmapxfeatures;//图层中所有的图元
vl_pnt : cmapxPoint;
ftrac : cmapxfeaturefactory;
ftr : cmapxfeature;
vl_ftrInterSect : cmapxfeature;//得到和半径相交的图元
vl_lyr1 : cmapxlayer;
begin
vl_lyr1 := map1.Layers.Item[1];//线图元所在的图层
vl_pnt := coPoint.Create;
vl_pnt.Set_(strtofloat(edit1.Text),strtofloat(edit2.Text));
ftrac := map1.FeatureFactory;
ftr :=ftrac.CreateCircularRegion(1,vl_pnt,strtofloat(edit3.text),7,24,map1.DefaultStyle);
vl_ftrs := vl_lyr1.SearchWithinDistance(vl_pnt,strtofloat(edit3.text),7,1);
showmessage(inttostr(vl_ftrs.Count));
vl_ftrInterSect := ftrac.IntersectFeatures(ftr,vl_ftrs)
showmessage(inttostr(vl_ftrInterSect.Parts.Count));
end;