Пример #1
0
        private void RepresentationPropertyPage_Load(object sender, EventArgs e)
        {
            int num;
            IRepresentationRule  rule;
            IRepresentationRules representationRules = this.m_pRepentation.RepresentationClass.RepresentationRules;

            representationRules.Reset();
            representationRules.Next(out num, out rule);
            while (rule != null)
            {
                string name = representationRules.get_Name(num);
                this.comboBox1.Items.Add(new RepresentationRuleWrap(num, name, rule));
            }
        }
        /// <summary>
        /// Check if a rep rule for the selected SymbolIDCode exists and if so returns it
        /// Ignore Case in check for Rule Name (since Rep Rules ignore case)
        /// </summary>
        /// <returns>-1 if not found</returns>
        private int getRepRuleIdForSidc(IRepresentationClass repClass, string sidc)
        {
            int returnRepRuleId = -1;

            if ((symbolCreator == null) || (repClass == null))
            {
                return(-1);
            }

            string symboName = symbolCreator.GetRuleNameFromSidc(sidc).ToUpper();

            if (string.IsNullOrEmpty(symboName))
            {
                Console.WriteLine("Empty Name returned for SIDC: " + sidc);
                return(-1);
            }

            IRepresentationRules repRules = repClass.RepresentationRules;

            repRules.Reset();

            int ruleID = 0;
            IRepresentationRule rule;

            repRules.Next(out ruleID, out rule);

            while (rule != null)
            {
                if (rule != null)
                {
                    string ruleName = repRules.get_Name(ruleID).ToUpper();

                    if (ruleName == symboName)
                    {
                        returnRepRuleId = ruleID;
                        break;
                    }
                }

                repRules.Next(out ruleID, out rule);
            }

            if (returnRepRuleId == -1)
            {
                System.Diagnostics.Debug.WriteLine("Existing Rule not found for " + symboName);
            }

            return(returnRepRuleId);
        }
Пример #3
0
        private void frmNewReprensentationWizard_Load(object sender, EventArgs e)
        {
            this.irepresentationRules_0 = new RepresentationRulesClass();
            IRepresentationRule repRule = this.method_1(this.ifeatureClass_0);

            this.irepresentationRules_0.Add(repRule);
            this.reprensationGeneralPage_0.FeatureClass = this.ifeatureClass_0;
            this.reprensationGeneralPage_0.Dock         = DockStyle.Fill;
            this.panel1.Controls.Add(this.reprensationGeneralPage_0);
            this.representationRulesPage_0.Dock                = DockStyle.Fill;
            this.representationRulesPage_0.Visible             = false;
            this.representationRulesPage_0.FeatureClass        = this.ifeatureClass_0;
            this.representationRulesPage_0.RepresentationRules = this.irepresentationRules_0;
            this.panel1.Controls.Add(this.representationRulesPage_0);
        }
        /// <summary>
        /// Check if a rep rule for the selected SymbolIDCode exists and if so returns it
        /// </summary>
        /// <returns>-1 if symbol not found/could not be added</returns>
        private int addRepRuleIdForSidc(IRepresentationClass repClass, string sidc)
        {
            if ((symbolCreator == null) || (repClass == null))
            {
                return(-1);
            }

            int repRuleId = -1;

            IRepresentationRules repRules = repClass.RepresentationRules;

            IRepresentationRule newRule = new RepresentationRuleClass();

            ISymbol symbol = symbolCreator.GetMarkerSymbolFromSIC(sidc) as ISymbol;

            if (symbol == null)
            {
                Console.WriteLine("ERROR: Null Symbol returned for SIDC: " + sidc);
                return(-1);
            }

            IMarkerSymbol markerSymbol = symbol as IMarkerSymbol;

            const double DEFAULT_MARKER_SIZE = 32.0;

            if (markerSymbol != null)
            {
                markerSymbol.Size = DEFAULT_MARKER_SIZE;
            }

            (newRule as IRepresentationRuleInit).InitWithSymbol(symbol);

            string symboName = symbolCreator.GetRuleNameFromSidc(sidc);

            if (string.IsNullOrEmpty(symboName))
            {
                return(-1);
            }

            repRuleId = repRules.Add(newRule);
            repRules.set_Name(repRuleId, symboName);

            repRulesWereAdded = true;

            Console.WriteLine("Adding new RepRule for Name: {0}, SIDC:{1}", symboName, sidc);

            return(repRuleId);
        }
Пример #5
0
        public void Init(IRepresentationRules irepresentationRules_1)
        {
            base.Items.Clear();
            this.irepresentationRules_0 = irepresentationRules_1;
            this.irepresentationRules_0.Reset();
            int num;
            IRepresentationRule representationRule;

            this.irepresentationRules_0.Next(out num, out representationRule);
            while (representationRule != null)
            {
                string string_ = this.irepresentationRules_0.get_Name(num);
                base.Items.Add(new RepresentationruleListBox.RepresentationRuleWrap(num, string_, representationRule));
                this.irepresentationRules_0.Next(out num, out representationRule);
            }
        }