// // GraphBaseConfiguration.cs // // Author: // Carsten Sonne Larsen // // Copyright (c) 2013 Carsten Sonne Larsen // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System.Collections.Generic; using Ntp.Analyzer.Objects; using Ntp.Analyzer.Config.Destination; using Ntp.Analyzer.Export; using Ntp.Analyzer.Graph.Interface; using System.Drawing.Imaging; namespace Ntp.Analyzer.Config.Graph { /// /// Base class for graph configurations. /// public abstract class GraphBaseConfiguration : ServerSubConfiguration, IGraphBaseConfiguration { protected GraphBaseConfiguration ( ServerConfiguration server, string configName, int indentLevel, int frequency, bool initialRun, bool fixedRun, string title, int width, int height, int timespan, double filterFactor, DestinationCollection destinations, WebLinkCollection links ) : base(server, configName, indentLevel, frequency, initialRun, fixedRun) { owners = new List (); this.title = title; this.timespan = timespan; this.width = width; this.height = height; this.filterFactor = filterFactor; this.destinations = destinations; this.links = links; } private readonly DestinationCollection destinations; private readonly double filterFactor; private readonly int height; protected readonly WebLinkCollection links; private readonly List owners; private readonly int timespan; private readonly string title; private readonly int width; /// /// Gets the name of this graph. /// /// The name of the graph. public string GraphName { get { return ConfigName; } } /// /// Gets the title of this graph. /// /// The title. public string Title { get { return title; } } /// /// Gets the width in pixels of generated graph. /// /// The width. public int Width { get { return width; } } /// /// Gets the format to use for destinations. /// /// The format. public ImageFormat Format { get { return ImageFormat.Png; } } /// /// Gets the height in pixels of generated graph. /// /// The height. public int Height { get { return height; } } /// /// Gets the timespan for thins graph. /// /// The timespan. public int Timespan { get { return timespan; } } /// /// Gets the filter factor. Used to filter away extreme values. /// /// The filter factor. public double FilterFactor { get { return filterFactor; } } /// /// Gets the destinations for output generated by this configuration. /// /// The destinations. public IEnumerable Locations { get { return destinations.Destinations; } } public DestinationCollection Destinations { get { return destinations; } } /// /// Attach the specified owner. /// /// Owner. public void Attach (GraphSetConfiguration owner) { owners.Add (owner); } public abstract string GetTitle (NamedObject namedObject); public abstract string GetLink (GraphSetConfiguration owner, string postfix); public abstract string GetAltName (GraphSetConfiguration owner, string postfix); public abstract string GetPageLink (GraphSetConfiguration graphSet, string prefix, string postfix); } }