All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geojson.Geometry Maven / Gradle / Ivy

There is a newer version: 1.14
Show newest version
package org.geojson;

import java.util.ArrayList;
import java.util.List;

public abstract class Geometry extends GeoJsonObject {

	protected List coordinates = new ArrayList();

	public Geometry() {
	}

	public Geometry(T... elements) {
		for (T coordinate : elements) {
			coordinates.add(coordinate);
		}
	}

	public Geometry add(T elements) {
		coordinates.add(elements);
		return this;
	}

	public List getCoordinates() {
		return coordinates;
	}

	public void setCoordinates(List coordinates) {
		this.coordinates = coordinates;
	}

	@SuppressWarnings("rawtypes")
	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Geometry)) {
			return false;
		}
		if (!super.equals(o)) {
			return false;
		}
		Geometry geometry = (Geometry)o;
		return !(coordinates != null ? !coordinates.equals(geometry.coordinates) : geometry.coordinates != null);
	}

	@Override
	public int hashCode() {
		int result = super.hashCode();
		result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "Geometry{" + "coordinates=" + coordinates + "} " + super.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy