Пример #1
0
        /// <summary>
        /// Recursively parses a d8list and determines in any of the features
        /// are in the extent.  Intended for use with an ATE.
        /// </summary>
        /// <param name="IRO">Bounding Extent</param>
        /// <param name="List">Designer List Object</param>
        /// <returns></returns>
        private static bool HasD8ChildInExtent(IRelationalOperator IRO, ID8List List)
        {
            bool allchildrenoutofextent = true;

            #region Check the current list item

            if (List is ID8GeoAssoc)
            {
                IFeature GuFeat = ((ID8GeoAssoc)List).AssociatedGeoRow as IFeature;
                if (GuFeat != null && GuFeat.Shape != null)
                {
                    if (!IRO.Disjoint(GuFeat.Shape))
                    {
                        allchildrenoutofextent = false;
                    }
                }
            }

            #endregion

            List.Reset();
            ID8ListItem Child = List.Next(false);
            while (Child != null && allchildrenoutofextent)
            {
                #region Process children until we find a child inside the extent

                if (Child is ID8GeoAssoc)
                {
                    IFeature GuFeat = ((ID8GeoAssoc)Child).AssociatedGeoRow as IFeature;
                    if (GuFeat != null && GuFeat.Shape != null)
                    {
                        if (!IRO.Disjoint(GuFeat.Shape))
                        {
                            allchildrenoutofextent = false;
                        }
                    }
                }

                if (Child is ID8List)
                {
                    allchildrenoutofextent = !HasD8ChildInExtent(IRO, (ID8List)Child);
                }

                Child = List.Next(false);

                #endregion
            }

            return(!allchildrenoutofextent);
        }
Пример #2
0
        public string GetConstructionNotes(ID8TopLevel topLevel, IEnvelope FilterExtent)
        {
            //Parse the Design Tree
            ID8List TopList = topLevel as ID8List;

            TopList.Reset();

            IMMPxApplication PxApp = null;

            try
            {
                PxApp = DesignerUtility.GetPxApplication();
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Could obtain a Px Application reference.", ex);
                return(_defaultDisplay);
            }

            try
            {
                TopList.Reset();
                ID8List WorkRequest = TopList.Next(false) as ID8List;
                if (WorkRequest == null)
                {
                    return("");
                }

                //WorkRequest.Reset();
                //ID8List Design = WorkRequest.Next(false) as ID8List;

                //Get the Design XML
                IMMPersistentXML WrXml = WorkRequest as IMMPersistentXML;

                string result = Utility.LabellingUtility.GetConstructionNotes(PxApp, WrXml, FilterExtent);
                if (string.IsNullOrEmpty(result))
                {
                    return(_NoFeatures);
                }
                else
                {
                    return(result);
                }
            }
            catch (ApplicationException apex)
            {
                //ignore exception, no features
                return(_NoFeatures);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Error Retrieving Construction Notes", ex);
                return(_defaultDisplay);
            }
        }
Пример #3
0
        /// <summary>
        ///     Updates the tab with the contents of the specified list.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="tabIndex">Index of the tab.</param>
        /// <param name="list">The list.</param>
        public static void UpdateTab(this IMMAttributeEditor source, mmAETabIndex tabIndex, ID8List list)
        {
            var tab = source.GetTabContents(tabIndex);

            tab.Clear();

            if (list.HasChildren)
            {
                ID8ListItem item;
                while ((item = list.Next(false)) != null)
                {
                    tab.Add(item);
                }
            }
        }
Пример #4
0
        /// <summary>
        ///     Replaces the source list with the contents of the specified list.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="list">The list that will replace the source.</param>
        public static void Update(this ID8List source, ID8List list)
        {
            source.Clear();

            ((ID8ListItem)source).AllowCoreEvents = false;

            try
            {
                list.Reset();

                ID8ListItem item;
                while ((item = list.Next(false)) != null)
                {
                    source.Add(item);
                }
            }
            finally
            {
                ((ID8ListItem)source).AllowCoreEvents = true;
            }
        }
Пример #5
0
        /// <summary>
        ///     Traverses the <paramref name="source" /> tree structure recursively selecting only those
        ///     <see cref="Miner.Interop.ID8ListItem" /> that satisify the <paramref name="selector" />
        ///     and flattens the resulting sequences into one sequence.
        /// </summary>
        /// <param name="source">The list to traverse.</param>
        /// <param name="selector">A function to test each element for a condition in each recursion.</param>
        /// <param name="depth">The depth of the recursion.</param>
        /// <param name="maximum">The maximum depth of the recursion.</param>
        /// <returns>
        ///     Returns an
        ///     <see cref="T:System.Collections.Generic.IEnumerable{Miner.Collections.IRecursion{Miner.Interop.ID8ListItem}}" />
        ///     whose elements
        ///     who are the result of invoking the recursive transform function on each element of the input sequence.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///     source
        ///     or
        ///     selector
        /// </exception>
        private static IEnumerable <IRecursion <ID8ListItem> > WhereImpl(ID8List source, Func <ID8ListItem, bool> selector, int depth, int maximum)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            depth++;

            source.Reset();
            ID8ListItem child;

            while ((child = source.Next()) != null)
            {
                if (selector(child))
                {
                    yield return(new Recursion <ID8ListItem>(depth, child));
                }

                if ((depth <= maximum) || (maximum == Recursion <ID8ListItem> .Infinity))
                {
                    ID8List list = child as ID8List;
                    if (list != null)
                    {
                        foreach (var item in WhereImpl(list, selector, depth, maximum))
                        {
                            yield return(item);
                        }
                    }
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Recursively parses a d8list and determines in any of the features
        /// are in the extent.  Intended for use with an ATE.
        /// </summary>
        /// <param name="IRO">Bounding Extent</param>
        /// <param name="List">Designer List Object</param>
        /// <returns></returns>
        private static bool HasD8ChildInExtent(IRelationalOperator IRO, ID8List List)
        {
            bool allchildrenoutofextent = true;

            #region Check the current list item

            if (List is ID8GeoAssoc)
            {
                IFeature GuFeat = ((ID8GeoAssoc)List).AssociatedGeoRow as IFeature;
                if (GuFeat != null && GuFeat.Shape != null)
                {
                    if (!IRO.Disjoint(GuFeat.Shape))
                        allchildrenoutofextent = false;
                }
            }

            #endregion

            List.Reset();
            ID8ListItem Child = List.Next(false);
            while (Child != null && allchildrenoutofextent)
            {

                #region Process children until we find a child inside the extent

                if (Child is ID8GeoAssoc)
                {
                    IFeature GuFeat = ((ID8GeoAssoc)Child).AssociatedGeoRow as IFeature;
                    if (GuFeat != null && GuFeat.Shape != null)
                    {
                        if (!IRO.Disjoint(GuFeat.Shape))
                            allchildrenoutofextent = false;
                    }
                }

                if (Child is ID8List)
                    allchildrenoutofextent = !HasD8ChildInExtent(IRO, (ID8List)Child);

                Child = List.Next(false);

                #endregion

            }

            return !allchildrenoutofextent;
        }