# /=====================================================================\ 
# |  LaTeXML-picture.rnc                                                |
# | RelaxNG model for LaTeXML generated documents                       |
# |=====================================================================|
# | Part of LaTeXML:                                                    |
# |  Public domain software, produced as part of work done by the       |
# |  United States Government & not subject to copyright in the US.     |
# |=====================================================================|
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     |
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    |
# \=========================================================ooo==U==ooo=/

# ======================================================================
# Picture; Experimental, possibly should evolve to SVG?
# ======================================================================

default namespace = "http://dlmf.nist.gov/LaTeXML"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"

## This module defines a picture environment, roughly a subset of SVG.
## NOTE: Eventually we will drop these subset elements and incorporate SVG itself.
Misc.class |= picture

#======================================================================

Picture.class =
  g | rect | line | circle | path
 | arc | wedge | ellipse | polygon | bezier
 | parabola | curve | dots | grid | clip
 | svg

## These attributes correspond roughly to SVG, but need documentation.
Picture.attributes =
  attribute x { text }?,
  attribute y { text }?,
  attribute r { text }?,
  attribute rx { text }?,
  attribute ry { text }?,
  attribute width { text }?,
  attribute height { text }?,
  attribute fill { text }?,
  attribute stroke { text }?,
  attribute stroke-width { text }?,
  attribute stroke-dasharray { text }?,
  attribute transform { text }?,
  attribute terminators { text }?,
  attribute arrowlength { text }?,
  attribute points { text }?,
  attribute showpoints { text }?,
  attribute displayedpoints { text }?,
  attribute arc { text }?,
  attribute angle1 { text }?,
  attribute angle2 { text }?,
  attribute arcsepA { text }?,
  attribute arcsepB { text }?,
  attribute curvature { text }?

## These attributes correspond roughly to SVG, but need documentation.
PictureGroup.attributes =
  attribute pos { text }?,
  attribute framed {xsd:boolean}?,
  [ a:defaultValue = "rect" ]
  attribute frametype { "rect" | "circle" | "oval" }?,
  attribute fillframe {xsd:boolean }?,
  attribute boxsep { text }?,
  attribute shadowbox {xsd:boolean}?,
  attribute doubleline {xsd:boolean}?

#======================================================================

picture =
## A picture environment.
element picture { picture_attributes, picture_model }

## Attributes for \elementref{picture}.
picture_attributes = 
  Common.attributes,
  ID.attributes,
  Picture.attributes,
  Imageable.attributes,
  attribute clip {xsd:boolean}?,
  attribute baseline { text }?,
  attribute unitlength { text }?,
  attribute xunitlength { text }?,
  attribute yunitlength { text }?,
  attribute origin-x { text }?,
  attribute origin-y { text }?,
  attribute tex { text }?,
  attribute content-tex { text }?

## Content model for \elementref{picture}.
picture_model = (Picture.class | Inline.class | Misc.class | Meta.class)*

#======================================================================

g =
## A graphical grouping; the content is inherits by the transformations, 
## positioning and other properties.
element g { g_attributes, g_model }

## Attributes for \elementref{g}.
g_attributes = Common.attributes, Transformable.attributes, Picture.attributes, PictureGroup.attributes

## Content model for \elementref{g}.
g_model = (Picture.class | Inline.class | Misc.class | Meta.class)*

#======================================================================

rect =
## A rectangle within a \elementref{picture}.
element rect { rect_attributes, rect_model }

## Attributes for \elementref{rect}.
rect_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{rect}.
rect_model = empty

#======================================================================

line =
## A line within a \elementref{picture}.
element line { line_attributes, line_model }

## Attributes for \elementref{line}.
line_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{line}.
line_model = empty

#======================================================================

polygon =
## A polygon within a \elementref{picture}.
element polygon { polygon_attributes, polygon_model }

## Attributes for \elementref{polygon}.
polygon_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{polygon}.
polygon_model = empty

#======================================================================

wedge =
## A wedge within a \elementref{picture}.
element wedge { wedge_attributes, wedge_model }

## Attributes for \elementref{wedge}.
wedge_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{wedge}.
wedge_model = empty

#======================================================================

arc =
## An arc within a \elementref{picture}.
element arc { arc_attributes, arc_model }

## Attributes for \elementref{arc}.
arc_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{arc}.
arc_model = empty

#======================================================================

circle =
## A circle within a \elementref{picture}.
element circle { circle_attributes, circle_model }

## Attributes for \elementref{circle}.
circle_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{circle}.
circle_model = empty

#======================================================================

ellipse =
## An ellipse within a \elementref{picture}.
element ellipse { ellipse_attributes, ellipse_model }

## Attributes for \elementref{ellipse}.
ellipse_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{ellipse}.
ellipse_model = empty

#======================================================================

path =
## A path within a \elementref{picture}.
element path { path_attributes, path_model }

## Attributes for \elementref{path}.
path_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{path}.
path_model = empty

#======================================================================

bezier =
## A bezier curve within a \elementref{picture}.
element bezier { bezier_attributes, bezier_model }

## Attributes for \elementref{bezier}.
bezier_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{bezier}.
bezier_model = empty

#======================================================================

curve =
## A curve within a \elementref{picture}.
element curve { curve_attributes, curve_model }

## Attributes for \elementref{curve}.
curve_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{curve}.
curve_model = empty

#======================================================================

parabola =
## A parabola curve within a \elementref{picture}.
element parabola { parabola_attributes, parabola_model }

## Attributes for \elementref{parabola}.
parabola_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{parabola}.
parabola_model = empty

#======================================================================

dots =
## A sequence of dots (?) within a \elementref{picture}.
element dots { dots_attributes, dots_model }

## Attributes for \elementref{dots}.
dots_attributes = Common.attributes, Picture.attributes,
  attribute dotstyle { text }?,
  attribute dotsize { text }?,
  attribute dotscale { text }?

## Content model for \elementref{dots}.
dots_model = empty

#======================================================================

grid =
## A grid within a \elementref{picture}.
element grid { grid_attributes, grid_model }

## Attributes for \elementref{grid}.
grid_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{grid}.
grid_model = empty

#======================================================================

clip =
## Establishes a clipping region within a \elementref{picture}.
element clip { clip_attributes, clip_model }

## Attributes for \elementref{clip}.
clip_attributes = Common.attributes, Picture.attributes


## Content model for \elementref{clip}.
clip_model = clippath*

#======================================================================

clippath =
## Establishes a clipping region within a \elementref{picture}.
element clippath { clippath_attributes, clippath_model }

## Attributes for \elementref{clippath}.
clippath_attributes = Common.attributes, Picture.attributes

## Content model for \elementref{clippath}.
clippath_model = (Picture.class | Inline.class | Misc.class | Meta.class)*

#======================================================================
