mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-19 00:21:01 +00:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Drawing;
|
|||
|
using System.Globalization;
|
|||
|
using System.Text;
|
|||
|
using CodeImp.DoomBuilder.Geometry;
|
|||
|
using CodeImp.DoomBuilder.Map;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|||
|
{
|
|||
|
internal sealed class NearestLineBlockmap : BlockMap<BlockEntry>
|
|||
|
{
|
|||
|
// Constructor
|
|||
|
public NearestLineBlockmap(RectangleF range) : base(range)
|
|||
|
{
|
|||
|
List<Linedef> singlesided = new List<Linedef>(General.Map.Map.Linedefs.Count);
|
|||
|
foreach(Linedef ld in General.Map.Map.Linedefs)
|
|||
|
if(ld.Back == null) singlesided.Add(ld);
|
|||
|
AddLinedefsSet(singlesided);
|
|||
|
|
|||
|
// Blocks that do not have any linedefs in them must get the nearest line in them!
|
|||
|
for(int x = 0; x < size.Width; x++)
|
|||
|
{
|
|||
|
for(int y = 0; y < size.Height; y++)
|
|||
|
{
|
|||
|
BlockEntry be = blockmap[x, y];
|
|||
|
if(be.Lines.Count == 0)
|
|||
|
{
|
|||
|
Vector2D bc = GetBlockCenter(new Point(x, y));
|
|||
|
Linedef ld = MapSet.NearestLinedef(singlesided, bc);
|
|||
|
be.Lines.Add(ld);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|