All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.gov.nasa.worldwind.ogc.wms.WMSLogoURL Maven / Gradle / Ivy

Go to download

World Wind is a collection of components that interactively display 3D geographic information within Java applications or applets.

There is a newer version: 2.0.0-986
Show newest version
/*
 * Copyright (C) 2012 United States Government as represented by the Administrator of the
 * National Aeronautics and Space Administration.
 * All Rights Reserved.
 */

package gov.nasa.worldwind.ogc.wms;

import gov.nasa.worldwind.util.WWUtil;
import gov.nasa.worldwind.util.xml.XMLEventParserContext;

import javax.xml.stream.events.*;
import java.util.Iterator;

/**
 * Parses a WMS layer LogoURL element. Also used for WMS layer LegendURL elements.
 *
 * @author tag
 * @version $Id: WMSLogoURL.java 1171 2013-02-11 21:45:02Z dcollins $
 */
public class WMSLogoURL extends WMSLayerInfoURL
{
    protected Integer width;
    protected Integer height;

    public WMSLogoURL(String namespaceURI)
    {
        super(namespaceURI);
    }

    @Override
    protected void doParseEventAttributes(XMLEventParserContext ctx, XMLEvent event, Object... args)
    {
        super.doParseEventAttributes(ctx, event, args);

        Iterator iter = event.asStartElement().getAttributes();
        if (iter == null)
            return;

        while (iter.hasNext())
        {
            Attribute attr = (Attribute) iter.next();

            if (attr.getName().getLocalPart().equals("width") && attr.getValue() != null)
            {
                Integer i = WWUtil.convertStringToInteger(attr.getValue());
                if (i != null)
                    this.setWidth(i);
            }

            if (attr.getName().getLocalPart().equals("height") && attr.getValue() != null)
            {
                Integer i = WWUtil.convertStringToInteger(attr.getValue());
                if (i != null)
                    this.setHeight(i);
            }
        }
    }

    public Integer getWidth()
    {
        return width;
    }

    protected void setWidth(Integer width)
    {
        this.width = width;
    }

    public Integer getHeight()
    {
        return height;
    }

    protected void setHeight(Integer height)
    {
        this.height = height;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy