﻿/*
 * Geo/Echo Object Ajax
 * Copyright(C) 2007 NEC Software Chubu All rights reserved.
 * Version: 3.5.1.1
*/
var GEAJAX = document.getElementById('GEAJAX');
if (GEAJAX){
	GEAJAX.path = GEAJAX.src.substring(0, GEAJAX.src.lastIndexOf('/'));

function GEAlign(){}
GEAlign.LT=0;GEAlign.LC=1;GEAlign.LB=2;GEAlign.CT=3;GEAlign.CC=4;GEAlign.CB=5;GEAlign.RT=6;GEAlign.RC=7;GEAlign.RB=8;

function GEAngle(degree){this.degree=!GEValueCheck.isNumber(degree)?0:degree;}
GEAngle.fromRadian=function(radian){var val=!GEValueCheck.isNumber(radian)?0:radian;var degree=radian*(180.0/Math.PI);if(degree>360.0)
degree-=360.0;else if(degree<-360)
degree+=360.0;return new GEAngle(degree);}
GEAngle.prototype.getRadian=function(){return this.degree*(Math.PI/180.0);}
GEAngle.prototype.isZero=function(){return(this.degree==0);};GEAngle.prototype.equals=function(other){if(GEValueCheck.isNull(other))
return false;if(this.degree==other.degree)
return true;else
return false;}
GEAngle.prototype.toString=function(){return"Degree="+this.degree+","+"Radian="+this.getRadian();}
GEAngle.prototype.clone=function(){return new GEAngle(this.degree);}

function GEAttribute(){this.items=new Array();}
GEAttribute.prototype.add=function(item){this.items.push(item);}
GEAttribute.prototype.count=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return 0;else
return this.items.length;}
GEAttribute.prototype.clear=function(){if(GEValueCheck.isNull(this.items))
return;delete this.items;this.items=new Array();}
GEAttribute.prototype.toResponseText=function(){var str=new GEStringBuilder();if(GEValueCheck.isNull(this.items))
return'';for(var i=0;i<this.items.length;i++){if(i>0)str.append(",");if(!GEValueCheck.isNull(this.items[i])&&this.items[i].toString){str.append(this.items[i].toString());}
else{str.append('');}}
return escape(str.toString());}
GEAttribute.fromJSON=function(obj){if(obj==null)
return null;var result=new GEAttribute();for(var i=0;i<obj.length;i++){result.add(obj[i].val);}
return result;}

function GEBooleanCondition(){this._value="";}
GEBooleanCondition.equals=function(value){var condition=new GEBooleanCondition();condition._value=!GEValueCheck.isBoolean(value)?"":value.toString();return condition;}
GEBooleanCondition.prototype.toResponseText=function(){return!GEValueCheck.isString(this._value)?"":escape(this._value);}

﻿
GEBrowserIsCompatible=function(){if(GEBrowser.isIE||GEBrowser.isFireFox||GEBrowser.isOpera||GEBrowser.isSafari)
return true;else
return false;}
function GEBrowser(){}
GEBrowser._ua=0;GEBrowser._ver=0;GEBrowser._init=function(){if(GEBrowser._ua!=0)return;if(window.opera){GEBrowser._ua=3;}
else if(navigator.appName=="Microsoft Internet Explorer"){GEBrowser._ua=1;GEBrowser._ver=GEBrowser._getIEVersion();}
else if(navigator.userAgent.indexOf("Firefox")!=-1){GEBrowser._ua=2;GEBrowser._ver=GEBrowser._getFireFoxVersion();}
else if(navigator.userAgent.indexOf("Safari")!=-1){GEBrowser._ua=4;}}
GEBrowser._getIEVersion=function(){if(GEBrowser._ua!=1)return;var version=navigator.appVersion;var x=version.indexOf("MSIE",0);if(version.substring(x+8,x+9)==";")
version=version.substring(x+5,x+8);else
version=version.substring(x+5,x+9);return Number(version);}
GEBrowser._getFireFoxVersion=function(){if(GEBrowser._ua!=2)return;var version=navigator.userAgent;var x=version.indexOf("Firefox",0);version=version.substring(x+8,x+9);return Number(version);}
GEBrowser.isIE=function(){return GEBrowser._ua==1;}
GEBrowser.isFireFox=function(){return GEBrowser._ua==2;}
GEBrowser.isOpera=function(){return GEBrowser._ua==3;}
GEBrowser.isSafari=function(){return GEBrowser._ua==4;}
GEBrowser.isIE6down=function(){return(GEBrowser._ua==1&&GEBrowser._ver<=6);}
GEBrowser.isIE7=function(){return(GEBrowser._ua==1&&GEBrowser._ver==7);}
GEBrowser.isFireFox2down=function(){return(GEBrowser._ua==2&&GEBrowser._ver<=2);}
GEBrowser.isFireFox3=function(){return(GEBrowser._ua==2&&GEBrowser._ver==3);}
GEBrowser._init();

function GECanvasRenderer(){this._imgCache=new GEImageCache();GEGC.add(this);}
GECanvasRenderer.prototype.createElement=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");var element=document.createElement("canvas");var size=view.getSize();element.width=size.width;element.height=size.height;return element;}
GECanvasRenderer.prototype.getCachedImage=function(url)
{if(url==null||url.length==0)
return null;return this._imgCache.get(url);}
GECanvasRenderer.prototype.dispose=function(){if(this._imgCache==null)return;this._imgCache.dispose();this._imgCache=null;}
GECanvasRenderer.prototype.drawLines=function(element,points,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(points))
GEError.argument("points");if(GEValueCheck.isNull(property))
property=new GELinearProperty();var context=element.getContext("2d");var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
context.strokeStyle="rgba("+property.lineColor.R+","+property.lineColor.G+","+property.lineColor.B+","+property.lineColor.getAlphaPercent()+")";context.lineWidth=lineWidth;context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.stroke();}
GECanvasRenderer.prototype.drawPolygon=function(element,points,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(points))
GEError.argument("points");if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var context=element.getContext("2d");var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
context.strokeStyle="rgba("+property.lineColor.R+","+property.lineColor.G+","+property.lineColor.B+","+property.lineColor.getAlphaPercent()+")";context.lineWidth=lineWidth;context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.stroke();if(!GEValueCheck.isNull(property.fillColor)){context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.fillStyle="rgba("+property.fillColor.R+","+property.fillColor.G+","+property.fillColor.B+","+property.fillColor.getAlphaPercent()+")";context.fill();}}
GECanvasRenderer.prototype.drawRectangle=function(element,rect,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(rect))
GEError.argument("rect");if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var context=element.getContext("2d");var points=rect.getCoordinates();var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
context.strokeStyle="rgba("+property.lineColor.R+","+property.lineColor.G+","+property.lineColor.B+","+property.lineColor.getAlphaPercent()+")";context.lineWidth=lineWidth;context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.stroke();if(!GEValueCheck.isNull(property.fillColor)){context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.fillStyle="rgba("+property.fillColor.R+","+property.fillColor.G+","+property.fillColor.B+","+property.fillColor.getAlphaPercent()+")";context.fill();}}
GECanvasRenderer.prototype.drawEllipse=function(element,center,xAxis,yAxis,rotate,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(center))
GEError.argument("center");if(GEValueCheck.isNull(xAxis))
GEError.argument("xAxis");if(GEValueCheck.isNull(yAxis))
GEError.argument("yAxis");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEEllipseProperty();var context=element.getContext("2d");var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
context.strokeStyle="rgba("+property.lineColor.R+","+property.lineColor.G+","+property.lineColor.B+","+property.lineColor.getAlphaPercent()+")";context.lineWidth=lineWidth;var c1,c2;var rMatrix=null;if(rotate!=0.0)
{rMatrix=new GEMatrix();rMatrix.rotateAt(center,-rotate);}
var p=new GEPointD(center.x,center.y-yAxis);if(rMatrix){p=rMatrix.transform(p);}
var startP=p.clone();context.beginPath();context.moveTo(p.x,p.y);c1=new GEPointD(center.x+(xAxis/2),center.y-yAxis);c2=new GEPointD(center.x+xAxis,center.y-(yAxis/2));if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x+xAxis,center.y);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x+xAxis,center.y+(yAxis/2));c2=new GEPointD(center.x+(xAxis/2),center.y+yAxis);if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x,center.y+yAxis);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x-(xAxis/2),center.y+yAxis);c2=new GEPointD(center.x-xAxis,center.y+(yAxis/2));if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x-xAxis,center.y);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x-xAxis,center.y-(yAxis/2));c2=new GEPointD(center.x-(xAxis/2),center.y-yAxis);if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x,center.y-yAxis);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);context.moveTo(p.x,p.y);context.closePath();context.stroke();if(!GEValueCheck.isNull(property.fillColor)){context.beginPath();context.moveTo(p.x,p.y);c1=new GEPointD(center.x+(xAxis/2),center.y-yAxis);c2=new GEPointD(center.x+xAxis,center.y-(yAxis/2));if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x+xAxis,center.y);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x+xAxis,center.y+(yAxis/2));c2=new GEPointD(center.x+(xAxis/2),center.y+yAxis);if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x,center.y+yAxis);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x-(xAxis/2),center.y+yAxis);c2=new GEPointD(center.x-xAxis,center.y+(yAxis/2));if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x-xAxis,center.y);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);c1=new GEPointD(center.x-xAxis,center.y-(yAxis/2));c2=new GEPointD(center.x-(xAxis/2),center.y-yAxis);if(rMatrix){c1=rMatrix.transform(c1);}
if(rMatrix){c2=rMatrix.transform(c2);}
p=new GEPointD(center.x,center.y-yAxis);if(rMatrix){p=rMatrix.transform(p);}
context.bezierCurveTo(c1.x,c1.y,c2.x,c2.y,p.x,p.y);context.moveTo(p.x,p.y);context.closePath();context.fillStyle="rgba("+property.fillColor.R+","+property.fillColor.G+","+property.fillColor.B+","+property.fillColor.getAlphaPercent()+")";context.fill();}}
GECanvasRenderer.prototype.drawPoint=function(element,point,rotate,property,pixSize){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEPointProperty();var context=element.getContext("2d");context.strokeStyle="rgba("+property.outlineColor.R+","+property.outlineColor.G+","+property.outlineColor.B+","+property.outlineColor.getAlphaPercent()+")";context.lineWidth=1;if(rotate!=0.0)
{context.save();context.translate(point.x,point.y);context.rotate(-rotate)
point=new GEPointD(0,0);}
if(property.pointType==GEPointType.Round){context.beginPath();context.arc(point.x,point.y,Math.max(pixSize.width,pixSize.height)/2,0,Math.PI*2,true);context.closePath();context.stroke();}
else if(property.pointType==GEPointType.SolidRound){context.beginPath();context.arc(point.x,point.y,Math.max(pixSize.width,pixSize.height)/2,0,Math.PI*2,true);context.moveTo(point.x,point.y);context.closePath();context.stroke();context.beginPath();context.moveTo(point.x,point.y);context.arc(point.x,point.y,Math.max(pixSize.width,pixSize.height)/2,0,Math.PI*2,true);context.moveTo(point.x,point.y);context.closePath();context.fillStyle="rgba("+property.fillColor.R+","+property.fillColor.G+","+property.fillColor.B+","+property.fillColor.getAlphaPercent()+")";context.fill();}
else
{var points;if(property.pointType==GEPointType.Triangle||property.pointType==GEPointType.SolidTriangle){points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y+(pixSize.height/2)));points.add(new GEPointD(point.x,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+(pixSize.width/2),point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-(pixSize.width/2),point.y+(pixSize.height/2)));}
else if(property.pointType==GEPointType.Square||property.pointType==GEPointType.SolidSquare){var rect=GERectangleD.fromCenter(point,new GESizeD(pixSize.width,pixSize.height));points=rect.getCoordinates();}
else if(property.pointType==GEPointType.Diamond||property.pointType==GEPointType.SolidDiamond){points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y));points.add(new GEPointD(point.x,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+(pixSize.width/2),point.y));points.add(new GEPointD(point.x,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-(pixSize.width/2),point.y));}
else if(property.pointType==GEPointType.Cross||property.pointType==GEPointType.SlantCross){var crossSizeX=pixSize.width/8;var crossSizeY=pixSize.height/8;points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y+crossSizeY));points.add(new GEPointD(point.x-(pixSize.width/2),point.y-crossSizeY));points.add(new GEPointD(point.x-crossSizeX,point.y-crossSizeY));points.add(new GEPointD(point.x-crossSizeX,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+crossSizeX,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+crossSizeX,point.y-crossSizeY));points.add(new GEPointD(point.x+(pixSize.width/2),point.y-crossSizeY));points.add(new GEPointD(point.x+(pixSize.width/2),point.y+crossSizeY));points.add(new GEPointD(point.x+crossSizeX,point.y+crossSizeY));points.add(new GEPointD(point.x+crossSizeX,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-crossSizeX,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-crossSizeX,point.y+crossSizeY));points.add(new GEPointD(point.x-(pixSize.width/2),point.y+crossSizeY));if(property.pointType==GEPointType.SlantCross){var rMatrix=new GEMatrix();rMatrix.rotateAt(point,GERadian.degToRad(45));rMatrix.transformPoints(points);}}
else{return;}
context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(var i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.stroke();if((property.pointType==GEPointType.SolidTriangle||property.pointType==GEPointType.SolidSquare||property.pointType==GEPointType.SolidDiamond||property.pointType==GEPointType.Cross||property.pointType==GEPointType.SlantCross)&&!GEValueCheck.isNull(property.fillColor)){context.beginPath();context.moveTo(points.items[0].x,points.items[0].y);for(i=1;i<points.count();i++){context.lineTo(points.items[i].x,points.items[i].y);}
context.moveTo(points.items[0].x,points.items[0].y);context.closePath();context.fillStyle="rgba("+property.fillColor.R+","+property.fillColor.G+","+property.fillColor.B+","+property.fillColor.getAlphaPercent()+")";context.fill();}}
if(rotate!=0.0){context.restore();}}
GECanvasRenderer.prototype.drawIcon=function(element,point,rotate,property,pixSize){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEIconProperty();var context=element.getContext("2d");if(pixSize.isZero())
{image=new Image();var _self=this;GEEvent.addListener(image,"load",function(){var imgSize=new GESizeD(image.width,image.height);if(GEValueCheck.isNumber(property.scale)){imgSize.width*=property.scale;imgSize.height*=property.scale;}
_self._drawImage(context,image,point,imgSize.width,imgSize.height,rotate);GEEvent.clearListener(image);image=null;});image.src=property.url;}
else
{var image=new Image();var _self=this;GEEvent.addListener(image,"load",function(){_self._drawImage(context,image,point,pixSize.width,pixSize.height,rotate);GEEvent.clearListener(image);image=null;});image.src=property.url;}}
GECanvasRenderer.prototype._drawImage=function(context,image,point,width,height,rotate)
{var p=new GEPointD(point.x-(width/2),point.y-(height/2));if(rotate!=0.0)
{var rMatrix=new GEMatrix();rMatrix.rotateAt(point,-rotate);p=rMatrix.transform(p);context.save();context.translate(p.x,p.y);context.rotate(-rotate)
context.drawImage(image,0,0,width,height);context.restore();}
else{try{context.drawImage(image,p.x,p.y,width,height);}catch(e){;}}}

function GECentroid(){}
GECentroid.lineString=function(coordinates){if(GEValueCheck.isNull(coordinates)||coordinates.count()<2)
return null;var length=GEMeasure.polylineLength(coordinates)/2.0;for(var i=0;i<coordinates.count()-1;i++){var segLen=coordinates.items[i].distanceAt(coordinates.items[i+1]);if(length>segLen)
{length-=segLen;continue;}
var p=new GEPointD();var t=length/segLen;p.x=coordinates.items[i].x+(t*(coordinates.items[i+1].x-coordinates.items[i].x));p.y=coordinates.items[i].y+(t*(coordinates.items[i+1].y-coordinates.items[i].y));return p;}
return null;}
GECentroid.polygon=function(coordinates){if(GEValueCheck.isNull(coordinates)||coordinates.count()<2)
return null;var s=0;for(var i=0;i<coordinates.count()-1;i++){s+=coordinates.items[i].x*coordinates.items[i+1].y-coordinates.items[i+1].x*coordinates.items[i].y;}
s/=2;var p=new GEPointD();for(var i=0;i<coordinates.count()-1;i++){p.x+=(coordinates.items[i].x+coordinates.items[i+1].x)*(coordinates.items[i].x*coordinates.items[i+1].y-coordinates.items[i+1].x*coordinates.items[i].y);p.y+=(coordinates.items[i].y+coordinates.items[i+1].y)*(coordinates.items[i].x*coordinates.items[i+1].y-coordinates.items[i+1].x*coordinates.items[i].y);}
p.x*=1/(6*s);p.y*=1/(6*s);return p;}

function GEColor(r,g,b,a){this.R=!GEValueCheck.isNumber(r)?0:r;this.G=!GEValueCheck.isNumber(g)?0:g;this.B=!GEValueCheck.isNumber(b)?0:b;this.A=!GEValueCheck.isNumber(a)?255:a;}
GEColor.Red=function(a){return new GEColor(255,0,0,a);}
GEColor.Green=function(a){return new GEColor(0,255,0,a);}
GEColor.Blue=function(a){return new GEColor(0,0,255,a);}
GEColor.Yellow=function(a){return new GEColor(255,255,0,a);}
GEColor.White=function(a){return new GEColor(255,255,255,a);}
GEColor.Black=function(a){return new GEColor(0,0,0,a);}
GEColor.Orange=function(a){return new GEColor(255,165,0,a);}
GEColor.prototype.getAlphaPercent=function(){if(!GEValueCheck.isNumber(this.A))
return 1.0;return this.A/255;}
GEColor.fromString=function(string){if(!GEValueCheck.isString(string)||string.length==0){GEError.argument("string");}
var colors=string.split(',');if(colors.length<3){GEError.argument("string");}
var alpha=255;if(colors.length>3){alpha=Number(colors[3]);}
return new GEColor(Number(colors[0]),Number(colors[1]),Number(colors[2]),alpha);}
GEColor.fromHexString=function(htmlColor,alpha){if(!GEValueCheck.isString(htmlColor)||htmlColor.length!=7)
GEError.argument("htmlColor");var red=htmlColor.substring(1,3);var green=htmlColor.substring(3,5);var blue=htmlColor.substring(5,7);red=GEColor._decConvert(red);green=GEColor._decConvert(green);blue=GEColor._decConvert(blue);var a=255;if(GEValueCheck.isNumber(alpha)){a=alpha;}
return new GEColor(red,green,blue,a);}
GEColor.fromStyleString=function(styleColor,alpha){if(!GEValueCheck.isString(styleColor))
GEError.argument("styleColor");var colors=styleColor.replace("rgb(","");colors=colors.replace(")","");colors=colors.split(",");var red=Number(colors[0]);var green=Number(colors[1]);var blue=Number(colors[2]);var a=255;if(GEValueCheck.isNumber(alpha)){a=alpha;}
return new GEColor(red,green,blue,a);}
GEColor.prototype.toString=function(){return this.R+","+this.G+","+this.B+","+this.A;};GEColor.prototype.toHexString=function(){return"#"+GEColor._hexConvert(this.R)+GEColor._hexConvert(this.G)+GEColor._hexConvert(this.B);};GEColor.prototype.toResponseText=function(){return escape(this.toString());};GEColor._hexConvert=function(dec){if(!GEValueCheck.isNumber(dec))
GEError.argument("dec");if(dec<0||dec>255)
GEError.range("dec");if(dec<10)
return"0"+dec;if(dec<=15)
return dec;var hex="";while(dec){var last=dec&15;hex=String.fromCharCode(((last>9)?55:48)+last)+hex;dec>>=4;}
return hex;}
GEColor._decConvert=function(hex){if(!GEValueCheck.isString(hex)||hex.length!=2)
GEError.argument("hex");hex=hex.toUpperCase();var hexStr="0123456789ABCDEF";var dec=0;dec=hexStr.indexOf(hex.charAt(0))*16+hexStr.indexOf(hex.charAt(1));return dec;}
GEColor.prototype.clone=function(){return new GEColor(this.R,this.G,this.B,this.A);}

function GEControlContainer(view,controlContainer){this.view=view;this.controlContainer=controlContainer;this.controlMargin=5;this._controlList=new Array();}
GEControlContainer.prototype.add=function(control)
{if(!control||!control.attach)return;control.attach(this,this.controlContainer);this._controlList.push(control);this.adjustPosition();}
GEControlContainer.prototype.remove=function(control)
{if(!control||!control.detach)return;if(this._controlList.length==0)return;control.detach(this,this.controlContainer);for(var i=0;i<this._controlList.length;i++)
{if(this._controlList[i]==map){this._controlList.splice(i,1);break;}}
this.adjustPosition();}
GEControlContainer.prototype.clear=function()
{if(this._controlList.length==0)return;for(var i=0;i<this._controlList.length;i++){this._controlList[i].detach(this,this.controlContainer);this._controlList[i]=null;}
delete this._controlList;this._controlList=new Array();}
GEControlContainer.prototype.dispose=function()
{if(this._controlList==null||this.controlContainer==null)return;for(var i=0;i<this._controlList.length;i++){this._controlList[i].detach(this,this.controlContainer);this._controlList[i]=null;}
delete this._controlList;this._controlList=null;}
GEControlContainer.prototype.getControls=function()
{return this._controlList;}
GEControlContainer.prototype.adjustPosition=function()
{if(this._controlList.length==0)return;var lt_left=0;var lb_left=0;var rt_right=0;var rb_right=0;var top=0;var bottom=0;for(var i=0;i<this._controlList.length;i++){var control=this._controlList[i];var offset=control.getOffset();var element=control.getElement();var align=control.baseAlign();switch(align){case GEControlPosition.LT:element.style.left=GEFunctions.createPx(lt_left+offset.x);element.style.top=GEFunctions.createPx(top+offset.y);element.style.right="";element.style.bottom="";lt_left+=(this.controlMargin+offset.x+parseInt(element.style.width));break;case GEControlPosition.LB:element.style.left=GEFunctions.createPx(lb_left+offset.x);element.style.top="";element.style.right="";element.style.bottom=GEFunctions.createPx(bottom+offset.y);lb_left+=(this.controlMargin+offset.x+parseInt(element.style.width));break;case GEControlPosition.RT:element.style.left="";element.style.top=GEFunctions.createPx(top+offset.y);element.style.right=GEFunctions.createPx(rt_right+offset.x);element.style.bottom="";rt_right+=(this.controlMargin+offset.x+parseInt(element.style.width));break;case GEControlPosition.RB:element.style.left="";element.style.top="";element.style.right=GEFunctions.createPx(rb_right+offset.x);element.style.bottom=GEFunctions.createPx(bottom+offset.y);rb_right+=(this.controlMargin+offset.x+parseInt(element.style.width));break;}}}

function GEControlPosition(){}
GEControlPosition.LT=0;GEControlPosition.LB=2;GEControlPosition.RT=6;GEControlPosition.RB=8;

﻿
function GEConvert(){}
GEConvert.dateToString=function(value){if(!value)
return'';var year=value.getFullYear().toString();var month=value.getMonth().toString();if(month=="0"){year=(value.getFullYear()-1).toString();month="12";}
else
{month=(value.getMonth()+1).toString();}
if(month.length==1)
month="0"+month;var date=value.getDate().toString();if(date.length==1)
date="0"+date;var hour=value.getHours().toString();if(hour.length==1)
hour="0"+hour;var minutes=value.getMinutes().toString();if(minutes.length==1)
minutes="0"+minutes;var second=value.getSeconds().toString();if(second.length==1)
second="0"+second;return year+'/'+month+'/'+date+' '+hour+':'+minutes+':'+second;}
GEConvert.stringToDate=function(value){if(!GEValueCheck.isString(value)||value.length!=19)
return null;var year=Number(value.substring(0,4));var month=Number(value.substring(5,7));var date=Number(value.substring(8,10));var hour=Number(value.substring(11,13));var minutes=Number(value.substring(14,16));var second=Number(value.substring(17,19));return new Date(year,month-1,date,hour,minutes,second);}
GEConvert.toBoolean=function(value){if(GEValueCheck.isNull(value))
return false;if(value==true||value.toString()=="1"||value.toUpperCase()=="TRUE")
return true;else
return false;}
GEConvert.toJSONText=function(value){if(!GEValueCheck.isString(value))
return"";value=GEConvert._toJSONText(value,'"','&quot;');value=GEConvert._toJSONText(value,'\\','&yen;');return value;}
GEConvert._toJSONText=function(text,target,rept)
{if(!GEValueCheck.isString(text))
return"";text=(GEValueCheck.isNull(text)?"":text)
while(true){var tmp=text;text=tmp.replace(target,rept);if(text==tmp){break;}}
return text;}

function GECopyright(copyright,option){if(!copyright)copyright='';this._copyright=copyright;if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.offsetX==undefined)
this.option.offsetX=5;if(this.option.offsetY==undefined)
this.option.offsetY=5;if(this.option.color==undefined)
this.option.color="#000000";this._parent=null;this._element=null;}
GECopyright.prototype.baseAlign=function(){return GEControlPosition.RB;}
GECopyright.prototype.getElement=function(){return this._element;}
GECopyright.prototype.getOffset=function(){return new GEPointD(this.option.offsetX,this.option.offsetY);}
GECopyright.prototype.isAttached=function(){return(this._parent!=null);}
GECopyright.prototype.attach=function(parent,controlContainer){if(this.isAttached())return false;this._parent=parent;this._element=document.createElement('div');this._element.id='GECopyright_'+GEFunctions.getRandomString();controlContainer.appendChild(this._element);GEFunctions.setBackgroundImage(this._element,GEAJAX.path+'/resources/control_back2.png',true,parent.view);GEFunctions.setStyle(this._element,"visibility: visible;"+"position: absolute;"+"overflow: visible;"+"z-index: 0;"+"background-repeat: repeat;"+"padding: 2px;");if(this.option.width!=undefined)
this._element.style.width=GEFunctions.createPx(this.option.width);var text=document.createElement("div");GEFunctions.setStyle(text,"overflow: visible;"+"color: "+this.option.color+";"+"font-family: MS Sans Serif;"+"font-size: 12px;"+"font-weight: bold;"+"text-align: right;"+"vertical-align: bottom;"+"top: 0px;");text.innerHTML=this._copyright.replace('\n','<br />');this._element.appendChild(text);GEEvent.disableDragEventOnIE(this._element);GEEvent.disableSelection(this._element);return true;}
GECopyright.prototype.detach=function(parent,controlContainer){if(!this.isAttached())return;GEEvent.resetDragEventOnIE(this._element);this._element.innerHTML='';controlContainer.removeChild(this._element);delete this._element;this._element=null;this._parent=null;}
GECopyright.prototype.refresh=function(){}

﻿
function GECursor(){}
GECursor.Default="default";GECursor.Move="move";GECursor.Resize="nw-resize";GECursor.Cross="crosshair";GECursor.Text="text";GECursor.Wait="wait";GECursor.Grab='url('+GEAJAX.path+'/resources/'+'grab.cur'+'), auto';GECursor.Grabbing='url('+GEAJAX.path+'/resources/'+'grabbing.cur'+'), auto';GECursor.Pointer="pointer";

﻿
function GEDebug(){}
GEDebug._container=null;GEDebug._body=null;GEDebug._initialized=false;GEDebug.write=function(value,color){if(!GEDebug.isOpened()){GEDebug.show();}
GEDebug._appendString(value,color);}
GEDebug.clear=function(){if(!GEDebug.isOpened()){GEDebug.show();}
GEDebug._body.innerHTML='';}
GEDebug.isOpened=function(){return GEDebug._initialized&&GEDebug._container.style.visibility=='visible';}
GEDebug.show=function(){if(GEDebug._initialized){GEDebug._container.style.visibility='visible';}else{var containerWidth=600;var containerHeight=250;GEDebug._container=document.createElement('div');GEDebug._container.id='_geDebugWindow';GEDebug._container.style.position='absolute';GEDebug._container.style.left='0px';GEDebug._container.style.top='0px';GEDebug._container.style.width=GEFunctions.createPx(containerWidth);GEDebug._container.style.height=GEFunctions.createPx(containerHeight);GEDebug._container.style.backgroundColor='#ffffff';GEDebug._container.style.visibility='visible';GEDebug._container.style.zIndex=10000;var head=document.createElement('div');head.id='_geDebugWindow_head';head.style.left='0px';head.style.top='0px';head.style.width='100%';head.style.height='15px';head.style.backgroundColor='#336699';head.style.fontSize='12px';head.style.border='1px solid black';head.style.cursor='move';var headText=document.createElement('span');headText.innerHTML='GEDebug Console [ <a href=\"javascript:GEDebug.clear();\">Clear</a> ] - [ <a href=\"javascript:GEDebug.close();\">Close</a> ]';headText.style.color='#ffffff';head.appendChild(headText);GEDebug._container.appendChild(head);var _offsetX=0;var _offsetY=0;var _isDragging=false;GEDebug._ev_mousedown=GEEvent.addListener(head,"mousedown",function(event)
{if(!event)event=window.event;var continaer=document.getElementById('_geDebugWindow');_offsetX=continaer.offsetLeft-event.clientX;_offsetY=continaer.offsetTop-event.clientY;_isDragging=true;return false;});GEDebug._ev_mousemove=GEEvent.addListener(document,"mousemove",function(event)
{if(!_isDragging)return false;if(!event)event=window.event;var continaer=document.getElementById('_geDebugWindow');continaer.style.left=GEFunctions.createPx(event.clientX+_offsetX);continaer.style.top=GEFunctions.createPx(event.clientY+_offsetY);return false;});GEDebug._ev_mouseup=GEEvent.addListener(document,"mouseup",function()
{if(!_isDragging)return;_isDragging=false;});GEDebug._body=document.createElement('div');GEDebug._body.id='_geDebugWindow_body';GEDebug._body.style.left='0px';GEDebug._body.style.top='0px';GEDebug._body.style.width='100%';GEDebug._body.style.height='100%';GEDebug._body.style.backgroundColor='#ffffff';GEDebug._body.style.color='#000000';GEDebug._body.style.overflow='auto';GEDebug._body.style.fontSize='12px';GEDebug._body.style.border='1px solid black';GEDebug._container.appendChild(GEDebug._body);document.body.appendChild(GEDebug._container);GEDebug._initialized=true;}}
GEDebug.close=function(){if(!GEDebug.isOpened())
return;GEDebug._container.style.visibility='hidden';}
GEDebug.setSize=function(width,height){if(!GEDebug.isOpened()){GEDebug.show();}
GEDebug._container.style.width=width+'px';GEDebug._container.style.height=height+'px';}
GEDebug._appendString=function(value,color){if(GEDebug._container==null)
return;if(typeof(value)==undefined)value='';var textNode=document.createElement('p');textNode.innerHTML=value;textNode.style.margin='0px';textNode.style.padding='0px';textNode.style.width='100%';textNode.style.borderBottom='dotted 1px black';if(color!=undefined)
textNode.style.color=color;GEDebug._body.appendChild(textNode);GEDebug._body.scrollTop+=GEDebug._body.clientHeight;}

