001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/io/shpapi/shape_new/Shape.java $
002 /*---------------- FILE HEADER ------------------------------------------
003 This file is part of deegree.
004 Copyright (C) 2001-2008 by:
005 Department of Geography, University of Bonn
006 http://www.giub.uni-bonn.de/deegree/
007 lat/lon GmbH
008 http://www.lat-lon.de
009
010 This library is free software; you can redistribute it and/or
011 modify it under the terms of the GNU Lesser General Public
012 License as published by the Free Software Foundation; either
013 version 2.1 of the License, or (at your option) any later version.
014
015 This library is distributed in the hope that it will be useful,
016 but WITHOUT ANY WARRANTY; without even the implied warranty of
017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
018 Lesser General Public License for more details.
019
020 You should have received a copy of the GNU Lesser General Public
021 License along with this library; if not, write to the Free Software
022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
023
024 Contact:
025
026 Andreas Poth
027 lat/lon GmbH
028 Aennchenstr. 19
029 53177 Bonn
030 Germany
031 E-Mail: poth@lat-lon.de
032
033 Prof. Dr. Klaus Greve
034 Department of Geography
035 University of Bonn
036 Meckenheimer Allee 166
037 53115 Bonn
038 Germany
039 E-Mail: greve@giub.uni-bonn.de
040
041 ---------------------------------------------------------------------------*/
042 package org.deegree.io.shpapi.shape_new;
043
044 import org.deegree.model.spatialschema.Geometry;
045
046 /**
047 * <code>Shape</code> defines methods to read, write and use objects read from/written to a
048 * shapefile (as well as some basic information).
049 *
050 * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
051 * @author last edited by: $Author: apoth $
052 *
053 * @version $Revision: 9342 $, $Date: 2007-12-27 13:32:57 +0100 (Do, 27 Dez 2007) $
054 */
055 public interface Shape {
056
057 /**
058 * Reads the object from a byte array.
059 *
060 * @param bytes
061 * @param offset
062 * where to start reading
063 * @return the new offset or -1, if the type was wrong.
064 */
065 public int read( byte[] bytes, int offset );
066
067 /**
068 * Writes the object to a byte array.
069 *
070 * @param bytes
071 * @param offset
072 * @return the new offset.
073 */
074 public int write( byte[] bytes, int offset );
075
076 /**
077 * @return the number of bytes necessary to write this instance.
078 */
079 public int getByteLength();
080
081 /**
082 * @return the type of the shape
083 */
084 public int getType();
085
086 /**
087 * @return the shapes' envelope, or null, if it has none
088 */
089 public ShapeEnvelope getEnvelope();
090
091 /**
092 * @return the shape as deegree Geometry
093 * @throws ShapeGeometryException
094 * if the deegree geometry could not be constructed
095 */
096 public Geometry getGeometry()
097 throws ShapeGeometryException;
098
099 }