//ICMap, Copyright 2006, clifford L. Collins, Collins Software, all rights reserved, http://collinssoftware.com, not for distribution or resale, use License is required: icmake
var activeMake;
var ESC=27;
var F2=113;
var DEL=46;
var KEY_LEFT=37;
var KEY_RIGHT=39;
var KEY_UP=38;
var KEY_DOWN=40;
var KEY_PAGEUP=33;
var KEY_PAGEDOWN=34;
var KEY_A=65;
var KEY_C=67;
var KEY_X=88;
var KEY_V=86;
var KEY_Z=90;
function ic$Make(id,img,view,height,width)
{
this.id=id;
this.height=height;
this.width=width;
this.img=img;
activeMake=this;
this.area=$130;
this.rectangle=$134;
this.arc=$135;
this.symbol=$136;
this.text=$137;
this.textbox=$131;
this.shape=$133;
this.sketch=$138;
this.line=$126;
this.pline=$129;
this.circle=$127;
this.polygon=$128;
this.pline=$129;
this.measure=$139;
this.image=$132;
this.setOn=$140;
this.isRubberBand=false;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=false;
this.ctrlDown=false;
this.view=view;
this.xPos=$116;
this.yPos=$117;
this.mouseUp=$150;
this.mouseDown=$148;
this.mouseMove=$149;
this.keyDown=$146;
this.keyUp=$145;
this.command=$144;
this.completed=$143;
this.cancel=$147;
this.snap=$106;
this.removeEvents=$142;
this.attachEvents=$141;
this.erase=$115;
this.visible=$118;
this.showRange=$124;
this.eraseRange=$115Range;
this.makeArc=$157;
this.buildArea=$104;
this.buildAreaDone=$104Done;
this.buildAdd=$107;
this.buildMove=$108;
this.buildErase=$103;
this.vmlLine=$109;
this.vmlPline=$110;
this.vmlCircle=$113;
this.vmlRectangle=$114;
this.vmlArc=$112;
this.vmlSymbol=$111;
this.vmlText=$120;
this.vmlTextbox=$120box;
this.vmlShape=$123;
this.vmlImage=$122;
this.onCompleted='';
this.onMove='';
this.onCancel='';
this.layer=document.createElement('
');
this.layer.style.zIndex=ZSelectPlane;
this.layer.style.borderWidth=0;
this.layer.style.border="";
this.layer.style.position="absolute";
this.layer.style.posTop=0;
this.layer.style.posLeft=0;
this.layer.style.pixelHeight=height;
this.layer.style.pixelWidth=width;
this.layer.oncontextmenu=null;
this.isVisible=true;
this.hint="";
document.body.appendChild(this.layer);
this.build=document.createElement('');
this.build.style.position="absolute"
this.build.style.top=0;
this.build.style.left=0;
this.build.style.zIndex=ZSelectPlane;
this.nl=0;
this.pntx=new Array(0);
this.pnty=new Array(0);
this.layer.appendChild(this.build);
editInit();
}
function $103()
{
this.np=0;
this.build.innerHTML="";
}
function $104(sx,sy)
{
var x,y;
x=this.view.screenToX(sx);
y=this.view.screenToY(sy);
this.x1=x;
this.y1=y;
this.xmin=x;
this.ymin=y;
this.xmax=x;
this.ymax=y;
this.nl=4;
this.pntx[0]=this.xmin;
this.pnty[0]=this.ymin;
this.pntx[1]=this.xmin;
this.pnty[1]=this.ymax;
this.pntx[2]=this.xmax;
this.pnty[2]=this.ymax;
this.pntx[3]=this.xmax;
this.pnty[3]=this.ymin;
this.pntx[4]=this.xmin;
this.pnty[4]=this.ymin;
}
function $104Done(sx,sy)
{
var x,y;
x=this.view.screenToX(sx);
y=this.view.screenToY(sy);
this.xmin=Math.min(x,this.xmin);
this.ymin=Math.min(y,this.ymin);
this.xmax=Math.max(x,this.xmax);
this.ymax=Math.max(y,this.ymax);
}
function $106(x,y)
{
var p;
var angle,deg,dx,n;
var tol;
p=new Array(2);
p[0]=x;
p[1]=y;
if(this.ctrlDown&&(this.nl >0))
{
angle=$75(this.pntx[this.nl-1],this.pnty[this.nl-1],x,y);
deg=Math.round($70(angle));
n=Math.round(deg/22.5);
deg=n*22.5;
angle=$71(deg);
dx=$72(this.pntx[this.nl-1],this.pnty[this.nl-1],x,y);
p=$74(dx,0,angle);
p[0]=p[0]+this.pntx[this.nl-1];
p[1]=p[1]+this.pnty[this.nl-1];
return p;
}
try
{
if(! optionSnap.checked)return p;
tol=parseInt(optionSnapTolerance.value);
if(tol <=0)return p;
G.snap(p,tol);
return p;
}
catch(e){ return p }
}
function $107(sx,sy)
{
var x,y;
var dx,dy;
x=this.view.screenToX(sx);
y=this.view.screenToY(sy);
if(this.nl >0)
{
dx=this.view.xToScreen(this.pntx[this.nl-1])-sx;
dy=this.view.yToScreen(this.pnty[this.nl-1])-sy;
if((dx==0)&&(dy==0))return;
}
p=this.snap(x,y);
if(this.type=='text')this.nl=0;
this.nl=this.nl+1;
this.pntx[this.nl-1]=p[0];
this.pnty[this.nl-1]=p[1];
this.pntx[this.nl]=p[0];
this.pnty[this.nl]=p[1];
if(this.type=='symbol')
{
this.angle=0;
this.build.innerHTML=this.vmlSymbol();
this.build.style.zIndex=50;
return;
}
if(this.type=='text')
{
this.angle=0;
this.build.innerHTML=this.vmlText();
this.build.style.zIndex=50;
return;
}
if(this.type=='textbox')
{
this.angle=0;
this.build.innerHTML=this.vmlTextbox();
this.build.style.zIndex=50;
return;
}
if(this.type=='image')
{
this.angle=0;
this.build.innerHTML=this.vmlImage();
this.build.style.zIndex=50;
return;
}
if(this.type=='shape')
{
this.angle=0;
this.build.innerHTML=this.vmlShape();
this.build.style.zIndex=50;
return;
}
if(this.type=='rectangle')return;
if(this.type=='area')return;
if(this.type=='circle')return;
if(this.type=='arc')return;
this.build.innerHTML=this.vmlLine("red","",true);
this.build.style.zIndex=50;
}
function $108(sx,sy)
{
var x,y;
var dx,dy;
var p;
var px,py;
if(this.nl <=0)return;
x=this.view.screenToX(sx);
y=this.view.screenToY(sy);
if(this.type=='area')
{
this.xmin=Math.min(x,this.x1);
this.ymin=Math.min(y,this.y1);
this.xmax=Math.max(x,this.x1);
this.ymax=Math.max(y,this.y1);
this.nl=4;
this.pntx[0]=this.xmin;
this.pnty[0]=this.ymin;
this.pntx[1]=this.xmin;
this.pnty[1]=this.ymax;
this.pntx[2]=this.xmax;
this.pnty[2]=this.ymax;
this.pntx[3]=this.xmax;
this.pnty[3]=this.ymin;
this.pntx[4]=this.xmin;
this.pnty[4]=this.ymin;
this.build.innerHTML=this.vmlLine("blue","",true);
this.build.style.zIndex=50;
return;
}
if(this.type=='sketch')
{
px=this.view.xToScreen(this.pntx[this.nl]);
py=this.view.yToScreen(this.pnty[this.nl]);
dx=Math.abs(px-x);
dy=Math.abs(py-y);
if((dx <4)&&(dy <4))return;
this.nl=this.nl+1;
}
p=this.snap(x,y)
this.pntx[this.nl]=p[0];
this.pnty[this.nl]=p[1];
if(this.type=='circle')
{
this.build.innerHTML=this.vmlCircle("red","",true);
this.build.style.zIndex=50;
return;
}
if(this.type=='rectangle')
{
this.build.innerHTML=this.vmlRectangle("red","",true);
this.build.style.zIndex=50;
return;
}
if(this.type=='arc')
{
this.build.innerHTML=this.vmlArc("red","",true);
this.build.style.zIndex=50;
return;
}
if((this.type=='symbol'))
{
this.build.innerHTML=this.vmlSymbol();
this.build.style.zIndex=50;
return;
}
if((this.type=='text'))
{
this.pntx[0]=p[0];
this.pnty[0]=p[1];
this.build.innerHTML=this.vmlText();
this.build.style.zIndex=50;
return;
}
if((this.type=='textbox'))
{
this.build.innerHTML=this.vmlTextbox();
this.build.style.zIndex=50;
return;
}
if((this.type=='image'))
{
this.build.innerHTML=this.vmlImage();
this.build.style.zIndex=50;
return;
}
if((this.type=='shape'))
{
this.build.innerHTML=this.vmlShape();
this.build.style.zIndex=50;
return;
}
this.build.innerHTML=this.vmlLine("red","",true);
this.build.style.zIndex=50;
}
function $109(color,href,build)
{
var xmin,ymin,xmax,ymax,text;
var coord,i,first,filled,xhref;
var lcolor;
var cmd;
var np;
np=this.nl;
if(build)np=np+1;
if(np <2)return"";
for(i=0; i ";
return text;
}
function $110(color,href,build)
{
var xmin,ymin,xmax,ymax,text;
var coord,i,first,filled,xhref;
var lcolor;
var cmd;
var np;
np=this.nl;
if(build)np=np+1;
if(np <2)return"";
for(i=0; i ";
return text;
}
function $111()
{
var text;
var size;
var np;
var x,y,dx,dy;
var x1,y1,x2,y2;
var x,y;
var rot;
np=this.nl;
if(np <1)return"";
this.angle=0
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
dx=Math.abs(x2-x1);
dy=Math.abs(y2-y1);
if((dx >8)||(dy >8))this.angle=$75(x1,y1,x2,y2);
window.status='Angle: '+$70(this.angle);
try
{
size=parseInt(symbolSize.value);
}
catch(e){size=10 }
if(size <=0)return"";
dx=Math.round(size/2);
x=x1-dx;
y=y1-dx;
rot='';
if(this.angle !=0)rot=' Rotation='+Math.round($70(this.angle))+';';
text="";
toClipboard(text);
return text;
}
function $112(color,href,build)
{
var xmin,ymin,xmax,ymax,text;
var coord,i,first,filled,xhref;
var lcolor;
var cmd;
var np;
np=this.nl;
if(build)np=np+1;
if(np <3)return"";
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[2]));
y2=Math.round(this.view.yToScreen(this.pnty[2]));
x3=Math.round(this.view.xToScreen(this.pntx[1]));
y3=Math.round(this.view.yToScreen(this.pnty[1]));
this.elementArc=$76(x1,y1,x2,y2,x3,y3);
if(this.elementArc.np <=0)return;
filled="F";
if(this.isClosed)filled="T";
for(i=0; i ";
return text;
}
function $113(color,href,build)
{
var xmin,ymin,xmax,ymax,text;
var coord,i,first,filled,xhref;
var lcolor;
var cmd;
var np;
var dx,dy;
var radius;
var diameter;
var cx,cy;
var x1,y1,x2,y2;
np=this.nl;
if(build)np=np+1;
if(np <2)return"";
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
cx=x1;
cy=y1;
dx=Math.abs(x2-x1);
dy=Math.abs(y2-y1);
radius=Math.round(Math.sqrt((dx*dx)+(dy*dy)));
xmin=cx-radius;
ymin=cy-radius;
diameter=radius*2;
text="";
return text;
}
function $114(color,href,build)
{
var xmin,ymin,xmax,ymax,text;
var coord,i,first,filled,xhref;
var cmd;
var np;
var dx,dy;
var radius;
var diameter;
var cx,cy;
var x1,y1,x2,y2;
np=this.nl;
if(build)np=np+1;
if(np <2)return"";
filled="F";
if(this.isClosed)filled="T";
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
xmin=Math.min(x1,x2);
ymin=Math.min(y1,y2);
xmax=Math.max(x1,x2);
ymax=Math.max(y1,y2);
dx=xmax-xmin;
dy=ymax-ymin;
text="";
return text;
}
function $115()
{
this.buildErase();
this.nl=0;
}
function $116(obj)
{
var p,left,dx;
left=0;
p=obj;
while(p !=null)
{
left=left+p.offsetLeft;
p=p.offsetParent;
}
dx=document.documentElement.scrollLeft+document.body.scrollLeft;
return(left);
}
function $117(obj)
{
var p,top,dy;
top=0;
p=obj;
while(p !=null)
{
top=top+p.offsetTop;
p=p.offsetParent;
}
dy=document.documentElement.scrollTop+document.body.scrollTop;
return(top);
}
function $118(status)
{
this.isVisible=status;
this.draw();
}
function $119(sx,sy,shape,color,href,hint)
{
var xhref;
var xhint;
var re = new RegExp("://");
var id;
var cmd;
if(sx <-5)return;
if(sx >(this.width+5))return;
if(sy <-5)return;
if(sy >(this.height+5))return;
xhref="";
if(href !="")
{
n=href.match(re);
if(n !=null)
{ xhref=" href=\""+href+"\" target=\"_blank\""; }
else{ xhref=" onClick=\"graPicture('"+href+"')\""; }
}
id="";
xhint="";
if(hint !="")xhint=" onMouseOut=\"graHint()\" onMouseOver=\"graHint('"+edit(hint)+"')\"";
cmd=" onmousedown=\"x$148(this)\""
+" onmousedown=\"x$150(this)\"";
obj2=document.createElement('');
obj2.innerHTML='';
obj2.style.position="absolute"
obj2.style.top=sy-5;
obj2.style.left=sx-5;
obj2.style.width=10;
obj2.style.height=10;
obj2.fillcolor=color;
obj2.style.zIndex=50;
this.layer.appendChild(obj2);
}
function $120()
{
var txt,angle,text;
var color1,color2;
this.angle=0;
x=Math.round(this.view.xToScreen(this.pntx[0]));
y=Math.round(this.view.yToScreen(this.pnty[0]));
text=textText.value;
if(text=='')text=' ';
size=parseInt(editDC.textSize);
if(size <=0)size=1;
y=y-size;
txt='';
if(editDC.textBold)text=''+text+'';
if(editDC.textItalic)text=''+text+'';
if(editDC.textUnderline)text=''+text+'';
txt=txt+text+'';
return txt;
}
function $120box()
{
var txt,angle,text;
var x1,y1,x2,y2;
var xmin,ymin,xmax,ymax;
var h,w;
var s;
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
xmin=Math.min(x1,x2);
ymin=Math.min(y1,y2);
xmax=Math.max(x1,x2);
ymax=Math.max(y1,y2);
w=xmax-xmin;
h=ymax-ymin;
this.textboxHeight=h;
this.textboxWidth=w;
text=textText.value;
if(text=='')text=' ';
size=parseInt(editDC.textSize);
if(size <=0)size=1;
if(editDC.textBold)text=''+text+'';
if(editDC.textItalic)text=''+text+'';
if(editDC.textUnderline)text=''+text+'';
rot='';
if(this.angle !=0)rot=' Rotation='+Math.round($70(this.angle))+';';
s=editStyle(this.type);
txt="";
txt=txt+"";
txt=txt+'';
txt=txt+'';
txt=txt+text+'';
txt=txt+'';
txt=txt+"";
return txt;
}
function $122()
{
var txt,angle,text;
var x1,y1,x2,y2;
var xmin,ymin,xmax,ymax;
var h,w;
var s;
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
xmin=Math.min(x1,x2);
ymin=Math.min(y1,y2);
xmax=Math.max(x1,x2);
ymax=Math.max(y1,y2);
w=xmax-xmin;
h=ymax-ymin;
this.textboxHeight=h;
this.textboxWidth=w;
rot='';
if(this.angle !=0)rot=' Rotation='+Math.round($70(this.angle))+';';
s=editStyle(this.type);
txt="";
txt=txt+"";
txt=txt+"";
txt=txt+"";
toClipboard(txt);
return txt;
}
function $123()
{
var txt,angle,text;
var x1,y1,x2,y2;
var xmin,ymin,xmax,ymax;
var h,w;
var s,a,c;
var ss;
x1=Math.round(this.view.xToScreen(this.pntx[0]));
y1=Math.round(this.view.yToScreen(this.pnty[0]));
x2=Math.round(this.view.xToScreen(this.pntx[1]));
y2=Math.round(this.view.yToScreen(this.pnty[1]));
xmin=Math.min(x1,x2);
ymin=Math.min(y1,y2);
xmax=Math.max(x1,x2);
ymax=Math.max(y1,y2);
w=xmax-xmin;
h=ymax-ymin;
this.shapeHeight=h;
this.shapeWidth=w;
text=shapeText.value;
if(text=='')text=' ';
size=parseInt(editDC.textSize);
if(size <=0)size=1;
if(editDC.textBold)text=''+text+'';
if(editDC.textItalic)text=''+text+'';
if(editDC.textUnderline)text=''+text+'';
rot='';
if(this.angle !=0)rot=' Rotation='+Math.round($70(this.angle))+';';
s=editStyle(this.type);
a='';
if((editDC.textBgcolor !='')&& editDC.textFill)
a=a+' fillcolor='+editDC.textBgcolor;
ss=parseInt(editDC.shapeStyle);
if(isNaN(ss))ss=63;
if(ss <0)ss=63;
txt="";
txt=txt+"";
c=parseInt(editDC.shapeLineWidth);
if(c >0)
{
txt=txt+"";
}
txt=txt+'';
txt=txt+'';
txt=txt+text+'';
txt=txt+'';
txt=txt+"";
return txt;
}
function $124(range)
{
if(this.rangeObj==null)
{
this.rangeObj=document.createElement('');
this.layer.appendChild(this.rangeObj);
}
this.rangeObj.innerHTML='';
this.rangeObj.style.position="relative"
this.rangeObj.style.top=range[1];
this.rangeObj.style.left=range[0];
this.rangeObj.style.width=range[2]-range[0];
this.rangeObj.style.height=range[3]-range[1];
this.rangeObj.style.visibility='';
this.rangeObj.style.zIndex=150;
}
function $115Range(range)
{
if(this.rangeObj==null)return;
this.rangeObj.style.visibility='hidden';
}
function edit(text)
{
var h;
h=text.toString();
h=trim(h);
while(h.indexOf("'")>=0)
{ h=h.replace("'",""); }
return(h);
}
function $126(onCompleted,onMove,onCancel,x,y)
{
this.removeEvents();
this.nl=0;
this.type='line';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=false;
if(x)
{
this.nl=1;
this.pntx[0]=x;
this.pnty[0]=y;
this.pntx[1]=x;
this.pnty[1]=y;
}
this.attachEvents();
}
function $127(onCompleted,onMove,onCancel,x,y)
{
this.removeEvents();
this.nl=0;
this.type='circle';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=true;
if(x)
{
this.nl=1;
this.pntx[0]=x;
this.pnty[0]=y;
this.pntx[1]=x;
this.pnty[1]=y;
}
this.attachEvents();
}
function $128(onCompleted,onMove,onCancel,x,y)
{
this.removeEvents();
this.nl=0;
this.type='polygon';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=true;
if(x)
{
this.nl=1;
this.pntx[0]=x;
this.pnty[0]=y;
this.pntx[1]=x;
this.pnty[1]=y;
}
this.attachEvents();
}
function $129(onCompleted,onMove,onCancel,x,y)
{
this.removeEvents();
this.nl=0;
this.type='pline';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=false;
if(x)
{
this.nl=1;
this.pntx[0]=x;
this.pnty[0]=y;
this.pntx[1]=x;
this.pnty[1]=y;
}
this.attachEvents();
}
function $130(onCompleted,onMove,onCancel)
{
var c="htt"+"p://msdn.microsoft.com/workshop/samples/author/dhtml/refs/cursor2.ani";
var c="images/Select.cur";
this.removeEvents();
this.type='area';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
this.img.style.cursor="hand";
}
function $131(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='textbox';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $132(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='image';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $133(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='shape';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $129(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='pline';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $134(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='rectangle';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=true;
this.attachEvents();
}
function $135(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='arc';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=false;
this.isRubberDown=false;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $136(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='symbol';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.angle=0;
this.attachEvents();
}
function $137(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='text';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.angle=0;
this.attachEvents();
}
function $138(onCompleted,onMove,onCancel)
{
this.removeEvents();
this.type='sketch';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
this.isClosed=false;
this.attachEvents();
}
function $139(onCompleted,onMove,onCancel,x,y)
{
this.removeEvents();
this.type='measure';
this.setOn(onCompleted,onMove,onCancel);
this.isRubberBand=true;
this.isRubberDown=true;
this.isDown=false;
if(x)
{
this.nl=1;
this.pntx[0]=x;
this.pnty[0]=y;
this.pntx[1]=x;
this.pnty[1]=y;
}
this.attachEvents();
this.img.style.cursor="hand";
}
function $140(onCompleted,onMove,onCancel)
{
this.onCreate='';
this.onMove='';
this.onCancel='';
if(onCompleted)this.onCompleted=onCompleted;
if(onMove)this.onMove=onMove;
if(onCancel)this.onCancel=onCancel;
}
function $141()
{
var obj;
G.isSelect=false;
activeMake=this;
this.isSet=true;
this.nl=0;
this.buildErase();
disableMainEvents();
obj=this.img;
obj=window.document;
obj.attachEvent("onmousedown",$151);
obj.attachEvent("onmousemove",$152);
obj.attachEvent("onmouseup",$153);
obj.attachEvent("ondblclick",$156);
window.document.attachEvent("onkeydown",$154);
window.document.attachEvent("onkeyup",$155);
}
function $142()
{
var obj;
this.img.style.cursor='';
this.buildErase();
if(G !=undefined)G.mode='';
if(! this.isSet)return;
this.isSet=false;
obj=this.img;
obj=window.document;
obj.detachEvent("onmousemove",$152);
obj.detachEvent("onmouseup",$153);
obj.detachEvent("onmousedown",$151);
obj.detachEvent("ondblclick",$156);
window.document.detachEvent("onkeydown",$154);
window.document.detachEvent("onkeyup",$155);
this.isRubberBand=false;
this.isRubberDown=false;
this.isDown=false;
enableMainEvents();
}
function $143()
{
this.removeEvents();
this.command(this.onCompleted);
}
function $144(functionName)
{
var cmd;
var xmin,ymin,xmax,ymax;
var cx,cy,radius,start,sweep;
var h,w;
if(! functionName)return;
if(functionName=='')return;
if((this.type=='area'))
{
cmd=functionName+'(activeMake,'+this.xmin+','+this.ymin+','+this.xmax+','+this.ymax+');';
eval(cmd);
return;
}
if(this.type=='textbox')
{
xmin=Math.min(this.pntx[0],this.pntx[1]);
ymin=Math.min(this.pnty[0],this.pnty[1]);
xmax=Math.max(this.pntx[0],this.pntx[1]);
ymax=Math.max(this.pnty[0],this.pnty[1]);
h=this.textboxHeight;
w=this.textboxWidth;
cmd=functionName+'(activeMake,'+xmin+','+ymin+','+xmax+','+ymax+','+h+','+w+');';
eval(cmd);
return;
}
if(this.type=='image')
{
xmin=Math.min(this.pntx[0],this.pntx[1]);
ymin=Math.min(this.pnty[0],this.pnty[1]);
xmax=Math.max(this.pntx[0],this.pntx[1]);
ymax=Math.max(this.pnty[0],this.pnty[1]);
h=this.textboxHeight;
w=this.textboxWidth;
cmd=functionName+'(activeMake,'+xmin+','+ymin+','+xmax+','+ymax+','+h+','+w+');';
eval(cmd);
return;
}
if(this.type=='shape')
{
xmin=Math.min(this.pntx[0],this.pntx[1]);
ymin=Math.min(this.pnty[0],this.pnty[1]);
xmax=Math.max(this.pntx[0],this.pntx[1]);
ymax=Math.max(this.pnty[0],this.pnty[1]);
h=this.shapeHeight;
w=this.shapeWidth;
cmd=functionName+'(activeMake,'+xmin+','+ymin+','+xmax+','+ymax+','+h+','+w+');';
eval(cmd);
return;
}
if((this.type=='line')||(this.type=='measure')||
(this.type=='circle')||(this.type=='rectangle'))
{
cmd=functionName+'(activeMake,'+this.pntx[0]+','+this.pnty[0]+','+this.pntx[1]+','+this.pnty[1]+');';
eval(cmd);
return;
}
if((this.type=='pline')||(this.type=='polygon')||(this.type=='sketch'))
{
cmd=functionName+'(activeMake,'+this.nl+',this.pntx,this.pnty);';
eval(cmd);
return;
}
if(this.type=='arc')
{
if(this.elementArc.np==0)return;
cx=this.view.screenToX(this.elementArc.cx);
cy=this.view.screenToY(this.elementArc.cy);
radius=Math.abs(this.view.screenToX(0)-this.view.screenToX(this.elementArc.radius));
start=this.elementArc.start;
sweep=this.elementArc.sweep;
cmd=functionName+'(activeMake,'+cx+','+cy+','+radius+','+start+','+sweep+');';
eval(cmd);
return;
}
if(this.type=='symbol')
{
cmd=functionName+'(activeMake,this.pntx[0],this.pnty[0],this.angle);';
eval(cmd);
return;
}
if(this.type=='text')
{
cmd=functionName+'(activeMake,this.pntx[0],this.pnty[0],this.angle);';
eval(cmd);
return;
}
}
function $145(key,ctrl,alt)
{
if(alt)
{
disableMainEvents();
}
}
function $146(key,ctrl,alt)
{
if(alt)
{
enableMainEvents();
}
if(ctrl)
{
if(key==KEY_A)
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.selectAll();
return;
}
if(key==KEY_C)
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.copy();
return;
}
if(key==KEY_X)
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.cut();
return;
}
if(key==KEY_V)
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.paste();
return;
}
if(key==KEY_Z)
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.undelete();
return;
}
}
if(key==ESC)
{
activeMake.erase();
G.clearSelected();
G.setNavigationButtons();
return;
}
if(key==F2)
{
activeMake.completed();
return;
}
if(key==DEL)
{
G.deleteSelected();
return;
}
if(key==KEY_PAGEUP)
{
G.previousFeature();
return;
}
if(key==KEY_PAGEDOWN)
{
G.nextFeature();
return;
}
if(! ctrl)return
if((key==KEY_LEFT)||(key==KEY_DOWN))
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.previousRecord();
return;
}
if((key==KEY_UP)||(key==KEY_RIGHT))
{
window.event.cancelBubble=true;
window.event.returnValue=false;
G.nextRecord();
return;
}
}
function $147()
{
this.removeEvents();
this.isDown=true;
this.isRubberBand=false;
this.isRubberDown=false;
this.command(this.onCancel);
}
function $148(x,y)
{
this.isDown=true;
G.clearSelected();
G.mode='building';
if(this.type=='area')
{
this.buildArea(x,y);
return;
}
if(this.type=='text')this.nl=0;
if(this.type=='arc')
{
this.buildAdd(x,y);
if(this.nl==2)this.isRubberBand=true;
return;
}
this.buildAdd(x,y);
}
function $149(x,y)
{
var cmd;
var rx,ry;
if(this.nl==0)return;
if(this.isDown&&(! this.isRubberDown))return;
if(! this.isRubberBand)return;
this.buildMove(x,y);
this.command(this.onMove);
}
function $150(x,y)
{
this.isDown=false;
this.img.style.cursor='';
if(this.type=='line')
{
if(this.nl==2)this.completed();
return;
}
if((this.type=='symbol')||(this.type=='text'))
{
this.buildAdd(x,y);
this.completed();
return;
}
if(this.type=='arc')
{
if(this.nl <3)return;
this.completed();
return;
}
if(this.type=='circle')
{
if(this.nl==2)this.completed();
return;
}
if(this.type=='rectangle')
{
if(this.nl==2)this.completed();
return;
}
if((this.type=='polygon')||(this.type=='pline'))
{
return;
}
if(this.type=='area')
{
this.buildAreaDone(x,y);
this.completed();
return;
}
if(this.type=='textbox')
{
this.buildAdd(x,y);
if(this.nl==2)this.completed();
return;
}
if(this.type=='image')
{
this.buildAdd(x,y);
if(this.nl==2)this.completed();
return;
}
if(this.type=='shape')
{
this.buildAdd(x,y);
if(this.nl==2)this.completed();
return;
}
if((this.type=='sketch'))
{
this.buildAdd(x,y);
this.completed();
return;
}
if(this.type=='measure')
{
if(this.nl==2)this.completed();
return;
}
}
function myConcern(obj,shilt,ctrl,alt)
{
var shift,ctrl,alt;
shift=event.shiftKey;
ctrl=event.ctrlKey;
alt=event.altKey;
if(alt)return false;
if(! obj)return false;
if(obj.tagName=='INPUT')return false;
if(obj.tagName=='BODY')return false;
if(obj.tagName=='HTML')return false;
if(obj==activeMake.img)return true;
if(obj.id)
{
if(obj.id.substr(0,8)=='icLayer_')return true;
if(obj.id=='icMake')return true;
}
return myConcern(obj.parentElement);
}
function $151()
{
var x,y;
var shift,ctrl,alt;
activeMake.ctrlDown=event.ctrlKey;
if(! myConcern(event.srcElement))return;
x=event.x;
y=event.y;
window.event.cancelBubble=true;
window.event.returnValue=false;
if(G.snapPoint)
{
x=G.snapX;
y=G.snapY;
}
G.snapPoint=false;
if(G.mode=='edit')G.edit.up(x,y);
activeMake.mouseDown(x,y);
G.mode='';
}
function $152()
{
var x,y;
var rx,ry;
if(! myConcern(event.srcElement))return;
x=event.x;
y=event.y;
activeMake.ctrlDown=event.ctrlKey;
window.event.cancelBubble=true;
window.event.returnValue=false;
if((G.mode !='edit')||(G.onMove==""))
{
rx=G.view.screenToX(x);
ry=G.view.screenToY(y);
rx=Math.round(rx*1000)/1000;
ry=Math.round(ry*1000)/1000;
window.status='x: '+rx+' y: '+ry+' sx: '+x+' sy: '+y;
}
if(G.mode=='edit')G.edit.move(x,y);
else activeMake.mouseMove(x,y);
}
function $153()
{
var x,y;
if(! myConcern(event.srcElement))return;
x=event.x;
y=event.y;
activeMake.ctrlDown=event.ctrlKey;
window.event.cancelBubble=true;
window.event.returnValue=false;
if(G.mode=='edit')G.edit.up(x,y);
else activeMake.mouseUp(x,y);
G.mode='';
}
function $154()
{
activeMake.keyDown(window.event.keyCode,window.event.ctrlKey,window.event.altKey);
}
function $155()
{
activeMake.keyUp(window.event.keyCode,window.event.ctrlKey,window.event.altKey);
}
function $156()
{
window.event.cancelBubble=true;
window.event.returnValue=false;
if(! myConcern(event.srcElement))return;
activeMake.keyDown(F2);
}
function $157()
{
if(nl <2)return false;
return false;
}