阅读:1193回复:1
一个关于通过属性定位图像的问题,急!!
<P>例子中有这样一段procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var lys:imolayers; layer:imomaplayer; recs:imorecordset; shp:imopolygon; rect:imorectangle; fields:imofields; exp:string; begin if(key=#13)then begin exp:='name='''+edit1.Text+''''; lys:=map1.Layers; layer:=imomaplayer(createoleobject('mapobjects2.maplayer')); layer:=imomaplayer(lys.Item('building')); recs:=layer.SearchExpression(exp); if(not recs.EOF)then begin fields:=recs.Fields; shp:=imopolygon(createoleobject('mapobjects2.polygon')); shp:=imopolygon(idispatch(fields.Item('shape').value)); rect:= IMoRectangle(CreateOleObject('MapObjects2.Rectangle')); rect:=shp.extent; rect.ScaleRectangle((strtoint(edit2.Text))); Map1.Extent := rect; Map1.Refresh; // flash the state Map1.FlashShape(shp, 3); end; Key := #0; end; end;</P> <P>大家都应该不陌生是在edit中输入所要查找的图形,然后map自动将这个图形放到屏幕中间并且变色闪烁</P> <P>现在我想问一下,如果shp是一个点的话</P> <P> rect:=shp.extent; rect.ScaleRectangle((strtoint(edit2.Text))); Map1.Extent := rect; 应该怎样改写?</P> <P>非常急,请帮忙!!!!</P> |
|
1楼#
发布于:2004-10-22 19:14
<P> vc中我是这么做的:</P><P> pPoint->AttachDispatch(pField.GetValue().pdispVal);
m_SelectedPoint.Add(pPoint); m_MainMap.CenterAt(pPoint->GetX(),pPoint->GetY()); m_MainMap.FlashShape(pPoint->m_lpDispatch,3);</P><P>希望对你有用!</P> |
|