io.github.sebasbaumh.postgis.PGbox3d Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postgis-java-ng Show documentation
Show all versions of postgis-java-ng Show documentation
This project contains Java bindings for using PostGIS geometries coming from a PostgreSQL database.
The newest version!
/*
* PostGIS extension for PostgreSQL JDBC driver
*
* (C) 2004 Paul Ramsey, [email protected]
* (C) 2005 Markus Schaber, [email protected]
* (C) 2015 Phillip Ross, [email protected]
* (C) 2018-2023 Sebastian Baumhekel, [email protected]
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 this library. If not, see .
*/
package io.github.sebasbaumh.postgis;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
/**
* BOX3D representing the maximum extents of the geometry.
* @author Sebastian Baumhekel
*/
public class PGbox3d extends PGboxbase
{
/**
* Type of the {@link PGobject}.
*/
private static final String PG_TYPE = "box3d";
/* JDK 1.5 Serialization */
private static final long serialVersionUID = 0x100;
/**
* Constructs an instance.
*/
public PGbox3d()
{
super(PG_TYPE);
}
/**
* Constructs an instance.
* @param llb lower-left point
* @param urt upper-right point
*/
public PGbox3d(Point llb, Point urt)
{
super(PG_TYPE, llb, urt);
}
/**
* Constructs an instance.
* @param value WKT
* @throws SQLException
*/
public PGbox3d(String value) throws SQLException
{
super(PG_TYPE, value);
}
@Override
public PGbox3d clone() throws CloneNotSupportedException
{
return (PGbox3d)super.clone();
}
@Override
public String getPrefix()
{
return "BOX3D";
}
@Override
public boolean is3d()
{
return true;
}
/**
* Gets this {@link Point} as a 2d object.
* @return {@link Point}
*/
public PGbox2d to2d()
{
return new PGbox2d(llb.to2d(), urt.to2d());
}
}