﻿
function GEDefaultOperation(){this._view=null;this._enableDragging=true;this._enableWheelZoom=true;this._enablePanning=true;this._enableKeyScroll=true;this._active=false;this.isDragging=false;}
GEDefaultOperation.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");this._view=view;this._container=view.getContainer();this._active=true;this._scrollFrom=null;this._view.changeCursor(GECursor.Grab);var self_defaultOp=this;this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});this._mousedown=GEEvent.addListener(this._container,'mousedown',function(event)
{if(GEEvent.isStopped(event))return;if(!self_defaultOp._enableDragging)return false;if(!GEEvent.isLeftButton(event))return;if(!event)event=window.event;self_defaultOp._view.changeCursor(GECursor.Grabbing);self_defaultOp._scrollFrom=new GEPointD(event.clientX,event.clientY);GEEvent.stopEvent(event);self_defaultOp._view.onscrollstart();self_defaultOp.isDragging=true;return false;});this._mousemove=GEEvent.addListener(document,'mousemove',function(event)
{if(GEEvent.isStopped(event))return;if(!self_defaultOp.isDragging)return;if(!GEEvent.isLeftButton(event))return;if(!event)event=window.event;self_defaultOp._view.onscroll(event.clientX-self_defaultOp._scrollFrom.x,event.clientY-self_defaultOp._scrollFrom.y);self_defaultOp._scrollFrom=null;self_defaultOp._scrollFrom=new GEPointD(event.clientX,event.clientY);GEEvent.stopEvent(event);return false;});this._mouseup=GEEvent.addListener(document,'mouseup',function(event)
{if(GEEvent.isStopped(event))return;if(!GEEvent.isLeftButton(event))return;if(!self_defaultOp.isDragging)return;self_defaultOp._view.changeCursor(GECursor.Grab);self_defaultOp.isDragging=false;self_defaultOp._scrollFrom=null;self_defaultOp._view.onscrollend();GEEvent.stopEvent(event);return false;});this._dblclick=GEEvent.addListener(this._container,'dblclick',function(event)
{if(GEEvent.isStopped(event))return;if(!self_defaultOp._enablePanning)return false;var p=self_defaultOp._view.getWorldPoint(event);self_defaultOp._view.panAt(p);GEEvent.stopEvent(event);return false;});var shiftOn=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(GEEvent.isStopped(event))return;if(!self_defaultOp._view.isLoaded())return;var srcElm=(event.srcElement||event.target);if(srcElm.tagName.toLowerCase()=='input'||srcElm.tagName.toLowerCase()=='select'||srcElm.tagName.toLowerCase()=='textarea')return;shiftOn=GEEvent.isShiftKey(event);if(!self_defaultOp._enableKeyScroll)return;keyCode=event.keyCode;var centerP=self_defaultOp._view.getCenter();var viewSize=self_defaultOp._view.getNormalRange().getSize();switch(keyCode)
{case 37:centerP.x-=(viewSize.width/10);break;case 38:centerP.y+=(viewSize.height/10);break;case 39:centerP.x+=(viewSize.width/10);break;case 40:centerP.y-=(viewSize.height/10);break;}
var angle=self_defaultOp._view.getAngle();if(!angle.isZero())
{var rMatrix=new GEMatrix();rMatrix.rotateAt(self_defaultOp._view.getCenter(),-angle.getRadian());centerP=rMatrix.transform(centerP);}
self_defaultOp._view.panAt(centerP);});this._keyup=GEEvent.addListener(document,'keyup',function(event){shiftOn=false;});this._onwheelevent=function(event)
{var delta=0;if(GEEvent.isStopped(event))return;if(!self_defaultOp._view.isLoaded())return;if(!self_defaultOp._enableWheelZoom)return;if(!event)event=window.event;if(event.wheelDelta)
{delta=event.wheelDelta/120;}
else if(event.detail)
{delta=-event.detail/3;}
if(delta)
{var cp=self_defaultOp._view.getWorldPoint(event);if(delta<0)
{self_defaultOp._view.zoomOut(cp,shiftOn);}
else
{self_defaultOp._view.zoomIn(cp,shiftOn);}}
GEEvent.stopEvent(event);event.returnValue=false;}
if(GEBrowser.isFireFox()){GEEvent.addListener(this._container,'DOMMouseScroll',this._onwheelevent);}else{GEEvent.addListener(this._container,'mousewheel',this._onwheelevent);}}
GEDefaultOperation.prototype.end=function(geom){}
GEDefaultOperation.prototype.kill=function(){if(!this._active)return;this.terminate(true);}
GEDefaultOperation.prototype.terminate=function(dispatch){if(!this._active)return;this._procOp=null;this._active=false;if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(document,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(document,"mouseup",this._mouseup);if(!GEValueCheck.isNull(this._dblclick))
GEEvent.removeListener(this._container,"dblclick",this._dblclick);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(GEBrowser.isFireFox()){GEEvent.removeListener(this._container,'DOMMouseScroll',this._onwheelevent);}else{GEEvent.removeListener(this._container,'mousewheel',this._onwheelevent);}
if(dispatch)this.end();}
GEDefaultOperation.prototype.enableDragging=function()
{if(!this._view)return;this._view.changeCursor(GECursor.Grab);this._enableDragging=true;}
GEDefaultOperation.prototype.disableDragging=function()
{if(!this._view)return;this._view.changeCursor(GECursor.Default);this._enableDragging=false;}
GEDefaultOperation.prototype.enableKeyScroll=function()
{if(!this._view)return;this._enableKeyScroll=true;}
GEDefaultOperation.prototype.disableKeyScroll=function()
{if(!this._view)return;this._enableKeyScroll=false;}
GEDefaultOperation.prototype.enableWheelZoom=function()
{if(!this._view)return;this._enableWheelZoom=true;}
GEDefaultOperation.prototype.disableWheelZoom=function()
{if(!this._view)return;this._enableWheelZoom=false;}
GEDefaultOperation.prototype.enablePanning=function()
{if(!this._view)return;this._enablePanning=true;}
GEDefaultOperation.prototype.disablePanning=function()
{if(!this._view)return;this._enablePanning=false;}

function GEDrawProperty(){}
GEDrawProperty.fromJSON=function(obj){if(obj==null)
return null;switch(obj.pt)
{case GEPropertyType.Linear:return GELinearProperty.fromJSON(obj);case GEPropertyType.Polygon:return GEPolygonProperty.fromJSON(obj);case GEPropertyType.Ellipse:return GEEllipseProperty.fromJSON(obj);case GEPropertyType.Point:return GEPointProperty.fromJSON(obj);case GEPropertyType.Icon:return GEIconProperty.fromJSON(obj);case GEPropertyType.Text:return GETextProperty.fromJSON(obj);default:return null;}}

function GEDynamicMap(serverPath,ws_id,name,option){if(!name)name='';this._name=name;if(!GEValueCheck.isString(serverPath))
GEError.argument('serverPath');else
this._serverPath=serverPath;if(!GEValueCheck.isString(ws_id))
GEError.argument('ws_id');else
this._ws_id=ws_id;if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.factor==undefined)
this.option.factor=1.2;if(this.option.istranspng==undefined)
this.option.istranspng=false;if(this.option.bgcolor==undefined)
this.option.bgcolor='';if(this.option.transparent==undefined)
this.option.transparent='';if(this.option.serviceName==undefined)
this.option.serviceName='MapImage.aspx';if(this.option.maxscale==undefined)
this.option.maxscale=0;if(this.option.minscale==undefined)
this.option.minscale=0;if(this.option.async_loading==undefined)
this.option.async_loading=false;if(this.option.waitHtml==undefined)
this.option.waitHtml='';if(this.option.debug==undefined)
this.option.debug=false;this._ELEMENT_ID_CONTAINER="GEDynamicMap";this._ELEMENT_ID_IMGCONTAINER='GEDynamicMap_Cntr';this._ELEMENT_ID_ELM='GEDynamicMap_Elm';this._view=null;this._viewContainer=null;this._mapContainer=null;this._imageContainer=null;this._labelNode=null;this._element=null;this._cloneElement=null;this._activeScale=0;this._viewevent_onresize=null;this._viewevent_onscrollstart=null;this._transImg=GEAJAX.path+'/resources/'+'transparent.gif';}
GEDynamicMap.prototype.getName=function(){return this._name;}
GEDynamicMap.prototype.getServerPath=function(){return this._serverPath;}
GEDynamicMap.prototype.getId=function(){return this._ws_id;}
GEDynamicMap.prototype.isAttached=function(){return(this._view!=null&&this._mapContainer!=null);}
GEDynamicMap.prototype.getzIndex=function(zIndex){if(!this.isAttached())return;return this._mapContainer.style.zIndex;}
GEDynamicMap.prototype.setzIndex=function(zIndex){if(!this.isAttached())return;if(!GEValueCheck.isNumber(zIndex))
GEError.argument('zIndex');this._mapContainer.style.zIndex=zIndex;}
GEDynamicMap.prototype.getVisible=function(){if(!this.isAttached())return false;return this._mapContainer.style.display!='none';}
GEDynamicMap.prototype.setVisible=function(visible,refresh){if(!this.isAttached())return;if(visible){this._mapContainer.style.display='block';if(refresh)this.refresh("visible_changed");}else{this._mapContainer.style.display='none';}}
GEDynamicMap.prototype.getFeatureQueryCommand=function(){return new GELayerQueryCommand(this,this._serverPath);}
GEDynamicMap.prototype.getLayers=function(expression){var command=new GELayerQueryCommand(this,this._serverPath);return command.execute(this._ws_id,expression);}
GEDynamicMap.prototype.getLayerById=function(id){if(!GEValueCheck.isNumber(id))
return null;var command=new GELayerQueryCommand(this,this._serverPath);var expression=new GELayerExpression();expression.sid=GENumberCondition.equals(id);return command.execute(this._ws_id,expression);}
GEDynamicMap.prototype.getLayersById=function(idArray){if(idArray==null||idArray.length==0)
return null;var command=new GELayerQueryCommand(this,this._serverPath);var expression=new GELayerExpression();expression.sid=GENumberCondition.or(idArray);return command.execute(this._ws_id,expression);}
GEDynamicMap.prototype.attach=function(view,viewContainer){if(this.isAttached())return false;this._view=view;this._viewContainer=viewContainer;var viewSize=this._view.getSize();this._imageSize=new GESizeD(Math.ceil(viewSize.width*this.option.factor),Math.ceil(viewSize.height*this.option.factor));viewSize=null;var self_dynaMap=this;this._viewevent_onresize=GEEvent.addListener(view,'onresize',function(event)
{self_dynaMap._onresize();});this._viewevent_onscrollstart=GEEvent.addListener(view,'onscrollstart',function(event)
{self_dynaMap._onscrollstart();});this._mapContainer=document.createElement('div');this._mapContainer.id=this._ELEMENT_ID_CONTAINER+'_'+GEFunctions.getRandomString();viewContainer.appendChild(this._mapContainer);GEFunctions.setStyle(this._mapContainer,"display: block;"+"position: absolute;"+"left: 0px;"+"top: 0px;");GEEvent.disableDragEventOnIE(this._mapContainer);if(!GEBrowser.isIE()){this._mapContainer.onclick=GEEvent.stopEvent;this._mapContainer.ondblclick=GEEvent.stopEvent;this._mapContainer.onmousedown=GEEvent.stopEvent;this._mapContainer.onmousemove=GEEvent.stopEvent;this._mapContainer.onmouseup=GEEvent.stopEvent;}
this._imageContainer=document.createElement('div');this._imageContainer.id=this._ELEMENT_ID_IMGCONTAINER+'_'+GEFunctions.getRandomString();this._mapContainer.appendChild(this._imageContainer);GEFunctions.setStyle(this._imageContainer,"position: absolute;"+"left: 0px;"+"top: 0px;"+"z-index: 0;");GEEvent.disableDragEventOnIE(this._imageContainer);if(!GEBrowser.isIE()){this._imageContainer.onclick=GEEvent.stopEvent;this._imageContainer.ondblclick=GEEvent.stopEvent;this._imageContainer.onmousedown=GEEvent.stopEvent;this._imageContainer.onmousemove=GEEvent.stopEvent;this._imageContainer.onmouseup=GEEvent.stopEvent;}
var viewPort=this._view.getViewPort();var imgLeft=viewPort.min.x-Math.ceil((this._imageSize.width-viewPort.getWidth())/2);var imgTop=viewPort.min.y-Math.ceil((this._imageSize.height-viewPort.getHeight())/2);viewPort=null;this._element=document.createElement('img');this._element.id=this._ELEMENT_ID_ELM+'_'+GEFunctions.getRandomString();this._imageContainer.appendChild(this._element);GEFunctions.setStyle(this._element,"position: absolute;"+"width: "+this._imageSize.width+"px;"+"height: "+this._imageSize.height+"px;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"left: "+imgLeft+"px;"+"top: "+imgTop+"px;");GEFunctions.setImageSrc(this._element,this._transImg,false,true);GEEvent.disableDragEventOnIE(this._element);if(!GEBrowser.isIE()){this._element.onclick=GEEvent.stopEvent;this._element.ondblclick=GEEvent.stopEvent;this._element.onmousedown=GEEvent.stopEvent;this._element.onmousemove=GEEvent.stopEvent;this._element.onmouseup=GEEvent.stopEvent;}
var scale=this._view.getScale();var visible=((this.option.maxscale==0||this.option.maxscale<=scale)&&(this.option.minscale==0||this.option.minscale>=scale));this.setVisible(visible,false);return true;}
GEDynamicMap.prototype.detach=function(view,viewContainer){if(!this.isAttached())return;GEEvent.removeListener(view,'onresize',this._viewevent_onresize);this._viewevent_onresize=null;GEEvent.removeListener(view,'onscrollstart',this._viewevent_onscrollstart);this._viewevent_onscrollstart=null;GEEvent.resetDragEventOnIE(this._mapContainer);GEEvent.resetDragEventOnIE(this._imageContainer);GEEvent.resetDragEventOnIE(this._element);viewContainer.removeChild(this._mapContainer);this._mapContainer.innerHTML='';this._mapContainer=null;this._imageContainer=null;this._element=null;this._view=null;this._viewContainer=null;}
GEDynamicMap.prototype._onresize=function(){var viewSize=this._view.getSize();this._imageSize=new GESizeD(Math.ceil(viewSize.width*this.option.factor),Math.ceil(viewSize.height*this.option.factor));viewSize=null;}
GEDynamicMap.prototype._onscrollstart=function(){this._hideLoading();}
GEDynamicMap.prototype.onzoomstart=function(){if(this._view==null)return;if(!this.getVisible())return;this._mapContainer.style.display='none';}
GEDynamicMap.prototype.onzoom=function(e)
{}
GEDynamicMap.prototype.onzoomend=function()
{if(!this.getVisible())return;this._mapContainer.style.display='block';}
GEDynamicMap.prototype.refresh=function(reason){if(!this.isAttached())return;if(!this.getVisible())return;switch(reason){case'resize':var viewSize=this._view.getSize();this._imageSize=new GESizeD(Math.ceil(viewSize.width*this.option.factor),Math.ceil(viewSize.height*this.option.factor));viewSize=null;break;case'scale_changed':this._activeScale=this._view.getScale();GEFunctions.setImageSrc(this._element,this._transImg,false,true);break;}
if(!((this.option.maxscale==0||this.option.maxscale<=this._activeScale)&&(this.option.minscale==0||this.option.minscale>=this._activeScale)))return;var viewPort=this._view.getViewPort();var imgLeft=viewPort.min.x-Math.ceil((this._imageSize.width-viewPort.getWidth())/2);var imgTop=viewPort.min.y-Math.ceil((this._imageSize.height-viewPort.getHeight())/2);viewPort=null;var center=this._view.getCenter();var scale=this._view.getScale();var rotate=this._view.getAngle().getRadian();if(this._cloneElement==null){this._cloneElement=this._element.cloneNode(false);var _self=this;var cloneEvt=GEEvent.addListener(this._cloneElement,"load",function()
{if(!_self._cloneElement||!_self._imageContainer||!_self._element)return;_self._hideLoading();GEEvent.clearListener(_self._element);_self._element.src='';_self._imageContainer.replaceChild(_self._cloneElement,_self._element);_self._element=_self._cloneElement;GEEvent.removeListener(_self._cloneElement,"load",cloneEvt);_self._cloneElement=null;});}
GEFunctions.setStyle(this._cloneElement,"position: absolute;"+"width: "+this._imageSize.width+"px;"+"height: "+this._imageSize.height+"px;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"left: "+imgLeft+"px;"+"top: "+imgTop+"px;");GEEvent.disableDragEventOnIE(this._cloneElement);if(!GEBrowser.isIE()){this._cloneElement.onclick=GEEvent.stopEvent;this._cloneElement.ondblclick=GEEvent.stopEvent;this._cloneElement.onmousedown=GEEvent.stopEvent;this._cloneElement.onmousemove=GEEvent.stopEvent;this._cloneElement.onmouseup=GEEvent.stopEvent;}
this._showLoading(imgLeft,imgTop);var url=this._getImageUrl(center,scale,rotate,this._imageSize,true);if(this.option.async_loading){this._setImageAsync(this._cloneElement,url,this.option.istranspng,this._view);}else{GEFunctions.setImageSrc(this._cloneElement,url,this.option.istranspng,true,this._view);}
center=null;}
GEDynamicMap.prototype._showLoading=function(imgLeft,imgTop)
{if(!this._imageContainer||this.option.waitHtml.length==0)return;if(this._labelNode){this._hideLoading();}
this._labelNode=document.createElement('span');this._labelNode.innerHTML=this.option.waitHtml;GEFunctions.setStyle(this._labelNode,"position: absolute;"+"left: "+(imgLeft+(this._imageSize.width/2))+"px;"+"top: "+(imgTop+(this._imageSize.height/2))+"px;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"text-align: center;"+"vertical-align: middle;");this._imageContainer.appendChild(this._labelNode);}
GEDynamicMap.prototype._hideLoading=function()
{if(!this._imageContainer||!this._labelNode)return;this._imageContainer.removeChild(this._labelNode);this._labelNode=null;}
GEDynamicMap.prototype._setImageAsync=function(img,url,isTransPng,view)
{var t=img;var u=url;var trans=isTransPng;var v=view;setTimeout(function()
{GEFunctions.setImageSrc(t,u,trans,true,v);},10);}
GEDynamicMap.prototype._getImageUrl=function(center,scale,rotate,size,noCache){var param="?ws="+this._ws_id+"&x="+center.x+"&y="+center.y+"&sc="+scale+"&r="+rotate+"&w="+size.width+"&h="+size.height;if(noCache){param+='&t='+GEFunctions.getRandomString();}
if(this.option.bgcolor!=''){param+='&bg='+this.option.bgcolor;}
if(this.option.transparent!=''){param+='&tp='+this.option.transparent;}
var url=this._serverPath+this.option.serviceName+param;if(this.option.debug){GEDebug.write(url);}
return url;};

﻿
function GEEllipse(center,xAxis,yAxis,angle){this.feature=null;this.center=GEValueCheck.isNull(center)?new GEPointD(0,0):center.clone();this.xAxis=!GEValueCheck.isNumber(xAxis)?0:xAxis;this.yAxis=!GEValueCheck.isNumber(yAxis)?0:yAxis;this.angle=GEValueCheck.isNull(angle)?new GEAngle(0):angle;this.hide=false;}
GEEllipse.fromRectangle=function(rectangle){if(GEValueCheck.isNull(rectangle))
rectangle=new GERectangleD();var center=rectangle.getCenter();var size=rectangle.getSize();return new GEEllipse(center,size.width/2,size.height/2);}
GEEllipse.prototype.getCenter=function(){return this.center.clone();}
GEEllipse.prototype.getCentroid=function(){return this.center.clone();}
GEEllipse.prototype.getGeometryType=function(){return GEGeometryType.Ellipse;}
GEEllipse.prototype.getCoordinates=function(){var rect=GERectangleD.fromCenter(this.center,new GESizeD(this.xAxis*2,this.yAxis*2));var coordinates=rect.getCoordinates();if(!this.angle.isZero())
{var rMatrix=new GEMatrix();rMatrix.rotateAt(this.center,this.angle.getRadian());rMatrix.transformPoints(coordinates);}
return coordinates;}
GEEllipse.prototype.setCoordinates=function(points,angle){if(GEValueCheck.isNull(points)||points.count()==0){return;}
if(GEValueCheck.isNull(angle))
angle=this.angle;var coordinates=points.clone();if(!angle.isZero())
{var rMatrix=new GEMatrix();rMatrix.rotateAt(coordinates.mbr().getCenter(),-angle.getRadian());rMatrix.transformPoints(coordinates);}
var rect=coordinates.mbr();var size=rect.getSize();this.center=rect.getCenter();this.xAxis=size.width/2;this.yAxis=size.height/2;}
GEEllipse.prototype.getBoundary=function(){var coordinates=this.getCoordinates();return GERectangleD.fromPoints(coordinates);}
GEEllipse.prototype.getNearestPoint=function(p){if(GEValueCheck.isNull(p))
return null;var coordinates=this.getCoordinates();return coordinates.getNearestPoint(p);}
GEEllipse.prototype.clone=function(){var result=new GEEllipse();result.center=this.center.clone();result.xAxis=this.xAxis;result.yAxis=this.yAxis;result.angle=this.angle.clone();return result;}
GEEllipse.prototype.toWKT=function(){if(GEValueCheck.isNull(this.center)||!GEValueCheck.isNumber(this.xAxis)||!GEValueCheck.isNumber(this.yAxis))
return"";var coordinates=this.getCoordinates();var wkt=new GEStringBuilder();wkt.append(GEGeometryType.Polygon.toUpperCase());wkt.append("((");wkt.append(this._getCoordinateString(coordinates));wkt.append("))");return wkt.toString();}
GEEllipse.prototype.toText=function(){if(GEValueCheck.isNull(this.center)||!GEValueCheck.isNumber(this.xAxis)||!GEValueCheck.isNumber(this.yAxis))
return"";var coordinates=this.getCoordinates();var wkt=new GEStringBuilder();wkt.append(GEGeometryType.Ellipse);wkt.append("((");wkt.append(this._getCoordinateString(coordinates));wkt.append("))");wkt.append(";;");return wkt.toString();}
GEEllipse.prototype._getCoordinateString=function(coordinates){var result=new GEStringBuilder();for(var i=0;i<coordinates.count();i++){if(i>0)result.append(",");result.append(coordinates.items[i].x.toString()+" "+coordinates.items[i].y.toString());}
return result.toString();}
GEEllipse.prototype.toJSON=function(){if(GEValueCheck.isNull(this.center))
return"";var result=new GEStringBuilder();result.append('{');result.append('"gt":"'+this.getGeometryType()+'",');result.append('"pt":[{"x":"'+this.center.x.toString()+'",'+'"y":"'+this.center.y.toString()+'"}],');result.append('"xa":"'+this.xAxis.toString()+'",');result.append('"ya":"'+this.yAxis.toString()+'",');result.append('"rot":"'+this.angle.getRadian().toString()+'"');result.append('}');return result.toString();}
GEEllipse.fromJSON=function(obj){if(obj==null)
return null;var result=new GEEllipse();result.center=new GEPointD(Number(obj.pt[0].x),Number(obj.pt[0].y));result.xAxis=Number(obj.xa);result.yAxis=Number(obj.ya);if(!GEValueCheck.isNull(obj.rot)){result.angle=GEAngle.fromRadian(Number(obj.rot));}
return result;}

function GEEllipseProperty(){this.lineColor=new GEColor(0,0,0);this.fillColor=new GEColor(255,255,255);this.lineWidth=1;this.sizeUnit=GESizeUnit.Pixel;}
GEEllipseProperty.prototype.getPropertyType=function(){return GEPropertyType.Ellipse;}
GEEllipseProperty.prototype.toResponseText=function(){var result=new GEStringBuilder();result.append("&pt="+this.getPropertyType());if(!GEValueCheck.isNull(this.lineColor)){var str=this.lineColor.toResponseText();if(str.length>0){result.append("&lc="+str);}}
if(!GEValueCheck.isNull(this.fillColor)){var str=this.fillColor.toResponseText();if(str.length>0){result.append("&fc="+str);}}
if(!GEValueCheck.isNull(this.lineWidth)){var str=this.lineWidth.toString();if(str.length>0){result.append("&lw="+str);}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result.append("&ut="+str);}}
return result.toString();}
GEEllipseProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.lineColor)){result.append(',"lc":"'+this.lineColor.toString()+'"');}
if(!GEValueCheck.isNull(this.fillColor)){result.append(',"fc":"'+this.fillColor.toString()+'"');}
if(!GEValueCheck.isNull(this.lineWidth)){result.append(',"lw":"'+this.lineWidth.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
result.append('}');return result.toString();}
GEEllipseProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GEEllipseProperty();if(!GEValueCheck.isNull(obj.lc))
result.lineColor=GEColor.fromString(obj.lc);if(!GEValueCheck.isNull(obj.fc))
result.fillColor=GEColor.fromString(obj.fc);if(!GEValueCheck.isNull(obj.lw))
result.lineWidth=Number(obj.lw);if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;return result;}

function GEError(){}
GEError.argument=function(param){var e=new Error();e.name="ArgumentError";e.message=param+" パラメータが不正です。";if(typeof(e.description)!=undefined){e.description=e.message;}
throw e;}
GEError.range=function(param){var e=new Error();e.name="RangeError";e.message=param+"パラメータが範囲外です。";if(typeof(e.description)!=undefined){e.description=e.message;}
throw e;}
GEError.custom=function(type,message){var e=new Error();e.name=type;e.message=message;if(typeof(e.description)!=undefined){e.description=e.message;}
throw e;}
GEError.server=function(message){var e=new Error();e.name="ServerError";e.message=message;if(typeof(e.description)!=undefined){e.description=e.message;}
throw e;}
GEError.show=function(e){var msg="----- Geo/Echo Object Ajax [エラー詳細] -----"+"\n\n"+"【ErrorType】"+"\n"+
e.name+"\n"+"【Message】"+"\n"+
e.message;alert(msg);throw e;}

﻿
function GEEvent(){}
function GEEventData(eventType,handler,useCapture)
{this.eventType=eventType;this.handler=handler;this.useCapture=useCapture;}
GEEvent.addListener=function(elm,eventType,handler,useCapture){if(!elm)return;if(!useCapture)useCapture=false;if(this.containsListener(elm,eventType,handler,useCapture))
return;if(elm.addEventListener)
{elm.addEventListener(eventType,handler,useCapture);}
else if(elm.attachEvent)
{elm.attachEvent('on'+eventType,handler);}
else
{if(!elm.__events){elm.__events=new Object();}
if(elm.__events[eventType]==null){elm.__events[eventType]=new Array();}
elm.__events[eventType].push(handler);}
if(!elm.__eventData){elm.__eventData=new Array();}
elm.__eventData.push(new GEEventData(eventType,handler,useCapture));return handler;}
GEEvent.removeListener=function(elm,eventType,handler,useCapture){if(!elm)return;if(!useCapture)useCapture=false;if(elm.removeEventListener)
{elm.removeEventListener(eventType,handler,useCapture);}
else if(elm.attachEvent)
{elm.detachEvent('on'+eventType,handler);}
else
{if(!elm.__events){return;}
var listeners=elm.__events[eventType];if(!listeners){return;}
for(var i=0;i<listeners.length;i++)
{if(listeners[i]==handler){listeners.splice(i,1);break;}}}
if(elm.__eventData&&elm.__eventData.length>0){for(var i=0;i<elm.__eventData.length;i++){var eData=elm.__eventData[i];if(eData.eventType==eventType&&eData.handler.toString()==handler.toString()&&eData.useCapture==useCapture)
{delete eData.eventType;eData.eventType=null;delete eData.handler;eData.handler=null;delete eData.useCapture;eData.useCapture=null;elm.__eventData.splice(i,1);break;}}}
handler=null;}
GEEvent.clearListener=function(elm){if(!elm||!elm.__eventData||elm.__eventData.length==0)return;for(var i=elm.__eventData.length-1;i>=0;i--){var eData=elm.__eventData[i];this.removeListener(elm,eData.eventType,eData.handler,eData.useCapture);eData=null;}
elm.__eventData=null;}
GEEvent.containsListener=function(elm,eventType,handler,useCapture){if(!elm||!elm.__eventData||elm.__eventData.length==0)return false;if(!useCapture)useCapture=false;for(var i=0;i<elm.__eventData.length;i++){var eData=elm.__eventData[i];if(eData.eventType==eventType&&eData.handler.toString()==handler.toString()&&eData.useCapture==useCapture)
{return true;}}
return false;}
GEEvent.cleanup=function(){this._traverseCleanup(document);}
GEEvent._traverseCleanup=function(e)
{if(e.__eventData&&e.__eventData.length>0){this.clearListener(e);}
if(e.childNodes.length>0){for(var i=0;i<e.childNodes.length;i++){this._traverseCleanup(e.childNodes[i]);}}}
GEEvent.dispatch=function(elm,eventType,event){if(!elm)return;if(!elm.__events){return;}
var listeners=elm.__events[eventType];if(!listeners){return;}
if(!event){event=new Object();}
if(!event.target||event.target==null){event.target=elm;}
for(var i=0;i<listeners.length;i++)
{GEEvent._setEventTimer(listeners[i],event,i+1);}}
GEEvent._setEventTimer=function(func,args,i){var callFunc=func;if(i==undefined)i=1;setTimeout(function(){callFunc(args);},i);}
GEEvent.stopEvent=function(e){GEEvent.stopPropagation(e);GEEvent.preventDefault(e);}
GEEvent.stopPropagation=function(e){if(GEBrowser.isIE()){event.cancelBubble=true;}else{e.stopPropagation();}}
GEEvent.isStopped=function(e){if(GEBrowser.isIE()){return event.cancelBubble;}else{return e.cancelBubble;}}
GEEvent.preventDefault=function(e){if(GEBrowser.isIE()){event.returnValue=false;}else{e.preventDefault();}}
GEEvent.disableDragEventOnIE=function(elm)
{if(!elm)return;elm.ondrag=function(){return false;}
elm.ondragstart=function(){return false;}
elm.onselectstart=function(){return false;}
elm.oncontextmenu=function(){return false;}}
GEEvent.resetDragEventOnIE=function(elm)
{if(!elm)return;elm.ondrag=null;elm.ondragstart=null;elm.onselectstart=null;elm.oncontextmenu=null;}
GEEvent.disableSelection=function(elm)
{if(!elm)return;if(GEBrowser.isIE()){elm.unselectable='on';elm.galleryimg='no';}
else if(GEBrowser.isFireFox()){elm.style.MozUserSelect="none";}}
GEEvent.hasMouseEvent=function(mouseEvent){return(GEBrowser.isIE()&&event!=null)||(!GEBrowser.isIE()&&mouseEvent!=null);}
GEEvent.isLeftButton=function(mouseEvent){if(!GEEvent.hasMouseEvent(mouseEvent))return false;return(GEBrowser.isIE()&&event.button==1)||(!GEBrowser.isIE()&&mouseEvent.button==0);}
GEEvent.isRightButton=function(mouseEvent){if(!GEEvent.hasMouseEvent(mouseEvent))return false;return(GEBrowser.isIE()&&event.button==2)||(!GEBrowser.isIE()&&mouseEvent.button==2);}
GEEvent.isShiftKey=function(keyEvent)
{var shift;if(keyEvent!=null){shift=typeof keyEvent.modifiers=='undefined'?keyEvent.shiftKey:keyEvent.modifiers&Event.SHIFT_MASK;}else{shift=event.shiftKey;}
if(shift)
return true;else
return false;}
GEEvent.isCtrlKey=function(keyEvent)
{var ctrl;if(keyEvent!=null){ctrl=typeof keyEvent.modifiers=='undefined'?keyEvent.ctrlKey:keyEvent.modifiers&Event.CONTROL_MASK;}else{ctrl=event.ctrlKey;}
if(ctrl)
return true;else
return false;}

function GEFeature(layer){this.layer=layer;this.sid=0;this.birthTime=new Date(1000,1,1,0,0,0);this.deathTime=new Date(9000,12,31,23,59,59);this.labelString=null;this.geometry=null;this.attribute=null;this.property=null;}
GEFeature.prototype.setLayer=function(layer){this.layer=layer;}
GEFeature.prototype.setGeometry=function(geom){this.geometry=geom;if(!GEValueCheck.isNull(geom)){geom.feature=this;}}
GEFeature.prototype.updateProperty=function(){if(this.property==null)
return false;var cmd=new GEPropertyUpdater();return cmd.updateFeatureProperty(this);}
GEFeature.prototype.toResponseText=function(layer){var result=new GEStringBuilder();if(GEValueCheck.isNumber(this.sid)){var str=this.sid.toString();if(str.length>0){result.append("&f="+escape(str));}}
if(!GEValueCheck.isNull(this.birthTime)&&layer.hasTimeAxis()){var str=GEConvert.dateToString(this.birthTime);if(str.length>0){result.append("&bt="+escape(str));}}
if(!GEValueCheck.isNull(this.deathTime)&&layer.hasTimeAxis()){var str=GEConvert.dateToString(this.deathTime);if(str.length>0){result.append("&dt="+escape(str));}}
if(!GEValueCheck.isNull(this.labelString)){if(this.labelString.length>0){result.append("&lb="+escape(this.labelString));}}
if(!GEValueCheck.isNull(this.geometry)){var str=this.geometry.toWKT();if(str.length>0){result.append("&wkt="+escape(str));}
str=this.geometry.getGeometryType();if(str.length>0){result.append("&gt="+escape(str));}}
if(!GEValueCheck.isNull(this.attribute)){var str=this.attribute.toResponseText();if(str.length>0){result.append("&at="+str);}}
if(!GEValueCheck.isNull(this.property)){var str=this.property.toResponseText();if(str.length>0){result.append(str);}}
return result.toString();}
GEFeature.fromJSON=function(obj){if(obj==null)
return null;var result=new GEFeature();result.sid=Number(obj.f);if(!GEValueCheck.isNull(obj.bt))
result.birthTime=GEConvert.stringToDate(obj.bt);if(!GEValueCheck.isNull(obj.dt))
result.deathTime=GEConvert.stringToDate(obj.dt);if(!GEValueCheck.isNull(obj.lb))
result.labelString=obj.lb;if(!GEValueCheck.isNull(obj.geo))
result.setGeometry(GEGeometry.fromJSON(obj.geo));if(!GEValueCheck.isNull(obj.att))
result.attribute=GEAttribute.fromJSON(obj.att);if(!GEValueCheck.isNull(obj.prop))
result.property=GEDrawProperty.fromJSON(obj.prop);return result;}

function GEFeatureExpression(){this.sid=new GENumberCondition();this.timeAxis=new GETimeAxisCondition();this.geometryType=new GEGeometryTypeCondition();this.spatial=new GESpatialCondition();this.attribute="";}
GEFeatureExpression.prototype.toResponseText=function(){var result=new GEStringBuilder();if(!GEValueCheck.isNull(this.sid)){var str=this.sid.toResponseText();if(str.length>0){result.append("&sid="+str);}}
if(!GEValueCheck.isNull(this.timeAxis)){var str=this.timeAxis.toResponseText();if(str.length>0){result.append("&ta="+str);}}
if(!GEValueCheck.isNull(this.geometryType)){var str=this.geometryType.toResponseText();if(str.length>0){result.append("&gt="+str);}}
if(!GEValueCheck.isNull(this.spatial)){var str=this.spatial.toResponseText();if(str.length>0){result.append("&sp="+str);}}
if(GEValueCheck.isString(this.attribute)&&this.attribute.length>0){result.append("&at=");result.append(escape(this.attribute));}
return result.toString();}

﻿
function GEFeatureQueryCommand(layer){if(GEValueCheck.isNull(layer))
GEError.argument('layer');this.layer=layer;}
GEFeatureQueryCommand.prototype.execute=function(expression){var param=this._createParam(this.layer,expression);param+='&t='+GEFunctions.getRandomString();var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureQuery.aspx','GET',param);var obj=http.execute();if(obj==null)
return null;if(obj.response=='error'){GEError.server(obj.msg);return null;}
var result=new Array();for(var i=0;i<obj.ft.length;i++){var feature=GEFeature.fromJSON(obj.ft[i]);feature.setLayer(this.layer);result.push(feature);feature=null;}
obj=null;http=null;return result;}
GEFeatureQueryCommand.prototype.executeAsync=function(expression,success,error){var param=this._createParam(this.layer,expression);var layer=this.layer;var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureQuery.aspx','GET',param);http.beginExecute(function(obj){if(obj==null){if(success){success(null);}
return;}
if(obj.response=='error'){if(error)error(200,obj.msg);return;}
var result=new Array();for(var i=0;i<obj.ft.length;i++){var feature=GEFeature.fromJSON(obj.ft[i]);feature.setLayer(layer);result.push(feature);feature=null;}
obj=null;http=null;if(success){success(result);}},function(status){if(error){error(status,'');}
status=null;http=null;});http=null;}
GEFeatureQueryCommand.prototype._createParam=function(layer,expression){var param=new GEStringBuilder();param.append('ws='+layer.ws_id);param.append('&id='+layer.layerId.toString());param.append('&cn='+layer.connection);param.append('&t='+GEFunctions.getRandomString());if(!GEValueCheck.isNull(expression))
param.append(expression.toResponseText());return param.toString();}

﻿
function GEFeatureUpdateCommand(layer){if(GEValueCheck.isNull(layer))
GEError.argument('layer');this.layer=layer;}
GEFeatureUpdateCommand.prototype._createParam=function(layer,feature,features,mode){var param=new GEStringBuilder();param.append('ws='+layer.ws_id);param.append('&id='+layer.layerId.toString());param.append('&cn='+layer.connection);param.append('&t='+GEFunctions.getRandomString());param.append('&md='+mode);if(mode!='d'){param.append(feature.toResponseText(layer));}
else{param.append('&f=');if(features!=null&&features.length>0)
{for(var i=0;i<features.length;i++){if(i>0)param.append(',');param.append(features[i].sid.toString());}}}
return param.toString();}
GEFeatureUpdateCommand.prototype.addFeature=function(feature){var param=this._createParam(this.layer,feature,null,'a');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);var obj=http.execute();http=null;if(obj==null)
return false;if(obj.response=='error'){GEError.server(obj.msg);return false;}
if(obj.sid>0){feature.sid=obj.sid;return 1;}
else{return 0;}}
GEFeatureUpdateCommand.prototype.addFeatureAsync=function(feature,success,error){var param=this._createParam(this.layer,feature,null,'a');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);http.beginExecute(function(obj){if(obj==null)
return;if(obj.response=='error'){if(error)error(200,obj.msg);return;}
if(obj.sid>0){feature.sid=obj.sid;if(success)success(1);}
else{if(success)success(0);}
obj=null;http=null;},function(status){if(error){error(status,'');}
status=null;http=null;});http=null;}
GEFeatureUpdateCommand.prototype.updateFeature=function(feature){var param=this._createParam(this.layer,feature,null,'u');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);var obj=http.execute();http=null;if(obj==null)
return false;if(obj.response=='error'){GEError.server(obj.msg);return false;}
return obj.update;}
GEFeatureUpdateCommand.prototype.updateFeatureAsync=function(feature,success,error){var param=this._createParam(this.layer,feature,null,'u');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);http.beginExecute(function(obj){if(obj==null)
return;if(obj.response=='error'){if(error)error(200,obj.msg);return;}
if(success)
success(obj.update);obj=null;http=null;},function(status){if(error){error(status,'');}
status=null;http=null;});http=null;}
GEFeatureUpdateCommand.prototype.deleteFeatures=function(features){var param=this._createParam(this.layer,null,features,'d');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);var obj=http.execute();http=null;if(obj==null)
return false;if(obj.response=='error'){GEError.server(obj.msg);return false;}
return obj.update;}
GEFeatureUpdateCommand.prototype.deleteFeaturesAsync=function(features,success,error){var param=this._createParam(this.layer,null,features,'d');var http=new GEXmlHttp(this.layer.serverPath+'SdbFeatureUpdate.aspx','POST',param);http.beginExecute(function(obj){if(obj==null)
return;if(obj.response=='error'){if(error)error(200,obj.msg);return;}
if(success)
success(obj.update);obj=null;http=null;},function(status){if(error){error(status,'');}
status=null;http=null;});http=null;}

﻿
function GEFunctions(){}
GEFunctions.parsePx=function(value){if(value=='')return 0;return parseFloat(value);}
GEFunctions.createPx=function(value){return value+'px';}
GEFunctions.setImageSrc=function(img,src,isTransPng,onErrorSetTrans,view)
{if(isTransPng>0&&GEBrowser.isIE6down()){img.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='image')";img.src=GEAJAX.path+'/resources/transparent.gif';if(view){GEEvent.addListener(view,"oncursorchanged",function(e){img.style.cursor=e.cursor;});}}
else
{if(img.runtimeStyle){img.runtimeStyle.filter='';}
img.src=src;}
GEEvent.disableSelection(img);if(onErrorSetTrans&&typeof(img.onerror)!=undefined){GEEvent.addListener(img,"error",function()
{img.src=GEAJAX.path+'/resources/transparent.gif';});}}
GEFunctions.setBackgroundImage=function(elm,url,isTransPng,view)
{if(GEValueCheck.isNull(isTransPng))
isTransPng=false;if(isTransPng&&GEBrowser.isIE6down()){elm.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+url+",sizingMethod='scale')";elm.runtimeStyle.backgroundImage='url('+GEAJAX.path+'/resources/transparent.gif)';if(view){GEEvent.addListener(view,"oncursorchanged",function(e){elm.style.cursor=e.cursor;});}}
else
{if(elm.runtimeStyle){elm.runtimeStyle.filter='';}
elm.style.backgroundImage='url('+url+')';}}
GEFunctions.setStyle=function(elm,cssText)
{if(!elm)return;if(!cssText)cssText='';if(typeof(elm.style.cssText)!=undefined){elm.style.cssText=cssText;}else{elm.setAttribute('style',cssText);}}
GEFunctions.getRandomString=function()
{var now=new Date();return String(Math.floor(Math.random()*10000))+String(now.getSeconds());}
GEFunctions.getStringBytes=function(text)
{if(!GEValueCheck.isString(text))
return 0;count=0;for(i=0;i<text.length;i++)
{n=escape(text.charAt(i));if(n.length<4)count++;else count+=2;}
return count;}
GEFunctions.getMaxIndex=function()
{return 999999;}

function GEGC(){}
GEGC._objects=new Array();GEGC.add=function(o){if(GEValueCheck.isNull(o))return;if(!o.dispose)return;this._objects.push(o);}
GEGC.collect=function(){if(!this._objects||this._objects.length==0)return;for(var i=0;i<this._objects.length;i++){this._objects[i].dispose();this._objects[i]=null;}
this._objects=null;}

function GEGeometry(){}
GEGeometry.create=function(geometryType){return GEGeometryFactory.instance(geometryType);}
GEGeometry.fromJSON=function(obj){if(obj==null)
return null;if(obj.gt==GEGeometryType.GPoint||obj.gt=="gp"){return GEGPoint.fromJSON(obj);}
else if(obj.gt==GEGeometryType.LineString||obj.gt=="ls"){return GELineString.fromJSON(obj);}
else if(obj.gt==GEGeometryType.Polygon||obj.gt=="pg"){return GEPolygon.fromJSON(obj);}
else if(obj.gt==GEGeometryType.Ellipse||obj.gt=="el"){return GEEllipse.fromJSON(obj);}
else{return null;}}

function GEGeometryFactory(){}
GEGeometryFactory.instance=function(geometryType){switch(geometryType){case GEGeometryType.GPoint:return new GEGPoint();case GEGeometryType.LineString:return new GELineString();case GEGeometryType.Polygon:return new GEPolygon();case GEGeometryType.Ellipse:return new GEEllipse();default:return null;}}

function GEGeometryType(){}
GEGeometryType.GPoint="GPoint";GEGeometryType.LineString="LineString";GEGeometryType.Polygon="Polygon";GEGeometryType.Ellipse="Ellipse";

function GEGeometryTypeCondition(){this._value="";}
GEGeometryTypeCondition.equals=function(value){var condition=GEGeometryTypeCondition.or(new Array(value));return condition;}
GEGeometryTypeCondition.or=function(value){var condition=new GEGeometryTypeCondition();if(GEValueCheck.isNull(value)||value.length==0)
return condition;var result=new GEStringBuilder();for(var i=0;i<value.length;i++){if(!GEValueCheck.isString(value[i])){condition._value="";return condition;}
if(result.length>0)result.append(",");result.append(value[i].toString());}
condition._value=result.toString();return condition;}
GEGeometryTypeCondition.prototype.toResponseText=function(){return!GEValueCheck.isString(this._value)?"":escape(this._value);}

﻿
function GEGPoint(coordinate){this.feature=null;this.coordinate=GEValueCheck.isNull(coordinate)?new GEPointD(0,0):coordinate.clone();this.textString=null;this.angle=new GEAngle(0);this.hide=false;}
GEGPoint.prototype.getGeometryType=function(){return GEGeometryType.GPoint;}
GEGPoint.prototype.getCoordinates=function(){var result=new GEPointDList();result.add(this.coordinate.clone());return result;}
GEGPoint.prototype.setCoordinates=function(points){if(GEValueCheck.isNull(points)||points.count()==0){return;}
this.coordinate=points.items[0].clone();}
GEGPoint.prototype.getCenter=function(){return this.coordinate.clone();}
GEGPoint.prototype.getCentroid=function(){return this.coordinate.clone();}
GEGPoint.prototype.getBoundary=function(){if(GEValueCheck.isNull(this.coordinate))
return null;return new GERectangleD(this.coordinate.clone(),this.coordinate.clone());}
GEGPoint.prototype.getNearestPoint=function(point){if(GEValueCheck.isNull(point))
return null;if(GEValueCheck.isNull(this.coordinate))
return null;return this.coordinate.clone();}
GEGPoint.prototype.clone=function(){var result=new GEGPoint();result.coordinate=this.coordinate.clone();result.textString=this.textString;result.angle=this.angle.clone();return result;}
GEGPoint.prototype.toWKT=function(){if(GEValueCheck.isNull(this.coordinate))
return"";var wkt="POINT("+this.coordinate.x+" "+this.coordinate.y+")";return wkt;}
GEGPoint.prototype.toText=function(){if(GEValueCheck.isNull(this.coordinate))
return"";var wkt=GEGeometryType.GPoint.toUpperCase()+"("+this.coordinate.x+" "+this.coordinate.y+")";wkt+=";;";return wkt;}
GEGPoint.prototype.toJSON=function(){if(GEValueCheck.isNull(this.coordinate))
return"";var result=new GEStringBuilder();result.append('{');result.append('"gt":"'+this.getGeometryType()+'",');result.append('"pt":[{"x":"'+this.coordinate.x.toString()+'",'+'"y":"'+this.coordinate.y.toString()+'"}],');result.append('"txt":"'+GEConvert.toJSONText((GEValueCheck.isNull(this.textString)?"":this.textString))+'",');result.append('"rot":"'+this.angle.getRadian().toString()+'"');result.append('}');return result.toString();}
GEGPoint.fromJSON=function(obj){if(obj==null)
return null;var result=new GEGPoint();result.coordinate=new GEPointD(Number(obj.pt[0].x),Number(obj.pt[0].y));if(!GEValueCheck.isNull(obj.txt)){result.textString=obj.txt;}
if(!GEValueCheck.isNull(obj.rot)){result.angle=GEAngle.fromRadian(Number(obj.rot));}
return result;}

