예제 #1
0
        /// <summary>
        /// 将带有x、y字段的ITable对象转化为IFeatureClass
        /// </summary>
        /// <param name="pTable">带有x、y字段的ITable数据源</param>
        /// <param name="xName">X字段名称</param>
        /// <param name="yName">y字段名称</param>
        /// <param name="zName">z字段名称(可为空)</param>
        /// <param name="spatialReference">空间坐标参考</param>
        /// <returns></returns>
        private IFeatureClass OpenXYData(ITable pTable, string xName, string yName, string zName, ISpatialReference spatialReference)
        {
            // 将带有x、y字段的ITable对象转化为IFeatureClass,确定X、Y、Z字段以及空间参考坐标
            // xy字段属性描述
            IXYEvent2FieldsProperties pXYEventFieldsPro = new XYEvent2FieldsPropertiesClass();

            pXYEventFieldsPro.XFieldName = xName;
            pXYEventFieldsPro.YFieldName = yName;
            pXYEventFieldsPro.ZFieldName = zName;

            //XY事件 数据表名称描述
            IXYEventSourceName pXYEventSourceName = new XYEventSourceNameClass();

            pXYEventSourceName.EventProperties = pXYEventFieldsPro;

            IDataset ds    = pTable as IDataset;
            IName    tname = ds.FullName;

            pXYEventSourceName.SpatialReference = spatialReference;
            pXYEventSourceName.EventTableName   = tname;

            IName          xyname = pXYEventSourceName as IName;
            IXYEventSource xysrc  = (IXYEventSource)xyname.Open();

            return(xysrc as IFeatureClass);
        }
예제 #2
0
        /// <summary>
        /// Creates the XY event source from a table which can be used to dynamically create a point feature class.
        /// </summary>
        /// <param name="xyTable">The table containing fields for X and Y coordinates.</param>
        /// <param name="xFieldName">Name of the x coordinate field.</param>
        /// <param name="yFieldName">Name of the y coordinate field.</param>
        /// <param name="spatialReference">The spatial reference of the points contained in the table.</param>
        /// <returns></returns>
        /// <remarks>An <see cref="IXYEventSource"/> is a dynmanic point feature class which generates features
        /// based on X and Y coordinates in a table.<para/>
        /// Since XYEventSource inherits from FeatureClass, it implements the same interfaces and can be treated like any other point feature class.</remarks>
        public static IXYEventSource CreateXYEventSourceFromTable(ITable xyTable, string xFieldName, string yFieldName, ISpatialReference spatialReference)
        {
            // Validate arguments
            if (xyTable == null)
            {
                throw new ArgumentNullException("xyTable", "XY table has not been set.");
            }
            if (string.IsNullOrEmpty(xFieldName))
            {
                throw new ArgumentNullException("xFieldName", "X field name has not been set.");
            }
            if (string.IsNullOrEmpty(yFieldName))
            {
                throw new ArgumentNullException("yFieldName", "Y field name has not been set.");
            }
            if (spatialReference == null)
            {
                throw new ArgumentNullException("spatialReference", "Spatial reference has not been set.");
            }

            // QI to get the dataset
            IDataset dataset = xyTable as IDataset;

            // Verify fields exist and are of a numeric type
            Int32 index = xyTable.FindField(xFieldName);

            if (index == -1)
            {
                throw new ArgumentException(string.Format("{0} field does not exist in table {1}.", xFieldName, dataset.Name));
            }
            index = xyTable.FindField(yFieldName);
            if (index == -1)
            {
                throw new ArgumentException(string.Format("{0} field does not exist in table {1}.", yFieldName, dataset.Name));
            }

            // Set the field properties for the XY event theme
            IXYEvent2FieldsProperties xyEvent2FieldsProperties = new XYEvent2FieldsPropertiesClass();

            xyEvent2FieldsProperties.XFieldName = xFieldName;
            xyEvent2FieldsProperties.YFieldName = yFieldName;
            xyEvent2FieldsProperties.ZFieldName = string.Empty;

            // Create XY event theme
            IXYEventSourceName xyEventSourceName = new XYEventSourceNameClass();

            xyEventSourceName.EventProperties  = xyEvent2FieldsProperties;
            xyEventSourceName.SpatialReference = spatialReference;
            xyEventSourceName.EventTableName   = dataset.FullName;

            // Create XY event source.
            IName          name          = (xyEventSourceName as IName);
            IXYEventSource xyEventSource = (name.Open() as IXYEventSource);

            // Return value
            return(xyEventSource);
        }
