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

📄 getmaprequest.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.vfny.geoserver.wms.requests;

import com.vividsolutions.jts.geom.Envelope;
import org.geoserver.ows.util.CaseInsensitiveMap;
import org.geotools.styling.Style;
import org.geotools.styling.StyledLayerDescriptor;
import org.opengis.filter.Filter;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.vfny.geoserver.global.MapLayerInfo;
import org.vfny.geoserver.wms.responses.palette.InverseColorMapOp;
import org.vfny.geoserver.global.WMS;
import org.vfny.geoserver.wms.servlets.WMService;
import java.awt.Color;
import java.awt.geom.Point2D;
import java.awt.image.IndexColorModel;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;


/**
 * Represents a WMS GetMap request. as a extension to the WMS spec 1.1.
 *
 * @author Gabriel Roldan, Axios Engineering
 * @author Simone Giannecchini
 * @version $Id: GetMapRequest.java 7639 2007-10-22 15:18:58Z aaime $
 */
public class GetMapRequest extends WMSRequest {
    /** DOCUMENT ME! */
    static final Color DEFAULT_BG = Color.white;

    /** DOCUMENT ME! */
    public static final String SE_XML = "SE_XML";
    private static final String TRANSACTION_REQUEST_TYPE = "GetMap";

    /** set of mandatory request's parameters */
    private MandatoryParameters mandatoryParams = new MandatoryParameters();

    /** set of optionals request's parameters */
    private OptionalParameters optionalParams = new OptionalParameters();

    /** format options */
    private Map /*<String,Object>*/ formatOptions = new CaseInsensitiveMap(new HashMap());

    /** raw kvp parameters non-parsed */
    private Map /*<String,String>*/ rawKvp;
    