﻿
function GEHiliteRender(view){this._view=view;this.color=new GEColor(255,0,0);this._imgCache=new GEImageCache();}
GEHiliteRender.prototype.render=function(rubberBand,geom,property){if(GEValueCheck.isNull(rubberBand)||GEValueCheck.isNull(geom))
return;var hiliteProp=property;switch(geom.getGeometryType()){case GEGeometryType.GPoint:var lp=this._view.toLocalPoint(geom.coordinate);var ptype=property.getPropertyType();if(ptype==GEPropertyType.Point){if(hiliteProp==null)
hiliteProp=new GEPointProperty();var backColor1=hiliteProp.outlineColor;var backColor2=hiliteProp.fillColor;hiliteProp.outlineColor=this.color;hiliteProp.fillColor=this.color;rubberBand.drawPoint(lp,geom.angle.getRadian(),hiliteProp);hiliteProp.outlineColor=backColor1;hiliteProp.fillColor=backColor2;}
else if(ptype==GEPropertyType.Text){if(hiliteProp==null)
hiliteProp=new GETextProperty();var backColor=hiliteProp.fontColor;hiliteProp.fontColor=this.color;rubberBand.drawText(lp,geom.textString,geom.angle.getRadian(),hiliteProp);hiliteProp.fontColor=backColor;}
else if(ptype==GEPropertyType.Icon){if(hiliteProp==null)
hiliteProp=new GEIconProperty();var polyProp=new GEPolygonProperty();polyProp.lineColor=this.color;polyProp.fillColor=this.color;var pixSize=hiliteProp.iconSize.clone();if(!pixSize.isZero()&&hiliteProp.sizeUnit==GESizeUnit.World){pixSize=this._view.toLocalSize(pixSize);}
if(pixSize.width<=0||pixSize.height<=0)
{var image=this._imgCache.get(property.url);if(image!=null)
{pixSize=new GESizeD(image.width,image.height);if(GEValueCheck.isNumber(hiliteProp.scale)){pixSize.width*=hiliteProp.scale;pixSize.height*=hiliteProp.scale;}
this._renderBoundary(rubberBand,lp,pixSize,geom.angle.getRadian(),polyProp);}
else
{image=new Image();var _self=this;GEEvent.addListener(image,"load",function(){pixSize=new GESizeD(image.width,image.height);if(GEValueCheck.isNumber(hiliteProp.scale)){pixSize.width*=hiliteProp.scale;pixSize.height*=hiliteProp.scale;}
_self._renderBoundary(rubberBand,lp,pixSize,geom.angle.getRadian(),polyProp);});image.src=property.url;this._imgCache.add(property.url,image);}}
else
{if(!pixSize.isZero()&&GEValueCheck.isNumber(hiliteProp.scale)){pixSize.width*=hiliteProp.scale;pixSize.height*=hiliteProp.scale;}
this._renderBoundary(rubberBand,lp,pixSize,geom.angle.getRadian(),polyProp);}}
break;case GEGeometryType.LineString:if(hiliteProp==null)
hiliteProp=new GELinearProperty();var backColor=hiliteProp.lineColor;hiliteProp.lineColor=this.color;var localPoints=geom.coordinates.clone();for(var i=0;i<localPoints.count();i++){localPoints.items[i]=this._view.toLocalPoint(localPoints.items[i]);}
rubberBand.drawLines(localPoints,hiliteProp);hiliteProp.lineColor=backColor;break;case GEGeometryType.Polygon:if(hiliteProp==null)
hiliteProp=new GEPolygonProperty();var backColor1=hiliteProp.lineColor;var backColor2=hiliteProp.fillColor;hiliteProp.lineColor=this.color;hiliteProp.fillColor=this.color;var localPoints=geom.shell.clone();for(var i=0;i<localPoints.count();i++){localPoints.items[i]=this._view.toLocalPoint(localPoints.items[i]);}
rubberBand.drawPolygon(localPoints,hiliteProp);hiliteProp.lineColor=backColor1;hiliteProp.fillColor=backColor2;break;case GEGeometryType.Ellipse:if(hiliteProp==null)
hiliteProp=new GEEllipseProperty();var backColor1=hiliteProp.lineColor;var backColor2=hiliteProp.fillColor;hiliteProp.lineColor=this.color;hiliteProp.fillColor=this.color;var center=this._view.toLocalPoint(geom.center);var radius=this._view.toLocalSize(new GESizeD(geom.xAxis,geom.yAxis));rubberBand.drawEllipse(center,radius.width,radius.height,geom.angle.getRadian(),hiliteProp);hiliteProp.lineColor=backColor1;hiliteProp.fillColor=backColor2;break;}}
GEHiliteRender.prototype._renderBoundary=function(rubberBand,lp,pixSize,rotate,prop){var rect=GERectangleD.fromCenter(lp,pixSize);var coordinates=rect.getCoordinates();if(rotate&&rotate!=0)
{var rMatrix=new GEMatrix();rMatrix.rotateAt(lp,-rotate);rMatrix.transformPoints(coordinates);}
rubberBand.drawPolygon(coordinates,prop);}

function GEIconProperty(url){this.url=url;this.iconSize=new GESizeD(0,0);this.sizeUnit=GESizeUnit.Pixel;this.scale=1.0;}
GEIconProperty.prototype.getPropertyType=function(){return GEPropertyType.Icon;}
GEIconProperty.prototype.toResponseText=function(){var result=new GEStringBuilder();result.append("&pt="+this.getPropertyType());if(!GEValueCheck.isNull(this.url)){var str=this.url.toString();if(str.length>0){result.append("&url="+escape(str));}}
if(!GEValueCheck.isNull(this.iconSize)){var str=this.iconSize.width.toString()+","+this.iconSize.height.toString();if(str.length>0){result.append("&is="+str);}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result.append("&ut="+str);}}
if(!GEValueCheck.isNull(this.scale)){var str=this.scale.toString();if(str.length>0){result.append("&sc="+str);}}
return result.toString();}
GEIconProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.url)){result.append(',"url":"'+GEConvert.toJSONText(this.url)+'"');}
if(!GEValueCheck.isNull(this.iconSize)){result.append(',"is":"'+this.iconSize.width.toString()+","+this.iconSize.height.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
if(!GEValueCheck.isNull(this.scale)){result.append(',"sc":"'+this.scale.toString()+'"');}
result.append('}');return result.toString();}
GEIconProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GEIconProperty(obj.url);if(!GEValueCheck.isNull(obj.is)){var sizeItems=obj.is.split(',');result.iconSize=new GESizeD(Number(sizeItems[0]),Number(sizeItems[1]));}
if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;if(!GEValueCheck.isNull(obj.sc))
result.scale=Number(obj.sc);return result;}

function GEImageCache(){this._urlList=new Array();this._imageList=new Array();GEGC.add(this);}
GEImageCache.prototype.add=function(url,image){if(GEValueCheck.isNull(url)||GEValueCheck.isNull(image))
return;this._urlList.push(url);this._imageList.push(image);}
GEImageCache.prototype.get=function(url){if(GEValueCheck.isNull(url))
return null;if(this._urlList.length==0||this._imageList.length==0)
return null;for(var i=0;i<this._urlList.length;i++){if(this._urlList[i]==url){return this._imageList[i];}}
return null;}
GEImageCache.prototype.clear=function(){if(this._urlList.length==0&&this._imageList.length==0)
return;delete this._urlList;delete this._imageList;this._urlList=new Array();this._imageList=new Array();}
GEImageCache.prototype.dispose=function(){if(this._urlList==null||this._imageList==null)
return;delete this._urlList;this._urlList=null;delete this._imageList;this._imageList=null;}

function GEIndexView(view,option){if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.offsetX==undefined)
this.option.offsetX=0;if(this.option.offsetY==undefined)
this.option.offsetY=0;this.option.offsetX-=2;this.option.offsetY-=2;this._view=view;this._container=view.getContainer();var memoryLayers=view.getMemoryLayers();if(memoryLayers!=null&&memoryLayers.length>0){for(var i=0;i<memoryLayers.length;i++){if(memoryLayers[i].name=="_INDEX_VIEW_"){memoryLayers[i].dispose();}}}
this._memoryLayer=view.createMemoryLayer("_INDEX_VIEW_");this._parent=null;this._element=null;this._parentviewevent_onrangechanged=null;this._viewevent_click=null;this._viewevent_dblclick=null;this._viewevent_mousedown=null;this._viewevent_wheelevent=null;}
GEIndexView.prototype.baseAlign=function(){return GEControlPosition.RB;}
GEIndexView.prototype.getElement=function(){return this._element;}
GEIndexView.prototype.getOffset=function(){return new GEPointD(this.option.offsetX,this.option.offsetY);}
GEIndexView.prototype.isAttached=function(){return(this._parent!=null);}
GEIndexView.prototype.attach=function(parent,controlContainer){if(this.isAttached())return false;this._parent=parent;this._view.centerWithScaleAt(parent.view.getCenter(),parent.view.getScale()*15);this._view.disableDragging();this._view.disableWheelZoom();this._view.disablePanning();this._view.disableKeyScroll();this._view.changeCursor(GECursor.Cross);this._view.option.zoomEffect=false;this._viewevent_mousedown=GEEvent.addListener(this._container,'mousedown',function(event)
{GEEvent.stopEvent(event);});this._viewevent_dblclick=GEEvent.addListener(this._container,'dblclick',function(event)
{GEEvent.stopEvent(event);});this._viewevent_wheelevent=function(event)
{GEEvent.stopEvent(event);}
if(GEBrowser.isFireFox()){GEEvent.addListener(this._container,'DOMMouseScroll',this._viewevent_wheelevent);}else{GEEvent.addListener(this._container,'mousewheel',this._viewevent_wheelevent);}
var _self=this;this._viewevent_click=GEEvent.addListener(this._container,"click",function(mouseEvent){var p=_self._view.getWorldPoint(mouseEvent);_self._parent.view.centerAt(p);GEEvent.stopEvent(mouseEvent);});this._parentviewevent_onrangechanged=GEEvent.addListener(parent.view,"onrangechanged",function(event){if(_self._container.style.display=='none')return;var view=_self._parent.view;if(event.reason=='scale_changed'){_self._view.centerWithScaleAt(view.getCenter(),view.getScale()*15);}else{_self._view.panAt(view.getCenter());}
refreshPositionRect();});function refreshPositionRect()
{var view=_self._parent.view;var rect=GEPolygon.fromRectangle(view.getRange());var prop=new GEPolygonProperty();prop.lineColor=GEColor.fromHexString('#006633');prop.lineWidth=1;prop.fillColor=GEColor.fromHexString('#66CC00',50);_self._memoryLayer.clear();_self._memoryLayer.add(rect,prop);}
var size=this._view.getSize();this._element=document.createElement('div');this._element.id='GEIndexView_'+GEFunctions.getRandomString();controlContainer.appendChild(this._element);GEFunctions.setStyle(this._element,"visibility: visible;"+"position: absolute;"+"width: "+size.width+"px;"+"height: "+size.height+"px;"+"overflow: visible;"+"z-index: 0;"+"padding: 2px;"+"border: 1px #000000 solid;"+"background-color: #ffffff;");this._element.appendChild(this._container);var view_toggle=document.createElement('img');view_toggle.src=GEAJAX.path+'/resources/'+'indexview_hidden.gif';view_toggle.alt="索引ビューを閉じます";GEFunctions.setStyle(view_toggle,"visibility: visible;"+"position: absolute;"+"right: 1px;"+"bottom: 1px;"+"width: 13px;"+"height: 13px;"+"overflow: visible;"+"z-index: 10;"+"cursor: "+GECursor.Pointer+";");this._element.appendChild(view_toggle);GEEvent.addListener(view_toggle,"click",function()
{var container=_self._container;if(container.style.display!='none'){container.style.display="none";view_toggle.src=GEAJAX.path+'/resources/'+'indexview_show.gif';view_toggle.alt="索引ビューを開きます";var size=_self._view.getSize();_self._element.style.width=GEFunctions.createPx(13);_self._element.style.height=GEFunctions.createPx(13);}else{container.style.display="block";view_toggle.src=GEAJAX.path+'/resources/'+'indexview_hidden.gif';view_toggle.alt="索引ビューを閉じます";var size=_self._view.getSize();_self._element.style.width=GEFunctions.createPx(size.width);_self._element.style.height=GEFunctions.createPx(size.height);var view=_self._parent.view;_self._view.centerWithScaleAt(view.getCenter(),view.getScale()*15);refreshPositionRect();}
_self._parent.adjustPosition();return false;});refreshPositionRect();return true;}
GEIndexView.prototype.detach=function(parent,controlContainer){if(!this.isAttached())return;GEEvent.removeListener(parent.view,'onrangechanged',this._parentviewevent_onrangechanged);GEEvent.removeListener(this._container,'click',this._viewevent_click);GEEvent.removeListener(this._container,'dblclick',this._viewevent_dblclick);GEEvent.removeListener(this._container,'mousedown',this._viewevent_mousedown);if(GEBrowser.isFireFox()){GEEvent.removeListener(this._container,'DOMMouseScroll',this._viewevent_wheelevent);}else{GEEvent.removeListener(this._container,'mousewheel',this._viewevent_wheelevent);}
this._element.removeChild(this._container);controlContainer.removeChild(this._element);this._element=null;this._parent=null;this._container=null;this._view=null;}
GEIndexView.prototype.refresh=function(){}

function GEJoinStyle(){}
GEJoinStyle.Miter="Miter";GEJoinStyle.Round="Round";GEJoinStyle.Bevel="Bevel";

﻿
function GELayer(parent,serverPath,ws_id,layerType,layerId,connection){if(GEValueCheck.isNull(parent))
GEError.argument("parent");if(!GEValueCheck.isString(serverPath))
GEError.argument("serverPath");if(!GEValueCheck.isString(ws_id))
GEError.argument("ws_id");if(!GEValueCheck.isString(layerType))
GEError.argument("layerType");if(!GEValueCheck.isNumber(layerId))
GEError.argument("layerId");if(!GEValueCheck.isString(connection))
GEError.argument("connection");this.parent=parent;this.serverPath=serverPath;this.ws_id=ws_id;this.layerType=layerType;this.layerId=layerId;this.connection=connection;this.property=null;this._layerName="";this._readonly=true;this._visible="";this._hasTimeAxis="";}
GELayer.prototype.isReadonly=function(){return this._readonly;}
GELayer.prototype.isVisible=function(){return this._visible;}
GELayer.prototype.hasTimeAxis=function(){return this._hasTimeAxis;}
GELayer.prototype.getName=function(){return this._layerName;}
GELayer.prototype.newFeature=function(){return new GEFeature(this);}
GELayer.prototype.getFeatureQueryCommand=function(){return new GEFeatureQueryCommand(this);}
GELayer.prototype.getFeatureUpdateCommand=function(){return new GEFeatureUpdateCommand(this);}
GELayer.prototype.queryFeature=function(expression){var cmd=this.getFeatureQueryCommand();return cmd.execute(expression);}
GELayer.prototype.queryFeatureAsync=function(expression,success,error){var cmd=this.getFeatureQueryCommand();cmd.executeAsync(expression,success,error);}
GELayer.prototype.addFeature=function(feature){var cmd=this.getFeatureUpdateCommand();return cmd.addFeature(feature);}
GELayer.prototype.addFeatureAsync=function(feature,success,error){var cmd=this.getFeatureUpdateCommand();cmd.addFeatureAsync(feature,success,error);}
GELayer.prototype.updateFeature=function(feature){var cmd=this.getFeatureUpdateCommand();return cmd.updateFeature(feature);}
GELayer.prototype.updateFeatureAsync=function(feature,success,error){var cmd=this.getFeatureUpdateCommand();cmd.updateFeatureAsync(feature,success,error);}
GELayer.prototype.deleteFeature=function(feature){var features=new Array();features.push(feature);return this.deleteFeatures(features);}
GELayer.prototype.deleteFeatureAsync=function(feature,success,error){var features=new Array();features.push(feature);this.deleteFeaturesAsync(features,success,error);}
GELayer.prototype.deleteFeatures=function(features){if(features==null||features.length==0)return false;var cmd=this.getFeatureUpdateCommand();return cmd.deleteFeatures(features);}
GELayer.prototype.deleteFeaturesAsync=function(features,success,error){if(features==null||features.length==0)return;var cmd=this.getFeatureUpdateCommand();cmd.deleteFeaturesAsync(features,success,error);}
GELayer.prototype.updateProperty=function(){if(this.property==null)
return false;var cmd=new GEPropertyUpdater();return cmd.updateLayerProperty(this);}
GELayer.fromJSON=function(obj,parent,serverPath,ws_id){if(obj==null)
return null;var type=obj.lt
var sid=Number(obj.id)
var conn=obj.cnn
var result=new GELayer(parent,serverPath,ws_id,type,sid,conn);if(!GEValueCheck.isNull(obj.nm))
result._layerName=obj.nm;if(!GEValueCheck.isNull(obj.ro))
result._readonly=GEConvert.toBoolean(obj.ro);if(!GEValueCheck.isNull(obj.vb))
result._visible=GEConvert.toBoolean(obj.vb);if(!GEValueCheck.isNull(obj.ta))
result._hasTimeAxis=GEConvert.toBoolean(obj.ta);if(!GEValueCheck.isNull(obj.prop))
result.property=GEDrawProperty.fromJSON(obj.prop);return result;}

function GELayerExpression(){this.sid=new GENumberCondition();}
GELayerExpression.prototype.toResponseText=function(){var result=new GEStringBuilder();if(!GEValueCheck.isNull(this.sid)){var str=this.sid.toResponseText();if(str.length>0){result.append("&sid="+str);}}
return result.toString();}

﻿
function GELayerQueryCommand(parent,serverPath){if(GEValueCheck.isNull(parent))
GEError.argument('parent');if(!GEValueCheck.isString(serverPath))
GEError.argument('serverPath');this.parent=parent;this.serverPath=serverPath;}
GELayerQueryCommand.prototype.execute=function(ws_id,expression){var param=this._createParam(ws_id,expression);var http=new GEXmlHttp(this.serverPath+'SdbLayerQuery.aspx','GET',param);var obj=http.execute();if(GEValueCheck.isNull(obj))
return null;if(obj.response=='error'){GEError.server(obj.msg);return null;}
var result=new Array();for(var i=0;i<obj.layer.length;i++){if(!obj.layer[i])continue;var layer=GELayer.fromJSON(obj.layer[i],this.parent,this.serverPath,ws_id);if(layer!=null){result.push(layer);layer=null;}}
obj=null;http=null;return result;}
GELayerQueryCommand.prototype.executeAsync=function(ws_id,expression){var param=this._createParam(ws_id,expression);var http=new GEXmlHttp(this.serverPath+'SdbLayerQuery.aspx','GET',param);http.beginExecute(function(obj){if(obj==null){if(success){success(null);}
return;}
if(obj.response=='error'){if(error)error(200,obj.msg);return;}
var result=new Array();for(var i=0;i<obj.layer.length;i++){if(!obj.layer[i])continue;var layer=GELayer.fromJSON(obj.layer[i],this.parent,this.serverPath,ws_id);if(layer!=null){result.push(layer);layer=null;}}
obj=null;http=null;if(success){success(result);}},function(status){if(error){error(status,'');}
status=null;http=null;});http=null;}
GELayerQueryCommand.prototype._createParam=function(ws_id,expression){var param=new GEStringBuilder();param.append('ws='+ws_id);param.append('&t='+GEFunctions.getRandomString());if(!GEValueCheck.isNull(expression))
param.append(expression.toResponseText());return param.toString();}

﻿
function GELevelSlider(option){if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.offsetX==undefined)
this.option.offsetX=5;if(this.option.offsetY==undefined)
this.option.offsetY=5;this._parent=null;this._viewevent_onscalechanged=null;}
GELevelSlider.prototype.baseAlign=function(){return GEControlPosition.LT;}
GELevelSlider.prototype.getElement=function(){return this._element;}
GELevelSlider.prototype.getOffset=function(){return new GEPointD(this.option.offsetX,this.option.offsetY);}
GELevelSlider.prototype.isAttached=function(){return(this._parent!=null);}
GELevelSlider.prototype.attach=function(parent,controlContainer){if(this.isAttached())return false;this._parent=parent;this._element=document.createElement('div');this._element.id='GELevelSlider_'+GEFunctions.getRandomString();controlContainer.appendChild(this._element);GEFunctions.setBackgroundImage(this._element,GEAJAX.path+'/resources/control_back2.png',true,parent.view);GEFunctions.setStyle(this._element,"visibility: visible;"+"position: absolute;"+"width: 80px;"+"overflow: visible;"+"z-index: 0;"+"background-repeat: repeat;"+"padding: 5px;");GEEvent.disableDragEventOnIE(this._element);GEEvent.disableSelection(this._element);this.refresh();var self_ls=this;this._viewevent_onscalechanged=GEEvent.addListener(parent.view,"onscalechanged",function()
{self_ls.refresh();});this._viewevent_elementclick=GEEvent.addListener(this._element,"click",function(mouseEvent)
{parent.view.changeCursor(GECursor.Pointer);var childNodes=self_ls._element.childNodes;if(childNodes==null||childNodes.length==0)
return false;for(var i=0;i<childNodes.length;i++){if(GEValueCheck.isNull(childNodes[i].tag))
continue;var top=GEFunctions.parsePx(childNodes[i].style.top)+GEFunctions.parsePx(self_ls._element.style.top);var bottom=top+16;var left=GEFunctions.parsePx(childNodes[i].style.left)+GEFunctions.parsePx(self_ls._element.style.left);var right=left+50;var p=parent.view.getLocalPoint(mouseEvent);if(p.y>=top&&p.y<bottom&&p.x>=left&&p.x<right){if(parent.view.getScale()==childNodes[i].tag)
break;parent.view.scaleAt(childNodes[i].tag);self_ls.refresh();break;}}});this._viewevent_mouseover=GEEvent.addListener(this._element,"mouseover",function(mouseEvent)
{parent.view.changeCursor(GECursor.Pointer);});this._viewevent_mouseout=GEEvent.addListener(this._element,"mouseout",function(mouseEvent)
{parent.view.changeCursor(GECursor.Grab);});return true;}
GELevelSlider.prototype.detach=function(parent,controlContainer){if(!this.isAttached())return;GEEvent.removeListener(parent.view,'onscalechanged',this._viewevent_onscalechanged);GEEvent.removeListener(this._element,'click',this._viewevent_elementclick);GEEvent.removeListener(this._element,'mouseover',this._viewevent_mouseover);GEEvent.removeListener(this._element,'mouseout',this._viewevent_mouseout);GEEvent.resetDragEventOnIE(this._element);this._element.innerHTML='';controlContainer.removeChild(this._element);delete this._element;this._element=null;this._parent=null;}
GELevelSlider.prototype.refresh=function(){if(!this.isAttached())return;this._element.innerHTML='';var levels=this._parent.view.getLevels();if(levels==null||levels.length<2)
return;var img=document.createElement('img');img.src=GEAJAX.path+'/resources/'+'slider_m.gif';var currentLevel=this._parent.view.getLevel();var top=10;var text_top=5;for(var i=0;i<levels.length;i++){var imgc=img.cloneNode(true);var height=16;if(i==0){imgc.src=GEAJAX.path+'/resources/'+'slider_t.gif';height=10;}else if(i==levels.length-1){imgc.src=GEAJAX.path+'/resources/'+'slider_b.gif';height=10;}
GEFunctions.setStyle(imgc,"position: absolute;"+"left: 5px;"+"top: "+top+"px;"+"width: 12px;"+"height: "+height+"px;");this._element.appendChild(imgc);var label=document.createElement('div');label.tag=levels[i].scale;GEFunctions.setStyle(label,"position: absolute;"+"left: 20px;"+"top: "+text_top+"px;"+"width: 50px;"+"color: #000000;"+"font-family: MS Sans Serif;"+"font-size: 12px;"+"font-weight: bold;");if(levels[i].lv==currentLevel){label.style.border='1px #000000 solid';label.style.backgroundColor='#ffffff';}
label.appendChild(document.createTextNode('1/'+levels[i].scale))
this._element.appendChild(label);top+=height;text_top+=16;}
this._element.style.height=GEFunctions.createPx(top);}

function GELinearProperty(){this.lineColor=new GEColor(0,0,0);this.lineWidth=1;this.sizeUnit=GESizeUnit.Pixel;this.linePattern=GELinePattern.Solid;this.startCap=GELineCaps.Flat;this.endCap=GELineCaps.Flat;this.joinStyle=GEJoinStyle.Miter;this.drawBaseLine=false;this.baseLineColor=new GEColor(0,0,0);}
GELinearProperty.prototype.getPropertyType=function(){return GEPropertyType.Linear;}
GELinearProperty.prototype.toResponseText=function(){var result=new GEStringBuilder();result.append("&pt="+this.getPropertyType());if(!GEValueCheck.isNull(this.lineColor)){var str=this.lineColor.toResponseText();if(str.length>0){result.append("&lc="+str);}}
if(!GEValueCheck.isNull(this.lineWidth)){var str=this.lineWidth.toString();if(str.length>0){result.append("&lw="+str);}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result.append("&ut="+str);}}
if(!GEValueCheck.isNull(this.linePattern)){var str=this.linePattern;if(str.length>0){result.append("&lp="+str);}}
if(!GEValueCheck.isNull(this.startCap)){var str=this.startCap;if(str.length>0){result.append("&sc="+str);}}
if(!GEValueCheck.isNull(this.endCap)){var str=this.endCap;if(str.length>0){result.append("&ec="+str);}}
return result.toString();}
GELinearProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.lineColor)){result.append(',"lc":"'+this.lineColor.toString()+'"');}
if(!GEValueCheck.isNull(this.lineWidth)){result.append(',"lw":"'+this.lineWidth.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
if(!GEValueCheck.isNull(this.linePattern)){result.append(',"lp":"'+this.linePattern+'"');}
if(!GEValueCheck.isNull(this.startCap)){result.append(',"sc":"'+this.startCap+'"');}
if(!GEValueCheck.isNull(this.endCap)){result.append(',"ec":"'+this.endCap+'"');}
result.append('}');return result.toString();}
GELinearProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GELinearProperty();if(!GEValueCheck.isNull(obj.lc))
result.lineColor=GEColor.fromString(obj.lc);if(!GEValueCheck.isNull(obj.lw))
result.lineWidth=Number(obj.lw);if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;if(!GEValueCheck.isNull(obj.lp))
result.linePattern=obj.lp;if(!GEValueCheck.isNull(obj.sc))
result.startCap=obj.sc;if(!GEValueCheck.isNull(obj.ec))
result.endCap=obj.ec;return result;}

function GELineCaps(){}
GELineCaps.Flat="Flat";GELineCaps.Square="Square";GELineCaps.Round="Round";GELineCaps.Triangle="Triangle";GELineCaps.SquareAnchor="SquareAnchor";GELineCaps.RoundAnchor="RoundAnchor";GELineCaps.DiamondAnchor="DiamondAnchor";GELineCaps.ArrowAnchor="ArrowAnchor";

function GELinePattern(){}
GELinePattern.None="None";GELinePattern.Solid="Solid";GELinePattern.Dot="Dot";GELinePattern.Dash="Dash";GELinePattern.DashDot="DashDot";GELinePattern.DashDotDot="DashDotDot";

﻿
function GELineString(coordinates){this.feature=null;this.coordinates=GEValueCheck.isNull(coordinates)?new GEPointDList():coordinates.clone();this.hide=false;}
GELineString.prototype.getGeometryType=function(){return GEGeometryType.LineString;}
GELineString.prototype.getCoordinates=function(){return this.coordinates.clone();}
GELineString.prototype.setCoordinates=function(points){if(GEValueCheck.isNull(points)||points.count()==0){return;}
this.coordinates=points.clone();}
GELineString.prototype.getCenter=function(){return this.coordinates.center();}
GELineString.prototype.getLength=function(){return GEMeasure.polylineLength(this.coordinates);}
GELineString.prototype.getCentroid=function(){return GECentroid.lineString(this.coordinates);}
GELineString.prototype.getBoundary=function(){if(GEValueCheck.isNull(this.coordinates))
return null;return this.coordinates.mbr();}
GELineString.prototype.getNearestPoint=function(p){if(GEValueCheck.isNull(p))
return null;if(GEValueCheck.isNull(this.coordinates))
return null;return this.coordinates.getNearestPoint(p);}
GELineString.prototype.getNearestDistance=function(p){if(GEValueCheck.isNull(p))
return 0;if(GEValueCheck.isNull(this.coordinates))
return 0;return this.coordinates.getNearestDistance(p);}
GELineString.prototype.clone=function(){var result=new GELineString();result.coordinates=this.coordinates.clone();return result;}
GELineString.prototype.toWKT=function(){if(GEValueCheck.isNull(this.coordinates))
return"";var wkt=new GEStringBuilder();wkt.append(this.getGeometryType().toUpperCase());wkt.append("(");wkt.append(this._getCoordinateString(this.coordinates));wkt.append(")");return wkt.toString();}
GELineString.prototype.toText=function(){if(GEValueCheck.isNull(this.coordinates))
return"";var wkt=new GEStringBuilder();wkt.append(GEGeometryType.LineString);wkt.append("(");wkt.append(this._getCoordinateString(this.coordinates));wkt.append(")");wkt.append(";;");return wkt.toString();}
GELineString.prototype._getCoordinateString=function(coordinates){var result=new GEStringBuilder();for(var i=0;i<coordinates.count();i++){if(i>0)result.append(",");result.append(coordinates.items[i].x.toString()+" "+coordinates.items[i].y.toString());}
return result.toString();}
GELineString.prototype.toJSON=function(){if(GEValueCheck.isNull(this.coordinates))
return"";var result=new GEStringBuilder();result.append('{');result.append('"gt":"'+this.getGeometryType()+'",');result.append('"pts":');result.append('[');for(var i=0;i<this.coordinates.count();i++){result.append('{');result.append('"x":"'+this.coordinates.items[i].x.toString()+'",');result.append('"y":"'+this.coordinates.items[i].y.toString()+'"');result.append('}');if(i<this.coordinates.count()-1)
result.append(',');}
result.append(']');result.append('}');return result.toString();}
GELineString.fromJSON=function(obj){if(obj==null)
return null;var result=new GELineString();var coordinates=new GEPointDList();for(var i=0;i<obj.pts.length;i++){var x=Number(obj.pts[i].x)
var y=Number(obj.pts[i].y)
coordinates.add(new GEPointD(x,y));}
result.coordinates=coordinates;return result;}

