wnfanny
路人甲
路人甲
  • 注册日期2005-03-25
  • 发帖数9
  • QQ
  • 铜币174枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1574回复:3

如何将一个variant类型转化成geometry

楼主#
更多 发布于:2007-05-29 15:46
<P>当我读取一个要素类中的某一个要素,读取到它的shape字段的值,是一个variant类型的值,要如何做才能把这个variant值转换成一个geometry对象</P>
喜欢0 评分0
whmwxhanshan123
路人甲
路人甲
  • 注册日期2006-06-17
  • 发帖数3108
  • QQ
  • 铜币6445枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-05-31 22:39
<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
wy8705244
路人甲
路人甲
  • 注册日期2006-10-21
  • 发帖数23
  • QQ
  • 铜币164枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-05-29 22:40
<P>  Dim pFeatureLayer As IFeatureLayer<BR>  Dim pFeatureClass As IFeatureClass<BR>  Dim pMap As IMap<BR>  Set pMap = MapControl1.Map<BR>  <BR>  Dim pLayer As ILayer<BR>  Set pLayer = pMap.Layer(0)<BR>  <BR>  Set pFeatureLayer = pLayer<BR>  Set pFeatureClass = pFeatureLayer.FeatureClass<BR>  <BR>  If pFeatureClass.ShapeType = esriGeometryPoint Then<BR>     MsgBox "This is a Point feaure class"<BR>  Else<BR>     MsgBox "This is not a Point feature class"<BR>  End If</P>
<P>这段是在VB+AE中实现的,首先要加载图层</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
3楼#
发布于:2007-05-29 20:29
<P>感觉你好像需要获取这个要素中的要素geometry类型,如果是,下面的方法可以获取</P><PRE><P>The following example shows how you can use the <B>ShapeType</B> property to determine whether or not the feature class is a polygon feature class, and if it is, then do something, otherwise skip it. <BR><BR></P><PRE> Dim pFeatcls As IFeatureClass
<BR> Dim pFeatLayer As IFeatureLayer
<BR> Dim pDoc As IMxDocument
<BR> Dim pMap As IMap
<BR>
<BR> Set pDoc = ThisDocument
<BR> Set pMap = pDoc.Maps.Item(0)
<BR> Set pFeatLayer = pMap.Layer(0)
<BR> Set pFeatcls = pFeatLayer.FeatureClass
<BR>
<BR> If pFeatcls.ShapeType = esriGeometryPolygon Then
<BR>   ' code to do something. Here we will send a message
<BR>   ' to a message box
<BR>   MsgBox "This is a polygon feaure class"
<BR> Else
<BR>   ' code to execute if this is not a polygon
<BR>   ' feature class
<BR>   MsgBox "This is not a polygon feature class"
<BR> End If</PRE></PRE>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部