function ZdcNearShop(){
this.type = 'ZdcNearShop';
this.result = false;
this.text_data = null;
}
ZdcNearShop.prototype.getResult = function(){
return this.result;
}
ZdcNearShop.prototype.abort = function(){
if( this.httpReq ){
this.httpReq.abort();
}
}
ZdcNearShop.prototype.search = function(opts, callback){
var owner = this;
//var enc = ZDC_ENC;
var enc = "EUC";
var target_url = "http://127.0.0.1/cgi/nkyoten.cgi";
var prm = '';
prm += '&key=53nQ2P9tlg4vBGnAjvBvnAqf9FmgbPB5idj5SdXuomA4fhEzTErxAzTjrxpzThngszFIlgrnFDng0z46oRAL0ungdzFblg3nFengVz57oRuLTE';
prm += '&cid='+opts.cid;
prm += '&opt=nanaco';
prm += '&pos='+opts.startPos;
prm += '&cnt='+opts.maxCount;
prm += '&enc='+enc;
prm += '&lat='+opts.lat;
prm += '&lon='+opts.lon;
prm += '&latlon='+opts.latlon;
prm += '&jkn='+opts.jkn;
prm += '&rad='+opts.radius;
prm += '&knsu='+opts.limitCount;
prm += '&exkid='+opts.exceptKid;
prm += '&circle=1';
prm += '&hour=1';
prm += '&cust='+opts.cust; prm += '&exarea='+opts.exarea; prm += '&polycol='+opts.polycol;
var request_url = target_url+'?'+prm;
this.httpReq = new ZdcEmapHttpRequest('EUC', 'EUC');
this.httpReq.request(request_url, function(reference_text,status){
var result = new ZdcNearShopResult(reference_text, status);
result.type = owner.type;
result.options = opts;
owner.result = result;
ZDC.trigger(owner, "end", result);
if( callback != null ){
// mod 2013/04/15 H.Osamoto [
// callback(result);
// mod 2015/09/30 Y.Uesugi [
if (result.hitCount == 0 || result.hitCount < opts.minCount) {
//if (result.hitCount == 0) {
// mod 2015/09/30 Y.Uesugi [
if (opts.researchCount != "") {
var target_url = "http://127.0.0.1/cgi/nkyoten.cgi";
var prm = '';
prm += '&key=53nQ2P9tlg4vBGnAjvBvnAqf9FmgbPB5idj5SdXuomA4fhEzTErxAzTjrxpzThngszFIlgrnFDng0z46oRAL0ungdzFblg3nFengVz57oRuLTE';
prm += '&cid='+opts.cid;
prm += '&opt=nanaco';
prm += '&pos='+opts.startPos;
prm += '&cnt='+opts.researchCount;
prm += '&enc='+enc;
prm += '&lat='+opts.lat;
prm += '&lon='+opts.lon;
prm += '&latlon='+opts.latlon;
prm += '&jkn='+opts.jkn;
prm += '&rad=10000000';
prm += '&knsu='+opts.researchCount;
prm += '&exkid='+opts.exceptKid;
prm += '&circle=1';
prm += '&hour=1';
prm += '&cust='+opts.cust;
prm += '&exarea='+opts.exarea; prm += '&polycol='+opts.polycol;
var request_url = target_url+'?'+prm;
this.httpReq = new ZdcEmapHttpRequest('EUC', 'EUC');
this.httpReq.request(request_url, function(reference_text,status){
var result = new ZdcNearShopResult(reference_text, status);
result.type = owner.type;
result.options = opts;
// add 2016/01/27 H.Yasunaga search時の再検索のフラグ追加 [
result.researched = "1";
// add 2016/01/27 H.Yasunaga ]
owner.result = result;
ZDC.trigger(owner, "end", result);
if( callback != null ){
callback(result);
}
}, opts.timeout);
} else {
callback(result);
}
} else {
callback(result);
}
// mod 2013/04/15 H.Osamoto ]
}
}, opts.timeout);
}
function ZdcNearShopOptions(frewd){
//default値
this.cid = '99999999';
this.startPos = 1;
this.minCount = 0; this.maxCount = 30;
this.lat = '';
this.lon = '';
this.latlon = '';
this.jkn = '';
this.limitCount = 100; //指定件数
this.radius = 50000; //半径
this.timeout = 60000;
this.pointFlg = '2'; //暫定対応: default: 2 (ZDC ms)
this.exceptKid = ''; //除外する拠点
this.cust = ''; this.researchCount = ''; this.exarea = ''; this.polycol = ''; }
function ZdcNearShopResult(text_data, status){
if( text_data == null ){
ZdcSetErrorStatus.call(this, '', status);
return;
}
//header
var res = new Array();
//res = text_data.split(ZDC_HTTP_DMT[ZDC_ENC]);
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]);
var rest = ( retcd.charAt(3) == '0' && retcd.charAt(7) == '1' )? true : false;
//Parameter Error Check
if( retcd.charAt(3) == '1' ){
ZdcSetErrorStatus.call(this, retcd);
return;
}
//record
// add 2016/01/27 H.Yasunaga search時の再検索のフラグ追加 再検索した場合は"1"を設定 [
this.researched = "";
// add 2016/01/27 ]
this.retCode = retcd;
this.type = '';
this.status = status;
this.recCount = cnt;
this.hitCount = hitcnt;
this.rest = rest;
this.items = [];
for(var i=0; i18) lvl = 0;
var item = new ZdcNearShopItem(cols,lvl);
this.items.push(item);
}
}
function ZdcNearShopItem(cols,lvl){
this.id = cols[0];
this.lat = cols[1];
this.lon = cols[2];
this.icon = cols[3];
this.dist = cols[4];
this.nflg = cols[5];
this.col_02 = cols[6];
this.name = cols[7];
this.addr = cols[8];
this.col_09 = cols[9];
this.col_03 = cols[10];
this.col_05 = cols[11];
this.col_04 = cols[12];
this.col_08 = cols[13];
this.lvl = lvl;
}