﻿
function GEMapView(container,levels,option){if(!container){GEError.argument("container");}
if(levels&&levels.length>0)
{var scales=levels.split(',');this._levels=[];for(var i=0;i<scales.length;i++){this._levels[i]=new Object();this._levels[i].lv=Number(i+1);this._levels[i].scale=parseInt(scales[i]);}}
else
this._levels=null;if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(GEValueCheck.isNumber(this.option.width))
container.style.width=GEFunctions.createPx(this.option.width);if(GEValueCheck.isNumber(this.option.height))
container.style.height=GEFunctions.createPx(this.option.height);if(this.option.operation==undefined)
this.option.operation=true;if(this.option.resolution==undefined)
this.option.resolution=96;if(this.option.minx==undefined)
this.option.minx=-200000;if(this.option.miny==undefined)
this.option.miny=-200000;if(this.option.maxx==undefined)
this.option.maxx=200000;if(this.option.maxy==undefined)
this.option.maxy=200000;if(this.option.backcolor==undefined)
this.option.backcolor='#E8E8E8';if(this.option.zoomEffect==undefined)
this.option.zoomEffect=false;this._ELEMENT_ID_VIEW_CLIP="GEMapViewClipRegion";this._ELEMENT_ID_VIEW_CONTAINER="GEMapViewContainer";this._ELEMENT_ID_CONTROLL_CONTAINER="GEControllContainer";this._scale=2500;this._center=new GEPointD(0,0);this._rotate=0.0;this._viewSize=new GESizeD();this._refreshing=false;this._scrollFrom=null;this._scrolling=false;this._clipRegion=null;this._viewContainer=null;this._controlContainer=null;this._mapList=new Array();this._memoryLayers=new Array();this._pixWorld=(1/(this.option.resolution/25.4))/1000.0;this._container=container;this._containerOffset=null;this._initializeView();this._memoryLayer=new GEMemoryLayer(this,this._viewContainer,false,"_DEFAULT_");this._defaultOp=new GEDefaultOperation();this._opController=new GEOperationController(this,this._viewContainer);this._opController.beginDefault(this._defaultOp);GEGC.add(this);}
GEMapView.prototype.dispose=function(){if(this._container==null)return;this._opController.terminateDefault();this._opController=null;this._defaultOp=null;this._memoryLayer.dispose();this._memoryLayer=null;for(var i=0;i<this._memoryLayers.length;i++){this._memoryLayers[i].dispose();}
this._memoryLayers=null;for(var i=0;i<this._mapList.length;i++){var map=this._mapList[i];map.detach(this,this._viewContainer);}
delete this._mapList;GEEvent.resetDragEventOnIE(this._viewContainer);GEEvent.resetDragEventOnIE(this._controlContainer.controlContainer);GEEvent.resetDragEventOnIE(this._clipRegion);GEEvent.resetDragEventOnIE(this._container);this._viewContainer=null;this._controlContainer=null;this._clipRegion=null;this._container=null;}
GEMapView.prototype.isLoaded=function(){return this._mapList.length>0;}
GEMapView.prototype.isRefreshing=function(){return this._refreshing;}
GEMapView.prototype.hasLevels=function(){return(this._levels!=null&&this._levels.length>0);}
GEMapView.prototype.getLevels=function(){return this._levels;}
GEMapView.prototype.getCoordinateSpace=function(){return new GERectangleD(new GEPointD(this.option.minx,this.option.miny),new GEPointD(this.option.maxx,this.option.maxy));}
GEMapView.prototype.getSize=function(){return this._viewSize.clone();}
GEMapView.prototype.getContainer=function(){return this._container;}
GEMapView.prototype.getMaps=function(map)
{return this._mapList;}
GEMapView.prototype.attachMap=function(map)
{if(!map||!map.attach)return;map.attach(this,this._viewContainer);this._mapList.push(map);}
GEMapView.prototype.detachMap=function(map)
{if(!map||!map.detach)return;if(this._mapList.length==0)return;map.detach(this,this._viewContainer);for(var i=0;i<this._mapList.length;i++)
{if(this._mapList[i]==map){this._mapList.splice(i,1);break;}}}
GEMapView.prototype.clearMaps=function()
{if(this._mapList.length==0)return;for(var i=0;i<this._mapList.length;i++){var map=this._mapList[i];map.detach(this,this._viewContainer);}
this._mapList=null;this._mapList=new Array();}
GEMapView.prototype.getControls=function()
{this._controlContainer.getControls();}
GEMapView.prototype.addControl=function(control)
{this._controlContainer.add(control);}
GEMapView.prototype.removeControl=function(control)
{this._controlContainer.remove(control);}
GEMapView.prototype.clearControls=function()
{this._controlContainer.clear();}
GEMapView.prototype.resize=function()
{this.onresize();}
GEMapView.prototype.createMemoryLayer=function(name){var mLayer=new GEMemoryLayer(this,this._viewContainer,true,name);this._memoryLayers.push(mLayer);return mLayer;}
GEMapView.prototype.getMemoryLayers=function(){return this._memoryLayers;}
GEMapView.prototype.getMemoryLayer=function(){return this._memoryLayer;}
GEMapView.prototype.saveMemoryLayer=function(){return this._memoryLayer.save();}
GEMapView.prototype.loadMemoryLayer=function(data){this._memoryLayer.load(data);}
GEMapView.prototype._removeMemoryLayer=function(mLayer){if(!mLayer)return;var newList=new Array();if(!GEValueCheck.isNull(this._memoryLayers)){for(var i=0;i<this._memoryLayers.length;i++){if(this._memoryLayers[i]==mLayer)
continue;newList.push(this._memoryLayers[i]);}}
this._memoryLayers=newList;}
GEMapView.prototype.getCenter=function(){return this._center.clone();}
GEMapView.prototype.getAngle=function(){return GEAngle.fromRadian(this._rotate);}
GEMapView.prototype.getLevel=function(){if(!this.hasLevels())
return 0;for(var i=0;i<this._levels.length;i++)
{var info=this._levels[i];if(info==undefined)break;if(parseInt(info.scale)==this._scale){return parseInt(info.lv);}}
return 0;}
GEMapView.prototype.getMaxLevel=function(){if(!this.hasLevels())
return 0;var maxLv=0;for(var i=0;i<this._levels.length;i++)
{var info=this._levels[i];if(info==undefined)continue;if(parseInt(info.lv)>maxLv){maxLv=parseInt(info.lv);}}
return maxLv;}
GEMapView.prototype.getScale=function(){return this._scale;}
GEMapView.prototype.getScaleByLebel=function(level){if(!GEValueCheck.isNumber(level)||parseInt(level)<=0)
return 0;if(!this.hasLevels())
return 0;if(level>this.getMaxLevel())
return 0;for(var i=0;i<this._levels.length;i++)
{var info=this._levels[i];if(info==undefined)break;if(parseInt(info.lv)==level){return info.scale;}}
return 0;}
GEMapView.prototype.getNormalRange=function()
{var pixSize=this.getPixelWorld();var left=this._center.x-((this._viewSize.width/2)*pixSize.width);var top=this._center.y+((this._viewSize.height/2)*pixSize.height);var size=new GESizeD(pixSize.width*this._viewSize.width,pixSize.height*this._viewSize.height);pixSize=null;return GERectangleD.fromSize(new GEPointD(left,top-size.height),size);}
GEMapView.prototype.getRange=function()
{var r=this.getNormalRange();if(this._rotate!=0.0){return r.getRotationRect(GEAngle.fromRadian(-this._rotate));}else{return r;}}
GEMapView.prototype.zoomIn=function(p,centerAt)
{if(!this.isLoaded())return;if(this._scale<=1){return;}
var newScale=0;if(this.hasLevels())
{var level=this.getLevel();if(level<=1){return;}
newScale=this.getScaleByLebel(level-1);}
else
{newScale=this._scale/1.5;}
this._zoomProc(newScale,p,centerAt);}
GEMapView.prototype.zoomOut=function(p,centerAt)
{if(!this.isLoaded())return;var newScale=0;if(this.hasLevels())
{var level=this.getLevel();if(level>=this.getMaxLevel()){return;}
newScale=this.getScaleByLebel(level+1);}
else
{newScale=this._scale*1.5;}
this._zoomProc(newScale,p,centerAt);}
GEMapView.prototype._zoomProc=function(newScale,p,centerAt)
{var oldScale=this._scale;var oldCenter=this._center.clone();if(p){if(GEValueCheck.isNull(centerAt))
centerAt=true;if(centerAt)
{this._center=p.clone();}
else
{var lp=this.toLocalPoint(p);this._scale=newScale;var lp2=this.toLocalPoint(p);var offset=this.toWorldSize(new GESizeD(lp2.x-lp.x,lp2.y-lp.y));var vp=this._center.clone();vp.x+=offset.width;vp.y-=offset.height;this._center=vp;}}
this._scale=newScale;this.onzoom(oldScale,oldCenter);}
GEMapView.prototype.centerAt=function(p){if(!this.isLoaded())return;if(!p)return;this._center=p.clone();this.onrangechanged("center_changed");}
GEMapView.prototype.centerWithScaleAt=function(p,scale){if(!this.isLoaded())return;if(!p)return;if(!GEValueCheck.isNumber(scale)||parseInt(scale)<=0)
return;this._center=p.clone();this.scaleAt(scale);}
GEMapView.prototype.centerWithLevelAt=function(p,level){if(!this.isLoaded())return;if(!p)return;if(!GEValueCheck.isNumber(level)||parseInt(level)<=0)
return;this._center=p.clone();this.levelAt(level);}
GEMapView.prototype.panAt=function(p){if(!this.isLoaded())return;if(!p)return;if(this._scrolling)return;var range=this.getRange();if(range.contains(p))
{var p1=this.toLocalPoint(this._center);var p2=this.toLocalPoint(p);this.onscrollstart();var times=Math.floor(Math.max(Math.abs(p1.x-p2.x),Math.abs(p1.y-p2.y))/100);if(times<=0)times=1;var dx=Math.ceil((p1.x-p2.x)/times);var dy=Math.ceil((p1.y-p2.y)/times);;this._startPanning(dx,dy,times);}
else
{this.centerAt(p);}
range=null;}
GEMapView.prototype._startPanning=function(dx,dy,times)
{var self_view=this;var timer=setTimeout(function()
{self_view.onscroll(dx,dy);times--;if(times>0){self_view._startPanning(dx,dy,times);}else{clearTimeout(timer);self_view.onscrollend();}},10);}
GEMapView.prototype.levelAt=function(level){if(!GEValueCheck.isNumber(level)||parseInt(level)<=0)
return;if(!this.isLoaded())return;if(!this.hasLevels())
return;if(level>this.getMaxLevel())
return;var newScale=this.getScaleByLebel(level);if(newScale==0)return;this._scale=newScale;this.onscalechanged();}
GEMapView.prototype.scaleAt=function(scale){if(!GEValueCheck.isNumber(scale)||parseInt(scale)<=0)
return;if(!this.isLoaded())return;if(this.hasLevels())
{var lv_scale=this._levels[0].scale;for(var i=0;i<this._levels.length-1;i++)
{var info1=this._levels[i];var info2=this._levels[i+1];if(info1==undefined||info2==undefined)break;if(info1.scale>scale)break;if((scale-info1.scale)<(info2.scale-scale)){lv_scale=info1.scale;}
else{lv_scale=info2.scale;}}
if(lv_scale==0)return;this._scale=lv_scale;}
else
{this._scale=Math.floor(scale);}
this.onscalechanged();}
GEMapView.prototype.rangeAt=function(range){if(!this.isLoaded())return;var center=range.getCenter();var targetRange=range.clone();if(this._rotate!=0.0){targetRange=targetRange.getRotationRect(GEAngle.fromRadian(-this._rotate));}
var r=this.getNormalRange();var scaleF=1.0;if((r.getHeight()*range.getWidth())>=(r.getWidth()*targetRange.getHeight())){scaleF=r.getWidth()/targetRange.getWidth();}else{scaleF=r.getHeight()/targetRange.getHeight();}
if(scaleF>0.0)
{this.centerAt(center);this.scaleAt(this._scale/scaleF);}
center=null;r=null;}
GEMapView.prototype.rotateAt=function(angle){if(GEValueCheck.isNull(angle))
return;if(!this.isLoaded())return;this._rotate=angle.getRadian();this.onrotatechanged();}
GEMapView.prototype.refresh=function(){if(!this.isLoaded())return;this._mapRefresh("user");}
GEMapView.prototype.getPixelWorld=function(){return new GESizeD(this._pixWorld*this._scale,this._pixWorld*this._scale);}
GEMapView.prototype.toLocalPoint=function(worldP){if(!worldP)GEError.argument("worldP");var bounds=this.getNormalRange();var pixSize=this.getPixelWorld();var wp=worldP.clone();if(this._rotate!=0.0){var rMatrix=new GEMatrix();rMatrix.rotateAt(this._center,this._rotate);wp=rMatrix.transform(worldP);rMatrix=null;}
var p=new GEPointD((wp.x-bounds.min.x)/pixSize.width,(bounds.max.y-wp.y)/pixSize.height);bounds=null;pixSize=null;return p;}
GEMapView.prototype.toLocalSize=function(worldD){if(!worldD)GEError.argument("worldD");var pixSize=this.getPixelWorld();var localD=new GESizeD(worldD.width/pixSize.width,worldD.height/pixSize.height);pixSize=null;return localD;}
GEMapView.prototype.toWorldPoint=function(localP){if(!localP)GEError.argument("localP");var bounds=this.getNormalRange();var pixSize=this.getPixelWorld();var p=new GEPointD((localP.x*pixSize.width)+bounds.min.x,bounds.max.y-(localP.y*pixSize.height));if(this._rotate!=0.0){var rMatrix=new GEMatrix();rMatrix.rotateAt(this._center,-this._rotate);p=rMatrix.transform(p);rMatrix=null;}
bounds=null;pixSize=null;return p;}
GEMapView.prototype.toWorldSize=function(localD){if(!localD)GEError.argument("localD");var pixSize=this.getPixelWorld();var worldD=new GESizeD(localD.width*pixSize.width,localD.height*pixSize.height);pixSize=null;return worldD;}
GEMapView.prototype.getViewPort=function()
{var left=this._viewContainer.offsetLeft*-1;var top=this._viewContainer.offsetTop*-1;return GERectangleD.fromSize(new GEPointD(left,top),this._viewSize);}
GEMapView.prototype.getLocalPoint=function(mouseEvent){var pageX;var pageY;if(GEBrowser.isIE()){pageX=event.clientX+(document.body.scrollLeft||document.documentElement.scrollLeft);pageY=event.clientY+(document.body.scrollTop||document.documentElement.scrollTop);}
else if(mouseEvent.type=="DOMMouseScroll"&&GEBrowser.isFireFox2down()){pageX=mouseEvent.screenX;pageY=mouseEvent.screenY;}
else if(mouseEvent.type=="DOMMouseScroll"&&GEBrowser.isFireFox3()){pageX=mouseEvent.pageX;pageY=mouseEvent.pageY;}
else{pageX=mouseEvent.pageX;pageY=mouseEvent.pageY;}
var documentOffset=this.getContainerOffset();var p=new GEPointD(pageX-documentOffset.width,pageY-documentOffset.height);p.round(4);return p;}
GEMapView.prototype.getWorldPoint=function(mouseEvent){var p=this.toWorldPoint(this.getLocalPoint(mouseEvent));p.round(4);return p;}
GEMapView.prototype.getContainerOffset=function(){var currentElement=this._container;var offsetX=0;var offsetY=0;while(currentElement!=null){if((currentElement.style!=null)&&(currentElement.style.display!='none'&&currentElement.style.visibility!='hidden')){offsetX+=(GEValueCheck.isNumber(currentElement.offsetLeft))?currentElement.offsetLeft:0;offsetY+=(GEValueCheck.isNumber(currentElement.offsetTop))?currentElement.offsetTop:0;offsetX+=currentElement.style.borderLeftWidth!=''?parseInt(currentElement.style.borderLeftWidth):0;offsetY+=currentElement.style.borderTopWidth!=''?parseInt(currentElement.style.borderTopWidth):0;}
currentElement=currentElement.offsetParent;}
if(GEBrowser.isIE())
{offsetX+=document.documentElement.clientLeft;offsetY+=document.documentElement.clientTop;}
this._containerOffset=new GESizeD(offsetX,offsetY);return this._containerOffset;}
GEMapView.prototype.changeCursor=function(cursor)
{if(!cursor||(cursor.substr(0,3)=='url'&&(GEBrowser.isOpera()||GEBrowser.isSafari()))){cursor=GECursor.Default;}
if(this._container.style.cursor!=cursor){this._container.style.cursor=cursor;this.oncursorchanged();}}
GEMapView.prototype.isDragging=function()
{return this._defaultOp.isDragging;}
GEMapView.prototype.enableDragging=function()
{this._defaultOp.enableDragging();}
GEMapView.prototype.disableDragging=function()
{this._defaultOp.disableDragging();}
GEMapView.prototype.enableKeyScroll=function()
{this._defaultOp.enableKeyScroll();}
GEMapView.prototype.disableKeyScroll=function()
{this._defaultOp.disableKeyScroll();}
GEMapView.prototype.enableWheelZoom=function()
{this._defaultOp.enableWheelZoom();}
GEMapView.prototype.disableWheelZoom=function()
{this._defaultOp.disableWheelZoom();}
GEMapView.prototype.enablePanning=function()
{this._defaultOp.enablePanning();}
GEMapView.prototype.disablePanning=function()
{this._defaultOp.disablePanning();}
GEMapView.prototype.beginOperation=function(op)
{if(!this.option.operation){return;}
if(!op||!op.start){return;}
this._opController.begin(op);}
GEMapView.prototype.terminateOperation=function()
{this._opController.terminate();}
function GEEventArgs(){}
GEMapView.prototype.oncursorchanged=function()
{var e=new GEEventArgs();e.cursor=this._container.style.cursor;GEEvent.dispatch(this,"oncursorchanged",e);}
GEMapView.prototype.onresize=function()
{this._viewSize.width=this._container.clientWidth;this._viewSize.height=this._container.clientHeight;GEEvent.dispatch(this,"onresize",new GEEventArgs());this.onrangechanged("resize");}
GEMapView.prototype.onscalechanged=function()
{GEEvent.dispatch(this,"onscalechanged",new GEEventArgs());this.onrangechanged("scale_changed");}
GEMapView.prototype.onrotatechanged=function()
{GEEvent.dispatch(this,"onrotatechanged",new GEEventArgs());this.onrangechanged("rotate_changed");}
GEMapView.prototype.onrangechanged=function(reason)
{this._mapRefresh(reason);var args=new GEEventArgs();args.reason=reason;GEEvent.dispatch(this,"onrangechanged",args);}
GEMapView.prototype.onscrollstart=function()
{this._scrollFrom=this._center.clone();this._scrolling=true;GEEvent.dispatch(this,"onscrollstart",new GEEventArgs());}
GEMapView.prototype.onscroll=function(dx,dy)
{if(!this._scrolling)return;var localP=this.toLocalPoint(this._center);localP.x-=dx;localP.y-=dy;this._center=this.toWorldPoint(localP);localP=null;var left=this._viewContainer.offsetLeft+dx;var top=this._viewContainer.offsetTop+dy;this._viewContainer.style.left=GEFunctions.createPx(left);this._viewContainer.style.top=GEFunctions.createPx(top);var args=new GEEventArgs()
args.dx=dx;args.dy=dy;GEEvent.dispatch(this,"onscroll",args);}
GEMapView.prototype.onscrollend=function()
{if(!this._scrolling)return;GEEvent.dispatch(this,"onscrollend",new GEEventArgs());this._scrolling=false;if(!this._scrollFrom.equals(this._center)){this.onrangechanged("scroll");}
this._scrollFrom=null;}
GEMapView.prototype.onbeginrefresh=function()
{GEEvent.dispatch(this,"onbeginrefresh",new GEEventArgs());}
GEMapView.prototype.onendrefresh=function()
{GEEvent.dispatch(this,"onendrefresh",new GEEventArgs());}
GEMapView.prototype.onzoom=function(oldScale,oldCenter)
{if(this.option.zoomEffect==false||this._mapList.length==0)
{this.onscalechanged();return;}
var e=new GEEventArgs();var ocp=this.toLocalPoint(oldCenter);var ncp=this.toLocalPoint(this._center);var times=3;e.dx=parseFloat(ocp.x-ncp.x)/times;e.dy=parseFloat(ocp.y-ncp.y)/times;var baseSize=10;var dw=(baseSize*(oldScale/this._scale))-baseSize;e.ds=(baseSize+(dw/times))/baseSize;if(Math.pow(e.ds,times)>(oldScale/this._scale))times--;e.cp=this.getViewPort().getCenter();e.matrix=new GEMatrix();e.matrix.scaleAt(e.cp,e.ds,e.ds);for(var i=0;i<this._mapList.length;i++)
this._mapList[0].onzoomstart(e);var cnt=0;this._zoomAnimate(cnt,times,e);}
GEMapView.prototype._zoomAnimate=function(cnt,times,e)
{cnt++;if(cnt>times)
{for(var i=0;i<this._mapList.length;i++)
this._mapList[0].onzoomend(e);this.onscalechanged();}
else
{var self=this;setTimeout(function(){for(var i=0;i<self._mapList.length;i++)
self._mapList[i].onzoom(e);self._zoomAnimate(cnt,times,e);},0);}}
GEMapView.prototype._mapRefresh=function(reason){if(!this.isLoaded())return;this._refreshing=true;this.onbeginrefresh();this._memoryLayer.render();for(var i=0;i<this._memoryLayers.length;i++)
this._memoryLayers[i].render();if(this._mapList.length>0){for(var i=0;i<this._mapList.length;i++){this._mapList[i].refresh(reason);}}
this._refreshing=false;this.onendrefresh();}
GEMapView.prototype._initializeView=function()
{this._container.style.overflow='hidden';GEEvent.disableDragEventOnIE(this._container);this._viewSize.width=this._container.clientWidth;this._viewSize.height=this._container.clientHeight;this._clipRegion=document.createElement('div');this._clipRegion.id=this._ELEMENT_ID_VIEW_CLIP+'_'+GEFunctions.getRandomString();this._container.appendChild(this._clipRegion);GEFunctions.setStyle(this._clipRegion,"position: relative;"+"left: 0px;"+"top: 0px;"+"width: 100%;"+"height: 100%;"+"background-color: "+this.option.backcolor+";"+"z-index: 0;"+"overflow: hidden;");GEEvent.disableDragEventOnIE(this._clipRegion);this._viewContainer=document.createElement('div');this._viewContainer.id=this._ELEMENT_ID_VIEW_CONTAINER+'_'+GEFunctions.getRandomString();GEFunctions.setStyle(this._viewContainer,"position: relative;"+"left: 0px;"+"top: 0px;"+"z-index: 0;");this._clipRegion.appendChild(this._viewContainer);GEEvent.disableDragEventOnIE(this._viewContainer);var controlContainer=document.createElement('div');controlContainer.id=this._ELEMENT_ID_CONTROLL_CONTAINER+'_'+GEFunctions.getRandomString();GEFunctions.setStyle(controlContainer,"position: relative;"+"left: 0px;"+"top: 0px;"+"width: 100%;"+"height: 100%;"+"overflow: hidden;"+"z-index: 1;");this._clipRegion.appendChild(controlContainer);GEEvent.disableDragEventOnIE(controlContainer);this._controlContainer=new GEControlContainer(this,controlContainer);var self_view=this;GEEvent.addListener(window,'resize',function()
{var width=self_view._container.clientWidth;var height=self_view._container.clientHeight;if(width!=self_view._viewSize.width||height!=self_view._viewSize.height)
{self_view._viewSize.width=width;self_view._viewSize.height=height;self_view.onresize();return false;}});}

function GEMathSupport(){}
GEMathSupport.round=function(value,digit){if(!GEValueCheck.isNumber(value))
return value;if(!GEValueCheck.isNumber(digit))
return value;if(digit<0)
return value;var v=Math.round(value*Math.pow(10,digit))/Math.pow(10,digit);return v;}

function GEMatrix()
{this._elements=new Array(2);this._elements[0]=new Array(2);this._elements[1]=new Array(2);this._elements[2]=new Array(2);this.reset();}
GEMatrix.prototype.reset=function()
{this.setMatrix(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0);}
GEMatrix.prototype.setMatrix=function(m00,m01,m02,m10,m11,m12,m20,m21,m22)
{this._elements[0][0]=m00;this._elements[0][1]=m01;this._elements[0][2]=m02;this._elements[1][0]=m10;this._elements[1][1]=m11;this._elements[1][2]=m12;this._elements[2][0]=m20;this._elements[2][1]=m21;this._elements[2][2]=m22;}
GEMatrix.prototype.multiply=function(m)
{var newMatrix=new GEMatrix();for(var i=0;i<3;i++)
{for(var j=0;j<3;j++)
{newMatrix._elements[i][j]=(this._elements[i][0]*m._elements[0][j])+
(this._elements[i][1]*m._elements[1][j])+
(this._elements[i][2]*m._elements[2][j]);}}
this._elements=newMatrix._elements;}
GEMatrix.prototype.translate=function(dx,dy)
{if(!GEValueCheck.isNumber(dx))
dx=0;if(!GEValueCheck.isNumber(dy))
dy=0;var m=new GEMatrix();m.setMatrix(1,0,0,0,1,0,dx,dy,1);this.multiply(m);}
GEMatrix.prototype.scale=function(sx,sy)
{if(!GEValueCheck.isNumber(sx))
sx=0;if(!GEValueCheck.isNumber(sy))
sy=0;var m=new GEMatrix();m.setMatrix(sx,0,0,0,sy,0,0,0,1);this.multiply(m);}
GEMatrix.prototype.rotate=function(rad){if(!GEValueCheck.isNumber(rad))
rad=0;var sin=Math.sin(rad);var cos=Math.cos(rad);var sin_m=sin*-1;var m=new GEMatrix();m.setMatrix(cos,sin,0,sin_m,cos,0,0,0,1);this.multiply(m);}
GEMatrix.prototype.rotateAt=function(p,rad){if(GEValueCheck.isNull(p))
return;if(!GEValueCheck.isNumber(rad))
rad=0;this.translate(p.x*-1,p.y*-1);this.rotate(rad);this.translate(p.x,p.y);}
GEMatrix.prototype.scaleAt=function(p,sx,sy){if(GEValueCheck.isNull(p))
return;if(!GEValueCheck.isNumber(sx))
sx=0;if(!GEValueCheck.isNumber(sy))
sy=0;this.translate(p.x*-1,p.y*-1);this.scale(sx,sy);this.translate(p.x,p.y);}
GEMatrix.prototype.transform=function(p)
{var resultP=new GEPointD();resultP.x=(this._elements[0][0]*p.x)+(this._elements[1][0]*p.y)+this._elements[2][0];resultP.y=(this._elements[0][1]*p.x)+(this._elements[1][1]*p.y)+this._elements[2][1];return resultP;}
GEMatrix.prototype.transformPoints=function(points)
{for(var i=0;i<points.count();i++){points.items[i]=this.transform(points.items[i]);}}
GEMatrix.prototype.dumpOut=function()
{var out='(';for(var i=0;i<3;i++)
{for(var j=0;j<3;j++)
{out+=(this._elements[i][j]+', ');}}
out+=')';GEDebug.write(out,'red');}

function GEMeasure(){}
GEMeasure.lineLength=function(startP,endP){if(GEValueCheck.isNull(startP)||GEValueCheck.isNull(endP))
return 0.0;return Math.sqrt(Math.pow((endP.x-startP.x),2.0)+Math.pow((endP.y-startP.y),2.0));}
GEMeasure.polylineLength=function(points){var length=0.0;if(GEValueCheck.isNull(points)||points.count()<2)
return length;for(var i=0;i<points.count()-1;i++){length+=points.items[i].distanceAt(points.items[i+1]);}
return length;}
GEMeasure.polygonArea=function(points){var area=0.0;if(GEValueCheck.isNull(points)||points.count()<3)
return area;var pts=points.clone();if(!pts.isClosed())
pts.closed();var p1=0;var p2=0;for(var i=0;i<=pts.count()-1;i++){p1=i+1;if(p1>pts.count()-1)
p1=0;p2=i-1;if(p2<0)
p2=pts.count()-1;area+=pts.items[i].x*(pts.items[p1].y-pts.items[p2].y);}
return Math.abs(area)/2;}
GEMeasure.distanceAtLine=function(p,p1,p2){var dx=p2.x-p1.x;var dy=p2.y-p1.y;var a=(dx*dx)+(dy*dy);if(a==0.0)
return Math.sqrt((p1.x-p.x)*(p1.x-p.x)+(p1.y-p.y)*(p1.y-p.y));var b=(dx*(p1.x-p.x))+(dy*(p1.y-p.y));var t=-(b/a);if(t<0.0)
t=0.0;if(t>1.0)
t=1.0;var x=t*dx+p1.x;var y=t*dy+p1.y;return Math.sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));}

﻿
function GEMemoryLayer(view,viewContainer,deleteable,name,index){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this.name=name;this._view=view;this._viewContainer=viewContainer;this._deleteable=GEValueCheck.isNull(deleteable)?false:deleteable;this._index=0;this._geoms=new Array();this._properties=new Array();this._keys=new Array();this._rubberBand=new GERubberBand(this._view,this._viewContainer,this._index);this._hide=false;this._isRender=false;GEGC.add(this);}
GEMemoryLayer.prototype.setIndex=function(index){this._index=index;this._rubberBand.clear();this._rubberBand=new GERubberBand(this._view,this._viewContainer,index);this.render();}
GEMemoryLayer.prototype.render=function(){if(this._view==null)return;this._rubberBand.clear();if(GEValueCheck.isNull(this._geoms)||this._geoms.length==0)
return;if(this._hide)
return;var viewRange=this._view.getRange();for(var i=0;i<this._geoms.length;i++){if(this._geoms[i].hide){continue;}
if(!viewRange.intersects(this._geoms[i].getBoundary())){continue;}
var property=this._properties[i];switch(this._geoms[i].getGeometryType())
{case GEGeometryType.GPoint:if(this._geoms[i].coordinate!=null){var lp=this._view.toLocalPoint(this._geoms[i].coordinate);var ptype=property.getPropertyType();if(ptype==GEPropertyType.Point){this._rubberBand.drawPoint(lp,this._geoms[i].angle.getRadian(),property);}
else if(ptype==GEPropertyType.Text){this._rubberBand.drawText(lp,this._geoms[i].textString,this._geoms[i].angle.getRadian(),property);}
else if(ptype==GEPropertyType.Icon){this._rubberBand.drawIcon(lp,this._geoms[i].angle.getRadian(),property);}}
break;case GEGeometryType.LineString:var localPoints=this._geoms[i].coordinates.clone();if(localPoints!=null&&localPoints.count()>0){for(var j=0;j<localPoints.count();j++){localPoints.items[j]=this._view.toLocalPoint(localPoints.items[j]);}
this._rubberBand.drawLines(localPoints,property);}
break;case GEGeometryType.Polygon:var localPoints=this._geoms[i].shell.clone();if(localPoints!=null&&localPoints.count()>0){for(var j=0;j<localPoints.count();j++){localPoints.items[j]=this._view.toLocalPoint(localPoints.items[j]);}
this._rubberBand.drawPolygon(localPoints,property);}
break;case GEGeometryType.Ellipse:if(this._geoms[i].center!=null){var center=this._view.toLocalPoint(this._geoms[i].center);var radius=this._view.toLocalSize(new GESizeD(this._geoms[i].xAxis,this._geoms[i].yAxis));this._rubberBand.drawEllipse(center,radius.width,radius.height,this._geoms[i].angle.getRadian(),property);}
break;}
if(this._geoms[i].feature!=null&&this._geoms[i].feature.labelString!=null&&this._geoms[i].feature.labelString.length>0){var centroid=this._geoms[i].getCentroid();var p=this._view.toLocalPoint(centroid);this._rubberBand.drawText(p,this._geoms[i].feature.labelString,0,new GETextProperty());}}}
GEMemoryLayer.prototype.count=function(){if(this._view==null)return 0;if(GEValueCheck.isNull(this._geoms))
return 0;else
return this._geoms.length;}
GEMemoryLayer.prototype.add=function(geometry,property,key,render){if(this._view==null)return;if(GEValueCheck.isNull(geometry))
return;if(GEValueCheck.isNull(property))
property=null;if(GEValueCheck.isNull(key))
key='';if(GEValueCheck.isNull(render))
render=true;this._geoms.push(geometry);this._properties.push(property);this._keys.push(key);if(GEValueCheck.isNull(render)||render==true)
this.render();}
GEMemoryLayer.prototype.remove=function(geom){if(GEValueCheck.isNull(geom))
return;if(this._geoms==null||this._geoms.length==0)
return;var geometries=new Array();var properties=new Array();var keys=new Array();for(var i=0;i<this._geoms.length;i++){geometries.push(this._geoms[i]);properties.push(this._properties[i]);keys.push(this._keys[i]);}
this._geoms.length=0;this._properties.length=0;this._keys.length=0;for(var i=0;i<geometries.length;i++){if(geometries[i]==geom)
continue;this._geoms.push(geometries[i]);this._properties.push(properties[i]);this._keys.push(keys[i]);}
this.render();}
GEMemoryLayer.prototype.removeKey=function(key){if(this._view==null)return;if(GEValueCheck.isNull(key))
return;if(this._geoms==null||this._geoms.length==0)
return;var geometries=new Array();var properties=new Array();var keys=new Array();for(var i=0;i<this._geoms.length;i++){geometries.push(this._geoms[i]);properties.push(this._properties[i]);keys.push(this._keys[i]);}
this._geoms.length=0;this._properties.length=0;this._keys.length=0;for(var i=0;i<geometries.length;i++){if(keys[i]==key)
continue;this._geoms.push(geometries[i]);this._properties.push(properties[i]);this._keys.push(keys[i]);}
this.render();}
GEMemoryLayer.prototype.clear=function(){if(this._view==null)return;this._rubberBand.clear();this._geoms.length=0;this._properties.length=0;this._keys.length=0;}
GEMemoryLayer.prototype.dispose=function(){if(this._view==null)
return;this._rubberBand.clear();this._geoms.length=0;this._properties.length=0;this._keys.length=0;if(!GEValueCheck.isNull(this._event_onrangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._event_onrangechanged);this._view._removeMemoryLayer(this);this._view=null;this._viewContainer=null;}
GEMemoryLayer.prototype.hide=function(){if(this._view==null)return;if(this._geoms!=null&&this._geoms.length>0){for(var i=0;i<this._geoms.length;i++){this._geoms[i].hide=true;}}
this._hide=true;this.render();}
GEMemoryLayer.prototype.show=function(){if(this._view==null)return;if(this._geoms!=null&&this._geoms.length>0){for(var i=0;i<this._geoms.length;i++){this._geoms[i].hide=false;}}
this._hide=false;this.render();}
GEMemoryLayer.prototype.getKey=function(geom){if(GEValueCheck.isNull(geom))
return null;if(this._geoms==null||this._geoms.length==0)
return null;for(var i=0;i<this._geoms.length;i++){if(this._geoms[i]!=geom)
continue;return this._keys[i];}
return null;}
GEMemoryLayer.prototype.getProperty=function(geom){if(GEValueCheck.isNull(geom))
return null;if(this._geoms==null||this._geoms.length==0)
return null;for(var i=0;i<this._geoms.length;i++){if(this._geoms[i]!=geom)
continue;return this._properties[i];}
return null;}
GEMemoryLayer.prototype.searchKey=function(key){var result=new Array();if(this._geoms==null||this._geoms.length==0)
return result;if(GEValueCheck.isNull(key))
key='';for(var i=0;i<this._geoms.length;i++){if(this._keys[i]!=key)
continue;result.push(this._geoms[i]);}
return result;}
GEMemoryLayer.prototype.searchHit=function(p,tol,key){var result=new Array();if(this._view==null)
return result;if(GEValueCheck.isNull(p))
return result;if(this._geoms==null||this._geoms.length==0)
return result;if(!GEValueCheck.isNumber(tol))
tol=5;var wp=this._view.toWorldPoint(p);var wtol=this._view.toWorldSize(new GESizeD(tol,tol));for(var i=0;i<this._geoms.length;i++){if(!GEValueCheck.isNull(key)&&this._keys[i]!=key)
continue;if(this._geoms[i].hide)continue;var geom=this._geoms[i];var property=this._properties[i];var mbr=geom.getBoundary();mbr.inflate(wtol.width*2,wtol.height*2);switch(geom.getGeometryType())
{case GEGeometryType.GPoint:var lp=this._view.toLocalPoint(this._geoms[i].coordinate);var isHit=false;var ptype=property.getPropertyType();if(ptype==GEPropertyType.Point){isHit=this._rubberBand.hitTestPoint(p,lp,this._geoms[i].angle.getRadian(),property);}
else if(ptype==GEPropertyType.Text){isHit=this._rubberBand.hitTestText(p,lp,this._geoms[i].textString,this._geoms[i].angle.getRadian(),property);}
else if(ptype==GEPropertyType.Icon){isHit=this._rubberBand.hitTestIcon(p,lp,this._geoms[i].angle.getRadian(),property);}
else{isHit=false;}
if(isHit){result.push(geom);}
break;case GEGeometryType.Polygon:if(!mbr.contains(wp))continue;if(GESpatials.pointIn(wp,geom.shell))
result.push(geom);break;case GEGeometryType.LineString:if(!mbr.contains(wp))continue;var dist=geom.getNearestDistance(wp);if(dist<=wtol.width)
result.push(geom);break;case GEGeometryType.Ellipse:if(!mbr.contains(wp))continue;if(geom.getBoundary().contains(wp))
result.push(geom);break;}}
return result;}
GEMemoryLayer.prototype.searchContains=function(rect,key){var result=new Array();if(this._view==null)
return result;if(GEValueCheck.isNull(rect))
return result;if(this._geoms==null||this._geoms.length==0)
return result;var pts=new GEPointDList();pts.add(this._view.toWorldPoint(rect.min));pts.add(this._view.toWorldPoint(rect.max));var wRect=GERectangleD.fromPoints(pts);for(var i=0;i<this._geoms.length;i++){if(!GEValueCheck.isNull(key)&&this._keys[i]!=key)
continue;if(this._geoms[i].hide)continue;var geom=this._geoms[i];var property=this._properties[i];var mbr=geom.getBoundary();switch(geom.getGeometryType())
{case GEGeometryType.GPoint:break;case GEGeometryType.Polygon:case GEGeometryType.LineString:case GEGeometryType.Ellipse:if(wRect.containsR(mbr)){result.push(geom);}
break;}}
return result;}
GEMemoryLayer.prototype.save=function(){if(this._view==null)
return"";if(GEValueCheck.isNull(this._geoms)||this._geoms.length==0||GEValueCheck.isNull(this._properties)||this._properties.length==0)
return"";var result=new GEStringBuilder();result.append('{');result.append('index:');result.append(this._index.toString());result.append(',');result.append('geometries:');result.append('[');for(var i=0;i<this._geoms.length;i++){result.append(this._geoms[i].toJSON());if(i<this._geoms.length-1)
result.append(',');}
result.append(']');result.append(',');result.append('properties:');result.append('[');for(var i=0;i<this._properties.length;i++){result.append(this._properties[i].toJSON());if(i<this._properties.length-1)
result.append(',');}
result.append(']');result.append('}');return result.toString();}
GEMemoryLayer.prototype.load=function(data){if(data==null||data.length==0||this._view==null)
return;this.clear();var obj=eval('('+data+')');if(GEValueCheck.isNull(obj)){return;}
if(!GEValueCheck.isNull(obj.index)){this.setIndex(Number(obj.index));}
if(!GEValueCheck.isNull(obj.geometries)){for(var i=0;i<obj.geometries.length;i++){this._geoms.push(GEGeometry.fromJSON(obj.geometries[i]));}}
if(!GEValueCheck.isNull(obj.properties)){for(var i=0;i<obj.properties.length;i++){this._properties.push(GEDrawProperty.fromJSON(obj.properties[i]));}}
for(var i=0;i<obj.geometries.length;i++){this._keys.push('');}}

function GEModifyGeometry(geom,property){if(GEValueCheck.isNull(geom))
GEError.argument("geom");this.geometry=geom;this.geomType=geom.getGeometryType();this._property=property;this._view=null;this._container=null;this._active=false;this._memoryLayer=null;this._VERTEX_KEY="_VERTEX_";this._modifyMenu=new GEModifyMenu();this._torelance=10;this.enableSnap=false;this.snapController=new GESnapController();this.vertexProperty=new GEPointProperty();this.vertexProperty.outlineColor=new GEColor(0,0,0);this.vertexProperty.fillColor=new GEColor(255,255,255);this.vertexProperty.pointType=GEPointType.SolidSquare;this.vertexProperty.pointSize=10;this.editingGeom=null;if(this._property==null)
{if(geom.feature!=null&&geom.feature.layer!=null)
this._property=geom.feature.layer.property;}}
GEModifyGeometry.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._active=true;this._view=view;this._container=view.getContainer();this._isStart=true;var self=this;this.editingGeom=this.geometry.clone();var modified=false;var points=this.editingGeom.getCoordinates();var op_terminate=false;var keyCode=null;var mouseOnGeom=true;var dragVertex=-1;var dragSegment=-1;var dragStartP=null;var clickP=null;var backLocalP=null;var currentP=null;var modifyMode="";this._memoryLayer=self._view.createMemoryLayer("_MODIFY_GEOMETRY_");this._memoryLayer.setIndex(GEFunctions.getMaxIndex());this.geometry.hide=true;this._memoryLayer.add(this.editingGeom,this._property);this._showVertex(points);this._view.getMemoryLayer().render();var layers=this._view.getMemoryLayers();if(layers!=null&&layers.length>0){for(var i=0;i<layers.length;i++){layers[i].render();}}
this._view.disablePanning();this._view.disableDragging();this._view.changeCursor(GECursor.Move);var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(GEEvent.isCtrlKey(event)&&keyCode==90&&modified)
{self.editingGeom.setCoordinates(self.geometry.getCoordinates());modified=false;self.terminate(false);self._view.beginOperation(self);}
else if(GEEvent.isCtrlKey(event)&&keyCode==13&&modified)
{var ret=self.checkPolygon(points);if(ret)
{self.geometry.setCoordinates(points);op_terminate=true;self.modifyComplete(self.geometry);self.terminate(true,self.geometry);}
else
{self.editingGeom.setCoordinates(self.geometry.getCoordinates());modified=false;self.terminate(false);self._view.beginOperation(self);}}
else if(keyCode==46)
{var removeVertex=-1;for(var i=0;i<points.count();i++){var geomLocalP=self._view.toLocalPoint(points.items[i]);if(Math.abs(currentP.distanceAt(geomLocalP))<self._torelance){removeVertex=i;break;}}
if(self.geomType==GEGeometryType.LineString){if(points.count()<3){removeVertex=-1;}}
else if(self.geomType==GEGeometryType.Polygon){if(points.count()<5){removeVertex=-1;}}
else{removeVertex=-1;}
if(removeVertex!=-1){if((self.geomType==GEGeometryType.Polygon||self.geomType==GEGeometryType.Ellipse)&&(removeVertex==0||removeVertex==points.count()-1))
{points.removeAt(points.count()-1);points.removeAt(0);points.closed();}
else{points.removeAt(removeVertex);}
self.editingGeom.setCoordinates(points);modified=true;self._showVertex(points);}}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){keyCode=null;});this._contextmenu=GEEvent.addListener(document,'contextmenu',function(){return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;dragStartP=null;clickP=null;var localP=self._view.getLocalPoint(mouseEvent);localP.round(3);clickP=localP.clone();self._modifyMenu.close();if(GEEvent.isLeftButton(mouseEvent)&&mouseOnGeom){dragStartP=localP.clone();}
else if(GEEvent.isRightButton(mouseEvent)&&mouseOnGeom){var clickVertex=-1;for(var i=0;i<points.count();i++){var geomLocalP=self._view.toLocalPoint(points.items[i]);if(Math.abs(localP.distanceAt(geomLocalP))<self._torelance){clickVertex=i;break;}}
var removevertex=GEEvent.addListener(self._modifyMenu,"removevertex",function(args){if(!GEValueCheck.isNull(self._index)){self._index=args;}
if((self.geomType==GEGeometryType.Polygon||self.geomType==GEGeometryType.Ellipse)&&(args.index==0||args.index==points.count()-1))
{points.removeAt(points.count()-1);points.removeAt(0);points.closed();}
else{points.removeAt(args.index);}
self.editingGeom.setCoordinates(points);modified=true;self._showVertex(points);GEEvent.removeListener(self._modifyMenu,"removevertex",removevertex);GEEvent.removeListener(self._modifyMenu,"modifysubmit",modifysubmit);GEEvent.removeListener(self._modifyMenu,"modifyreset",modifyreset);GEEvent.removeListener(self._modifyMenu,"modifycancel",modifycancel);});var modifysubmit=GEEvent.addListener(self._modifyMenu,"modifysubmit",function(args){var ret=self.checkPolygon(points);if(ret)
{self.geometry.setCoordinates(points);op_terminate=true;self.modifyComplete(self.geometry);self.terminate(true,self.geometry);}
else
{self.editingGeom.setCoordinates(self.geometry.getCoordinates());modified=false;self.terminate(false);self._view.beginOperation(self);}});var modifyreset=GEEvent.addListener(self._modifyMenu,"modifyreset",function(){self.editingGeom.setCoordinates(self.geometry.getCoordinates());modified=false;GEEvent.removeListener(self._modifyMenu,"removevertex",removevertex);GEEvent.removeListener(self._modifyMenu,"modifysubmit",modifysubmit);GEEvent.removeListener(self._modifyMenu,"modifyreset",modifyreset);GEEvent.removeListener(self._modifyMenu,"modifycancel",modifycancel);self.terminate(false);self._view.beginOperation(self);});var modifycancel=GEEvent.addListener(self._modifyMenu,"modifycancel",function(){self.terminate(true,null);});self._modifyMenu.open(self._view,localP,self.editingGeom,clickVertex);}
e_mousedown=false;return false;});var e_mousemove=false;this._mousemove=GEEvent.addListener(this._container,'mousemove',function(mouseEvent){if(op_terminate)return false;if(e_mousemove)return false;e_mousemove=true;var localP=self._view.getLocalPoint(mouseEvent);localP.round(3);currentP=localP;if(backLocalP!=null&&localP.equals(backLocalP)){e_mousemove=false;return false;}
backLocalP=localP;if(dragStartP==null){mouseOnGeom=false;modifyMode="";dragSegment=-1;dragVertex=-1;var wp=self._view.toWorldPoint(localP);var worldTolerance=self._view.toWorldSize(new GESizeD(self._torelance,self._torelance)).width;if(self.geomType!=GEGeometryType.GPoint)
{for(var i=0;i<points.count();i++)
{if(wp.distanceAt(points.items[i])<=worldTolerance)
{modifyMode="mv";dragVertex=i;mouseOnGeom=true;if(self._view._defaultOp._enableDragging)
self._view._defaultOp._enableDragging=false;self._view.changeCursor(GECursor.Resize);e_mousemove=false;return false;}}}else{if(points.count()>0&&wp.distanceAt(points.items[0])<=worldTolerance)
{modifyMode="mv";dragVertex=0;mouseOnGeom=true;if(self._view._defaultOp._enableDragging)
self._view._defaultOp._enableDragging=false;self._view.changeCursor(GECursor.Move);e_mousemove=false;return false;}}
if(self.geomType==GEGeometryType.Polygon||self.geomType==GEGeometryType.LineString){for(var i=0;i<points.count()-1;i++)
{if(GEMeasure.distanceAtLine(wp,points.items[i],points.items[i+1])<worldTolerance)
{modifyMode="ms";dragSegment=i;mouseOnGeom=true;if(self._view._defaultOp._enableDragging)
self._view._defaultOp._enableDragging=false;self._view.changeCursor(GECursor.Resize);e_mousemove=false;return false;}}}
if(self.geomType==GEGeometryType.Polygon||self.geomType==GEGeometryType.Ellipse){var w=self._view.toWorldPoint(localP);w.round(5);if(GESpatials.pointIn(w,points)){modifyMode="mg";mouseOnGeom=true;if(self._view._defaultOp._enableDragging)
self._view._defaultOp._enableDragging=false;self._view.changeCursor(GECursor.Move);e_mousemove=false;return false;}}
self._view.changeCursor(GECursor.Grab);self._view.enableDragging();}
else{if(self._memoryLayer.count()>1){self._memoryLayer.removeKey(self._VERTEX_KEY);}
if(modifyMode=="mv"&&dragVertex!=-1){var p=self._view.toWorldPoint(localP);if(self.geomType!=GEGeometryType.Ellipse)
p=self.replacePointInternal(p,dragVertex,keyCode);else
p=self.replacePointInternal(p,keyCode);if(p!=null)
{if(self.geomType!=GEGeometryType.Ellipse)
{points.items[dragVertex]=p;points.items[dragVertex].round(5);if(self.geomType==GEGeometryType.Polygon){if(dragVertex==0){points.items[points.count()-1]=points.items[0].clone();}
if(dragVertex==points.count()-1){points.items[0]=points.items[points.count()-1].clone();}}}
else
{var p2=self._view.toWorldPoint(dragStartP);dragStartP=localP;if(!self.editingGeom.angle.isZero())
{var rMatrix=new GEMatrix();rMatrix.rotateAt(self.editingGeom.center,-self.editingGeom.angle.getRadian());p=rMatrix.transform(p);p2=rMatrix.transform(p2);rMatrix.transformPoints(points);}
var dx=(p.x-self.editingGeom.center.x)/(p2.x-self.editingGeom.center.x);var dy=(p.y-self.editingGeom.center.y)/(p2.y-self.editingGeom.center.y);var trans=new GEMatrix();trans.scaleAt(self.editingGeom.center.clone(),dx,dy);trans.transformPoints(points);if(!self.editingGeom.angle.isZero())
{var rMatrix=new GEMatrix();rMatrix.rotateAt(self.editingGeom.center,self.editingGeom.angle.getRadian());rMatrix.transformPoints(points);}}
modified=true;}}
else if(modifyMode=="ms"&&dragSegment!=-1){var p1=self._view.toWorldPoint(localP);var p2=self._view.toWorldPoint(dragStartP);dragStartP=localP;var offsetX=p1.x-p2.x;var offsetY=p1.y-p2.y;for(var i=0;i<2;i++){points.items[dragSegment+i].x+=offsetX;points.items[dragSegment+i].y+=offsetY;points.items[dragSegment+i].round(5);}
if(self.geomType==GEGeometryType.Polygon||self.geomType==GEGeometryType.Ellipse){if(dragSegment==0){points.items[points.count()-1]=points.items[0].clone();}
if(dragSegment==points.count()-2){points.items[0]=points.items[points.count()-1].clone();}}
modified=true;}
else if(modifyMode=="mg"){var p1=self._view.toWorldPoint(localP);var p2=self._view.toWorldPoint(dragStartP);dragStartP=localP;var offsetX=p1.x-p2.x;var offsetY=p1.y-p2.y;for(var i=0;i<points.count();i++){points.items[i].x+=offsetX;points.items[i].y+=offsetY;points.items[i].round(5);}
modified=true;}
else{e_mousemove=false;return false;}
self.editingGeom.setCoordinates(points);self._memoryLayer.render();}
e_mousemove=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(this._container,'mouseup',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;var localP=self._view.getLocalPoint(mouseEvent);localP.round(3);if(!mouseOnGeom&&dragStartP==null&&localP.equals(clickP))
{op_terminate=true;if(GEEvent.isLeftButton(mouseEvent)&&modified)
{var ret=self.checkPolygon(points);if(ret)
{self.geometry.setCoordinates(points);op_terminate=true;self.modifyComplete(self.geometry);self.terminate(true,self.geometry);}
else
{self.editingGeom.setCoordinates(self.geometry.getCoordinates());modified=false;self.terminate(false);self._view.beginOperation(self);}}
else
{self.terminate(true,self.geometry);}}
else
{if(GEEvent.isLeftButton(mouseEvent)&&clickP!=null&&dragSegment!=-1&&localP.equals(clickP)){var p=self._view.toWorldPoint(localP);points.insert(dragSegment,p.clone());self.editingGeom.setCoordinates(points);modified=true;}
dragStartP=null;clickP=null;self._showVertex(points);}
e_mouseup=false;return false;});}
GEModifyGeometry.prototype._showVertex=function(points)
{this._memoryLayer.hide();this._memoryLayer.removeKey(this._VERTEX_KEY);for(var i=0;i<points.count();i++){this._memoryLayer.add(new GEGPoint(points.items[i]),this.vertexProperty,this._VERTEX_KEY);}
this._memoryLayer.show();}
GEModifyGeometry.prototype.checkPolygon=function(points)
{if(this.geomType!=GEGeometryType.Polygon)
return true;var direct=GESpatials.polygonDirection(points);if(direct<0)
alert("図形がねじれているか不正な形状です。");return direct>=0;}
GEModifyGeometry.prototype.replacePointInternal=function(p,vIndex,keycode)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var sp=this.snapController.execute(this._view,p,true,null,this.editingGeom,vIndex);if(sp.equals(p))
return null;else
p=sp;}
return this.replacePoint(p,vIndex,keycode);}
GEModifyGeometry.prototype.replacePoint=function(p,vIndex,keycode)
{return p;}
GEModifyGeometry.prototype.modifyComplete=function(geom){}
GEModifyGeometry.prototype.end=function(geom){}
GEModifyGeometry.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GEModifyGeometry.prototype.terminate=function(dispatch,geom){if(!this._active)return;if(!GEValueCheck.isNull(this._modifyMenu))
this._modifyMenu.close();this._memoryLayer.dispose();this.editingGeom=null;this.geometry.hide=false;if(!GEValueCheck.isNull(this._view)){this._view.enableDragging();this._view.getMemoryLayer().render();var layers=this._view.getMemoryLayers();if(layers!=null&&layers.length>0){for(var i=0;i<layers.length;i++){layers[i].render();}}}
if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(document,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(this._container,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(this._container,"mouseup",this._mouseup);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._active=false;if(dispatch)this.end(geom);}

function GEModifyMenu(){this._body=null;this._container=null;this._id="__ModifyMenu";}
GEModifyMenu.prototype.open=function(view,localP,geom,index){if(GEValueCheck.isNull(localP))
GEError.argument("localP");if(GEValueCheck.isNull(geom))
GEError.argument("geom");GEEvent.dispatch(this,"menuopen",new GEEventArgs());var element=document.getElementById(this._id);var id=this._id;if(this.isOpened()){element.parentNode.removeChild(element);}
var self=this;var bodyElement=document.createElement("div");bodyElement.style.padding=GEFunctions.createPx(2);bodyElement.style.zIndex=10000;var mnuModifySep=document.createElement("hr");mnuModifySep.id="mnuModifySep";GEFunctions.setStyle(mnuModifySep,"margin: "+GEFunctions.createPx(0)+"; "+"padding: "+GEFunctions.createPx(0)+"; "+"width: 100%; "+"border-style: solid; "+"border-width: "+GEFunctions.createPx(1)+"; "+"border-color: darkgray;");var mnuRemoveVertex=document.createElement("div");mnuRemoveVertex.id="mnuRemoveVertex";var imgRemoveVertex=document.createElement("img");imgRemoveVertex.src=GEAJAX.path+"/resources/modify_remove.gif";mnuRemoveVertex.appendChild(imgRemoveVertex);var txtRemoveVertex=document.createTextNode(" 頂点を削除　(Delete)");mnuRemoveVertex.appendChild(txtRemoveVertex);if(GEValueCheck.isNumber(index)&&index>=0&&geom.getGeometryType()!=GEGeometryType.GPoint){var coordinates=geom.getCoordinates();if(geom.getGeometryType()==GEGeometryType.LineString){if(coordinates.count()>=3){this._ableMenu(mnuRemoveVertex);this._removeVertex=GEEvent.addListener(mnuRemoveVertex,"click",function(){var args=new GEEventArgs();args.index=index;GEEvent.dispatch(self,"removevertex",args);self.close();});}
else{this._disableMenu(mnuRemoveVertex);}}
else if(geom.getGeometryType()==GEGeometryType.Polygon){if(coordinates.count()>=5){this._ableMenu(mnuRemoveVertex);this._removeVertex=GEEvent.addListener(mnuRemoveVertex,"click",function(){var args=new GEEventArgs();args.index=index;GEEvent.dispatch(self,"removevertex",args);self.close();});}
else{this._disableMenu(mnuRemoveVertex);}}
else{this._disableMenu(mnuRemoveVertex);}}
else{this._disableMenu(mnuRemoveVertex);}
bodyElement.appendChild(mnuRemoveVertex);bodyElement.appendChild(mnuModifySep.cloneNode(false));var mnuModifySubmit=document.createElement("div");mnuModifySubmit.id="mnuModifySubmit";var imgModifySubmit=document.createElement("img");imgModifySubmit.src=GEAJAX.path+"/resources/modify_submit.gif";mnuModifySubmit.appendChild(imgModifySubmit);var txtModifySubmit=document.createTextNode(" 確定　　　　　(Ctrl+Enter)");mnuModifySubmit.appendChild(txtModifySubmit);this._ableMenu(mnuModifySubmit);this._modifySubmit=GEEvent.addListener(mnuModifySubmit,"click",function(){var args=new GEEventArgs();args.geom=geom;GEEvent.dispatch(self,"modifysubmit",args);self.close();});bodyElement.appendChild(mnuModifySubmit);var mnuModifyReset=document.createElement("div");mnuModifyReset.id="mnuModifyReset";var imgModifyReset=document.createElement("img");imgModifyReset.src=GEAJAX.path+"/resources/modify_reset.gif";mnuModifyReset.appendChild(imgModifyReset);var txtModifyReset=document.createTextNode(" 元に戻す　　(Ctrl+Z)");mnuModifyReset.appendChild(txtModifyReset);this._ableMenu(mnuModifyReset);this._modifyReset=GEEvent.addListener(mnuModifyReset,"click",function(){var args=new GEEventArgs();GEEvent.dispatch(self,"modifyreset",args);self.close();});bodyElement.appendChild(mnuModifyReset);bodyElement.appendChild(mnuModifySep.cloneNode(false));var mnuModifyCancel=document.createElement("div");mnuModifyCancel.id="mnuModifyCancel";var imgModifyCancel=document.createElement("img");imgModifyCancel.src=GEAJAX.path+"/resources/modify_cancel.gif";mnuModifyCancel.appendChild(imgModifyCancel);var txtModifyCancel=document.createTextNode(" キャンセル　(Esc)");mnuModifyCancel.appendChild(txtModifyCancel);this._ableMenu(mnuModifyCancel);this._modifyCancel=GEEvent.addListener(mnuModifyCancel,"click",function(){var args=new GEEventArgs();GEEvent.dispatch(self,"modifycancel",args);self.close();});bodyElement.appendChild(mnuModifyCancel);var documentOffset=view.getContainerOffset();this._container=document.createElement("div");this._container.id=this._id;this._container.style.position="absolute";this._container.style.left=GEFunctions.createPx(localP.x+documentOffset.width+3);this._container.style.top=GEFunctions.createPx(localP.y+documentOffset.height+3);this._container.style.width=GEFunctions.createPx(160);this._container.style.backgroundColor="#FFFFFF";this._container.style.visibility="visible";this._container.style.zIndex=10000;this._body=document.createElement("div");this._body.style.left=GEFunctions.createPx(0);this._body.style.top=GEFunctions.createPx(0);this._body.style.width="100%";this._body.style.height="100%";this._body.style.backgroundColor="#FFFFFF";this._body.style.color="#000000";this._body.style.overflow="auto";this._body.style.fontSize=GEFunctions.createPx(12);this._body.style.border="1px solid black";this._body.style.zIndex=10000;this._body.appendChild(bodyElement);this._container.appendChild(this._body);this._containerContextMenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){GEEvent.stopEvent(mouseEvent);return false;});this._bodyContextMenu=GEEvent.addListener(this._body,'contextmenu',function(mouseEvent){GEEvent.stopEvent(mouseEvent);return false;});document.body.appendChild(this._container);}
GEModifyMenu.prototype.isOpened=function(){return document.getElementById(this._id)!=null;}
GEModifyMenu.prototype.close=function(){var element=document.getElementById(this._id);if(element)
element.parentNode.removeChild(element);GEEvent.dispatch(this,"menuclose",new GEEventArgs());}
GEModifyMenu.prototype._ableMenu=function(element){var mouseoverColor="#EEEEFF";var mouseoutColor="#FFFFFF";GEFunctions.setStyle(element,"margin: "+GEFunctions.createPx(5)+"; "+"cursor: pointer; ");GEEvent.addListener(element,"mouseover",function(){element.style.backgroundColor=mouseoverColor;});GEEvent.addListener(element,"mouseout",function(){element.style.backgroundColor=mouseoutColor;});}
GEModifyMenu.prototype._disableMenu=function(element){var disableColor="#888888";GEFunctions.setStyle(element,"margin: "+GEFunctions.createPx(5)+"; "+"color: "+disableColor+"; "+"cursor: default; ");}

