Пример #1
0
        private TocClass LoadTocClass(Symbol symbol, SwatchMaker swatchMaker, string label, bool includeImage)
        {
            TocClass tocClass = LoadTocClass(symbol, swatchMaker, includeImage);

            tocClass.Label = label;
            return(tocClass);
        }
Пример #2
0
        private TocClass LoadTocClass(Symbol symbol, SwatchMaker swatchMaker, bool includeImage)
        {
            TocClass tocClass = new TocClass();

            if (includeImage)
            {
                tocClass.Image = swatchMaker.GetSwatchBytes(symbol);
            }

            return(tocClass);
        }
Пример #3
0
        private List <TocGroup> LoadTocGroups(Renderer renderer, SwatchMaker swatchMaker, bool includeImages)
        {
            List <TocGroup> tocGroups = new List <TocGroup>();

            switch (renderer.GetType().Name)
            {
            case "SimpleRenderer":
                tocGroups.Add(new TocGroup());
                SimpleRenderer sr = (SimpleRenderer)renderer;
                tocGroups[0].Add(LoadTocClass(sr.Symbol, swatchMaker, includeImages));
                break;

            case "ValueMapRenderer":
                tocGroups.Add(new TocGroup());
                ValueMapRenderer vmr = (ValueMapRenderer)renderer;

                foreach (Classification classification in vmr.Classifications)
                {
                    string label = "";

                    switch (classification.GetType().Name)
                    {
                    case "Exact":
                        Exact exact = (Exact)classification;
                        label = !String.IsNullOrEmpty(exact.Label) ? exact.Label : exact.Value;
                        break;

                    case "Range":
                        Range range = (Range)classification;
                        label = !String.IsNullOrEmpty(range.Label) ? range.Label : range.Lower + " to " + range.Upper;
                        break;

                    case "Other":
                        label = "(other)";
                        break;
                    }

                    tocGroups[0].Add(LoadTocClass(classification.Symbol, swatchMaker, label, includeImages));
                }
                break;

            case "ScaleDependentRenderer":
                ScaleDependentRenderer scd = (ScaleDependentRenderer)renderer;
                tocGroups = LoadTocGroups(scd.Renderer, swatchMaker, includeImages);

                foreach (TocGroup tocGroup in tocGroups)
                {
                    if (!String.IsNullOrEmpty(scd.Lower))
                    {
                        tocGroup.MinScale = Convert.ToDouble(scd.Lower);
                    }
                    if (!String.IsNullOrEmpty(scd.Upper))
                    {
                        tocGroup.MaxScale = Convert.ToDouble(scd.Upper);
                    }
                }
                break;

            case "GroupRenderer":
                foreach (Renderer subRenderer in (GroupRenderer)renderer)
                {
                    List <TocGroup> subGroups = LoadTocGroups(subRenderer, swatchMaker, includeImages);

                    foreach (TocGroup tocGroup in subGroups)
                    {
                        tocGroups.Add(tocGroup);
                    }
                }
                break;
            }

            return(tocGroups);
        }
Пример #4
0
 public TocLoader(ArcImsService service, int swatchWidth, int swatchHeight)
 {
     _service     = service;
     _swatchMaker = new SwatchMaker(service, swatchWidth, swatchHeight);
 }