<?xml version="1.0" encoding="utf-8" ?>
<ViewContext version="1.1.0"
             id="{{ wmc.id }}"
             xmlns="http://www.opengis.net/context"
             xmlns:xlink="http://www.w3.org/1999/xlink"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:mb3="http://mapbender3.org/schema/wmc"
             xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.0.0/context.xsd">
    <General>
        <Window width="{{ wmc.state.json.window.width }}" height="{{ wmc.state.json.window.height }}" />
        <BoundingBox SRS="{{ wmc.state.json.extent.srs }}" minx="{{ wmc.state.json.extent.minx }}" miny="{{ wmc.state.json.extent.miny }}" maxx="{{ wmc.state.json.extent.maxx }}" maxy="{{ wmc.state.json.extent.maxy }}"/>
        <Title>{{ wmc.state.title }}</Title>
        <KeywordList>
            <Keyword>mapbender3</Keyword>
            {% if wmc.keywords is defined %}
            {% for keyword in wmc.keywords %}
            <Keyword>{{ keyword }}</Keyword>
            {% endfor %}
            {% endif %}
        </KeywordList>
        {% if wmc.abstract is defined %}
        <Abstract>{{ wmc.abstract }}</Abstract>
        {% endif %}
        {% if wmc.logourl != null %}
        <LogoURL width="{{ wmc.logourl.width }}" height="{{ wmc.logourl.height }}" format="{{ wmc.logourl.onlineResource.format }}">
            <OnlineResource xlink:type="simple" xlink:href="{{ wmc.logourl.onlineResource.url }}"/>
        </LogoURL>
        {% endif %}
        {% if wmc.descriptionurl != null %}
        <DescriptionURL format="{{ wmc.descriptionurl.onlineResource.format }}">
            <OnlineResource xlink:type="simple" xlink:href="{{ wmc.descriptionurl.onlineResource.href }}"/>
        </DescriptionURL>
        {% endif %}
        {% if wmc.contact != null %}
        <ContactInformation>
            {% if  wmc.contact.person != null or wmc.contact.organization != null %}
            <ContactPersonPrimary>
                <ContactPerson>{{ wmc.contact.person }}</ContactPerson>
                <ContactOrganization>{{ wmc.contact.organization }}</ContactOrganization>
            </ContactPersonPrimary>
            {% endif %}
            {% if wmc.contact.position != null %}
            <ContactPosition>{{ wmc.contact.position }}</ContactPosition>
            {% endif %}
            {% if wmc.contact.address != null %}
            <ContactAddress>
                <AddressType>{{ wmc.contact.addressType }}</AddressType>
                <Address>{{ wmc.contact.address }}</Address>
                <City>{{ wmc.contact.addressCity }}</City>
                <StateOrProvince>{{ wmc.contact.addressStateOrProvince }}</StateOrProvince>
                <PostCode>{{ wmc.contact.addressPostCode }}</PostCode>
                <Country>{{ wmc.contact.addressCountry }}</Country>
            </ContactAddress>
            {% endif %}
            {% if wmc.contact.voiceTelephone != null %}
            <ContactVoiceTelephone>{{ wmc.contact.voiceTelephone }}</ContactVoiceTelephone>
            {% endif %}
            {% if wmc.contact.facsimileTelephone != null %}
            <ContactFacsimileTelephone>{{ wmc.contact.facsimileTelephone }}</ContactFacsimileTelephone>
            {% endif %}
            {% if wmc.contact.electronicMailAddress != null %}
            <ContactElectronicMailAddress>{{ wmc.contact.electronicMailAddress }}</ContactElectronicMailAddress>
            {% endif %}
        </ContactInformation>
        {% endif %}
        <Extension>
            <mb3:maxExtent  SRS="{{ wmc.state.json.maxextent.srs }}" minx="{{ wmc.state.json.maxextent.minx }}" miny="{{ wmc.state.json.maxextent.miny }}" maxx="{{ wmc.state.json.maxextent.maxx }}" maxy="{{ wmc.state.json.maxextent.maxy }}"/>
        </Extension>
    </General>
    <LayerList>
        {% for source in wmc.state.json.sources %}
        {% for layer in source.configuration.children %}
        {% include "MapbenderWmcBundle:Wmc:wmc110_layer.xml.twig"  with {'layer': layer, 'source': source }%}
        {% endfor %}
        {% endfor %}
    </LayerList>
</ViewContext>