Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/Clipper/Clipper Sample


Required plugins for this example: MBS Tools Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/Clipper/Clipper Sample

This example is the version from Wed, 9th Jan 2018.

Project "Clipper Sample.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Const text_clipping = "[[{""X"":""115.54"",""Y"":""216.41""},{""X"":""113.01"",""Y"":""217.26""},{""X"":""105.79"",""Y"":""218.58""},{""X"":""96.36"",""Y"":""219.18""},{""X"":""88.73"",""Y"":""218.69""},{""X"":""82.86"",""Y"":""217.48""},{""X"":""78.40"",""Y"":""215.73""},{""X"":""74.91"",""Y"":""213.42""},{""X"":""72.12"",""Y"":""210.49""},{""X"":""69.88"",""Y"":""206.77""},{""X"":""68.13"",""Y"":""201.83""},{""X"":""66.93"",""Y"":""195.19""},{""X"":""66.45"",""Y"":""186.51""},{""X"":""67.03"",""Y"":""179.19""},{""X"":""68.36"",""Y"":""173.03""},{""X"":""70.25"",""Y"":""168.30""},{""X"":""72.58"",""Y"":""164.82""},{""X"":""75.62"",""Y"":""161.94""},{""X"":""79.35"",""Y"":""159.71""},{""X"":""84.02"",""Y"":""158.09""},{""X"":""89.93"",""Y"":""157.11""},{""X"":""96.97"",""Y"":""156.93""},{""X"":""105.18"",""Y"":""157.69""},{""X"":""114.58"",""Y"":""159.65""},{""X"":""116.44"",""Y"":""168.59""},{""X"":""110.93"",""Y"":""166.65""},{""X"":""105.50"",""Y"":""165.51""},{""X"":""98.32"",""Y"":""165.06""},{""X"":""94.16"",""Y"":""165.58""},{""X"":""90.96"",""Y"":""166.82""},{""X"":""88.62"",""Y"":""168.68""},{""X"":""86.96"",""Y"":""171.17""},{""X"":""85.31"",""Y"":""175.67""},{""X"":""84.32"",""Y"":""181.28""},{""X"":""84.15"",""Y"":""188.62""},{""X"":""84.83"",""Y"":""196.53""},{""X"":""86.18"",""Y"":""202.53""},{""X"":""87.64"",""Y"":""205.97""},{""X"":""89.52"",""Y"":""208.29""},{""X"":""92.02"",""Y"":""209.92""},{""X"":""95.18"",""Y"":""210.85""},{""X"":""99.07"",""Y"":""210.96""},{""X"":""105.48"",""Y"":""210.28""},{""X"":""111.84"",""Y"":""208.54""},{""X"":""116.32"",""Y"":""206.45""},{""X"":""116.62"",""Y"":""206.17""},{""X"":""115.55"",""Y"":""216.31""},{""X"":""115.54"",""Y"":""216.41""}],[{""X"":""120.11"",""Y"":""219.00""},{""X"":""120.11"",""Y"":""132.31""},{""X"":""137.23"",""Y"":""132.31""},{""X"":""137.23"",""Y"":""219.00""},{""X"":""137.23"",""Y"":""219.00""},{""X"":""120.11"",""Y"":""219.00""}],[{""X"":""153.34"",""Y"":""132.13""},{""X"":""156.60"",""Y"":""132.56""},{""X"":""159.17"",""Y"":""133.77""},{""X"":""161.19"",""Y"":""135.77""},{""X"":""162.61"",""Y"":""138.40""},{""X"":""163.19"",""Y"":""141.48""},{""X"":""162.87"",""Y"":""144.75""},{""X"":""161.71"",""Y"":""147.51""},{""X"":""159.79"",""Y"":""149.80""},{""X"":""157.51"",""Y"":""151.22""},{""X"":""154.46"",""Y"":""151.96""},{""X"":""151.02"",""Y"":""151.84""},{""X"":""148.34"",""Y"":""150.92""},{""X"":""146.08"",""Y"":""149.20""},{""X"":""144.28"",""Y"":""146.63""},{""X"":""143.38"",""Y"":""143.78""},{""X"":""143.37"",""Y"":""140.64""},{""X"":""144.20"",""Y"":""137.77""},{""X"":""145.94"",""Y"":""135.15""},{""X"":""148.14"",""Y"":""133.37""},{""X"":""150.80"",""Y"":""132.38""},{""X"":""153.33"",""Y"":""132.13""},{""X"":""153.34"",""Y"":""132.13""}],[{""X"":""144.58"",""Y"":""219.00""},{""X"":""144.58"",""Y"":""157.06""},{""X"":""161.88"",""Y"":""157.06""},{""X"":""161.88"",""Y"":""219.00""},{""X"":""161.88"",""Y"":""219.00""},{""X"":""144.58"",""Y"":""219.00""}],[{""X"":""168.78"",""Y"":""243.93""},{""X"":""168.78"",""Y"":""157.06""},{""X"":""186.09"",""Y"":""157.06""},{""X"":""186.19"",""Y"":""161.44""},{""X"":""191.55"",""Y"":""158.75""},{""X"":""196.41"",""Y"":""157.22""},{""X"":""201.17"",""Y"":""156.70""},{""X"":""207.60"",""Y"":""157.21""},{""X"":""212.99"",""Y"":""158.51""},{""X"":""216.03"",""Y"":""160.11""},{""X"":""219.02"",""Y"":""162.82""},{""X"":""222.00"",""Y"":""166.95""},{""X"":""223.86"",""Y"":""171.04""},{""X"":""225.25"",""Y"":""176.56""},{""X"":""226.01"",""Y"":""184.02""},{""X"":""225.94"",""Y"":""191.67""},{""X"":""225.03"",""Y"":""199.56""},{""X"":""223.55"",""Y"":""205.37""},{""X"":""221.48"",""Y"":""209.86""},{""X"":""218.90"",""Y"":""213.53""},{""X"":""216.12"",""Y"":""216.03""},{""X"":""213.05"",""Y"":""217.58""},{""X"":""207.99"",""Y"":""218.94""},{""X"":""201.87"",""Y"":""219.54""},{""X"":""195.30"",""Y"":""219.05""},{""X"":""189.90"",""Y"":""217.79""},{""X"":""186.09"",""Y"":""216.23""},{""X"":""186.09"",""Y"":""243.93""},{""X"":""186.09"",""Y"":""243.93""},{""X"":""168.78"",""Y"":""243.93""}],[{""X"":""186.09"",""Y"":""170.27""},{""X"":""186.13"",""Y"":""208.05""},{""X"":""189.79"",""Y"":""210.09""},{""X"":""193.53"",""Y"":""211.16""},{""X"":""197.86"",""Y"":""211.53""},{""X"":""201.86"",""Y"":""210.97""},{""X"":""204.91"",""Y"":""209.73""},{""X"":""207.25"",""Y"":""207.87""},{""X"":""209.01"",""Y"":""205.27""},{""X"":""210.72"",""Y"":""200.64""},{""X"":""211.90"",""Y"":""194.30""},{""X"":""212.32"",""Y"":""186.82""},{""X"":""211.80"",""Y"":""179.19""},{""X"":""210.69"",""Y"":""174.07""},{""X"":""209.11"",""Y"":""170.68""},{""X"":""207.06"",""Y"":""168.30""},{""X"":""204.40"",""Y"":""166.63""},{""X"":""200.81"",""Y"":""165.59""},{""X"":""196.18"",""Y"":""165.25""},{""X"":""192.24"",""Y"":""166.16""},{""X"":""188.91"",""Y"":""167.87""},{""X"":""186.21"",""Y"":""169.99""},{""X"":""186.09"",""Y"":""170.26""},{""X"":""186.09"",""Y"":""170.27""}],[{""X"":""231.09"",""Y"":""243.93""},{""X"":""231.09"",""Y"":""157.06""},{""X"":""248.39"",""Y"":""157.06""},{""X"":""248.50"",""Y"":""161.44""},{""X"":""253.86"",""Y"":""158.75""},{""X"":""258.72"",""Y"":""157.22""},{""X"":""263.48"",""Y"":""156.70""},{""X"":""269.91"",""Y"":""157.21""},{""X"":""275.30"",""Y"":""158.51""},{""X"":""278.34"",""Y"":""160.11""},{""X"":""281.33"",""Y"":""162.82""},{""X"":""284.31"",""Y"":""166.96""},{""X"":""286.17"",""Y"":""171.04""},{""X"":""287.56"",""Y"":""176.57""},{""X"":""288.32"",""Y"":""184.02""},{""X"":""288.25"",""Y"":""191.67""},{""X"":""287.34"",""Y"":""199.56""},{""X"":""285.86"",""Y"":""205.37""},{""X"":""283.79"",""Y"":""209.86""},{""X"":""281.21"",""Y"":""213.53""},{""X"":""278.43"",""Y"":""216.04""},{""X"":""275.35"",""Y"":""217.58""},{""X"":""270.29"",""Y"":""218.94""},{""X"":""264.18"",""Y"":""219.54""},{""X"":""257.60"",""Y"":""219.05""},{""X"":""252.21"",""Y"":""217.78""},{""X"":""248.40"",""Y"":""216.23""},{""X"":""248.40"",""Y"":""243.93""},{""X"":""248.40"",""Y"":""243.93""},{""X"":""231.09"",""Y"":""243.93""}],[{""X"":""248.39"",""Y"":""170.27""},{""X"":""248.44"",""Y"":""208.05""},{""X"":""252.10"",""Y"":""210.09""},{""X"":""255.84"",""Y"":""211.16""},{""X"":""260.17"",""Y"":""211.53""},{""X"":""264.17"",""Y"":""210.97""},{""X"":""267.22"",""Y"":""209.73""},{""X"":""269.56"",""Y"":""207.87""},{""X"":""271.32"",""Y"":""205.27""},{""X"":""273.03"",""Y"":""200.64""},{""X"":""274.21"",""Y"":""194.30""},{""X"":""274.63"",""Y"":""186.82""},{""X"":""274.12"",""Y"":""179.19""},{""X"":""273.00"",""Y"":""174.07""},{""X"":""271.42"",""Y"":""170.68""},{""X"":""269.38"",""Y"":""168.30""},{""X"":""266.72"",""Y"":""166.64""},{""X"":""263.12"",""Y"":""165.59""},{""X"":""258.49"",""Y"":""165.25""},{""X"":""254.56"",""Y"":""166.16""},{""X"":""251.23"",""Y"":""167.86""},{""X"":""248.52"",""Y"":""169.99""},{""X"":""248.40"",""Y"":""170.26""},{""X"":""248.39"",""Y"":""170.27""}],[{""X"":""302.11"",""Y"":""132.13""},{""X"":""305.37"",""Y"":""132.56""},{""X"":""307.93"",""Y"":""133.77""},{""X"":""309.95"",""Y"":""135.77""},{""X"":""311.37"",""Y"":""138.40""},{""X"":""311.95"",""Y"":""141.48""},{""X"":""311.63"",""Y"":""144.75""},{""X"":""310.47"",""Y"":""147.51""},{""X"":""308.56"",""Y"":""149.80""},{""X"":""306.27"",""Y"":""151.22""},{""X"":""303.22"",""Y"":""151.96""},{""X"":""299.79"",""Y"":""151.84""},{""X"":""297.10"",""Y"":""150.92""},{""X"":""294.85"",""Y"":""149.20""},{""X"":""293.04"",""Y"":""146.63""},{""X"":""292.14"",""Y"":""143.78""},{""X"":""292.13"",""Y"":""140.64""},{""X"":""292.97"",""Y"":""137.77""},{""X"":""294.71"",""Y"":""135.15""},{""X"":""296.90"",""Y"":""133.37""},{""X"":""299.56"",""Y"":""132.38""},{""X"":""302.10"",""Y"":""132.13""},{""X"":""302.11"",""Y"":""132.13""}],[{""X"":""293.34"",""Y"":""219.00""},{""X"":""293.34"",""Y"":""157.06""},{""X"":""310.65"",""Y"":""157.06""},{""X"":""310.65"",""Y"":""219.00""},{""X"":""310.65"",""Y"":""219.00""},{""X"":""293.34"",""Y"":""219.00""}],[{""X"":""371.24"",""Y"":""171.37""},{""X"":""371.24"",""Y"":""219.00""},{""X"":""358.21"",""Y"":""219.00""},{""X"":""358.11"",""Y"":""172.27""},{""X"":""357.35"",""Y"":""170.01""},{""X"":""355.81"",""Y"":""168.19""},{""X"":""353.32"",""Y"":""166.83""},{""X"":""349.52"",""Y"":""165.99""},{""X"":""345.63"",""Y"":""165.91""},{""X"":""341.71"",""Y"":""166.90""},{""X"":""339.11"",""Y"":""168.36""},{""X"":""336.70"",""Y"":""171.02""},{""X"":""335.06"",""Y"":""173.87""},{""X"":""334.96"",""Y"":""219.00""},{""X"":""317.48"",""Y"":""219.00""},{""X"":""317.48"",""Y"":""157.06""},{""X"":""334.96"",""Y"":""157.06""},{""X"":""335.01"",""Y"":""162.07""},{""X"":""339.49"",""Y"":""159.34""},{""X"":""344.58"",""Y"":""157.56""},{""X"":""349.77"",""Y"":""156.78""},{""X"":""355.76"",""Y"":""156.84""},{""X"":""360.47"",""Y"":""157.70""},{""X"":""364.07"",""Y"":""159.18""},{""X"":""366.81"",""Y"":""161.26""},{""X"":""369.25"",""Y"":""164.29""},{""X"":""370.67"",""Y"":""167.42""},{""X"":""371.23"",""Y"":""170.82""},{""X"":""371.24"",""Y"":""171.27""},{""X"":""371.24"",""Y"":""171.37""}],[{""X"":""401.90"",""Y"":""232.76""},{""X"":""407.58"",""Y"":""232.33""},{""X"":""411.33"",""Y"":""231.29""},{""X"":""413.88"",""Y"":""229.75""},{""X"":""415.39"",""Y"":""227.89""},{""X"":""416.16"",""Y"":""225.48""},{""X"":""416.21"",""Y"":""216.25""},{""X"":""411.46"",""Y"":""218.08""},{""X"":""405.72"",""Y"":""219.22""},{""X"":""399.44"",""Y"":""219.51""},{""X"":""393.19"",""Y"":""218.76""},{""X"":""388.30"",""Y"":""217.32""},{""X"":""385.44"",""Y"":""215.70""},{""X"":""382.67"",""Y"":""212.97""},{""X"":""380.07"",""Y"":""208.95""},{""X"":""378.24"",""Y"":""204.52""},{""X"":""376.93"",""Y"":""198.51""},{""X"":""376.28"",""Y"":""190.44""},{""X"":""376.52"",""Y"":""182.65""},{""X"":""377.58"",""Y"":""175.38""},{""X"":""379.16"",""Y"":""170.07""},{""X"":""381.22"",""Y"":""166.08""},{""X"":""384.14"",""Y"":""162.28""},{""X"":""387.11"",""Y"":""159.77""},{""X"":""390.08"",""Y"":""158.35""},{""X"":""395.48"",""Y"":""157.12""},{""X"":""401.76"",""Y"":""156.70""},{""X"":""406.66"",""Y"":""157.40""},{""X"":""412.02"",""Y"":""159.31""},{""X"":""416.24"",""Y"":""161.51""},{""X"":""416.24"",""Y"":""157.06""},{""X"":""433.55"",""Y"":""157.06""},{""X"":""433.43"",""Y"":""223.84""},{""X"":""432.54"",""Y"":""227.93""},{""X"":""430.90"",""Y"":""231.30""},{""X"":""428.49"",""Y"":""234.16""},{""X"":""425.23"",""Y"":""236.55""},{""X"":""420.86"",""Y"":""238.51""},{""X"":""415.19"",""Y"":""239.93""},{""X"":""407.89"",""Y"":""240.69""},{""X"":""399.04"",""Y"":""240.53""},{""X"":""391.61"",""Y"":""239.58""},{""X"":""384.09"",""Y"":""237.51""},{""X"":""382.01"",""Y"":""236.48""},{""X"":""380.74"",""Y"":""226.84""},{""X"":""385.59"",""Y"":""229.19""},{""X"":""391.82"",""Y"":""231.36""},{""X"":""398.16"",""Y"":""232.49""},{""X"":""401.75"",""Y"":""232.75""},{""X"":""401.90"",""Y"":""232.76""}],[{""X"":""416.25"",""Y"":""170.27""},{""X"":""414.97"",""Y"":""169.05""},{""X"":""410.96"",""Y"":""166.71""},{""X"":""406.83"",""Y"":""165.39""},{""X"":""404.44"",""Y"":""165.28""},{""X"":""400.31"",""Y"":""165.96""},{""X"":""397.15"",""Y"":""167.34""},{""X"":""394.75"",""Y"":""169.35""},{""X"":""392.82"",""Y"":""172.20""},{""X"":""391.40"",""Y"":""176.14""},{""X"":""390.35"",""Y"":""182.50""},{""X"":""390.04"",""Y"":""190.14""},{""X"":""390.67"",""Y"":""197.15""},{""X"":""391.97"",""Y"":""202.39""},{""X"":""393.71"",""Y"":""206.20""},{""X"":""395.76"",""Y"":""208.58""},{""X"":""398.42"",""Y"":""210.25""},{""X"":""401.86"",""Y"":""211.27""},{""X"":""406.04"",""Y"":""211.51""},{""X"":""410.92"",""Y"":""210.69""},{""X"":""414.49"",""Y"":""209.16""},{""X"":""416.25"",""Y"":""208.01""},{""X"":""416.25"",""Y"":""170.27""},{""X"":""416.25"",""Y"":""170.27""}]]"
Const text_polygon = "[[{""X"":""28.18"",""Y"":""205.95""},{""X"":""28.18"",""Y"":""105.07""},{""X"":""48.27"",""Y"":""105.07""},{""X"":""48.28"",""Y"":""110.23""},{""X"":""54.15"",""Y"":""107.22""},{""X"":""59.69"",""Y"":""105.39""},{""X"":""65.04"",""Y"":""104.66""},{""X"":""72.07"",""Y"":""105.08""},{""X"":""78.09"",""Y"":""106.31""},{""X"":""81.57"",""Y"":""107.68""},{""X"":""84.84"",""Y"":""110.05""},{""X"":""88.03"",""Y"":""113.63""},{""X"":""90.87"",""Y"":""118.22""},{""X"":""92.71"",""Y"":""123.12""},{""X"":""94.06"",""Y"":""129.73""},{""X"":""94.70"",""Y"":""138.25""},{""X"":""94.41"",""Y"":""147.24""},{""X"":""93.31"",""Y"":""155.42""},{""X"":""91.66"",""Y"":""161.49""},{""X"":""89.46"",""Y"":""166.25""},{""X"":""86.67"",""Y"":""170.32""},{""X"":""83.75"",""Y"":""173.13""},{""X"":""80.65"",""Y"":""174.92""},{""X"":""75.51"",""Y"":""176.56""},{""X"":""69.28"",""Y"":""177.50""},{""X"":""63.74"",""Y"":""177.55""},{""X"":""57.05"",""Y"":""176.72""},{""X"":""51.42"",""Y"":""175.15""},{""X"":""48.27"",""Y"":""173.79""},{""X"":""48.27"",""Y"":""205.95""},{""X"":""48.27"",""Y"":""205.95""},{""X"":""28.18"",""Y"":""205.95""}],[{""X"":""48.28"",""Y"":""120.42""},{""X"":""48.38"",""Y"":""164.32""},{""X"":""52.31"",""Y"":""166.53""},{""X"":""56.14"",""Y"":""167.74""},{""X"":""61.35"",""Y"":""168.35""},{""X"":""65.96"",""Y"":""167.83""},{""X"":""69.49"",""Y"":""166.59""},{""X"":""72.20"",""Y"":""164.73""},{""X"":""74.29"",""Y"":""162.19""},{""X"":""76.19"",""Y"":""157.95""},{""X"":""77.71"",""Y"":""152.00""},{""X"":""78.63"",""Y"":""144.11""},{""X"":""78.66"",""Y"":""136.61""},{""X"":""77.89"",""Y"":""129.16""},{""X"":""76.59"",""Y"":""124.08""},{""X"":""74.84"",""Y"":""120.60""},{""X"":""72.55"",""Y"":""118.04""},{""X"":""69.77"",""Y"":""116.28""},{""X"":""65.91"",""Y"":""115.07""},{""X"":""60.69"",""Y"":""114.57""},{""X"":""56.85"",""Y"":""115.18""},{""X"":""53.10"",""Y"":""116.68""},{""X"":""48.91"",""Y"":""119.57""},{""X"":""48.28"",""Y"":""120.39""},{""X"":""48.28"",""Y"":""120.42""}],[{""X"":""132.15"",""Y"":""104.65""},{""X"":""139.94"",""Y"":""105.10""},{""X"":""146.11"",""Y"":""106.30""},{""X"":""151.03"",""Y"":""108.11""},{""X"":""155.15"",""Y"":""110.57""},{""X"":""158.60"",""Y"":""113.67""},{""X"":""161.35"",""Y"":""117.41""},{""X"":""163.45"",""Y"":""121.89""},{""X"":""165.10"",""Y"":""127.80""},{""X"":""166.07"",""Y"":""135.09""},{""X"":""166.22"",""Y"":""143.93""},{""X"":""165.51"",""Y"":""151.69""},{""X"":""164.06"",""Y"":""158.12""},{""X"":""162.01"",""Y"":""163.28""},{""X"":""159.40"",""Y"":""167.47""},{""X"":""156.32"",""Y"":""170.74""},{""X"":""152.52"",""Y"":""173.40""},{""X"":""147.87"",""Y"":""175.49""},{""X"":""142.07"",""Y"":""176.99""},{""X"":""134.92"",""Y"":""177.77""},{""X"":""127.42"",""Y"":""177.67""},{""X"":""120.74"",""Y"":""176.71""},{""X"":""115.29"",""Y"":""175.07""},{""X"":""110.74"",""Y"":""172.78""},{""X"":""106.95"",""Y"":""169.86""},{""X"":""103.92"",""Y"":""166.34""},{""X"":""101.48"",""Y"":""162.04""},{""X"":""99.57"",""Y"":""156.68""},{""X"":""98.29"",""Y"":""150.05""},{""X"":""97.78"",""Y"":""141.98""},{""X"":""98.18"",""Y"":""134.19""},{""X"":""99.36"",""Y"":""127.55""},{""X"":""101.22"",""Y"":""122.01""},{""X"":""103.68"",""Y"":""117.38""},{""X"":""106.77"",""Y"":""113.52""},{""X"":""110.41"",""Y"":""110.41""},{""X"":""114.84"",""Y"":""107.89""},{""X"":""120.07"",""Y"":""106.06""},{""X"":""126.27"",""Y"":""104.95""},{""X"":""132.11"",""Y"":""104.65""},{""X"":""132.15"",""Y"":""104.65""}],[{""X"":""117.86"",""Y"":""140.93""},{""X"":""118.75"",""Y"":""153.65""},{""X"":""119.63"",""Y"":""158.05""},{""X"":""121.31"",""Y"":""161.73""},{""X"":""123.57"",""Y"":""164.71""},{""X"":""126.01"",""Y"":""166.43""},{""X"":""129.14"",""Y"":""167.44""},{""X"":""133.32"",""Y"":""167.70""},{""X"":""137.17"",""Y"":""167.11""},{""X"":""140.03"",""Y"":""165.83""},{""X"":""142.14"",""Y"":""163.92""},{""X"":""143.62"",""Y"":""161.33""},{""X"":""145.05"",""Y"":""155.97""},{""X"":""145.97"",""Y"":""148.23""},{""X"":""146.12"",""Y"":""137.89""},{""X"":""145.44"",""Y"":""129.22""},{""X"":""144.13"",""Y"":""122.91""},{""X"":""142.80"",""Y"":""119.58""},{""X"":""140.91"",""Y"":""117.26""},{""X"":""138.39"",""Y"":""115.66""},{""X"":""135.07"",""Y"":""114.75""},{""X"":""131.03"",""Y"":""114.64""},{""X"":""127.21"",""Y"":""115.38""},{""X"":""124.25"",""Y"":""116.82""},{""X"":""122.07"",""Y"":""118.86""},{""X"":""120.53"",""Y"":""121.59""},{""X"":""119.03"",""Y"":""126.93""},{""X"":""118.09"",""Y"":""134.21""},{""X"":""117.86"",""Y"":""140.81""},{""X"":""117.86"",""Y"":""140.93""}],[{""X"":""172.03"",""Y"":""177.00""},{""X"":""172.03"",""Y"":""76.33""},{""X"":""191.91"",""Y"":""76.33""},{""X"":""191.91"",""Y"":""177.00""},{""X"":""191.91"",""Y"":""177.00""},{""X"":""172.03"",""Y"":""177.00""}],[{""X"":""224.60"",""Y"":""196.88""},{""X"":""221.39"",""Y"":""198.11""},{""X"":""215.61"",""Y"":""199.00""},{""X"":""208.60"",""Y"":""199.21""},{""X"":""204.09"",""Y"":""190.40""},{""X"":""211.28"",""Y"":""190.55""},{""X"":""214.82"",""Y"":""189.98""},{""X"":""217.84"",""Y"":""188.66""},{""X"":""220.35"",""Y"":""186.54""},{""X"":""222.45"",""Y"":""183.44""},{""X"":""224.33"",""Y"":""178.55""},{""X"":""225.80"",""Y"":""173.86""},{""X"":""195.43"",""Y"":""105.07""},{""X"":""215.95"",""Y"":""105.07""},{""X"":""235.40"",""Y"":""149.04""},{""X"":""252.44"",""Y"":""105.07""},{""X"":""265.17"",""Y"":""105.14""},{""X"":""233.73"",""Y"":""186.25""},{""X"":""231.07"",""Y"":""190.77""},{""X"":""228.03"",""Y"":""194.27""},{""X"":""224.70"",""Y"":""196.82""},{""X"":""224.60"",""Y"":""196.88""}],[{""X"":""292.60"",""Y"":""192.98""},{""X"":""298.73"",""Y"":""192.56""},{""X"":""303.08"",""Y"":""191.46""},{""X"":""305.98"",""Y"":""189.91""},{""X"":""307.86"",""Y"":""187.98""},{""X"":""308.96"",""Y"":""185.54""},{""X"":""309.26"",""Y"":""183.06""},{""X"":""309.20"",""Y"":""173.81""},{""X"":""304.04"",""Y"":""175.83""},{""X"":""298.03"",""Y"":""177.13""},{""X"":""291.00"",""Y"":""177.63""},{""X"":""284.29"",""Y"":""177.05""},{""X"":""278.60"",""Y"":""175.70""},{""X"":""274.88"",""Y"":""174.11""},{""X"":""271.82"",""Y"":""171.71""},{""X"":""268.90"",""Y"":""168.11""},{""X"":""266.25"",""Y"":""163.24""},{""X"":""264.52"",""Y"":""157.97""},{""X"":""263.31"",""Y"":""150.88""},{""X"":""262.81"",""Y"":""141.60""},{""X"":""263.34"",""Y"":""132.62""},{""X"":""264.61"",""Y"":""125.23""},{""X"":""266.40"",""Y"":""119.67""},{""X"":""268.74"",""Y"":""115.31""},{""X"":""271.95"",""Y"":""111.17""},{""X"":""275.11"",""Y"":""108.42""},{""X"":""278.30"",""Y"":""106.76""},{""X"":""283.81"",""Y"":""105.35""},{""X"":""290.52"",""Y"":""104.67""},{""X"":""295.16"",""Y"":""104.90""},{""X"":""299.98"",""Y"":""105.99""},{""X"":""306.08"",""Y"":""108.50""},{""X"":""309.26"",""Y"":""110.23""},{""X"":""309.26"",""Y"":""105.06""},{""X"":""329.35"",""Y"":""105.06""},{""X"":""329.23"",""Y"":""182.37""},{""X"":""328.37"",""Y"":""186.78""},{""X"":""326.76"",""Y"":""190.49""},{""X"":""324.35"",""Y"":""193.73""},{""X"":""321.15"",""Y"":""196.44""},{""X"":""316.95"",""Y"":""198.74""},{""X"":""311.55"",""Y"":""200.55""},{""X"":""304.61"",""Y"":""201.78""},{""X"":""296.23"",""Y"":""202.25""},{""X"":""286.50"",""Y"":""201.75""},{""X"":""279.10"",""Y"":""200.55""},{""X"":""271.33"",""Y"":""198.26""},{""X"":""269.50"",""Y"":""197.28""},{""X"":""268.04"",""Y"":""186.11""},{""X"":""273.14"",""Y"":""188.62""},{""X"":""280.19"",""Y"":""191.16""},{""X"":""286.81"",""Y"":""192.48""},{""X"":""292.48"",""Y"":""192.97""},{""X"":""292.60"",""Y"":""192.98""}],[{""X"":""309.26"",""Y"":""120.42""},{""X"":""308.13"",""Y"":""119.26""},{""X"":""303.52"",""Y"":""116.46""},{""X"":""299.14"",""Y"":""114.93""},{""X"":""296.63"",""Y"":""114.57""},{""X"":""291.87"",""Y"":""115.12""},{""X"":""288.19"",""Y"":""116.39""},{""X"":""285.33"",""Y"":""118.31""},{""X"":""282.99"",""Y"":""121.03""},{""X"":""281.19"",""Y"":""124.65""},{""X"":""279.81"",""Y"":""130.01""},{""X"":""278.92"",""Y"":""137.91""},{""X"":""278.88"",""Y"":""145.11""},{""X"":""279.69"",""Y"":""152.40""},{""X"":""281.18"",""Y"":""158.05""},{""X"":""283.08"",""Y"":""162.12""},{""X"":""285.18"",""Y"":""164.65""},{""X"":""287.89"",""Y"":""166.53""},{""X"":""291.41"",""Y"":""167.79""},{""X"":""296.02"",""Y"":""168.34""},{""X"":""301.23"",""Y"":""167.79""},{""X"":""305.10"",""Y"":""166.63""},{""X"":""309.03"",""Y"":""164.44""},{""X"":""309.26"",""Y"":""164.24""},{""X"":""309.26"",""Y"":""164.24""},{""X"":""309.26"",""Y"":""120.42""}],[{""X"":""369.84"",""Y"":""104.65""},{""X"":""377.62"",""Y"":""105.10""},{""X"":""383.80"",""Y"":""106.30""},{""X"":""388.72"",""Y"":""108.11""},{""X"":""392.84"",""Y"":""110.56""},{""X"":""396.29"",""Y"":""113.67""},{""X"":""399.04"",""Y"":""117.41""},{""X"":""401.13"",""Y"":""121.89""},{""X"":""402.78"",""Y"":""127.80""},{""X"":""403.75"",""Y"":""135.08""},{""X"":""403.90"",""Y"":""143.93""},{""X"":""403.19"",""Y"":""151.69""},{""X"":""401.74"",""Y"":""158.12""},{""X"":""399.70"",""Y"":""163.28""},{""X"":""397.08"",""Y"":""167.47""},{""X"":""394.00"",""Y"":""170.74""},{""X"":""390.20"",""Y"":""173.40""},{""X"":""385.55"",""Y"":""175.49""},{""X"":""379.75"",""Y"":""176.99""},{""X"":""372.60"",""Y"":""177.77""},{""X"":""365.11"",""Y"":""177.67""},{""X"":""358.43"",""Y"":""176.71""},{""X"":""352.98"",""Y"":""175.07""},{""X"":""348.43"",""Y"":""172.78""},{""X"":""344.63"",""Y"":""169.86""},{""X"":""341.60"",""Y"":""166.34""},{""X"":""339.16"",""Y"":""162.04""},{""X"":""337.26"",""Y"":""156.68""},{""X"":""335.98"",""Y"":""150.05""},{""X"":""335.46"",""Y"":""141.97""},{""X"":""335.86"",""Y"":""134.19""},{""X"":""337.04"",""Y"":""127.55""},{""X"":""338.90"",""Y"":""122.01""},{""X"":""341.37"",""Y"":""117.38""},{""X"":""344.45"",""Y"":""113.52""},{""X"":""348.10"",""Y"":""110.41""},{""X"":""352.52"",""Y"":""107.89""},{""X"":""357.76"",""Y"":""106.06""},{""X"":""363.95"",""Y"":""104.95""},{""X"":""369.79"",""Y"":""104.65""},{""X"":""369.84"",""Y"":""104.65""}],[{""X"":""355.55"",""Y"":""140.93""},{""X"":""356.44"",""Y"":""153.65""},{""X"":""357.32"",""Y"":""158.05""},{""X"":""358.99"",""Y"":""161.73""},{""X"":""361.25"",""Y"":""164.71""},{""X"":""363.70"",""Y"":""166.43""},{""X"":""366.83"",""Y"":""167.44""},{""X"":""371.01"",""Y"":""167.70""},{""X"":""374.86"",""Y"":""167.11""},{""X"":""377.72"",""Y"":""165.83""},{""X"":""379.82"",""Y"":""163.92""},{""X"":""381.31"",""Y"":""161.33""},{""X"":""382.74"",""Y"":""155.97""},{""X"":""383.65"",""Y"":""148.23""},{""X"":""383.81"",""Y"":""137.89""},{""X"":""383.12"",""Y"":""129.22""},{""X"":""381.82"",""Y"":""122.91""},{""X"":""380.48"",""Y"":""119.58""},{""X"":""378.60"",""Y"":""117.26""},{""X"":""376.07"",""Y"":""115.66""},{""X"":""372.76"",""Y"":""114.75""},{""X"":""368.72"",""Y"":""114.64""},{""X"":""364.90"",""Y"":""115.38""},{""X"":""361.94"",""Y"":""116.82""},{""X"":""359.76"",""Y"":""118.86""},{""X"":""358.22"",""Y"":""121.60""},{""X"":""356.71"",""Y"":""126.93""},{""X"":""355.77"",""Y"":""134.21""},{""X"":""355.55"",""Y"":""140.81""},{""X"":""355.55"",""Y"":""140.93""}],[{""X"":""471.82"",""Y"":""121.68""},{""X"":""471.82"",""Y"":""177.00""},{""X"":""456.69"",""Y"":""177.00""},{""X"":""456.58"",""Y"":""122.81""},{""X"":""455.77"",""Y"":""120.25""},{""X"":""454.20"",""Y"":""118.25""},{""X"":""451.80"",""Y"":""116.74""},{""X"":""448.06"",""Y"":""115.65""},{""X"":""442.84"",""Y"":""115.25""},{""X"":""438.30"",""Y"":""116.22""},{""X"":""435.19"",""Y"":""117.70""},{""X"":""432.97"",""Y"":""119.70""},{""X"":""430.36"",""Y"":""123.35""},{""X"":""429.69"",""Y"":""124.95""},{""X"":""429.69"",""Y"":""177.00""},{""X"":""409.38"",""Y"":""177.00""},{""X"":""409.38"",""Y"":""105.07""},{""X"":""429.69"",""Y"":""105.07""},{""X"":""429.70"",""Y"":""110.91""},{""X"":""434.67"",""Y"":""107.84""},{""X"":""440.16"",""Y"":""105.83""},{""X"":""445.62"",""Y"":""104.85""},{""X"":""452.21"",""Y"":""104.70""},{""X"":""457.71"",""Y"":""105.40""},{""X"":""461.98"",""Y"":""106.78""},{""X"":""465.33"",""Y"":""108.76""},{""X"":""468.28"",""Y"":""111.73""},{""X"":""470.35"",""Y"":""115.03""},{""X"":""471.52"",""Y"":""118.58""},{""X"":""471.82"",""Y"":""121.56""},{""X"":""471.82"",""Y"":""121.68""}]]"
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) dim p1 as ClipperPathsMBS = text1 dim p2 as ClipperPathsMBS = text2 //draw input polygons with user-defined routine ... DrawPolygons(g, p1, &c8888FF77) // blue DrawPolygons(g, p2, &cFF888877) // red //perform intersection ... dim c as new ClipperEngineMBS call c.AddPaths(p1, ClipperMBS.PolyType.Subject, true) call c.AddPaths(p2, ClipperMBS.PolyType.Clip, true) dim cliptype as Integer = PopupClipType.ListIndex-1 dim PolyFillType as Integer = Integer(ClipperMBS.PolyFillType.EvenOdd) dim solution as ClipperPathsMBS if c.Execute(ClipType, solution, PolyFillType, PolyFillType) then //draw solution with user-defined routine ... DrawPolygons(g, solution, &c88FF8877) // solution shaded green end if End EventHandler
End Control
Control PopupClipType Inherits PopupMenu
ControlInstance PopupClipType Inherits PopupMenu
EventHandler Sub Change() out.Invalidate End EventHandler
End Control
EventHandler Sub Open() text1 = PathsFromJSON(text_polygon) text2 = PathsFromJSON(text_clipping) End EventHandler
Sub DrawPolygon(g as graphics, p as ClipperPathMBS, c as color, ox as integer = 0, oy as integer = 0) dim coordinates(0) as integer dim points() as ClipperPointMBS = p.Values for each point as ClipperPointMBS in points coordinates.Append point.x + ox coordinates.Append point.y + oy next g.ForeColor = c g.FillPolygon coordinates End Sub
Sub DrawPolygons(g as Graphics, paths as ClipperPathsMBS, c as color, ox as integer = 0, oy as integer = 0) dim pathsList() as ClipperPathMBS = paths.Values dim pic as new Picture(g.Width, g.Height, 32) dim mask as Picture = pic.mask pic.Graphics.ForeColor = rgb(c.Red, c.Green, c.Blue) pic.Graphics.FillRect 0, 0, g.Width, g.Height mask.Graphics.ClearRect 0, 0, g.Width, g.Height dim last as ClipperPathMBS for each p as ClipperPathMBS in pathsList if last <> nil and last.PointInPolygon(p.Value(0)) = 1 then DrawPolygon(mask.graphics, p, &cFFFFFF, ox, oy) else DrawPolygon(mask.graphics, p, &c000000, ox, oy) end if last = p next g.DrawPicture pic, 0, 0 End Sub
Function PathsFromJSON(s as string) As ClipperPathsMBS dim j as new JSONItem(s) dim paths as new ClipperPathsMBS dim ju as integer = j.Count-1 for ji as integer = 0 to ju dim jj as JSONItem = j.Value(ji) dim path as new ClipperPathMBS dim jju as integer = jj.Count-1 for jji as integer = 0 to jju dim jjj as JSONItem = jj.Value(jji) dim x as Integer = jjj.Value("X") dim y as Integer = jjj.Value("Y") path.append x, y next paths.Append path next return paths End Function
Property text1 As ClipperPathsMBS
Property text2 As ClipperPathsMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Tools Plugin.


The biggest plugin in space...