myMapTag
6853 ワード
var tagpoint = {};
var tagline = {};
var magtype = "";
function mapTagCallBack(geo,type){
magtype = type;
if(type == "point"){
tagpoint = geo;
}else{
tagline = geo;
}
markDlg();
}
/**
* dialog
*/
function markDlg(lon,lat){
art.dialog({id:'mark'}).close();
art.dialog({
id: "mark",
title:"<span style='background:no-repeat;padding-left:20px;'> </span>",
padding: '5px',
content: $('#markDiv')[0],
drag:true,
close:function(){
$("#markName").val("");
$("#nullAlam").text(" ");
}
});
}
/**
* dialog
*/
function markListDialog(){
$("#markBtn").addClass("focus");
art.dialog({id:'markListDiv'}).close();
art.dialog({
id: "markListDiv",
title:"<span style='background:no-repeat;padding-left:20px;'> </span>",
padding: '5px',
content: $('#markListDiv')[0],
follow:$("#fullsc")[0],
drag:true,
close:function(){
$(".quickSearch .focus").removeClass("focus");
removeAllMapTag();
}
});
/*var This = this;
var $dialog = $("<div id='maptagDiag' style='color:#838383;display:none;position:absolute;left:1170px;top:105px;border: 1px solid #ccc;padding: 10px;box-shadow: #aaa 1px 1px 5px;background: #eee;width: 250px; height: 300px;'>" +
"<h3 style='margin-bottom: 5px;margin-left: 215px;'><a onclick='closeDiag();' style='cursor:pointer'> </a></h3>" +
"<h3 style='margin-bottom: 5px;'> :</h3>" +
"<div style='width: 250px;'>"+
"<p align='center' style='margin-top: 5px;height: 25px;'>"+
"<span> :</span>"+
"<input type='text' id='mapTagSear' placeholder=' ' class='searchTip inputC'/>"+
"<input type='button' class='btn_search' id='btnMarkSearch' value=' ' onclick='getMark();' style='width: 40px;height: 25px;'/>"+
"<span id ='markSearchCount' style='float:right;color:orange;height: 24px;line-height: 24px;'>"+
"</span>"+
"</p>"+
"</div>"+
"<div class='result' style='width:240px;height:260px;'>"+
"<table id='maptagtable' class='yfTable'>"+
"</table>"+
"</div>"+
"</div>");
$dialog.appendTo("body");
$("#maptagDiag").show();*/
}
function closeDiag(){
$("#maptagDiag").hide();
removeAllMapTag();
}
/**
*
*/
function addMark(){
if($("#markName").val() == ""){
$("#nullAlam").text(" ");
return;
}
var name = $("#markName").val();
if(magtype == "point"){
var paths = tagpoint.x + ',' + tagpoint.y;
var geometry = 1;
}else{
var paths = tagline.paths.toString();
var geometry = 2;
}
Sk.Net.postJson("command",{cmd:"gueryMapTagList"},function(data){
json = data.datas.mapTagList;
var flag = false;
for(var i in json){
if(json[i].paths==paths){
flag=true;
break;
}
}
if(flag==true){
diagMapTag();
art.dialog({id:'mark'}).close();
}else{
Sk.Net.postJson("command",{cmd:"addMapTag",name:name,paths:paths,geometry:geometry},function(data){
});
art.dialog({id:'mark'}).close();
markListDialog();
getMark();
}
});
}
/**
* dialog
*/
function diagMapTag(){
artDialog({
content:' !',
lock:true,
ok:function(){
close:true;
}
});
}
/**
*
*/
function getMark(val){
var name = $("#mapTagSear").val();
if(isNaN(name)){
$.extend(condition,{name:name});
}
condition = {name:name,geometry:val} ;
var opts = $.extend({cmd :"gueryMapTagList"}, condition);
Sk.Net.postJson("command",opts, function(data){
json = data.datas.mapTagList;
layerControl.clear("maptag");
for(var i in json){
var point;
mapManager.map.infoWindow.show();
layerControl.show("maptag");
if(json[i].geometry==1){
json[i].longitude = json[i].path[0].longitude;
json[i].latitude = json[i].path[0].latitude;
json[i].geometry = json[i].geometry;
}else if(json[i].geometry==2){
var linePoints = {
pointArray:[],
spatialReference:4326
};
linePoints.pointArray.push([]);
if (json[i].path != null) {
for (var count = 0; count < json[i].path.length; count++) {
var lonlat = json[i].path[count];
if (lonlat != null ) {
linePoints.pointArray[0].push([lonlat.longitude, lonlat.latitude]);
}
}
}
json[i].linePoints = linePoints;
}
}
layerControl.setDatas("maptag",json);
$("#maptagtable").yfTable("setDatas",data.datas.mapTagList);
return;
});
}
/**
*
*/
function rowClick(event){
};
/**
*
*/
function deleteMapTag(val){
artDialog({
content:' ?',
lock:true,
ok:function(){
Sk.Net.postJson("command",{cmd:"delMapTag",id:val},function(data){
getMark();
});
}
});
}
/**
*
*/
function removeAllMapTag(){
mapManager.map.infoWindow.hide();
layerControl.hide("maptag");
$(".event_infor").fadeOut("slow");
}