MSAGL Support

Added new tech tree layout implementation using Microsoft Automatic Graph Layouts
Added some functionality to the database editor tools
This commit is contained in:
hyperion51 2020-04-14 00:42:04 +01:00
commit 01a956eef6
1110 changed files with 119054 additions and 151 deletions

View file

@ -0,0 +1,52 @@
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
#if DEBUGGLEE
namespace Microsoft.Msagl.Splines {
/// <summary>
/// For debugging purposees only
/// </summary>
internal class CurveSerializer {
CurveSerializer() { }
internal static void Serialize(string fileName, ICurve i) {
Stream file = File.Open(fileName, FileMode.Create);
// Create a formatter object based on command line arguments
IFormatter formatter = new BinaryFormatter();
// Serialize the object graph to stream
formatter.Serialize(file, i);
// All done
file.Close();
}
internal static ICurve Deserialize(string fileName) {
// Verify that the input file exists
if (!File.Exists(fileName))
return null;
// Open the requested file to a stream object
Console.WriteLine("\nDeserializing LinkedList from file: {0} ..\n", fileName);
Stream file = File.Open(fileName, FileMode.Open);
IFormatter formatter = new BinaryFormatter();
try {
ICurve i = formatter.Deserialize(file) as ICurve;
return i;
} catch (Exception) {
throw;
} finally {
file.Close();
}
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fce314c20730a0d43b0f291788333652
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,188 @@
#if TEST_MSAGL
using System;
using Microsoft.Msagl.Core.Geometry.Curves;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
///</summary>
[Serializable]
public class DebugCurve : DebugShape {
/// <summary>
/// color transparency
/// </summary>
public byte Transparency { get; set; }
double width = 1;
///<summary>
///</summary>
public ICurve Curve { get; set; }
///<summary>
///</summary>
public double Width {
get { return width; }
set { width = value; }
}
///<summary>
///</summary>
///<param name="transparency"></param>
///<param name="width"></param>
///<param name="curve"></param>
///<param name="color"></param>
///<param name="id"></param>
public DebugCurve(byte transparency, double width, string color, ICurve curve, object id)
: this(width, color, curve, id) {
Transparency = transparency;
}
///<summary>
///</summary>
///<param name="transparency"></param>
///<param name="width"></param>
///<param name="curve"></param>
///<param name="color"></param>
///<param name="dashArray"></param>
public DebugCurve(byte transparency, double width, string color, ICurve curve, double [] dashArray)
: this(width, color, curve, null) {
Transparency = transparency;
DashArray = dashArray;
}
///<summary>
///</summary>
///<param name="transparency"></param>
///<param name="width"></param>
///<param name="curve"></param>
///<param name="color"></param>
public DebugCurve(byte transparency, double width, string color, ICurve curve)
: this(width, color, curve, null)
{
Transparency = transparency;
}
/// <summary>
/// </summary>
/// <param name="transparency"></param>
/// <param name="width"></param>
/// <param name="color"></param>
/// <param name="fillColor"></param>
/// <param name="curve"></param>
public DebugCurve(byte transparency, double width, string color, string fillColor, ICurve curve)
: this(width, color, fillColor, curve, null) {
Transparency = transparency;
}
///<summary>
///</summary>
///<param name="width"></param>
///<param name="color"></param>
///<param name="curve"></param>
public DebugCurve(double width, string color, ICurve curve):this(width,color,curve,null)
{
}
///<summary>
///</summary>
///<param name="width"></param>
///<param name="color"></param>
///<param name="curve"></param>
///<param name="id"></param>
public DebugCurve(double width, string color, ICurve curve, object id) {
Transparency = 255;
Width = width;
Color = color;
Curve = curve;
Label = id;
}
/// <summary>
/// </summary>
/// <param name="width"></param>
/// <param name="color"></param>
/// <param name="fillColor"></param>
/// <param name="curve"></param>
/// <param name="id"></param>
public DebugCurve(double width, string color,string fillColor, ICurve curve, object id): this(width, color, curve, null) {
FillColor = fillColor;
}
///<summary>
///</summary>
public object Label { get; set; }
///<summary>
///</summary>
///<param name="curve"></param>
///<param name="color"></param>
public DebugCurve(string color, ICurve curve):this(1, color, curve, null){}
///<summary>
///</summary>
///<param name="curve"></param>
///<param name="pen"></param>
public DebugCurve(double pen, ICurve curve) : this(pen, "black", curve, null){}
///<summary>
///</summary>
///<param name="curve"></param>
///<param name="id"></param>
public DebugCurve(ICurve curve, object id) : this(1, "black", curve, id) { }
///<summary>
///</summary>
///<param name="color"></param>
///<param name="curve"></param>
///<param name="id"></param>
public DebugCurve(string color, ICurve curve, object id) : this(1, color, curve, id) { }
///<summary>
///</summary>
///<param name="curve"></param>
public DebugCurve(ICurve curve) : this(1, "black", curve, null) { }
/// <summary>
/// color strings for debugging
/// </summary>
[SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")]
public static readonly string[] Colors = {
"DeepSkyBlue", "IndianRed", "Orange", "Gold", "DarkRed", "Plum",
"Red", "Violet", "Indigo", "Yellow", "OrangeRed", "Tomato", "Purple"
, "SaddleBrown", "Green", "Navy", "Aqua", "Pink", "Bisque", "Black",
"BlanchedAlmond", "Blue", "BlueViolet", "Brown", "Lime", "BurlyWood"
, "Chocolate", "Coral", "CornflowerBlue", "Cornsilk", "Crimson",
"Cyan", "CadetBlue", "Chartreuse", "DarkBlue", "DarkCyan",
"DarkGoldenrod", "DarkGray", "DarkGreen", "DarkKhaki", "DarkMagenta"
, "DarkOliveGreen", "DarkOrange", "DarkOrchid", "DarkSalmon",
"DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkTurquoise",
"DarkViolet", "DeepPink", "DimGray", "DodgerBlue", "Firebrick",
"FloralWhite", "ForestGreen", "Fuchsia", "CodeAnalysis", "Gainsboro"
, "GhostWhite", "Goldenrod", "Gray", "GreenYellow", "Honeydew",
"HotPink", "Ivory", "Lavender", "LavenderBlush", "LawnGreen",
"LemonChiffon", "LightBlue", "LightCoral", "LightCyan",
"LightGoldenrodYellow", "LightGray", "LightGreen", "LightPink",
"LightSalmon", "LightSeaGreen", "LightSkyBlue", "LightSlateGray",
"LightSteelBlue", "LightYellow", "LimeGreen", "Linen", "Magenta",
"Maroon", "MediumAquamarine", "MediumBlue", "MediumOrchid",
"MediumPurple", "MediumSeaGreen", "MediumSlateBlue",
"MediumSpringGreen", "MediumTurquoise", "MediumVioletRed",
"MidnightBlue", "MintCream", "MistyRose", "Moccasin", "NavajoWhite",
"OldLace", "Olive", "OliveDrab", "Orchid", "PaleGoldenrod",
"PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip",
"PeachPuff", "Peru", "PowderBlue", "RosyBrown", "RoyalBlue",
"Salmon", "SandyBrown", "SeaGreen", "CodeAnalysis", "SeaShell",
"Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "Snow",
"SpringGreen", "SteelBlue", "Tan", "Teal", "Thistle", "Transparent",
"Turquoise", "Aquamarine", "Azure", "Beige", "Wheat", "White",
"WhiteSmoke", "YellowGreen", "Khaki", "AntiqueWhite"
};
///<summary>
/// the pattern of dashes
///</summary>
public double [] DashArray;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3fb21f5fc4c0034e9f711f730ec7a43
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,64 @@
#if TEST_MSAGL
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace Microsoft.Msagl.DebugHelpers{
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix"), Serializable]
public class DebugCurveCollection{
/// <summary>
///
/// </summary>
/// <param name="debugCurves"></param>
DebugCurveCollection(IEnumerable<DebugCurve> debugCurves){
DebugCurvesArray = debugCurves.ToArray();
}
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
public DebugCurve[] DebugCurvesArray;
///<summary>
///</summary>
///<param name="debugCurves"></param>
///<param name="fileName"></param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public static void WriteToFile(IEnumerable<DebugCurve> debugCurves, string fileName) {
Stream stream = File.Open(fileName, FileMode.Create);
var bformatter = new BinaryFormatter();
try {
bformatter.Serialize(stream, new DebugCurveCollection(debugCurves));
}
catch (SerializationException e) {
Console.WriteLine(e.ToString());
}
stream.Close();
}
///<summary>
///</summary>
///<param name="fileName"></param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public static IEnumerable<DebugCurve> ReadFromFile(string fileName) {
Stream stream = File.Open(fileName, FileMode.Open);
var bformatter = new BinaryFormatter();
DebugCurveCollection dc = null;
try {
dc = bformatter.Deserialize(stream) as DebugCurveCollection;
}
catch (SerializationException e) {
Console.WriteLine(e.ToString());
}
stream.Close();
return new List<DebugCurve>(dc.DebugCurvesArray);
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad8faafa314d6774ab3fdf08a2e70472
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using Microsoft.Msagl.Core.Geometry.Curves;
#if DEBUG
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
///</summary>
public class DebugEllipse : DebugShape {
/// <summary>
///
/// </summary>
public Ellipse Ellipse { get; set; }
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 040ef4a26c4d6c2429db40ff02c30dd1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,16 @@
#if DEBUG && !SHARPKIT
using System.Collections.Generic;
namespace Microsoft.Msagl.DebugHelpers {
class DebugGraphics : IDebugGraphics {
List<DebugShape> shapes = new List<DebugShape>();
public IList<DebugShape> Shapes {
get { return shapes; }
}
public void Clear() {
shapes.Clear();
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6eb93269a49de9f46bf5e37df01800c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using Microsoft.Msagl.Core.Geometry;
#if DEBUG && !SHARPKIT
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
///</summary>
public class DebugRectangle : DebugShape {
/// <summary>
///
/// </summary>
public Rectangle Rectangle { get; set; }
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50946ea45cb57054d8d74a441769a954
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,23 @@
#if DEBUG
using System;
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
///</summary>
[Serializable]
public class DebugShape {
///<summary>
///</summary>
public int Pen { get; set; }
///<summary>
///</summary>
public string Color { get; set; }
/// <summary>
/// Filling Color of the Shape.
/// </summary>
public string FillColor { get; set;}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 648c9b730b46c73408222504c3341ced
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,148 @@
//
// DevTrace.cs
// Development-time tracing, using a #define (DEVTRACE) separate from Release-enabled TRACE.
//
// Copyright Microsoft Corporation.
//
#if !DEBUG
#if DEVTRACE
#error DEVTRACE is only allowed in DEBUG builds
#endif
#else // DEBUG
using System.Diagnostics;
namespace Microsoft.Msagl.DebugHelpers {
#if DEVTRACE
#if !TRACE
#error TRACE must be defined if DEVTRACE is
#endif
#if !TEST_MSAGL
// Rectilinear uses some TEST_MSAGL utilities in DEVTRACE
#error TEST_MSAGL must be defined if DEVTRACE is
#endif
#else // DEVTRACE
static
#endif // DEVTRACE
internal class DevTrace {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])"), Conditional("DEVTRACE")]
internal static void Assert(bool condition, string format, params object[] args) {
Trace.Assert(condition, string.Format(format, args));
}
#if DEVTRACE
// Called by the test app. By default this is added to the Trace.Listeners collection,
// retaining the DefaultTraceListener, so we can see the output in the debugger's Output
// window as well. The .config file can modify this to remove the default listener.
internal static void AddListenerToFile(string fileName) {
// Use File.Create to overwrite any existing file.
Trace.Listeners.Add(new TextWriterTraceListener(System.IO.File.Create(fileName)));
}
// The message level; unrelated to the TraceLevel from the config file, this just
// identifies a consistent prefix for warnings and errors.
internal enum Level {
Info
, Warning
, Error
}
// The switch from the config file. Its TraceLevel is used as the verbosity level.
TraceSwitch Switch { get; set; }
// 'name' should be qualified so it is apparent which module uses it, e.g.
// "Rectilinear_ScanLineTrace". Caller usually maintains this DevTrace instance
// inside #if DEVTRACE, and a conditional function wrapper to call it, e.g.:
// #if DEVTRACE
// DevTrace ScanLineDevTrace;
// #endif // DEVTRACE
//
// [Conditional("DEVTRACE")]
// void ScanLineTraceInfo(...) {
// #if DEVTRACE
// DevTrace.WriteLine(...);
// #endif // DEVTRACE
// }
// This eliminates the need for #if DEVTRACE...#endif at each callsite.
//
// The test app must also have an <appname>.exe.config file in the same directory as <appname>.exe.
// See TestRectilinear for an example of contents. This allows tracing to be configurable per-test-app,
// both for which switches to use and what level of output or verification is desired.
// So to summarize, it's a 2-step process for the client:
// 1. Set up <appname>.exe.config (with its Properties set for it to be copied to the bin directory)
// 2. Either modify that .config file to create a listener to your file, or (best for multiple runs)
// add a test-app parameter for the filename to create (see TestRectilinear). Note that some
// of the possible switches are for validation rather than output; those don't require a file.
// To enable tracing inside MSAGL, it's two or three more steps:
// a. If a switch doesn't exist yet, create it as noted above (and put it in the .config files of
// apps that are interested in it).
// b. Insert appropriate calls in the code.
// c. Modify the tracelevel in the .config file of the app you're using, from 0 (off) to 1 (high level)
// to 4 (low-level, very verbose or detailed verification).
internal DevTrace(string switchName) : this(switchName, "") {}
internal DevTrace(string switchName, string prefix) {
this.Switch = new TraceSwitch(switchName, prefix);
Trace.WriteLine(string.Format("Trace switch {0} level: {1}", switchName
, (TraceLevel.Off == Switch.Level) ? "Off" : ((int)Switch.Level).ToString()));
}
internal bool IsLevel(int level) {
return (int)Switch.Level >= level;
}
// VerboseLevel is filtered by the config-file value, as an int rather than Error, Warning, etc.
// which would be confusing with TraceLevel. Higher numbers mean more output or verification.
// MessageLevel is *not* related to the switch value from the config file, it just identifies
// a consistent prefix.
internal void WriteLineIf(DevTrace.Level messageLevel, int verboseLevel, string format, params object[] args) {
if (IsLevel(verboseLevel)) {
Trace.IndentLevel = verboseLevel;
string message = Switch.Description;
if (!string.IsNullOrEmpty(message)) {
message += ": ";
}
message += string.Format(format, args);
if (DevTrace.Level.Warning == messageLevel) {
message = "*** Trace Warning *** " + message;
}
if (DevTrace.Level.Error == messageLevel) {
message = "*** Trace Error *** " + message;
}
Trace.WriteLine(message);
}
}
// Usually verboseLevel is 0 for warnings and errors.
internal void WriteWarning(int verboseLevel, string format, params object[] args) {
WriteLineIf(DevTrace.Level.Warning, verboseLevel, format, args);
FlushListeners();
}
internal void WriteError(int verboseLevel, string format, params object[] args) {
WriteLineIf(DevTrace.Level.Error, verboseLevel, format, args);
FlushListeners();
}
// Followup info for Warning or Error that doesn't fit cleanly on a single line.
internal void WriteFollowup(int verboseLevel, string format, params object[] args) {
if (IsLevel(verboseLevel)) {
Trace.IndentLevel = 8;
Trace.WriteLine(string.Format(format, args));
}
}
internal void FlushListeners() {
// Warnings or Errors may be followed by an assert so let's make sure the files are flushed.
foreach (TraceListener listener in Trace.Listeners) {
listener.Flush();
}
}
#endif // DEVTRACE
}
}
#endif // DEBUG

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 124ea8406cf52c74286be6834936dcbc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
#if DEBUG && !SHARPKIT
using System.Collections.Generic;
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
///</summary>
public interface IDebugGraphics {
/// <summary>
///
/// </summary>
IList<DebugShape> Shapes { get; }
/// <summary>
///
/// </summary>
void Clear();
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af5cc366432065344beafc2d31ee7e6b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 03e659699ca573f42915bafe375c8280
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace Microsoft.Msagl.DebugHelpers.Persistence {
internal class CharStreamElement : CurveStreamElement {
internal CharStreamElement(char ch) {
Value = ch;
}
internal char Char { get { return (char)Value; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4b9e4de43907bfa4e8ce00313710b6d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.DebugHelpers {
/// <summary>
/// this class is needed for temporarily holding the list of integers representing cluster childs,
/// and the list of node Id's representing cluster child nodes
/// </summary>
public class ClusterWithChildLists {
internal List<string> ChildClusters = new List<string>();
internal List<string> ChildNodes = new List<string>();
internal Cluster Cluster;
internal ClusterWithChildLists(Cluster cl) {
Cluster = cl;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8fd662453be6214fbe06864af5b449b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Msagl.DebugHelpers.Persistence;
namespace Microsoft.Msagl.DebugHelpers {
internal class CurveStream {
string data;
CurveStreamElement[] curveStreamElements;
int offset;
internal CurveStream(string curveData) {
data=curveData;
Init();
}
void Init() {
data=data.Trim();
var blocks = data.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
curveStreamElements = RefineBlocks(blocks).ToArray();
}
static IEnumerable<CurveStreamElement> RefineBlocks(string[] blocks) {
foreach (string block in blocks) {
var ch = block[0];
if (Char.IsLetter(ch)) {
yield return new CharStreamElement(ch);
if (block.Length > 1) {
double res;
if (Double.TryParse(block.Substring(1), out res))
yield return new DoubleStreamElement(res);
else yield return null;
}
} else {
double res;
if (Double.TryParse(block, out res))
yield return new DoubleStreamElement(res);
else yield return null;
}
}
}
internal CurveStreamElement GetNextCurveStreamElement() {
if (offset >= curveStreamElements.Length)
return null;
return curveStreamElements[offset++];
}
internal CurveStreamElement PickNextCurveStreamElement() {
if (offset >= curveStreamElements.Length)
return null;
return curveStreamElements[offset];
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad70a4f707b9e314aa19661f66eda914
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,5 @@
namespace Microsoft.Msagl.DebugHelpers {
internal abstract class CurveStreamElement {
protected internal object Value;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4669c6e3c997c3c428aeb69f01e13665
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace Microsoft.Msagl.DebugHelpers {
internal class DoubleStreamElement : CurveStreamElement {
public DoubleStreamElement(double res) {
Value = res;
}
internal double Double { get { return (double)Value; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dee7c0c3fbacb5c4daba716f03820229
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ffe42331b0b95443a639f743911e147
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ac6cfc90cc611b479e750f56522b2db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,515 @@
#if PERSISTENCE
namespace Microsoft.Msagl.DebugHelpers {
#pragma warning disable 1591
/// <summary>
/// tokens for the graph parser
/// </summary>
public enum GeometryToken
{
///<summary>
///</summary>
Clusters,
///<summary>
///</summary>
Force,
///<summary>
///</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Barycenter")]
Barycenter,
///<summary>
///</summary>
Cluster,
///<summary>
///</summary>
Width,
/// <summary>
///
/// </summary>
Height,
/// <summary>
///
/// </summary>
Label,
/// <summary>
///
/// </summary>
MsaglGeometryGraph,
/// <summary>
///
/// </summary>
Header,
/// <summary>
///
/// </summary>
AspectRatio,
/// <summary>
///
/// </summary>
Transform,
/// <summary>
///
/// </summary>
TransformElement,
/// <summary>
///
/// </summary>
NodeSeparation,
/// <summary>
///
/// </summary>
LayerSeparation,
/// <summary>
///
/// </summary>
Margins,
/// <summary>
///
/// </summary>
MinNodeHeight,
/// <summary>
///
/// </summary>
MinNodeWidth,
/// <summary>
///
/// </summary>
Nodes,
/// <summary>
///
/// </summary>
Edges,
/// <summary>
///
/// </summary>
Node,
/// <summary>
///
/// </summary>
Edge,
/// <summary>
///
/// </summary>
Id,
/// <summary>
///
/// </summary>
Padding,
/// <summary>
///
/// </summary>
ICurve,
/// <summary>
///
/// </summary>
Ellipse,
/// <summary>
///
/// </summary>
Curve,
/// <summary>
///
/// </summary>
LineSegment,
/// <summary>
///
/// </summary>
CubicBezierSegment,
/// <summary>
///
/// </summary>
AxisA,
/// <summary>
///
/// </summary>
AxisB,
/// <summary>
///
/// </summary>
Center,
/// <summary>
///
/// </summary>
Point,
/// <summary>
///
/// </summary>
XCoordinate,
/// <summary>
///
/// </summary>
YCoordinate,
/// <summary>
///
/// </summary>
SourceNodeId,
/// <summary>
///
/// </summary>
TargetNodeId,
/// <summary>
///
/// </summary>
LabelWidth,
/// <summary>
///
/// </summary>
LabelHeight,
/// <summary>
///
/// </summary>
LabelCenter,
/// <summary>
///
/// </summary>
LineWidth,
/// <summary>
///
/// </summary>
ArrowheadAtSource,
/// <summary>
///
/// </summary>
ArrowheadPosition,
/// <summary>
///
/// </summary>
ArrowheadAtTarget,
/// <summary>
///
/// </summary>
Weight,
/// <summary>
///
/// </summary>
Separation,
/// <summary>
///
/// </summary>
Start,
/// <summary>
///
/// </summary>
End,
/// <summary>
///
/// </summary>
B0,
/// <summary>
///
/// </summary>
B1,
/// <summary>
///
/// </summary>
B2,
/// <summary>
///
/// </summary>
B3,
/// <summary>
///
/// </summary>
UnderlyingPolyline,
/// <summary>
///
/// </summary>
UnderlyingPolylineIsNull,
/// <summary>
///
/// </summary>
PolylineSite,
/// <summary>
///
/// </summary>
SiteK,
/// <summary>
///
/// </summary>
SiteV,
/// <summary>
///
/// </summary>
ParStart,
/// <summary>
///
/// </summary>
ParEnd,
/// <summary>
///
/// </summary>
Reporting,
/// <summary>
///
/// </summary>
RandomSeedForOrdering,
/// <summary>
///
/// </summary>
NoGainStepsBound,
/// <summary>
///
/// </summary>
MaxNumberOfPassesInOrdering,
/// <summary>
///
/// </summary>
Demotion,
/// <summary>
///
/// </summary>
GroupSplit,
/// <summary>
///
/// </summary>
LabelCornersPreserveCoefficient,
/// <summary>
///
/// </summary>
SplineCalculationDuration,
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Brandes")]
BrandesThreshold,
/// <summary>
///
/// </summary>
LayoutAlgorithmSettings,
/// <summary>
///
/// </summary>
SugiyamaLayoutSettings,
/// <summary>
///
/// </summary>
MdsLayoutSettings,
/// <summary>
///
/// </summary>
RankingLayoutSetting,
/// <summary>
///
/// </summary>
LayoutAlgorithmType,
/// <summary>
///
/// </summary>
RepetitionCoefficientForOrdering,
/// <summary>
///
/// </summary>
Exponent,
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Majorization")]
IterationsWithMajorization,
/// <summary>
///
/// </summary>
PivotNumber,
/// <summary>
///
/// </summary>
RotationAngle,
/// <summary>
///
/// </summary>
ScaleX,
/// <summary>
///
/// </summary>
ScaleY,
/// <summary>
///
/// </summary>
OmegaX,
/// <summary>
///
/// </summary>
OmegaY,
/// <summary>
/// defines the edge routing mode
/// </summary>
EdgeRoutingMode,
/// <summary>
///
/// </summary>
UseSparseVisibilityGraph,
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Kd")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Kd")]
UseKdHull,
/// <summary>
///
/// </summary>
ClusterIndex,
/// <summary>
///
/// </summary>
ChildClusters,
/// <summary>
///
/// </summary>
ChildNodes,
/// <summary>
///
/// </summary>
RectangularBoundary,
/// <summary>
///
/// </summary>
Polyline,
/// <summary>
///
/// </summary>
Closed,
/// <summary>
///
/// </summary>
PolylinePoints,
/// <summary>
///
/// </summary>
CurveData,
/// <summary>
/// center x
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cx")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Cx")]
Cx,
/// <summary>
/// center y
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Cy")]
Cy,
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ry")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ry")]
Ry,
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Rx")]
Rx,
/// <summary>
///
/// </summary>
ArrowheadPositionAtSource,
/// <summary>
///
/// </summary>
ArrowheadPositionAtTarget,
/// <summary>
///
/// </summary>
Polygon,
/// <summary>
///
/// </summary>
MsaglGeometryFile,
/// <summary>
///
/// </summary>
Error,
/// <summary>
///
/// </summary>
Rect,
/// <summary>
///
/// </summary>
X,
/// <summary>
///
/// </summary>
Y,
///<summary>
///</summary>
Points,
///<summary>
///</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "T")]
T,
///<summary>
///</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S")]
S,
/// <summary>
/// arrowhead at source
/// </summary>
As,
/// <summary>
/// arrowhead at target
/// </summary>
At,
/// <summary>
///
/// </summary>
Graph,
///<summary>
/// ArrowheadSourceLength
///</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Asl")]
Asl,
/// <summary>
/// ArrowheadTargetLength
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Atl")]
Atl,
/// <summary>
/// RectangleClusterBoundary
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Atl")]
RectangularClusterBoundary,
RightBorderInfo,
LeftBorderInfo,
BottomBorderInfo,
TopBorderInfo,
LeftMargin,
RightMargin,
BottomMargin,
TopMargin,
GenerateFixedConstraints,
GenerateFixedConstraintsDefault,
DefaultBottomMargin,
DefaultTopMargin,
DefaultRightMargin,
DefaultLeftMargin,
InnerMargin,
FixedPosition,
LgData,
SortedLgInfos,
LgNodeInfo,
Rail,
LgLevels,
LgNodeInfos,
Rank,
Level,
NodeCountOnLevel,
Rails,
Arrowhead,
CurveAttachmentPoint,
RailsPerEdge,
EdgeRails,
RailId,
EdgeId,
LgEdgeInfos,
LgEdgeInfo,
Zoomlevel,
SkeletonLevel,
LgSkeletonLevels,
MinPassingEdgeZoomLevel,
LabelVisibleFromScale,
LabelOffset,
LabelWidthToHeightRatio,
Unknown
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f9d1688287274043abfa3f8480314dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,17 @@
#if TEST_MSAGL
using Microsoft.Msagl.Core.Geometry.Curves;
using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.DebugHelpers {
/// <summary>
/// shows curves
/// </summary>
/// <param name="curves"></param>
public delegate void Show(params ICurve[] curves);
///<summary>
///</summary>
///<param name="graph"></param>
public delegate void ShowGraph(GeometryGraph graph);
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8e77d9f8edbe74642af97b95e6dee04c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
#if TEST_MSAGL
using Microsoft.Msagl.Core.Geometry.Curves;
using Microsoft.Msagl.Layout.Layered;
namespace Microsoft.Msagl.DebugHelpers {
/// <summary>
///
/// </summary>
/// <param name="db"></param>
/// <param name="curves"></param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "db")]
public delegate void ShowDatabase(Database db, params ICurve[] curves);
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 45897ca5f15feeb40ba31db023951c96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
#if TEST_MSAGL
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
/// shows shapes
///</summary>
///<param name="shapes"></param>
public delegate void ShowDebugCurves(params DebugCurve[] shapes);
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7bf5ab766ce3b114a9d6435ed1483991
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
#if TEST_MSAGL
using System.Collections.Generic;
namespace Microsoft.Msagl.DebugHelpers {
///<summary>
/// shows shapes
///</summary>
///<param name="shapes"></param>
public delegate void ShowDebugCurvesEnumeration(IEnumerable<DebugCurve> shapes);
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 59c951ebc5e073c44915def110c330e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,68 @@
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace Microsoft.Msagl.DebugHelpers {
#if REPORTING
/// <summary>
/// support for native method calls
/// </summary>
public class Timer {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass"), DllImport("Kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool QueryPerformanceCounter(out long lpPerformanceCount);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass"), DllImport("Kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool QueryPerformanceFrequency(out long lpFrequency);
private long startTime;
private long stopTime;
private long freq;
/// <summary>
/// ctor
/// </summary>
public Timer() {
if (QueryPerformanceFrequency(out freq) == false) {
throw new Win32Exception(); // timer not supanchored
}
}
/// <summary>
/// Start the timer
/// </summary>
/// <returns>long - tick count</returns>
public long Start() {
QueryPerformanceCounter(out startTime);
return startTime;
}
/// <summary>
/// Stop timer
/// </summary>
/// <returns>long - tick count</returns>
public long Stop() {
QueryPerformanceCounter(out stopTime);
return stopTime;
}
/// <summary>
/// Return the duration of the timer in seconds.
/// </summary>
/// <returns>double - duration</returns>
public double Duration {
get {
return (double)(stopTime - startTime) / (double)freq;
}
}
/// <summary>
/// Frequency of timer (no counts in one second on this machine)
/// </summary>
///<returns>long - Frequency</returns>
public long Frequency {
get {
QueryPerformanceFrequency(out freq);
return freq;
}
}
}
#endif
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27dac62c8c918ef449c31f25667d9e57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: