Package org.geotools.caching.spatialindex

Examples of org.geotools.caching.spatialindex.NodeIdentifier


   
   
    private void releaseLocks(){
      try {
        for (Iterator<NodeIdentifier> iterator = writelocks.iterator(); iterator.hasNext();) {
          NodeIdentifier type = (NodeIdentifier) iterator.next();
          try{
              type.writeUnLock();
          }catch (Exception ex){
          //    logger.log(Level.SEVERE, "Could not release write lock.", ex);
          }
        }
      } catch (Exception ex) {
          logger.log(Level.SEVERE, "Could not release write locks.", ex);
      }
      try {
        for (Iterator<NodeIdentifier> iterator = readlocks.iterator(); iterator.hasNext();) {
          NodeIdentifier type = (NodeIdentifier) iterator.next();
          try{
              type.readUnLock();
          }catch (Exception ex){
          //    logger.log(Level.SEVERE, "Could not release read lock.", ex);
          }
        }
      } catch (Exception ex) {
View Full Code Here


     
      GridRootNode gn = g.getRootNode();
      tovisit.add(gn.getIdentifier());
      if (nodeids != null) {
            for( Iterator<NodeIdentifier> iterator = nodeids.iterator(); iterator.hasNext(); ) {
                NodeIdentifier id = (NodeIdentifier) iterator.next();
                if (id.isValid()) {
                    tovisit.add(id);
                }
            }
            init();
        }
View Full Code Here

      if (currentNodeIterator == null || !currentNodeIterator.hasNext()){
        if (tovisit.size() == 0){
          //nothing found; no other things to look at
          return null;
        }
        NodeIdentifier nodeid = tovisit.pop();
        GridNode currentNode = (GridNode)grid.readNode(nodeid);
        currentNodeIterator = currentNode.getData().iterator();
      }
    }
   
View Full Code Here

  public boolean evict() {
    synchronized (queue) {
      Iterator<NodeIdentifier> it = queue.keySet().iterator();
      while (it.hasNext()) {
        NodeIdentifier node = it.next();
        if (!node.isLocked()) {
          try {
            node.writeLock();
            try {
              tree.evict(node);
              queue.remove(node);
            } finally {
              node.writeUnLock();
            }
          } catch (Exception ex) {
            ex.printStackTrace();
            return false;
          }
View Full Code Here

        // done.
        boolean recordaccess = this.tracker.getDoRecordAccess();
        try {
            this.tracker.setDoRecordAccess(false);
            for( Iterator<NodeIdentifier> iterator = nodes.iterator(); iterator.hasNext(); ) {
                NodeIdentifier nodeIdentifier = (NodeIdentifier) iterator.next();
                nodeIdentifier.setValid(true);
            }
        } finally {
            this.tracker.setDoRecordAccess(recordaccess);
        }
    }
View Full Code Here

        // done.
        boolean recordaccess = this.tracker.getDoRecordAccess();
        try {
            this.tracker.setDoRecordAccess(false);
            for( Iterator<NodeIdentifier> iterator = nodes.iterator(); iterator.hasNext(); ) {
                NodeIdentifier nodeIdentifier = (NodeIdentifier) iterator.next();
                nodeIdentifier.setValid(false);
            }
        } finally {
            this.tracker.setDoRecordAccess(recordaccess);
        }
    }
View Full Code Here

        boolean added = false;
        if (cc.getChildCount() > MAX_INSERTION) {
            GridRootNode node = getRootNode();
            added = insertDataToNode(node, data, shape);
        } else {
            NodeIdentifier next = null;
            while( (next = cc.getNext()) != null ){
                if (insertDataToNodeID(next, data, shape)){
                    added = true;
                }
            }
View Full Code Here

        if(bounds == null){
            return;             //cannot do anything because we need to know the bounds of the data.
        }
        this.mbr = new Region(new double[] { bounds.getMinX(), bounds.getMinY() }, new double[] { bounds.getMaxX(), bounds.getMaxY() });
        this.dimension = this.mbr.getDimension();
        NodeIdentifier id = findUniqueInstance(new RegionNodeIdentifier(this.mbr));
        //GridRootNode tmpRootNode = new GridRootNode(gridsize, (RegionNodeIdentifier)id);
       
        this.rootNode = null;
        try{
            this.rootNode = storage.get(id);
View Full Code Here

      
       //here we need to visit just the children that may intersect
        List<Integer> childrenindex = tmpRoot.getChildren(query);
        for( Iterator<Integer> iterator = childrenindex.iterator(); iterator.hasNext(); ) {
            Integer childid = (Integer) iterator.next();
            NodeIdentifier child = tmpRoot.getChildIdentifier(childid);
            Node childNode = readNode(child);
            v.visitNode(childNode);
            if (v.isDataVisitor()) {
                visitData(childNode, v, query, type);
            }
View Full Code Here

        List<NodeIdentifier> missing = new ArrayList<NodeIdentifier>();
        List<NodeIdentifier> found = new ArrayList<NodeIdentifier>();

        if (!this.root.isValid()) {
            NodeCursor cc = new NodeCursor(getRootNode(), search);
            NodeIdentifier next = null;
            while ((next=cc.getNext()) != null){
                if (!next.isValid()){
                    missing.add(next);
                }else{
                    found.add(next);
                }
            }
View Full Code Here

TOP

Related Classes of org.geotools.caching.spatialindex.NodeIdentifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.