Example #1
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public SprinklerLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(translations.Get("sprinklers.name"), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(translations, "sprinklers.covered", Color.Green),
                this.Dry = new LegendEntry(translations, "sprinklers.dry-crops", Color.Red)
            };

            // get static sprinkler coverage
            this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(mods);

            // get max sprinkler radius
            this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value));
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.LineSprinklers.MaxRadius);
            }
        }
Example #2
0
        // Build legend (this is done every time the overlay is opened or the mode is changed)
        public override List <LegendEntry> GetCustomLegendData()
        {
            List <LegendEntry> entries = new List <LegendEntry>();

            WorldIdForLegend = ClusterManager.Instance.activeWorldId;

            // Re-build ColorMap, so that only the relevant items are displayed (present and already discovered on this planetoid)
            ColorMap.Clear();

            for (int cell = 0; cell < Grid.CellCount; cell++)
            {
                if (Grid.IsActiveWorld(cell))
                {
                    ProcessCell(cell);
                }
            }

            // Collect the legend entries
            foreach (KeyValuePair <string, MapOverlayEntry> entry in ColorMap.OrderBy(e => UI.StripLinkFormatting(e.Value.Name.text)).ToList())
            {
                // If multiple entries with the same color exist, merge them in one legend entry
                LegendEntry existingLegendEntry = entries.Find(legend => legend.colour == entry.Value.Color);

                if (existingLegendEntry == null)
                {
                    entries.Add(new LegendEntry(entry.Value.Name, "", entry.Value.Color));
                }
                else
                {
                    existingLegendEntry.name = ((LocString)existingLegendEntry.name) + "\n" + entry.Value.Name;
                }
            }

            return(entries);
        }
Example #3
0
            private Image GetPieGraph()
            {
                var ru = new RandomUtil();
                var pg = new PieGraph(Size);

                pg.Color         = Color.White;
                pg.ColorGradient = Color.Orange;
                var legend = new Legend(Width, 70);

                legend.Text = string.Empty;
                pg.Text     = _displayString + " Total: " + _totalComponents.ToString();
                var keys = _componentInfoTable.Keys;
                var ie   = keys.GetEnumerator();

                while (ie.MoveNext())
                {
                    Type          key = (Type)ie.Current;
                    ComponentInfo ci  = (ComponentInfo)_componentInfoTable[key];
                    var           ps  = new PieSlice(ci.Count, ci.Color);
                    pg.Slices.Add(ps);
                    var le = new LegendEntry(ci.Color, ci.Type.Name.ToString().Trim());
                    legend.LegendEntryCollection.Add(le);
                }

                return(GraphRenderer.DrawGraphAndLegend(pg, legend, Size));
            }
Example #4
0
            private Image GetBarGraph()
            {
                RandomUtil ru = new RandomUtil();
                BarGraph   bg = new BarGraph(this.Size);

                bg.Color         = Color.White;
                bg.ColorGradient = Color.Orange;

                Legend legend = new Legend(this.Width, 70);

                legend.Text = String.Empty;
                bg.Text     = _displayString + " Total: " + _totalComponents.ToString();

                ICollection keys = _componentInfoTable.Keys;
                IEnumerator ie   = keys.GetEnumerator();

                while (ie.MoveNext())
                {
                    Type          key = (Type)ie.Current;
                    ComponentInfo ci  = (ComponentInfo)_componentInfoTable[key];
                    BarSlice      bs  = new BarSlice(ci.Count, ci.Color);

                    bg.BarSliceCollection.Add(bs);

                    LegendEntry le = new LegendEntry(ci.Color, ci.Type.Name.ToString().Trim());

                    legend.LegendEntryCollection.Add(le);
                }

                return(GraphRenderer.DrawGraphAndLegend(bg, legend, this.Size));
            }
