Пример #1
0
        /// <summary>
        ///     Changes the field visibility to the specified <paramref name="visible" /> value for the fields
        ///     that match the field name.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <param name="visible">if set to <c>true</c> if the field is visible.</param>
        /// <exception cref="System.NullReferenceException">
        ///     source
        ///     or
        ///     fieldName
        /// </exception>
        public static void ChangeVisibility(this IMMFeatureClass source, string fieldName, bool visible)
        {
            if (source == null)
            {
                throw new NullReferenceException("source");
            }
            if (fieldName == null)
            {
                throw new NullReferenceException("fieldName");
            }

            ID8List list = source as ID8List;

            if (list == null)
            {
                return;
            }

            IMMSubtype all = source.GetSubtype(ConfigTopLevelExtensions.ALL_SUBTYPES);

            if (all != null)
            {
                all.ChangeVisibility(fieldName, visible);
            }

            foreach (var subtype in list.AsEnumerable().OfType <IMMSubtype>())
            {
                subtype.ChangeVisibility(fieldName, visible);
            }
        }
Пример #2
0
        /// <summary>
        ///     Add the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
        /// </summary>
        /// <param name="uids">The dictionary of events and UIDs.</param>
        /// <param name="list">The list of events and UIDs.</param>
        /// <param name="messages">The messages.</param>
        protected void Add(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
        {
            // Enumerate through the dictionary of events and UIDs.
            foreach (var uid in uids)
            {
                // Locate all of the "AutoValue" types.
                foreach (var item in list.AsEnumerable())
                {
                    if (item.ItemType == mmd8ItemType.mmitAutoValue)
                    {
                        IMMAutoValue autoValue = (IMMAutoValue)item;
                        if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                        {
                            // When the UID is not contained within the list.
                            if (!uid.Value.Contains(autoValue.AutoGenID))
                            {
                                // Enumerate through all of the UIDs in the collection and add them to list.
                                foreach (var id in uid.Value)
                                {
                                    IMMAutoValue newAutoValue = new MMAutoValueClass();
                                    newAutoValue.EditEvent = uid.Key;
                                    newAutoValue.AutoGenID = new UIDClass()
                                    {
                                        Value = id
                                    };

                                    ((ID8List)item).AddEx(newAutoValue);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        ///     Executes the geoprocessing function using the given array of parameter values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="trackCancel">The track cancel.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="messages">The messages that are reported to the user.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void Execute(Dictionary <string, IGPValue> parameters, ITrackCancel trackCancel, IGPEnvironmentManager environmentManager, IGPMessages messages, IGPUtilities2 utilities)
        {
            IGPValue           value    = parameters["in_table"];
            IRelationshipClass relClass = utilities.OpenRelationshipClass(value);

            if (relClass != null)
            {
                IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                configTopLevel.Workspace = utilities.GetWorkspace(value);

                IGPMultiValue onCreate = (IGPMultiValue)parameters["in_create"];
                IGPMultiValue onDelete = (IGPMultiValue)parameters["in_delete"];

                var uids = new Dictionary <mmEditEvent, IEnumerable <IUID> >();
                uids.Add(mmEditEvent.mmEventRelationshipCreated, onCreate.AsEnumerable().Cast <IGPAutoValue>().Select(o => o.UID));
                uids.Add(mmEditEvent.mmEventRelationshipDeleted, onDelete.AsEnumerable().Cast <IGPAutoValue>().Select(o => o.UID));

                // Update the list to have these UIDs.
                ID8List list = (ID8List)configTopLevel.GetRelationshipClass(relClass);
                base.Add(uids, list, messages);

                // Commit the changes to the database.
                configTopLevel.SaveRelationshipClasstoDB(relClass);

                // Success.
                parameters["out_results"].SetAsText("true");
            }
            else
            {
                // Failure.
                parameters["out_results"].SetAsText("false");
            }
        }
Пример #4
0
        public void Setup()
        {
            _List       = new D8ListClass();
            _LayerNames = new[] { "Support Structure", "Surface Structure", "Underground Structure" };

            foreach (var layerName in _LayerNames)
            {
                ID8Layer layer = new D8LayerClass();
                layer.LayerName = layerName;

                string tableName = layerName.Replace(" ", "");
                for (int i = 0; i < _LayerNames.Length; i++)
                {
                    ID8Feature feature = new D8FeatureClass();
                    feature.Name = tableName;

                    ID8GeoAssoc geoAssoc = (ID8GeoAssoc)feature;
                    geoAssoc.OID       = i;
                    geoAssoc.TableName = tableName;

                    ((ID8List)layer).Add((ID8ListItem)feature);
                }

                _List.Add((ID8ListItem)layer);
            }
        }
Пример #5
0
        /// <summary>
        ///     Executes the geoprocessing function using the given array of parameter values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="trackCancel">The track cancel.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="messages">The messages that are reported to the user.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void Execute(Dictionary <string, IGPValue> parameters, ITrackCancel trackCancel, IGPEnvironmentManager environmentManager, IGPMessages messages, IGPUtilities2 utilities)
        {
            IGPValue     value = parameters["in_table"];
            IObjectClass table = utilities.OpenTable(value);

            if (table != null)
            {
                IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                configTopLevel.Workspace = utilities.GetWorkspace(value);

                // Load all of the subtypes when the user specified "All" or "-1".
                int subtype      = parameters["in_subtype"].Cast(-1);
                var subtypeCodes = new List <int>(new[] { subtype });
                if (subtype == -1)
                {
                    ISubtypes subtypes = (ISubtypes)table;
                    subtypeCodes.AddRange(subtypes.Subtypes.AsEnumerable().Select(o => o.Key));
                }

                IGPMultiValue onCreate = (IGPMultiValue)parameters["in_create"];
                IGPMultiValue onUpdate = (IGPMultiValue)parameters["in_update"];
                IGPMultiValue onDelete = (IGPMultiValue)parameters["in_delete"];

                // Load the "Attribute" AUs.
                var uids = new Dictionary <mmEditEvent, IEnumerable <IUID> >();
                uids.Add(mmEditEvent.mmEventFeatureCreate, onCreate.AsEnumerable().Cast <IGPAutoValue>().Select(o => o.UID));
                uids.Add(mmEditEvent.mmEventFeatureUpdate, onUpdate.AsEnumerable().Cast <IGPAutoValue>().Select(o => o.UID));
                uids.Add(mmEditEvent.mmEventFeatureDelete, onDelete.AsEnumerable().Cast <IGPAutoValue>().Select(o => o.UID));

                IGPValue field = parameters["in_field"];
                int      index = table.FindField(field.GetAsText());

                // Enumerate through all of the subtypes making changes.
                foreach (var subtypeCode in subtypeCodes)
                {
                    // Load the configurations for the table and subtype.
                    IMMSubtype mmsubtype = configTopLevel.GetSubtypeByID(table, subtypeCode, false);

                    // Load the field configurations.
                    IMMField mmfield = null;
                    mmsubtype.GetField(index, ref mmfield);

                    // Update the list to have these UIDs removed.
                    ID8List list = (ID8List)mmfield;
                    base.Remove(uids, list, messages);
                }

                // Commit the changes to the database.
                configTopLevel.SaveFeatureClassToDB(table);

                // Success.
                parameters["out_results"].SetAsText("true");
            }
            else
            {
                // Failure.
                parameters["out_results"].SetAsText("false");
            }
        }
Пример #6
0
        /// <summary>
        ///     Traverses the <paramref name="source" /> tree structure recursively counting all of the
        ///     <see cref="Miner.Interop.ID8ListItem" /> in the tree.
        /// </summary>
        /// <param name="source">The list to traverse.</param>
        /// <returns>
        ///     Returns the <see cref="int" /> representing the number of elements in the tree.
        /// </returns>
        public static int Count(this ID8List source)
        {
            if (source == null)
            {
                return(0);
            }

            return(source.Where(o => o != null).Count());
        }
Пример #7
0
        /// <summary>
        ///     Creates an <see cref="IEnumerable{T}" /> from an <see cref="ID8List" />
        /// </summary>
        /// <param name="source">An <see cref="ID8List" /> to create an <see cref="IEnumerable{T}" /> from.</param>
        /// <returns>
        ///     An <see cref="IEnumerable{T}" /> that contains the list items from the input source.
        /// </returns>
        public static IEnumerable <ID8ListItem> AsEnumerable(this ID8List source)
        {
            if (source == null)
            {
                return(null);
            }

            return(source.AsEnumerable(Recursion <ID8ListItem> .Infinity));
        }
Пример #8
0
        /// <summary>
        ///     Creates an <see cref="IEnumerable{T}" /> from an <see cref="ID8List" />
        /// </summary>
        /// <param name="source">An <see cref="ID8List" /> to create an <see cref="IEnumerable{T}" /> from.</param>
        /// <param name="depth">The depth of the recursion.</param>
        /// <returns>
        ///     An <see cref="IEnumerable{T}" /> that contains the list items from the input source.
        /// </returns>
        public static IEnumerable <ID8ListItem> AsEnumerable(this ID8List source, int depth)
        {
            if (source == null)
            {
                return(null);
            }

            return(source.Where(o => o != null, depth).Select(o => o.Value));
        }
Пример #9
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);
            }
        }
Пример #10
0
        /// <summary>
        ///     Notifies event listeners that the list has been rebuilt.
        /// </summary>
        /// <param name="source">The source.</param>
        public static void Notify(this ID8List source)
        {
            if (source == null)
            {
                return;
            }

            IMMCoreEvents eventHandler = (IMMCoreEvents)source;

            eventHandler.ItemRebuilt(source as ID8ListItem);
        }
Пример #11
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>
        /// <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">selector</exception>
        public static IEnumerable <IRecursion <ID8ListItem> > Where(this ID8List source, Func <ID8ListItem, bool> selector)
        {
            if (source == null)
            {
                return(null);
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            return(source.Where(selector, Recursion <ID8ListItem> .Infinity));
        }
Пример #12
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 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">selector</exception>
        public static IEnumerable <IRecursion <ID8ListItem> > Where(this ID8List source, Func <ID8ListItem, bool> selector, int depth)
        {
            if (source == null)
            {
                return(null);
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            return(WhereImpl(source, selector, 0, depth));
        }
Пример #13
0
        /// <summary>
        ///     Traverses the <paramref name="source" /> tree structure recursively counting those
        ///     <see cref="Miner.Interop.ID8ListItem" />
        ///     that satisfies the <paramref name="selector" /> match test.
        /// </summary>
        /// <param name="source">The list to traverse.</param>
        /// <param name="selector">A function to test an element for a condition.</param>
        /// <returns>
        ///     Returns the <see cref="Int32" /> representing the number of elements that match the selector.
        /// </returns>
        /// <exception cref="ArgumentNullException">selector</exception>
        public static int Count(this ID8List source, Func <ID8ListItem, bool> selector)
        {
            if (source == null)
            {
                return(0);
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            return(source.Where(selector).Count());
        }
Пример #14
0
        /// <summary>
        ///     Adds the error to the internal D8List.
        /// </summary>
        /// <param name="errorMessage">The error message to be added.</param>
        protected void AddError(string errorMessage)
        {
            if (_ErrorList == null)
            {
                _ErrorList = new D8ListClass();
            }

            IMMValidationError error = new MMValidationErrorClass();

            error.Severity     = 8;
            error.BitmapID     = 0;
            error.ErrorMessage = errorMessage;
            _ErrorList.Add((ID8ListItem)error);
        }
Пример #15
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);
        }
Пример #16
0
        /// <summary>
        ///     Adds the node as a child to the specified <paramref name="parent" />.
        /// </summary>
        /// <param name="source">The node.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException">parent</exception>
        public static void Add(this IMMPxNode source, IMMPxNode parent)
        {
            if (source == null)
            {
                return;
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            ID8List list = (ID8List)parent;

            ((ID8ListEx)parent).BuildChildren = true;

            list.Add((ID8ListItem)source);
        }
Пример #17
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;
            }
        }
Пример #18
0
        /// <summary>
        ///     Performs the queries necessary to build the list.
        /// </summary>
        /// <param name="pList">The list.</param>
        public override void BuildList(ID8List pList)
        {
            if (pList == null)
            {
                return;
            }

            if (!this.Validate((IMMPxNode)pList))
            {
                return;
            }

            foreach (var nodeID in _NodeIDs)
            {
                IMMPxNode node = this.GetNode(nodeID);
                if (node != null)
                {
                    pList.Add((ID8ListItem)node);
                }
            }
        }
Пример #19
0
        /// <summary>
        ///     Determines whether the specified row is valid.
        /// </summary>
        /// <param name="pRow">The row.</param>
        /// <returns>D8List of IMMValidationError items.</returns>
        public virtual ID8List IsValid(IRow pRow)
        {
            // Create a new D8List.
            _ErrorList = new D8ListClass();

            try
            {
                this.InternalIsValid(pRow);
            }
            catch (Exception e)
            {
                if (MinerRuntimeEnvironment.IsUserInterfaceSupported)
                {
                    Log.Error("Error Executing Validation Rule " + _Name, e);
                }
                else
                {
                    Log.Error(e);
                }
            }

            // Return the error list.
            return(_ErrorList);
        }
Пример #20
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);
                        }
                    }
                }
            }
        }
