Renon
路人甲
路人甲
  • 注册日期2003-08-01
  • 发帖数169
  • QQ6625162
  • 铜币66枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1233回复:0

菜鸟问题

楼主#
更多 发布于:2003-12-17 20:55
能查到线,但线显示不出来,请高手帮忙

procedure TForm1.Button1Click(Sender: TObject);
var
  pNewLine : IPolyLine ;
  p1,p2 : Ipoint ;
  pFeature : IFeature ;
  pFeatureClass : IFeatureClass ;
  pWorkSpaceEdit : IWorkspaceEdit ;
  pGeoFeatureLayer : IGeoFeatureLayer ;
  pGeometry : IGeometry ;
begin
  p1 := CoPoint.create as IPoint ;
  p2 := CoPoint.create as IPoint ;
  p1.Set_X(-11866);
  p1.Set_Y(11181);
  p2.Set_X(8354);
  p2.Set_Y(-3970);
  pNewLine := CoPolyLine.create as IPolyline ;
  pNewLine.Set_FromPoint(p1 );
  pNewLine.Set_ToPoint(p2 );
  pWorkSpaceEdit := WorkSpaceEdit(MapControl1);
  pWorkSpaceEdit.StartEditing(true);
  pWorkSpaceEdit.StartEditOperation ;
  pGeoFeatureLayer := IGeoFeatureLayer(MapControl1.Layer [0]);
  pGeoFeatureLayer.Get_FeatureClass(pFeatureClass);
  pFeatureClass.CreateFeature(pFeature);
  pGeometry := pNewLine as IGeometry ;
  MapControl1.FlashShape(pGeometry ,5,500);
  pFeature.Set_Shape(pGeometry );
  pFeature.Store ;
  pWorkSpaceEdit.StopEditOperation ;
  pWorkSpaceEdit.StopEditing(true);
  MapControl1.Refresh;
end;


喜欢0 评分0
游客

返回顶部