Example usage for org.apache.lucene.geo Polygon Polygon

List of usage examples for org.apache.lucene.geo Polygon Polygon

Introduction

In this page you can find the example usage for org.apache.lucene.geo Polygon Polygon.

Prototype

public Polygon(double[] polyLats, double[] polyLons, Polygon... holes) 

Source Link

Document

Creates a new Polygon from the supplied latitude/longitude array, and optionally any holes.

Usage

From source file:perf.IndexAndSearchOpenStreetMaps.java

License:Apache License

/** One normally need not clone a Polygon (it's a read only holder class), but we do this here just to keep the benchmark honest, by
 *  including Polygon construction cost in measuring search run time. */
private static Polygon[] clonePolygon(Polygon[] polies) {
    Polygon[] newPolies = new Polygon[polies.length];
    for (int i = 0; i < polies.length; i++) {
        Polygon poly = polies[i];
        Polygon[] holes = poly.getHoles();
        if (holes.length > 0) {
            holes = clonePolygon(holes);
        }// w ww  .j  a v a 2  s  . c o m
        newPolies[i] = new Polygon(poly.getPolyLats(), poly.getPolyLons(), holes);
    }
    return newPolies;
}