function ZdcKyotenId(){ this.type = 'ZdcKyotenId'; this.result = false; this.text_data = null; } ZdcKyotenId.prototype.getResult = function(){ return this.result; } ZdcKyotenId.prototype.abort = function(){ if( this.httpReq ){ this.httpReq.abort(); } } ZdcKyotenId.prototype.search = function(opts, callback){ var owner = this; var enc = ZDC_ENC; var target_url = ""; if (opts.nolog) { target_url = "http://127.0.0.1/cgi/kyotenid_nolog.cgi"; } else { target_url = "http://127.0.0.1/cgi/kyotenid.cgi"; } var prm = ''; prm += '&key=40nQgP9tlg2vBwnAbvBhnAdf9TmgkPBDidJ5SAXutmAefx8zTlrxszTurxhzTungyXBWoQvv8VoQozFzpR6zTh'; prm += '&cid='+opts.cid; prm += '&kid='+opts.kid; prm += '&type=1'; prm += '&opt=decorte'; prm += '&enc='+enc; var request_url = target_url+'?'+prm; this.httpReq = new ZdcEmapHttpRequest('EUC', 'EUC'); this.httpReq.request(request_url, function(reference_text,status){ var result = new ZdcKyotenIdResult(reference_text, status); result.type = owner.type; result.options = opts; owner.result = result; ZdcEvent.trigger(owner, "end", result); if( callback != null ){ callback(result); } }, opts.timeout); } function ZdcKyotenIdOptions(){ //default値 this.cid = '99999999'; this.kid = ''; this.timeout = 60000; this.nolog = true; // ログ出力抑制 } function ZdcKyotenIdResult(text_data, status){ if( text_data == null ){ ZdcSetErrorStatus.call(this, '', status); return; } //header var res = new Array(); res = text_data.split('\n'); var header = res.shift(); var cols = header.split('\t'); var retcd = cols[0]; var cnt = parseFloat(cols[1]); var hitcnt = parseFloat(cols[2]); //Parameter Error Check if( retcd.charAt(3) == '1' ){ ZdcSetErrorStatus.call(this, retcd); return; } //record this.retCode = retcd; this.type = ''; this.status = status; this.recCount = cnt; this.hitCount = hitcnt; if (cnt > 0) { cols = res[0].split('\t'); // 拠点縮尺(PC) lvl = cols[cols.length-2]; if (!lvl || lvl < 1 || lvl >18) lvl = 0; this.item = new ZdcKyotenIdItem(cols,lvl); } } function ZdcKyotenIdItem(cols,lvl){ this.lat = cols[0]; this.lon = cols[1]; this.icon = cols[2]; this.gif = cols[3]; this.nflg = cols[4]; this.name = cols[5]; this.addr = cols[6]; this.col_01 = cols[7]; this.col_02 = cols[8]; this.col_03 = cols[9]; this.col_08 = cols[10]; this.col_09 = cols[11]; this.col_10 = cols[12]; this.col_11 = cols[13]; this.col_12 = cols[14]; this.col_07 = cols[15]; this.lvl = lvl; }