예제 #3
0
        private static IFeatureClass CreateXYEventFeature(ITable xyTable, string xField, string yField, ISpatialReference spatialReference)
        {
            IXYEvent2FieldsProperties xyEventProperties = new XYEvent2FieldsPropertiesClass
            {
                XFieldName = xField,
                YFieldName = yField
            };
            
            IXYEventSourceName xyEventSourceName = new XYEventSourceNameClass
            {
                EventProperties = xyEventProperties,
                EventTableName = ((IDataset) xyTable).FullName,
                SpatialReference = spatialReference
            };

            IName name = xyEventSourceName as IName;
            IXYEventSource xyEventSource = name.Open() as IXYEventSource;
            return xyEventSource as IFeatureClass;
        }
예제 #4
0
        public void CreateXYLayer()
        {
            try
            {
            //IMxDocument pMxDoc;
            //IMap pMap = axMapControl.Map;
            ////IApplication m_app;
            //IApplication m_app = default(IApplication);
            ////IApplication m_app = Application;
            // //IMxApplication m_appsd;

            ////pMxDoc = (IMxDocument)m_app.Document;
            ////pMap = pMxDoc.FocusMap;
            //int i =pMap.MapSurroundCount;

            IApplication m_app = axMapControl.ActiveView.ScreenDisplay as IApplication;
            //IApplication m_app = ESRI.ArcGIS.ArcMap.Application;

            //IApplication m_app = axMapControl.app

            IMxDocument pMxDoc;
            IMap pMap;
            pMxDoc = (IMxDocument)m_app.Document;
            pMap = pMxDoc.FocusMap;

            // Get the table named XYSample.txt
            IStandaloneTableCollection pStTabCol;
            IStandaloneTable pStandaloneTable;
            ITable pTable = null;
            pStTabCol = (IStandaloneTableCollection) pMap;
            for (int intCount = 0; intCount < pStTabCol.StandaloneTableCount; intCount++)
            {
            pStandaloneTable = (IStandaloneTable) pStTabCol.get_StandaloneTable(intCount);
            if (pStandaloneTable.Name == @"c:\XYSample.txt")
            {
            pTable = pStandaloneTable.Table;
            break;
            }
            }
            if (pTable == null)
            {
            MessageBox.Show("The table was not found");
            return;
            }

            // Get the table name object
            IDataset pDataSet;
            IName pTableName;
            pDataSet = (IDataset) pTable;
            pTableName = pDataSet.FullName;

            // Specify the X and Y fields
            IXYEvent2FieldsProperties pXYEvent2FieldsProperties;
            pXYEvent2FieldsProperties = new XYEvent2FieldsPropertiesClass();
            pXYEvent2FieldsProperties.XFieldName = "x";
            pXYEvent2FieldsProperties.YFieldName = "y";
            pXYEvent2FieldsProperties.ZFieldName = "";

            // Specify the projection
            ISpatialReferenceFactory pSpatialReferenceFactory;
            pSpatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            IProjectedCoordinateSystem pProjectedCoordinateSystem;
            pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(26911);
            // esriSRProjCS_NAD1983UTM_11N

            // Create the XY name object and set it's properties
            IXYEventSourceName pXYEventSourceName = new XYEventSourceNameClass();
            IName pXYName;
            IXYEventSource pXYEventSource;
            pXYEventSourceName.EventProperties = pXYEvent2FieldsProperties;
            pXYEventSourceName.SpatialReference = pProjectedCoordinateSystem;
            pXYEventSourceName.EventTableName = pTableName;
            pXYName = (IName) pXYEventSourceName;
            pXYEventSource = (IXYEventSource) pXYName.Open();

            // Create a new Map Layer
            IFeatureLayer pFLayer = new FeatureLayerClass();
            pFLayer.FeatureClass = (IFeatureClass) pXYEventSource;
            pFLayer.Name = "Sample XY Event layer";

            // Add the layer extension (this is done so that when you edit
            // the layer's Source properties and click the Set Data Source
            // button, the Add XY Events Dialog appears)
            ILayerExtensions pLayerExt;
            IFeatureLayerSourcePageExtension pRESPageExt = new XYDataSourcePageExtensionClass();
            pLayerExt = (ILayerExtensions) pFLayer;
            pLayerExt.AddExtension(pRESPageExt);

            pMap.AddLayer(pFLayer);
            }

            catch (System.Exception SysEx)
            {
            MessageBox.Show(SysEx.Message,".NET Error: ",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            }
        }
예제 #5
0
        /// <summary>
        /// this function takes a table and creates a shapefile (XY events) layer
        /// that is then added to the map
        /// </summary>
        /// <param name="pMxDoc">the map doc</param>
        /// <param name="sWorkspacePath">where to put the shapefile that is generated from the xy events / and where the dbf lives</param>
        /// <param name="sTableName">the name of the dbf to open</param>
        /// <param name="pSpatRef">the spatial ref for the prj file for the shapefile</param>\ 
        /// <changelog>
        ///
        ///         comments created.
        ///
        /// </changelog>
        public void addXYEvents(IMxDocument pMxDoc, string sWorkspacePath, string sTableName, ISpatialReference pSpatRef, string xField, string yField, string zField)
        {
            IWorkspaceFactory pWSF = new ShapefileWorkspaceFactoryClass();
            IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWSF.OpenFromFile(sWorkspacePath, 0);
            ITable            pTable            = (ITable)pFeatureWorkspace.OpenTable(sTableName);

            if (pTable == null)
            {
                MessageBox.Show("The table was not found");
                return;
            }

            // Create a new standalone table and add it
            // to the collection of the focus map
            IStandaloneTable pStTab = new StandaloneTableClass();

            pStTab.Table = (ITable)pTable;

            //sortTable(ref pTable);

            // Get the table name object
            IDataset pDataSet   = (IDataset)pStTab;
            IName    pTableName = pDataSet.FullName;

            // Specify the X and Y fields
            IXYEvent2FieldsProperties pXYEvent2FieldsProperties = new XYEvent2FieldsPropertiesClass();

            pXYEvent2FieldsProperties.XFieldName = xField;
            pXYEvent2FieldsProperties.YFieldName = yField;
            pXYEvent2FieldsProperties.ZFieldName = zField;

            // Create the XY name object and set it's properties
            IXYEventSourceName pXYEventSourceName = new XYEventSourceNameClass();

            pXYEventSourceName.EventProperties = pXYEvent2FieldsProperties;
            if (pSpatRef != null)
            {
                pXYEventSourceName.SpatialReference = pSpatRef;
            }
            pXYEventSourceName.EventTableName = pTableName;
            IName          pXYName        = (IName)pXYEventSourceName;
            IXYEventSource pXYEventSource = (IXYEventSource)pXYName.Open();

            // Create a new Map Layer
            IFeatureLayer pFLayer = new FeatureLayerClass();

            pFLayer.FeatureClass = (IFeatureClass)pXYEventSource;
            pFLayer.Name         = sTableName;

            //Add the layer extension (this is done so that when you edit
            //the layer's Source properties and click the Set Data Source
            //button, the Add XY Events Dialog appears)
            XYDataSourcePageExtension pRESPageExt = new XYDataSourcePageExtension();
            ILayerExtensions          pLayerExt   = (ILayerExtensions)pFLayer;

            pLayerExt.AddExtension(pRESPageExt);

            //Get the FcName from the featureclass
            IFeatureClass pFc = pFLayer.FeatureClass;

            pDataSet = (IDataset)pFc;
            IFeatureClassName pINFeatureClassName = (IFeatureClassName)pDataSet.FullName;
            IDatasetName      pInDsName           = (IDatasetName)pINFeatureClassName;

            //Get the selection set
            IFeatureSelection pFSel   = (IFeatureSelection)pFLayer;
            ISelectionSet     pSelSet = (ISelectionSet)pFSel.SelectionSet;

            //Define the output feature class name
            IFeatureClassName pFeatureClassName = new FeatureClassNameClass();
            IDatasetName      pOutDatasetName   = (IDatasetName)pFeatureClassName;
            //string sDSName = ensureDataName(pDataSet.Name, sWorkspacePath);

            string sDSName = pDataSet.Name; // +DateTime.UtcNow.DayOfYear + DateTime.UtcNow.Hour + DateTime.UtcNow.Minute + DateTime.UtcNow.Second;

            pOutDatasetName.Name = sDSName;

            IWorkspaceName pWorkspaceName = new WorkspaceNameClass();

            pWorkspaceName.PathName = sWorkspacePath;
            pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapeFileWorkspaceFactory";

            pOutDatasetName.WorkspaceName    = pWorkspaceName;
            pFeatureClassName.FeatureType    = esriFeatureType.esriFTSimple;
            pFeatureClassName.ShapeType      = esriGeometryType.esriGeometryPoint;
            pFeatureClassName.ShapeFieldName = "Shape";

            //Export
            IExportOperation pExportOp = new ExportOperationClass();

            pExportOp.ExportFeatureClass(pInDsName, null, null, null, pOutDatasetName as IFeatureClassName, 0);

            IFeatureClass pClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass(sDSName);
            IFeatureLayer pLayer = new FeatureLayerClass();

            pLayer.FeatureClass = pClass;
            pLayer.Name         = sDSName;//pClass.AliasName;

            pMxDoc.AddLayer(pLayer);
            pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pLayer, null);
        }
