//========================================================================
//青岛港式图 客户端程序,版权所有,中山大学
//作者: 胡如根
//修改:
//文件名:
//功能:
//最后修改时间:
//========================================================================
//将地图坐标转化为视图坐标
//将地图横坐标转化为视图横坐标
function MapToViewX(dMapX)
{
return parseInt(p_imgMapWidth/2 + (dMapX-p_midX) * p_scale);
}//将地图纵坐标转化为视图纵坐标
function MapToViewY(dMapY)
{
return parseInt(p_imgMapHeight/2 + (dMapY-p_midY) * p_scale);
}function MapToVewStr(x1,y1,x2,y2)
{
var strRes;
strRes= "'" + MapToViewX(x1) + ","
+ MapToViewY(y1) + ","
+ MapToViewX(x2) + ","
+ MapToViewY(y1) + "'"
return strRes;
}
//建立Berth对象function PortBerth(x1,y1,x2,y2,msg)
{
//var vx1,vy1,vx2,vy2;
this.vx1=0;
this.vy1=0;
this.vx2=0;
this.vy2=0;
this.x1=x1;
this.y1=y1;
this.x2=x2;
this.y2=y2;
this.msg=msg;
}PortBerth.prototype.changeViewPos=function()
{
this.vx1=MapToViewX(this.x1);
this.vy1=MapToViewY(this.y1);
this.vx2=MapToViewX(this.x2);
this.vy2=MapToViewY(this.y2);
}PortBerth.prototype.isInrect=function(x,y)
{
var bFlag;
bFlag=false;
if((this.vx1 < x) && (x < this.vx2) && (this.vy1 < y)&&(y < this.vy2)) bFlag=true;
return bFlag;
}PortBerth.prototype.debuginfo=function()
{
var strRes;
strRes = this.msg;
strRes = strRes + "p_midX=" + p_midX + " p_midY=" + p_midY + " p_scale=" + p_scale + "\n";
strRes = strRes + " x1= " + this.x1
+ " y1= " + this.y1
+ " x2= " + this.x2
+ " y2= " + this.y2 + "\n";
strRes = strRes + " vx1= " + this.vx1
+ " vy1= " + this.vy1
+ " vx2= " + this.vx2
+ " vy2= " + this.vy2 + "\n";
return strRes;}
//青岛港式图 客户端程序,版权所有,中山大学
//作者: 胡如根
//修改:
//文件名:
//功能:
//最后修改时间:
//========================================================================
//将地图坐标转化为视图坐标
//将地图横坐标转化为视图横坐标
function MapToViewX(dMapX)
{
return parseInt(p_imgMapWidth/2 + (dMapX-p_midX) * p_scale);
}//将地图纵坐标转化为视图纵坐标
function MapToViewY(dMapY)
{
return parseInt(p_imgMapHeight/2 + (dMapY-p_midY) * p_scale);
}function MapToVewStr(x1,y1,x2,y2)
{
var strRes;
strRes= "'" + MapToViewX(x1) + ","
+ MapToViewY(y1) + ","
+ MapToViewX(x2) + ","
+ MapToViewY(y1) + "'"
return strRes;
}
//建立Berth对象function PortBerth(x1,y1,x2,y2,msg)
{
//var vx1,vy1,vx2,vy2;
this.vx1=0;
this.vy1=0;
this.vx2=0;
this.vy2=0;
this.x1=x1;
this.y1=y1;
this.x2=x2;
this.y2=y2;
this.msg=msg;
}PortBerth.prototype.changeViewPos=function()
{
this.vx1=MapToViewX(this.x1);
this.vy1=MapToViewY(this.y1);
this.vx2=MapToViewX(this.x2);
this.vy2=MapToViewY(this.y2);
}PortBerth.prototype.isInrect=function(x,y)
{
var bFlag;
bFlag=false;
if((this.vx1 < x) && (x < this.vx2) && (this.vy1 < y)&&(y < this.vy2)) bFlag=true;
return bFlag;
}PortBerth.prototype.debuginfo=function()
{
var strRes;
strRes = this.msg;
strRes = strRes + "p_midX=" + p_midX + " p_midY=" + p_midY + " p_scale=" + p_scale + "\n";
strRes = strRes + " x1= " + this.x1
+ " y1= " + this.y1
+ " x2= " + this.x2
+ " y2= " + this.y2 + "\n";
strRes = strRes + " vx1= " + this.vx1
+ " vy1= " + this.vy1
+ " vx2= " + this.vx2
+ " vy2= " + this.vy2 + "\n";
return strRes;}
解决方案 »
- 为什么查询按钮,按下去没反应的.JS问题?_有答案_火速结贴
- JS做贷款计算器
- 哪位高手帮我看下加入背景图怎么加
- 怎么实现搜索后(一次搜索),页面中所有的关键字高亮显示!
- 请教下用js如何清除cookie?
- 想在网站订阅别人blog的内容,就象csdn首页上面的"专家Blogs",不知道怎么实现?
- 怎么用js动态改变<s:url>标签的action的值
- 如何獲取在一個Form裡面的所有name類似的對象的值?
- 如何提取网页文本框中被选定文本的内容
- 请问:一个含有Frame的页面,打印时IE是怎么确定打哪个页面的
- 怎么才能让Access数据库的某字段放下无限大的数据啊?
- 请问这种怪模怪样的js代码是通过什么东西编译过的?
调用部分是:function onMouseClick(E){
GetMouse(E);
x2 = mouseX;
y2 = mouseY;
window.status= " x2=" + x2 + " y2=" + y2;
var inBerth;
inBerth=false;
if((bTrackStarted==true)&&(event.srcElement.name=="WORKLAYER"))
{
OnTracking(E);
}
else //added 2004年6月16日
{ for(var i=0; i<berths.length; i++)
{
if(berths[i].isInrect(x2,y2))
{
//showHint("isInrect" + berths[i].debuginfo());
//alert("bb");
showHint(berths[i].msg);
SelectMouseCursor("BERTH");
inBerth=true;
break;
}
}
if(!inBerth) SelectMouseCursor("NORMAL");
}
return;
}