Example usage for com.google.common.geometry S2Polygon isValid

List of usage examples for com.google.common.geometry S2Polygon isValid

Introduction

In this page you can find the example usage for com.google.common.geometry S2Polygon isValid.

Prototype

public static boolean isValid(final List<S2Loop> loops) 

Source Link

Document

Return true if the given loops form a valid polygon.

Usage

From source file:com.bc.fiduceo.geometry.s2.BcS2Polygon.java

@Override
public boolean isValid() {
    final int numLoops = googlePolygon.numLoops();
    final ArrayList<S2Loop> loops = new ArrayList<>();
    for (int i = 0; i < numLoops; i++) {
        final S2Loop loop = googlePolygon.loop(i);
        if (!loop.isValid()) {
            return false;
        }//from w w w .  j  a v  a 2  s.c o m
        loops.add(loop);
    }

    return S2Polygon.isValid(loops);
}