001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/io/quadtree/Node.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.io.quadtree;
037    
038    import java.util.List;
039    
040    import org.deegree.model.spatialschema.Envelope;
041    
042    /**
043     * TODO add documentation here
044     *
045     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
046     * @author last edited by: $Author: mschneider $
047     *
048     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
049     */
050    interface Node<T> {
051    
052        /**
053         * @return the id of the Node
054         */
055        public String getId();
056    
057        /**
058         * inserts a new item into the quadtree
059         *
060         * @param item
061         *            (or it's id) which shall be inserted into the quadtree.
062         * @param itemEnv
063         *            the bbox of the item
064         * @return true if the insertion occurred false otherwise.
065         * @throws Exception
066         *             if an error occurred while inserting the specified node.
067         */
068        public boolean insert( T item, Envelope itemEnv )
069                                throws Exception;
070    
071        /**
072         * returns a List containing all items whose envelope intersects with the passed one
073         *
074         * @param searchEnv
075         * @param visitor
076         * @param level
077         *
078         * @return a List containing all items whose envelope intersects with the passed one
079         * @throws Exception
080         *             if an error occurred while acquiring all nodes.
081         */
082        public List<T> query( Envelope searchEnv, List<T> visitor, int level )
083                                throws Exception;
084    
085        /**
086         * deletes a specific item from the tree (not the item itself will be deleted, just its
087         * reference will be.
088         *
089         * @param item
090         *            (or it's ide) to be deleted
091         * @param itemsEnvelope
092         *            bbox of the item
093         * @return true if the deletion occurred false otherwise.
094         * @throws Exception
095         *             if an error occurred while deleting the specified node.
096         */
097        public boolean delete( T item, Envelope itemsEnvelope )
098                                throws Exception;
099    
100        /**
101         * Updates the spatial reference of the given item.
102         *
103         * @param item
104         *            which spatial reference in the quadtree should be updated.
105         * @param newBBox
106         *            newBBox the new BBoundingbox of the item.
107         * @return true if the update occurred, false otherwise
108         */
109        public boolean update( T item, Envelope newBBox );
110    
111        /**
112         * deletes all references of items whose envelope intersects with the passed one (
113         *
114         * @see #delete )
115         * @param envelope
116         */
117        public void deleteRange( Envelope envelope );
118    
119    }