Example #5
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public SprinklerLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(I18n.Sprinklers_Name(), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(I18n.Keys.Sprinklers_Covered, Color.Green),
                this.Dry = new LegendEntry(I18n.Keys.Sprinklers_DryCrops, Color.Red)
            };

            // get static sprinkler coverage
            this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(mods);

            // get max sprinkler radius
            this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value));
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.LineSprinklers.MaxRadius);
            }
        }
        /// <summary>Render the UI.</summary>
        /// <param name="spriteBatch">The sprite batch being rendered.</param>
        public void Draw(SpriteBatch spriteBatch)
        {
            // calculate dimensions
            int leftOffset = this.bounds.X;
            int topOffset  = this.bounds.Y;

            // draw overlay label
            {
                CommonHelper.DrawScroll(spriteBatch, new Vector2(leftOffset, topOffset), new Vector2(this.BoxContentWidth, this.LabelTextSize.Y), out Vector2 contentPos, out Rectangle scrollBounds, padding: this.ScrollPadding);

                contentPos += new Vector2((this.BoxContentWidth - this.LabelTextSize.X) / 2f, 0); // center label in box
                spriteBatch.DrawString(Game1.smallFont, this.LayerName, contentPos, Color.Black);

                topOffset += scrollBounds.Height + this.Padding;
            }

            // draw legend
            if (this.Legend.Any())
            {
                CommonHelper.DrawScroll(spriteBatch, new Vector2(leftOffset, topOffset), new Vector2(this.BoxContentWidth, this.Legend.Length * this.LegendColorSize), out Vector2 contentPos, out Rectangle _, padding: this.ScrollPadding);
                for (int i = 0; i < this.Legend.Length; i++)
                {
                    LegendEntry value   = this.Legend[i];
                    int         legendX = (int)contentPos.X;
                    int         legendY = (int)(contentPos.Y + i * this.LegendColorSize);

                    spriteBatch.DrawLine(legendX, legendY, new Vector2(this.LegendColorSize), value.Color);
                    spriteBatch.DrawString(Game1.smallFont, value.Name, new Vector2(legendX + this.LegendColorSize + this.LegendColorPadding, legendY + 2), Color.Black);
                }
            }
        }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropPaddyWaterLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropPaddyWater_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.InRange    = new LegendEntry(I18n.Keys.CropPaddyWater_InRange, Color.Green),
         this.NotInRange = new LegendEntry(I18n.Keys.CropPaddyWater_NotInRange, Color.Red)
     };
 }
Example #8
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropWaterLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropWater_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Watered = new LegendEntry(I18n.Keys.CropWater_Watered, Color.Green),
         this.Dry     = new LegendEntry(I18n.Keys.CropWater_Dry, Color.Red)
     };
 }
Example #9
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropWaterLayer(ITranslationHelper translations, LayerConfig config, IMonitor monitor)
     : base(translations.Get("crop-water.name"), config, monitor)
 {
     this.Legend = new[]
     {
         this.Watered = new LegendEntry(translations, "crop-water.watered", Color.Green),
         this.Dry     = new LegendEntry(translations, "crop-water.dry", Color.Red)
     };
 }
Example #10
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public ScarecrowLayer(LayerConfig config)
     : base(I18n.Scarecrows_Name(), config)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(I18n.Keys.Scarecrows_Protected, Color.Green),
         this.Exposed = new LegendEntry(I18n.Keys.Scarecrows_Exposed, Color.Red)
     };
 }
 public void DrawImage(Graphics g, Rectangle r)
 {
     for (int x = 0; x <= m_legendData.Count - 1; x++)
     {
         LegendEntry Entry = m_legendData[x];
         g.DrawLine(Entry.Pen, r.X + 10, r.Y + 25 * x + 13, r.X + 30, r.Y + 25 * x + 13);
         g.DrawString(Entry.DisplayName, new Font("Segoe UI", 13.25f), Brushes.Black, r.X + 40, r.Y + 25 * x + 5);
     }
 }
