/// <summary>
        ///     Creates the variant domain by instantiating the objects from the <see cref="IUID" /> an placing them into a
        ///     <see cref="IGPString" /> value for the domain.
        /// </summary>
        /// <typeparam name="TValue">The type of the value.</typeparam>
        /// <param name="uids">The uids that will be created.</param>
        /// <returns>
        ///     Returns a <see cref="IGPDomain" /> representing the coded value domain.
        /// </returns>
        protected IGPDomain CreateDomain <TValue>(IEnumerable <IUID> uids)
        {
            IGPCodedValueDomain codedValueDomain = new GPCodedValueDomainClass();

            foreach (var uid in uids)
            {
                GPAutoValue <TValue> value = new GPAutoValue <TValue>(uid);
                codedValueDomain.AddCode(value, value.Name);
            }

            return((IGPDomain)codedValueDomain);
        }
示例#2
0
        /// <summary>
        /// Creates a geoprocessing value object from the given string.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public IGPValue CreateValue(string text)
        {
            IGPValue   value   = new GPAutoValue <TValue>();
            IGPMessage message = value.SetAsText(text);

            if (message.IsInformational())
            {
                return(value);
            }

            return(null);
        }
        /// <summary>
        ///     Loads the components from the registry.
        /// </summary>
        /// <typeparam name="TValue">The type of the value.</typeparam>
        /// <param name="categoryID">The category identifier.</param>
        /// <returns>
        ///     Returns a <see cref="IEnumerable{IUID}" /> representing the UIDs that are enabled.
        /// </returns>
        protected List <GPAutoValue <TValue> > LoadComponents <TValue>(string categoryID)
        {
            List <GPAutoValue <TValue> > list = new List <GPAutoValue <TValue> >();

            IMMComCategoryLookup categories = new ComCategoryLookup(categoryID);

            for (int i = 0; i < categories.Count; i++)
            {
                IUID uid = new UIDClass();
                uid.Value = categories.GetClassID(i).ToString("B");

                GPAutoValue <TValue> value = new GPAutoValue <TValue>(uid);
                list.Add(value);
            }

            return(list.OrderBy(o => o.Name).ToList());
        }