#include #include #include #include /*データベースのパス*/ char CLR_PATH[] = "/home/www/cgi-bin/clr_db"; char DATA_PATH[] = "/home/www/cgi-bin/data_db"; char GEO_PATH[] = "/home/www/cgi-bin/geo_db"; char NAME_PATH[] = "/home/www/cgi-bin/name_db"; /*プロトコル各オプションの検出フラグ*/ struct options { int W; int N; int E; int S; int D; int DR; int DG; int DB; int L; int T; int M; int LG; }; struct options option; /*プロトコル値*/ float W = 0; float N = 0; float E = 0; float S= 0; char D[16] = ""; char DR[16] = ""; char DG[16] = ""; char DB[16] = ""; int L[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; int T=0; int M=0; char LG[8] = "ja"; int L_NUM = 12; /*計算用の参照変数:プロトコルによって一意に決定される*/ int Ordered_L_cnt; float SCOPEwidth; float sr; int match_id[33][16384]; int match_L[32]; float clr[36][5][256]; int clr_class[36]; long clrID[36][16384]; float clrData[36][16384]; char townName[4][4096][16]; int MAX_DEG_VAL = 999; int MIN_DEG_VAL = 0; /*計算用スタック:出力ポリゴン頂点セットを表示解像度にあわせて縮約する際*/ int stack[2][16384]; float x, y; /*ログファイル:プログラムデバッグ用*/ char LOGFILE_DEBUG[] = "CGI_output.log"; FILE *fz; int log_R, log_L, log_T; /*ログファイル:実際のユーザアクセスの記録用*/ char LOGFILE_ACCESS[] = "access.log"; int error_cnt_R; int error_cnt_L; long error_ID_R[1024]; long error_ID_L[1024]; /*-----------------------------------------------------------*/ int main(argc,argv) int argc; char *argv[]; { int N1 = 0; int N2 = 0; int i,j; char log_file[32]; int outN1=0; int outN2= 0; /*debug*/ sprintf(log_file, LOGFILE_DEBUG); /*debug*/ fz = fopen(log_file,"w"); /*debug*/ log_R = log_L = log_T = 1; memset(match_id,0,sizeof(match_id)); memset(match_L,0,sizeof(match_L)); error_cnt_R = 0; error_cnt_L = 0; memset(error_ID_R,0,sizeof(error_ID_R)); memset(error_ID_L,0,sizeof(error_ID_L)); /*ユーザーアクセスのログ記録*/ log_lec(); /*ヘッダー出力*/ printf("Content-type: text/html\n\n"); /*アプレットからのクエリーシーケンス解析*/ protocol_analisys(); /*クエリーのスコープにマッチするRegionデータのID検索*/ N1 = match_query('R',0); /*debug*/ fprintf(fz,"\n",N1); /*クエリーのスコープにマッチするLineデータのID検索*/ for(i=0; i\n",match_L[i]); N2 += match_L[i]; } } /*debug*/ fprintf(fz,"\n\n\n"); /*マッチしたRegionとLineとTextのID数をアウトプット*/ if(M==1) N1=N1+48; if(T==0) { printf("%d %d %d\n",N1,N2,0); /*debug*/ fprintf(fz,"%d %d %d\n",N1,N2,0); } else if(T==3) { printf("%d %d %d\n",N1,N2,N1*2); /*debug*/ fprintf(fz,"%d %d %d\n",N1,N2,N1*2); } else { printf("%d %d %d\n",N1,N2,N1); /*debug*/ fprintf(fz,"%d %d %d\n",N1,N2,N1); } if(M==1) N1=N1-48; /*Region用のclrファイルと統計データの読み込み*/ if(M==0) { clr_and_data_read('R',0,D); } else if(M==1) { clr_and_data_read('R',33,DR); clr_and_data_read('R',34,DG); clr_and_data_read('R',35,DB); } /*Line用のclrファイルと統計データの読み込み*/ for(i=0; i\n\n"); /*print_colorPatern();*/ } /*マッチしたLineの色彩データとgeoデータをアウトプット*/ for(i=0; i\n"); } if(N2==outN2) { /*debug*/ fprintf(fz,"\n"); } /*debug*/ fprintf(fz,"\n", error_cnt_R); for(i=0; i\n", error_ID_R[i]); } /*debug*/ fprintf(fz,"\n", error_cnt_L); for(i=0; i\n", error_ID_L[i]); } /*マッチしたRegionの名前テキストと位置をアウトプット*/ if(T>0) { townName_read(); } for(i=0;i\n", qs); option.W = 0; option.N = 0; option.E = 0; option.S = 0; option.D = 0; option.DR = 0; option.DG = 0; option.DB = 0; option.L = 0; option.T = 0; option.M = 0; option.LG = 0; Ordered_L_cnt = 0; j = 0; for(i=0;i<256;i++) { cc = qs[i]; if (cc == '=') { buff[j] = 0x00; strcpy(flag,buff); j=0; } else if (cc== '&' || cc == NULL) { buff[j] = 0x00; if(!strcmp(flag,"W")){ option.W = 1; W = atof(buff); } else if(!strcmp(flag,"N")){ option.N = 1; N = atof(buff); } else if(!strcmp(flag,"E")){ option.E = 1; E = atof(buff); } else if(!strcmp(flag,"S")){ option.S = 1; S = atof(buff); } else if(!strcmp(flag,"D")){ option.D = 1; strcpy(D,buff); } else if(!strcmp(flag,"DR")){ option.DR = 1; strcpy(DR,buff); } else if(!strcmp(flag,"DG")){ option.DG = 1; strcpy(DG,buff); } else if(!strcmp(flag,"DB")){ option.DB = 1; strcpy(DB,buff); } else if(!strcmp(flag,"L")){ option.L = 1; for(k=0;k<12;k++) { if(buff[k]=='1') { L[k] = 1; Ordered_L_cnt++; } } } else if(!strcmp(flag,"T")){ option.T = 1; T = atoi(buff); } else if(!strcmp(flag,"M")){ option.M = 1; M = atoi(buff); } else if(!strcmp(flag,"LG")){ option.LG = 1; buff[3] = 0x00; strcpy(LG,buff); } if(cc == NULL) break; j=0; } else { buff[j] = cc; j++; } } /*フィルタリングモードの時は海岸線を自動的に出す*/ if(M==1) { L[2] = 1; Ordered_L_cnt++; } /*debug*/ fprintf(fz,"