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

📄 giflegendgraphicproducerfactory.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
字号:
/* 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.responses.legend.gif;

import org.vfny.geoserver.wms.GetLegendGraphicProducer;
import org.vfny.geoserver.wms.GetLegendGraphicProducerSpi;
import org.vfny.geoserver.wms.responses.helpers.JAISupport;
import java.util.Collections;
import java.util.Map;
import java.util.Set;


/**
 * Factory of legend graphic producers for the <code>"image/gif"</code> format.
 *
 * @author Gabriel Roldan, Axios Engineering
 * @version $Id: GIFLegendGraphicProducerFactory.java 6326 2007-03-15 18:36:40Z jdeolive $
 */
public class GIFLegendGraphicProducerFactory implements GetLegendGraphicProducerSpi {
    /**
     * Empty constructor, as required by the factory strategy.
     */
    public GIFLegendGraphicProducerFactory() {
        super();
    }

    /**
     * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#getName()
     */
    public String getName() {
        return "Graphics Interchange Format (GIF) legend graphics producer";
    }

    /**
     * DOCUMENT ME!
     *
     * @return a singleton Set with the supported mime type.
     *
     * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#getSupportedFormats()
     */
    public Set getSupportedFormats() {
        return Collections.singleton(GifLegendGraphicProducer.MIME_TYPE);
    }

    /**
     * Returns wether the gif legend producer is available to be used.
     *
     * @return <code>true</code> iif JAI is available, since the actual image generation
     * depends on JAI availability.
     *
     * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#isAvailable()
     */
    public boolean isAvailable() {
        return JAISupport.isJaiAvailable();
    }

    /**
     * Evaluates if the prioducer this factory serves can create images in
     * <code>mimeType</code> format.
     *
     * @param mimeType DOCUMENT ME!
     *
     * @return true iif <code>mimeType == "image/gif"</code>
     *
     * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#canProduce(java.lang.String)
     */
    public boolean canProduce(String mimeType) {
        return GifLegendGraphicProducer.MIME_TYPE.equals(mimeType);
    }

    /**
     * Creates a legend graphics producer for the given format, which in this
     * case must be <code>"image/gif"</code>
     *
     * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#createLegendProducer(java.lang.String)
     */
    public GetLegendGraphicProducer createLegendProducer(String format)
        throws IllegalArgumentException {
        if (!canProduce(format)) {
            throw new IllegalArgumentException(format + " not supported by this legend producer");
        }

        return new GifLegendGraphicProducer();
    }

    /* (non-Javadoc)
         * @see org.geotools.factory.Factory#getImplementationHints()
         * This just returns java.util.Collections.EMPTY_MAP
         */
    public Map getImplementationHints() {
        return java.util.Collections.EMPTY_MAP;
    }
}

⌨️ 快捷键说明

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