Exemplo n.º 1
0
 protected override void ApplyAttributesOfElement(string name, GeoDo.RSS.Layout.IElement ele)
 {
     if (ele is GeoDo.RSS.Layout.Elements.ILegendElement)
     {
         LegendItem[]   legendItems   = CreateLegendItems();
         ILegendElement legendElement = ele as ILegendElement;
         legendElement.LegendItems = legendItems;
     }
     base.ApplyAttributesOfElement(name, ele);
 }
Exemplo n.º 2
0
 protected override void ApplyAttributesOfElement(string name, IElement ele)
 {
     if (ele is ILegendElement)
     {
         if (_legendItems == null || _legendItems.Count < 1)
         {
             return;
         }
         LegendItem[]   legendItems   = CreateLegendItems();
         ILegendElement legendElement = ele as ILegendElement;
         if (legendItems != null && legendItems.Length > 0)
         {
             legendElement.LegendItems = legendItems;
         }
     }
     base.ApplyAttributesOfElement(name, ele);
 }
Exemplo n.º 3
0
        internal void SetOrbitTimes(string[] orbitTimes)
        {
            if (_template == null)
            {
                return;
            }
            ILayout layout = _template.Layout;

            IElement[]        dfs = layout.QueryElements((e) => { return(e is ILegendElement); });
            List <LegendItem> lg  = new List <LegendItem>();

            for (int i = 0; i < orbitTimes.Length; i++)
            {
                lg.Add(new LegendItem(orbitTimes[i]));
            }
            ILegendElement legend = dfs[0] as ILegendElement;

            legend.LegendItems = lg.ToArray();
        }
Exemplo n.º 4
0
 protected override void ApplyAttributesOfElement(string name, GeoDo.RSS.Layout.IElement ele)
 {
     if (ele is GeoDo.RSS.Layout.Elements.ILegendElement)
     {
         ILegendElement legendElement = ele as ILegendElement;
         //修改图例名称
         legendElement.Text = "海冰面积:" + Math.Round(_statAreas[_statAreas.Count - 1], 2) + "平方公里";
         Layout.LegendItem[] legends = legendElement.LegendItems;
         if (legends != null && legends.Length > 0)
         {
             int i = 0;
             foreach (Layout.LegendItem item in legends)
             {
                 item.Text = item.Text + ":" + Math.Round(_statAreas[i], 2);
                 i++;
             }
         }
     }
     base.ApplyAttributesOfElement(name, ele);
 }
Exemplo n.º 5
0
 IFieldsetElement IContentModel<IFieldsetElement, ILegendElement>.this[ILegendElement child]
 {
     get { return this[child]; }
 }
Exemplo n.º 6
0
 IFieldsetElement IContentModel <IFieldsetElement, ILegendElement> .this[ILegendElement child]
 {
     get { return(this[child]); }
 }
Exemplo n.º 7
0
        public static void UpdateLegend(ProductColorTable[] colors, Action <int, string> percentProgress)
        {
            string path = System.AppDomain.CurrentDomain.BaseDirectory + "LayoutTemplate";

            if (!Directory.Exists(path))
            {
                return;
            }
            string[] files = Directory.GetFiles(path, "*.gxt", SearchOption.AllDirectories);
            if (files == null || files.Length == 0)
            {
                return;
            }
            for (int i = 0; i < files.Length; i++)
            {
                string          fname    = files[i];
                ILayoutTemplate template = LayoutTemplate.LoadTemplateFrom(fname);

                //LayoutTemplate.LoadTemplateFrom(fname);
                if (template == null)
                {
                    return;
                }
                if (percentProgress != null)
                {
                    percentProgress((int)((i + 1) * 100f / files.Length), "");
                }
                ILayout layout   = template.Layout;
                bool    haUpdate = false;
                for (int e = 0; e < layout.Elements.Count; e++)
                {
                    if (layout.Elements[e] is ILegendElement)
                    {
                        ILegendElement legendEle = layout.Elements[e] as ILegendElement;
                        string         colotName = legendEle.ColorTableName;
                        if (!string.IsNullOrWhiteSpace(colotName))
                        {
                            ProductColorTable colorTable = ProductColorTableFactory.GetColorTable(colotName);
                            if (colorTable != null)
                            {
                                List <LegendItem> items = new List <LegendItem>();
                                foreach (ProductColor pc in colorTable.ProductColors)
                                {
                                    if (!pc.DisplayLengend)
                                    {
                                        continue;
                                    }
                                    LegendItem item = new LegendItem(pc.LableText, pc.Color);
                                    items.Add(item);
                                }
                                legendEle.LegendItems = items.ToArray();
                                haUpdate = true;
                            }
                        }
                    }
                }
                if (haUpdate)
                {
                    template.SaveTo(fname);
                }
            }
        }