资源简介
arcengine内在图层创建(全)arcengine内在图层创建(全)arcengine内在图层创建(全)arcengine内在图层创建(全)
代码片段和文件信息
//建立内存图层------------------
/*
* 创建一个工具,名为CreatMemlayer
* 这个工具的作用为,创建一个名为layername参数传进来的内存图层
* 这个内存图层的格式定义在本类的CreateVehicleFeature函数,可以自定义修改
* 作者:陈芋宇
* 20100716
*/
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.baseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesGDB;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
namespace InMemolayer
{
public class CreateMemolayer
{
//自定义一系列的变量呗
private IHookHelper m_hookHelper;
private IFeature pthisfeature;
IFeatureClass pvehicleclass;
IFeaturelayer pvehiclelayer;
IActiveView m_activeView;
///
/// 默认构造函数
///
public CreateMemolayer(object hook)
{
if (hook == null)
return;
if (m_hookHelper == null)
m_hookHelper = new HookHelperClass();
m_hookHelper.Hook = hook;
m_activeView = m_hookHelper.ActiveView;
}
///
/// 创建空的内存工作空间,并且返回工作空间 -- pfeatureworkspace
///
private IFeatureWorkspace CreateEmptylayerInmemeory(string slayername ESRI.ArcGIS.Geometry.ISpatialReference pspatialreference int itype)
{
//打开工作空间
const string strShapeFieldName = “SHAPE“;
IWorkspaceFactory pWSF = new InMemoryWorkspaceFactoryClass();
ESRI.ArcGIS.Geodatabase.IWorkspaceName pworkspacename = pWSF.Create(““ “MyWorkspace“ null 0);
ESRI.ArcGIS.esriSystem.IName pname = (IName)pworkspacename;
IFeatureWorkspace pfeatureworkspace = (IFeatureWorkspace)(pname.Open()); //打开刚建立的内存空间
try
{
//为esriFieldTypeGeometry类型的字段创建几何定义,包括类型和空间参照
IGeometryDef pGeoDef = new GeometryDefClass(); //The geometry definition for the field if IsGeometry is TRUE.
IGeometryDefEdit pGeoDefEdit = (IGeometryDefEdit)pGeoDef;
if (itype == 0)
{
pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
}
else
{
if (itype == 1)
{
pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;
}
else
{
pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolygon;
}
}
if (pspatialreference != null)
{
pspatialreference.SetDomain(-180 180 -90 90);
pGeoDefEdit.SpatialReference_2 = pspatialreference;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 11836 2010-07-16 10:03 CreateMemola
----------- --------- ---------- ----- ----
11836 1
- 上一篇:HCNP路由交换的总结
- 下一篇:S7-300/400流量累计功能块
评论
共有 条评论