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

📄 omgrid.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     *        the grid from the longitude anchor point.     * @param y vertical location, in pixels, of the top of the grid     *        from the latitude anchor point.     * @param vResolution the vertical resolution of the data, as     *        pixels per row.     * @param hResolution the horizontal resolution of the data, as     *        pixels per column.     * @param data GridData object holding rows and columns of grid data.     */    public OMGrid(float lat, float lon, int x, int y, float vResolution,            float hResolution, GridData data) {        setRenderType(RENDERTYPE_OFFSET);        set(lat, lon, x, y, vResolution, hResolution, data);    }    /**     * Set the parameters of the OMGrid after construction.     */    protected void set(float lat, float lon, int x, int y, float vResolution,                       float hResolution, int[][] data) {        set(lat, lon, x, y, vResolution, hResolution, new OMGridData.Int(data));    }    /**     * Set the parameters of the OMGrid after construction.     */    protected void set(float lat, float lon, int x, int y, float vResolution,                       float hResolution, GridData data) {        latitude = lat;        longitude = lon;        point = new Point(x, y);        verticalResolution = vResolution;        horizontalResolution = hResolution;        setData(data);    }    /**     * Set the vertical number of data points. Should correspond to     * the the data, and to the major setting of the OMGrid. Will be     * set automatically when the data is set.     *      * @deprecated set when data is set.     */    public void setRows(int rows) {    //      this.rows = rows;    }    /**     * Get the vertical number of data points.     */    public int getRows() {        if (data != null) {            return data.getNumRows();        } else {            return 0;        }    }    public void setLatitude(float lat) {        if (latitude == lat)            return;        latitude = lat;        setNeedToRegenerate(true);    }    /**     * Get the latitude of the lower left anchor point of the grid, in     * decimal degrees.     */    public float getLatitude() {        return latitude;    }    public void setLongitude(float lon) {        if (longitude == lon)            return;        longitude = lon;        setNeedToRegenerate(true);    }    /**     * Get the latitude of the lower left anchor point of the grid, in     * decimal degrees.     */    public float getLongitude() {        return longitude;    }    /**     * Get the screen location, or x/y offset from the lat/lon anchor     * point, of the lower left corner of the grid.     */    public Point getPoint() {        return point;    }    /**     * Set the horizontal number of data points. Should correspond to     * the the data, and to the major setting of the OMGrid. Will be     * set automatically when the data is set. Does nothing.     *      * @deprecated set when the data is set     */    public void setColumns(int columns) {    //      this.columns = columns;    }    /**     * Set the horizontal number of data points.     */    public int getColumns() {        if (data != null) {            return data.getNumColumns();        } else {            return 0;        }    }    /**     * Set which dimension is defined first in the two dimensional     * array. If COLUMN_MAJOR (true and the default), the first     * dimension of the data array will represent the horizontal     * location of the data, and the second dimension will represent     * the vertical location. Vice versa for COLUMN_ROW. Calling this     * method will reset the column and row count to match the data to     * the new orientation.     */    public void setMajor(boolean maj) {        if (data != null && maj != data.getMajor()) {            data.setMajor(maj);        }    }    /**     * Set which dimension is defined first in the two dimensional     * array.     */    public boolean getMajor() {        if (data != null) {            return data.getMajor();        }        return major;    }    /**     * Set the angle that the grid should be rotated. May not be     * implemented for some OMGridGenerators.     *      * @param orient is the angle of the grid, in radians. Up/North is     *        zero.     */    public void setOrientation(float orient) {        orientation = orient;    }    /**     * Get the angle that was set for the grid to be rotated. In     * radians, up/north is zero.     */    public float getOrientation() {        return orientation;    }    /**     * Set the data of the grid. The major setting will cause this     * method to set the number of rows and columns accordingly. The     * values in the array will be interpreted to the OMGridGenerator     * that you provide to this OMGrid. The OMGridGenerator will     * create what gets drawn on the map based on this data. The     * int[][] will be wrapped by a GridData.Int object.     */    public void setData(int[][] data) {        setData(new OMGridData.Int(data));    }    /**     * Set the data of the grid. The major setting will cause this     * method to set the number of rows and columns accordingly. The     * values in the array will be interpreted to the OMGridGenerator     * that you provide to this OMGrid. The OMGridGenerator will     * create what gets drawn on the map based on this data.     */    public void setData(GridData data) {        this.data = data;    }    /**     * Get the data array for the OMGrid. What these numbers represent     * depends on what OMGridGenerator is being used.     */    public GridData getData() {        return data;    }    /**     * There is an option in the OMGrid where the data array contains     * ID numbers for a set of other objects. So the grid holds onto     * the location of these objects, and the OMGridObjects provides     * the ID mapping to the actual object.     */    public void setGridObjects(OMGridObjects someGridObjs) {        gridObjects = someGridObjs;    }    /**     * Get the OMGridObjects containing the mapping of the data array     * IDs to a set of Objects.     */    public OMGridObjects getGridObjects() {        return gridObjects;    }    /**     * Set the OMGridGenerator that will interpret the data array and     * create OMGraphics for it.     */    public void setGenerator(OMGridGenerator aGenerator) {        generator = aGenerator;    }    /**     * Get the OMGridGenerator being used to interpret the data array.     */    public OMGridGenerator getGenerator() {        return generator;    }    /**     * Set the number of decimal degrees between horizontal rows.     */    public void setVerticalResolution(float vRes) {        verticalResolution = vRes;    }    /**     * Get the number of decimal degrees between horizontal rows.     */    public float getVerticalResolution() {        return verticalResolution;    }    /**     * Set the number of decimal degrees between vertical columns.     */    public void setHorizontalResolution(float hRes) {        horizontalResolution = hRes;    }    /**     * Get the number of decimal degrees between vertical columns.     */    public float getHorizontalResolution() {        return horizontalResolution;    }    public int getWidth() {        return width;    }    public int getHeight() {        return height;    }    /**     * Set the units for the grid data.     */    public void setUnits(Length length) {        units = length;    }    /**     * Get the units for the grid data.     */    public Length getUnits() {        return units;    }    /**     * Generate OMGraphics based on the data array. If there is an     * OMGridGenerator, it will be used to generate OMGraphics from     * the data array. If not, the OMGridObjects will be used to     * create OMGraphics for the map.     */    public synchronized boolean generate(Projection proj) {        float upLat;        int columns = getColumns();        int rows = getRows();        // Clear out the OMGraphicList part        super.clear();        setShape(null);        /**         * Let's figure out the dimensions and location of the grid,         * relative to the screen.         */        if (renderType == RENDERTYPE_LATLON) {            /**             * Means that the latitudeResolution and             * horizontalResolution refer to degrees/datapoint.             */            float rightLon;            rightLon = longitude + ((float) columns) * horizontalResolution;            upLat = latitude + ((float) rows) * verticalResolution;            point1 = proj.forward(upLat, longitude);            point2 = proj.forward(latitude, rightLon);            /** For later... */            height = point2.y - point1.y;            width = point2.x - point1.x;            if (Debug.debugging("grid")) {                Debug.output("OMGrid.generate:  height = " + height                        + ", width = " + width);            }        } else if (renderType == RENDERTYPE_XY

⌨️ 快捷键说明

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