Simple GIS

GISプログラムの練習

hana

package face7;

import tool.*;

public class catchdata {

    String urlx;
String data=new String[5000];
int s,datanumber,pointnumber;
int sx;

String point=new String[500];
String id=new String[500];
int px=new int[500];
int py=new int[500];
double p=new double[500];
String str,bou,right,left;
int p1,p2;
 
int x,y,w,h;
int rx,ry,lx,ly;

int nnumber;
  int nx=new int[500];
int ny=new int[500];  
    
void makedata(String pic){

    urlx=" http://detectface.com/api/detect?url="+pic+"&m=2";
    
    
    getdata sub=new getdata();
    sub.makedata(urlx,"UTF-8");
    data=sub.data;
    datanumber=sub.datanumber;
    
    sx=0;
    for(s=1;s<datanumber+1;s++){
    str=data[s];
    if(str.indexOf("<point")>-1)sx=sx+1;
     if(str.indexOf("<point")>-1)point[sx]=data[s];
    }
    
    pointnumber=sx;
    
    for(s=1;s<pointnumber+1;s++){
     str=point[s];   
    p1=str.indexOf("id=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    id[s]=str.substring(p1+1,p2);
    }
    
    
    
    for(s=1;s<pointnumber+1;s++){
     str=point[s];   
    p1=str.indexOf("x=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    px[s]=Integer.parseInt(str);
    }
    
    for(s=1;s<pointnumber+1;s++){
     str=point[s];   
    p1=str.indexOf("y=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    py[s]=Integer.parseInt(str);
    }
    
    for(s=1;s<pointnumber+1;s++){
    str=point[s];   
    p1=str.indexOf("s=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    p[s]=Double.parseDouble(str);
    }

    
     bou="";
     right="";
     left="";
    for(s=1;s<datanumber+1;s++){
    str=data[s];
    if(str.indexOf("<bounds")>-1)bou=data[s];
    if(str.indexOf("<right")>-1)right=data[s];
    if(str.indexOf("<left")>-1)left=data[s];
    }
    
    
    str=bou;   
    p1=str.indexOf("x=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    x=Integer.parseInt(str);
     
    str=bou;   
    p1=str.indexOf("y=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    y=Integer.parseInt(str);
    
    str=bou;   
    p1=str.indexOf("width=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    w=Integer.parseInt(str);
     
    str=bou;   
    p1=str.indexOf("height=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    h=Integer.parseInt(str);
    
    str=right;   
    p1=str.indexOf("x=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    rx=Integer.parseInt(str);
     
    str=right;   
    p1=str.indexOf("y=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    ry=Integer.parseInt(str);
    
     str=left;   
    p1=str.indexOf("x=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    lx=Integer.parseInt(str);
     
    str=left;   
    p1=str.indexOf("y=");
    p1=str.indexOf("'",p1);
    p2=str.indexOf("'",p1+1);
    str=str.substring(p1+1,p2);
    ly=Integer.parseInt(str);
 
    int c1,n;
    String strx;
    c1=0;
    
    for(s=1;s<pointnumber+1;s++){
    str=id[s];
    strx="";
    n=0;
    if(str.indexOf("N")>-1)c1=c1+1;
    if(str.indexOf("N")>-1)strx=str.replace("N","");
     if(str.indexOf("N")>-1)n=Integer.parseInt(strx);
      if(str.indexOf("N")>-1)nx[n]=px[s];
       if(str.indexOf("N")>-1)ny[n]=py[s];
    }
    
    nnumber=c1;
    
    
    
    
    
    
}
}