Files
tbf/SchematicDrawing/Enums.cs
T

121 lines
2.5 KiB
C#

///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace SchematicDrawing
{
public static class Const
{
public const int Step = 10;
public static readonly Matrix MatrixRight = new Matrix(1, 0, 0, 1, 0, 0);
public static readonly Matrix MatrixUp = new Matrix(0, -1, 1, 0, 0, 0);
public static readonly Matrix MatrixLeft = new Matrix(-1, 0, 0, -1, 0, 0);
public static readonly Matrix MatrixDown = new Matrix(0, 1, -1, 0, 0, 0);
}
public enum Shape
{
Ambient,
Bypass,
Cross,
Div,
Edges, /// Dummy shape, has no image and always coordinates (0,0)
FlowM,
Junction,
Knee,
PressM,
Pump,
PumpFM,
RegV,
Sink,
Tank,
Tee,
TempM,
Valve,
WaterM,
Count
}
public enum Sz
{
S,
M,
L,
XL,
K1,
K2,
K3,
K4,
K5,
K6,
K7,
K8,
Count,
}
public enum Orient
{
R,
Dn,
L,
Up,
Count,
}
public enum Selection
{
Object,
Label,
Value,
EdgeS,
EdgeM,
EdgeL,
EdgeXL,
Count
}
public static class Utils
{
/// <summary>
/// Return coordinates of the vector in direction Orient
/// </summary>
/// <param name="orient">Orient</param>
/// <returns>Vector</returns>
public static Point GetVect(Orient orient)
{
switch (orient)
{
default:
case Orient.R: return new Point(1, 0);
case Orient.Up: return new Point(0, -1);
case Orient.L: return new Point(-1, 0);
case Orient.Dn: return new Point(0, 1);
}
}
/// <summary>
/// Return coordinates of the vector perpendicular to Orient
/// </summary>
/// <param name="orient">Orient</param>
/// <returns>Perpendicular vector</returns>
public static Point GetNormalVect(Orient orient)
{
switch (orient)
{
default:
case Orient.R: return new Point(0, 1);
case Orient.Up: return new Point(1, 0);
case Orient.L: return new Point(0, -1);
case Orient.Dn: return new Point(-1, 0);
}
}
}
}