Files
ntpa/Ntp.Analyzer/Config/Graph/GraphBaseConfiguration.cs
T

162 lines
5.4 KiB
C#
Raw Normal View History

2016-03-06 00:15:13 +01:00
//
// GraphBaseConfiguration.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// 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
{
/// <summary>
/// Base class for graph configurations.
/// </summary>
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<GraphSetConfiguration> ();
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<GraphSetConfiguration> owners;
private readonly int timespan;
private readonly string title;
private readonly int width;
/// <summary>
/// Gets the name of this graph.
/// </summary>
/// <value>The name of the graph.</value>
public string GraphName {
get { return ConfigName; }
}
/// <summary>
/// Gets the title of this graph.
/// </summary>
/// <value>The title.</value>
public string Title {
get { return title; }
}
/// <summary>
/// Gets the width in pixels of generated graph.
/// </summary>
/// <value>The width.</value>
public int Width {
get { return width; }
}
/// <summary>
/// Gets the format to use for destinations.
/// </summary>
/// <value>The format.</value>
public ImageFormat Format {
get { return ImageFormat.Png; }
}
/// <summary>
/// Gets the height in pixels of generated graph.
/// </summary>
/// <value>The height.</value>
public int Height {
get { return height; }
}
/// <summary>
/// Gets the timespan for thins graph.
/// </summary>
/// <value>The timespan.</value>
public int Timespan {
get { return timespan; }
}
/// <summary>
/// Gets the filter factor. Used to filter away extreme values.
/// </summary>
/// <value>The filter factor.</value>
public double FilterFactor {
get { return filterFactor; }
}
/// <summary>
/// Gets the destinations for output generated by this configuration.
/// </summary>
/// <value>The destinations.</value>
public IEnumerable<StreamDestination> Locations {
get { return destinations.Destinations; }
}
public DestinationCollection Destinations {
get { return destinations; }
}
/// <summary>
/// Attach the specified owner.
/// </summary>
/// <param name="owner">Owner.</param>
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);
}
2016-03-05 15:25:01 +01:00
}