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

org.geolatte.geom.crs.CoordinateReferenceSystem Maven / Gradle / Ivy

Go to download

This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL specification.

The newest version!
/*
 * This file is part of the GeoLatte project.
 *
 *     GeoLatte is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     GeoLatte is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 *
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with GeoLatte.  If not, see .
 *
 * Copyright (C) 2010 - 2011 and Ownership of code is shared by:
 * Qmino bvba - Romeinsestraat 18 - 3001 Heverlee  (http://www.qmino.com)
 * Geovise bvba - Generaal Eisenhowerlei 9 - 2140 Antwerpen (http://www.geovise.com)
 */

package org.geolatte.geom.crs;

import org.geolatte.geom.*;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * A Coordinate Reference System.
 *
 * @author Karel Maesen, Geovise BVBA
 *         creation-date: 8/2/11
 */
public abstract class CoordinateReferenceSystem

extends CrsIdentifiable { private final CoordinateSystem

coordinateSystem; /** * Constructs a CoordinateReferenceSystem. * * @param crsId the {@link CrsId} that identifies this CoordinateReferenceSystem uniquely * @param name the commonly used name for this CoordinateReferenceSystem * @param coordinateSystem the coordinate system to use * @throws IllegalArgumentException if less than two {@link CoordinateSystemAxis CoordinateSystemAxes} are passed. */ public CoordinateReferenceSystem(CrsId crsId, String name, CoordinateSystem

coordinateSystem) { super(crsId, name); if (coordinateSystem == null) throw new IllegalArgumentException("No null arguments allowed"); this.coordinateSystem = coordinateSystem; } /** * Returns the type token for the type of Positions referenced in this system. * * @return a Class object */ public Class

getPositionClass() { return this.coordinateSystem.getPositionClass(); } /** * Returns the CoordinateSystem associated with this CoordinateReferenceSystem. * * @return Returns the CoordinateSystem associated with this CoordinateReferenceSystem. */ public CoordinateSystem

getCoordinateSystem() { return coordinateSystem; } /** * Returns the coordinate dimension, i.e. the number of axes in this coordinate reference system. * * @return the coordinate dimension */ public int getCoordinateDimension() { return getCoordinateSystem().getCoordinateDimension(); } /** * Return the {@link CoordinateSystemAxis CoordinateSystemAxes} associated with this CoordinateReferenceSystem. * * @return an array of {@link CoordinateSystemAxis CoordinateSystemAxes}. */ public CoordinateSystemAxis getAxis(int idx) { return coordinateSystem.getAxis(idx); } /** * Returns the index of the specified axis in this {@code CoordinateReferenceSystem}, or * -1 if it is not an axis of this system. * * @param axis the axis to look up * @return the index of the specified axis in this {@code CoordinateReferenceSystem} */ public int getAxisIndex(CoordinateSystemAxis axis) { return getCoordinateSystem().getAxisIndex(axis); } public boolean isCompound() { return false; } public CoordinateReferenceSystem addVerticalSystem(LinearUnit unit, Class clazz){ return CoordinateReferenceSystems.addVerticalSystem(this, clazz, unit); } public CoordinateReferenceSystem addLinearSystem(LinearUnit unit, Class clazz){ return CoordinateReferenceSystems.addLinearSystem(this, clazz, unit); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; CoordinateReferenceSystem that = (CoordinateReferenceSystem) o; if (!coordinateSystem.equals(that.coordinateSystem)) return false; return true; } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + coordinateSystem.hashCode(); return result; } public boolean hasZ() { return getCoordinateSystem().hasZ(); } public boolean hasM() { return getCoordinateSystem().hasM(); } public String toString() { return getName() + " (" + getCrsId().toString() + ")"; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy