package map;
import tool.*;
import java.util.HashMap;
public class pro {
String[] data=new String[50000];
int s,datanumber;
double[] lat=new double[500000];
double[] lon=new double[500000];
String[] geo=new String[500000];
String str;
double[] count=new double[500000];
String[] dic=new String[500000];
int met_x,met_y,sx;
HashMap<String,Integer> map = new HashMap<String,Integer>();
public static void main(String[] args) {
pro test=new pro();
}
pro(){
readfile sub=new readfile();
sub.makedata("shop.csv","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
for(s=1;s<datanumber;s++){
String[] x=data[s+1].split(",");
str=x[3].replace("\"","");
lat[s]=Double.parseDouble(str);
str=x[4].replace("\"","");
lon[s]=Double.parseDouble(str);
}
datanumber=datanumber-1;
for(s=1;s<datanumber+1;s++){
geo[s]=geo(lat[s],lon[s]);
}
int s1,s2,dicnumber,tx,h;
dicnumber=0;
for(s=1;s<datanumber+1;s++){
for(s1=-5;s1<6;s1++){
for(s2=-5;s2<6;s2++){
str=move(geo[s],s1,s2);
h=0;
if(map.containsKey(str))h=100;
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=str;
if(h<50)map.put(str,dicnumber);
}
}
}
int txs;
double z;
for(s=1;s<datanumber;s++){
for(s1=-5;s1<6;s1++){
for(s2=-5;s2<6;s2++){
str=move(geo[s],s1,s2);
txs=map.get(str);
z=s1*s1+s2*s2;
z=Math.sqrt(z)+1;
count[txs]=count[txs]+1/z;
}
}
}
System.out.println(dicnumber);
graph subg=new graph();
subg.geo=dic;
subg.count=count;
subg.datanumber=dicnumber;
subg.makedata("ren.jpg");
}
String move(String g,int dx,int dy){
String str;
if(g.indexOf("-")>-1)g="35504444";
int x1,x2,x3,y1,y2,y3;
str=g.substring(0,2);
y1=Integer.parseInt(str);
str=g.substring(2,4);
x1=Integer.parseInt(str);
str=g.substring(4,5);
y2=Integer.parseInt(str);
str=g.substring(5,6);
x2=Integer.parseInt(str);
str=g.substring(6,7);
y3=Integer.parseInt(str);
str=g.substring(7,8);
x3=Integer.parseInt(str);
x3=x3+dx;
y3=y3+dy;
if(y3>9)y2=y2+1;
if(y3>9)y3=y3-10;
if(y2>7)y1=y1+1;
if(y2>7)y2=0;
if(x3>9)x2=x2+1;
if(x3>9)x3=x3-10;
if(x2>7)x1=x1+1;
if(x2>7)x2=0;
if(y3<0)y2=y2-1;
if(y3<0)y3=y3+10;
if(y2<0)y1=y1-1;
if(y2<0)y2=7;
if(x3<0)x2=x2-1;
if(x3<0)x3=x3+10;
if(x2<0)x1=x1-1;
if(x2<0)x2=7;
str=""+y1+""+x1+""+y2+""+x2+""+y3+""+x3;
return str;
}
String geo(double xs,double ys){
double x,y;
int x1,x2,x3;
int y1,y2,y3;
x=xs-100;
y=1.5*ys;
y1=(int)y;
x1=(int)x;
y=y-y1;
y=8*y;
x=x-x1;
x=8*x;
y2=(int)y;
x2=(int)x;
y=y-y2;
y=10*y;
x=x-x2;
x=10*x;
y3=(int)y;
x3=(int)x;
String str;
str=""+y1+""+x1+""+y2+""+x2+""+y3+""+x3;
return str;
}
}
最終更新:2014年04月10日 09:46