﻿
function GEMultiSelectGeometry(property){this.searchMode=GESearchMode.Memory;this.memoryLayer=null;this.memorySearchKey=null;this.layerList=new Array();this.singleSelection=false;var defaultProperty=new GEPolygonProperty();defaultProperty.linePattern=GELinePattern.Dot;defaultProperty.lineWidth=2;this.property=GEValueCheck.isNull(property)?defaultProperty:property;this._procOp=null;this._view=null;this._container=null;this._active=false;this.rubberBand=null;}
GEMultiSelectGeometry.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._active=true;this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._view.disableDragging();this._view.disablePanning();var self=this;var op_terminate=false;var hiliteRender=new GEHiliteRender(this._view);var geoms=null;var props=null;var activeGeoms=null;var activeProps=null;this._procOp=new GETrackRectangle(this.property);this._procOp.start(view,viewContainer);this._view.changeCursor(GECursor.Pointer);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;self.rubberBand.clear();if(activeGeoms!=null&&activeGeoms.length>0){for(var i=0;i<activeGeoms.length;i++){hiliteRender.render(self.rubberBand,activeGeoms[i],activeProps[i]);}}});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});this._procOp.end=function(rectPoly){if(op_terminate)return false;if(rectPoly==null)return false;geoms=new Array();props=new Array();activeGeoms=new Array();activeProps=new Array();var wRect=rectPoly.getBoundary();var pts=new GEPointDList();pts.add(self._view.toLocalPoint(wRect.min));pts.add(self._view.toLocalPoint(wRect.max));var lRect=GERectangleD.fromPoints(pts);if((self.searchMode==GESearchMode.Server||self.searchMode==GESearchMode.Both)&&self.layerList.length>0)
{var expression=new GEFeatureExpression();expression.spatial=GESpatialCondition.fromPolygon(rectPoly,GESpatialRelation.Contains);for(var i=0;i<self.layerList.length;i++){var targetLayer=self.layerList[i];var result=targetLayer.queryFeature(expression);if(result==null)continue;for(var j=0;j<result.length;j++){if(result[j].geometry!=null){geoms.push(result[j].geometry);props.push(targetLayer.property);}}}
if(self.searchMode==GESearchMode.Memory||self.searchMode==GESearchMode.Both)
{var mLayer=self.memoryLayer;if(mLayer==null)
mLayer=self._view.getMemoryLayer();var m_geoms=null;if(self.memorySearchKey!=null)
{m_geoms=mLayer.searchContains(lRect,self.memorySearchKey);}
else
{m_geoms=mLayer.searchHit(lRect);}
if(!GEValueCheck.isNull(m_geoms)&&m_geoms.length>0)
{for(var j=0;j<m_geoms.length;j++)
{geoms.push(m_geoms[j]);props.push(mLayer.getProperty(m_geoms[j]));}}}
self._trySelections(geoms,props,hiliteRender,self.rubberBand,activeGeoms,activeProps);if(selectedGeoms!=null&&selectedGeoms.length>0)
{if(self.singleSelection){op_terminate=true;self.selected(activeGeoms);self.terminate(true,activeGeoms);return;}}
else
{op_terminate=true;self.terminate(false);self._view.beginOperation(self);}}
else if(self.searchMode==GESearchMode.Memory||self.searchMode==GESearchMode.Both)
{var mLayer=self.memoryLayer;if(mLayer==null)
mLayer=self._view.getMemoryLayer();var m_geoms=null;if(self.memorySearchKey!=null)
{m_geoms=mLayer.searchContains(lRect,self.memorySearchKey);}
else
{m_geoms=mLayer.searchContains(lRect);}
if(!GEValueCheck.isNull(m_geoms)&&m_geoms.length>0)
{for(var i=0;i<m_geoms.length;i++)
{geoms.push(m_geoms[i]);props.push(mLayer.getProperty(m_geoms[i]));}}
self._trySelections(geoms,props,hiliteRender,self.rubberBand,activeGeoms,activeProps);if(activeGeoms!=null&&activeGeoms.length>0)
{if(self.singleSelection){op_terminate=true;self.selected(activeGeoms);self.terminate(true,activeGeoms);}}
else
{op_terminate=true;self.terminate(false);self._view.beginOperation(self);}}}
var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;GEEvent.stopEvent(mouseEvent);if(GEEvent.isLeftButton(mouseEvent)&&!GEValueCheck.isNull(activeGeoms)&&activeGeoms.length>0)
{op_terminate=true;self.selected(activeGeoms);self.terminate(true,activeGeoms);}
else if(GEEvent.isRightButton(mouseEvent)){if(GEValueCheck.isNull(activeGeoms)||activeGeoms.length==0){op_terminate=true;self.terminate(true,null);}
else
{op_terminate=true;self.terminate(false);self._view.beginOperation(self);}}
e_mousedown=false;return false;});}
GEMultiSelectGeometry.prototype._trySelections=function(geoms,props,hiliteRender,rubberBand,activeGeoms,activeProps){rubberBand.clear();if(!GEValueCheck.isNull(geoms)&&geoms.length>0){for(var i=0;i<geoms.length;i++){if(this.validate(geoms[i])){hiliteRender.render(rubberBand,geoms[i],props[i]);activeGeoms.push(geoms[i]);activeProps.push(props[i]);}}}}
GEMultiSelectGeometry.prototype.validate=function(geom){return true;}
GEMultiSelectGeometry.prototype.selected=function(geoms){}
GEMultiSelectGeometry.prototype.end=function(geoms){}
GEMultiSelectGeometry.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GEMultiSelectGeometry.prototype.terminate=function(dispatch,geoms){if(!this._active)return;if(this._procOp!=null)
{this._procOp.kill();this._procOp=null;}
this.rubberBand.dispose();this._view.enableDragging();this._view.enablePanning();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);this._active=false;if(dispatch)this.end(geoms);}

function GENumberCondition(){this._value="";}
GENumberCondition.equals=function(value){var condition=new GENumberCondition();condition._value=!GEValueCheck.isNumber(value)?"":value.toString();return condition;}
GENumberCondition.or=function(value){var condition=new GENumberCondition();if(GEValueCheck.isNull(value)||value.length==0)
return condition;var string=new GEStringBuilder();for(var i=0;i<value.length;i++){if(!GEValueCheck.isNumber(value[i])){break;}
if(string.length>0)string.append(",");string.append(value[i].toString());}
condition._value=string.toString();return condition;}
GENumberCondition.greaterThan=function(value){var condition=new GENumberCondition();condition._value=!GEValueCheck.isNumber(value)?"":value.toString()+"<";return condition;}
GENumberCondition.lessThan=function(value){var condition=new GENumberCondition();condition._value=!GEValueCheck.isNumber(value)?"":"<"+value.toString();return condition;}
GENumberCondition.greaterThanEquals=function(value){var condition=new GENumberCondition();condition._value=!GEValueCheck.isNumber(value)?"":value.toString()+"<=";return condition;}
GENumberCondition.lessThanEquals=function(value){var condition=new GENumberCondition();condition._value=!GEValueCheck.isNumber(value)?"":"<="+value.toString();return condition;}
GENumberCondition.range=function(v1,v2){var condition=new GENumberCondition();if(!GEValueCheck.isNumber(v1)||!GEValueCheck.isNumber(v2))
return condition;condition._value=v1.toString()+"<="+v2.toString();return condition;}
GENumberCondition.prototype.toResponseText=function(){return!GEValueCheck.isString(this._value)?"":escape(this._value);}

﻿
function GEOperationController(view,viewContainer){this._view=view;this._viewContainer=viewContainer;this._defOp=null;this._lastOp=null;}
GEOperationController.prototype.beginDefault=function(defOp)
{if(!defOp||!defOp.start){return;}
defOp.start(this._view,this._viewContainer);}
GEOperationController.prototype.terminateDefault=function()
{if(this._defOp!=null&&this._defOp._active)
{this._defOp.kill();this._defOp=null;}}
GEOperationController.prototype.begin=function(op)
{if(!op||!op.start){return;}
this.terminate();op.start(this._view,this._viewContainer);this._lastOp=op;}
GEOperationController.prototype.terminate=function()
{if(this._lastOp!=null&&this._lastOp._active)
{this._lastOp.kill();this._lastOp=null;}}

function GEPointD(x,y){this.x=!GEValueCheck.isNumber(x)?0:x;this.y=!GEValueCheck.isNumber(y)?0:y;}
GEPointD.prototype.swap=function(){var x=this.x;this.x=this.y;this.y=x;};GEPointD.prototype.translate=function(x,y)
{if(!GEValueCheck.isNumber(x))
x=0;if(!GEValueCheck.isNumber(y))
y=0;this.x+=x;this.y+=y;}
GEPointD.prototype.round=function(digit){if(!GEValueCheck.isNumber(digit))
return;this.x=GEMathSupport.round(this.x,digit);this.y=GEMathSupport.round(this.y,digit);};GEPointD.prototype.distanceAt=function(p){var dx=this.x-p.x;var dy=this.y-p.y;return Math.sqrt((dx*dx)+(dy*dy));};GEPointD.prototype.equals=function(other){if(GEValueCheck.isNull(other))
return false;if(this.x==other.x&&this.y==other.y)
return true;else
return false;}
GEPointD.prototype.toString=function(){return"X="+this.x+","+"Y="+this.y;}
GEPointD.prototype.clone=function(){return new GEPointD(this.x,this.y);}

function GEPointDList(){this.items=new Array();}
GEPointDList.prototype.add=function(p){if(GEValueCheck.isNull(p))
return;this.items.push(p);}
GEPointDList.prototype.insert=function(index,p){if(GEValueCheck.isNull(this.items)||GEValueCheck.isNull(p))
return;if(!GEValueCheck.isNumber(index)||index<0||index>=this.count()-1)
return;var clone=this.clone();this.clear();for(var i=0;i<clone.count();i++){this.add(clone.items[i]);if(i==index){this.add(p);}}}
GEPointDList.prototype.removeAt=function(index){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return;this.items.splice(index,1);}
GEPointDList.prototype.removeOverlap=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return;var result=new GEPointDList();for(var i=0;i<this.items.length-1;i++){if(this.items[i].equals(this.items[i+1]))
continue;result.add(this.items[i]);}
result.add(this.items[this.items.length-1]);this.items=new Array();for(var i=0;i<result.count();i++){this.add(result.items[i]);}}
GEPointDList.prototype.count=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return 0;else
return this.items.length;}
GEPointDList.prototype.clear=function(){if(GEValueCheck.isNull(this.items))
return;delete this.items;this.items=new Array();}
GEPointDList.prototype.firstPoint=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;else
return this.items[0];}
GEPointDList.prototype.lastPoint=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;else
return this.items[this.items.length-1];}
GEPointDList.prototype.minPoint=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;var x=this.items[0].x;var y=this.items[0].y;for(var i=0;i<this.items.length;i++){if(i>0){if(this.items[i].x<x)
x=this.items[i].x;if(this.items[i].y<y)
y=this.items[i].y;}}
return new GEPointD(x,y);}
GEPointDList.prototype.maxPoint=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;var x=this.items[0].x;var y=this.items[0].y;for(var i=0;i<this.items.length;i++){if(i>0){if(this.items[i].x>x)
x=this.items[i].x;if(this.items[i].y>y)
y=this.items[i].y;}}
return new GEPointD(x,y);}
GEPointDList.prototype.mbr=function(){var min=this.minPoint();var max=this.maxPoint();if(GEValueCheck.isNull(min)||GEValueCheck.isNull(max))
return null;return new GERectangleD(min,max);}
GEPointDList.prototype.center=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;var minX=this.items[0].x;var minY=this.items[0].y;var maxX=this.items[0].x;var maxY=this.items[0].y;;for(var i=0;i<this.items.length;i++){if(i>0){if(this.items[i].x<minX)
minX=this.items[i].x;else if(this.items[i].x>maxX)
maxX=this.items[i].x;if(this.items[i].y<minY)
minY=this.items[i].y;else if(this.items[i].y>maxY)
maxY=this.items[i].y;}}
return new GEPointD(minX+((maxX-minX)/2.0),minY+((maxY-minY)/2.0));}
GEPointDList.prototype.clone=function(){if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;var result=new GEPointDList();for(var i=0;i<this.items.length;i++){result.add(this.items[i].clone());}
return result;}
GEPointDList.prototype.isClosed=function(){if(GEValueCheck.isNull(this.items)||this.items.length<2)
return false;return(this.items[0].x==this.items[this.items.length-1].x&&this.items[0].y==this.items[this.items.length-1].y);}
GEPointDList.prototype.closed=function(){if(GEValueCheck.isNull(this.items)||this.items.length<2||this.isClosed())
return;this.items.push(this.items[0].clone());}
GEPointDList.prototype.getNearestPoint=function(p){if(GEValueCheck.isNull(p))
return null;if(GEValueCheck.isNull(this.items)||this.items.length==0)
return null;var result=null;var length=9999999999;var w_length=9999999999;for(var i=0;i<this.items.length;i++){length=p.distanceAt(this.items[i]);if(length<w_length){result=this.items[i].clone();w_length=length;}}
return result;}
GEPointDList.prototype.getNearestDistance=function(p){if(GEValueCheck.isNull(p))
return null;if(GEValueCheck.isNull(this.items)||this.items.length<2)
return null;var w_length=9999999999;for(var i=0;i<this.items.length-1;i++){var length=GEMeasure.distanceAtLine(p,this.items[i],this.items[i+1]);if(length<w_length){w_length=length;}}
return w_length;}

﻿
function GEPointProperty(){this.pointType=GEPointType.SolidRound;this.outlineColor=new GEColor(0,0,0);this.fillColor=new GEColor(255,255,255);this.pointSize=12;this.sizeUnit=GESizeUnit.Pixel;this.scale=1.0;}
GEPointProperty.prototype.getPropertyType=function(){return GEPropertyType.Point;}
GEPointProperty.prototype.toResponseText=function(){var result=new GEStringBuilder();result.append("&pt="+this.getPropertyType());if(!GEValueCheck.isNull(this.pointType)){var str=this.pointType;if(str.length>0){result.append("&ty="+str);}}
if(!GEValueCheck.isNull(this.outlineColor)){var str=this.outlineColor.toResponseText();if(str.length>0){result.append("&lc="+str);}}
if(!GEValueCheck.isNull(this.fillColor)){var str=this.fillColor.toResponseText();if(str.length>0){result.append("&fc="+str);}}
if(!GEValueCheck.isNull(this.pointSize)){var str=this.pointSize.toString();if(str.length>0){result.append("&ps="+str);}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result.append("&ut="+str);}}
if(!GEValueCheck.isNull(this.scale)){var str=this.scale.toString();if(str.length>0){result.append("&sc="+str);}}
return result.toString();}
GEPointProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.pointType)){result.append(',"ty":"'+this.pointType+'"');}
if(!GEValueCheck.isNull(this.outlineColor)){result.append(',"lc":"'+this.outlineColor.toString()+'"');}
if(!GEValueCheck.isNull(this.fillColor)){result.append(',"fc":"'+this.fillColor.toString()+'"');}
if(!GEValueCheck.isNull(this.pointSize)){result.append(',"ps":"'+this.pointSize.toString()+","+this.pointSize.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
if(!GEValueCheck.isNull(this.scale)){result.append(',"sc":"'+this.scale.toString()+'"');}
result.append('}');return result.toString();}
GEPointProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GEPointProperty();if(!GEValueCheck.isNull(obj.ty))
result.pointType=obj.ty;if(!GEValueCheck.isNull(obj.lc))
result.outlineColor=GEColor.fromString(obj.lc);if(!GEValueCheck.isNull(obj.fc))
result.fillColor=GEColor.fromString(obj.fc);if(!GEValueCheck.isNull(obj.ps))
{var sizeItems=obj.ps.split(',');result.pointSize=Number(sizeItems[1]);}
if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;if(!GEValueCheck.isNull(obj.sc))
result.scale=Number(obj.sc);return result;}

function GEPointType(){}
GEPointType.None="None";GEPointType.Round="Round";GEPointType.Triangle="Triangle";GEPointType.Square="Square";GEPointType.Diamond="Diamond";GEPointType.SolidRound="SolidRound";GEPointType.SolidTriangle="SolidTriangle";GEPointType.SolidSquare="SolidSquare";GEPointType.SolidDiamond="SolidDiamond";GEPointType.Cross="Cross";GEPointType.SlantCross="SlantCross";

﻿
function GEPolygon(shell,holes){this.feature=null;this.shell=GEValueCheck.isNull(shell)?new GEPointDList():shell.clone();this.holes=null;if(!GEValueCheck.isNull(holes)&&holes.length>0){this.holes=new Array();for(var i=0;i<holes.length;i++){this.holes.push(holes[i].clone());}}
this.hide=false;}
GEPolygon.fromRectangle=function(rectangle){if(GEValueCheck.isNull(rectangle))
rectangle=new GERectangleD();return new GEPolygon(rectangle.getCoordinates(),null);}
GEPolygon.prototype.getGeometryType=function(){return GEGeometryType.Polygon;}
GEPolygon.prototype.getCoordinates=function(){return this.shell.clone();}
GEPolygon.prototype.setCoordinates=function(points){if(GEValueCheck.isNull(points)||points.count()==0){return;}
this.shell=points.clone();}
GEPolygon.prototype.getCenter=function(){return this.shell.center();}
GEPolygon.prototype.getArea=function(){var result=GEMeasure.polygonArea(this.shell);if(!GEValueCheck.isNull(this.holes)&&this.holes.Length>0){for(var i=0;i<this.holes.length;i++){result-=GEMeasure.polygonArea(this.holes[i]);}}
return result;}
GEPolygon.prototype.getCentroid=function(){return GECentroid.polygon(this.shell);}
GEPolygon.prototype.getBoundary=function(){if(GEValueCheck.isNull(this.shell))
return null;return this.shell.mbr();}
GEPolygon.prototype.getNearestPoint=function(p){if(GEValueCheck.isNull(p))
return null;if(GEValueCheck.isNull(this.shell))
return null;return this.shell.getNearestPoint(p);}
GEPolygon.prototype.getNearestDistance=function(p){if(GEValueCheck.isNull(p))
return 0;if(GEValueCheck.isNull(this.shell))
return 0;return this.shell.getNearestDistance(p);}
GEPolygon.prototype.clone=function(){var result=new GEPolygon();result.shell=this.shell.clone();if(this.holes!=null&&this.holes.length>0){result.holes=new Array();for(var i=0;i<this.holes.length;i++)
result.holes.add(this.holes[i].clone());}
return result;}
GEPolygon.prototype.toWKT=function(){if(GEValueCheck.isNull(this.shell))
return"";var wkt=new GEStringBuilder();wkt.append(this.getGeometryType().toUpperCase());wkt.append("(");wkt.append("(");wkt.append(this._getCoordinateString(this.shell));wkt.append(")");if(!GEValueCheck.isNull(this.holes)&&this.holes.length>0){for(var i=0;i<this.holes.length;i++){if(GEValueCheck.isNull(this.holes[i])||this.holes[i].count()<3)
continue;wkt.append("(");wkt.append(this._getCoordinateString(this.holes[i]));wkt.append(")");}}
wkt.append(")");return wkt.toString();}
GEPolygon.prototype.toText=function(){if(GEValueCheck.isNull(this.shell))
return"";var wkt=new GEStringBuilder();wkt.append(GEGeometryType.Polygon);wkt.append("(");wkt.append("(");wkt.append(this._getCoordinateString(this.shell));wkt.append(")");if(!GEValueCheck.isNull(this.holes)&&this.holes.length>0){for(var i=0;i<this.holes.length;i++){if(GEValueCheck.isNull(this.holes[i])||this.holes[i].count()<3)
continue;wkt.append("(");wkt.append(this._getCoordinateString(this.holes[i]));wkt.append(")");}}
wkt.append(")");wkt.append(";;");return wkt.toString();}
GEPolygon.prototype._getCoordinateString=function(coordinates){var result=new GEStringBuilder();for(var i=0;i<coordinates.count();i++){if(i>0)result.append(",");result.append(coordinates.items[i].x.toString()+" "+coordinates.items[i].y.toString());}
return result.toString();}
GEPolygon.prototype.isValid=function(){if(GEValueCheck.isNull(this.shell))
return false;var points=this.shell;if(points.count()<3||!points.items[0].equals(points.items[points.count()-1]))
return false;var startP=points.items[0];var endP=points.items[points.count()-1];var direct=GESpatials.polygonDirection(points);return direct>=0;}
GEPolygon.prototype.toJSON=function(){if(GEValueCheck.isNull(this.shell))
return"";var result=new GEStringBuilder();result.append('{');result.append('"gt":"'+this.getGeometryType()+'",');result.append('"sl":');result.append('[');for(var i=0;i<this.shell.count();i++){result.append('{');result.append('"x":"'+this.shell.items[i].x.toString()+'",');result.append('"y":"'+this.shell.items[i].y.toString()+'"');result.append('}');if(i<this.shell.count()-1)
result.append(',');}
result.append(']');if(!GEValueCheck.isNull(this.holes)&&this.holes.length>0){result.append(',');result.append('"hls":');result.append('[');for(var i=0;i<this.holes.length;i++){result.append('[');for(var j=0;j<this.holes[i].count();j++){result.append('{');result.append('"x":"'+this.holes[i].items[j].x.toString()+'",');result.append('"y":"'+this.holes[i].items[j].y.toString()+'"');result.append('}');if(j<this.holes[i].count()-1)
result.append(',');}
result.append(']');}
result.append(']');}
result.append('}');return result.toString();}
GEPolygon.fromJSON=function(obj){if(obj==null)
return null;var result=new GEPolygon();var shell=new GEPointDList();for(var i=0;i<obj.sl.length;i++){var x=Number(obj.sl[i].x)
var y=Number(obj.sl[i].y)
shell.add(new GEPointD(x,y));}
result.shell=shell;if(!GEValueCheck.isNull(obj.hls)&&obj.hls.length>0){var holes=new Array();for(var i=0;i<obj.hls.length;i++){var hole=new GEPointDList();for(var j=0;j<obj.hls[i].length;j++){var x=Number(obj.hls[i][j].x)
var y=Number(obj.hls[i][j].y)
hole.add(new GEPointD(x,y));}
holes.push(hole);}
result.holes=holes;}
return result;}

function GEPolygonProperty(){this.lineColor=new GEColor(0,0,0);this.fillColor=null;this.lineWidth=1;this.sizeUnit=GESizeUnit.Pixel;this.linePattern=GELinePattern.Solid;this.joinStyle=GEJoinStyle.Miter;}
GEPolygonProperty.prototype.getPropertyType=function(){return GEPropertyType.Polygon;}
GEPolygonProperty.prototype.toResponseText=function(){var result=new GEStringBuilder();result.append("&pt="+this.getPropertyType());if(!GEValueCheck.isNull(this.lineColor)){var str=this.lineColor.toResponseText();if(str.length>0){result.append("&lc="+str);}}
if(!GEValueCheck.isNull(this.fillColor)){var str=this.fillColor.toResponseText();if(str.length>0){result.append("&fc="+str);}}
if(!GEValueCheck.isNull(this.lineWidth)){var str=this.lineWidth.toString();if(str.length>0){result.append("&lw="+str);}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result.append("&ut="+str);}}
if(!GEValueCheck.isNull(this.linePattern)){var str=this.linePattern;if(str.length>0){result.append("&lp="+str);}}
return result.toString();}
GEPolygonProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.lineColor)){result.append(',"lc":"'+this.lineColor.toString()+'"');}
if(!GEValueCheck.isNull(this.fillColor)){result.append(',"fc":"'+this.fillColor.toString()+'"');}
if(!GEValueCheck.isNull(this.lineWidth)){result.append(',"lw":"'+this.lineWidth.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
if(!GEValueCheck.isNull(this.linePattern)){result.append(',"lp":"'+this.linePattern+'"');}
result.append('}');return result.toString();}
GEPolygonProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GEPolygonProperty();if(!GEValueCheck.isNull(obj.lc))
result.lineColor=GEColor.fromString(obj.lc);if(!GEValueCheck.isNull(obj.fc))
result.fillColor=GEColor.fromString(obj.fc);if(!GEValueCheck.isNull(obj.lw))
result.lineWidth=Number(obj.lw);if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;if(!GEValueCheck.isNull(obj.lp))
result.linePattern=obj.lp;return result;}

