Skip to content

Commit 5760dbb

Browse files
committed
Merge with v6.0.0
1 parent 558d3f9 commit 5760dbb

File tree

128 files changed

+20869
-12815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+20869
-12815
lines changed

Beziers/Beziers.cs

Lines changed: 0 additions & 666 deletions
This file was deleted.

Beziers/Beziers.pas

Lines changed: 0 additions & 899 deletions
This file was deleted.

Beziers/beziers.cpp

Lines changed: 0 additions & 729 deletions
This file was deleted.

Beziers/beziers.hpp

Lines changed: 0 additions & 60 deletions
This file was deleted.

C#/ConsoleDemo/ConsoleDemo/Program.cs

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
namespace ClipperTest1
1212
{
13-
using Polygon = List<IntPoint>;
14-
using Polygons = List<List<IntPoint>>;
13+
using Path = List<IntPoint>;
14+
using Paths = List<List<IntPoint>>;
1515

1616
class Program
1717
{
@@ -53,7 +53,7 @@ public StyleInfo()
5353

5454
public class PolyInfo
5555
{
56-
public Polygons polygons;
56+
public Paths polygons;
5757
public StyleInfo si;
5858
}
5959

@@ -74,7 +74,7 @@ public SVGBuilder()
7474
style = new StyleInfo();
7575
}
7676

77-
public void AddPolygons(Polygons poly)
77+
public void AddPaths(Paths poly)
7878
{
7979
if (poly.Count == 0) return;
8080
PolyInfo pi = new PolyInfo();
@@ -107,7 +107,7 @@ public Boolean SaveToFile(string filename, double scale = 1.0, int margin = 10)
107107

108108
for ( ; i < PolyInfoList.Count; i++ )
109109
{
110-
foreach (Polygon pg in PolyInfoList[i].polygons)
110+
foreach (Path pg in PolyInfoList[i].polygons)
111111
foreach (IntPoint pt in pg)
112112
{
113113
if (pt.X < rec.left) rec.left = pt.X;
@@ -135,7 +135,7 @@ public Boolean SaveToFile(string filename, double scale = 1.0, int margin = 10)
135135
foreach (PolyInfo pi in PolyInfoList)
136136
{
137137
writer.Write(" <path d=\"");
138-
foreach (Polygon p in pi.polygons)
138+
foreach (Path p in pi.polygons)
139139
{
140140
if (p.Count < 3) continue;
141141
writer.Write(String.Format(NumberFormatInfo.InvariantInfo, " M {0:f2} {1:f2}",
@@ -161,7 +161,7 @@ public Boolean SaveToFile(string filename, double scale = 1.0, int margin = 10)
161161
if (pi.si.showCoords)
162162
{
163163
writer.Write("<g font-family=\"Verdana\" font-size=\"11\" fill=\"black\">\n\n");
164-
foreach (Polygon p in pi.polygons)
164+
foreach (Path p in pi.polygons)
165165
{
166166
foreach (IntPoint pt in p)
167167
{
@@ -185,7 +185,7 @@ public Boolean SaveToFile(string filename, double scale = 1.0, int margin = 10)
185185

186186
////////////////////////////////////////////////
187187

188-
static bool LoadFromFile(string filename, Polygons ppg, int dec_places, int xOffset = 0, int yOffset = 0)
188+
static bool LoadFromFile(string filename, Paths ppg, int dec_places, int xOffset = 0, int yOffset = 0)
189189
{
190190
double scaling;
191191
scaling = Math.Pow(10, dec_places);
@@ -203,7 +203,7 @@ static bool LoadFromFile(string filename, Polygons ppg, int dec_places, int xOff
203203
{
204204
if ((line = sr.ReadLine()) == null) return false;
205205
if (!Int32.TryParse(line, out vertCnt) || vertCnt < 0) return false;
206-
Polygon pg = new Polygon(vertCnt);
206+
Path pg = new Path(vertCnt);
207207
ppg.Add(pg);
208208
if (scaling > 0.999 & scaling < 1.001)
209209
for (int j = 0; j < vertCnt; j++)
@@ -240,13 +240,13 @@ static bool LoadFromFile(string filename, Polygons ppg, int dec_places, int xOff
240240
}
241241

242242
////////////////////////////////////////////////
243-
static void SaveToFile(string filename, Polygons ppg, int dec_places)
243+
static void SaveToFile(string filename, Paths ppg, int dec_places)
244244
{
245245
double scaling = Math.Pow(10, dec_places);
246246
StreamWriter writer = new StreamWriter(filename);
247247
if (writer == null) return;
248248
writer.Write("{0}\r\n", ppg.Count);
249-
foreach (Polygon pg in ppg)
249+
foreach (Path pg in ppg)
250250
{
251251
writer.Write("{0}\r\n", pg.Count);
252252
foreach (IntPoint ip in pg)
@@ -273,20 +273,20 @@ static void OutputFileFormat()
273273

274274
////////////////////////////////////////////////
275275

276-
static Polygon IntsToPolygon(int[] ints)
276+
static Path IntsToPolygon(int[] ints)
277277
{
278278
int len1 = ints.Length /2;
279-
Polygon result = new Polygon(len1);
279+
Path result = new Path(len1);
280280
for (int i = 0; i < len1; i++)
281281
result.Add(new IntPoint(ints[i * 2], ints[i * 2 +1]));
282282
return result;
283283
}
284284

285285
////////////////////////////////////////////////
286286

287-
static Polygon MakeRandomPolygon(Random r, int maxWidth, int maxHeight, int edgeCount, Int64 scale = 1)
287+
static Path MakeRandomPolygon(Random r, int maxWidth, int maxHeight, int edgeCount, Int64 scale = 1)
288288
{
289-
Polygon result = new Polygon(edgeCount);
289+
Path result = new Path(edgeCount);
290290
for (int i = 0; i < edgeCount; i++)
291291
{
292292
result.Add(new IntPoint(r.Next(maxWidth)*scale, r.Next(maxHeight)*scale));
@@ -297,34 +297,34 @@ static Polygon MakeRandomPolygon(Random r, int maxWidth, int maxHeight, int edg
297297

298298
static void Main(string[] args)
299299
{
300-
////quick test with random polygons ...
301-
//Polygons ss = new Polygons(1), cc = new Polygons(1), sss = new Polygons();
302-
//Random r = new Random((int)DateTime.Now.Ticks);
303-
//int scale = 1000000000; //tests 128bit math
304-
//ss.Add(MakeRandomPolygon(r, 400, 350, 9, scale));
305-
//cc.Add(MakeRandomPolygon(r, 400, 350, 9, scale));
306-
//Clipper cpr = new Clipper();
307-
//cpr.AddPolygons(ss, PolyType.ptSubject);
308-
//cpr.AddPolygons(cc, PolyType.ptClip);
309-
//cpr.Execute(ClipType.ctUnion, sss, PolyFillType.pftNonZero, PolyFillType.pftNonZero);
310-
//sss = Clipper.OffsetPolygons(sss, -5.0*scale, JoinType.jtMiter, 4);
311-
//SVGBuilder svg1 = new SVGBuilder();
312-
//svg1.style.brushClr = Color.FromArgb(0x20, 0, 0, 0x9c);
313-
//svg1.style.penClr = Color.FromArgb(0xd3, 0xd3, 0xda);
314-
//svg1.AddPolygons(ss);
315-
//svg1.style.brushClr = Color.FromArgb(0x20, 0x9c, 0, 0);
316-
//svg1.style.penClr = Color.FromArgb(0xff, 0xa0, 0x7a);
317-
//svg1.AddPolygons(cc);
318-
//svg1.style.brushClr = Color.FromArgb(0xAA, 0x80, 0xff, 0x9c);
319-
//svg1.style.penClr = Color.FromArgb(0, 0x33, 0);
320-
//svg1.AddPolygons(sss);
321-
//svg1.SaveToFile("solution.svg", 1.0/scale);
322-
//return;
323-
324-
if (args.Length < 5)
300+
////quick test with random polygons ...
301+
//Paths ss = new Paths(1), cc = new Paths(1), sss = new Paths();
302+
//Random r = new Random((int)DateTime.Now.Ticks);
303+
//int scale = 1000000000; //tests 128bit math
304+
//ss.Add(MakeRandomPolygon(r, 400, 350, 9, scale));
305+
//cc.Add(MakeRandomPolygon(r, 400, 350, 9, scale));
306+
//Clipper cpr = new Clipper();
307+
//cpr.AddPaths(ss, PolyType.ptSubject, true);
308+
//cpr.AddPaths(cc, PolyType.ptClip, true);
309+
//cpr.Execute(ClipType.ctUnion, sss, PolyFillType.pftNonZero, PolyFillType.pftNonZero);
310+
//sss = Clipper.OffsetPolygons(sss, -5.0 * scale, JoinType.jtMiter, 4);
311+
//SVGBuilder svg1 = new SVGBuilder();
312+
//svg1.style.brushClr = Color.FromArgb(0x20, 0, 0, 0x9c);
313+
//svg1.style.penClr = Color.FromArgb(0xd3, 0xd3, 0xda);
314+
//svg1.AddPaths(ss);
315+
//svg1.style.brushClr = Color.FromArgb(0x20, 0x9c, 0, 0);
316+
//svg1.style.penClr = Color.FromArgb(0xff, 0xa0, 0x7a);
317+
//svg1.AddPaths(cc);
318+
//svg1.style.brushClr = Color.FromArgb(0xAA, 0x80, 0xff, 0x9c);
319+
//svg1.style.penClr = Color.FromArgb(0, 0x33, 0);
320+
//svg1.AddPaths(sss);
321+
//svg1.SaveToFile("solution.svg", 1.0 / scale);
322+
//return;
323+
324+
if (args.Length < 5)
325325
{
326326
string appname = System.Environment.GetCommandLineArgs()[0];
327-
appname = Path.GetFileName(appname);
327+
appname = System.IO.Path.GetFileName(appname);
328328
Console.WriteLine("");
329329
Console.WriteLine("Usage:");
330330
Console.WriteLine(" {0} CLIPTYPE s_file c_file INPUT_DEC_PLACES SVG_SCALE [S_FILL, C_FILL]", appname);
@@ -401,8 +401,8 @@ static void Main(string[] args)
401401
}
402402
}
403403

404-
Polygons subjs = new Polygons();
405-
Polygons clips = new Polygons();
404+
Paths subjs = new Paths();
405+
Paths clips = new Paths();
406406
if (!LoadFromFile(subjFilename, subjs, decimal_places))
407407
{
408408
Console.WriteLine("Error processing subject polygons file - {0} ", subjFilename);
@@ -418,11 +418,11 @@ static void Main(string[] args)
418418

419419
Console.WriteLine("wait ...");
420420
Clipper cp = new Clipper();
421-
cp.AddPolygons(subjs, PolyType.ptSubject);
422-
cp.AddPolygons(clips, PolyType.ptClip);
421+
cp.AddPaths(subjs, PolyType.ptSubject, true);
422+
cp.AddPaths(clips, PolyType.ptClip, true);
423423

424-
Polygons solution = new Polygons();
425-
//Polygons solution = new Polygons();
424+
Paths solution = new Paths();
425+
//Paths solution = new Paths();
426426
if (cp.Execute(ct, solution, pftSubj, pftClip))
427427
{
428428
SaveToFile("solution.txt", solution, decimal_places);
@@ -432,13 +432,13 @@ static void Main(string[] args)
432432
SVGBuilder svg = new SVGBuilder();
433433
svg.style.brushClr = Color.FromArgb(0x20, 0, 0, 0x9c);
434434
svg.style.penClr = Color.FromArgb(0xd3, 0xd3, 0xda);
435-
svg.AddPolygons(subjs);
435+
svg.AddPaths(subjs);
436436
svg.style.brushClr = Color.FromArgb(0x20, 0x9c, 0, 0);
437437
svg.style.penClr = Color.FromArgb(0xff, 0xa0, 0x7a);
438-
svg.AddPolygons(clips);
438+
svg.AddPaths(clips);
439439
svg.style.brushClr = Color.FromArgb(0xAA, 0x80, 0xff, 0x9c);
440440
svg.style.penClr = Color.FromArgb(0, 0x33, 0);
441-
svg.AddPolygons(solution);
441+
svg.AddPaths(solution);
442442
svg.SaveToFile("solution.svg", svg_scale);
443443

444444
Console.WriteLine("finished!");

0 commit comments

Comments
 (0)