Пример #21
0
 /// <summary>
 ///     Removes the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
 /// </summary>
 /// <param name="uids">The dictionary of events and UIDs.</param>
 /// <param name="list">The list of events and UIDs.</param>
 /// <param name="messages">The messages.</param>
 protected void Remove(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
 {
     // Enumerate through the dictionary of events and UIDs.
     foreach (var uid in uids)
     {
         // Locate all of the "AutoValue" types.
         foreach (var item in list.AsEnumerable())
         {
             if (item.ItemType == mmd8ItemType.mmitAutoValue)
             {
                 IMMAutoValue autoValue = (IMMAutoValue)item;
                 if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                 {
                     // When the UID is contained within the list it should be removed.
                     if (uid.Value.Contains(autoValue.AutoGenID))
                     {
                         list.Remove(item);
                         messages.Add(esriGPMessageType.esriGPMessageTypeInformative, "Removing the {0} from the {1} event.", autoValue.AutoGenID.Value, autoValue.EditEvent);
                     }
                 }
             }
         }
     }
 }
Пример #22
0
        /// <summary>
        ///     Gets the automatic value (i.e. ArcFM Auto Updater) for the specified <paramref name="editEvent" /> and
        ///     <paramref name="guid" />.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <returns>
        ///     Returns a <see cref="IMMAutoValue" /> representing the automatic value; otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">guid</exception>
        public static IMMAutoValue GetAutoValue(this IMMSubtype source, mmEditEvent editEvent, Guid guid)
        {
            if (source == null)
            {
                return(null);
            }
            if (guid == Guid.Empty)
            {
                throw new ArgumentNullException("guid");
            }

            ID8List list = source as ID8List;

            if (list == null)
            {
                return(null);
            }

            var values = list.Where(i => i.ItemType == mmd8ItemType.mmitAutoValue, 0).Select(o => o.Value);

            foreach (IMMAutoValue autoValue in values.OfType <IMMAutoValue>().Where(o => o.AutoGenID != null && o.EditEvent == editEvent))
            {
                if (autoValue.AutoGenID.Value == null)
                {
                    continue;
                }

                string autoGenID = autoValue.AutoGenID.Value.ToString();
                if (string.Equals(autoGenID, guid.ToString("B"), StringComparison.InvariantCultureIgnoreCase))
                {
                    return(autoValue);
                }
            }

            return(null);
        }
Пример #23
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;
        }
