forked from fel88/DeepNestPort
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fel88#12 upd (hull clipping + simplification draw)
# Conflicts: # DeepNestLib/Background.cs # DeepNestLib/DeepNestLib.csproj # DeepNestLib/DxfParser.cs # DeepNestLib/NFP.cs # DeepNestLib/NestingContext.cs # DeepNestLib/RawDetail.cs # DeepNestLib/SvgNest.cs # DeepNestLib/SvgNestConfig.cs # DeepNestLib/SvgPoint.cs # DeepNestPort/Form1.Designer.cs # DeepNestPort/Form1.cs # DeepNestPort/Form1.resx
- Loading branch information
Showing
8 changed files
with
522 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,64 @@ | ||
namespace DeepNestLib | ||
{ | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
using System.Linq; | ||
|
||
public class RawDetail | ||
public class RawDetail | ||
{ | ||
public List<LocalContour> Outers = new List<LocalContour>(); | ||
public List<LocalContour> Holes = new List<LocalContour>(); | ||
|
||
public RectangleF BoundingBox() | ||
{ | ||
public List<LocalContour> Outers = new List<LocalContour>(); | ||
public List<LocalContour> Holes = new List<LocalContour>(); | ||
GraphicsPath gp = new GraphicsPath(); | ||
foreach (var item in Outers) | ||
{ | ||
gp.AddPolygon(item.Points.ToArray()); | ||
} | ||
|
||
return gp.GetBounds(); | ||
} | ||
|
||
public string Name { get; set; } | ||
|
||
public NFP ToNfp() | ||
{ | ||
NFP po = null; | ||
List<NFP> nfps = new List<NFP>(); | ||
foreach (var item in this.Outers) | ||
{ | ||
var nn = new NFP(); | ||
nfps.Add(nn); | ||
foreach (var pitem in item.Points) | ||
{ | ||
nn.AddPoint(new SvgPoint(pitem.X, pitem.Y)); | ||
} | ||
} | ||
|
||
if (nfps.Any()) | ||
{ | ||
var tt = nfps.OrderByDescending(z => z.Area).First(); | ||
po = tt; // Reference caution needed here; should be cloning not messing with the original object? | ||
po.Name = Name; | ||
|
||
foreach (var r in nfps) | ||
{ | ||
if (r == tt) | ||
{ | ||
continue; | ||
} | ||
|
||
if (po.Children == null) | ||
{ | ||
po.Children = new List<NFP>(); | ||
} | ||
po.Children.Add(r); | ||
} | ||
} | ||
|
||
public string Name { get; set; } | ||
return po; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.