Beispiel #1
0
        public static IRepresentationRule CreateRepresentationRule(IFeatureClass ifeatureClass_0)
        {
            IBasicSymbol        symbol = CreateBasicSymbol(ifeatureClass_0);
            IRepresentationRule rule   = new RepresentationRuleClass();

            rule.InsertLayer(0, symbol);
            return(rule);
        }
        private IRepresentationRule method_1(IFeatureClass ifeatureClass_1)
        {
            IBasicSymbol        symbol = this.method_0(ifeatureClass_1);
            IRepresentationRule rule   = new RepresentationRuleClass();

            rule.InsertLayer(0, symbol);
            return(rule);
        }
        /// <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);
        }
Beispiel #4
0
        private static IStyleGalleryItem3 ConvertMarkerItemToRep(IStyleGalleryItem3 inputItem)
        {
            IMarkerSymbol           markerSymbol = inputItem.Item as IMarkerSymbol;
            IRepresentationRule     repRule      = new RepresentationRuleClass();
            IRepresentationRuleInit repRuleInit  = repRule as IRepresentationRuleInit;

            repRuleInit.InitWithSymbol((ISymbol)markerSymbol); //initialize the rep rule with the marker
            IRepresentationGraphics representationGraphics = new RepresentationMarkerClass();

            IGraphicAttributes      graphicAttributes  = null;
            IRepresentationGraphics tempMarkerGraphics = null;
            IGeometry           tempGraphicGeometry    = null;
            IRepresentationRule tempRule = null;

            //only pull the markers out.
            for (int i = 0; i < repRule.LayerCount; i++)
            {
                graphicAttributes  = repRule.get_Layer(i) as IGraphicAttributes;
                tempMarkerGraphics = graphicAttributes.get_Value((int)esriGraphicAttribute.esriGAMarker) as IRepresentationGraphics;

                tempMarkerGraphics.Reset();
                tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);

                while (tempRule != null && tempGraphicGeometry != null)
                {
                    representationGraphics.Add(tempGraphicGeometry, tempRule);
                    tempGraphicGeometry = null;
                    tempRule            = null;
                    tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);
                }
            }

            IStyleGalleryItem3 newMarkerStyleGalleryItem = new ServerStyleGalleryItemClass();

            newMarkerStyleGalleryItem.Item     = representationGraphics;
            newMarkerStyleGalleryItem.Name     = inputItem.Name;
            newMarkerStyleGalleryItem.Category = inputItem.Category;
            newMarkerStyleGalleryItem.Tags     = inputItem.Tags.Replace(";emf", ""); //strip emf from the tags

            return(newMarkerStyleGalleryItem);
        }
Beispiel #5
0
        private static IStyleGalleryItem3 ConvertMarkerItemToRep(IStyleGalleryItem3 inputItem)
        {
            IMarkerSymbol markerSymbol = inputItem.Item as IMarkerSymbol;
              IRepresentationRule repRule = new RepresentationRuleClass();
              IRepresentationRuleInit repRuleInit = repRule as IRepresentationRuleInit;

              repRuleInit.InitWithSymbol((ISymbol)markerSymbol); //initialize the rep rule with the marker
              IRepresentationGraphics representationGraphics = new RepresentationMarkerClass();

              IGraphicAttributes graphicAttributes = null;
              IRepresentationGraphics tempMarkerGraphics = null;
              IGeometry tempGraphicGeometry = null;
              IRepresentationRule tempRule = null;

              //only pull the markers out.
              for (int i = 0; i < repRule.LayerCount; i++)
              {

            graphicAttributes = repRule.get_Layer(i) as IGraphicAttributes;
            tempMarkerGraphics = graphicAttributes.get_Value((int)esriGraphicAttribute.esriGAMarker) as IRepresentationGraphics;

            tempMarkerGraphics.Reset();
            tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);

            while (tempRule != null && tempGraphicGeometry != null)
            {
              representationGraphics.Add(tempGraphicGeometry, tempRule);
              tempGraphicGeometry = null;
              tempRule = null;
              tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);
            }
              }

              IStyleGalleryItem3 newMarkerStyleGalleryItem = new ServerStyleGalleryItemClass();
              newMarkerStyleGalleryItem.Item = representationGraphics;
              newMarkerStyleGalleryItem.Name = inputItem.Name;
              newMarkerStyleGalleryItem.Category = inputItem.Category;
              newMarkerStyleGalleryItem.Tags = inputItem.Tags.Replace(";emf", ""); //strip emf from the tags

              return newMarkerStyleGalleryItem;
        }
        /// <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;
        }