アットウィキロゴ

google map

package map;
 
 
public class pro {
 
    double lat,lon;
  int cx,cy,dy,dx;
 
     int h=500;
    int w=500;
  double delta;
 
int[][] memor=new int[h][w]; 
int[][] memog=new int[h][w]; 
int[][] memob=new int[h][w];  
 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
 pro(){  
 
   lat=34;
    lon=135;
    delta=1;    
 
 
    map sub=new map();
    sub.makedata(lat,lon);
    memor=sub.memor;
     memog=sub.memog;
     memob=sub.memob;
  cx=sub.cx;
  cy=sub.cy;
  dx=sub.dx;
  dy=sub.dy;
 
 
 
  double x1,y1;
  int x2,y2;
 
  x1=133.7-lon;
  y1=34.6-lat;
 
 
 
  x2=(int)(cx+x1*dx);
  y2=(int)(cy+y1*dy);
 
  System.out.println(x2+","+y2);
 
 
graph sub7=new graph();
sub7.memor=memor;
sub7.memog=memog;
sub7.memob=memob;
sub7.x2=x2;
sub7.y2=y2;
sub7.makedata("x.jpg");
 
 
 
 
  }
 
}
 
 
 
 
 
package map;
 
 
public class map {
 
     String urlx,urlxs;
    double lat,lon,delta;
 
 
 
    int h=500;
    int w=500;
 
int[][] memor=new int[h][w]; 
int[][] memog=new int[h][w]; 
int[][] memob=new int[h][w];  
 
 int[][] memors=new int[h][w]; 
int[][] memogs=new int[h][w]; 
int[][] memobs=new int[h][w];  
 
int subnumber;
int[] subx=new int[5500];
int[] suby=new int[5500];
 
int[] px=new int[4];
int[] py=new int[4];
 
 
int[] magicx=new int[100];
int[] magicy=new int[100];
int magicnumber;
 
int cx,cy,dy,dx;
 
void makedata(double lat,double lon){
 
delta=1;    
 
urlx=makeurl(lat,lon);
 
   urlxs=makemarker(lat,lon,delta); 
 
   catchimg sub=new catchimg();
sub.makedata(urlx);
memor=sub.memor;
memog=sub.memog;
memob=sub.memob;
 
catchimg sub3=new catchimg();
sub3.makedata(urlxs);
memors=sub3.memor;
memogs=sub3.memog;
memobs=sub3.memob;
 
sabun();
 
group sub4=new group();
sub4.xx=subx;
sub4.yy=suby;
sub4.number=subnumber;
sub4.makedata();
px=sub4.px;
py=sub4.py;
 
int s,minx,maxx,miny,maxy;
 
minx=999;
for(s=1;s<4;s++){
if(px[s]<minx)minx=px[s];
}
 
maxx=0;
for(s=1;s<4;s++){
if(px[s]>maxx)maxx=px[s];
}
 
miny=999;
for(s=1;s<4;s++){
if(py[s]<miny)miny=py[s];
}
 
maxy=0;
for(s=1;s<4;s++){
if(py[s]>maxy)maxy=py[s];
}
 
dx=maxx-minx;
dy=miny-maxy;
cx=minx;
cy=maxy;
 
 
    }
 
    double seekx(double lonx){     
 
    double x1;
  double z1,z2,c1,c2;
  x1=0;
 
  z2=change(lonx)-change(lon); 
 
  x1=cx+dx*z2;
 
    return x1;
        }
 
double change(double v){
int v1;
double v2,v3,v4;
v1=(int)v;
v2=v-v1;
v3=100*v2/60;        
v4=v1+v3;
return v4;
        }
 
double seeky(double latx){     
 
 
    double x1;
  double z1,z2,c1,c2;
  x1=0;
 
  z2=change(latx)-change(lat); 
 
  x1=cy+dy*z2;
 
    return x1;
        }
 
 
void sabun(){
 
    int sx,mx,nx;
    int r1,g1,b1,r2,b2,g2;
    int m1;
 
  sx=0;
for(mx=0;mx<h;mx++){
for(nx=0;nx<w;nx++){
r1=memor[mx][nx];
g1=memog[mx][nx];
b1=memob[mx][nx];   
r2=memors[mx][nx];
g2=memogs[mx][nx];
b2=memobs[mx][nx];   
m1=(r1-r2)*(r1-r2)+(g1-g2)*(g1-g2)+(b1-b2)*(b1-b2);
if(m1>500)sx=sx+1;
if(m1>500)subx[sx]=nx;
if(m1>500)suby[sx]=mx;
}
}
 
subnumber=sx;
 
 
}
 
String makeurl(double lat,double lon){
 String urlx;
 urlx="http://maps.google.com/maps/api/staticmap?center="+lat+","+lon+"&zoom=7&size=500x500&sensor=false";
 
    return urlx;   
}
 
String makemarker(double lat,double lon,double dx){
 String urlx;
 double lat1,lon1;
 lon1=lon+dx;
 lat1=lat+dx;
 urlx="http://maps.google.com/maps/api/staticmap?center="+lat+","+lon+"&zoom=7&size=500x500&sensor=false";
 urlx=urlx+"&markers="+lat+","+lon+"&markers="+lat+","+lon1+"&markers="+lat1+","+lon; 
    return urlx;   
}
 
 
 
}
 
 
 
 
 
package map;
 
 
public class group {
 
