module NSWTopo::Declination
def get_features
def get_features @params["fill"] ||= @params["stroke"] declination = @angle || @map.declination col_spacing = @spacing row_spacing = @arrows * 0.5 col_offset = @offset % @spacing radius = 0.5 * @map.neatline.bounds.transpose.then do |bl, tr| Vector[*tr] - Vector[*bl] end.norm j_max = (radius / col_spacing).ceil i_max = (radius / row_spacing).ceil (-j_max..j_max).each.with_object(GeoJSON::Collection.new(projection: @map.neatline.projection)) do |j, collection| x = j * col_spacing + col_offset coordinates = [radius, -radius].map do |y| Vector[x, y].rotate_by_degrees(declination - @map.rotation) + Vector[*@map.dimensions] / 2 end collection.add_linestring coordinates (-i_max..i_max).reject(&j.even? ? :even? : :odd?).map do |i| Vector[x, i * row_spacing].rotate_by_degrees(declination - @map.rotation) + Vector[*@map.dimensions] / 2 end.each do |coordinates| collection.add_point coordinates, "rotation" => declination end end end