资源简介
使用Java实现的R树结构,可以自动生成大量矩形或自己修改输入固定的矩形。根据最小扩大原则和Guttman的经典算法实现的结构。经过测试,构建的最小MBR结果都是正确的。可以直接在eclipse下运行。
代码片段和文件信息
//ABL.java
//
//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.
package rtree;
//package rtree;
/**Active Branch List
This class will consist of the Elements and their MINDIST from the point of query.
When the array of this object is returned by the ‘nearestSearch‘ method
kindly type cast ‘Elemen‘t to ‘LeafElement‘ when necessary.
This library should be considered as an open source library. Formal GNU licensing I will include later.
*/
public class ABL implements Cloneable
{
/**
Please type cast it to LeafElement when used as a returned value of
the ‘nearestSearch‘ method.
*/
public Element element;
/**By Definition - The distance of a point P in Euclidean space (E(n))
from a rectangle R in the same space denoted by MINDIST(PR).
In English - This is the minimum distance between the query point P
and the MBR of the object.
Note:- The distance(minDist) is the square of the actual distance.
To get the actual distance call Math.sqrt(minDist) (cast minDist to
Double).
*/
public long minDist;//MINDIST(Pthis)
public ABL(Element elementlong minDist)
{
this.element = element;
this.minDist = minDist;
}
//Uses Two-Way-Merge-Sort (Recursive)
//Sorts an ABL array based on minDist. Make sure there are no null values.
public void mergeSort(ABL[] arrABL)
{
twoWayMerge(arrABL0arrABL.length-1);
}
private void twoWayMerge(ABL[] arrABLint startint finish)
{
try{
int size = finish - start+1;
if(size <= 2){
if(size < 2)
return;
ABL temp;
if(arrABL[start].minDist > arrABL[finish].minDist){
temp = arrABL[start];
arrABL[start] = arrABL[finish];
arrABL[finish] = temp;
}
return;
}
Double middle = new Double(start+finish);
middle = new Double(Math.ceil(middle.doubleValue()/2));
twoWayMerge(arrABLstartmiddle.intValue());
twoWayMerge(arrABLmiddle.intValue()finish);
simpleMerge(arrABLstartmiddle.intValue()finish);
}
catch(Exception e){
System.out.println(“rtree.ABL.twoWayMerge: most probably a null value in array“);
}
}
//simple merge
private void simpleMerge(ABL[] arrABLint firstint secondint third)
throws Exception
{
int i = first;
int j = second;
int l = 0;
ABL[] temp = new ABL[third-first+1];
while((i < second) && (j <= third)){//loop till one lasts
if(arrABL[i].minDist <= arrABL[j].minDist)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 299 2009-02-17 20:25 Rtree-eclipse\rtree\.classpath
文件 381 2009-02-17 20:25 Rtree-eclipse\rtree\.project
文件 634 2009-02-17 20:25 Rtree-eclipse\rtree\.settings\org.eclipse.jdt.core.prefs
文件 2044 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\ABL.class
文件 315 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\app.dat
文件 4071 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\BufferHeader.class
文件 5148 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\CachedNodes.class
文件 3249 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\ChangeLog
文件 1093 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\Element.class
文件 372 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\ElementNotFoundException.class
文件 8454 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\FileHdr.class
文件 442 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\IllegalValueException.class
文件 1173 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\CompElmtX.class
文件 863 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\CompRectX.class
文件 1590 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\ContainedByPred.class
文件 1533 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\ContainsPred.class
文件 1504 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\EqualsPred.class
文件 1428 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\IntersectPred.class
文件 5363 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\Join.class
文件 426 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\JoinException.class
文件 1022 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\MeetPred.class
文件 812 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\Pair.class
文件 998 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\PairElmt.class
文件 592 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\Predicate.class
文件 2454 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\join\SweepLine.class
文件 2383 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\LeafElement.class
文件 1405 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\Logic.txt
文件 22943 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\Node.class
文件 354 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\NodeEmptyException.class
文件 351 2009-02-17 20:25 Rtree-eclipse\rtree\bin\rtree\NodeFullException.class
............此处省略84个文件信息
相关资源
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
评论
共有 条评论