function GEPropertyType(){}
GEPropertyType.Linear="Linear";GEPropertyType.Polygon="Polygon";GEPropertyType.Ellipse="Ellipse";GEPropertyType.Point="Point";GEPropertyType.Icon="Icon";GEPropertyType.Text="Text";

﻿
function GEPropertyUpdater(){}
GEPropertyUpdater.prototype.updateLayerProperty=function(layer){if(GEValueCheck.isNull(layer)||GEValueCheck.isNull(layer.property))
return;var param=new GEStringBuilder();param.append('ws='+layer.ws_id);param.append('&id='+layer.layerId.toString());param.append('&cn='+layer.connection);param.append('&lt='+layer.layerType);param.append(layer.property.toResponseText());var http=new GEXmlHttp(layer.serverPath+'PropertyUpdater.aspx','POST',param.toString());var obj=http.execute();if(obj==null)
return false;if(obj.response=='error'){GEError.server(obj.msg);return false;}
if(obj.update>0){return true;}
else{return false;}
http=null;}
GEPropertyUpdater.prototype.updateFeatureProperty=function(feature){if(GEValueCheck.isNull(feature)||GEValueCheck.isNull(feature.geometry))
return;var param=new GEStringBuilder();param.append('ws='+feature.layer.ws_id);param.append('&id='+feature.layer.layerId.toString());param.append('&cn='+feature.layer.connection);param.append('&sid='+feature.sid.toString());param.append('&gt='+feature.geometry.getGeometryType());if(!GEValueCheck.isNull(feature.property))
param.append(feature.property.toResponseText());else
param.append('&md=d');var http=new GEXmlHttp(feature.layer.serverPath+'PropertyUpdater.aspx','POST',param.toString());var obj=http.execute();if(obj==null)
return false;if(obj.response=='error'){GEError.server(obj.msg);return false;}
if(obj.update>0){return true;}
else{return false;}
http=null;}

function GERadian(){}
GERadian._PI=3.141592653589793;GERadian.radToDeg=function(rad)
{if(!GEValueCheck.isNumber(rad))
return 0.0;var r=rad*(180.0/GERadian._PI);if(r>360.0)
r-=360.0;else if(r<-360)
r+=360.0;return r;}
GERadian.degToRad=function(degree)
{if(!GEValueCheck.isNumber(degree))
return 0.0;return degree*(GERadian._PI/180.0);}
GERadian.revise=function(rad)
{if(!GEValueCheck.isNumber(rad))
return;var work_r=rad;var fc_2pi=GERadian._PI*2.0;while(work_r<0.0){work_r+=fc_2pi;}
while(fc_2pi<=work_r){work_r-=fc_2pi;}
return work_r;}
GERadian.getRadian=function(p1,p2)
{if(!p1||!p2)
return 0.0;var dx=p2.x-p1.x;var dy=p2.y-p1.y;var area;if(dx>=0.0)
{if(dy>=0.0)
{area=0;}
else
{area=3;var t=dx;dx=-dy;dy=t;}}
else
{if(dy>=0.0)
{area=1;var t=dx;dx=dy;dy=-t;}
else
{area=2;dx=-dx;dy=-dy;}}
var a;if(dy>dx)
{a=GERadian._PI/2.0-Math.atan(dx/dy);}
else
{a=Math.atan(dy/dx);}
return a+area*(GERadian._PI/2.0);}

function GERectangleD(min,max){this.min=GEValueCheck.isNull(min)?new GEPointD(0,0):min;this.max=GEValueCheck.isNull(max)?new GEPointD(0,0):max;}
GERectangleD.fromSize=function(min,size){if(GEValueCheck.isNull(min))
min=new GEPointD(0,0);if(GEValueCheck.isNull(size))
size=new GESizeD(0,0);var max=new GEPointD(min.x+size.width,min.y+size.height);return new GERectangleD(min,max);}
GERectangleD.fromCenter=function(center,size){if(GEValueCheck.isNull(center))
center=new GEPointD(0,0);if(GEValueCheck.isNull(size))
size=new GESizeD(0,0);var min=new GEPointD(center.x-(size.width/2),center.y-(size.height/2));var max=new GEPointD(center.x+(size.width/2),center.y+(size.height/2));return new GERectangleD(min,max);}
GERectangleD.fromPoints=function(points){if(GEValueCheck.isNull(points))
return null;var minP=new GEPointD();var maxP=new GEPointD();for(var i=0;i<points.count();i++){if(i==0){minP.x=points.items[i].x;minP.y=points.items[i].y;maxP.x=points.items[i].x;maxP.y=points.items[i].y;}else{if(minP.x>points.items[i].x)minP.x=points.items[i].x;if(minP.y>points.items[i].y)minP.y=points.items[i].y;if(maxP.x<points.items[i].x)maxP.x=points.items[i].x;if(maxP.y<points.items[i].y)maxP.y=points.items[i].y;}}
return new GERectangleD(minP,maxP);}
GERectangleD.prototype.round=function(digit){if(!GEValueCheck.isNumber(digit))
return;if(!GEValueCheck.isNull(this.min)){this.min.x=GEMathSupport.round(this.min.x,digit);this.min.y=GEMathSupport.round(this.min.y,digit);}
if(!GEValueCheck.isNull(this.max)){this.max.x=GEMathSupport.round(this.max.x,digit);this.max.y=GEMathSupport.round(this.max.y,digit);}};GERectangleD.prototype.getTopLeft=function(){var top=GEValueCheck.isNull(this.min)?new GEPointD(0,0):this.min.x;var left=GEValueCheck.isNull(this.max)?new GEPointD(0,0):this.max.y;return new GEPointD(top,left);}
GERectangleD.prototype.getBottomRight=function(){var bottom=GEValueCheck.isNull(this.max)?new GEPointD(0,0):this.max.x;var right=GEValueCheck.isNull(this.min)?new GEPointD(0,0):this.min.y;return new GEPointD(this.max.x,this.min.y);}
GERectangleD.prototype.getCenter=function(){if(GEValueCheck.isNull(this.min)||GEValueCheck.isNull(this.max))
return null;return new GEPointD((this.max.x+this.min.x)/2,(this.max.y+this.min.y)/2);}
GERectangleD.prototype.getCoordinates=function(){if(GEValueCheck.isNull(this.min)||GEValueCheck.isNull(this.max))
return null;var result=new GEPointDList();result.add(new GEPointD(this.min.x,this.min.y));result.add(new GEPointD(this.min.x,this.max.y));result.add(new GEPointD(this.max.x,this.max.y));result.add(new GEPointD(this.max.x,this.min.y));result.add(new GEPointD(this.min.x,this.min.y));return result;}
GERectangleD.prototype.getArea=function(){var size=this.getSize();return size.width*size.height;}
GERectangleD.prototype.getSize=function(){if(GEValueCheck.isNull(this.min)||GEValueCheck.isNull(this.max))
return null;return new GESizeD(Math.abs((this.max.x-this.min.x)),Math.abs((this.max.y-this.min.y)));}
GERectangleD.prototype.getWidth=function(){if(GEValueCheck.isNull(this.min)||GEValueCheck.isNull(this.max))
return 0;return this.max.x-this.min.x;}
GERectangleD.prototype.getHeight=function(){if(GEValueCheck.isNull(this.min)||GEValueCheck.isNull(this.max))
return 0;return this.max.y-this.min.y;}
GERectangleD.prototype.setSize=function(size){if(GEValueCheck.isNull(size))
return;this.max.x=this.min.x+size.width;this.max.y=this.min.y+size.height;}
GERectangleD.prototype.equals=function(other){if(GEValueCheck.isNull(other))
return false;if(this.min.equals(other.min)&&this.max.equals(other.max))
return true;else
return false;}
GERectangleD.prototype.toString=function(){return"Min("+this.min.toString()+"),"+"Max("+this.max.toString()+")";}
GERectangleD.prototype.clone=function(){return new GERectangleD(this.min,this.max);}
GERectangleD.prototype.contains=function(p){if(!p)return false;return((p.x>=this.min.x&&p.x<=this.max.x)&&(p.y>=this.min.y&&p.y<=this.max.y));}
GERectangleD.prototype.containsR=function(r){if(!r)return false;return this.min.x<r.min.x&&this.max.x>r.max.x&&this.min.y<r.min.y&&this.max.y>r.max.y;}
GERectangleD.prototype.intersects=function(r){if(!r)return false;if(this.min.x<=r.max.x&&this.max.y>=r.min.y&&this.max.x>=r.min.x&&this.min.y<=r.max.y)
{return true;}
else
{return false;}}
GERectangleD.prototype.inflate=function(dx,dy){this.min.x-=(dx/2.0);this.min.y-=(dy/2.0);this.max.x+=(dx/2.0);this.max.y+=(dy/2.0);}
GERectangleD.prototype.getRotationRect=function(angle){if(GEValueCheck.isNull(angle))
return this.clone();var coordinates=this.getCoordinates();var rMatrix=new GEMatrix();rMatrix.rotateAt(this.getCenter(),angle.getRadian());for(var i=0;i<coordinates.count();i++){var p=rMatrix.transform(coordinates.items[i]);coordinates.items[i]=p;}
rMatrix=null;return GERectangleD.fromPoints(coordinates);}

function GERectZoom(property){var defaultProperty=new GEPolygonProperty();defaultProperty.lineColor=new GEColor(255,0,0);defaultProperty.fillColor=new GEColor(255,0,0,50);defaultProperty.lineWidth=2;this.property=GEValueCheck.isNull(property)?defaultProperty:property;this._view=null;this._active=false;this._procOp=null;}
GERectZoom.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._active=true;this._view=view;var _self=this;this._procOp=new GETrackRectangle(this.property);this._procOp.start(view,viewContainer);this._procOp.trackComplete=function(geom){_self._procOp.rubberBand.clear();if(geom!=undefined&&geom!=null){this._view.rangeAt(geom.shell.mbr());}
_self.terminate(true);}}
GERectZoom.prototype.end=function(){}
GERectZoom.prototype.kill=function(){if(!this._active||this._procOp==null)return;this._procOp.kill();this.terminate(true);}
GERectZoom.prototype.terminate=function(dispatch){if(!this._active)return;this._procOp=null;this._active=false;if(dispatch)this.end();}

function GERendererFactory(){}
GERendererFactory.instance=function(){if(GEBrowser.isIE()){return new GEVmlRenderer();}
else if(GEBrowser.isFireFox()||GEBrowser.isOpera()||GEBrowser.isSafari()){return new GECanvasRenderer();}
else{return null;}}

function GERotation(property){var defaultProperty=new GEPolygonProperty();defaultProperty.lineColor=new GEColor(255,0,0);defaultProperty.fillColor=new GEColor(255,0,0,50);defaultProperty.lineWidth=2;this.property=GEValueCheck.isNull(property)?defaultProperty:property;this._view=null;this._active=false;}
GERotation.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._active=true;this._view.disableDragging();this._rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());var viewSize=this._view.getSize();var viewRect=new GERectangleD(new GEPointD(0,viewSize.height),new GEPointD(viewSize.width,0));this._coordinates=viewRect.getCoordinates();this._viewCenter=viewRect.getCenter();viewSize=null;viewRect=null;this._viewRotate=this._view.getAngle().getRadian();if(this._viewRotate!=0.0){var rMatrix=new GEMatrix();rMatrix.rotateAt(this._viewCenter,this._viewRotate*-1);for(var i=0;i<this._coordinates.count();i++){var p=rMatrix.transform(this._coordinates.items[i]);p.round(3);this._coordinates.items[i]=p;}
rMatrix=null;}
this._rubberBand.drawPolygon(this._coordinates,this.property);var directLines=new GEPointDList();directLines.add(this._coordinates.items[0]);directLines.add(this._viewCenter);directLines.add(this._coordinates.items[3]);this._rubberBand.drawLines(directLines,this.property);directLines.clear();directLines=null;this._scrollFrom=null;this._isDragging=false;this._view.changeCursor(GECursor.Grab);var self_op=this;var container=this._view.getContainer();this._mousedown=GEEvent.addListener(container,'mousedown',function(event)
{if(!self_op._active)return;if(!event)event=window.event;self_op._view.changeCursor(GECursor.Grabbing);self_op._scrollFrom=self_op._view.getLocalPoint(event);self_op._isDragging=true;GEEvent.stopEvent(event);return false;});this._mousemove=GEEvent.addListener(document,'mousemove',function(event)
{if(!self_op._active)return;if(!self_op._isDragging)return false;if(!event)event=window.event;var p=self_op._view.getLocalPoint(event);if(p.equals(self_op._scrollFrom))return false;var stAngle=GERadian.getRadian(self_op._scrollFrom,self_op._viewCenter);var edAngle=GERadian.getRadian(p,self_op._viewCenter);var rad=GEMathSupport.round(stAngle-edAngle,3)*-1;var rMatrix=new GEMatrix();rMatrix.rotateAt(self_op._viewCenter,rad);var rotCoordinates=new GEPointDList();for(var i=0;i<self_op._coordinates.count();i++){var p=rMatrix.transform(self_op._coordinates.items[i]);p.round(3);rotCoordinates.add(p);}
rMatrix=null;self_op._rubberBand.clear();self_op._rubberBand.drawPolygon(rotCoordinates,self_op.property);var directLines=new GEPointDList();directLines.add(rotCoordinates.items[0]);directLines.add(self_op._viewCenter);directLines.add(rotCoordinates.items[3]);self_op._rubberBand.drawLines(directLines,self.property);rotCoordinates.clear();rotCoordinates=null;directLines.clear();directLines=null;GEEvent.stopEvent(event);return false;});this._mouseup=GEEvent.addListener(document,'mouseup',function(event)
{if(!self_op._active)return;if(!self_op._isDragging)return;if(!event)event=window.event;var p=self_op._view.getLocalPoint(event);if(!p.equals(self_op._scrollFrom))
{var stAngle=GERadian.getRadian(self_op._scrollFrom,self_op._viewCenter);var edAngle=GERadian.getRadian(p,self_op._viewCenter);var rad=GEMathSupport.round(stAngle-edAngle,3)*-1;self_op._view.rotateAt(GEAngle.fromRadian(self_op._viewRotate+(rad*-1)));self_op.terminate(true);return;}
else
{self_op._view.changeCursor(GECursor.Grab);self_op._isDragging=false;self_op._scrollFrom=null;}
GEEvent.stopEvent(event);return false;});}
GERotation.prototype.end=function(){}
GERotation.prototype.kill=function(){if(!this._active)return;this.terminate(true);}
GERotation.prototype.terminate=function(dispatch){if(!this._active)return;this._rubberBand.dispose();var container=this._view.getContainer();if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(document,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(document,"mouseup",this._mouseup);this._view.enableDragging();this._active=false;if(dispatch)this.end();}

function GERubberBand(view,viewContainer,index){this._ELEMENT_ID="GERubberBand";this.renderer=GERendererFactory.instance();this._view=view;this._viewContainer=viewContainer;this._rdrElement=null;this._txtElement=null;this._index=!GEValueCheck.isNumber(index)?0:index;this._elmContainer=null;if(GEValueCheck.isNull(this.renderer))
return;this._elmContainer=document.createElement("div");this._elmContainer.id=this._ELEMENT_ID+'_'+GEFunctions.getRandomString();this._viewContainer.appendChild(this._elmContainer);this._createElement();GEGC.add(this);}
GERubberBand.prototype._createElement=function(){if(GEValueCheck.isNull(this.renderer))
return;var left=this._viewContainer.offsetLeft*-1;var top=this._viewContainer.offsetTop*-1;GEFunctions.setStyle(this._elmContainer,"position: absolute;"+"left: "+GEFunctions.createPx(left)+";"+"top: "+GEFunctions.createPx(top)+";"+"margin: 0px;"+"padding: 0px;"+"z-index: "+100+this._index+";");this._rdrElement=this.renderer.createElement(this._view,this._viewContainer);this._rdrElement.id=this._elmContainer.id+'_rdr';this._elmContainer.appendChild(this._rdrElement);GEFunctions.setStyle(this._rdrElement,"z-index: "+110+this._index+";");this._txtElement=document.createElement("div");this._txtElement.id=this._elmContainer.id+'_txt';this._elmContainer.appendChild(this._txtElement);GEFunctions.setStyle(this._txtElement,"z-index: "+120+this._index+";");}
GERubberBand.prototype.clear=function(){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;this._elmContainer.removeChild(this._rdrElement);this._elmContainer.removeChild(this._txtElement);this._rdrElement=null;this._txtElement=null;this._createElement();}
GERubberBand.prototype.dispose=function(){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;this.renderer.dispose();this.renderer=null;this._elmContainer.removeChild(this._rdrElement);this._elmContainer.removeChild(this._txtElement);this._rdrElement=null;this._txtElement=null;this._viewContainer.removeChild(this._elmContainer);this._elmContainer=null;}
GERubberBand.prototype.drawLines=function(points,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(points))
GEError.argument("points");if(points.count()<2)
return;if(GEValueCheck.isNull(property))
property=new GELinearProperty();var pixWidth=property.lineWidth;if(property.sizeUnit==GESizeUnit.World)
{var size=this._view.toLocalSize(new GESizeD(pixWidth,pixWidth));pixWidth=size.width;}
if(pixWidth<=0)pixWidth=1;this.renderer.drawLines(this._rdrElement,points,property,pixWidth);if(property.drawBaseLine&&pixWidth>1)
{var color=property.lineColor.clone();property.lineColor=property.baseLineColor;this.renderer.drawLines(this._rdrElement,points,property,1);property.lineColor=color;}}
GERubberBand.prototype.drawPolygon=function(points,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(points))
GEError.argument("points");if(points.count()<2)
return;if(!points.isClosed())
points.closed();if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var pixWidth=property.lineWidth;if(property.sizeUnit==GESizeUnit.World)
{var size=this._view.toLocalSize(new GESizeD(pixWidth,pixWidth));pixWidth=size.width;}
if(pixWidth<=0)pixWidth=1;this.renderer.drawPolygon(this._rdrElement,points,property,pixWidth);}
GERubberBand.prototype.drawRectangle=function(rect,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(rect))
GEError.argument("rect");if(rect.getSize().isZero())
return;if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var pixWidth=property.lineWidth;if(property.sizeUnit==GESizeUnit.World)
{var size=this._view.toLocalSize(new GESizeD(pixWidth,pixWidth));pixWidth=size.width;}
if(pixWidth<=0)pixWidth=1;this.renderer.drawRectangle(this._rdrElement,rect,property,pixWidth);}
GERubberBand.prototype.drawEllipse=function(center,xAxis,yAxis,rotate,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(center))
GEError.argument("center");if(GEValueCheck.isNull(xAxis))
GEError.argument("xAxis");if(GEValueCheck.isNull(yAxis))
GEError.argument("yAxis");if(xAxis<=0&&yAxis<=0)
return;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEEllipseProperty();var pixWidth=property.lineWidth;if(property.sizeUnit==GESizeUnit.World)
{var size=this._view.toLocalSize(new GESizeD(pixWidth,pixWidth));pixWidth=size.width;}
if(pixWidth<=0)pixWidth=1;this.renderer.drawEllipse(this._rdrElement,center,xAxis,yAxis,rotate,property,pixWidth);}
GERubberBand.prototype.drawPoint=function(point,rotate,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(point))
GEError.argument("point");if(property.pointSize<=0)
return;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEPointProperty();var pixSize=new GESizeD(property.pointSize,property.pointSize);if(!pixSize.isZero()&&property.sizeUnit==GESizeUnit.World){pixSize=this._view.toLocalSize(pixSize);}
if(pixSize.width<=0||pixSize.height<=0)return;if(GEValueCheck.isNumber(property.scale)){pixSize.width*=property.scale;pixSize.height*=property.scale;}
this.renderer.drawPoint(this._rdrElement,point,rotate,property,pixSize);}
GERubberBand.prototype.drawIcon=function(point,rotate,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEIconProperty();var pixSize=property.iconSize.clone();if(!pixSize.isZero()&&property.sizeUnit==GESizeUnit.World){pixSize=this._view.toLocalSize(pixSize);}
if(!pixSize.isZero()&&GEValueCheck.isNumber(property.scale)){pixSize.width*=property.scale;pixSize.height*=property.scale;}
this.renderer.drawIcon(this._rdrElement,point,rotate,property,pixSize);}
GERubberBand.prototype.drawText=function(point,textString,rotate,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null||this._txtElement==null||this._elmContainer==null)
return;if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(textString)||textString.length==0)
return;if(property.fontSize<=0)
return;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GETextProperty();var pixFontSize=property.fontSize;var pixOffset=property.offset.clone();if(property.sizeUnit==GESizeUnit.World){var size=this._view.toLocalSize(new GESizeD(pixFontSize,pixFontSize));pixFontSize=size.width;pixOffset=this._view.toLocalSize(pixOffset);}
if(pixFontSize<=0)return;var bytes=GEFunctions.getStringBytes(textString);var aspect=0.5;var textWidth=(pixFontSize*aspect)*bytes;var textContainer=document.createElement("div");textContainer.innerHTML=textString;if(!GEValueCheck.isNull(property.backColor)){GEFunctions.setStyle(textContainer,"position: absolute;"+"left: "+GEFunctions.createPx(point.x-(textWidth/2)+pixOffset.width)+";"+"top: "+GEFunctions.createPx(point.y-(pixFontSize/2)+pixOffset.height)+";"+"font-size: "+GEFunctions.createPx(pixFontSize)+";"+"color: "+property.fontColor.toHexString()+";"+"background-color: "+property.backColor.toHexString()+";"+"font-weight: bold;"+"padding: 1px; "+"white-space: nowrap;"+"font-family: "+GEFunctions.createPx(property.fontName)+";");}
else
{GEFunctions.setStyle(textContainer,"position: absolute;"+"left: "+GEFunctions.createPx(point.x-(textWidth/2)+pixOffset.width)+";"+"top: "+GEFunctions.createPx(point.y-(pixFontSize/2)+pixOffset.height)+";"+"font-size: "+GEFunctions.createPx(pixFontSize)+";"+"color: "+property.fontColor.toHexString()+";"+"font-weight: bold;"+"padding: 1px; "+"white-space: nowrap;"+"font-family: "+GEFunctions.createPx(property.fontName)+";");}
this._txtElement.insertBefore(textContainer,null);}
GERubberBand.prototype.hitTestPoint=function(testP,point,rotate,property){if(GEValueCheck.isNull(this.renderer))
return false;if(this._rdrElement==null&&this._elmContainer==null)
return false;if(GEValueCheck.isNull(point))
return false;if(property.pointSize<=0)
return false;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEPointProperty();var pixSize=new GESizeD(property.pointSize,property.pointSize);if(!pixSize.isZero()&&property.sizeUnit==GESizeUnit.World){pixSize=this._view.toLocalSize(pixSize);}
if(pixSize.width<=0||pixSize.height<=0)return false;if(GEValueCheck.isNumber(property.scale)){pixSize.width*=property.scale;pixSize.height*=property.scale;}
var dist=testP.distanceAt(point);return(dist<=(pixSize.width/2)&&dist<=(pixSize.height/2));}
GERubberBand.prototype.hitTestIcon=function(testP,point,rotate,property){if(GEValueCheck.isNull(this.renderer))
return false;if(this._rdrElement==null&&this._elmContainer==null)
return false;if(GEValueCheck.isNull(point))
return false;if(property.pointSize<=0)
return false;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEIconProperty();var pixSize=property.iconSize.clone();if(!pixSize.isZero()&&property.sizeUnit==GESizeUnit.World){pixSize=this._view.toLocalSize(pixSize);}
else if(pixSize.isZero()){var image=this.renderer.getCachedImage(property.url);if(image!=null){pixSize=new GESizeD(image.width,image.height);}}
if(pixSize.width<=0||pixSize.height<=0)return false;if(!pixSize.isZero()&&GEValueCheck.isNumber(property.scale)){pixSize.width*=property.scale;pixSize.height*=property.scale;}
var dist=testP.distanceAt(point);return(dist<=(pixSize.width/2)&&dist<=(pixSize.height/2));}
GERubberBand.prototype.hitTestText=function(testP,point,textString,rotate,property){if(GEValueCheck.isNull(this.renderer))
return;if(this._rdrElement==null&&this._elmContainer==null)
return;if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(textString)||textString.length==0)
return;if(property.fontSize<=0)
return;if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GETextProperty();var pixFontSize=property.fontSize;var pixOffset=property.offset.clone();if(property.sizeUnit==GESizeUnit.World){var size=this._view.toLocalSize(new GESizeD(pixFontSize,pixFontSize));pixFontSize=size.width;pixOffset=this._view.toLocalSize(pixOffset);}
if(pixFontSize<=0)return;var bytes=GEFunctions.getStringBytes(textString);var aspect=0.5;var textWidth=(pixFontSize*aspect)*bytes;var rect=GERectangleD.fromSize(new GEPointD(point.x-(textWidth/2)+pixOffset.width,point.y-(pixFontSize/2)+pixOffset.height),new GESizeD(pixFontSize*textString.length,pixFontSize));return rect.contains(testP);}

function GEScalebar(option){if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.offsetX==undefined)
this.option.offsetX=5;if(this.option.offsetY==undefined)
this.option.offsetY=5;this._parent=null;this._element=null;this._viewevent_onscalechanged=null;}
GEScalebar.prototype.baseAlign=function(){return GEControlPosition.LB;}
GEScalebar.prototype.getElement=function(){return this._element;}
GEScalebar.prototype.getOffset=function(){return new GEPointD(this.option.offsetX,this.option.offsetY);}
GEScalebar.prototype.isAttached=function(){return(this._parent!=null);}
GEScalebar.prototype.attach=function(parent,controlContainer){if(this.isAttached())return false;this._parent=parent;this._element=document.createElement('div');this._element.id='GEScalebar_'+GEFunctions.getRandomString();controlContainer.appendChild(this._element);GEFunctions.setBackgroundImage(this._element,GEAJAX.path+'/resources/control_back2.png',true,parent.view);GEFunctions.setStyle(this._element,"visibility: visible;"+"position: absolute;"+"overflow: visible;"+"z-index: 0;"+"background-repeat: repeat;"+"padding: 5px;");GEEvent.disableDragEventOnIE(this._element);GEEvent.disableSelection(this._element);this.refresh();var self_sb=this;this._viewevent_onscalechanged=GEEvent.addListener(parent.view,"onscalechanged",function()
{self_sb.refresh();});return true;}
GEScalebar.prototype.detach=function(parent,controlContainer){if(!this.isAttached())return;GEEvent.removeListener(parent.view,'onscalechanged',this._viewevent_onscalechanged);GEEvent.resetDragEventOnIE(this._element);this._element.innerHTML='';controlContainer.removeChild(this._element);delete this._element;this._element=null;this._parent=null;}
GEScalebar.prototype.refresh=function(){if(!this.isAttached())return;this._element.innerHTML='';var pixelSize=this._parent.view.getPixelWorld();var barWidth=0;var labelStr='';var metor=pixelSize.width*100;if(metor<1.0)
{return;}
else if(metor>=1000)
{var valueStep=5;var kmetor=metor/1000;kmetor=Math.floor(kmetor);kmetor=valueStep*Math.floor(kmetor/valueStep);if(kmetor<=0)kmetor=1;barWidth=Math.floor((kmetor*1000)/pixelSize.width);labelStr=kmetor+" Km";}
else
{var valueStep=50;metor=Math.floor(metor);metor=valueStep*Math.floor(metor/valueStep);if(metor<=0)metor=25;barWidth=Math.floor(metor/pixelSize.width);labelStr=metor+" m";}
this._element.style.width=GEFunctions.createPx(barWidth);var text=document.createElement("div");text.appendChild(document.createTextNode(labelStr));GEFunctions.setStyle(text,"position: relative;"+"overflow: visible;"+"width: "+barWidth+"px;"+"font-family: MS Sans Serif;"+"font-size: 5px;"+"font-weight: bold;"+"text-align: center;"+"vertical-align: bottom;"+"top: 0px;");this._element.appendChild(text);var img1=document.createElement('img');img1.src=GEAJAX.path+'/resources/'+'scaleb_l.gif';GEFunctions.setStyle(img1,"position: relative;"+"top: -5px;"+"width: 4px;"+"height: 12px;");this._element.appendChild(img1);var img2=document.createElement('img');img2.src=GEAJAX.path+'/resources/'+'scaleb_b.gif';GEFunctions.setStyle(img2,"position: relative;"+"top: -5px;"+"width: "+(barWidth-8)+"px;"+"height: 4px;");this._element.appendChild(img2);var img3=document.createElement('img');img3.src=GEAJAX.path+'/resources/'+'scaleb_r.gif';GEFunctions.setStyle(img3,"position: relative;"+"top: -5px;"+"width: 4px;"+"height: 12px;");this._element.appendChild(img3);}

﻿
function GESearchMode(){}
GESearchMode.Server="Server";GESearchMode.Memory="Memory";GESearchMode.Both="Both";

﻿
function GESelectGeometry(){this.searchMode=GESearchMode.Memory;this.memoryLayer=null;this.memorySearchKey=null;this.layerList=new Array();this.tolerance=10;this.toleranceUnit=GESizeUnit.Pixel;this.singleSelection=false;this._view=null;this._container=null;this._active=false;this.rubberBand=null;}
GESelectGeometry.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._active=true;this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());var self=this;var op_terminate=false;var hiliteRender=new GEHiliteRender(this._view);var geoms=null;var props=null;var activeGeom=null;var activeProp=null;var current=0;this._view.disablePanning();this._view.changeCursor(GECursor.Pointer);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;self.rubberBand.clear();if(activeGeom!=null){hiliteRender.render(self.rubberBand,activeGeom,activeProp);}});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_click=false;this._click=GEEvent.addListener(this._container,'click',function(mouseEvent){if(op_terminate)return false;if(e_click)return false;e_click=true;self._view.changeCursor(GECursor.Pointer);if(!GEValueCheck.isNull(activeGeom)){op_terminate=true;self.selected(activeGeom);self.terminate(true,activeGeom);e_click=false;return false;}
geoms=new Array();props=new Array();current=0;activeGeom=null;activeProp=null;var lp=self._view.getLocalPoint(mouseEvent);var wp=self._view.getWorldPoint(mouseEvent);var tolerance=5;if(GEValueCheck.isNumber(self.tolerance)){if(self.toleranceUnit==GESizeUnit.World){var wsize=self._view.toLocalSize(new GESizeD(self.tolerance,self.tolerance));tolerance=wsize.width;}}
var worldTolerance=self._view.toWorldSize(new GESizeD(tolerance,tolerance));if((self.searchMode==GESearchMode.Server||self.searchMode==GESearchMode.Both)&&self.layerList.length>0)
{var rect=GERectangleD.fromCenter(wp,worldTolerance);var expression=new GEFeatureExpression();expression.spatial=GESpatialCondition.fromPolygon(GEPolygon.fromRectangle(rect),GESpatialRelation.Intersects);for(var i=0;i<self.layerList.length;i++){var targetLayer=self.layerList[i];var result=targetLayer.queryFeature(expression);if(result==null)continue;for(var j=0;j<result.length;j++){if(result[j].geometry!=null){geoms.push(result[j].geometry);props.push(targetLayer.property);}}}
if(self.searchMode==GESearchMode.Memory||self.searchMode==GESearchMode.Both)
{var mLayer=self.memoryLayer;if(mLayer==null)
mLayer=self._view.getMemoryLayer();var m_geoms=null;if(self.memorySearchKey!=null)
{m_geoms=mLayer.searchHit(lp,tolerance,self.memorySearchKey);}
else
{m_geoms=mLayer.searchHit(lp,tolerance);}
if(!GEValueCheck.isNull(m_geoms)&&m_geoms.length>0)
{for(var j=0;j<m_geoms.length;j++)
{geoms.push(m_geoms[j]);props.push(mLayer.getProperty(m_geoms[j]));}}}
current=self._trySelection(geoms,current);if(current>=0)
{activeGeom=geoms[current];activeProp=props[current];self.rubberBand.clear();hiliteRender.render(self.rubberBand,activeGeom,activeProp);if(self.singleSelection){op_terminate=true;self.selected(activeGeom);self.terminate(true,activeGeom);e_click=false;return;}}
else if(self.singleSelection)
{self.rubberBand.clear();current=0;geoms=null;props=null;activeGeom=null;activeProp=null;}
e_click=false;}
else if(self.searchMode==GESearchMode.Memory||self.searchMode==GESearchMode.Both)
{var mLayer=self.memoryLayer;if(mLayer==null)
mLayer=self._view.getMemoryLayer();var m_geoms=null;if(self.memorySearchKey!=null)
{m_geoms=mLayer.searchHit(lp,tolerance,self.memorySearchKey);}
else
{m_geoms=mLayer.searchHit(lp,tolerance);}
if(!GEValueCheck.isNull(m_geoms)&&m_geoms.length>0)
{for(var i=0;i<m_geoms.length;i++)
{geoms.push(m_geoms[i]);props.push(mLayer.getProperty(m_geoms[i]));}}
current=self._trySelection(geoms,current);if(current>=0)
{activeGeom=geoms[current];activeProp=props[current];self.rubberBand.clear();hiliteRender.render(self.rubberBand,activeGeom,activeProp);if(self.singleSelection){op_terminate=true;self.selected(activeGeom);self.terminate(true,activeGeom);}}
else if(self.singleSelection)
{self.rubberBand.clear();current=0;geoms=null;props=null;activeGeom=null;activeProp=null;}
e_click=false;}
return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;if(GEEvent.isRightButton(mouseEvent)){if(GEValueCheck.isNull(geoms)||geoms.length==0){op_terminate=true;self.terminate(true,null);e_mousedown=false;return false;}
current++;current=self._trySelection(geoms,current);if(current>=0)
{activeGeom=geoms[current];activeProp=props[current];self.rubberBand.clear();hiliteRender.render(self.rubberBand,activeGeom,activeProp);}
else
{self.rubberBand.clear();current=0;geoms=null;props=null;activeGeom=null;activeProp=null;}}
e_mousedown=false;return false;});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==83)
{if(GEValueCheck.isNull(geoms)||geoms.length==0){op_terminate=true;self.terminate(true,null);e_mousedown=false;return false;}
current++;current=self._trySelection(geoms,current);if(current>=0)
{activeGeom=geoms[current];activeProp=props[current];self.rubberBand.clear();hiliteRender.render(self.rubberBand,activeGeom,activeProp);}
else
{self.rubberBand.clear();current=0;geoms=null;props=null;activeGeom=null;activeProp=null;}}
e_keydown=false;return false;});}
GESelectGeometry.prototype._trySelection=function(geoms,stIdx){if(!GEValueCheck.isNull(geoms)&&geoms.length>0&&stIdx<geoms.length){for(var i=stIdx;i<geoms.length;i++){if(this.validate(geoms[i])){return i;}}}
return-1;}
GESelectGeometry.prototype.validate=function(geom){return true;}
GESelectGeometry.prototype.selected=function(geom){}
GESelectGeometry.prototype.end=function(geom){}
GESelectGeometry.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GESelectGeometry.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._click))
GEEvent.removeListener(this._container,"click",this._click);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._active=false;if(dispatch)this.end(geom);}

function GESizeD(width,height){this.width=GEValueCheck.isNull(width)?0:width;this.height=GEValueCheck.isNull(height)?0:height;}
GESizeD.prototype.isZero=function(){return(this.width==0&&this.height==0);};GESizeD.prototype.swap=function(){var width=this.width;this.width=this.height;this.height=width;};GESizeD.prototype.round=function(digit){if(!GEValueCheck.isNumber(digit))
return;this.width=GEMathSupport.round(this.width,digit);this.height=GEMathSupport.round(this.height,digit);};GESizeD.prototype.equals=function(other){if(GEValueCheck.isNull(other))
return false;if(this.width==other.width&&this.height==other.height)
return true;else
return false;}
GESizeD.prototype.toString=function(){return"Width="+this.width+","+"Height="+this.height;}
GESizeD.prototype.clone=function(){return new GESizeD(this.width,this.height);}

function GESizeUnit(){}
GESizeUnit.Pixel="Pixel";GESizeUnit.World="World";

﻿
function GESnapController(){this.searchMode=GESearchMode.Memory;this.memoryLayer=null;this.memorySearchKey=null;this.layerList=new Array();this.snapToSelf=true;this.tolerance=20;this.toleranceUnit=GESizeUnit.Pixel;}
GESnapController.prototype.execute=function(view,p,accept,accept_points,geom,vIndex){if(GEValueCheck.isNull(view)||GEValueCheck.isNull(p)){return null;}
if(this.searchMode==GESearchMode.Server&&(this.layerList.length==0||!accept))
return null;var tolerance=5;if(GEValueCheck.isNumber(this.tolerance)){if(this.toleranceUnit==GESizeUnit.World){var wsize=view.toLocalSize(new GESizeD(this.tolerance,this.tolerance));tolerance=wsize.width;}
else{tolerance=this.tolerance;}}
var worldTolerance=view.toWorldSize(new GESizeD(tolerance,tolerance));var lp=view.toLocalPoint(p);var snapPoints=new GEPointDList();if((this.searchMode==GESearchMode.Server||this.searchMode==GESearchMode.Both)&&this.layerList.length>0&&accept)
{var rect=GERectangleD.fromCenter(p,worldTolerance);var expression=new GEFeatureExpression();expression.spatial=GESpatialCondition.fromPolygon(GEPolygon.fromRectangle(rect),GESpatialRelation.Intersects);for(var i=0;i<this.layerList.length;i++){var features=this.layerList[i].queryFeature(expression);if(features==null||features.length==0)
continue;for(var j=0;j<features.length;j++){if(features[j]==null||features[j].geometry==null)
continue;if(features[j].geometry.hide)continue;var np=features[j].geometry.getNearestPoint(p);if(p.distanceAt(np)<=worldTolerance.width){snapPoints.add(np);}}}}
if(this.searchMode==GESearchMode.Memory||this.searchMode==GESearchMode.Both)
{var mLayer=this.memoryLayer;if(mLayer==null)
mLayer=view.getMemoryLayer();var geoms=null;if(this.memorySearchKey!=null)
{geoms=mLayer.searchHit(lp,tolerance,this.memorySearchKey);}
else
{geoms=mLayer.searchHit(lp,tolerance);}
if(!GEValueCheck.isNull(geoms)&&geoms.length>0)
{for(var i=0;i<geoms.length;i++)
{if(geoms[i].hide)continue;if(geoms[i]==geom)
continue;var sp=geoms[i].getNearestPoint(p);if(p.distanceAt(sp)<=worldTolerance.width){snapPoints.add(sp);}}}}
if(this.snapToSelf)
{if(accept_points!=null&&accept_points.count()>1)
{var mbr=accept_points.mbr();mbr.inflate(worldTolerance.width*2,worldTolerance.height*2);if(mbr.contains(p))
{var checkPoints=accept_points.clone();checkPoints.removeAt(checkPoints.count()-1);var sp=checkPoints.getNearestPoint(p);if(p.distanceAt(sp)<=worldTolerance.width){snapPoints.add(sp);}}}
if(geom!=null)
{var checkPoints=geom.getCoordinates();if(vIndex){checkPoints.removeAt(vIndex);}
var sp=checkPoints.getNearestPoint(p);if(p.distanceAt(sp)<=worldTolerance.width){snapPoints.add(sp);}}}
if(snapPoints.count()>0)
{return snapPoints.getNearestPoint(p);}
else
{return p;}}

