Nyall Dawson 1cf0a20267 [FEATURE][processing] New algorithm for topological coloring of polygons
This ports to old (pre 2.0!!) topocolor plugin to processing. It's based
off my beta 2.x fork (never publicly released) which implemented
a bunch of improvements to the algorithm allowing for minimal number
of required colors and also balanced counts of features assigned
each individual color.

** Pretty sure this plugin was highlighted in Victor's presentation
about plugins-which-shouldn't-be-plugins-and-should-be-processing-algs
instead. It's a prime example of a plugin where the amount of code
required for gui+setup exceeded the actual "guts" of the plugin by
a huge factor, and which is much more useful when it can be
integrated into a larger processing model.
2017-02-22 12:10:13 +10:00

123 lines
8.4 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-0.7606503579952282</gml:X><gml:Y>-6.113305489260142</gml:Y></gml:coord>
<gml:coord><gml:X>14.23934964200477</gml:X><gml:Y>5.886694510739858</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.760650357995228,-0.113305489260142 2.23934964200477,-0.113305489260142 2.23934964200477,-3.11330548926014 -0.760650357995228,-3.11330548926014 -0.760650357995228,-0.113305489260142</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>-0.76065</ogr:left>
<ogr:top>-0.11331</ogr:top>
<ogr:right>2.23935</ogr:right>
<ogr:bottom>-3.11331</ogr:bottom>
<ogr:id>3</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.760650357995228,-3.11330548926014 2.23934964200477,-3.11330548926014 2.23934964200477,-6.11330548926014 -0.760650357995228,-6.11330548926014 -0.760650357995228,-3.11330548926014</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>-0.76065</ogr:left>
<ogr:top>-3.11331</ogr:top>
<ogr:right>2.23935</ogr:right>
<ogr:bottom>-6.11331</ogr:bottom>
<ogr:id>4</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.23934964200477,-0.113305489260142 8.23934964200477,-0.113305489260142 8.23934964200477,-3.11330548926014 5.23934964200477,-3.11330548926014 5.23934964200477,-0.113305489260142</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>5.23935</ogr:left>
<ogr:top>-0.11331</ogr:top>
<ogr:right>8.23935</ogr:right>
<ogr:bottom>-3.11331</ogr:bottom>
<ogr:id>11</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.23934964200477,-3.11330548926014 8.23934964200477,-3.11330548926014 8.23934964200477,-6.11330548926014 5.23934964200477,-6.11330548926014 5.23934964200477,-3.11330548926014</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>5.23935</ogr:left>
<ogr:top>-3.11331</ogr:top>
<ogr:right>8.23935</ogr:right>
<ogr:bottom>-6.11331</ogr:bottom>
<ogr:id>12</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.4">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8.23934964200477,-3.11330548926014 11.2393496420048,-3.11330548926014 11.2393496420048,-6.11330548926014 8.23934964200477,-6.11330548926014 8.23934964200477,-3.11330548926014</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>8.23935</ogr:left>
<ogr:top>-3.11331</ogr:top>
<ogr:right>11.23935</ogr:right>
<ogr:bottom>-6.11331</ogr:bottom>
<ogr:id>16</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>11.2393496420048,-0.113305489260142 14.2393496420048,-0.113305489260142 14.2393496420048,-3.11330548926014 11.2393496420048,-3.11330548926014 11.2393496420048,-0.113305489260142</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>11.23935</ogr:left>
<ogr:top>-0.11331</ogr:top>
<ogr:right>14.23935</ogr:right>
<ogr:bottom>-3.11331</ogr:bottom>
<ogr:id>19</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.6">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>11.2393496420048,-3.11330548926014 14.2393496420048,-3.11330548926014 14.2393496420048,-6.11330548926014 11.2393496420048,-6.11330548926014 11.2393496420048,-3.11330548926014</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>11.23935</ogr:left>
<ogr:top>-3.11331</ogr:top>
<ogr:right>14.23935</ogr:right>
<ogr:bottom>-6.11331</ogr:bottom>
<ogr:id>20</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.7">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2.23934964200477,5.88669451073986 5.23934964200477,5.88669451073986 5.23934964200477,2.88669451073986 2.23934964200477,2.88669451073986 2.23934964200477,-0.113305489260142 -0.760650357995228,-0.113305489260142 -0.760650357995228,2.88669451073986 -0.760650357995228,5.88669451073986 2.23934964200477,5.88669451073986</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>2.23935</ogr:left>
<ogr:top>5.88669</ogr:top>
<ogr:right>5.23935</ogr:right>
<ogr:bottom>2.88669</ogr:bottom>
<ogr:id>5</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.8">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.23934964200477,2.88669451073986 8.23934964200477,2.88669451073986 11.2393496420048,2.88669451073986 11.2393496420048,-0.113305489260142 11.2393496420048,-3.11330548926014 8.23934964200477,-3.11330548926014 8.23934964200477,-0.113305489260142 5.23934964200477,-0.113305489260142 5.23934964200477,2.88669451073986</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>5.23935</ogr:left>
<ogr:top>2.88669</ogr:top>
<ogr:right>8.23935</ogr:right>
<ogr:id>10</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.9">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2.23934964200477,2.88669451073986 5.23934964200477,2.88669451073986 5.23934964200477,-0.113305489260142 5.23934964200477,-3.11330548926014 5.23934964200477,-6.11330548926014 2.23934964200477,-6.11330548926014 2.23934964200477,-3.11330548926014 2.23934964200477,-0.113305489260142 2.23934964200477,2.88669451073986</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>2.23935</ogr:left>
<ogr:top>2.88669</ogr:top>
<ogr:right>5.23935</ogr:right>
<ogr:id>6</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:adjacent_polys fid="adjacent_polys.10">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.23934964200477,5.88669451073986 8.23934964200477,5.88669451073986 11.2393496420048,5.88669451073986 14.2393496420048,5.88669451073986 14.2393496420048,2.88669451073986 14.2393496420048,-0.113305489260142 11.2393496420048,-0.113305489260142 11.2393496420048,2.88669451073986 8.23934964200477,2.88669451073986 5.23934964200477,2.88669451073986 5.23934964200477,5.88669451073986</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:left>5.23935</ogr:left>
<ogr:top>5.88669</ogr:top>
<ogr:right>8.23935</ogr:right>
<ogr:bottom>2.88669</ogr:bottom>
<ogr:id>9</ogr:id>
</ogr:adjacent_polys>
</gml:featureMember>
</ogr:FeatureCollection>