UltimateZoneBuilder/Source/Plugins/BuilderModes/ErrorChecks/ResultShortLinedef.cs
MaxED cb1eb1de83 Changed, Visual mode: "Paste Selection" action (Ctrl-V) can now paste both copied textures and things, based on what was copied last.
Changed, Map Analysis mode: the view is now much more zoomed after clocking on a "Check very short linedefs" error check result.
Removed single testing engine launchable by the editor at once limitation (it worked properly only when using Test map actions anyway).
Fixed: re-did the fix for invalid geometry created when drawing very large grids from R2653, because it caused other issues.
2016-06-19 00:09:53 +00:00

80 lines
No EOL
1.9 KiB
C#

#region ================== Namespaces
using System;
using System.Drawing;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public class ResultShortLinedef : ErrorResult
{
#region ================== Variables
private readonly Linedef line;
#endregion
#region ================== Properties
public override int Buttons { get { return 0; } }
#endregion
#region ================== Constructor / Destructor
// Constructor
public ResultShortLinedef(Linedef l)
{
// Initialize
line = l;
viewobjects.Add(l);
hidden = l.IgnoredErrorChecks.Contains(this.GetType()); //mxd
description = "This linedef is shorter than 1 map unit. This can potentially cause nodebuilding errors.";
}
#endregion
#region ================== Methods
// This sets if this result is displayed in ErrorCheckForm (mxd)
internal override void Hide(bool hide)
{
hidden = hide;
Type t = this.GetType();
if(hide) line.IgnoredErrorChecks.Add(t);
else if(line.IgnoredErrorChecks.Contains(t)) line.IgnoredErrorChecks.Remove(t);
}
// This must return the string that is displayed in the listbox
public override string ToString()
{
return "Linedef " + line.Index + " is shorter than 1 mu.";
}
// Rendering
public override void PlotSelection(IRenderer2D renderer)
{
renderer.PlotLinedef(line, General.Colors.Selection);
renderer.PlotVertex(line.Start, ColorCollection.VERTICES);
renderer.PlotVertex(line.End, ColorCollection.VERTICES);
}
// We must zoom in way more than usual...
public override RectangleF GetZoomArea()
{
// Get Area
RectangleF area = base.GetZoomArea();
// Remove padding
area.Inflate(-97f, -97f);
// Return area
return area;
}
#endregion
}
}