function GESortOrder(){}
GESortOrder.None=0;GESortOrder.Asc=1;GESortOrder.Desc=2;

function GESpatialCondition(){this._isRange=false;this._range=null;this._relation=GESpatialRelation.Intersects;this._geom=null;}
GESpatialCondition.mbrIntersects=function(range){var condition=new GESpatialCondition();condition._isRange=true;condition._range=GEValueCheck.isNull(range)?new GERectangleD():range;condition._relation=GESpatialRelation.Intersects;condition._geom=null;return condition;}
GESpatialCondition._fromGeometry=function(geom,relation){var condition=new GESpatialCondition();condition._isRange=false;condition._range=null;condition._relation=relation;condition._geom=geom;return condition;}
GESpatialCondition.fromPoint=function(geom,relation){return GESpatialCondition._fromGeometry(geom,relation);}
GESpatialCondition.fromLineString=function(geom,relation){return GESpatialCondition._fromGeometry(geom,relation);}
GESpatialCondition.fromPolygon=function(geom,relation){return GESpatialCondition._fromGeometry(geom,relation);}
GESpatialCondition.fromEllipse=function(geom,relation){return GESpatialCondition._fromGeometry(geom,relation);}
GESpatialCondition.prototype.toResponseText=function(){if(this._isRange){var range=this._range;var size=range.getSize();return escape("MBRIntersects("+
GEMathSupport.round(range.min.x,4).toString()+" "+GEMathSupport.round(range.min.y,4).toString()+", "+
GEMathSupport.round(size.width,4).toString()+", "+GEMathSupport.round(size.height,4).toString()+")");}
else{if(GEValueCheck.isNull(this._geom))
return"";return escape(this._relation+"('"+this._geom.toText()+"')");}}

function GESpatialRelation(){}
GESpatialRelation.Contains="Contains";GESpatialRelation.Crosses="Crosses";GESpatialRelation.Equals="Equals";GESpatialRelation.Intersects="Intersects";GESpatialRelation.Overlaps="Overlaps";GESpatialRelation.Touches="Touches";GESpatialRelation.Within="Within";

﻿
function GESpatials(){}
GESpatials.pointIn=function(p,points){if(points==null||points.count()<3)
return false;var pointCount=0;if(points.items[0].equals(points.items[points.count()-1])){pointCount=points.count()-1;}
else{pointCount=points.count();}
var totalAngle=0.0;var totalPoint=0;var lastP=new GEPointD();for(var i=0;i<pointCount;i++){if(points.items[i]==lastP)
continue;else
lastP=points.items[i];var next=i+1;if(next>=pointCount)
next=0;while(points.items[i]==points.items[next]&&next!=i){next++;if(next>=pointCount)
next=0;}
if(next==i)
return false;var a1=GERadian.getRadian(p,points.items[i]);a1=GERadian.revise(a1);var a2=GERadian.getRadian(points.items[next],p);a2=GERadian.revise(a2);var r=(a2-a1);r=GERadian.revise(r);totalAngle+=r;totalPoint++;}
if(totalPoint<3)
return false;totalAngle=GEMathSupport.round(totalAngle,5);var checkAngle1=GEMathSupport.round(Math.PI*(totalPoint-2),5);var checkAngle2=GEMathSupport.round(Math.PI*(totalPoint+2),5);if(checkAngle1==totalAngle||checkAngle2==totalAngle){return true;}
else{return false;}}
GESpatials.isCross=function(p1,p2,p3,p4){if((p1.equals(p3)&&p2.equals(p4))||(p1.equals(p4)&&p2.equals(p3)))
return false;if(GERadian.getRadian(p1,p2)==GERadian.getRadian(p3,p4))
return false;if(p1.x>=p2.x){if((p1.x<p3.x&&p1.x<p4.x)||(p2.x>p3.x&&p2.x>p4.x))
return false;}
else{if((p2.x<p3.x&&p2.x<p4.x)||(p1.x>p3.x&&p1.x>p4.x))
return false;}
if(p1.y>=p2.y){if((p1.y<p3.y&&p1.y<p4.y)||(p2.y>p3.y&&p2.y>p4.y))
return false;}
else{if((p2.Y<p3.Y&&p2.Y<p4.Y)||(p1.Y>p3.Y&&p1.Y>p4.Y))
return false;}
if(((p1.x-p2.x)*(p3.y-p1.y)+(p1.y-p2.y)*(p1.x-p3.x))*((p1.x-p2.x)*(p4.y-p1.y)+(p1.y-p2.y)*(p1.x-p4.x))>0.0)
return false;if(((p3.x-p4.x)*(p1.y-p3.y)+(p3.y-p4.y)*(p3.x-p1.x))*((p3.x-p4.x)*(p2.y-p3.y)+(p3.y-p4.y)*(p3.x-p2.x))>0.0)
return false;return true;}
GESpatials.polygonDirection=function(points)
{if(points==null||points.count()<3)
return-1;var checkPoints=points.clone();checkPoints.removeOverlap();for(var i=0;i<checkPoints.count()-1;i++)
{var p1=checkPoints.items[i];var p2=checkPoints.items[i+1];for(var j=0;j<checkPoints.count()-1;j++)
{if(j==i||j==(i+1))continue;var p3=checkPoints.items[j];var p4=checkPoints.items[j+1];if(p1.equals(p3)||p1.equals(p4)||p2.equals(p3)||p2.equals(p4))continue;if(GESpatials.isCross(p1,p2,p3,p4))
{return-1;}}}
checkPoints.removeAt(checkPoints.count()-1);var pointCount=checkPoints.count();var totalAngle=0.0;var totalPoint=0;for(var i=0;i<pointCount;i++)
{var next=i+1;if(next>=pointCount)next=0;while(checkPoints.items[i].equals(checkPoints.items[next])&&next!=i)
{next++;if(next>=pointCount)
next=0;}
if(next==i)
return-1;var prev=i-1;if(prev<0)
prev=pointCount-1;while(checkPoints.items[i].equals(checkPoints.items[prev])&&prev!=i)
{prev--;if(prev<0)
prev=pointCount-1;}
if(prev==i)
return-1;var a1=GERadian.getRadian(checkPoints.items[i],checkPoints.items[prev]);a1=GERadian.revise(a1);var a2=GERadian.getRadian(checkPoints.items[i],checkPoints.items[next]);a2=GERadian.revise(a2);var r=(a2-a1);r=GERadian.revise(r);totalAngle+=r;totalPoint++;}
totalAngle=GEMathSupport.round(totalAngle,5);var checkAngle=GEMathSupport.round(Math.PI*(totalPoint-2),5);if(totalAngle==checkAngle)
{return 0;}
else
{checkAngle=GEMathSupport.round(Math.PI*(totalPoint+2),5);if(totalAngle==checkAngle)
{return 1;}
else
{return-1;}}}

function GEStringBuilder()
{this._k=-1;this._b=[];}
GEStringBuilder.prototype=new String();GEStringBuilder.prototype.append=function(){for(var i=0,f=arguments.length;i<f;i++)
{if(!arguments[i]){return;};this._b[++this._k]=arguments[i];}}
GEStringBuilder.prototype.toString=function(s){return this._b.join(s||'');}

function GEStringCondition(){this._value="";}
GEStringCondition.equals=function(value){var condition=new GEStringCondition();condition._value=!GEValueCheck.isString(value)?"":"='"+value+"'";return condition;}
GEStringCondition.notEquals=function(value){var condition=new GEStringCondition();condition._value=!GEValueCheck.isString(value)?"":"!='"+value+"'";return condition;}
GEStringCondition.like=function(value){var condition=new GEStringCondition();condition._value=!GEValueCheck.isString(value)?"":"'%"+value+"%'";return condition;}
GEStringCondition.prefixMatch=function(value){var condition=new GEStringCondition();condition._value=!GEValueCheck.isString(value)?"":"'"+value+"%'";return condition;}
GEStringCondition.suffixMatch=function(value){var condition=new GEStringCondition();condition._value=!GEValueCheck.isString(value)?"":"'%"+value+"'";return condition;}
GEStringCondition.prototype.toResponseText=function(){return!GEValueCheck.isString(this._value)?"":escape(this._value);}

function GETextProperty(){this.fontColor=new GEColor(0,0,0);this.backColor=null;this.fontSize=10;this.sizeUnit=GESizeUnit.Pixel;this.fontName="ＭＳ Ｐゴシック";this.offset=new GESizeD(0,0);}
GETextProperty.prototype.getPropertyType=function(){return GEPropertyType.Text;}
GETextProperty.prototype.toResponseText=function(){var result="";result+="&pt="+this.getPropertyType();if(!GEValueCheck.isNull(this.fontColor)){var str=this.fontColor.toResponseText();if(str.length>0){result+="&fc="+str;}}
if(!GEValueCheck.isNull(this.backColor)){var str=this.backColor.toResponseText();if(str.length>0){result+="&bc="+str;}}
if(!GEValueCheck.isNull(this.fontSize)){var str=this.fontSize.toString();if(str.length>0){result+="&fs="+str;}}
if(!GEValueCheck.isNull(this.sizeUnit)){var str=this.sizeUnit;if(str.length>0){result+="&ut="+str;}}
if(!GEValueCheck.isNull(this.fontName)){var str=escape(this.fontName);if(str.length>0){result+="&fn="+str;}}
if(!GEValueCheck.isNull(this.offset)){var str=this.offset.width+","+this.offset.height;if(str.length>0){result+="&of="+str;}}
return result;}
GETextProperty.prototype.toJSON=function(){var result=new GEStringBuilder();result.append('{');result.append('"pt":"'+this.getPropertyType()+'"');if(!GEValueCheck.isNull(this.fontColor)){result.append(',"fc":"'+this.fontColor.toString()+'"');}
if(!GEValueCheck.isNull(this.backColor)){result.append(',"bc":"'+this.backColor.toString()+'"');}
if(!GEValueCheck.isNull(this.fontSize)){result.append(',"fs":"'+this.fontSize.toString()+'"');}
if(!GEValueCheck.isNull(this.sizeUnit)){result.append(',"ut":"'+this.sizeUnit+'"');}
if(!GEValueCheck.isNull(this.fontName)){result.append(',"fn":"'+GEConvert.toJSONText(this.fontName)+'"');}
if(!GEValueCheck.isNull(this.offset)){result.append(',"of":"'+this.offset.width.toString()+","+this.offset.height.toString()+'"');}
result.append('}');return result.toString();}
GETextProperty.fromJSON=function(obj){if(obj==null)
return null;var result=new GETextProperty();if(!GEValueCheck.isNull(obj.fc))
result.fontColor=GEColor.fromString(obj.fc);if(!GEValueCheck.isNull(obj.bc))
result.backColor=GEColor.fromString(obj.bc);if(!GEValueCheck.isNull(obj.fs))
result.fontSize=Number(obj.fs);if(!GEValueCheck.isNull(obj.ut))
result.sizeUnit=obj.ut;if(!GEValueCheck.isNull(obj.fn))
result.fontName=obj.fn;if(!GEValueCheck.isNull(obj.of)){var offsetItems=obj.of.split(',');result.offset=new GESizeD(Number(offsetItems[0]),Number(offsetItems[1]));}
return result;}

﻿
function GETileMap(serverPath,ws_id,name,option){if(!name)name='';this._name=name;if(!GEValueCheck.isString(serverPath))
GEError.argument('serverPath');else
this._serverPath=serverPath;if(!GEValueCheck.isString(ws_id))
GEError.argument('ws_id');else
this._ws_id=ws_id;if(option){this.option=eval('('+option+')');}else{this.option=new Object();}
if(this.option.istranspng==undefined)
this.option.istranspng=false;if(this.option.bgcolor==undefined)
this.option.bgcolor='';if(this.option.transparent==undefined)
this.option.transparent='';if(this.option.precache==undefined)
this.option.precache=true;if(this.option.extension==undefined)
this.option.extension='png';if(this.option.serviceName==undefined)
this.option.serviceName='TileImage.aspx';if(this.option.useCache==undefined)
this.option.useCache=true;if(this.option.tileSize==undefined)
this.option.tileSize=new GESizeD(300,300);else
this.option.tileSize=new GESizeD(this.option.tileSize,this.option.tileSize);if(this.option.maxscale==undefined)
this.option.maxscale=0;if(this.option.minscale==undefined)
this.option.minscale=0;if(this.option.scrolling==undefined)
this.option.scrolling=true;if(this.option.async_loading==undefined)
this.option.async_loading=true;if(this.option.debug==undefined)
this.option.debug=false;this._transImg=GEAJAX.path+'/resources/'+'transparent.gif';this._ELEMENT_ID_CONTAINER="GETileMap";this._ELEMENT_ID_TILECONTAINER="GETileMap_Cntr";this._view=null;this._mapContainer=null;this._tileContainer=null;this._animeContainer=null;this._viewevent_onresize=null;this._viewevent_onscroll=null;this._viewevent_onscrollend=null;this._tileCols=0;this._tileRows=0;this._activeScale=0;this._tileWorldSize=null;this._allTileSize=null;this._scrollBufferLT=null;this._scrollBufferRB=null;this._tileMaxCols=0;this._tileMaxRows=0;}
GETileMap.prototype.getName=function(){return this._name;}
GETileMap.prototype.getServerPath=function(){return this._serverPath;}
GETileMap.prototype.getId=function(){return this._ws_id;}
GETileMap.prototype.isAttached=function(){return(this._view!=null&&this._mapContainer!=null);}
GETileMap.prototype.getzIndex=function(zIndex){if(!this.isAttached())return;return this._mapContainer.style.zIndex;}
GETileMap.prototype.setzIndex=function(zIndex){if(!this.isAttached())return;if(!GEValueCheck.isNumber(zIndex))
GEError.argument('zIndex');this._mapContainer.style.zIndex=zIndex;}
GETileMap.prototype.getVisible=function(){if(!this.isAttached())return false;return this._mapContainer.style.display!='none';}
GETileMap.prototype.setVisible=function(visible,refresh){if(!this.isAttached())return;if(!refresh)refresh=false;if(visible){this._mapContainer.style.display='block';if(refresh)this.refresh("visible_changed");}else{this._mapContainer.style.display='none';}}
GETileMap.prototype.getFeatureQueryCommand=function(){return new GELayerQueryCommand(this,this._serverPath);}
GETileMap.prototype.getLayers=function(expression){if(this.option.precache)
return null;var command=new GELayerQueryCommand(this,this._serverPath);return command.execute(this._ws_id,expression);}
GETileMap.prototype.getLayerById=function(id){if(!GEValueCheck.isNumber(id))
return null;if(this.option.precache)
return null;var command=new GELayerQueryCommand(this,this._serverPath);var expression=new GELayerExpression();expression.sid=GENumberCondition.equals(id);return command.execute(this._ws_id,expression);}
GETileMap.prototype.getLayersById=function(idArray){if(idArray==null||idArray.length==0)
return null;if(this.option.precache)
return null;var command=new GELayerQueryCommand(this,this._serverPath);var expression=new GELayerExpression();expression.sid=GENumberCondition.or(idArray);return command.execute(this._ws_id,expression);}
GETileMap.prototype.attach=function(view,viewContainer){if(this.isAttached())return false;this._view=view;this._activeScale=view.getScale();var pixelSize=this._view.getPixelWorld();this._tileWorldSize=new GESizeD(pixelSize.width*this.option.tileSize.width,pixelSize.height*this.option.tileSize.height);pixelSize=null;var totalSize=this._view.getCoordinateSpace().getSize();this._tileMaxCols=Math.ceil(totalSize.width/this._tileWorldSize.width);this._tileMaxRows=Math.ceil(totalSize.height/this._tileWorldSize.height);totalSize=null;var tileRange=this._getTileRange();this._tileCols=tileRange.getWidth();this._tileRows=tileRange.getHeight();this._allTileSize=new GESizeD(this._tileCols*this.option.tileSize.width,this._tileRows*this.option.tileSize.height);tileRange=null;var self_tileMap=this;this._viewevent_onresize=GEEvent.addListener(view,'onresize',function(event)
{self_tileMap._onresize();});this._viewevent_onscroll=GEEvent.addListener(view,'onscroll',function(event)
{if(self_tileMap.option.scrolling)
self_tileMap._onscroll();});this._viewevent_onscrollend=GEEvent.addListener(view,'onscrollend',function(event)
{if(!self_tileMap.option.scrolling){self_tileMap._onscroll();}});this._mapContainer=document.createElement('div');this._mapContainer.id=this._ELEMENT_ID_CONTAINER+'_'+GEFunctions.getRandomString();viewContainer.appendChild(this._mapContainer);GEFunctions.setStyle(this._mapContainer,"display: block;"+"position: absolute;"+"left: 0px;"+"top: 0px;");GEEvent.disableDragEventOnIE(this._mapContainer);if(!GEBrowser.isIE()){this._mapContainer.onclick=GEEvent.stopEvent;this._mapContainer.ondblclick=GEEvent.stopEvent;this._mapContainer.onmousedown=GEEvent.stopEvent;this._mapContainer.onmousemove=GEEvent.stopEvent;this._mapContainer.onmouseup=GEEvent.stopEvent;}
this._tileContainer=document.createElement('div');this._tileContainer.id=this._ELEMENT_ID_TILECONTAINER+'_'+GEFunctions.getRandomString();this._mapContainer.appendChild(this._tileContainer);GEFunctions.setStyle(this._tileContainer,"position: absolute;"+"left: 0px;"+"top: 0px;"+"z-index: 0;");GEEvent.disableDragEventOnIE(this._tileContainer);if(!GEBrowser.isIE()){this._tileContainer.onclick=GEEvent.stopEvent;this._tileContainer.ondblclick=GEEvent.stopEvent;this._tileContainer.onmousedown=GEEvent.stopEvent;this._tileContainer.onmousemove=GEEvent.stopEvent;this._tileContainer.onmouseup=GEEvent.stopEvent;}
this._createTiles();var scale=this._view.getScale();var visible=((this.option.maxscale==0||this.option.maxscale<=scale)&&(this.option.minscale==0||this.option.minscale>=scale));this.setVisible(visible,false);this._animeContainer=this._tileContainer.cloneNode(false);this._mapContainer.appendChild(this._animeContainer);return true;}
GETileMap.prototype._getTileRange=function(){var coordinateSpace=this._view.getCoordinateSpace();var viewRange=this._view.getRange();var lb=new GEPointD(Math.floor((viewRange.min.x-coordinateSpace.min.x)/this._tileWorldSize.width)-2,Math.floor((coordinateSpace.max.y-viewRange.max.y)/this._tileWorldSize.width)-2);var rt=new GEPointD(Math.floor((viewRange.max.x-coordinateSpace.min.x)/this._tileWorldSize.width)+2,Math.floor((coordinateSpace.max.y-viewRange.min.y)/this._tileWorldSize.width)+2);coordinateSpace=null;viewRange=null;return new GERectangleD(lb,rt);}
GETileMap.prototype.detach=function(view,viewContainer){if(!this.isAttached())return;if(this._tileContainer.childNodes.length>0)
{for(var i=this._tileContainer.childNodes.length-1;i>=0;i--){var img=this._tileContainer.childNodes[i];GEEvent.resetDragEventOnIE(img);GEEvent.clearListener(img);img.src='';this._tileContainer.removeChild(img);img=null;}}
GEEvent.removeListener(view,'onresize',this._viewevent_onresize);GEEvent.removeListener(view,'onscroll',this._viewevent_onscroll);GEEvent.removeListener(view,'onscrollend',this._viewevent_onscrollend);this._viewevent_onresize=null;this._viewevent_onscroll=null;this._viewevent_onscrollend=null;GEEvent.resetDragEventOnIE(this._animeContainer);GEEvent.resetDragEventOnIE(this._tileContainer);GEEvent.resetDragEventOnIE(this._mapContainer);viewContainer.removeChild(this._mapContainer);this._mapContainer.innerHTML='';this._mapContainer=null;this._animeContainer=null;this._tileContainer=null;this._view=null;}
GETileMap.prototype._createTiles=function(){var cloneContainer=this._tileContainer;if(cloneContainer.childNodes.length>0)
{for(var i=cloneContainer.childNodes.length-1;i>=0;i--){var img=cloneContainer.childNodes[i];GEEvent.resetDragEventOnIE(img);GEEvent.clearListener(img);img.src='';cloneContainer.removeChild(img);img=null;}}
var viewSize=this._view.getSize();var bufferX=Math.ceil(((this._tileCols*this.option.tileSize.width)-viewSize.width)/2);var bufferY=Math.ceil(((this._tileRows*this.option.tileSize.height)-viewSize.height)/2);viewSize=null;var tile_base=document.createElement('img');GEFunctions.setStyle(tile_base,"position: absolute;"+"width: "+this.option.tileSize.width+"px;"+"height: "+this.option.tileSize.height+"px;"+"margin: 0px;"+"padding: 0px;");GEFunctions.setImageSrc(tile_base,this._transImg,false,false);for(var x=0;x<this._tileCols;x++)
{for(var y=0;y<this._tileRows;y++)
{var tile=tile_base.cloneNode(false);GEFunctions.setStyle(tile,"position: absolute;"+"width: "+this.option.tileSize.width+"px;"+"height: "+this.option.tileSize.height+"px;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"left: "+parseInt((this.option.tileSize.width*x)-bufferX)+"px;"+"top: "+parseInt((this.option.tileSize.height*y)-bufferY)+"px;");GEEvent.disableDragEventOnIE(tile);if(!GEBrowser.isIE()){tile.onclick=GEEvent.stopEvent;tile.ondblclick=GEEvent.stopEvent;tile.onmousedown=GEEvent.stopEvent;tile.onmousemove=GEEvent.stopEvent;tile.onmouseup=GEEvent.stopEvent;}
cloneContainer.appendChild(tile);tile=null;}}
GEEvent.clearListener(tile_base);tile_base.src='';tile_base=null;}
GETileMap.prototype.onzoomstart=function(){if(this._view==null)return;if(!this.getVisible())return;var cloneContainer=this._tileContainer.cloneNode(true);this._mapContainer.replaceChild(cloneContainer,this._animeContainer);this._animeContainer=cloneContainer;this._animeContainer.style.display='block';this._tileContainer.style.zIndex=0;this._animeContainer.style.zIndex=10;}
GETileMap.prototype.onzoom=function(e)
{var w,h;var p=new GEPointD();for(var i=0;i<this._animeContainer.childNodes.length;i++)
{var tile=this._animeContainer.childNodes[i];if(i==0){w=parseInt(tile.style.width)*e.ds;h=parseInt(tile.style.height)*e.ds;}
p.x=parseInt(tile.style.left);p.y=parseInt(tile.style.top);p=e.matrix.transform(p);GEFunctions.setStyle(tile,"position: absolute;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"left : "+(p.x+e.dx)+"px;"+"top : "+(p.y+e.dy)+"px;"+"width : "+w+"px;"+"height : "+h+"px;");}}
GETileMap.prototype.onzoomend=function()
{this._tileContainer.style.zIndex=10;this._animeContainer.style.zIndex=0;}
GETileMap.prototype._onscroll=function(){if(this._view==null)return;if(!this.getVisible())return;var view_left=this._view._viewContainer.offsetLeft;var view_top=this._view._viewContainer.offsetTop;for(var i=0;i<this._tileContainer.childNodes.length;i++)
{var tile=this._tileContainer.childNodes[i];var index=tile.id.split('_');var left=tile.offsetLeft+view_left;var top=tile.offsetTop+view_top;var right=left+tile.offsetWidth;var bottom=top+tile.offsetHeight;if(left>this._scrollBufferRB.x){tile.style.left=GEFunctions.createPx((left-view_left)-this._allTileSize.width);index[0]=parseInt(index[0])-this._tileCols;}
else if(right<this._scrollBufferLT.x){tile.style.left=GEFunctions.createPx((left-view_left)+this._allTileSize.width);index[0]=parseInt(index[0])+this._tileCols;}
if(top>this._scrollBufferRB.y){tile.style.top=GEFunctions.createPx((top-view_top)-this._allTileSize.height);index[1]=parseInt(index[1])-this._tileRows;}
else if(bottom<this._scrollBufferLT.y){tile.style.top=GEFunctions.createPx((top-view_top)+this._allTileSize.height);index[1]=parseInt(index[1])+this._tileRows;}
var newId=index[0]+'_'+index[1];if(tile.id!=newId)
{tile.id=newId;GEFunctions.setImageSrc(tile,this._transImg,false,false);var url=this._getImageUrl(index[0],index[1],this._activeScale);if(this.option.async_loading)
this._setImageAsync(tile,url,this.option.istranspng,i,this._view);else
GEFunctions.setImageSrc(tile,url,this.option.istranspng,true,this._view);}
tile=null;}}
GETileMap.prototype._onresize=function(){var tileRange=this._getTileRange();this._tileCols=tileRange.getWidth();this._tileRows=tileRange.getHeight();this._allTileSize=new GESizeD(this._tileCols*this.option.tileSize.width,this._tileRows*this.option.tileSize.height);tileRange=null;}
GETileMap.prototype.refresh=function(reason){if(!this.isAttached())return;if(reason=='scroll')return;if(!this.getVisible())return;var pixelSize=this._view.getPixelWorld();var coordinateSpace=this._view.getCoordinateSpace();switch(reason){case'resize':var tileRange=this._getTileRange();this._tileCols=tileRange.getWidth();this._tileRows=tileRange.getHeight();this._allTileSize=new GESizeD(this._tileCols*this.option.tileSize.width,this._tileRows*this.option.tileSize.height);tileRange=null;this._createTiles();break;case'scale_changed':this._tileWorldSize=new GESizeD(pixelSize.width*this.option.tileSize.width,pixelSize.height*this.option.tileSize.height);var totalSize=coordinateSpace.getSize();this._tileMaxCols=Math.ceil(totalSize.width/this._tileWorldSize.width);this._tileMaxRows=Math.ceil(totalSize.height/this._tileWorldSize.height);totalSize=null;break;}
this._activeScale=this._view.getScale();if(!((this.option.maxscale==0||this.option.maxscale<=this._activeScale)&&(this.option.minscale==0||this.option.minscale>=this._activeScale)))return;var centerP=this._view.getCenter();var ctile_x=Math.floor((centerP.x-coordinateSpace.min.x)/this._tileWorldSize.width);var ctile_y=Math.floor((coordinateSpace.max.y-centerP.y)/this._tileWorldSize.height);var stile_x=ctile_x-Math.floor(this._tileCols/2);var stile_y=ctile_y-Math.floor(this._tileRows/2);var viewPort=this._view.getViewPort();var tileStartX=Math.floor(viewPort.min.x+(viewPort.getWidth()/2)-((ctile_x-stile_x)*this.option.tileSize.width));var tileStartY=Math.floor(viewPort.min.y+(viewPort.getHeight()/2)-((ctile_y-stile_y)*this.option.tileSize.height));tileStartX-=Math.floor(((centerP.x-coordinateSpace.min.x)-(ctile_x*this._tileWorldSize.width))/pixelSize.width);tileStartY-=Math.floor(((coordinateSpace.max.y-centerP.y)-(ctile_y*this._tileWorldSize.height))/pixelSize.height);this._scrollBufferLT=new GEPointD((viewPort.min.x-tileStartX)*-1,(viewPort.min.y-tileStartY)*-1);this._scrollBufferRB=new GEPointD(this._scrollBufferLT.x+this._allTileSize.width,this._scrollBufferLT.y+this._allTileSize.height);viewPort=null;centerP=null;var cloneContainer;if(reason=='scale_changed'){cloneContainer=this._tileContainer.cloneNode(true);}else{cloneContainer=this._tileContainer;}
var tileIndex=0;var posX=parseInt(tileStartX);for(var x=0;x<this._tileCols;x++)
{var posY=parseInt(tileStartY);for(var y=0;y<this._tileRows;y++)
{var xi=x+stile_x;var yi=y+stile_y;var tile=cloneContainer.childNodes[tileIndex];var newId=xi+'_'+yi;tile.id=newId;GEFunctions.setStyle(tile,"position: absolute;"+"width: "+this.option.tileSize.width+"px;"+"height: "+this.option.tileSize.height+"px;"+"margin: 0px;"+"padding: 0px;"+"border: none;"+"left: "+posX+"px;"+"top: "+posY+"px;");if(!GEBrowser.isIE()){tile.onclick=GEEvent.stopEvent;tile.ondblclick=GEEvent.stopEvent;tile.onmousedown=GEEvent.stopEvent;tile.onmousemove=GEEvent.stopEvent;tile.onmouseup=GEEvent.stopEvent;}
GEFunctions.setImageSrc(tile,this._transImg,false,false);if(xi<=this._tileMaxCols&&yi<=this._tileMaxRows)
{var url=this._getImageUrl(xi,yi,this._activeScale);if(this.option.async_loading)
this._setImageAsync(tile,url,this.option.istranspng,tileIndex,this._view);else
GEFunctions.setImageSrc(tile,url,this.option.istranspng,true,this._view);}
tile=null;tileIndex++;posY+=this.option.tileSize.height;}
posX+=this.option.tileSize.width;}
if(reason=='scale_changed')
{for(var i=this._tileContainer.childNodes.length-1;i>=0;i--){var img=this._tileContainer.childNodes[i];this._tileContainer.removeChild(img);GEEvent.clearListener(img);img.src='';img=null;}
this._mapContainer.replaceChild(cloneContainer,this._tileContainer);this._tileContainer=null;this._tileContainer=cloneContainer;}
cloneContainer=null;pixelSize=null;coordinateSpace=null;}
GETileMap.prototype._setImageAsync=function(img,url,isTransPng,i,view)
{var t=img;var u=url;var trans=isTransPng;var v=view;if(i==undefined)i=0;setTimeout(function()
{GEFunctions.setImageSrc(t,u,trans,true,v);},i);}
GETileMap.prototype._getImageUrl=function(x,y,scale){if(x<0||y<0||x>=this._tileMaxCols||y>=this._tileMaxRows)
{return this._transImg;}
else
{if(this.option.precache)
{var sub_dir=this._ws_id+'/'+scale+'/'+Math.floor(x/10.0)+'_'+Math.floor(y/10.0)+'/';var url=this._serverPath+sub_dir+x+'_'+y+'_'+this.option.tileSize.width+'_'+this.option.tileSize.height+'.'+this.option.extension;if(this.option.debug){GEDebug.write(url);}
return url;}
else
{var param="?ws="+this._ws_id+"&x="+x+"&y="+y+"&sc="+scale+"&w="+this.option.tileSize.width+"&h="+this.option.tileSize.height;if(!this.option.useCache)param+="&c=0";if(this.option.bgcolor!=''){param+='&bg='+this.option.bgcolor;}
if(this.option.transparent!=''){param+='&tp='+this.option.transparent;}
var url=this._serverPath+this.option.serviceName+param;if(this.option.debug){GEDebug.write(url);}
return url;}}};

function GETimeAxisCondition(){this._t1=null;this._t2=null;this._spanMode=null;}
GETimeAxisCondition.fromPoint=function(value){var condition=new GETimeAxisCondition();condition._t1=GEValueCheck.isNull(value)?null:GEFunctions.dateToString(value);condition._t2=GEValueCheck.isNull(value)?null:GEFunctions.dateToString(value);condition._spanMode=null;return condition;}
GETimeAxisCondition.fromSpan=function(t1,t2,spanMode){var condition=new GETimeAxisCondition();condition._t1=GEValueCheck.isNull(t1)?null:GEFunctions.dateToString(t1);condition._t2=GEValueCheck.isNull(t2)?null:GEFunctions.dateToString(t2);condition._spanMode=spanMode;return condition;}
GETimeAxisCondition.prototype.toResponseText=function(){if(GEValueCheck.isNull(this._t1)||GEValueCheck.isNull(this._t2))
return"";if(this._t1!=this._t2&&GEValueCheck.isNull(this._spanMode))
return"";if(GEValueCheck.isNull(this._spanMode)){return escape("("+this._t1+")");}
else{return escape(this._spanMode.toString()+"("+this._t1+", "+this._t2+")");}}

function GETimeSpanMode(){}
GETimeSpanMode.All="All";GETimeSpanMode.Birth="Birth";GETimeSpanMode.Death="Death";

function GETrackEllipse(property){if(GEValueCheck.isNull(property)){this.property=new GEEllipseProperty();this.property.fillColor=null;}else{this.property=property;}
this.rubberBand=null;this._view=null;this._container=null;this._contextmenu=null;this._active=false;this.enableSnap=false;this.snapController=new GESnapController();}
GETrackEllipse.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._active=true;var self=this;var op_terminate=false;var keyCode=null;var p1=null;var p2=null;var dragFlg=false;this._view.disablePanning();this._view.disableDragging();this._view.changeCursor(GECursor.Cross);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;refreshRubberBand();});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(GEEvent.isCtrlKey(event)&&keyCode==90&&p1!=null)
{p1=null;refreshRubberBand();dragFlg=false;}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){if(op_terminate)return false;keyCode=null;});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;p1=null;if(GEEvent.isLeftButton(mouseEvent)){p1=self._view.getWorldPoint(mouseEvent);p1=self.replacePointInternal(p1,true,keyCode);if(p1!=null)
{dragFlg=true;}}
e_mousedown=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(document,'mouseup',function(mouseEvent){var TRACK_TOLERANCE=10;if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;if(GEEvent.isLeftButton(mouseEvent)&&dragFlg){dragFlg=false;var p=self._view.getWorldPoint(mouseEvent);if(p1==null||p1.distanceAt(p)<=self._view.toWorldSize(new GESizeD(TRACK_TOLERANCE,TRACK_TOLERANCE)).width)
{self.rubberBand.clear();e_mouseup=false;return false;}
p=self.replacePointInternal(p,true,keyCode);if(p!=null)
{var geom=GEEllipse.fromRectangle(new GERectangleD(p1,p));op_terminate=true;self.trackComplete(geom);self.terminate(true,geom);}}
else if(GEEvent.isRightButton(mouseEvent)&&!dragFlg){self.terminate(true,null);}
dragFlg=false;e_mouseup=false;return false;});var e_mousemove=false;var back_p=new GEPointD();this._mousemove=GEEvent.addListener(document,'mousemove',function(mouseEvent){if(!dragFlg||GEValueCheck.isNull(p1))return false;cursorP=self._view.getLocalPoint(mouseEvent);self._view.changeCursor(GECursor.Cross);if(GEBrowser.isOpera()){var now_p=self._view.getLocalPoint(mouseEvent);if(Math.abs(back_p.x-now_p.x)<5&&Math.abs(back_p.y-now_p.y)<5){mouseEvent.button=1;}
back_p=now_p;}
refreshRubberBand();e_mousemove=false;return false;});function refreshRubberBand()
{self.rubberBand.clear();if(p1==null||cursorP==null)return;var p=self._view.toWorldPoint(cursorP);p=self.replacePointInternal(p,false,keyCode);var pointList=new GEPointDList();pointList.add(p1);pointList.add(p);var min=self._view.toLocalPoint(pointList.minPoint());var max=self._view.toLocalPoint(pointList.maxPoint());var center=self._view.toLocalPoint(pointList.center());var xAxis=(max.x-min.x)/2;var yAxis=(min.y-max.y)/2;self.rubberBand.drawEllipse(center,xAxis,yAxis,0.0,self.property);}}
GETrackEllipse.prototype.replacePointInternal=function(p,accept,keycode,pp)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var points=new GEPointDList();points.add(pp);var sp=this.snapController.execute(this._view,p,accept,points);if(accept&&sp.equals(p))
return null;else
p=sp;}
return this.replacePoint(p,accept,keycode,pp);}
GETrackEllipse.prototype.replacePoint=function(p,accept,keycode,pp)
{return p;}
GETrackEllipse.prototype.trackComplete=function(geom){}
GETrackEllipse.prototype.end=function(geom){}
GETrackEllipse.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GETrackEllipse.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(document,"mouseup",this._mouseup);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(document,"mousemove",this._mousemove);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._view.enableDragging();this._active=false;if(dispatch)this.end(geom);}