예제 #6
0
파일: frmSample.cs 프로젝트: sishui198/SAAR
        private void btnSelect_Click(object sender, EventArgs e)
        {
            REngine    pEngine  = mForm.pEngine;
            clsSnippet pSnippet = new clsSnippet();

            string strBLLayerName = cboTargetLayer.Text;
            string strXFieldName  = cboXField.Text;
            string strYFieldName  = cboYField.Text;
            string strSALayerName = cboStudyArea.Text;

            int intLIndex  = pSnippet.GetIndexNumberFromLayerName(pActiveView, strSALayerName);
            int intBLIndex = pSnippet.GetIndexNumberFromLayerName(pActiveView, strBLLayerName);

            ILayer        pSALayer  = mForm.axMapControl1.get_Layer(intLIndex);
            IFeatureLayer pSAFLayer = (IFeatureLayer)pSALayer;
            IFeatureClass pSAFClass = pSAFLayer.FeatureClass;

            ILayer           pBLLayer     = mForm.axMapControl1.get_Layer(intBLIndex);
            IFeatureLayer    pBLFLayer    = (IFeatureLayer)pBLLayer;
            IGeoFeatureLayer pBLGeoFLayer = (IGeoFeatureLayer)pBLFLayer;
            IAttributeTable  pBLAttTable  = (IAttributeTable)pBLGeoFLayer;
            ITable           pBLTable     = (ITable)pBLAttTable;

            //Get File Name and Path
            IDataLayer   pSADLayer     = (IDataLayer)pSALayer;
            IDatasetName pSADSName     = (IDatasetName)pSADLayer.DataSourceName;
            string       strSAFCName   = pSADSName.Name;
            string       strSAFCPath   = pSADSName.WorkspaceName.PathName;
            string       strSAFullName = strSAFCPath + "\\" + strSAFCName + ".shp";
            IDataLayer   pBLDLayer     = (IDataLayer)pBLLayer;
            IDatasetName pBLDSName     = (IDatasetName)pBLDLayer.DataSourceName;
            string       strBLFCName   = pBLDSName.Name;
            string       strBLFCPath   = pBLDSName.WorkspaceName.PathName;
            string       strBLFullName = strBLFCPath + "\\" + strBLFCName + "1.dbf";;

            mForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
            pActiveView = mForm.axMapControl1.ActiveView;
            IMap pMap = pActiveView.FocusMap;

            int intXFieldIdx = pBLFLayer.FeatureClass.Fields.FindField(strXFieldName) - 1; //-1 to use for R idx
            int intYFieldIdx = pBLFLayer.FeatureClass.Fields.FindField(strYFieldName) - 1;



            //StringBuilder plotCommmand = new StringBuilder();
            //plotCommmand.Append("library(circular);library(maptools);library(spdep);library(foreign);");
            //plotCommmand.Append("city.shp <- readShapePoly(" + strSAFullName + ");");
            //plotCommmand.Append("polycoords <- as.matrix(city.shp@polygons[[1]]@Polygons[[1]]@coords);");
            //plotCommmand.Append("bll.df <- as.data.frame(read.dbf(" + strBLFullName + ");");
            //plotCommmand.Append("del.row <- which(point.in.polygon(bll.df[,6],bll.df[,7],polycoords[,1],polycoords[,2])==0);");
            //plotCommmand.Append("hist(bll.df[,6])");
            //pEngine.Evaluate(plotCommmand.ToString());

            pEngine.Evaluate(@"library(circular);library(maptools);library(spdep);library(foreign)");
            pEngine.Evaluate(@"city.shp <- readShapePoly(" + strSAFullName + ")");
            //DataFrame pGV =pEngine.Evaluate(@"bll.df <- as.data.frame(read.dbf(" + strBLFullName + ")").AsDataFrame();
            //DataFrame pBLLdf = pEngine.
            pEngine.Evaluate("bll.df <- as.data.frame(read.dbf(\"" + strBLFullName + "\")");
            pEngine.Evaluate("hist(bll.df[,6])");



            // Get the table named XYSample.txt
            IStandaloneTableCollection pStTabCol;
            IStandaloneTable           pStandaloneTable;
            ITable pTable = null;

            pStTabCol = (IStandaloneTableCollection)pMap;
            for (int intCount = 0; intCount < pStTabCol.StandaloneTableCount; intCount++)
            {
                pStandaloneTable = (IStandaloneTable)pStTabCol.get_StandaloneTable(intCount);
                if (pStandaloneTable.Name == "syracuse-bll.csv")
                {
                    pTable = pStandaloneTable.Table;
                    break;
                }
            }
            if (pTable == null)
            {
                MessageBox.Show("The table was not found");
                return;
            }

            // Get the table name object
            IDataset pDataSet;
            IName    pTableName;

            pDataSet   = (IDataset)pTable;
            pTableName = pDataSet.FullName;

            // Specify the X and Y fields
            IXYEvent2FieldsProperties pXYEvent2FieldsProperties = new XYEvent2FieldsPropertiesClass();

            pXYEvent2FieldsProperties.XFieldName = cboXField.Text;
            pXYEvent2FieldsProperties.YFieldName = cboYField.Text;
            pXYEvent2FieldsProperties.ZFieldName = "";

            // Create the XY name object and set it's properties
            IXYEventSourceName pXYEventSourceName = new XYEventSourceNameClass();

            pXYEventSourceName.EventProperties = pXYEvent2FieldsProperties;
            IGeoDataset pGeoDataset = (IGeoDataset)pBLDLayer;

            pXYEventSourceName.SpatialReference = pGeoDataset.SpatialReference;
            //pXYEventSourceName.EventTableName = pTableName;

            IName          pXYName        = (IName)pXYEventSourceName;
            IXYEventSource pXYEventSource = (IXYEventSource)pXYName.Open();

            // Create a new Map Layer
            IFeatureLayer pFLayer = new FeatureLayerClass();

            pFLayer.FeatureClass = (IFeatureClass)pXYEventSource;
            pFLayer.Name         = "Sample XY Event layer";

            // Add the layer extension (this is done so that when you edit
            //   the layer's Source properties and click the Set Data Source
            //   button, the Add XY Events Dialog appears)
            //ILayerExtensions pLayerExt;
            //IFeatureLayerSourcePageExtension pRESPageExt = new XYDataSourcePageExtensionClass();
            //pLayerExt = (ILayerExtensions) pFLayer;
            //pLayerExt.AddExtension(pRESPageExt);

            pMap.AddLayer(pFLayer);
        }