    int[] xx=new int[5500];
int[] yy=new int[5500];
int s,number,sx;
    int[] group=new int[5000];
 
int[] px=new int[4];
int[] py=new int[4];
 
 
    void makedata(){
 
        group[1]=1;
 
        int x1,y1,x2,y2,tx;
       int h,m1;
 
        s=1;
        group[s]=1;
        int g;
        g=1;
       for(s=1;s<number+1;s++){
        x1=xx[s];
        y1=yy[s];
        for(sx=1;sx<number+1;sx++){
       h=0;
       x2=xx[sx];
       y2=yy[sx];
       m1=met(x1,y1,x2,y2);
       if(m1<10)h=h+1;
       if(group[s]==g)h=h+1; 
       if(group[sx]==0)h=h+1; 
       if(h==3)group[sx]=g;
        }
       }
 
 
         s=search();
        group[s]=2;
        g=2;
       for(s=1;s<number+1;s++){
        x1=xx[s];
        y1=yy[s];
        for(sx=1;sx<number+1;sx++){
       h=0;
       x2=xx[sx];
       y2=yy[sx];
       m1=met(x1,y1,x2,y2);
       if(m1<10)h=h+1;
       if(group[s]==g)h=h+1; 
       if(group[sx]==0)h=h+1; 
       if(h==3)group[sx]=g;
        }
       }
 
          s=search();
        group[s]=3;
        g=3;
       for(s=1;s<number+1;s++){
        x1=xx[s];
        y1=yy[s];
        for(sx=1;sx<number+1;sx++){
       h=0;
       x2=xx[sx];
       y2=yy[sx];
       m1=met(x1,y1,x2,y2);
       if(m1<10)h=h+1;
       if(group[s]==g)h=h+1; 
       if(group[sx]==0)h=h+1; 
       if(h==3)group[sx]=g;
        }
       }
 
 
       int n,maxh;
 
       n=count();
 
       for(g=1;g<4;g++){
           maxh=0;
           sx=0;
       for(s=1;s<number+1;s++){
       h=0;
       if(group[s]==g)h=h+1;
       if(yy[s]>maxh)h=h+1;
       if(h==2)maxh=yy[s];
       if(h==2)sx=s;
       }
       px[g]=xx[sx];
       py[g]=yy[sx];
       }
 
 
 
    }
    int search(){
 
        int s,h,sx;
        sx=0;
        for(s=1;s<number+1;s++){
    h=0;
      if(group[s]==0)h=h+1;    
        if(sx==0)h=h+1;    
        if(h==2)sx=s;
        }
    return sx;
    }
 
    int count(){
    int s,g1;
        g1=0;
        for(s=1;s<number+1;s++){
    if(group[s]==0)g1=g1+1;
        }
    return g1;
 
    }
int met(int x1,int y1,int x2,int y2){
    int m1;
 m1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
 return m1;
}
}
 
 
 
 
package map;
 
import java.awt.*; 
import java.awt.Color;   
import java.awt.image.*;   
import java.awt.image.BufferedImage;   
import java.io.*;   
import javax.imageio.ImageIO;   
 
class graph{
 
    int h=500;
    int w=500;
int p1;
int s,sx;
String a1,a2;
 int[][] memor=new int[h][w]; 
int[][] memog=new int[h][w]; 
int[][] memob=new int[h][w];  
int mx,nx;
 
int w1,h1;
int x2,y2; 
 
 
 
void makedata(String file){
 
w1=500;
h1=500;    
BufferedImage off = new BufferedImage(w1, h1, BufferedImage.TYPE_INT_BGR);   
Graphics offsc = off.getGraphics(); 
offsc.setColor(Color.white); 
offsc.fillRect(0,0,w1,h1); 
offsc.setColor(Color.black); 
 
 
 
 
for(mx=0;mx<h;mx++){
for(nx=0;nx<w;nx++){
offsc.setColor(new Color(memor[mx][nx],memog[mx][nx],memob[mx][nx])); 
offsc.drawRect(nx,mx,1,1);
}
}
 
 
offsc.setColor(Color.black); 
offsc.fillRect(x2,y2,10,10);
 
offsc.dispose(); 
 
try { 
ImageIO.write(off, "jpeg", new File(file)); 
} catch (IOException exception) { exception.printStackTrace(); }     
}   
}
 
 
 
package map;
 
import java.awt.*; 
import java.awt.image.*; 
import java.net.URL;
import java.net.MalformedURLException;
 
public class catchimg {
 
PixelGrabber pg; 
Color col; 
Image img;
int red,green,blue; 
 
int mx,nx,m,n; 
int ex,ey; 
String s1,s2,s3,s4; 
URL urlx;
int w=500;
int h=500;
int[] pix=new int[w*h]; 
int[][] memor=new int[h][w]; 
int[][] memog=new int[h][w]; 
int[][] memob=new int[h][w];  
 
    void makedata(String pic){
 
 
 
        try{
urlx = new URL(pic);
    }catch(MalformedURLException e){e.printStackTrace();}
 
catchimg(urlx);  
 
} 
 
void catchimg(URL s){ 
 
img = Toolkit.getDefaultToolkit().getImage(s); 
pg = new PixelGrabber(img,0,0,w,h,pix,0,w); 
 
try{pg.grabPixels();}catch(InterruptedException ie){} 
m=0; 
n=0; 
for(int i=0;i<w*h;i++){ 
int p = pix[i]; 
col=new Color(pix[i]); 
red=col.getRed(); 
green=col.getGreen(); 
blue=col.getBlue(); 
memor[m][n]=red; 
memog[m][n]=green; 
memob[m][n]=blue; 
n=n+1; 
if (n==w)m=m+1; 
if (n==w)n=0; 
} 
 
 
 
} 
 
 
 
 
 
}
 
最終更新:2013年12月31日 04:49