﻿
function GETrackLineString(property){this.property=GEValueCheck.isNull(property)?new GELinearProperty():property;this.drawVertex=true;this.rubberBand=null;this._view=null;this._container=null;this._active=false;this.enableSnap=false;this.fixedMode=false;this.snapController=new GESnapController();this.vertexProperty=new GEPointProperty();this.vertexProperty.outlineColor=new GEColor(0,0,0);this.vertexProperty.fillColor=new GEColor(255,255,255);this.vertexProperty.pointType=GEPointType.SolidSquare;this.vertexProperty.pointSize=10;}
GETrackLineString.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._active=true;var self=this;var op_terminate=false;var pointList=new GEPointDList();var keyCode=null;var clickP=null;var cursorP=null;var dragFlg=false;var viewScroll=false;var activeCenterP=this._view.getCenter();this._view.disablePanning();if(this.fixedMode){this._view.disableDragging();}
this._view.changeCursor(GECursor.Cross);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;refreshRubberBand();});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(GEEvent.isCtrlKey(event)&&keyCode==90&&pointList.count()>=1)
{undoPoints();}
else if(self.fixedMode&&GEEvent.isCtrlKey(event))
{self._view.enableDragging();self._view.changeCursor(GECursor.Grab);viewScroll=true;}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){if(op_terminate)return false;if(self.fixedMode)
{viewScroll=false;self._view.disableDragging();self._view.changeCursor(GECursor.Cross);}
keyCode=null;});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;if(GEEvent.isLeftButton(mouseEvent)){clickP=self._view.getLocalPoint(mouseEvent);dragFlg=true;}
e_mousedown=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(this._container,'mouseup',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;dragFlg=false;if(clickP!=null&&GEEvent.isLeftButton(mouseEvent))
{trackFlg=false;var p=self._view.toWorldPoint(clickP);p=self.replacePointInternal(p,true,keyCode,pointList);if(p!=null)
{pointList.add(p);trackFlg=true;}}
else if(GEEvent.isRightButton(mouseEvent)){if(pointList.count()>=1){undoPoints();}else{self.terminate(true,null);}}
e_mouseup=false;return false;});var e_mousemove=false;var back_p=(GEValueCheck.isNull(this.pointList)||this.pointList.count()==0)?new GEPointD():this._view.toLocalPoint(this.pointList.items[this.pointList.count()-1]);this._mousemove=GEEvent.addListener(this._container,'mousemove',function(mouseEvent){var TRACK_TOLERANCE=10;if(op_terminate)return false;if(viewScroll)return false;if(e_mousemove)return false;e_mousemove=true;cursorP=self._view.getLocalPoint(mouseEvent);if(dragFlg&&clickP!=null){if(cursorP.distanceAt(clickP)>=TRACK_TOLERANCE)
clickP=null;else
clickP=cursorP;}
self._view.changeCursor(GECursor.Cross);activeCenterP=self._view.getCenter();if(pointList.count()==0)
{e_mousemove=false;return false;}
if(GEBrowser.isOpera()){e_mousemove=false;var now_p=self._view.getLocalPoint(mouseEvent);if(Math.abs(back_p.x-now_p.x)<5&&Math.abs(back_p.y-now_p.y)<5){mouseEvent.button=1;}
back_p=now_p;}
refreshRubberBand();e_mousemove=false;return false;});var e_dblclick=false;this._dblclick=GEEvent.addListener(this._container,'dblclick',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(e_dblclick)return false;e_dblclick=true;pointList.removeOverlap();if(pointList.count()<2||!trackFlg){e_dblclick=false;return false;}
var geom=new GELineString(pointList);GEEvent.stopPropagation(mouseEvent);self._view.panAt(activeCenterP);op_terminate=true;self.trackComplete(geom);self.terminate(true,geom);e_dblclick=false;return false;});function undoPoints()
{if(pointList.count()==0)return;pointList.removeAt(pointList.count()-1);refreshRubberBand();}
function refreshRubberBand()
{self.rubberBand.clear();if(cursorP==null||pointList.count()<1)return;var p=self._view.toWorldPoint(cursorP);p=self.replacePointInternal(p,false,keyCode,pointList);var newPointList=new GEPointDList();for(var i=0;i<pointList.count();i++){newPointList.add(self._view.toLocalPoint(pointList.items[i]));}
if(p!=null){newPointList.add(self._view.toLocalPoint(p));}
self.rubberBand.drawLines(newPointList,self.property);if(self.drawVertex){for(var i=0;i<newPointList.count();i++){self.rubberBand.drawPoint(newPointList.items[i],0,self.vertexProperty);}}}}
GETrackLineString.prototype.replacePointInternal=function(p,accept,keycode,points)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var sp=this.snapController.execute(this._view,p,accept,points);if(accept&&sp.equals(p))
return null;else
p=sp;}
return this.replacePoint(p,accept,keycode,points);}
GETrackLineString.prototype.replacePoint=function(p,accept,keycode,points)
{return p;}
GETrackLineString.prototype.trackComplete=function(geom){}
GETrackLineString.prototype.end=function(geom){}
GETrackLineString.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GETrackLineString.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(this._container,"mouseup",this._mouseup);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(this._container,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._dblclick))
GEEvent.removeListener(this._container,"dblclick",this._dblclick);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._view.enableDragging();this._active=false;if(dispatch)this.end(geom);}

function GETrackPoint(property){this.property=GEValueCheck.isNull(property)?new GEPointProperty():property;this.rubberBand=null;this._view=null;this._container=null;this._active=false;this.enableSnap=false;this.fixedMode=false;this.snapController=new GESnapController();}
GETrackPoint.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._active=true;var self=this;var op_terminate=false;var keyCode=null;var clickP=null;var cursorP=null;var dragFlg=false;var viewScroll=false;this._view.disablePanning();if(this.fixedMode){this._view.disableDragging();}
this._view.changeCursor(GECursor.Cross);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;refreshRubberBand();});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(self.fixedMode&&GEEvent.isCtrlKey(event))
{self._view.enableDragging();self._view.changeCursor(GECursor.Grab);viewScroll=true;}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){if(op_terminate)return false;if(self.fixedMode)
{viewScroll=false;self._view.disableDragging();self._view.changeCursor(GECursor.Cross);}
keyCode=null;});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;if(GEEvent.isLeftButton(mouseEvent)){clickP=self._view.getLocalPoint(mouseEvent);dragFlg=true;}
e_mousedown=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(this._container,'mouseup',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;dragFlg=false;if(clickP!=null&&GEEvent.isLeftButton(mouseEvent))
{var p=self._view.toWorldPoint(clickP);p=self.replacePointInternal(p,true,keyCode);if(p!=null)
{var geom=new GEGPoint(p);op_terminate=true;self.trackComplete(geom);self.terminate(true,geom);}}
else if(GEEvent.isRightButton(mouseEvent)){self.terminate(true,null);}
e_mouseup=false;return false;});var e_mousemove=false;var back_p=new GEPointD();this._mousemove=GEEvent.addListener(this._container,'mousemove',function(mouseEvent){var TRACK_TOLERANCE=10;if(op_terminate)return false;if(viewScroll)return false;if(e_mousemove)return false;e_mousemove=true;cursorP=self._view.getLocalPoint(mouseEvent);if(dragFlg&&clickP!=null){if(cursorP.distanceAt(clickP)>=TRACK_TOLERANCE)
clickP=null;else
clickP=cursorP;}
self._view.changeCursor(GECursor.Cross);if(GEBrowser.isOpera()){var now_p=self._view.getLocalPoint(mouseEvent);if(Math.abs(back_p.x-now_p.x)<5&&Math.abs(back_p.y-now_p.y)<5){mouseEvent.button=1;}
back_p=now_p;}
refreshRubberBand();e_mousemove=false;return false;});function refreshRubberBand()
{self.rubberBand.clear();if(cursorP==null)return;var p=self._view.toWorldPoint(cursorP);p=self.replacePointInternal(p,false,keyCode);if(p==null)return false;self.rubberBand.drawPoint(self._view.toLocalPoint(p),0,self.property);}}
GETrackPoint.prototype.replacePointInternal=function(p,accept,keycode)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var sp=this.snapController.execute(this._view,p,accept,null);if(accept&&sp.equals(p))
return null;else
p=sp;}
return this.replacePoint(p,accept,keycode);}
GETrackPoint.prototype.replacePoint=function(p,accept,keycode)
{return p;}
GETrackPoint.prototype.trackComplete=function(geom){}
GETrackPoint.prototype.end=function(geom){}
GETrackPoint.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GETrackPoint.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(this._container,"mouseup",this._mouseup);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(this._container,"mousemove",this._mousemove);this._view.enablePanning();this._view.enableDragging();this._active=false;if(dispatch)this.end(geom);this._view.changeCursor(GECursor.Grab);}

﻿
function GETrackPolygon(property){this.property=GEValueCheck.isNull(property)?new GEPolygonProperty():property;this.drawVertex=true;this.rubberBand=null;this._view=null;this._container=null;this._active=false;this.enableSnap=false;this.fixedMode=false;this.snapController=new GESnapController();this.vertexProperty=new GEPointProperty();this.vertexProperty.outlineColor=new GEColor(0,0,0);this.vertexProperty.fillColor=new GEColor(255,255,255);this.vertexProperty.pointType=GEPointType.SolidSquare;this.vertexProperty.pointSize=10;}
GETrackPolygon.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._container.style.cursor="default";this._active=true;var self=this;var op_terminate=false;var pointList=new GEPointDList();var keyCode=null;var clickP=null;var cursorP=null;var dragFlg=false;var viewScroll=false;var activeCenterP=this._view.getCenter();this._view.disablePanning();if(this.fixedMode){this._view.disableDragging();}
this._view.changeCursor(GECursor.Cross);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;refreshRubberBand();});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(GEEvent.isCtrlKey(event)&&keyCode==90&&pointList.count()>=1)
{undoPoints();}
else if(self.fixedMode&&GEEvent.isCtrlKey(event))
{self._view.enableDragging();self._view.changeCursor(GECursor.Grab);viewScroll=true;}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){if(op_terminate)return false;if(self.fixedMode)
{viewScroll=false;self._view.disableDragging();self._view.changeCursor(GECursor.Cross);}
keyCode=null;});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_mousedown=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;if(GEEvent.isLeftButton(mouseEvent)){clickP=self._view.getLocalPoint(mouseEvent);dragFlg=true;}
e_mousedown=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(this._container,'mouseup',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;dragFlg=false;if(clickP!=null&&GEEvent.isLeftButton(mouseEvent))
{trackFlg=false;var p=self._view.toWorldPoint(clickP);p=self.replacePointInternal(p,true,false,keyCode,pointList);if(p!=null)
{pointList.add(p);trackFlg=true;}}
else if(GEEvent.isRightButton(mouseEvent)){if(pointList.count()>=1){undoPoints();}else{self.terminate(true,null);}}
e_mouseup=false;return false;});var e_mousemove=false;var back_p=(GEValueCheck.isNull(this.pointList)||this.pointList.count()==0)?new GEPointD():this._view.toLocalPoint(this.pointList.items[this.pointList.count()-1]);this._mousemove=GEEvent.addListener(this._container,'mousemove',function(mouseEvent){var TRACK_TOLERANCE=10;if(op_terminate)return false;if(viewScroll)return false;if(e_mousemove)return false;e_mousemove=true;cursorP=self._view.getLocalPoint(mouseEvent);if(dragFlg&&clickP!=null){if(cursorP.distanceAt(clickP)>=TRACK_TOLERANCE)
clickP=null;else
clickP=cursorP;}
self._view.changeCursor(GECursor.Cross);activeCenterP=self._view.getCenter();if(pointList.count()==0)
{e_mousemove=false;return false;}
if(GEBrowser.isOpera()){e_mousemove=false;var now_p=self._view.getLocalPoint(mouseEvent);if(Math.abs(back_p.x-now_p.x)<5&&Math.abs(back_p.y-now_p.y)<5){mouseEvent.button=1;}
back_p=now_p;}
refreshRubberBand();e_mousemove=false;return false;});var e_dblclick=false;this._dblclick=GEEvent.addListener(this._container,'dblclick',function(mouseEvent){if(op_terminate)return false;if(viewScroll)return false;if(e_dblclick)return false;e_dblclick=true;pointList.removeOverlap();if(pointList.count()<3||!trackFlg){e_dblclick=false;return false;}
var p=pointList.items[pointList.count()-1];p=self.replacePointInternal(p,true,true,keyCode,pointList);if(p==null)
{pointList.removeAt(pointList.count()-1);e_dblclick=false;return false;}
if(!pointList.isClosed())
pointList.closed();var geom=new GEPolygon(pointList);GEEvent.stopPropagation(mouseEvent);self._view.panAt(activeCenterP);op_terminate=true;self.trackComplete(geom);self.terminate(true,geom);e_dblclick=false;return false;});function undoPoints()
{if(pointList.count()==0)return;pointList.removeAt(pointList.count()-1);refreshRubberBand();}
function refreshRubberBand()
{self.rubberBand.clear();if(cursorP==null||pointList.count()<1)return;var p=self._view.toWorldPoint(cursorP);p=self.replacePointInternal(p,false,false,keyCode,pointList);var newPointList=new GEPointDList();for(var i=0;i<pointList.count();i++){newPointList.add(self._view.toLocalPoint(pointList.items[i]));}
if(p!=null){newPointList.add(self._view.toLocalPoint(p));}
self.rubberBand.drawPolygon(newPointList,self.property);if(self.drawVertex){for(var i=0;i<newPointList.count();i++){self.rubberBand.drawPoint(newPointList.items[i],0,self.vertexProperty);}}}}
GETrackPolygon.prototype.replacePointInternal=function(p,accept,complete,keycode,points)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var sp=this.snapController.execute(this._view,p,accept,points);if(accept&&sp.equals(p))
return null;else
p=sp;}
if(accept&&points!=null&&points.count()>2)
{var startP=points.items[0];var endP=points.items[points.count()-1];for(var i=0;i<points.count()-1;i++)
{var p1=points.items[i];var p2=points.items[i+1];if(p1.equals(p)||p2.equals(p))continue;if(!p1.equals(endP)&&!p2.equals(endP))
{if(GESpatials.isCross(p1,p2,p,endP))
return null;}
if(complete&&!p1.equals(startP)&&!p2.equals(startP))
{if(GESpatials.isCross(p1,p2,p,startP))
return null;}}}
return this.replacePoint(p,accept,keycode,points);}
GETrackPolygon.prototype.replacePoint=function(p,accept,keycode,points)
{return p;}
GETrackPolygon.prototype.trackComplete=function(geom){}
GETrackPolygon.prototype.end=function(geom){}
GETrackPolygon.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GETrackPolygon.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(this._container,"mouseup",this._mouseup);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(this._container,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._dblclick))
GEEvent.removeListener(this._container,"dblclick",this._dblclick);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._view.enableDragging();this._active=false;if(dispatch)this.end(geom);}

function GETrackRectangle(property){this.property=GEValueCheck.isNull(property)?new GEPolygonProperty():property;this.rubberBand=null;this._view=null;this._container=null;this._active=false;this.enableSnap=false;this.snapController=new GESnapController();}
GETrackRectangle.prototype.start=function(view,viewContainer){if(GEValueCheck.isNull(view))
GEError.argument("view");if(GEValueCheck.isNull(viewContainer))
GEError.argument("viewContainer");this._view=view;this._container=view.getContainer();this.rubberBand=new GERubberBand(this._view,viewContainer,GEFunctions.getMaxIndex());this._active=true;var self=this;var op_terminate=false;var keyCode=null;var p1=null;var p2=null;var dragFlg=false;this._view.disablePanning();this._view.disableDragging();this._view.changeCursor(GECursor.Cross);this._rangechanged=GEEvent.addListener(this._view,"onrangechanged",function(){if(op_terminate)return false;refreshRubberBand();});var e_keydown=false;this._keydown=GEEvent.addListener(document,'keydown',function(event){if(op_terminate)return false;if(e_keydown)return false;e_keydown=true;keyCode=event.keyCode;if(keyCode==27)
{self.terminate(true,null);}
else if(GEEvent.isCtrlKey(event)&&keyCode==90&&p1!=null)
{p1=null;refreshRubberBand();dragFlg=false;}
e_keydown=false;});this._keyup=GEEvent.addListener(document,'keyup',function(event){if(op_terminate)return false;keyCode=null;});this._contextmenu=GEEvent.addListener(this._container,'contextmenu',function(mouseEvent){return false;});var e_mousedown=false;var m_down=false;this._mousedown=GEEvent.addListener(this._container,'mousedown',function(mouseEvent){if(op_terminate)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mousedown)return false;e_mousedown=true;p1=null;if(GEEvent.isLeftButton(mouseEvent)){p1=self._view.getWorldPoint(mouseEvent);p1=self.replacePointInternal(p1,true,keyCode);if(p1!=null)
{dragFlg=true;}}
m_down=true;e_mousedown=false;return false;});var e_mouseup=false;this._mouseup=GEEvent.addListener(document,'mouseup',function(mouseEvent){var TRACK_TOLERANCE=10;if(op_terminate)return false;if(!m_down)return false;if(!GEEvent.hasMouseEvent(mouseEvent))return false;if(e_mouseup)return false;e_mouseup=true;if(GEEvent.isLeftButton(mouseEvent)&&dragFlg){var p=self._view.getWorldPoint(mouseEvent);if(p1==null||p1.distanceAt(p)<=self._view.toWorldSize(new GESizeD(TRACK_TOLERANCE,TRACK_TOLERANCE)).width)
{self.rubberBand.clear();}
else
{p=self.replacePointInternal(p,true,keyCode);if(p!=null)
{var geom=new GEPolygon.fromRectangle(new GERectangleD(p1,p));op_terminate=true;self.trackComplete(geom);self.terminate(true,geom);}}}
else if(GEEvent.isRightButton(mouseEvent)&&!dragFlg){self.terminate(true,null);}
dragFlg=false;m_down=false;e_mouseup=false;return false;});var e_mousemove=false;var back_p=new GEPointD();this._mousemove=GEEvent.addListener(document,'mousemove',function(mouseEvent){if(!dragFlg||GEValueCheck.isNull(p1))return false;cursorP=self._view.getLocalPoint(mouseEvent);if(GEBrowser.isOpera()){var now_p=self._view.getLocalPoint(mouseEvent);if(Math.abs(back_p.x-now_p.x)<5&&Math.abs(back_p.y-now_p.y)<5){mouseEvent.button=1;}
back_p=now_p;}
refreshRubberBand();e_mousemove=false;return false;});function refreshRubberBand()
{self.rubberBand.clear();if(p1==null||cursorP==null)return;var p=self._view.toWorldPoint(cursorP);p=self.replacePointInternal(p,false,keyCode);self.rubberBand.drawRectangle(new GERectangleD(self._view.toLocalPoint(p1),self._view.toLocalPoint(p)),self.property);}}
GETrackRectangle.prototype.replacePointInternal=function(p,accept,keycode,pp)
{if(this.enableSnap==true&&keycode!=null&&keycode==16){var points=new GEPointDList();points.add(pp);var sp=this.snapController.execute(this._view,p,accept,points);if(accept&&sp.equals(p))
return null;else
p=sp;}
return this.replacePoint(p,accept,keycode,pp);}
GETrackRectangle.prototype.replacePoint=function(p,accept,keycode,pp)
{return p;}
GETrackRectangle.prototype.trackComplete=function(geom){}
GETrackRectangle.prototype.end=function(geom){}
GETrackRectangle.prototype.kill=function(){if(!this._active)return;this.terminate(true,null);}
GETrackRectangle.prototype.terminate=function(dispatch,geom){if(!this._active)return;this.rubberBand.dispose();if(!GEValueCheck.isNull(this._rangechanged))
GEEvent.removeListener(this._view,"onrangechanged",this._rangechanged);if(!GEValueCheck.isNull(this._keydown))
GEEvent.removeListener(document,"keydown",this._keydown);if(!GEValueCheck.isNull(this._keyup))
GEEvent.removeListener(document,"keyup",this._keyup);if(!GEValueCheck.isNull(this._contextmenu))
GEEvent.removeListener(this._container,"contextmenu",this._contextmenu);if(!GEValueCheck.isNull(this._mousedown))
GEEvent.removeListener(this._container,"mousedown",this._mousedown);if(!GEValueCheck.isNull(this._mousemove))
GEEvent.removeListener(document,"mousemove",this._mousemove);if(!GEValueCheck.isNull(this._mouseup))
GEEvent.removeListener(document,"mouseup",this._mouseup);this._view.changeCursor(GECursor.Grab);this._view.enablePanning();this._view.enableDragging();this._active=false;if(dispatch)this.end(geom);}

function GEUnload()
{GEEvent.cleanup();GEGC.collect();}

function GEValueCheck(){}
GEValueCheck.isNull=function(val){return val==null||val==undefined;}
GEValueCheck.isNumber=function(val){if(GEValueCheck.isNull(val)||isNaN(val))return false;return typeof(val)=="number";}
GEValueCheck.isString=function(val){if(GEValueCheck.isNull(val))return false;return typeof(val)=="string";}

﻿
function GEVmlRenderer(){this._BEHAVIOR="#default#VML";this._PREFIX="vml";this._NAMESPACE_URI="urn:schemas-microsoft-com:vml";this._imgCache=new GEImageCache();GEGC.add(this);}
GEVmlRenderer.prototype.createElement=function(view,viewContainer){var element=document.createElement("div");GEFunctions.setStyle(element,"position: absolute;"+"margin: 0px;"+"padding: 0px;"+"z-index: 0;");return element;}
GEVmlRenderer.prototype.getCachedImage=function(url)
{if(url==null||url.length==0)
return null;return this._imgCache.get(url);}
GEVmlRenderer.prototype.dispose=function(){if(this._imgCache==null)return;this._imgCache.dispose();this._imgCache=null;}
GEVmlRenderer.prototype.drawLines=function(element,points,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(points))
GEError.argument("points");if(GEValueCheck.isNull(property))
property=new GELinearProperty();var elmFill=document.createElement("v:fill");elmFill.namespaceURI=this._NAMESPACE_URI;elmFill.prefix=this._PREFIX;elmFill.opacity="0";var elmtStroke=document.createElement("v:stroke");elmtStroke.namespaceURI=this._NAMESPACE_URI;elmtStroke.prefix=this._PREFIX;elmtStroke.joinstyle=property.joinStyle;elmtStroke.opacity=property.lineColor.getAlphaPercent();if(!GEValueCheck.isNull(property.linePattern))
{if(property.linePattern==GELinePattern.None){return;}
elmtStroke.dashstyle=this._getDashStyle(property.linePattern);}
if(!GEValueCheck.isNull(property.startCap)&&!GEValueCheck.isNull(property.endCap)&&property.startCap==property.endCap&&(property.startCap==GELineCaps.Square||property.startCap==GELineCaps.Round||property.startCap==GELineCaps.Triangle))
{elmtStroke.endcap=this._getCapStyle(property.endCap);}
else if(!GEValueCheck.isNull(property.startCap)&&property.startCap!=GELineCaps.Flat){elmtStroke.startarrow=this._getArrowType(property.startCap);}
else if(!GEValueCheck.isNull(property.endCap)&&property.endCap!=GELineCaps.Flat){elmtStroke.endarrow=this._getArrowType(property.endCap);}
var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
var elmPolyline=document.createElement("v:polyline");elmPolyline.namespaceURI=this._NAMESPACE_URI;elmPolyline.prefix=this._PREFIX;GEFunctions.setStyle(elmPolyline,"position: absolute; visibility: visible;");elmPolyline.strokecolor=property.lineColor.toHexString();elmPolyline.strokeweight=GEFunctions.createPx(lineWidth);elmPolyline.points=this._getPointsString(points);elmPolyline.appendChild(elmFill);elmPolyline.appendChild(elmtStroke);element.insertBefore(elmPolyline,null);elmPolyline.addBehavior(this._BEHAVIOR);elmFill.addBehavior(this._BEHAVIOR);elmtStroke.addBehavior(this._BEHAVIOR);}
GEVmlRenderer.prototype._getDashStyle=function(linePattern){switch(linePattern){case GELinePattern.Dot:return"shortDot";case GELinePattern.Dash:return"shortDash";case GELinePattern.DashDot:return"shortDashDot";case GELinePattern.DashDotDot:return"shortDashDotDot";default:return"";}}
GEVmlRenderer.prototype._getCapStyle=function(cap){switch(cap){case GELineCaps.Square:return"square";case GELineCaps.Round:return"round";case GELineCaps.Triangle:return"none";}}
GEVmlRenderer.prototype._getArrowType=function(cap){switch(cap){case GELineCaps.SquareAnchor:return"none";case GELineCaps.RoundAnchor:return"oval";case GELineCaps.DiamondAnchor:return"diamond";case GELineCaps.ArrowAnchor:return"block";}}
GEVmlRenderer.prototype.drawPolygon=function(element,points,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(points))
GEError.argument("points");if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var elmFill=document.createElement("v:fill");elmFill.namespaceURI=this._NAMESPACE_URI;elmFill.prefix=this._PREFIX;if(!GEValueCheck.isNull(property.fillColor)){elmFill.color=property.fillColor.toHexString();elmFill.opacity=property.fillColor.getAlphaPercent();}
else{elmFill.opacity="0";}
var elmtStroke=document.createElement("v:stroke");elmtStroke.namespaceURI=this._NAMESPACE_URI;elmtStroke.prefix=this._PREFIX;elmtStroke.joinstyle=property.joinStyle;elmtStroke.opacity=property.lineColor.getAlphaPercent();if(!GEValueCheck.isNull(property.linePattern))
{if(property.linePattern==GELinePattern.None){return;}
elmtStroke.dashstyle=this._getDashStyle(property.linePattern);}
var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
var elmPolyline=document.createElement("v:polyline");elmPolyline.namespaceURI=this._NAMESPACE_URI;elmPolyline.prefix=this._PREFIX;GEFunctions.setStyle(elmPolyline,"position: absolute; visibility: visible;");elmPolyline.strokecolor=property.lineColor.toHexString();elmPolyline.strokeweight=GEFunctions.createPx(lineWidth);elmPolyline.points=this._getPointsString(points);elmPolyline.appendChild(elmFill);elmPolyline.appendChild(elmtStroke);element.insertBefore(elmPolyline,null);elmPolyline.addBehavior(this._BEHAVIOR);elmFill.addBehavior(this._BEHAVIOR);elmtStroke.addBehavior(this._BEHAVIOR);}
GEVmlRenderer.prototype.drawRectangle=function(element,rect,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(rect))
GEError.argument("rect");if(GEValueCheck.isNull(property))
property=new GEPolygonProperty();var elmFill=document.createElement("v:fill");elmFill.namespaceURI=this._NAMESPACE_URI;elmFill.prefix=this._PREFIX;if(!GEValueCheck.isNull(property.fillColor)){elmFill.color=property.fillColor.toHexString();elmFill.opacity=property.fillColor.getAlphaPercent();}
else{elmFill.opacity="0";}
var elmtStroke=document.createElement("v:stroke");elmtStroke.namespaceURI=this._NAMESPACE_URI;elmtStroke.prefix=this._PREFIX;elmtStroke.joinstyle=property.joinStyle;elmtStroke.opacity=property.lineColor.getAlphaPercent();if(!GEValueCheck.isNull(property.linePattern))
{if(property.linePattern==GELinePattern.None){return;}
elmtStroke.dashstyle=this._getDashStyle(property.linePattern);}
var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
var elmRect=document.createElement("v:polyline");elmRect.namespaceURI=this._NAMESPACE_URI;elmRect.prefix=this._PREFIX;GEFunctions.setStyle(elmRect,"position: absolute; visibility: visible;");elmRect.strokecolor=property.lineColor.toHexString();elmRect.strokeweight=GEFunctions.createPx(lineWidth);elmRect.points=this._getPointsString(rect.getCoordinates());elmRect.appendChild(elmFill);elmRect.appendChild(elmtStroke);element.insertBefore(elmRect,null);elmRect.addBehavior(this._BEHAVIOR);elmFill.addBehavior(this._BEHAVIOR);elmtStroke.addBehavior(this._BEHAVIOR);}
GEVmlRenderer.prototype.drawEllipse=function(element,center,xAxis,yAxis,rotate,property,pixWidth){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(center))
GEError.argument("center");if(GEValueCheck.isNull(xAxis))
GEError.argument("xAxis");if(GEValueCheck.isNull(yAxis))
GEError.argument("yAxis");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEEllipseProperty();var elmFill=document.createElement("v:fill");elmFill.namespaceURI=this._NAMESPACE_URI;elmFill.prefix=this._PREFIX;if(!GEValueCheck.isNull(property.fillColor)){elmFill.color=property.fillColor.toHexString();elmFill.opacity=property.fillColor.getAlphaPercent();}
else{elmFill.opacity="0";}
var elmtStroke=document.createElement("v:stroke");elmtStroke.namespaceURI=this._NAMESPACE_URI;elmtStroke.prefix=this._PREFIX;elmtStroke.joinstyle="miter";elmtStroke.opacity=property.lineColor.getAlphaPercent();var lineWidth=1;if(!GEValueCheck.isNull(pixWidth)&&pixWidth>0){lineWidth=pixWidth;}
var elmOval=document.createElement("v:oval");elmOval.namespaceURI=this._NAMESPACE_URI;elmOval.prefix=this._PREFIX;elmOval.strokecolor=property.lineColor.toHexString();elmOval.strokeweight=GEFunctions.createPx(lineWidth);GEFunctions.setStyle(elmOval,"position: absolute; visibility: visible;"+"left: "+GEFunctions.createPx(center.x-xAxis)+";"+"top: "+GEFunctions.createPx(center.y-yAxis)+";"+"width: "+GEFunctions.createPx(xAxis*2)+";"+"height: "+GEFunctions.createPx(yAxis*2)+";"+"rotation: "+-GERadian.radToDeg(rotate)+";");elmOval.appendChild(elmFill);elmOval.appendChild(elmtStroke);element.insertBefore(elmOval,null);elmOval.addBehavior(this._BEHAVIOR);elmFill.addBehavior(this._BEHAVIOR);elmtStroke.addBehavior(this._BEHAVIOR);}
GEVmlRenderer.prototype.drawPoint=function(element,point,rotate,property,pixSize){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEPointProperty();var elmFill=document.createElement("v:fill");elmFill.namespaceURI=this._NAMESPACE_URI;elmFill.prefix=this._PREFIX;if(!GEValueCheck.isNull(property.fillColor)&&property.pointType!=GEPointType.Round&&property.pointType!=GEPointType.Triangle&&property.pointType!=GEPointType.Square&&property.pointType!=GEPointType.Diamond)
{elmFill.color=property.fillColor.toHexString();elmFill.opacity=property.fillColor.getAlphaPercent();}
else{elmFill.opacity="0";}
var elmtStroke=document.createElement("v:stroke");elmtStroke.namespaceURI=this._NAMESPACE_URI;elmtStroke.prefix=this._PREFIX;elmtStroke.color=property.outlineColor.toHexString();elmtStroke.opacity=property.outlineColor.getAlphaPercent();elmtStroke.weight=GEFunctions.createPx(1);var elmPoint;if(property.pointType==GEPointType.Round||property.pointType==GEPointType.SolidRound){var elmPoint=document.createElement("v:oval");elmPoint.namespaceURI=this._NAMESPACE_URI;elmPoint.prefix=this._PREFIX;GEFunctions.setStyle(elmPoint,"position: absolute; visibility: visible;"+"left: "+GEFunctions.createPx(point.x-(pixSize.width/2))+";"+"top: "+GEFunctions.createPx(point.y-(pixSize.height/2))+";"+"width: "+GEFunctions.createPx(pixSize.width)+";"+"height: "+GEFunctions.createPx(pixSize.height)+";"+"rotation: "+GERadian.radToDeg(-rotate)+";");}
else if(property.pointType==GEPointType.Triangle||property.pointType==GEPointType.SolidTriangle){elmPoint=document.createElement("v:polyline");elmPoint.namespaceURI=this._NAMESPACE_URI;elmPoint.prefix=this._PREFIX;GEFunctions.setStyle(elmPoint,"position: absolute; visibility: visible; rotation: "+GERadian.radToDeg(-rotate)+";");var points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y+(pixSize.height/2)));points.add(new GEPointD(point.x,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+(pixSize.width/2),point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-(pixSize.width/2),point.y+(pixSize.height/2)));elmPoint.points=this._getPointsString(points);}
else if(property.pointType==GEPointType.Square||property.pointType==GEPointType.SolidSquare){elmPoint=document.createElement("v:polyline");elmPoint.namespaceURI=this._NAMESPACE_URI;elmPoint.prefix=this._PREFIX;GEFunctions.setStyle(elmPoint,"position: absolute; visibility: visible; rotation: "+GERadian.radToDeg(-rotate)+";");var rect=GERectangleD.fromCenter(point,new GESizeD(pixSize.width,pixSize.height));elmPoint.points=this._getPointsString(rect.getCoordinates());}
else if(property.pointType==GEPointType.Diamond||property.pointType==GEPointType.SolidDiamond){elmPoint=document.createElement("v:polyline");elmPoint.namespaceURI=this._NAMESPACE_URI;elmPoint.prefix=this._PREFIX;GEFunctions.setStyle(elmPoint,"position: absolute; visibility: visible; rotation: "+GERadian.radToDeg(-rotate)+";");var points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y));points.add(new GEPointD(point.x,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+(pixSize.width/2),point.y));points.add(new GEPointD(point.x,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-(pixSize.width/2),point.y));elmPoint.points=this._getPointsString(points);}
else if(property.pointType==GEPointType.Cross||property.pointType==GEPointType.SlantCross){elmPoint=document.createElement("v:polyline");elmPoint.namespaceURI=this._NAMESPACE_URI;elmPoint.prefix=this._PREFIX;var crossSizeX=pixSize.width/8;var crossSizeY=pixSize.height/8;points=new GEPointDList();points.add(new GEPointD(point.x-(pixSize.width/2),point.y+crossSizeY));points.add(new GEPointD(point.x-(pixSize.width/2),point.y-crossSizeY));points.add(new GEPointD(point.x-crossSizeX,point.y-crossSizeY));points.add(new GEPointD(point.x-crossSizeX,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+crossSizeX,point.y-(pixSize.height/2)));points.add(new GEPointD(point.x+crossSizeX,point.y-crossSizeY));points.add(new GEPointD(point.x+(pixSize.width/2),point.y-crossSizeY));points.add(new GEPointD(point.x+(pixSize.width/2),point.y+crossSizeY));points.add(new GEPointD(point.x+crossSizeX,point.y+crossSizeY));points.add(new GEPointD(point.x+crossSizeX,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-crossSizeX,point.y+(pixSize.height/2)));points.add(new GEPointD(point.x-crossSizeX,point.y+crossSizeY));points.add(new GEPointD(point.x-(pixSize.width/2),point.y+crossSizeY));elmPoint.points=this._getPointsString(points);var rad=-rotate;if(property.pointType==GEPointType.SlantCross){rad+=GERadian.degToRad(45);}
GEFunctions.setStyle(elmPoint,"position: absolute; visibility: visible; rotation: "+GERadian.radToDeg(rad)+";");}
else{return;}
elmPoint.appendChild(elmFill);elmPoint.appendChild(elmtStroke);element.insertBefore(elmPoint,null);elmPoint.addBehavior(this._BEHAVIOR);elmFill.addBehavior(this._BEHAVIOR);elmtStroke.addBehavior(this._BEHAVIOR);}
GEVmlRenderer.prototype._getPointsString=function(points){if(GEValueCheck.isNull(points))
GEError.argument("points");var strPoints=new GEStringBuilder();for(var i=0;i<points.count();i++){if(i>0){strPoints.append(' ');}
points.items[i].round(4);strPoints.append(points.items[i].x.toString()+','+points.items[i].y.toString());}
return strPoints.toString();}
GEVmlRenderer.prototype.drawIcon=function(element,point,rotate,property,pixSize){if(GEValueCheck.isNull(element))
GEError.argument("element");if(GEValueCheck.isNull(point))
GEError.argument("point");if(GEValueCheck.isNull(rotate))
rotate=0.0;if(GEValueCheck.isNull(property))
property=new GEIconProperty();if(pixSize.isZero())
{var image=this._imgCache.get(property.url);if(image!=null)
{var imgSize=new GESizeD(image.width,image.height);if(GEValueCheck.isNumber(property.scale)){imgSize.width*=property.scale;imgSize.height*=property.scale;}
this._drawImage(element,property.url,point,imgSize.width,imgSize.height,rotate);}
else
{image=new Image();var _self=this;GEEvent.addListener(image,"load",function(){var imgSize=new GESizeD(image.width,image.height);if(GEValueCheck.isNumber(property.scale)){imgSize.width*=property.scale;imgSize.height*=property.scale;}
_self._drawImage(element,property.url,point,imgSize.width,imgSize.height,rotate);});image.src=property.url;this._imgCache.add(property.url,image);}}
else
{this._drawImage(element,property.url,point,pixSize.width,pixSize.height,rotate);}}
GEVmlRenderer.prototype._drawImage=function(element,url,point,width,height,rotate)
{var elmIcon=document.createElement("v:image");elmIcon.namespaceURI=this._NAMESPACE_URI;elmIcon.prefix=this._PREFIX;elmIcon.src=url;GEFunctions.setStyle(elmIcon,"position: absolute; visibility: visible;"+"left: "+GEFunctions.createPx(point.x-(width/2))+";"+"top: "+GEFunctions.createPx(point.y-(height/2))+";"+"width: "+GEFunctions.createPx(width)+";"+"height: "+GEFunctions.createPx(height)+";"+"rotation: "+GERadian.radToDeg(-rotate)+";");element.insertBefore(elmIcon,null);elmIcon.addBehavior(this._BEHAVIOR);}

function GEXmlHttp(url,type,param){if(!GEValueCheck.isString(url))
GEError.argument("url");if(!GEValueCheck.isString(type))
type="GET";this._xmlHttp=GEXmlHttpFactory.instance();this._url=url;this._type=type;this._param=param;}
GEXmlHttp.prototype._setRequestHeader=function(){if(this._type.toUpperCase()=="POST")
this._xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}
GEXmlHttp.prototype._getUrl=function(){if(this._type.toUpperCase()=="GET"&&GEValueCheck.isString(this._param)&&this._param.length>0){return this._url+"?"+this._param;}
else{return this._url;}}
GEXmlHttp.prototype._getSendParameter=function(){if(this._type.toUpperCase()=="POST"&&GEValueCheck.isString(this._param)&&this._param.length>0){return this._param;}
else{return null;}}
GEXmlHttp.prototype.beginExecute=function(success,error){try{if(GEValueCheck.isNull(this._xmlHttp)){if(!GEValueCheck.isNull(error))error(-1);return;}
this._xmlHttp.open(this._type,this._getUrl(),true);var xmlHttp=this._xmlHttp;this._xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){if(!GEValueCheck.isNull(success))success(GEXmlHttp._toObject(xmlHttp));}
else{if(!GEValueCheck.isNull(error))error(xmlHttp.status);}}}
this._setRequestHeader();this._xmlHttp.send(this._getSendParameter());}
catch(e){return;}}
GEXmlHttp.prototype.execute=function(){try{if(GEValueCheck.isNull(this._xmlHttp)){if(!GEValueCheck.isNull(error))
return null;}
this._xmlHttp.open(this._type,this._getUrl(),false);this._setRequestHeader();this._xmlHttp.send(this._getSendParameter());return GEXmlHttp._toObject(this._xmlHttp);}
catch(e){return null;}}
GEXmlHttp._toObject=function(xmlHttp){try{if(GEValueCheck.isNull(xmlHttp))
GEError.argument("xmlHttp");return eval('('+xmlHttp.responseText+')');}
catch(e){return null;}}

function GEXmlHttpFactory(){}
GEXmlHttpFactory.instance=function(){if(GEBrowser.isIE()){return new ActiveXObject("Microsoft.XMLHTTP");}
else if(GEBrowser.isFireFox()||GEBrowser.isOpera()||GEBrowser.isSafari()){return new XMLHttpRequest();}
else{return null;}}
}