Пример #24
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);
                }
            }
        }
Пример #25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="PxApp"></param>
        /// <param name="TopList"></param>
        /// <param name="FilterExtent">Optional, if not null it will be used to filter the notes to the current extent</param>
        /// <param name="UseLookupTable">Whether to perform a search / replace of the CUNames in the Design before outputting them</param>
        /// <returns></returns>
        public static string GetConstructionNotes(IMMPxApplication PxApp, IMMPersistentXML ListItem, IEnvelope FilterExtent)
        {
            if (PxApp == null)
            {
                throw new Exception("No Px Application found");
            }
            if (ListItem == null)
            {
                throw new Exception("No item given to generate notes for");
            }

            string XslPath = "";

            try
            {
                XslPath = DesignerUtility.GetPxConfig(PxApp, Constants.PxConfig_ContstructionNotesXslPath);
                if (string.IsNullOrEmpty(XslPath))
                {
                    throw new Exception("Obtained an empty reference to the Construction Notes Stylesheet.  Ask your administrator to verify the Px Configuration.");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to find a Px Configuration for the Construction Notes Stylesheet.  Ask your administrator to verify the Px Configuration.", ex);
            }

            //Our resulting XML must have Work Locations / Gis Units in order to filter it
            System.Xml.XmlDocument modernDocument = null;
            string labelXmlType = DesignerUtility.GetPxConfig(PxApp, Constants.PxConfig_ContstructionNotesXmlSource);

            switch (labelXmlType)
            {
            case "DesignTree":
                modernDocument = GetReportingXml(PxApp, ListItem, LabelXmlType.DesignTree);
                break;

            default:
            case "DesignerXml":
                modernDocument = GetReportingXml(PxApp, ListItem, LabelXmlType.DesignerXml);
                break;

            case "PxXml":
                modernDocument = GetReportingXml(PxApp, ListItem, LabelXmlType.PxXml);
                break;

            case "CostEngine":
                modernDocument = GetReportingXml(PxApp, ListItem, LabelXmlType.CostEngine);
                break;

            case "Custom":
                modernDocument = GetReportingXml(PxApp, ListItem, LabelXmlType.Custom);
                break;
            }

            if (FilterExtent != null)
            {
                #region Fitler the Design Xml

                IRelationalOperator IRO = FilterExtent as IRelationalOperator;

                //Build up a list of Work Locations in the current extent
                List <string> BadWls = new List <string>();
                List <string> BadGus = new List <string>();

                ID8ListItem WlOrCu    = null;
                ID8ListItem GivenItem = ListItem as ID8ListItem;
                if (GivenItem == null)
                {
                    throw new ApplicationException("Selected item is not a valid list item");
                }

                if (GivenItem.ItemType == mmd8ItemType.mmd8itWorkRequest)
                {
                    ((ID8List)GivenItem).Reset();
                    ID8List Design = ((ID8List)GivenItem).Next(false) as ID8List;
                    GivenItem = Design as ID8ListItem;
                    ((ID8List)GivenItem).Reset();
                    WlOrCu = ((ID8List)GivenItem).Next(false);
                }
                else if (GivenItem.ItemType == mmd8ItemType.mmd8itDesign)
                {
                    ((ID8List)GivenItem).Reset();
                    WlOrCu = ((ID8List)GivenItem).Next(false);
                }
                else if (GivenItem.ItemType == mmd8ItemType.mmd8itWorkLocation)
                {
                    WlOrCu = (ID8ListItem)GivenItem;
                }
                else
                {
                    throw new ApplicationException("Construction notes are not supported on the selected item");
                }

                while (WlOrCu != null)
                {
                    if (WlOrCu.ItemType == mmd8ItemType.mmd8itWorkLocation)
                    {
                        if (!HasD8ChildInExtent(IRO, WlOrCu as ID8List))
                        {
                            BadWls.Add(((ID8WorkLocation)WlOrCu).ID);
                        }
                    }
                    else
                    {
                        if (WlOrCu.ItemType == mmd8ItemType.mmitMMGisUnit)
                        {
                            if (!HasD8ChildInExtent(IRO, WlOrCu as ID8List))
                            {
                                BadGus.Add(((IMMGisUnit)WlOrCu).GisUnitID.ToString());
                            }
                        }
                    }

                    WlOrCu = ((ID8List)GivenItem).Next(false);
                }

                string wlquery = "";
                foreach (string wlid in BadWls)
                {
                    if (!string.IsNullOrEmpty(wlid))
                    {
                        wlquery += "//WORKLOCATION[ID='" + wlid + "']|";
                    }
                }
                wlquery = wlquery.TrimEnd("|".ToCharArray());

                string guquery = "";
                foreach (string guid in BadGus)
                {
                    if (!string.IsNullOrEmpty(guid))
                    {
                        guquery += "//GISUNIT[DESIGNER_ID='" + guid + "']|";
                    }
                }
                guquery = guquery.TrimEnd("|".ToCharArray());

                string query = wlquery + "|" + guquery;
                query = query.Trim("|".ToCharArray());

                //Filter the xml document to remove the bad wls
                if (!string.IsNullOrEmpty(query))
                {
                    foreach (System.Xml.XmlNode BadNode in modernDocument.SelectNodes(query))
                    {
                        BadNode.ParentNode.RemoveChild(BadNode);
                    }
                }

                #endregion
            }

            return(TransformXml(modernDocument, XslPath));
        }
Пример #26
0
 /// <summary>
 ///     Performs the queries necessary to build the list.
 /// </summary>
 /// <param name="pList">The list.</param>
 public abstract void BuildList(ID8List pList);