Example #12
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropPaddyWaterLayer(ITranslationHelper translations, LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(translations.Get("crop-paddy-water.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.InRange    = new LegendEntry(translations, "crop-paddy-water.in-range", Color.Green),
         this.NotInRange = new LegendEntry(translations, "crop-paddy-water.not-in-range", Color.Red)
     };
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public CropWaterLayer(LayerConfig config)
     : base(I18n.CropWater_Name(), config)
 {
     this.Legend = new[]
     {
         this.Watered = new LegendEntry(I18n.Keys.CropWater_Watered, Color.Green),
         this.Dry     = new LegendEntry(I18n.Keys.CropWater_Dry, Color.Red)
     };
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropFertilizerLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropFertilizer_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Fertilizer    = new LegendEntry(I18n.Keys.CropFertilizer_Fertilizer, Color.Green),
         this.RetainingSoil = new LegendEntry(I18n.Keys.CropFertilizer_RetainingSoil, Color.Blue),
         this.SpeedGro      = new LegendEntry(I18n.Keys.CropFertilizer_SpeedGro, Color.Magenta)
     };
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropHarvestLayer(ITranslationHelper translations, LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(translations.Get("crop-harvest.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Ready         = new LegendEntry(translations, "crop-harvest.ready", Color.Green),
         this.NotReady      = new LegendEntry(translations, "crop-harvest.not-ready", Color.Black),
         this.NotEnoughTime = new LegendEntry(translations, "crop-harvest.not-enough-time", Color.Red)
     };
 }
Example #16
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 public TillableLayer(ITranslationHelper translations, LayerConfig config)
     : base(translations.Get("tillable.name"), config)
 {
     this.Legend = new[]
     {
         this.Tillable    = new LegendEntry(translations, "tillable.tillable", Color.Green),
         this.Occupied    = new LegendEntry(translations, "tillable.occupied", Color.Orange),
         this.NonTillable = new LegendEntry(translations, "tillable.not-tillable", Color.Red)
     };
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public CropHarvestLayer(LayerConfig config)
     : base(I18n.CropHarvest_Name(), config)
 {
     this.Legend = new[]
     {
         this.Ready         = new LegendEntry(I18n.Keys.CropHarvest_Ready, Color.Green),
         this.NotReady      = new LegendEntry(I18n.Keys.CropHarvest_NotReady, Color.Black),
         this.NotEnoughTime = new LegendEntry(I18n.Keys.CropHarvest_NotEnoughTime, Color.Red)
     };
 }
Example #18
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropHarvestLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropHarvest_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Ready         = new LegendEntry(I18n.Keys.CropHarvest_Ready, Color.Green),
         this.NotReady      = new LegendEntry(I18n.Keys.CropHarvest_NotReady, Color.Black),
         this.NotEnoughTime = new LegendEntry(I18n.Keys.CropHarvest_NotEnoughTime, Color.Red)
     };
 }
Example #19
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public ScarecrowLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
     : base(I18n.Scarecrows_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(I18n.Keys.Scarecrows_Protected, Color.Green),
         this.Exposed = new LegendEntry(I18n.Keys.Scarecrows_Exposed, Color.Red)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public BuildableLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.Buildable_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Buildable    = new LegendEntry(I18n.Keys.Buildable_Buildable, Color.Green),
         this.Occupied     = new LegendEntry(I18n.Keys.Buildable_Occupied, Color.Orange),
         this.NonBuildable = new LegendEntry(I18n.Keys.Buildable_NotBuildable, Color.Red)
     };
 }
Example #21
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public ScarecrowLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
     : base(translations.Get("scarecrows.name"), config)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(translations, "scarecrows.protected", Color.Green),
         this.Exposed = new LegendEntry(translations, "scarecrows.exposed", Color.Red)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
Example #22
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public BuildableLayer(ITranslationHelper translations, LayerConfig config, IMonitor monitor)
     : base(translations.Get("buildable.name"), config, monitor)
 {
     this.Legend = new[]
     {
         this.Buildable    = new LegendEntry(translations, "buildable.buildable", Color.Green),
         this.Occupied     = new LegendEntry(translations, "buildable.occupied", Color.Orange),
         this.NonBuildable = new LegendEntry(translations, "buildable.not-buildable", Color.Red)
     };
 }
Example #23
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropFertilizerLayer(ITranslationHelper translations, LayerConfig config, IMonitor monitor)
     : base(translations.Get("crop-fertilizer.name"), config, monitor)
 {
     this.Legend = new[]
     {
         this.Fertilizer    = new LegendEntry(translations, "crop-fertilizer.fertilizer", Color.Green),
         this.RetainingSoil = new LegendEntry(translations, "crop-fertilizer.retaining-soil", Color.Blue),
         this.SpeedGro      = new LegendEntry(translations, "crop-fertilizer.speed-gro", Color.Magenta)
     };
 }
Example #24
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public BuildableLayer(LayerConfig config)
     : base(I18n.Buildable_Name(), config)
 {
     this.Legend = new[]
     {
         this.Buildable    = new LegendEntry(I18n.Keys.Buildable_Buildable, Color.Green),
         this.Occupied     = new LegendEntry(I18n.Keys.Buildable_Occupied, Color.Orange),
         this.NonBuildable = new LegendEntry(I18n.Keys.Buildable_NotBuildable, Color.Red)
     };
 }
Example #25
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 public AccessibleLayer(ITranslationHelper translations, LayerConfig config)
     : base(translations.Get("accessible.name"), config)
 {
     this.Legend = new[]
     {
         this.Clear      = new LegendEntry(translations, "accessible.clear", Color.Green),
         this.Occupied   = new LegendEntry(translations, "accessible.occupied", Color.Orange),
         this.Impassable = new LegendEntry(translations, "accessible.impassable", Color.Red),
         this.Warp       = new LegendEntry(translations, "accessible.warp", Color.Blue)
     };
 }
Example #26
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public MachineLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
     : base(translations.Get("machines.name"), config)
 {
     this.Legend = new[]
     {
         this.Empty      = new LegendEntry(translations, "machines.empty", Color.Red),
         this.Processing = new LegendEntry(translations, "machines.processing", Color.Orange),
         this.Finished   = new LegendEntry(translations, "machines.finished", Color.Green)
     };
     this.Mods = mods;
 }
Example #27
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public MachineLayer(LayerConfig config, ModIntegrations mods)
     : base(I18n.Machines_Name(), config)
 {
     this.Legend = new[]
     {
         this.Empty = new LegendEntry(I18n.Keys.Machines_Empty, Color.Red),
         this.Processing = new LegendEntry(I18n.Keys.Machines_Processing, Color.Orange),
         this.Finished = new LegendEntry(I18n.Keys.Machines_Finished, Color.Green)
     };
     this.Mods = mods;
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public AccessibleLayer(LayerConfig config)
     : base(I18n.Accessible_Name(), config)
 {
     this.Legend = new[]
     {
         this.Clear      = new LegendEntry(I18n.Keys.Accessible_Clear, Color.Green),
         this.Occupied   = new LegendEntry(I18n.Keys.Accessible_Occupied, I18n.Accessible_Occupied(), Color.Orange),
         this.Impassable = new LegendEntry(I18n.Keys.Accessible_Impassable, I18n.Accessible_Impassable(), Color.Red),
         this.Warp       = new LegendEntry(I18n.Keys.Accessible_Warp, I18n.Accessible_Warp(), Color.Blue)
     };
 }
Example #29
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public TillableLayer(ITranslationHelper translations, LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(translations.Get("tillable.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Tilled      = new LegendEntry(translations, "tillable.tilled", Color.DarkMagenta),
         this.Tillable    = new LegendEntry(translations, "tillable.tillable", Color.Green),
         this.Occupied    = new LegendEntry(translations, "tillable.occupied", Color.Orange),
         this.NonTillable = new LegendEntry(translations, "tillable.not-tillable", Color.Red)
     };
 }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 public TillableLayer(LayerConfig config)
     : base(I18n.Tillable_Name(), config)
 {
     this.Legend = new[]
     {
         this.Tilled      = new LegendEntry(I18n.Keys.Tillable_Tilled, Color.DarkMagenta),
         this.Tillable    = new LegendEntry(I18n.Keys.Tillable_Tillable, Color.Green),
         this.Occupied    = new LegendEntry(I18n.Keys.Tillable_Occupied, Color.Orange),
         this.NonTillable = new LegendEntry(I18n.Keys.Tillable_NotTillable, Color.Red)
     };
 }
 public LegendEntrySettingsWrapper(LegendEntry legendEntry) 
 {
     Background = new BackgroundSettingsWrapper(legendEntry.Background);
     DashStyle = legendEntry.DashStyle;
     DividerLine = new LineSettingsWrapper(legendEntry.DividerLine);
     HeaderMode = legendEntry.HeaderMode;
     Hotspot = new HotspotSettingsWrapper(legendEntry.Hotspot);
     LabelStyle = new LabelSettingsWrapper(legendEntry.LabelStyle);
     Name = legendEntry.Name;
     PaddingTop = legendEntry.PaddingTop;
     SeriesType = legendEntry.SeriesType;
     ShapeType = legendEntry.ShapeType;
     SortOrder = legendEntry.SortOrder;
     ToolTip = legendEntry.ToolTip;
     URL = legendEntry.URL;
     Use3D = legendEntry.Use3D;
     Value = legendEntry.Value;
     Visible = legendEntry.Visible;
 }
 /// <summary>
 /// Восстановить сохранненые значения.
 /// </summary>
 public void RestoreSettings(LegendEntry legendEntry)
 {
     Background.RestoreSettings(legendEntry.Background);
     legendEntry.DashStyle = DashStyle;
     DividerLine.RestoreSettings(legendEntry.DividerLine);
     legendEntry.HeaderMode = HeaderMode;
     Hotspot.RestoreSettings(legendEntry.Hotspot);
     LabelStyle.RestoreSettings(legendEntry.LabelStyle);
     legendEntry.Name = Name;
     legendEntry.PaddingTop = PaddingTop;
     legendEntry.SeriesType = SeriesType;
     legendEntry.ShapeType = ShapeType;
     legendEntry.SortOrder = SortOrder;
     legendEntry.ToolTip = ToolTip;
     legendEntry.URL = URL;
     legendEntry.Use3D = Use3D;
     legendEntry.Value = Value;
     legendEntry.Visible = Visible;
 }
        /// <summary>
        /// Восстановить сохранненые значения.
        /// </summary>
        public void RestoreSettings(LegendBox legendBox)
        {
            Background.RestoreSettings(legendBox.Background);
            legendBox.CornerBottomLeft = CornerBottomLeft;
            legendBox.CornerBottomRight = CornerBottomRight;
            legendBox.CornerSize = CornerSize;
            legendBox.CornerTopLeft = CornerTopLeft;
            legendBox.CornerTopRight = CornerTopRight;
            legendBox.DefaultCorner = DefaultCorner;
            DefaultEntry.RestoreSettings(legendBox.DefaultEntry);

            legendBox.ExtraEntries.Clear();
            for (int i = 0; i < ExtraEntries.Length; i++)
            {
                LegendEntry entry = new LegendEntry();
                ExtraEntries[i].RestoreSettings(entry);
                legendBox.ExtraEntries.Add(entry);
            }

            HeaderBackground.RestoreSettings(legendBox.HeaderBackground);
            HeaderEntry.RestoreSettings(legendBox.HeaderEntry);
            HeaderLabel.RestoreSettings(legendBox.HeaderLabel);
            legendBox.IconPath = IconPath;
            InteriorLine.RestoreSettings(legendBox.InteriorLine);
            LabelStyle.RestoreSettings(legendBox.LabelStyle);
            Line.RestoreSettings(legendBox.Line);
            legendBox.ListTopToBottom = ListTopToBottom;
            legendBox.Orientation = Orientation;
            legendBox.Padding = Padding;
            legendBox.Position = Position;
            Shadow.RestoreSettings(legendBox.Shadow);
            legendBox.Template = Template;
            legendBox.Visible = Visible;
        }
Example #34
0
			private Image GetBarGraph()
			{
				RandomUtil ru = new RandomUtil();
				BarGraph bg = new BarGraph(this.Size);

				bg.Color = Color.White;
				bg.ColorGradient = Color.Orange;

				Legend legend = new Legend(this.Width, 70);

				legend.Text = String.Empty;
				bg.Text = _displayString + " Total: " + _totalComponents.ToString();

				ICollection keys = _componentInfoTable.Keys;
				IEnumerator ie = keys.GetEnumerator();

				while (ie.MoveNext())
				{
					Type key = (Type)ie.Current;
					ComponentInfo ci = (ComponentInfo)_componentInfoTable[key];
					BarSlice bs = new BarSlice(ci.Count, ci.Color);

					bg.BarSliceCollection.Add(bs);

					LegendEntry le = new LegendEntry(ci.Color, ci.Type.Name.ToString().Trim());

					legend.LegendEntryCollection.Add(le);
				}

				return GraphRenderer.DrawGraphAndLegend(bg, legend, this.Size);
			}