有没有人使用.Net 拓扑套件?我有点卡住了,我正在尝试获取信封,以便验证尺寸
根据http://resources.esri.com/help/9.3/arcgisengine/dotnet/c6e6b26c-be52-4176-b1e5-bb628d10acd0.htm (使用页面底部的C#示例)
我正在采用 IGeometry 类型(边界)并将该多边形的包络投射到 IEnvelope(包络),我希望用它来查看宽度和高度属性
但是信封总是空的
IGeometry boundary;
var wktReader = new WKTReader(OSGBGeometryFactory.Factory);
boundary = wktReader.Read(projectDTO.BoundaryWKT);
IEnvelope envelope = boundary.Envelope as IEnvelope;
谁能帮忙,这是我第一次使用这个套件。
我想要解决的是,如果按照这个示例我已经有一个 IGeometry 类型(我的边界变量),为什么当我尝试转换它时它为空。
using ESRI.ArcGIS.Geometry;
class temp
{
public void test()
{
// Create an empty polygon object.
IArea areaPolygon = new PolygonClass();
// Cast to the IGeometry interface of the polygon object.
IGeometry geometryPolygon = (IGeometry)areaPolygon;
// Use the .Envelope property on the IGeometry interface of the
// polygon object to get an envelope object.
IEnvelope envelope = geometryPolygon.Envelope;
// Test to make sure you have an envelope object.
if (envelope is Envelope)
{
// The polygon object and resulting envelope are empty.
if (envelope.IsEmpty)
{
System.Windows.Forms.MessageBox.Show("The envelope is empty.");
}
}
}
}
我是否需要创建一个新的多边形并尝试投射它(即复制IArea areaPolygon = new PolygonClass();
)?