2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
2014-09-12 21:08:11 +00:00
using System ;
2009-04-19 18:07:22 +00:00
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Rendering ;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public class ResultLineOverlapping : ErrorResult
{
#region = = = = = = = = = = = = = = = = = = Variables
2014-09-12 21:08:11 +00:00
private readonly Linedef line1 ;
private readonly Linedef line2 ;
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
public override int Buttons { get { return 0 ; } }
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Destructor
// Constructor
public ResultLineOverlapping ( Linedef l1 , Linedef l2 )
{
// Initialize
2014-09-12 21:08:11 +00:00
line1 = l1 ;
line2 = l2 ;
viewobjects . Add ( l1 ) ;
viewobjects . Add ( l2 ) ;
hidden = ( l1 . IgnoredErrorChecks . Contains ( this . GetType ( ) ) & & l2 . IgnoredErrorChecks . Contains ( this . GetType ( ) ) ) ; //mxd
description = "These linedefs are overlapping and they do not reference the same sector on all sides. Overlapping lines is only allowed when they reference the same sector on all sides." ;
2009-04-19 18:07:22 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
2014-09-12 21:08:11 +00:00
// This sets if this result is displayed in ErrorCheckForm (mxd)
2014-12-03 23:15:26 +00:00
internal override void Hide ( bool hide )
{
2014-09-12 21:08:11 +00:00
hidden = hide ;
Type t = this . GetType ( ) ;
2015-12-28 15:01:53 +00:00
if ( hide )
2014-12-03 23:15:26 +00:00
{
2014-09-12 21:08:11 +00:00
line1 . IgnoredErrorChecks . Add ( t ) ;
line2 . IgnoredErrorChecks . Add ( t ) ;
}
else
{
2015-12-28 15:01:53 +00:00
if ( line1 . IgnoredErrorChecks . Contains ( t ) ) line1 . IgnoredErrorChecks . Remove ( t ) ;
if ( line2 . IgnoredErrorChecks . Contains ( t ) ) line2 . IgnoredErrorChecks . Remove ( t ) ;
2014-09-12 21:08:11 +00:00
}
}
2009-04-19 18:07:22 +00:00
// This must return the string that is displayed in the listbox
public override string ToString ( )
{
2013-09-11 09:47:53 +00:00
return "Linedefs " + line1 . Index + " and " + line2 . Index + " are overlapping and reference different sectors" ;
2009-04-19 18:07:22 +00:00
}
// Rendering
public override void PlotSelection ( IRenderer2D renderer )
{
renderer . PlotLinedef ( line1 , General . Colors . Selection ) ;
renderer . PlotLinedef ( line2 , General . Colors . Selection ) ;
renderer . PlotVertex ( line1 . Start , ColorCollection . VERTICES ) ;
renderer . PlotVertex ( line1 . End , ColorCollection . VERTICES ) ;
renderer . PlotVertex ( line2 . Start , ColorCollection . VERTICES ) ;
renderer . PlotVertex ( line2 . End , ColorCollection . VERTICES ) ;
}
#endregion
}
}