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

📄 getmaprequest.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

    /**
     * DOCUMENT ME!
     *
     * @param format DOCUMENT ME!
     */
    public void setFormat(String format) {
        this.mandatoryParams.format = format;
    }

    /**
     * Sets the format options.
     *
     * @param formatOptions A map of String,Object
     * @see #getFormatOptions()
     */
    public void setFormatOptions(Map formatOptions) {
        this.formatOptions = formatOptions;
    }

    /**
     * DOCUMENT ME!
     *
     * @param height DOCUMENT ME!
     */
    public void setHeight(int height) {
        this.mandatoryParams.height = height;
    }

    public void setHeight(Integer height) {
        this.mandatoryParams.height = height.intValue();
    }

    /**
     * DOCUMENT ME!
     *
     * @param layers DOCUMENT ME!
     */
    public void setLayers(MapLayerInfo[] layers) {
        this.mandatoryParams.layers = layers;
    }

    public void setLayers(List /*<MapLayerInfo>*/ layers) {
        this.mandatoryParams.layers = (MapLayerInfo[]) layers.toArray(new MapLayerInfo[layers.size()]);
    }

    /**
     * DOCUMENT ME!
     *
     * @param styles List&lt;org.geotools.styling.Style&gt;
     */
    public void setStyles(List styles) {
        this.mandatoryParams.styles = styles;
    }

    /**
     * Sets the url specified by the "SLD" parameter.
     */
    public void setSld(URL sld) {
        this.optionalParams.sld = sld;
    }

    /**
     * Sets the string specified by the "SLD_BODY" parameter
     */
    public void setSldBody(String sldBody) {
        this.optionalParams.sldBody = sldBody;
    }

    /**
     * Sets the flag to validate the "SLD" parameter or not.
     * //TODO
     */
    public void setValidateSchema(Boolean validateSLD) {
        this.optionalParams.validateSLD = validateSLD;
    }

    /**
     * Sets a list of filters, one for each layer
     *
     * @param filters A list of {@link Filter}.
     * @deprecated use {@link #setFilter(List)}.
     */
    public void setFilters(List filters) {
        setFilter(filters);
    }

    /**
     * Sets a list of filters, one for each layer
     *
     * @param filters A list of {@link Filter}.
     */
    public void setFilter(List filters) {
        this.optionalParams.filters = filters;
    }

    /**
     * Sets a list of filters ( cql ), one for each layer.
     *
     * @param cqlFilters A list of {@link Filter}.
     */
    public void setCQLFilter(List cqlFilters) {
        this.optionalParams.cqlFilters = cqlFilters;
    }

    /**
     * Sets a list of feature ids, one for each layer.
     *
     * @param featureIds A list of {@link String}.
     */
    public void setFeatureId(List featureIds) {
        this.optionalParams.featureIds = featureIds;
    }

    /**
     * DOCUMENT ME!
     *
     * @param transparent DOCUMENT ME!
     */
    public void setTransparent(boolean transparent) {
        this.optionalParams.transparent = transparent;
    }

    public void setTransparent(Boolean transparent) {
        this.optionalParams.transparent = (transparent != null) ? transparent.booleanValue() : false;
    }

    public void setBuffer(int buffer) {
        this.optionalParams.buffer = buffer;
    }

	public void setPalette(InverseColorMapOp paletteInverter) {
		this.optionalParams.paletteInverter = paletteInverter;
	}
    public void setBuffer(Integer buffer) {
        this.optionalParams.buffer = (buffer != null) ? buffer.intValue() : 0;
    }


    public void setTiled(boolean tiled) {
        this.optionalParams.tiled = tiled;
    }

    public void setTiled(Boolean tiled) {
        this.optionalParams.tiled = (tiled != null) ? tiled.booleanValue() : false;
    }

    public void setTilesOrigin(Point2D origin) {
        this.optionalParams.tilesOrigin = origin;
    }

    /**
     * DOCUMENT ME!
     *
     * @param width DOCUMENT ME!
     */
    public void setWidth(int width) {
        this.mandatoryParams.width = width;
    }

    public void setWidth(Integer width) {
        this.mandatoryParams.width = width.intValue();
    }

    /**
     * @param score the KML/KMZ score value for image vs. vector response, from 0 to 100
     * @deprecated use <code>getFormatOptions().put( "kmscore", new Integer( score ) );</code>
     */
    public void setKMScore(int score) {
        getFormatOptions().put("kmscore", new Integer(score));
    }

    /**
     * @param on true: full attribution; false: no attribution
     * @deprecated use <code>getFormatOptions().put( "kmattr", new Boolean( on ) );</code>
     */
    public void setKMattr(boolean on) {
        getFormatOptions().put("kmattr", new Boolean(on));
    }

    /**
     * Sets the super overlay parameter on the request.
     * @deprecated use <code>getFormatOptions().put( "superoverlay", new Boolean( superOverlay ) );</code>
     */
    public void setSuperOverlay(boolean superOverlay) {
        getFormatOptions().put("superoverlay", new Boolean(superOverlay));
    }

    /**
     * Sets the kml legend parameter of the request.
     * @deprecated use <code>getFormatOptions().put( "legend", new Boolean( legend ) );</code>
     */
    public void setLegend(boolean legend) {
        getFormatOptions().put("legend", new Boolean(legend));
    }

    /**
     * Sets the time request parameter.
     *
     */
    public void setTime(List time) {
        this.optionalParams.time = time;
    }

    /**
     * Sets the elevation request parameter.
     */
    public void setElevation(Integer elevation) {
        this.optionalParams.elevation = elevation;
    }

    /**
     * Sets the feature version optional param
     * @param featureVersion
     */
    public void setFeatureVersion(String featureVersion) {
        this.optionalParams.featureVersion = featureVersion;
    }
    
    public void setRemoteOwsType(String remoteOwsType) {
        this.optionalParams.remoteOwsType = remoteOwsType;
    }

    public void setRemoteOwsURL(URL remoteOwsURL) {
        this.optionalParams.remoteOwsURL = remoteOwsURL;
    }

    /**
     * Sets the raw kvp parameters which were used to create the request.
     */
    public void setRawKvp( Map rawKvp ) {
        this.rawKvp = rawKvp;
    }
    
    /**
     * decodes a color of the form <code>#FFFFFF</code> into a
     * <code>java.awt.Color</code> object
     *
     * @param hexColor DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    private static final Color decodeColor(String hexColor) {
        return Color.decode(hexColor);
    }

    /**
     * DOCUMENT ME!
     *
     * @author Gabriel Roldan, Axios Engineering
     * @version $Id: GetMapRequest.java 7639 2007-10-22 15:18:58Z aaime $
     */
    private class MandatoryParameters {
        /** ordered list of requested layers */
        MapLayerInfo[] layers;

        /**
         * ordered list of requested layers' styles, in a one to one
         * relationship with <code>layers</code>
         */
        List styles;

        /** DOCUMENT ME!  */
        Envelope bbox;

        /** DOCUMENT ME!  */
        int width;

        /** DOCUMENT ME!  */
        int height;

        /** DOCUMENT ME!  */
        String format;
    }

    /**
     * DOCUMENT ME!
     *
     * @author Gabriel Roldan, Axios Engineering
     * @version $Id: GetMapRequest.java 7639 2007-10-22 15:18:58Z aaime $
     */
    private class OptionalParameters {
        /**
         * the map's background color requested, or the default (white) if not
         * specified
         */
        Color bgColor = DEFAULT_BG;

        /** from SRS (1.1) or CRS (1.2) param */
        CoordinateReferenceSystem crs;

        /** EPSG code for the SRS */
        String srs;

        /** vendor extensions, allows to filter each layer with a user defined filter */
        List filters;

        /** cql filters */
        List cqlFilters;

        /** feature id filters */
        List featureIds;

        /** DOCUMENT ME!  */
        String exceptions = SE_XML;

        /** DOCUMENT ME!  */
        boolean transparent = false;

        /**
         * Tiling hint, according to the
         * <a href="http://wiki.osgeo.org/index.php/WMS_Tiling_Client_Recommendation">WMS-C specification</a>
         */
        boolean tiled;

        /**
         * Temporary hack since finding a good tiling origin would require us to compute
         * the bbox on the fly
         * TODO: remove this once we cache the real bbox of vector layers
         */
        public Point2D tilesOrigin;

        /** the rendering buffer, in pixels **/
        int buffer;

		/** The paletteInverter used for rendering, if any */
		InverseColorMapOp paletteInverter;

        /** time elevation parameter, a list since many pattern setup can be possible, see
         *  for example http://mapserver.gis.umn.edu/docs/howto/wms_time_support/#time-patterns */
        List time;

        /** time elevation parameter */
        Integer elevation;

        /**
         * SLD parameter
         */
        URL sld;

        /**
         * SLD_BODY parameter
         */
        String sldBody;

        /** flag to validate SLD parameter */
        Boolean validateSLD = Boolean.FALSE;

        /** feature version (for versioned requests) */
        String featureVersion;
        
        /** Remote OWS type */
        String remoteOwsType;
        
        /** Remote OWS url */
        URL remoteOwsURL;
    }

    /**
     * Standard override of toString()
     *
     * @return a String representation of this request.
     */
    public String toString() {
        StringBuffer returnString = new StringBuffer("\nGetMap Request");
        returnString.append("\n version: " + version);
        returnString.append("\n output format: " + mandatoryParams.format);
        returnString.append("\n width height: " + mandatoryParams.height + ","
            + mandatoryParams.width);
        returnString.append("\n bbox: " + mandatoryParams.bbox);
        returnString.append("\n layers: ");

        for (int i = 0; i < mandatoryParams.layers.length; i++) {
            returnString.append(mandatoryParams.layers[i].getName());

            if (i < (mandatoryParams.layers.length - 1)) {
                returnString.append(",");
            }
        }

        returnString.append("\n styles: ");

        for (Iterator it = mandatoryParams.styles.iterator(); it.hasNext();) {
            Style s = (Style) it.next();
            returnString.append(s.getName());

            if (it.hasNext()) {
                returnString.append(",");
            }
        }

        //returnString.append("\n inside: " + filter.toString());
        return returnString.toString();
    }
}

⌨️ 快捷键说明

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