<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:include schemaLocation="PlatformCommon-1.0.0.xsd"/>
  <xs:element name="TileSetDefinition">
    <xs:annotation>
      <xs:documentation>Defines a tile cache</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="TileStoreParameters" type="TileStoreParametersType">
           <xs:annotation>
            <xs:documentation>Defines the parameters to access and describe the tile cache</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="Extents" type="Box2DType">
          <xs:annotation>
            <xs:documentation>A bounding box around the area of the tile cache</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="BaseMapLayerGroup" type="BaseMapLayerGroupCommonType" minOccurs="1" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>A group of layers that is used to compose a tiled layer in the HTML viewer</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="TileStoreParametersType">
    <xs:annotation>
      <xs:documentation>TileStoreParameters defines the parameters of this tile cache.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TileProvider" type="xs:string">
        <xs:annotation>
          <xs:documentation>The tile image provider</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Parameter" type="NameValuePairType" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>Collection of name value pairs for connecting to the tile image provider</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="NameValuePairType">
    <xs:annotation>
      <xs:documentation>A type describing name and value pairs</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Name" type="xs:string">
        <xs:annotation>
          <xs:documentation>Text for the name of parameter</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Value" type="xs:string">
        <xs:annotation>
          <xs:documentation>Text for value of parameter</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Box2DType">
    <xs:annotation>
      <xs:documentation>Box2D encapsulates the the coordinates of a box in 2-D space</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="MinX" type="xs:double">
        <xs:annotation>
          <xs:documentation>Minimum x-coordinate</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="MaxX" type="xs:double">
        <xs:annotation>
          <xs:documentation>Maximum x-coordinate</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="MinY" type="xs:double">
        <xs:annotation>
          <xs:documentation>Minimum y-coordinate</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="MaxY" type="xs:double">
        <xs:annotation>
          <xs:documentation>Maximum y-coordinate</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="BaseMapLayerType">
    <xs:annotation>
      <xs:documentation>BaseMapLayerType encapsulates the properties of a BaseMapLayer.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Name" type="xs:string">
        <xs:annotation>
          <xs:documentation>Name of the MapLayer</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ResourceId" type="xs:string">
        <xs:annotation>
          <xs:documentation>ResourceId of the MapLayer</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Selectable" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether or not the Layer can be selected</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ShowInLegend" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether or not the Layer should be shown in the legend</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="LegendLabel" type="xs:string">
        <xs:annotation>
          <xs:documentation>Label to be shown for the Layer in the legend</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ExpandInLegend" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether or not the Layer should be expanded in the legend.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MapLayerGroupCommonType">
    <xs:annotation>
      <xs:documentation>MapLayerGroupCommonType is a common subclass of MapLayerGroupCommonType and BaseMapLayerGroupCommonType</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Name" type="xs:string">
        <xs:annotation>
          <xs:documentation>The name of this LayerGroup</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="Visible" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether this group's visiblity should be visible or not when it first comes into range</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ShowInLegend" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether or not the LayerGroup should be shown in the legend</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ExpandInLegend" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>Whether or not the LayerGroup should be initially expanded in the legend</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="LegendLabel" type="xs:string">
        <xs:annotation>
          <xs:documentation>Label to be shown for the LayerGroup in the legend</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="BaseMapLayerGroupCommonType">
    <xs:annotation>
      <xs:documentation>BaseMapLayerGroupCommonType encapsulates the properties of a BaseMapLayerGroup. It extends MapLayerGroupCommonType by holding the layers in the group.  The base map layer groups defines what layers are used to render a tile set in the HTML viewer.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="MapLayerGroupCommonType">
        <xs:sequence>
          <xs:element name="BaseMapLayer" type="BaseMapLayerType" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The layers that are part of this group. The order of the layers represents the draw order, layers first is the list are drawn over top of layers later in the list.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>