coordinate.js

来自「WebGis基本功能展示」· JavaScript 代码 · 共 25 行

JS
25
字号
Coordinate = Class.create();
Coordinate.prototype = {
    initialize: function(x, y){
        this.x = x;
        this.y = y;
    },
    
    isSame: function(coord){
        if (this.x == coord.x && this.y == coord.y) 
			return true;
		return false;
    },
    
    getBound: function(width, height){
        return new Bound(this.x-width/2, this.x+width/2, this.y-height/2, this.y+height/2);
    },
    
    getPoint: function(){
        return new Point(this.x/1e16,this.y/1e16);
    },
    
    toString: function(){
        return 'X:'+this.x+',Y:'+this.y;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?