コード例 #1
0
ファイル: XHybridIndex.java プロジェクト: danhan/Huploader
  /**
   * @deprecated match the input rectangle to support range query the return is
   * @param x
   * @param y
   * @param radius
   * @return an array of two boxes object, and the first box represents the left top point and the
   *     second box represents the right bottom point
   */
  public Hashtable<String, XBox[]> dmatch(double x, double y, double radius) {
    System.out.println("in matching./..." + x + ";" + y);
    Rectangle2D.Double matchRect =
        new Rectangle2D.Double(x - radius, y - radius, 2 * radius, 2 * radius);
    List<XQuadTree> tiles = this.quadtree.tileMatch(x, y, radius);
    Hashtable<String, XBox[]> result = null;
    try {
      if (tiles != null && tiles.size() > 0) {
        result = new Hashtable<String, XBox[]>();
        for (int i = 0; i < tiles.size(); i++) {
          XQuadTree oneTile = tiles.get(i);
          String tileIndex = oneTile.getIndex();
          // get the tile rect where the point is located
          Rectangle2D.Double tile_rect = oneTile.getM_rect();
          Point2D.Double offsetPoint = new Point2D.Double(tile_rect.getX(), tile_rect.getY());
          X2DGrid grid = new X2DGrid(tile_rect, this.cell_size, offsetPoint);
          XBox[] range = grid.intersect(matchRect);
          result.put(tileIndex, range);
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return result;
  }
コード例 #2
0
ファイル: XHybridIndex.java プロジェクト: danhan/Huploader
 public void getTiles(XQuadTree treeNode) {
   if (!treeNode.isHasChild()) { // this is the leaf node     	
     Rectangle2D.Double tile_rect = treeNode.getM_rect();
     Point2D.Double offsetPoint = new Point2D.Double(tile_rect.getX(), tile_rect.getY());
     X2DGrid grid = new X2DGrid(tile_rect, this.cell_size, offsetPoint);
     this.m_tiles.put(treeNode.getIndex(), grid);
   } else {
     this.getTiles(treeNode.getM_tl_child());
     this.getTiles(treeNode.getM_tr_child());
     this.getTiles(treeNode.getM_bl_child());
     this.getTiles(treeNode.getM_br_child());
   }
 }
コード例 #3
0
ファイル: XHybridIndex.java プロジェクト: danhan/Huploader
 /**
  * @deprecated get index for the data point, the column index should be appended the location id
  *     later row index: (QT tile index - row index, column index)
  * @param x latitude of the location point
  * @param y longitude of the location point
  * @return
  */
 public String[] dlocate(double x, double y) {
   // filter the tile with quad tree first
   XQuadTree tile = this.quadtree.locate(x, y);
   // get index in the first level
   String tile_index = tile.getIndex();
   // get the tile rect where the point is located
   Rectangle2D.Double tile_rect = tile.getM_rect();
   Point2D.Double offsetPoint = new Point2D.Double(tile_rect.getX(), tile_rect.getY());
   X2DGrid grid = new X2DGrid(tile_rect, this.cell_size, offsetPoint);
   XBox box = grid.locate(x, y);
   String[] indexes = new String[2];
   indexes[0] = tile_index + "-" + box.getRow();
   indexes[1] = box.getColumn();
   // System.out.println("row=> "+indexes[0]+";column=>"+indexes[1]);
   return indexes;
 }