compareTo method

int compareTo(
  1. dynamic o
)
override

BufferSubgraphs are compared on the x-value of their rightmost Coordinate. This defines a partial ordering on the graphs such that:

g1 >= g2 <==> Ring(g2) does not contain Ring(g1)

where Polygon(g) is the buffer polygon that is built from g.

This relationship is used to sort the BufferSubgraphs so that shells are guaranteed to be built before holes.

Implementation

int compareTo(dynamic o) {
  BufferSubgraph graph = o as BufferSubgraph;
  if (this.rightMostCoord!.x < graph.rightMostCoord!.x) {
    return -1;
  }
  if (this.rightMostCoord!.x > graph.rightMostCoord!.x) {
    return 1;
  }
  return 0;
}