예제 #7
0
        //使用addXY进行经纬度描点
        public void  CreateXYLayer()
        {
            try
            {
                IMxDocument pMxDoc;
                IMap        pMap = axMapControl.Map;

                IApplication m_app;

                IDocument doc = new MxDocumentClass();
                m_app  = doc.Parent;
                pMxDoc = (IMxDocument)m_app.Document;
                pMap   = pMxDoc.FocusMap;

                IStandaloneTableCollection pStTabCol;
                IStandaloneTable           pStandaloneTable;
                ITable pTable = null;
                pStTabCol = (IStandaloneTableCollection)pMap;
                for (int intCount = 0; intCount < pStTabCol.StandaloneTableCount; intCount++)
                {
                    pStandaloneTable = (IStandaloneTable)pStTabCol.get_StandaloneTable(intCount);
                    if (pStandaloneTable.Name == @"e:\XYSample.txt")
                    {
                        pTable = pStandaloneTable.Table;
                        break;
                    }
                }
                if (pTable == null)
                {
                    MessageBox.Show("The table was not found");
                    return;
                }

                IDataset pDataSet;
                IName    pTableName;
                pDataSet   = (IDataset)pTable;
                pTableName = pDataSet.FullName;

                IXYEvent2FieldsProperties pXYEvent2FieldsProperties;
                pXYEvent2FieldsProperties            = new XYEvent2FieldsPropertiesClass();
                pXYEvent2FieldsProperties.XFieldName = "x";
                pXYEvent2FieldsProperties.YFieldName = "y";
                pXYEvent2FieldsProperties.ZFieldName = "";

                ISpatialReferenceFactory pSpatialReferenceFactory;
                pSpatialReferenceFactory = new SpatialReferenceEnvironmentClass();
                IProjectedCoordinateSystem pProjectedCoordinateSystem;
                pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(26911);
                // esriSRProjCS_NAD1983UTM_11N

                // Create the XY name object and set it's properties
                IXYEventSourceName pXYEventSourceName = new XYEventSourceNameClass();
                IName          pXYName;
                IXYEventSource pXYEventSource;
                pXYEventSourceName.EventProperties  = pXYEvent2FieldsProperties;
                pXYEventSourceName.SpatialReference = pProjectedCoordinateSystem;
                pXYEventSourceName.EventTableName   = pTableName;
                pXYName        = (IName)pXYEventSourceName;
                pXYEventSource = (IXYEventSource)pXYName.Open();

                // Create a new Map Layer
                IFeatureLayer pFLayer = new FeatureLayerClass();
                pFLayer.FeatureClass = (IFeatureClass)pXYEventSource;
                pFLayer.Name         = "Sample XY Event layer";

                // Add the layer extension (this is done so that when you edit
                // the layer's Source properties and click the Set Data Source
                // button, the Add XY Events Dialog appears)
                ILayerExtensions pLayerExt;
                IFeatureLayerSourcePageExtension pRESPageExt = new XYDataSourcePageExtensionClass();
                pLayerExt = (ILayerExtensions)pFLayer;
                pLayerExt.AddExtension(pRESPageExt);

                pMap.AddLayer(pFLayer);
            }

            catch (System.Exception SysEx)
            {
                MessageBox.Show(SysEx.Message, ".NET Error: ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #8
0
        /// <summary>
        /// 模拟Addxy
        /// </summary>
        /// <param name="pTable"></param>
        /// <param name="pSpatialReference"></param>
        /// <returns></returns>
        public IFeatureClass CreateXYEventSource(ITable pTable, ISpatialReference pSpatialReference)
        {
            IXYEvent2FieldsProperties pEvent2FieldsProperties = new XYEvent2FieldsPropertiesClass();
            pEvent2FieldsProperties.XFieldName = "X";
            pEvent2FieldsProperties.YFieldName = "Y";

            IDataset pSourceDataset = (IDataset)pTable;
            IName sourceName = pSourceDataset.FullName;

            IXYEventSourceName pEventSourceName = new XYEventSourceNameClass();
            pEventSourceName.EventProperties = pEvent2FieldsProperties; pEventSourceName.EventTableName = sourceName; pEventSourceName.SpatialReference = pSpatialReference;

            IName pName = (IName)pEventSourceName;
            IXYEventSource pEventSource = (IXYEventSource)pName.Open();

            IFeatureClass pFeatureClass = (IFeatureClass)pEventSource; return pFeatureClass;
        }