implement converting paths of layer into CGAL polygons
Stefan Schuermans

Stefan Schuermans commited on 2013-01-27 16:03:24
Showing 7 changed files, with 934 additions and 203 deletions.

... ...
@@ -6,11 +6,11 @@ TARGET=dxfngc
6 6
 
7 7
 SRCS=$(wildcard src/*.cpp)
8 8
 
9
-CFLAGS=-Wall -Wextra -Werror -O3
9
+CFLAGS=-Wall -Wextra -Werror -O2 -g -frounding-math
10 10
 DEFINES=
11 11
 INCLUDES=
12 12
 LDFLAGS=
13
-LIBS=-lm -ldime
13
+LIBS=-lm -ldime -lCGAL
14 14
 
15 15
 CPP=g++
16 16
 CPPARGS=$(CFLAGS) $(DEFINES) $(INCLUDES)
... ...
@@ -903,7 +903,7 @@ LAYER
903 903
 100
904 904
 AcDbSymbolTable
905 905
  70
906
-3
906
+4
907 907
   0
908 908
 LAYER
909 909
   5
... ...
@@ -963,6 +963,26 @@ CONTINUOUS
963 963
 370
964 964
 13
965 965
 390
966
+F
967
+  0
968
+LAYER
969
+  5
970
+45
971
+100
972
+AcDbSymbolTableRecord
973
+100
974
+AcDbLayerTableRecord
975
+  2
976
+inner
977
+ 70
978
+0
979
+ 62
980
+2
981
+  6
982
+CONTINUOUS
983
+370
984
+13
985
+390
966 986
 F
967 987
   0
968 988
 ENDTAB
... ...
@@ -1291,7 +1311,7 @@ ENTITIES
1291 1311
   0
1292 1312
 LINE
1293 1313
   5
1294
-45
1314
+46
1295 1315
 100
1296 1316
 AcDbEntity
1297 1317
 100
... ...
@@ -1305,13 +1325,293 @@ AcDbLine
1305 1325
   6
1306 1326
 ByLayer
1307 1327
  10
1308
-10.0
1328
+0.0
1329
+ 20
1330
+100.0
1331
+ 30
1332
+0.0
1333
+ 11
1334
+120.0
1335
+ 21
1336
+100.0
1337
+ 31
1338
+0.0
1339
+  0
1340
+LINE
1341
+  5
1342
+47
1343
+100
1344
+AcDbEntity
1345
+100
1346
+AcDbLine
1347
+  8
1348
+0
1349
+ 62
1350
+256
1351
+370
1352
+-1
1353
+  6
1354
+ByLayer
1355
+ 10
1356
+120.0
1357
+ 20
1358
+100.0
1359
+ 30
1360
+0.0
1361
+ 11
1362
+120.0
1363
+ 21
1364
+0.0
1365
+ 31
1366
+0.0
1367
+  0
1368
+LINE
1369
+  5
1370
+48
1371
+100
1372
+AcDbEntity
1373
+100
1374
+AcDbLine
1375
+  8
1376
+0
1377
+ 62
1378
+256
1379
+370
1380
+-1
1381
+  6
1382
+ByLayer
1383
+ 10
1384
+120.0
1385
+ 20
1386
+0.0
1387
+ 30
1388
+0.0
1389
+ 11
1390
+0.0
1391
+ 21
1392
+0.0
1393
+ 31
1394
+0.0
1395
+  0
1396
+LINE
1397
+  5
1398
+49
1399
+100
1400
+AcDbEntity
1401
+100
1402
+AcDbLine
1403
+  8
1404
+0
1405
+ 62
1406
+256
1407
+370
1408
+-1
1409
+  6
1410
+ByLayer
1411
+ 10
1412
+0.0
1413
+ 20
1414
+0.0
1415
+ 30
1416
+0.0
1417
+ 11
1418
+0.0
1419
+ 21
1420
+100.0
1421
+ 31
1422
+0.0
1423
+  0
1424
+LINE
1425
+  5
1426
+4A
1427
+100
1428
+AcDbEntity
1429
+100
1430
+AcDbLine
1431
+  8
1432
+text
1433
+ 62
1434
+256
1435
+370
1436
+-1
1437
+  6
1438
+ByLayer
1439
+ 10
1440
+9.1666666666666572
1441
+ 20
1442
+70.0000000000000142
1443
+ 30
1444
+0.0
1445
+ 11
1446
+9.1666666666666572
1447
+ 21
1448
+90.0000000000000142
1449
+ 31
1450
+0.0
1451
+  0
1452
+LINE
1453
+  5
1454
+4B
1455
+100
1456
+AcDbEntity
1457
+100
1458
+AcDbLine
1459
+  8
1460
+text
1461
+ 62
1462
+256
1463
+370
1464
+-1
1465
+  6
1466
+ByLayer
1467
+ 10
1468
+9.1666666666666572
1469
+ 20
1470
+90.0000000000000142
1471
+ 30
1472
+0.0
1473
+ 11
1474
+15.8333333333333286
1475
+ 21
1476
+78.8888888888888999
1477
+ 31
1478
+0.0
1479
+  0
1480
+LINE
1481
+  5
1482
+4C
1483
+100
1484
+AcDbEntity
1485
+100
1486
+AcDbLine
1487
+  8
1488
+text
1489
+ 62
1490
+256
1491
+370
1492
+-1
1493
+  6
1494
+ByLayer
1495
+ 10
1496
+15.8333333333333286
1497
+ 20
1498
+78.8888888888888999
1499
+ 30
1500
+0.0
1501
+ 11
1502
+22.4999999999999858
1503
+ 21
1504
+90.0000000000000142
1505
+ 31
1506
+0.0
1507
+  0
1508
+LINE
1509
+  5
1510
+4D
1511
+100
1512
+AcDbEntity
1513
+100
1514
+AcDbLine
1515
+  8
1516
+text
1517
+ 62
1518
+256
1519
+370
1520
+-1
1521
+  6
1522
+ByLayer
1523
+ 10
1524
+22.4999999999999858
1525
+ 20
1526
+90.0000000000000142
1527
+ 30
1528
+0.0
1529
+ 11
1530
+22.4999999999999858
1531
+ 21
1532
+70.0000000000000142
1533
+ 31
1534
+0.0
1535
+  0
1536
+LINE
1537
+  5
1538
+4E
1539
+100
1540
+AcDbEntity
1541
+100
1542
+AcDbLine
1543
+  8
1544
+text
1545
+ 62
1546
+256
1547
+370
1548
+-1
1549
+  6
1550
+ByLayer
1551
+ 10
1552
+29.1666666666666572
1553
+ 20
1554
+90.0000000000000142
1555
+ 30
1556
+0.0
1557
+ 11
1558
+29.1666666666666572
1559
+ 21
1560
+70.0000000000000142
1561
+ 31
1562
+0.0
1563
+  0
1564
+LINE
1565
+  5
1566
+4F
1567
+100
1568
+AcDbEntity
1569
+100
1570
+AcDbLine
1571
+  8
1572
+text
1573
+ 62
1574
+256
1575
+370
1576
+-1
1577
+  6
1578
+ByLayer
1579
+ 10
1580
+35.8333333333333286
1581
+ 20
1582
+90.0
1583
+ 30
1584
+0.0
1585
+ 11
1586
+35.8333333333333286
1587
+ 21
1588
+70.0
1589
+ 31
1590
+0.0
1591
+  0
1592
+LINE
1593
+  5
1594
+50
1595
+100
1596
+AcDbEntity
1597
+100
1598
+AcDbLine
1599
+  8
1600
+text
1601
+ 62
1602
+256
1603
+370
1604
+-1
1605
+  6
1606
+ByLayer
1607
+ 10
1608
+35.8333333333333286
1309 1609
  20
1310 1610
 70.0
1311 1611
  30
1312 1612
 0.0
1313 1613
  11
1314
-110.0
1614
+44.7222222222222143
1315 1615
  21
1316 1616
 70.0
1317 1617
  31
... ...
@@ -1319,13 +1619,13 @@ ByLayer
1319 1619
   0
1320 1620
 LINE
1321 1621
   5
1322
-46
1622
+51
1323 1623
 100
1324 1624
 AcDbEntity
1325 1625
 100
1326 1626
 AcDbLine
1327 1627
   8
1328
-pocket
1628
+text
1329 1629
  62
1330 1630
 256
1331 1631
 370
... ...
@@ -1333,27 +1633,27 @@ pocket
1333 1633
   6
1334 1634
 ByLayer
1335 1635
  10
1336
-40.0
1636
+51.3888888888888715
1337 1637
  20
1338
-60.0
1638
+90.0
1339 1639
  30
1340 1640
 0.0
1341 1641
  11
1342
-20.0
1642
+51.3888888888888715
1343 1643
  21
1344
-60.0
1644
+70.0
1345 1645
  31
1346 1646
 0.0
1347 1647
   0
1348 1648
 LINE
1349 1649
   5
1350
-47
1650
+52
1351 1651
 100
1352 1652
 AcDbEntity
1353 1653
 100
1354 1654
 AcDbLine
1355 1655
   8
1356
-pocket
1656
+text
1357 1657
  62
1358 1658
 256
1359 1659
 370
... ...
@@ -1361,27 +1661,27 @@ pocket
1361 1661
   6
1362 1662
 ByLayer
1363 1663
  10
1364
-20.0
1664
+51.3888888888888715
1365 1665
  20
1366
-60.0
1666
+70.0
1367 1667
  30
1368 1668
 0.0
1369 1669
  11
1370
-20.0
1670
+60.2777777777777573
1371 1671
  21
1372
-20.0
1672
+70.0
1373 1673
  31
1374 1674
 0.0
1375 1675
   0
1376 1676
 LINE
1377 1677
   5
1378
-48
1678
+53
1379 1679
 100
1380 1680
 AcDbEntity
1381 1681
 100
1382 1682
 AcDbLine
1383 1683
   8
1384
-pocket
1684
+text
1385 1685
  62
1386 1686
 256
1387 1687
 370
... ...
@@ -1389,27 +1689,27 @@ pocket
1389 1689
   6
1390 1690
 ByLayer
1391 1691
  10
1392
-20.0
1692
+81.9444444444444571
1393 1693
  20
1394
-20.0
1694
+70.0
1395 1695
  30
1396 1696
 0.0
1397 1697
  11
1398
-100.0
1698
+81.9444444444444571
1399 1699
  21
1400
-20.0
1700
+90.0
1401 1701
  31
1402 1702
 0.0
1403 1703
   0
1404 1704
 LINE
1405 1705
   5
1406
-49
1706
+54
1407 1707
 100
1408 1708
 AcDbEntity
1409 1709
 100
1410 1710
 AcDbLine
1411 1711
   8
1412
-pocket
1712
+text
1413 1713
  62
1414 1714
 256
1415 1715
 370
... ...
@@ -1417,27 +1717,27 @@ pocket
1417 1717
   6
1418 1718
 ByLayer
1419 1719
  10
1420
-100.0
1720
+81.9444444444444571
1421 1721
  20
1422
-20.0
1722
+90.0
1423 1723
  30
1424 1724
 0.0
1425 1725
  11
1426
-100.0
1726
+88.6111111111111143
1427 1727
  21
1428
-60.0
1728
+78.8888888888888857
1429 1729
  31
1430 1730
 0.0
1431 1731
   0
1432 1732
 LINE
1433 1733
   5
1434
-4A
1734
+55
1435 1735
 100
1436 1736
 AcDbEntity
1437 1737
 100
1438 1738
 AcDbLine
1439 1739
   8
1440
-pocket
1740
+text
1441 1741
  62
1442 1742
 256
1443 1743
 370
... ...
@@ -1445,27 +1745,27 @@ pocket
1445 1745
   6
1446 1746
 ByLayer
1447 1747
  10
1448
-40.0
1748
+88.6111111111111143
1449 1749
  20
1450
-30.0
1750
+78.8888888888888857
1451 1751
  30
1452 1752
 0.0
1453 1753
  11
1454
-40.0
1754
+95.2777777777777999
1455 1755
  21
1456
-60.0
1756
+90.0
1457 1757
  31
1458 1758
 0.0
1459 1759
   0
1460 1760
 LINE
1461 1761
   5
1462
-4B
1762
+56
1463 1763
 100
1464 1764
 AcDbEntity
1465 1765
 100
1466 1766
 AcDbLine
1467 1767
   8
1468
-pocket
1768
+text
1469 1769
  62
1470 1770
 256
1471 1771
 370
... ...
@@ -1473,27 +1773,27 @@ pocket
1473 1773
   6
1474 1774
 ByLayer
1475 1775
  10
1476
-80.0
1776
+95.2777777777777999
1477 1777
  20
1478
-60.0
1778
+90.0
1479 1779
  30
1480 1780
 0.0
1481 1781
  11
1482
-80.0
1782
+95.2777777777777999
1483 1783
  21
1484
-30.0
1784
+70.0
1485 1785
  31
1486 1786
 0.0
1487 1787
   0
1488 1788
 LINE
1489 1789
   5
1490
-4C
1790
+57
1491 1791
 100
1492 1792
 AcDbEntity
1493 1793
 100
1494 1794
 AcDbLine
1495 1795
   8
1496
-pocket
1796
+text
1497 1797
  62
1498 1798
 256
1499 1799
 370
... ...
@@ -1501,27 +1801,83 @@ pocket
1501 1801
   6
1502 1802
 ByLayer
1503 1803
  10
1504
-80.0
1804
+110.8333333333333428
1505 1805
  20
1506
-30.0
1806
+90.0
1807
+ 30
1808
+0.0
1809
+ 11
1810
+101.9444444444444571
1811
+ 21
1812
+90.0
1813
+ 31
1814
+0.0
1815
+  0
1816
+LINE
1817
+  5
1818
+58
1819
+100
1820
+AcDbEntity
1821
+100
1822
+AcDbLine
1823
+  8
1824
+text
1825
+ 62
1826
+256
1827
+370
1828
+-1
1829
+  6
1830
+ByLayer
1831
+ 10
1832
+101.9444444444444571
1833
+ 20
1834
+90.0
1835
+ 30
1836
+0.0
1837
+ 11
1838
+101.9444444444444571
1839
+ 21
1840
+70.0
1841
+ 31
1842
+0.0
1843
+  0
1844
+LINE
1845
+  5
1846
+59
1847
+100
1848
+AcDbEntity
1849
+100
1850
+AcDbLine
1851
+  8
1852
+text
1853
+ 62
1854
+256
1855
+370
1856
+-1
1857
+  6
1858
+ByLayer
1859
+ 10
1860
+101.9444444444444571
1861
+ 20
1862
+70.0
1507 1863
  30
1508 1864
 0.0
1509 1865
  11
1510
-40.0
1866
+110.8333333333333428
1511 1867
  21
1512
-30.0
1868
+70.0
1513 1869
  31
1514 1870
 0.0
1515 1871
   0
1516 1872
 LINE
1517 1873
   5
1518
-4D
1874
+5A
1519 1875
 100
1520 1876
 AcDbEntity
1521 1877
 100
1522 1878
 AcDbLine
1523 1879
   8
1524
-pocket
1880
+text
1525 1881
  62
1526 1882
 256
1527 1883
 370
... ...
@@ -1529,27 +1885,27 @@ pocket
1529 1885
   6
1530 1886
 ByLayer
1531 1887
  10
1532
-80.0
1888
+101.9444444444444571
1533 1889
  20
1534
-60.0
1890
+81.1111111111111143
1535 1891
  30
1536 1892
 0.0
1537 1893
  11
1538
-100.0
1894
+108.6111111111111143
1539 1895
  21
1540
-60.0
1896
+81.1111111111111143
1541 1897
  31
1542 1898
 0.0
1543 1899
   0
1544
-LINE
1900
+CIRCLE
1545 1901
   5
1546
-4E
1902
+5B
1547 1903
 100
1548 1904
 AcDbEntity
1549 1905
 100
1550
-AcDbLine
1906
+AcDbCircle
1551 1907
   8
1552
-0
1908
+inner
1553 1909
  62
1554 1910
 256
1555 1911
 370
... ...
@@ -1557,27 +1913,23 @@ AcDbLine
1557 1913
   6
1558 1914
 ByLayer
1559 1915
  10
1560
-110.0
1916
+60.0
1561 1917
  20
1562
-10.0
1918
+50.0
1563 1919
  30
1564 1920
 0.0
1565
- 11
1566
-10.0
1567
- 21
1921
+ 40
1568 1922
 10.0
1569
- 31
1570
-0.0
1571 1923
   0
1572 1924
 LINE
1573 1925
   5
1574
-4F
1926
+5C
1575 1927
 100
1576 1928
 AcDbEntity
1577 1929
 100
1578 1930
 AcDbLine
1579 1931
   8
1580
-0
1932
+pocket
1581 1933
  62
1582 1934
 256
1583 1935
 370
... ...
@@ -1587,25 +1939,25 @@ ByLayer
1587 1939
  10
1588 1940
 10.0
1589 1941
  20
1590
-10.0
1942
+60.0
1591 1943
  30
1592 1944
 0.0
1593 1945
  11
1594 1946
 10.0
1595 1947
  21
1596
-70.0
1948
+10.0
1597 1949
  31
1598 1950
 0.0
1599 1951
   0
1600 1952
 LINE
1601 1953
   5
1602
-50
1954
+5D
1603 1955
 100
1604 1956
 AcDbEntity
1605 1957
 100
1606 1958
 AcDbLine
1607 1959
   8
1608
-0
1960
+pocket
1609 1961
  62
1610 1962
 256
1611 1963
 370
... ...
@@ -1613,25 +1965,25 @@ AcDbLine
1613 1965
   6
1614 1966
 ByLayer
1615 1967
  10
1616
-110.0
1968
+10.0
1617 1969
  20
1618
-70.0
1970
+10.0
1619 1971
  30
1620 1972
 0.0
1621 1973
  11
1622
-110.0
1974
+50.0
1623 1975
  21
1624 1976
 10.0
1625 1977
  31
1626 1978
 0.0
1627 1979
   0
1628
-CIRCLE
1980
+LINE
1629 1981
   5
1630
-51
1982
+5E
1631 1983
 100
1632 1984
 AcDbEntity
1633 1985
 100
1634
-AcDbCircle
1986
+AcDbLine
1635 1987
   8
1636 1988
 pocket
1637 1989
  62
... ...
@@ -1641,23 +1993,27 @@ pocket
1641 1993
   6
1642 1994
 ByLayer
1643 1995
  10
1644
-60.0
1645
- 20
1646 1996
 50.0
1997
+ 20
1998
+10.0
1647 1999
  30
1648 2000
 0.0
1649
- 40
1650
-10.0
2001
+ 11
2002
+50.0
2003
+ 21
2004
+30.0
2005
+ 31
2006
+0.0
1651 2007
   0
1652 2008
 LINE
1653 2009
   5
1654
-52
2010
+5F
1655 2011
 100
1656 2012
 AcDbEntity
1657 2013
 100
1658 2014
 AcDbLine
1659 2015
   8
1660
-text
2016
+pocket
1661 2017
  62
1662 2018
 256
1663 2019
 370
... ...
@@ -1665,27 +2021,27 @@ text
1665 2021
   6
1666 2022
 ByLayer
1667 2023
  10
1668
-9.1666666666666572
2024
+40.0
1669 2025
  20
1670
-80.0000000000000142
2026
+60.0
1671 2027
  30
1672 2028
 0.0
1673 2029
  11
1674
-9.1666666666666572
2030
+10.0
1675 2031
  21
1676
-100.0000000000000142
2032
+60.0
1677 2033
  31
1678 2034
 0.0
1679 2035
   0
1680 2036
 LINE
1681 2037
   5
1682
-53
2038
+60
1683 2039
 100
1684 2040
 AcDbEntity
1685 2041
 100
1686 2042
 AcDbLine
1687 2043
   8
1688
-text
2044
+pocket
1689 2045
  62
1690 2046
 256
1691 2047
 370
... ...
@@ -1693,27 +2049,27 @@ text
1693 2049
   6
1694 2050
 ByLayer
1695 2051
  10
1696
-9.1666666666666572
2052
+50.0
1697 2053
  20
1698
-100.0000000000000142
2054
+30.0
1699 2055
  30
1700 2056
 0.0
1701 2057
  11
1702
-15.8333333333333286
2058
+40.0
1703 2059
  21
1704
-88.8888888888888999
2060
+30.0
1705 2061
  31
1706 2062
 0.0
1707 2063
   0
1708 2064
 LINE
1709 2065
   5
1710
-54
2066
+61
1711 2067
 100
1712 2068
 AcDbEntity
1713 2069
 100
1714 2070
 AcDbLine
1715 2071
   8
1716
-text
2072
+pocket
1717 2073
  62
1718 2074
 256
1719 2075
 370
... ...
@@ -1721,27 +2077,27 @@ text
1721 2077
   6
1722 2078
 ByLayer
1723 2079
  10
1724
-15.8333333333333286
2080
+40.0
1725 2081
  20
1726
-88.8888888888888999
2082
+30.0
1727 2083
  30
1728 2084
 0.0
1729 2085
  11
1730
-22.4999999999999858
2086
+40.0
1731 2087
  21
1732
-100.0000000000000142
2088
+60.0
1733 2089
  31
1734 2090
 0.0
1735 2091
   0
1736 2092
 LINE
1737 2093
   5
1738
-55
2094
+62
1739 2095
 100
1740 2096
 AcDbEntity
1741 2097
 100
1742 2098
 AcDbLine
1743 2099
   8
1744
-text
2100
+pocket
1745 2101
  62
1746 2102
 256
1747 2103
 370
... ...
@@ -1749,27 +2105,27 @@ text
1749 2105
   6
1750 2106
 ByLayer
1751 2107
  10
1752
-22.4999999999999858
2108
+20.0
1753 2109
  20
1754
-100.0000000000000142
2110
+50.0
1755 2111
  30
1756 2112
 0.0
1757 2113
  11
1758
-22.4999999999999858
2114
+30.0
1759 2115
  21
1760
-80.0000000000000142
2116
+50.0
1761 2117
  31
1762 2118
 0.0
1763 2119
   0
1764 2120
 LINE
1765 2121
   5
1766
-56
2122
+63
1767 2123
 100
1768 2124
 AcDbEntity
1769 2125
 100
1770 2126
 AcDbLine
1771 2127
   8
1772
-text
2128
+pocket
1773 2129
  62
1774 2130
 256
1775 2131
 370
... ...
@@ -1777,27 +2133,27 @@ text
1777 2133
   6
1778 2134
 ByLayer
1779 2135
  10
1780
-29.1666666666666572
2136
+30.0
1781 2137
  20
1782
-100.0000000000000142
2138
+50.0
1783 2139
  30
1784 2140
 0.0
1785 2141
  11
1786
-29.1666666666666572
2142
+30.0
1787 2143
  21
1788
-80.0000000000000142
2144
+30.0
1789 2145
  31
1790 2146
 0.0
1791 2147
   0
1792 2148
 LINE
1793 2149
   5
1794
-57
2150
+64
1795 2151
 100
1796 2152
 AcDbEntity
1797 2153
 100
1798 2154
 AcDbLine
1799 2155
   8
1800
-text
2156
+pocket
1801 2157
  62
1802 2158
 256
1803 2159
 370
... ...
@@ -1805,27 +2161,27 @@ text
1805 2161
   6
1806 2162
 ByLayer
1807 2163
  10
1808
-35.8333333333333286
2164
+30.0
1809 2165
  20
1810
-100.0
2166
+30.0
1811 2167
  30
1812 2168
 0.0
1813 2169
  11
1814
-35.8333333333333286
2170
+20.0
1815 2171
  21
1816
-80.0
2172
+30.0
1817 2173
  31
1818 2174
 0.0
1819 2175
   0
1820 2176
 LINE
1821 2177
   5
1822
-58
2178
+65
1823 2179
 100
1824 2180
 AcDbEntity
1825 2181
 100
1826 2182
 AcDbLine
1827 2183
   8
1828
-text
2184
+pocket
1829 2185
  62
1830 2186
 256
1831 2187
 370
... ...
@@ -1833,27 +2189,27 @@ text
1833 2189
   6
1834 2190
 ByLayer
1835 2191
  10
1836
-35.8333333333333286
2192
+20.0
1837 2193
  20
1838
-80.0
2194
+30.0
1839 2195
  30
1840 2196
 0.0
1841 2197
  11
1842
-44.7222222222222143
2198
+20.0
1843 2199
  21
1844
-80.0
2200
+50.0
1845 2201
  31
1846 2202
 0.0
1847 2203
   0
1848 2204
 LINE
1849 2205
   5
1850
-59
2206
+66
1851 2207
 100
1852 2208
 AcDbEntity
1853 2209
 100
1854 2210
 AcDbLine
1855 2211
   8
1856
-text
2212
+pocket
1857 2213
  62
1858 2214
 256
1859 2215
 370
... ...
@@ -1861,27 +2217,27 @@ text
1861 2217
   6
1862 2218
 ByLayer
1863 2219
  10
1864
-51.3888888888888715
2220
+110.0
1865 2221
  20
1866
-100.0
2222
+60.0
1867 2223
  30
1868 2224
 0.0
1869 2225
  11
1870
-51.3888888888888715
2226
+110.0
1871 2227
  21
1872
-80.0
2228
+10.0
1873 2229
  31
1874 2230
 0.0
1875 2231
   0
1876 2232
 LINE
1877 2233
   5
1878
-5A
2234
+67
1879 2235
 100
1880 2236
 AcDbEntity
1881 2237
 100
1882 2238
 AcDbLine
1883 2239
   8
1884
-text
2240
+pocket
1885 2241
  62
1886 2242
 256
1887 2243
 370
... ...
@@ -1889,27 +2245,27 @@ text
1889 2245
   6
1890 2246
 ByLayer
1891 2247
  10
1892
-51.3888888888888715
2248
+110.0
1893 2249
  20
1894
-80.0
2250
+10.0
1895 2251
  30
1896 2252
 0.0
1897 2253
  11
1898
-60.2777777777777573
2254
+70.0
1899 2255
  21
1900
-80.0
2256
+10.0
1901 2257
  31
1902 2258
 0.0
1903 2259
   0
1904 2260
 LINE
1905 2261
   5
1906
-5B
2262
+68
1907 2263
 100
1908 2264
 AcDbEntity
1909 2265
 100
1910 2266
 AcDbLine
1911 2267
   8
1912
-text
2268
+pocket
1913 2269
  62
1914 2270
 256
1915 2271
 370
... ...
@@ -1917,27 +2273,27 @@ text
1917 2273
   6
1918 2274
 ByLayer
1919 2275
  10
1920
-81.9444444444444571
2276
+70.0
1921 2277
  20
1922
-80.0
2278
+10.0
1923 2279
  30
1924 2280
 0.0
1925 2281
  11
1926
-81.9444444444444571
2282
+70.0
1927 2283
  21
1928
-100.0
2284
+30.0
1929 2285
  31
1930 2286
 0.0
1931 2287
   0
1932 2288
 LINE
1933 2289
   5
1934
-5C
2290
+69
1935 2291
 100
1936 2292
 AcDbEntity
1937 2293
 100
1938 2294
 AcDbLine
1939 2295
   8
1940
-text
2296
+pocket
1941 2297
  62
1942 2298
 256
1943 2299
 370
... ...
@@ -1945,27 +2301,27 @@ text
1945 2301
   6
1946 2302
 ByLayer
1947 2303
  10
1948
-81.9444444444444571
2304
+80.0
1949 2305
  20
1950
-100.0
2306
+60.0
1951 2307
  30
1952 2308
 0.0
1953 2309
  11
1954
-88.6111111111111143
2310
+110.0
1955 2311
  21
1956
-88.8888888888888857
2312
+60.0
1957 2313
  31
1958 2314
 0.0
1959 2315
   0
1960 2316
 LINE
1961 2317
   5
1962
-5D
2318
+6A
1963 2319
 100
1964 2320
 AcDbEntity
1965 2321
 100
1966 2322
 AcDbLine
1967 2323
   8
1968
-text
2324
+pocket
1969 2325
  62
1970 2326
 256
1971 2327
 370
... ...
@@ -1973,27 +2329,27 @@ text
1973 2329
   6
1974 2330
 ByLayer
1975 2331
  10
1976
-88.6111111111111143
2332
+70.0
1977 2333
  20
1978
-88.8888888888888857
2334
+30.0
1979 2335
  30
1980 2336
 0.0
1981 2337
  11
1982
-95.2777777777777999
2338
+80.0
1983 2339
  21
1984
-100.0
2340
+30.0
1985 2341
  31
1986 2342
 0.0
1987 2343
   0
1988 2344
 LINE
1989 2345
   5
1990
-5E
2346
+6B
1991 2347
 100
1992 2348
 AcDbEntity
1993 2349
 100
1994 2350
 AcDbLine
1995 2351
   8
1996
-text
2352
+pocket
1997 2353
  62
1998 2354
 256
1999 2355
 370
... ...
@@ -2001,27 +2357,27 @@ text
2001 2357
   6
2002 2358
 ByLayer
2003 2359
  10
2004
-95.2777777777777999
2360
+80.0
2005 2361
  20
2006
-100.0
2362
+30.0
2007 2363
  30
2008 2364
 0.0
2009 2365
  11
2010
-95.2777777777777999
2011
- 21
2012 2366
 80.0
2367
+ 21
2368
+60.0
2013 2369
  31
2014 2370
 0.0
2015 2371
   0
2016 2372
 LINE
2017 2373
   5
2018
-5F
2374
+6C
2019 2375
 100
2020 2376
 AcDbEntity
2021 2377
 100
2022 2378
 AcDbLine
2023 2379
   8
2024
-text
2380
+pocket
2025 2381
  62
2026 2382
 256
2027 2383
 370
... ...
@@ -2029,27 +2385,27 @@ text
2029 2385
   6
2030 2386
 ByLayer
2031 2387
  10
2032
-110.8333333333333428
2033
- 20
2034 2388
 100.0
2389
+ 20
2390
+50.0
2035 2391
  30
2036 2392
 0.0
2037 2393
  11
2038
-101.9444444444444571
2394
+90.0
2039 2395
  21
2040
-100.0
2396
+50.0
2041 2397
  31
2042 2398
 0.0
2043 2399
   0
2044 2400
 LINE
2045 2401
   5
2046
-60
2402
+6D
2047 2403
 100
2048 2404
 AcDbEntity
2049 2405
 100
2050 2406
 AcDbLine
2051 2407
   8
2052
-text
2408
+pocket
2053 2409
  62
2054 2410
 256
2055 2411
 370
... ...
@@ -2057,27 +2413,27 @@ text
2057 2413
   6
2058 2414
 ByLayer
2059 2415
  10
2060
-101.9444444444444571
2416
+90.0
2061 2417
  20
2062
-100.0
2418
+50.0
2063 2419
  30
2064 2420
 0.0
2065 2421
  11
2066
-101.9444444444444571
2422
+90.0
2067 2423
  21
2068
-80.0
2424
+29.9999999999999964
2069 2425
  31
2070 2426
 0.0
2071 2427
   0
2072 2428
 LINE
2073 2429
   5
2074
-61
2430
+6E
2075 2431
 100
2076 2432
 AcDbEntity
2077 2433
 100
2078 2434
 AcDbLine
2079 2435
   8
2080
-text
2436
+pocket
2081 2437
  62
2082 2438
 256
2083 2439
 370
... ...
@@ -2085,27 +2441,27 @@ text
2085 2441
   6
2086 2442
 ByLayer
2087 2443
  10
2088
-101.9444444444444571
2444
+90.0
2089 2445
  20
2090
-80.0
2446
+29.9999999999999964
2091 2447
  30
2092 2448
 0.0
2093 2449
  11
2094
-110.8333333333333428
2450
+100.0
2095 2451
  21
2096
-80.0
2452
+30.0000000000000036
2097 2453
  31
2098 2454
 0.0
2099 2455
   0
2100 2456
 LINE
2101 2457
   5
2102
-62
2458
+6F
2103 2459
 100
2104 2460
 AcDbEntity
2105 2461
 100
2106 2462
 AcDbLine
2107 2463
   8
2108
-text
2464
+pocket
2109 2465
  62
2110 2466
 256
2111 2467
 370
... ...
@@ -2113,15 +2469,15 @@ text
2113 2469
   6
2114 2470
 ByLayer
2115 2471
  10
2116
-101.9444444444444571
2472
+100.0
2117 2473
  20
2118
-91.1111111111111143
2474
+30.0000000000000036
2119 2475
  30
2120 2476
 0.0
2121 2477
  11
2122
-108.6111111111111143
2478
+100.0
2123 2479
  21
2124
-91.1111111111111143
2480
+50.0
2125 2481
  31
2126 2482
 0.0
2127 2483
   0
... ...
@@ -2163,7 +2519,7 @@ E
2163 2519
   3
2164 2520
 AcDbVariableDictionary
2165 2521
 350
2166
-63
2522
+70
2167 2523
   0
2168 2524
 DICTIONARY
2169 2525
   5
... ...
@@ -2627,7 +2983,7 @@ Layout2
2627 2983
   0
2628 2984
 DICTIONARY
2629 2985
   5
2630
-63
2986
+70
2631 2987
 100
2632 2988
 AcDbDictionary
2633 2989
 281
... ...
@@ -2635,15 +2991,15 @@ AcDbDictionary
2635 2991
   3
2636 2992
 DIMASSOC
2637 2993
 350
2638
-65
2994
+72
2639 2995
   3
2640 2996
 HIDETEXT
2641 2997
 350
2642
-64
2998
+71
2643 2999
   0
2644 3000
 DICTIONARYVAR
2645 3001
   5
2646
-64
3002
+71
2647 3003
 100
2648 3004
 DictionaryVariables
2649 3005
 280
... ...
@@ -2653,7 +3009,7 @@ DictionaryVariables
2653 3009
   0
2654 3010
 DICTIONARYVAR
2655 3011
   5
2656
-65
3012
+72
2657 3013
 100
2658 3014
 DictionaryVariables
2659 3015
 280
... ...
@@ -9,17 +9,24 @@ set_precision 0.01
9 9
 set_tool_diameter 3
10 10
 set_move_z 3
11 11
 set_base_z 0
12
-set_cut_z -2
13 12
 set_cut_z_step 1
14 13
 set_feed_drill 100
15 14
 set_feed_mill 200
16 15
 
17 16
 read_dxf millme.dxf
18 17
 
19
-cut 0
20
-#cut_pocket pocket
18
+set_cut_z -1
21 19
 cut text
22 20
 
21
+set_cut_z -2
22
+cut_pocket pocket
23
+
24
+set_cut_z -3
25
+cut_inside inner
26
+
27
+set_cut_z -3
28
+cut_outside 0
29
+
23 30
 cmd M2
24 31
 
25 32
 write_ngc millme.ngc
... ...
@@ -13,8 +13,62 @@
13 13
 #include "drawing.h"
14 14
 #include "filename.h"
15 15
 #include "gcode.h"
16
+#include "polygons.h"
16 17
 #include "settings.h"
17 18
 
19
+/**
20
+ * @brief get layer by name from stream
21
+ * @param[in] strm stream to read layer name from
22
+ * @param[out] name layer name from stream
23
+ * @param[out] layer layer indicated by name from stream
24
+ * @return if layer could be found
25
+ */
26
+bool CmdParser::getLayer(std::istream &strm, std::string &name,
27
+                         const Layer *&layer) const
28
+{
29
+  // get layer name argument
30
+  strm >> name;
31
+  if (strm.fail()) {
32
+    std::cerr << "missing layer name" << std::endl;
33
+    return false;
34
+  }
35
+
36
+  // get layer
37
+  Drawing::Layers::const_iterator itLayer = mDrawing.mLayers.find(name);
38
+  if (itLayer == mDrawing.mLayers.end()) {
39
+    std::cerr << "layer \"" << name << "\" not found" << std::endl;
40
+    return false;
41
+  }
42
+  layer = &itLayer->second;
43
+
44
+  return true;
45
+}
46
+
47
+/**
48
+ * @brief get layer by name from stream and convert to polygons
49
+ * @param[in] strm stream to read layer name from
50
+ * @param[out] name layer name from stream
51
+ * @param[out] layer layer indicated by name from stream
52
+ * @param[in,out] polys polygons created from layer
53
+ * @return if layer could be found and converted to polygons
54
+ */
55
+bool CmdParser::getLayerPolys(std::istream &strm, std::string &name,
56
+                              const Layer *&layer, Polygons &polys) const
57
+{
58
+  // get layer
59
+  if (!getLayer(strm, name, layer))
60
+    return false;
61
+
62
+  // convert layer to polygons
63
+  if (!polys.loadLayer(*layer, mSettings.precision)) {
64
+    std::cerr << "cannot convert layer \"" << name << "\" to polygons"
65
+              << std::endl;
66
+    return false;
67
+  }
68
+
69
+  return true;
70
+}
71
+
18 72
 /**
19 73
  * @brief process cmd command
20 74
  * @param[in] strm stream to read command arguments from
... ...
@@ -40,23 +94,77 @@ bool CmdParser::procCmd_cmd(std::istream &strm)
40 94
  */
41 95
 bool CmdParser::procCmd_cut(std::istream &strm)
42 96
 {
43
-  // get arguments
97
+  // get layer from arguments
44 98
   std::string layerName;
45
-  strm >> layerName;
46
-  if (strm.fail()) {
47
-    std::cerr << "missing layer name" << std::endl;
99
+  const Layer *layer;
100
+  if (!getLayer(strm, layerName, layer))
48 101
     return false;
102
+
103
+  // convert layer to G-code
104
+  layer->toGCode(mSettings, mGCode);
105
+
106
+  return true;
49 107
 }
50 108
 
51
-  // get layer
52
-  Drawing::Layers::const_iterator layer = mDrawing.mLayers.find(layerName);
53
-  if (layer == mDrawing.mLayers.end()) {
54
-    std::cerr << "layer \"" << layerName << "\" not found" << std::endl;
109
+/**
110
+ * @brief process cut_inside command
111
+ * @param[in] strm stream to read command arguments from
112
+ * @return if processing command was successful
113
+ */
114
+bool CmdParser::procCmd_cut_inside(std::istream &strm)
115
+{
116
+  // get layer from arguments and convert to polygons
117
+  std::string layerName;
118
+  const Layer *layer;
119
+  Polygons polys;
120
+  if (!getLayerPolys(strm, layerName, layer, polys))
121
+    return false;
122
+
123
+  // TODO
124
+  std::cerr << "TODO: cut_inside" << std::endl;
55 125
   return false;
126
+
127
+  return true;
56 128
 }
57 129
 
58
-  // convert layer to G-code
59
-  layer->second.toGCode(mSettings, mGCode);
130
+/**
131
+ * @brief process cut_outside command
132
+ * @param[in] strm stream to read command arguments from
133
+ * @return if processing command was successful
134
+ */
135
+bool CmdParser::procCmd_cut_outside(std::istream &strm)
136
+{
137
+  // get layer from arguments and convert to polygons
138
+  std::string layerName;
139
+  const Layer *layer;
140
+  Polygons polys;
141
+  if (!getLayerPolys(strm, layerName, layer, polys))
142
+    return false;
143
+
144
+  // TODO
145
+  std::cerr << "TODO: cut_outside" << std::endl;
146
+  return false;
147
+
148
+  return true;
149
+}
150
+
151
+/**
152
+ * @brief process cut_pocket command
153
+ * @param[in] strm stream to read command arguments from
154
+ * @return if processing command was successful
155
+ */
156
+bool CmdParser::procCmd_cut_pocket(std::istream &strm)
157
+{
158
+  // get layer from arguments and convert to polygons
159
+  std::string layerName;
160
+  const Layer *layer;
161
+  Polygons polys;
162
+  if (!getLayerPolys(strm, layerName, layer, polys))
163
+    return false;
164
+
165
+  // TODO
166
+  std::cerr << "TODO: cut_pocket" << std::endl;
167
+  return false;
60 168
 
61 169
   return true;
62 170
 }
... ...
@@ -323,6 +431,12 @@ bool CmdParser::procLine(const std::string &strLine)
323 431
     return procCmd_cmd(strm);
324 432
   else if (cmd == "cut")
325 433
     return procCmd_cut(strm);
434
+  else if (cmd == "cut_inside")
435
+    return procCmd_cut_inside(strm);
436
+  else if (cmd == "cut_outside")
437
+    return procCmd_cut_outside(strm);
438
+  else if (cmd == "cut_pocket")
439
+    return procCmd_cut_pocket(strm);
326 440
   else if (cmd == "read_dxf")
327 441
     return procCmd_read_dxf(strm);
328 442
   else if (cmd == "set_base_z")
... ...
@@ -9,13 +9,36 @@
9 9
 #include <iostream>
10 10
 #include <string>
11 11
 
12
-#include "gcode.h"
13 12
 #include "drawing.h"
13
+#include "gcode.h"
14
+#include "layer.h"
15
+#include "polygons.h"
14 16
 #include "settings.h"
15 17
 
16 18
 /// command parser
17 19
 class CmdParser {
18 20
 public:
21
+  /**
22
+   * @brief get layer by name from stream
23
+   * @param[in] strm stream to read layer name from
24
+   * @param[out] name layer name from stream
25
+   * @param[out] layer layer indicated by name from stream
26
+   * @return if layer could be found
27
+   */
28
+  bool getLayer(std::istream &strm, std::string &name,
29
+                const Layer *&layer) const;
30
+
31
+  /**
32
+   * @brief get layer by name from stream and convert to polygons
33
+   * @param[in] strm stream to read layer name from
34
+   * @param[out] name layer name from stream
35
+   * @param[out] layer layer indicated by name from stream
36
+   * @param[in,out] polys polygons created from layer
37
+   * @return if layer could be found and converted to polygons
38
+   */
39
+  bool getLayerPolys(std::istream &strm, std::string &name,
40
+                     const Layer *&layer, Polygons &polys) const;
41
+
19 42
   /**
20 43
    * @brief process cmd command
21 44
    * @param[in] strm stream to read command arguments from
... ...
@@ -30,6 +53,27 @@ public:
30 53
    */
31 54
   bool procCmd_cut(std::istream &strm);
32 55
 
56
+  /**
57
+   * @brief process cut_inside command
58
+   * @param[in] strm stream to read command arguments from
59
+   * @return if processing command was successful
60
+   */
61
+  bool procCmd_cut_inside(std::istream &strm);
62
+
63
+  /**
64
+   * @brief process cut_outside command
65
+   * @param[in] strm stream to read command arguments from
66
+   * @return if processing command was successful
67
+   */
68
+  bool procCmd_cut_outside(std::istream &strm);
69
+
70
+  /**
71
+   * @brief process cut_pocket command
72
+   * @param[in] strm stream to read command arguments from
73
+   * @return if processing command was successful
74
+   */
75
+  bool procCmd_cut_pocket(std::istream &strm);
76
+
33 77
   /**
34 78
    * @brief process read_dxf command
35 79
    * @param[in] strm stream to read command arguments from
... ...
@@ -0,0 +1,149 @@
1
+/* drawing (DXF) to G-code (NGC) converter
2
+ * Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
3
+ * Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
4
+ */
5
+
6
+#include <boost/shared_ptr.hpp>
7
+#include <iostream>
8
+#include <vector>
9
+
10
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
11
+#include <CGAL/Polygon_2.h>
12
+#include <CGAL/Polygon_with_holes_2.h>
13
+#include <CGAL/create_offset_polygons_2.h>
14
+#include <CGAL/Boolean_set_operations_2.h>
15
+
16
+#include "layer.h"
17
+#include "path.h"
18
+#include "point.h"
19
+#include "polygons.h"
20
+
21
+/**
22
+ * @brief clear all polygons
23
+ */
24
+void Polygons::clear()
25
+{
26
+  mPolys.clear();
27
+}
28
+
29
+/**
30
+ * @brief add polygons from layer
31
+ * @param[in] layer layer to obtain the polygons from
32
+ * @param[in] eqDist maximum distance of two points to be considered equal
33
+ * @return if the layer could be converted to polygons and imported
34
+ */
35
+bool Polygons::addLayer(const Layer &layer, double eqDist)
36
+{
37
+  // convert all paths to simple polygons
38
+  CgPolyVec simples;
39
+  Layer::Paths::const_iterator path;
40
+  for (path = layer.mPaths.begin(); path != layer.mPaths.end(); ++path) {
41
+    // skip empty paths
42
+    if (path->mPoints.empty())
43
+      continue;
44
+    // check that path is closed
45
+    if (!path->mPoints.front().equals(path->mPoints.back(), eqDist)) {
46
+      std::cerr << "path not closed" << std::endl;
47
+      return false;
48
+    }
49
+    // create simple polygon from path
50
+    //   - do not add last point to polygon, as it is the same as the first one
51
+    CgPoly simple;
52
+    Path::Points::const_iterator pt;
53
+    for (pt = path->mPoints.begin(); pt + 1 != path->mPoints.end(); ++pt)
54
+      simple.push_back(CgPoint(pt->mX, pt->mY));
55
+    // check that polygon is simple
56
+    if (!simple.is_simple()) {
57
+      std::cerr << "path is not simple (maybe self-itersecting?)" << std::endl;
58
+      return false;
59
+    }
60
+    // ensure orientation is clockwise (must be the same for all polygons)
61
+    if (simple.is_clockwise_oriented())
62
+      simple.reverse_orientation();
63
+    // collect polygons
64
+    simples.push_back(simple);
65
+  } // for path
66
+
67
+  // check that no partly overlaps are present
68
+  // deterine which polygon is contained in which one
69
+  std::vector<ssize_t> contained_in; // idx: contained poly, val: containing poly
70
+  ssize_t ia, ib;
71
+  CgPolyVec::const_iterator a, b;
72
+  for (a = simples.begin(); a != simples.end(); ++a)
73
+    contained_in.push_back(-1); // not contained in any polygon
74
+  for (a = simples.begin(), ia = 0; a != simples.end(); ++a, ++ia) {
75
+    b = a;
76
+    ib = ia;
77
+    for (++b, ++ib; b != simples.end(); ++b, ++ib) {
78
+      // A and B intersect each other
79
+      if (CGAL::do_intersect(*a, *b)) {
80
+        // compute differences A - B and B - A
81
+        CgPolyHolesVec a_b, b_a;
82
+        CGAL::difference(*a, *b, std::back_inserter(a_b));
83
+        CGAL::difference(*b, *a, std::back_inserter(b_a));
84
+        if (a_b.empty()) {
85
+          // A and B are identical
86
+          if (b_a.empty()) {
87
+            std::cerr << "duplicate polygons found - meaning is undefined"
88
+                      << std::endl;
89
+            return false;
90
+          }
91
+          // B contains A (A is hole in B)
92
+          else {
93
+            if (contained_in.at(ia) >= 0) {
94
+              std::cerr << "polygon contained in multiple polygons"
95
+                           " - meaning is undefined" << std::endl;
96
+              return false;
97
+            }
98
+            contained_in.at(ia) = ib;
99
+          }
100
+        } else {
101
+          // A contains B (B is hole in A)
102
+          if (b_a.empty()) {
103
+            if (contained_in.at(ib) >= 0) {
104
+              std::cerr << "polygon contained in multiple polygons"
105
+                           " - meaning is undefined" << std::endl;
106
+              return false;
107
+            }
108
+            contained_in.at(ib) = ia;
109
+          }
110
+          // A and B overlap partly
111
+          else {
112
+            std::cerr << "polygons overlap partly - meaning is undefined"
113
+                      << std::endl;
114
+            return false;
115
+          }
116
+        }
117
+      }
118
+    } // for b
119
+  } // for a
120
+
121
+  // add found polygons to member variable
122
+  for (ia = 0; (size_t)ia < contained_in.size(); ++ia) {
123
+    // outer polygon
124
+    if (contained_in.at(ia) < 0) {
125
+      CgPolyHoles poly(simples.at(ia));
126
+      // find and add holes
127
+      for (ib = 0; (size_t)ib < contained_in.size(); ++ib)
128
+        if (contained_in.at(ib) == ia)
129
+          poly.add_hole(simples.at(ib));
130
+      // add polygon to member variable
131
+      mPolys.push_back(poly);
132
+    }
133
+  }
134
+
135
+  return true;
136
+}
137
+
138
+/**
139
+ * @brief load polygons from layer
140
+ * @param[in] layer layer to obtain the polygons from
141
+ * @param[in] eqDist maximum distance of two points to be considered equal
142
+ * @return if the layer could be converted to polygons and imported
143
+ */
144
+bool Polygons::loadLayer(const Layer &layer, double eqDist)
145
+{
146
+  clear();
147
+  return addLayer(layer, eqDist);
148
+}
149
+
... ...
@@ -0,0 +1,61 @@
1
+/* drawing (DXF) to G-code (NGC) converter
2
+ * Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
3
+ * Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
4
+ */
5
+
6
+#ifndef POLYGONS_H
7
+#define POLYGONS_H
8
+
9
+#include <boost/shared_ptr.hpp>
10
+#include <vector>
11
+
12
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
13
+#include <CGAL/Polygon_2.h>
14
+#include <CGAL/Polygon_with_holes_2.h>
15
+#include <CGAL/create_offset_polygons_2.h>
16
+
17
+#include "layer.h"
18
+
19
+/// a set of polygons
20
+class Polygons {
21
+public:
22
+  typedef CGAL::Exact_predicates_exact_constructions_kernel CgKern;
23
+  typedef CgKern::Point_2                                   CgPoint;
24
+  typedef CGAL::Polygon_2<CgKern>                           CgPoly;
25
+  typedef CGAL::Polygon_with_holes_2<CgKern>                CgPolyHoles;
26
+  typedef CGAL::Straight_skeleton_2<CgKern>                 CgSskel;
27
+  typedef std::vector<CgPoly>                               CgPolyVec;
28
+  typedef std::vector<CgPolyHoles>                          CgPolyHolesVec;
29
+  typedef boost::shared_ptr<CgPoly>                         CgPolyPtr;
30
+  typedef boost::shared_ptr<CgPolyHoles>                    CgPolyHolesPtr;
31
+  typedef boost::shared_ptr<CgSskel>                        CgSskelPtr;
32
+  typedef std::vector<CgPolyPtr>                            CgPolyPtrVec;
33
+  typedef std::vector<CgPolyHolesPtr>                       CgPolyHolesPtrVec;
34
+
35
+  /**
36
+   * @brief clear all polygons
37
+   */
38
+  void clear();
39
+
40
+  /**
41
+   * @brief add polygons from layer
42
+   * @param[in] layer layer to obtain the polygons from
43
+   * @param[in] eqDist maximum distance of two points to be considered equal
44
+   * @return if the layer could be converted to polygons and imported
45
+   */
46
+  bool addLayer(const Layer &layer, double eqDist);
47
+
48
+  /**
49
+   * @brief load polygons from layer
50
+   * @param[in] layer layer to obtain the polygons from
51
+   * @param[in] eqDist maximum distance of two points to be considered equal
52
+   * @return if the layer could be converted to polygons and imported
53
+   */
54
+  bool loadLayer(const Layer &layer, double eqDist);
55
+
56
+  /// polygons
57
+  CgPolyHolesVec mPolys;
58
+};
59
+
60
+#endif // #ifndef POLYGONS_H
61
+
0 62