Exemple #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="RouteEventSourceProxy" /> class.
        /// </summary>
        /// <param name="eventTable">The event table.</param>
        /// <param name="locatorName">Name of the locator.</param>
        /// <param name="eventProperties">The event properties.</param>
        public RouteEventSourceProxy(ITable eventTable, IRouteLocatorName locatorName, IRouteEventProperties eventProperties)
        {
            IRouteEventSourceName eventSourceName = new RouteEventSourceNameClass();

            eventSourceName.EventProperties  = eventProperties;
            eventSourceName.EventTableName   = ((IDataset)eventTable).FullName;
            eventSourceName.RouteLocatorName = locatorName;

            this.Name         = eventSourceName;
            this.FeatureClass = (IRouteEventSource)((IName)eventSourceName).Open();
        }
        /// <summary>
        /// 动态分段,作者:刘宇
        /// </summary>
        /// <param name="_pRouteFC"></param>
        /// <param name="_pPKName"></param>
        /// <param name="_pEventTable"></param>
        /// <param name="_pFKName"></param>
        /// <param name="_pFrom"></param>
        /// <param name="_pTo"></param>
        /// <returns></returns>
        IFeatureClass EventTable2FeatureClass(IFeatureClass _pRouteFC, string _pPKName, ITable _pEventTable, string _pFKName, string _pFrom, string _pTo)
        {
            IDataset pDataset = (IDataset)_pRouteFC;

            IName pName = pDataset.FullName;

            IRouteLocatorName pRouteLocatorName = new RouteMeasureLocatorNameClass();

            pRouteLocatorName.RouteFeatureClassName = pName;

            pRouteLocatorName.RouteIDFieldName = _pPKName;

            pRouteLocatorName.RouteMeasureUnit = esriUnits.esriFeet;
            pName = (IName)pRouteLocatorName;

            IRouteEventProperties2 pRouteProp = new RouteMeasureLinePropertiesClass();

            pRouteProp.AddErrorField = true;
            pRouteProp.EventMeasureUnit = esriUnits.esriFeet;
            pRouteProp.EventRouteIDFieldName = _pFKName;

            IRouteMeasureLineProperties rMLineProp = (IRouteMeasureLineProperties)pRouteProp;

            rMLineProp.FromMeasureFieldName = _pFrom;
            rMLineProp.ToMeasureFieldName = _pTo;

            IDataset pDs = (IDataset)_pEventTable;
            IName pNTableName = pDs.FullName;
            IRouteEventSourceName pRouteEventSourceName = new RouteEventSourceNameClass();
            pRouteEventSourceName.EventTableName = pNTableName;
            pRouteEventSourceName.EventProperties = (IRouteEventProperties)pRouteProp;
            pRouteEventSourceName.RouteLocatorName = pRouteLocatorName;

            pName = (IName)pRouteEventSourceName;

            IFeatureClass pFeatureClass = (IFeatureClass)pName.Open();

            return pFeatureClass;
        }