﻿<?xml version="1.0" encoding="utf-8"?>
<!-- First version of a Render Extension to the SBML Layout Extension -->
<!--                                                                  -->
<!-- Author:	Frank Bergmann fbergman@kgi.edu                       -->
<!--                                                                  -->
<!-- Date:		07/05/2005                                            -->
<!--                                                                  -->
<!-- Further elements in consideration:                               -->
<!--   - custom shapes:                                               -->
<!--     In this specification the user is restricted to a very       -->
<!--     limited set of shapes from which complex elements can be     -->
<!--     constructed. In future version it would probably make        -->
<!--     sense to allow the user to specify path's with fillstyles.   -->
<!--                                                                  -->
<!-- This version relies on some imported elements from the SBML      -->
<!-- Layout extension, since i could not get the import statement     -->
<!-- to work ...                                                      -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://sbw.kgi.edu/xml/render/level1" xmlns:rl1="http://sbw.kgi.edu/xml/render/level1" elementFormDefault="qualified" version="1.0">
    <xsd:complexType name="ListOfRenderStyles">
        <xsd:annotation>
            <xsd:documentation>
                One SBML file can have many layouts, and a layout can have many rendering styles.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="renderStyle" type="rl1:RenderStyle" minOccurs="1" maxOccurs="unbounded" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="RenderStyle">
        <xsd:annotation>
            <xsd:documentation>
                A RenderStyle consists of the fillStyle (For the Background of the Layout) aloong
                with lists for CompartmentStyles, SpeciesStyles, ReactionsStyles and TextStyles. A
                version attribute has been allowed for later revisions.

                Each of these elemens are optional.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="listOfCompartmentStyles" type="rl1:ListOfCompartmentStyles" minOccurs="0" maxOccurs="1" />
                    <xsd:element name="listOfSpeciesStyles" type="rl1:ListOfSpeciesStyles" minOccurs="0" maxOccurs="1" />
                    <xsd:element name="listOfReactionStyles" type="rl1:ListOfReactionStyles" minOccurs="0" maxOccurs="1" />
                    <xsd:element name="listOfTextStyles" type="rl1:ListOfTextStyles" minOccurs="0" maxOccurs="1" />
                    <xsd:element name="listOfGroups" type="rl1:ListOfGroups" minOccurs="0" maxOccurs="1" />
                    <xsd:element name="fillStyle" type="rl1:FillStyle" minOccurs="0" maxOccurs="1" />
                </xsd:sequence>
                <xsd:attribute name="version" type="xsd:string" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfCompartmentStyles">
        <xsd:annotation>
            <xsd:documentation>
                The list of CompartementStyles consists of one or more compartment style(s).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="compartmentStyle" type="rl1:CompartmentStyle" minOccurs="1" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="CompartmentStyle">
        <xsd:annotation>
            <xsd:documentation>
                Each compartment style, consists of a nonempty list of shapes, an
                edge style and an optional membrane style (innerStyle)
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="listOfShapes" type="rl1:ListOfShapes" minOccurs="1" maxOccurs="1" />
                    <xsd:element name="edgeStyle" type="rl1:LineStyle" minOccurs="1" maxOccurs="1" />
                    <xsd:element name="innerStyle" type="rl1:LineStyle" minOccurs="0" maxOccurs="1" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfSpeciesStyles">
        <xsd:annotation>
            <xsd:documentation>
                The list of SpeciesStyles consists of one or more species style(s).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="speciesStyle" type="rl1:SpeciesStyle" minOccurs="1" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="SpeciesStyle">
        <xsd:annotation>
            <xsd:documentation>
                A SpeciesStyle consists of a list of shapes.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="listOfShapes" type="rl1:ListOfShapes" minOccurs="1" maxOccurs="unbounded" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ReferenceType">
        <xsd:annotation>
            <xsd:documentation>
                The ReferenceType is intended to be used in order to group elements,
                or to provide aliases (elements, with different boundingbox, but same
                rendering styles / glyph elements/attributes) for existing glyphs.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="boundingBox" type="rl1:BoundingBox" minOccurs="1" maxOccurs="1" />
                </xsd:sequence>
                <xsd:attribute name="SReferenceGlyph" type="rl1:SId" />
                <xsd:attribute name="glyphType" type="rl1:GlyphString" />
                <xsd:attribute name="SReferenceStyle" type="rl1:SId" use="optional" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfGroups">
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="group">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="reference" type="rl1:ReferenceType" />
                            </xsd:sequence>
                            <xsd:attribute name="groupName" type="xsd:string" />
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfTextStyles">
        <xsd:annotation>
            <xsd:documentation>
                The list of TextStyles consists of one or more text style(s).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="textStyle" type="rl1:TextStyle" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="TextStyle">
        <xsd:annotation>
            <xsd:documentation>
                Each textStyle consists of a fontStyle.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="fontStyle" type="rl1:FontStyle" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfReactionStyles">
        <xsd:annotation>
            <xsd:documentation>
                The list of ReactionStyles consists of one or more Reaction style(s).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="reactionStyle" type="rl1:ReactionStyle" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ReactionStyle">
        <xsd:annotation>
            <xsd:documentation>
                The reactionSytle specifies how arrows (at the end of product/reactants) should be
                rendered along with information on how the reaction should be displayed.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="arrow" type="rl1:ArrowStyle" minOccurs="0" maxOccurs="unbounded" />
                    <xsd:element name="line" type="rl1:LineStyle" minOccurs="1" maxOccurs="unbounded" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ArrowStyle">
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="fillStyle" type="rl1:FillStyle" minOccurs="1" maxOccurs="unbounded" />
                    <xsd:element name="lineStyle" type="rl1:LineStyle" minOccurs="1" maxOccurs="unbounded" />
                </xsd:sequence>
                <xsd:attribute name="kind" type="xsd:string" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="FontStyle">
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:sequence>
                    <xsd:element name="fillStyle" type="rl1:FillStyle" />
                </xsd:sequence>
                <xsd:attribute name="font" type="xsd:string" />
                <xsd:attribute name="size" type="xsd:double" />
                <xsd:attribute name="style" type="xsd:string" />
                <xsd:attribute name="calculateSize" type="xsd:boolean" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ListOfShapes">
        <xsd:annotation>
            <xsd:documentation>
                The list of shapes consists of one or more shape(s).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="shape" type="rl1:Shape" minOccurs="1" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Shape">
        <xsd:sequence>
            <xsd:element name="fillStyle" type="rl1:FillStyle" minOccurs="0" maxOccurs="1" />
            <xsd:element name="boundingBox" type="rl1:BoundingBox" minOccurs="0" maxOccurs="1" />
            <xsd:element name="edgeStyle" type="rl1:LineStyle" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
        <xsd:attribute name="kind" type="rl1:ShapeString" />
    </xsd:complexType>
    <xsd:complexType name="FillStyle">
        <xsd:annotation>
            <xsd:documentation>
                The fill style defines how a shape should be filled.
                The parameter endColor is only relevant for gradients.
                The parameter fillParameter allows to define how the
                gradient should look ... (examples are:
                forwarddiagonal - a diagonal linear gradient

            </xsd:documentation>
        </xsd:annotation>
        <xsd:attribute name="fillType" type="rl1:FillString" />
        <xsd:attribute name="startColor" type="rl1:ColorString" />
        <xsd:attribute name="endColor" type="rl1:ColorString" />
        <xsd:attribute name="gradientStyle" type="rl1:GradientString" use="optional" />
    </xsd:complexType>
    <xsd:complexType name="LineStyle">
        <xsd:complexContent>
            <xsd:extension base="rl1:RenderBase">
                <xsd:attribute name="color" type="rl1:ColorString" />
                <xsd:attribute name="thickness" type="xsd:double" />
                <xsd:attribute name="style" type="rl1:LineString" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="RenderBase" abstract="true">
        <xsd:annotation>
            <xsd:documentation>
                The type RenderBase is the base for all elements, it gives all elements an ID,
                and a reference, pointing to the corresponding element of the SBML Layout extension.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="rl1:SBase">
                <xsd:attribute name="SId" type="rl1:SId" />
                <xsd:attribute name="SReference" type="rl1:SId" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:simpleType name="GradientString">
        <xsd:annotation>
            <xsd:documentation>
                This optional parameter specifies how a gradient should look.
                the first four types apply to linear gradients, the latter
                five to radial gradients.

                Finally "None" is allowed to specify that none of the above
                apply.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ForwardDiagonal" />
            <xsd:enumeration value="BackwardDiagonal" />
            <xsd:enumeration value="Horizontal" />
            <xsd:enumeration value="Vertical" />
            <xsd:enumeration value="Center" />
            <xsd:enumeration value="LowerLeft" />
            <xsd:enumeration value="LowerRight" />
            <xsd:enumeration value="UpperLeft" />
            <xsd:enumeration value="UpperRight" />
            <xsd:enumeration value="None" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ShapeString">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="None" />
            <xsd:enumeration value="Ellipse" />
            <xsd:enumeration value="Rectangle" />
            <xsd:enumeration value="RoundedRectangle" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="FillString">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Empty" />
            <xsd:enumeration value="Solid" />
            <xsd:enumeration value="LinearGradient" />
            <xsd:enumeration value="RadialGradient" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="GlyphString">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="CompartmentGlyph" />
            <xsd:enumeration value="SpeciesGlyph" />
            <xsd:enumeration value="TextGlyph" />
            <xsd:enumeration value="ReactionGlyph" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="LineString">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Solid" />
            <xsd:enumeration value="Dot" />
            <xsd:enumeration value="DashDot" />
            <xsd:enumeration value="DashDotDot" />
            <xsd:enumeration value="Dash" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ColorString">
        <xsd:annotation>
            <xsd:documentation>The type ColorString represents colors in ARGB (alpha, red, green, blue) hex form.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="([a-f]|[A-F]|[0-9])([a-f]|[A-F]|[0-9])([a-f]|[A-F]|[0-9])([a-f]|[A-F]|[0-9])" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- INCLUDE FROM LAYOUT EXTENSION                               -->
    <!-- Could not get the import statement to work ...              -->
    <!-- If you know how please let me know                          -->
    <!-- <xsd:import namespace="sl2"                                 -->
    <!--    schemaLocation="http://projects.eml.org/bcb/sbml/level2" -->
    <!--    id="LayoutExtension" />                                  -->
    <xsd:complexType name="SBase" abstract="true">
        <xsd:annotation>
            <xsd:documentation>The SBase type is the base type of all main components in SBML.  It supports attaching metadata, notes and annotations to components.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="notes" minOccurs="0">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:any namespace="http://www.w3.org/1999/xhtml" processContents="skip" maxOccurs="unbounded" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="annotation" minOccurs="0">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:any processContents="skip" maxOccurs="unbounded" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="metaid" type="xsd:ID" use="optional" />
    </xsd:complexType>
    <xsd:simpleType name="SId">
        <xsd:annotation>
            <xsd:documentation>The type SId is used throughout SBML as the type of the 'id' attributes on model elements.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="(_|[a-z]|[A-Z])(_|[a-z]|[A-Z]|[0-9])*" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:complexType name="Point">
        <xsd:complexContent>
            <xsd:extension base="rl1:SBase">
                <xsd:attribute name="id" type="rl1:SId" use="optional" />
                <xsd:attribute name="x" type="xsd:double" />
                <xsd:attribute name="y" type="xsd:double" />
                <xsd:attribute name="z" type="xsd:double" use="optional" default="0.0" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="Dimensions">
        <xsd:complexContent>
            <xsd:extension base="rl1:SBase">
                <xsd:attribute name="id" type="rl1:SId" use="optional" />
                <xsd:attribute name="width" type="rl1:posDouble" />
                <xsd:attribute name="height" type="rl1:posDouble" />
                <xsd:attribute name="depth" type="rl1:posDouble" use="optional" default="0.0" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="BoundingBox">
        <xsd:complexContent>
            <xsd:extension base="rl1:SBase">
                <xsd:sequence>
                    <xsd:element name="position" type="rl1:Point" />
                    <xsd:element name="dimensions" type="rl1:Dimensions" />
                </xsd:sequence>
                <xsd:attribute name="id" type="rl1:SId" use="optional" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:simpleType name="posDouble">
        <xsd:restriction base="xsd:double">
            <xsd:minInclusive value="0.0" />
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>