    /**
     * Creates a GetMapRequest request.
     *
     * @param service The service handling the request.
     */
    public GetMapRequest(WMService service) {
        super(TRANSACTION_REQUEST_TYPE, service);
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public Envelope getBbox() {
        return this.mandatoryParams.bbox;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public java.awt.Color getBgColor() {
        return this.optionalParams.bgColor;
    }

    /**
     * DJB: spec says SRS is *required*, so if they dont specify one, we should throw an error
     *      instead we use "NONE" - which is no-projection.
     *      Previous behavior was to the WSG84 lat/long (4326)
     *
     * @return request CRS, or <code>null</code> if not set.
     * TODO: make CRS manditory as for spec conformance
     */
    public CoordinateReferenceSystem getCrs() {
        return this.optionalParams.crs;
    }

    public String getSRS() {
        return this.optionalParams.srs;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public String getExceptions() {
        return this.optionalParams.exceptions;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public String getFormat() {
        return this.mandatoryParams.format;
    }

    /**
     * Map of String,Object which contains kvp's which are specific to a
     * particular output format.
     */
    public Map getFormatOptions() {
        return formatOptions;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public int getHeight() {
        return this.mandatoryParams.height;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public MapLayerInfo[] getLayers() {
        return this.mandatoryParams.layers;
    }

    /**
     * Gets a list of the names of the styles to be returned by the server.
     *
     * @return A list of Strings of the names of the styles.
     */
    public List getStyles() {
        return this.mandatoryParams.styles;
    }

    /**
     * Gets the url specified by the "SLD" parameter.
     */
    public URL getSld() {
        return this.optionalParams.sld;
    }

    /**
     * Gets the string specified the "SLD_BODY" parameter.
     */
    public String getSldBody() {
        return this.optionalParams.sldBody;
    }

    /**
     * Gets the value of the "VALIDATESCHEMA" parameter which controls wether
     * the value of the "SLD paramter is schema validated.
     */
    public Boolean getValidateSchema() {
        return this.optionalParams.validateSLD;
    }

    /**
     * Gets a list of the the filters that will be applied to each layer before rendering
     *
     * @return -
     * @deprecated use {@link #getFilter()}.
     */
    public List getFilters() {
        return this.optionalParams.filters;
    }

    /**
     * Gets a list of the the filters that will be applied to each layer before rendering
     *
     * @return  A list of {@link Filter}.
     *
     */
    public List getFilter() {
        return this.optionalParams.filters;
    }

    /**
     * Gets a list of the cql filtesr that will be applied to each layer before
     * rendering.
     *
     * @return A list of {@link Filter}.
     *
     */
    public List getCQLFilter() {
        return this.optionalParams.cqlFilters;
    }

    /**
     * Gets a list of the feature ids that will be used to filter each layer
     * before rendering.
     *
     * @return A list of {@link String}.
     */
    public List getFeatureId() {
        return this.optionalParams.featureIds;
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     *
     */
    public boolean isTransparent() {
        return this.optionalParams.transparent;
    }

    /**
     * <a href="http://wiki.osgeo.org/index.php/WMS_Tiling_Client_Recommendation">WMS-C specification</a> tiling hint
     *
     */
    public boolean isTiled() {
        return this.optionalParams.tiled;
    }

    public Point2D getTilesOrigin() {
        return this.optionalParams.tilesOrigin;
    }

    public int getBuffer() {
        return this.optionalParams.buffer;
    }

	public InverseColorMapOp getPalette() {
		return this.optionalParams.paletteInverter;
	}

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public int getWidth() {
        return this.mandatoryParams.width;
    }

    /**
     * @return the KML/KMZ score value for image vs. vector response
     * @deprecated use <code>getFormatOptions().get( "kmscore" )</code>
     */
    public int getKMScore() {
        Integer kmscore = (Integer) getFormatOptions().get("kmscore");

        if (kmscore != null) {
            return kmscore.intValue();
        }

        return 40; //old default
    }

    /**
     * @return true: return full attribution for placemark <description>
     * @deprecated use <code>getFormatOptions().get( "kmattr" )</code>
     */
    public boolean getKMattr() {
        Boolean kmattr = (Boolean) getFormatOptions().get("kmattr");

        if (kmattr != null) {
            return kmattr.booleanValue();
        }

        return true; //old default
    }

    /**
     * @return super overlay flag, <code>true</code> if super overlay requested.
     * @deprecated use <code>getFormatOptions().get( "superoverlay" )</code>
     */
    public boolean getSuperOverlay() {
        Boolean superOverlay = (Boolean) getFormatOptions().get("superoverlay");

        if (superOverlay != null) {
            return superOverlay.booleanValue();
        }

        return false; //old default
    }

    /**
     * @return kml legend flag, <code>true</code> if legend is enabled.
     * @deprecated use <code>getFormatOptions().get( "legend" )</code>
     */
    public boolean getLegend() {
        Boolean legend = (Boolean) getFormatOptions().get("legend");

        if (legend != null) {
            return legend.booleanValue();
        }

        return false; //old default
    }

    /**
     * @return The time request parameter.
     */
    public List getTime() {
        return this.optionalParams.time;
    }

    /**
     * @return The elevation request parameter.
     */
    public Integer getElevation() {
        return this.optionalParams.elevation;
    }

    /**
     * Returs the feature version optional parameter
     * @return
     */
    public String getFeatureVersion() {
        return this.optionalParams.featureVersion;
    }
    
    /**
     * Returns the remote OWS type
     * @return
     */
    public String getRemoteOwsType() {
        return optionalParams.remoteOwsType;
    }

    /**
     * Returs the remote OWS URL
     * @return
     */
    public URL getRemoteOwsURL() {
        return optionalParams.remoteOwsURL;
    }

    /**
     * Gets the raw kvp parameters which were used to create the request.
     */
    public Map getRawKvp() {
        return rawKvp;
    }
    
    /**
     * DOCUMENT ME!
     *
     * @param bbox DOCUMENT ME!
     */
    public void setBbox(Envelope bbox) {
        this.mandatoryParams.bbox = bbox;
    }

    /**
     * DOCUMENT ME!
     *
     * @param bgColor DOCUMENT ME!
     */
    public void setBgColor(java.awt.Color bgColor) {
        this.optionalParams.bgColor = bgColor;
    }

    /**
     * DOCUMENT ME!
     *
     * @param crs DOCUMENT ME!
     */
    public void setCrs(CoordinateReferenceSystem crs) {
        this.optionalParams.crs = crs;
    }

    /**
     * DOCUMENT ME!
     *
     * @param crs DOCUMENT ME!
     */
    public void setSRS(String srs) {
        this.optionalParams.srs = srs;
    }

    /**
     * DOCUMENT ME!
     *
     * @param exceptions DOCUMENT ME!
     */
    public void setExceptions(String exceptions) {
        this.optionalParams.exceptions = exceptions;
    }

⌨️ 快捷键说明

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