liyanchao
路人甲
路人甲
  • 注册日期2005-07-25
  • 发帖数2
  • QQ
  • 铜币111枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1043回复:1

怎样添加图元的时候只刷新本图层

楼主#
更多 发布于:2005-08-03 13:29
<P>我用的是delphi+mapx,从数据库读取记录添加到一个图层上,想一个个的添加,中间有一定的间隔,现在是每添加一个就必须刷新整个地图才能显示,怎么只让他刷新一个本图层而不是整个地图</P>
<P>  if  FindLayer(mapx,LayerName) then<BR>    mapx.Layers.Remove(layerName);</P>
<P>  oBLayer := coBindLayer.Create;<BR>  oBLayer.LayerName := LayerName;<BR>  oBLayer.LayerType := miBindLayerTypeXY;//必须使用这个参数才能绑定XY坐标<BR>  oBLayer.RefColumn1 := XName;//第一个参数必须指定为横坐标<BR>  oBLayer.RefColumn2 := YName;//纵坐标<BR>  //添加数据集<BR>  ds := mapx.Datasets.Add(miDataSetADO ,<BR>                             rs,//使用这个方法获得ADO中的_Recordset类型<BR>                             DBName,//数据集名称<BR>                             TID,//传入的是Xunit表中的字段ID的名称<BR>                             EmptyParam,<BR>                             oBLayer,//BindLayer<BR>                             EmptyParam,EmptyParam);<BR>  //PBar.Properties.Max:=Ds.RowCount;<BR>  //画点和线<BR>  if  FindLayer(mapx,'P_LLay') then<BR>    mapx.Layers.Remove('P_LLay');<BR>    P_LLay:= Mapx.Layers.CreateLayer('P_LLay', EmptyParam,1,EmptyParam, EmptyParam);</P>
<P>    l_Style:=CoStyle.Create;<BR>    l_Style.SymbolType:=miSymbolTypeBitmap;<BR>    l_Style.SymbolBitmapTransparent:=true;<BR>    l_Style.SymbolBitmapSize:=BMPSIZE;</P>
<P>    l_pt:=CoPoint.Create;<BR>    l_ps:=coPoints.Create;</P>
<P>  for i:=1 to ds.RowCount do begin<BR>      //在点线层画原图<BR>  //  PBar.Position:=i;<BR>     if layername='l_source' then<BR>     bitMapName:='00.bmp'<BR>     else<BR>     bitMapName:='80.bmp';<BR>     if dbname='v_patroldata' then<BR>     bitmapname:=ds.Value[ds.Layer.AllFeatures.Item, ds.Fields.Item['state']] + '.bmp';<BR>     if dbname='v_PlanComplete' then<BR>     bitMapName:='00.bmp';<BR>     longitude:=ds.Value[ds.Layer.AllFeatures.Item, ds.Fields.Item['longitude']];<BR>     latitude:=ds.Value[ds.Layer.AllFeatures.Item, ds.Fields.Item['latitude']];<BR>     if dbname='v_patroldata' then<BR>     kaha=ds.Value[ds.Layer.AllFeatures.Item, ds.Fields.Item['gsmno']];<BR>     if layername='l_plandata' then<BR>     kaha=ds.Value[ds.Layer.AllFeatures.Item, ds.Fields.Item['eid']];<BR>     l_pt.Set_(longitude,latitude);<BR>     l_Style.SymbolBitmapName:=bitMapName;<BR>     l_Fea:=mapx.FeatureFactory.CreateSymbol(l_pt,l_Style);<BR>     l_fea.KeyValue :=kahao;</P>
<P>     P_LLay.AddFeature(l_Fea,EmptyParam);<BR>     p_llay.autolabel:=true;<BR>     l_ps.Add(l_pt,EmptyParam);<BR>     if DBName='v_patroldata' then<BR>     begin<BR>     sleep(100);<BR>     mapx.refresh;<BR>     end;<BR>    mapx.zoomto(50,longitude,latitude);<BR>  end;<BR></P>
喜欢0 评分0
echo2003
点子王
点子王
  • 注册日期2003-07-28
  • 发帖数2453
  • QQ76947571
  • 铜币5473枚
  • 威望1点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
1楼#
发布于:2005-08-03 18:01
layer.refresh,就可以了
举报 回复(0) 喜欢(0)     评分
游客

返回顶部