⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapcontrol.js

📁 WebGis基本功能展示
💻 JS
字号:
MapControl = Class.create();
MapControl.prototype = Object.extend(new Abstract.Control(), {
    initialize: function(id, container){
        this.id = id;        
        this.mapDiv = Util.createDiv(id);
        this.mapDiv.style.position = "absolute";
        this.mapDiv.style.zIndex = 0;
        this.mapDiv.style.cursor = "move";
        this.container = container;
        this.container.style.border = "1px solid #666666";
		this.container.style.overflow = "hidden";
		this.container.style.position = "relative";
        this.container.appendChild(this.mapDiv);
    },
    
    paint: function(model, isTracing){
        var curZoom = model.getZoom();
        var viewBound = curZoom.getViewBound(this.container).clone(model.getViewCenterCoord());
        var mapBound = curZoom.realMapBound;
        var deltaX = (mapBound.getMinX() - viewBound.getMinX()) * (curZoom.getTileCols() * TileSize / mapBound.getWidth());
        var deltaY = (viewBound.getMaxY() - mapBound.getMaxY()) * (curZoom.getTileRows() * TileSize / mapBound.getHeight());
        this.mapDiv.style.left = deltaX + "px";
        this.mapDiv.style.top = deltaY + "px";
        this.mapDiv.style.width = (curZoom.getTileCols() * TileSize) + "px"
        this.mapDiv.style.height = (curZoom.getTileRows() * TileSize) + "px"
        
        this.loadTiles(model, this.container, this.mapDiv, isTracing);
        
    }
});

⌨️ 快捷键说明

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