How STEP/SGML and XML/EDI Initiatives Will Impact Future Development of IETMs.   Table of contents   Indexes   Legal Issues of Electronic Commerce: Activity Policies, Intelligent Agents and Ethical Transactions

 
 

GDHU, the Graphic DTD for HUmans


 
Jan Christian   Herlitz
  Excosoft AB
Electrum 420
Kista   Sweden  S-164 40
Phone: +46 8 703 91 90
Fax: +46 8 703 94 90
Email: herlitz@excosoft.se Web: www.excosoft.se
 
Biographical notice:
 
Jan Christian Herlitz, M.Sc.
 
Jan Christian Herlitz is the founder of Excosoft. In the early 80's he worked for the Ericsson group where he developed software for literate programming, structured word processing and hyperlink systems. Today he is technical director at Excosoft.
 
ABSTRACT:
 
Graphics management is a headache in most SGML  (Standard Generalized Markup Language) environments. Proprietary image formats and graphics standards such as CCITT-G4, CGM and IGES do not completely satisfy user needs. Integration, archiving and delivery are significantly improved when graphical objects are stored as SGML markup.
 
 

Introduction

 
The management of graphics is still a headache in most SGML environments. This paper presents the Graphic DTD for HUmans (GDHU). This DTD is designed to facilitate the creation and maintenance of simple technical drawings, the kind of drawings we need in order to improve the quality of our documents.
 
GDHU focuses on the process of maintaining and refining a drawing. A drawing should be as easy to update as the document it resides in.
 
GDHU is based on the following requirements:
  • Drawings should be embedded SGML/XML documents in the same way as CALS tables are.
  • Elements from the parent DTD are reused inside the drawing.
  • When structure is added to drawings, algorithms can be defined to handle positioning and resizing automatically.
  • The typical drawing is not WYSIWYG.
  •  
    This DTD represents another bit in the puzzle that will make our SGML documents rich and enjoyable in their own right, and will free them from dependance upon formats that require storage in separate files.
     
     

    The Concept

     
     

    Embedding

     
    A GDHU drawing is embedded in the SGML document. Furthermore, parent DTD elements can be embedded in the GDHU drawing if required. Compare to a CALS table, there the content model for a cell is declared in the main DTD. In GDHU it is possible to insert paragraphs, lists, images, tables, etc. inside a drawing.
     
    There are several advantages accruing from a tight integration of a document and the drawings it contains.
  • It is easy to cut and paste objects between a drawings and its surroundings.
  • Simpler, unified interface for handling text.
  • Text inside drawings is searchable, can be spell-checked, its case can be changed, etc.
  • A drawing can contain complex SGML text structure (paragraphs, lists, tables).
  • There is no need for external entities.
  • References (id/idref, HyTime) can be made to and from drawings.
  •  
     

    Automatic Sizing

     
    We expect a table cell to adjust to its content and a paragraph to adjust to the frame width and we should expect similar functionality in a drawing.
     
    One of the important concepts underlying GDHU is that shapes by default adjust to their content (just like cells in a table). All GDHU shapes may contain other shapes. Even the polyline may have content!
     
    For instance a shape will expand if the text placed inside it does not fit. The expansion direction is downwards by default but can be set to other directions. Shapes inside a rectangle are by default centered.
     
      <rectangle></rectangle>  <rectangle>  This is <emph>my</emph> text!  </rectangle>  
     
     
    Note the emphasized "my"; SGML is doing its job inside the drawing!
     
    The expansion direction can also be set to the right.
     
      <rectangle expand-right>  This is <emph>my</emph> text!  </rectangle>  
     
     
    Expansion can also be inhibited.
     
      <rectangle expand-not>  This is <emph>my</emph> text!  </rectangle>  
     
     
     

    Automatic Positions

     
    By placing shapes inside other shapes it is possible to arrange and group intelligently. The parent shape can be invisible. By default, shapes are arranged sequentially and wrapped when they reach the frame border (or margin at printout). This behavior resembles the way words build a paragraph.
     
      <rectangle>  <rectangle>Hello</rectangle>  <oval></oval>  <oval></oval>  <rectangle>World</rectangle>  </rectangle>  
     
     
    Wrapping can be turned off and the build direction can be changed.
     
      <rectangle child-direction=270>  <rectangle></rectangle>  <oval></oval>  <oval></oval>  <rectangle></rectangle>  </rectangle>  
     
     
    Creating a drawing in GDHU will be working with structures rather than coordinate positions.
     
      <rectangle>  <rectangle>Hello</rectangle>  <rectangle>World</rectangle>  </rectangle>  
     
     
    When the user adds a new shape to the row the application will make room for the new shape automatically.
     
      <rectangle>  <rectangle>Hello</rectangle>  <rectangle>new</rectangle>  <rectangle>World</rectangle>  </rectangle>  
     
     
    Shape positions can also be defined indirectly by another shape position. When the "master shape" is moved all attached shapes are moved with it.
     
      <rectangle shape-id=d1>  I'm the master  </rectangle>  <oval attach-to=d1 delta-x=-25 delta-y=100>  I follow the master  </oval>  
     
    Lastly a position can be explicitly defined using a coordinate. This coordinate is relative to its parent shape so when a parent is moved, its child is moved with it.
     
    Each shape defines a coordinate system for its children. The (0, 0) position is at the upper left corner of a surrounding rectangle. For a rectangle this is the rectangle itself.
     
     
     

    Automatic Connections

     
    Polylines are used to connect shapes. An end node on a polyline can be attached to a node on another shape by applying the attach-to attribute. When the attached shape is moved, the connection is maintained, the polyline will stretch and contract like a "rubber band".
     
    A rectangle has four connection points; W, N, E and S (west, north, east and south). A connection is glued to the nearest connection point or to the nearest point on the shape if no connection point exist (the oval has none).
     
      <oval shape-id=d1>Hello</oval>  <oval x=50 y=50 shape-id=d2>World</oval>  <polyline>  <node attach-to=d1>  <node attach-to=d2>  </polyline>  
     
     
      <rectangle shape-id=d1>Hello</rectangle>  <rectangle x=50 y=50 shape-id=d2>World</rectangle>  <polyline>  <node attach-to=d1>  <node attach-to=d2>  </polyline>  
     
     
    Sometimes we may want to connect to the nearest point on a shape or a to specific connection point. If there are several points to choose between, the point nearest (0,0) is selected.
     
      <rectangle shape-id=d1>Hello</rectangle>  <rectangle x=100 y=100 shape-id=d2>World</rectangle>  <polyline>  <node attach-to="d1.$nearest">  <node attach-to="d2.w">  </polyline>  
     
     
    (The attach-to value is an expression with a special syntax. Please refer to www.excosoft.se/dev/ for details.)
     
     

    Automatic Style

     
    A group of shapes can inherit the style of a particular shape. This makes it easy to update a drawing and maintain the appearance of shapes. If, for example, we want a group of rectangles to be shadowed, we only need create one "template" shape.
     
     

    Bits and Pieces

     
     

    The Elements

     
    GDHU defines only seven elements.
  • A drawing is introduced in a document with the DRAWING element.
  • Four elements represent primitive shapes: NODE , POLYLINE , RECTANGLE and OVAL .
  • New shapes are created by the NEWSHAPE element.
  • One element, SHAPE , is a generic element obtaining its properties from elsewhere.
  •  
     

    ElementDRAWING

     
    A drawing element defines a drawing area. It has a default size and is invisible. The drawing element represents a name space; shape identities need only be unique inside the current drawing.
     
      <drawing>  </drawing>  
     
     

    Element NODE

     
    A node is an element primarily used to define polylines. A node is the only empty element in GDHU.
     
     

    Element POLYLINE

     
    A polyline is a shape built up using nodes. It must have at least two nodes; the start node and the stop node. These nodes are referred to as "the end nodes". Nodes are stored as child elements. It would perhaps seem more natural to store nodes as attributes but this would make it more difficult to set different properties for each individual node.
     
      <polyline>  <node x=0 y=0>  <node x=100 y=0>  </polyline>  
     
     
    Other shapes can be "inside" a polyline; a polyline is a containing element!
     
      <polyline>  <node x=0 y=0>  <node x=100 y=50>  <node x=0 y=100>  Angle  </polyline>  
     
     
    A polyline can be "closed" which will make it a "polygon". In a polygon the first node represents both the start and stop points.
     
      <polyline closed>  <node x=0 y=0>  <node x=50 y=50>  <node x=0 y=100>  </polyline>  
     
     
     

    Element RECTANGLE

     
    The rectangle is probably the most used shape in technical drawings. It has a default size.
     
      <rectangle>  </rectangle>  
     
     
     

    Element OVAL

     
    The oval represents an ellipse or a circle. It has a default size.
     
      <oval>  </oval>  
     
     
     

    Element NEWSHAPE

     
    A new shape is created with the NEWSHAPE element, please see "Creating New Shapes" below.
     
     

    Element SHAPE

     
    The SHAPE element is a generic element. The actual shape is specified with the BASED-ON attribute.
     
      <shape based-on=MyNewShape>  </shape>  
     
     

    The Attributes

     
    The shape properties can be controlled by attributes. Almost all attributes are relevant for all shapes.
     
     

    Units

     
     

    Coordinates and Dimensions

     
    The unit for coordinates and dimensions is the point . Examples of valid values:
     
      0  -4  64.75  99999  
     
     

    Color

     
    A color is specified with three integers. The three integers must range from 0 to 65535, and they denote the R, G and B values of the color, respectively.
     
     

    Degrees

     
    The degree unit ranges from 0 to 359.
     
     

    General Attributes

     
     

    Attribute SHAPE-ID

     
    The SHAPE-ID attribute assigns an id to the shape. It must be unique inside the current drawing.
     
      <oval shape-id=d1></oval>  
     
     

    Attribute MAIN

     
    The MAIN attribute declares a shape to be the main shape when a new shape is created (see Creating New Shapes below).
     
     

    Attribute LIKE

     
    The LIKE attribute forces a shape to inherit the properties of another shape with the specified SHAPE-ID .
     
    The following attributers are inherited: MIN-W , MAX-W , MIN-H , MAX-H , PERFECT , SMOOTHED and all stroke, fill and shadow attributes. If the shape has its own attributes, they will take precedence.
     
    NB! The shape also inherits the shape type, i.e. the element name! A set of "rectangles" can be changed to "ovals" using this technique.
     
     

    Position attributes

     
     

    Attributes X and Y

     
    The X and Y attributes specify the shape position relative its parent. If these attributes are not specified the shape is positioned according to automatic positioning rules.
     
      <rectangle>  <rectangle x=20 y=40>  </rectangle>  </rectangle>  
     
     
     

    Attribute Z

     
    The Z attribute defines the order in which shapes are drawn inside a shape . Shapes with lesser Z values are overlaid by shapes with greater Z values.
     
    <oval z=3></oval>
     
    If Z is not specified or shapes have the same Z value, the shapes are drawn in the order they are specified.
     
     

    Attributes DELTA-X and DELTA-Y

     
    The DELTA-X and DELTA-Y attributes define a delta displacement from the current position.
     
      <rectangle>  <rectangle deltay=40>  </rectangle>  </rectangle>  
     
     
     

    Attribute CHILD-DIRECTION

     
    The CHILD-DIRECTION attribute forces the children to be positioned in a specified direction without any wrapping.
     
     

    Attribute CHILD-SEPARATION

     
    The CHILD-SEPARATION attribute defines the spacing of positioned child shapes. The default is 5 points.
     
     
     

    Attribute CHILD-ALIGN

     
    The CHILD-ALIGN attribute defines how child shapes are aligned.
     
      <rectangle child-align=top>  <rectangle height=10></rectangle>  <rectangle height=30></rectangle>  <oval></oval>  </rectangle>  
     
     
      <rectangle child-align=bottom>  <rectangle height=10></rectangle>  <rectangle height=30></rectangle>  <oval></oval>  </rectangle>  
     
     
     

    Size attributes

     
     

    Attributes WIDTH and HEIGHT

     
    The WIDTH and HEIGHT attributes specify the explicit size of a shape, automatic resizing will be inhibited.
     
     

    Attribute EXPAND

     
    The EXPAND attribute defines the direction in which the shape will be expanded when there isn't room for its children.
     
      expand (expand-down | expand-right | expand-not) expand-down  
     
    The value expand-not means that the shape is a fixed size shape.
     
     

    Attributes MIN-W , MAX-W , MIN-H and MAX-H

     
    The attributes MIN-W , MAX-W , MIN-H and MAX-H define the extent to which a shape is allowed to shrink or expand.
     
     

    Attributes RESIZE-X and RESIZE-Y

     
    The RESIZE-X and RESIZE-Y attributes make the shape and its content uniformly bigger or smaller.
     
     

    Attribute PERFECT

     
    The PERFECT attribute forces the HEIGHT , MIN-H and MAX-H attributes to act as the corresponding WIDTH , MIN-W and MAX-W attributes. A perfect rectangle will be a square and a perfect oval be a circle.
     
     
     
    In a perfect polyline all sub-lines are slanted 0, 45 or 90 degrees. The process starts with the start node and moves towards the stop node, changing the slant but keeping the sub-line length.
     
     
     

    Attribute SMOOTHED

     
    The SMOOTHED attribute specifies how much the corners in the shape shall be smoothed.
     
     
     
     

    Stroke Attributes

     
     

    Attribute LINE-WIDTH

     
    The LINE-WIDTH attribute defines the width of a shape's outline in points. The line width 0 indicates the thinnest line that can be drawn. A negative value makes the line invisible. Default line width is 1 point.
     
     

    Attribute LINE-COLOR

     
    The LINE-COLOR attribute determines the outline color of a shape. The default value is black.
     
     

    Attribute LINE-DASH

     
    The LINE-DASH attribute specifies the way in which lines in a shape are stroked.
     
     

    Fill Attributes

     
     

    Attribute FILLED

     
    The FILLED attribute defines whether the shape is filled or not.
     
     

    Attribute FILL-COLOR

     
    The FILL-COLOR attribute determines the fill color of a shape. The default value is white.
     
     

    Shadow attributes

     
     

    Attribute SHADOWED

     
    The SHADOWED attribute defines whether a shape is shadowed or not.
     
     

    Attribute SHADOW-COLOR

     
    The SHADOW-COLOR attribute determines the shadow color of a shape.
     
     

    Attributes SHADOW-X and SHADOW-Y

     
    The SHADOW-X and SHADOW-Y attributes specifies the offset of the shadow. Negative values are possible. Default offset is 10 points.
     
     

    Arrow Attributes

     
     

    Attribute ARROWED

     
    The ARROWED attribute defines whether or not to draw an arrowhead at a node.
     
     

    Attribute ARROW-TYPE

     
    The ARROW-TYPE attribute defines the type of arrowhead to be drawn at a node.
     
     

    Creation Attributes

     
     

    Attribute NAME

     
    The NAME attribute defines a name for a new shape. This name is used by generic shapes that are based on the new shape.
     
     

    Attribute BASED-ON

     
    The BASED-ON attribute forces a shape to conform to a new shape.
     
     

    The DTD

     
    Here follows the Graphic DTD for HUmans.
     
      <!ENTITY % blocks "#PCDATA|para|table|list|equation">  <!ENTITY % expression "CDATA">  <!ENTITY % color "NUMBERS">  <!ENTITY % degrees "NUMBER">  <!ENTITY % yesorno "NUMBER">  <!ENTITY % shapes "rectangle|oval|polyline|shape|newshape">  <!ENTITY % directions "(expand-down|expand-right|expand-not)">  <!ENTITY % alignments "(align-top|align-left|align-right|                         align-bottom|align-centre)">    <!ELEMENT (drawing|%shapes;) - - (%shapes;|node|%blocks;)* >  <!ELEMENT node - - EMPTY >    <!ATTLIST drawing   id               ID            #IMPLIED  >  <!ATTLIST (%shapes;|node)   id               ID            #IMPLIED   shape-id         NAME          #IMPLIED   name             NAME          #IMPLIED   based-on         NAME          #IMPLIED   like             NAME          #IMPLIED   main             %yesorno;     "0"     x                %expression;  #IMPLIED   y                %expression;  #IMPLIED   z                %expression;  #IMPLIED   delta-x          %expression;  "0"   delta-y          %expression;  "0"   attach-to        NAME          #IMPLIED     width            %expression;  #IMPLIED   height           %expression;  #IMPLIED   expand           %directions;  expand-down   min-w            %expression;  100   max-w            %expression;  #IMPLIED   min-h            %expression;  50   max-h            %expression;  #IMPLIED   resize-x         NUMBER        100   resize-y         NUMBER        100   perfect          %yesorno;     0   smoothed         NUMBER        0     line-width       %expression;  1   line-color       %color;       "0 0 0"   line-dash        NAME          #IMPLIED     filled           %yesorno;     "0"   fill-color       %color;       "65535 65535 65535"     shadowed         %yesorno;     "0"   shadow-color     %color;       "153 153 153"   shadow-x         %expression;  "5"   shadow-y         %expression;  "5"     arrowed          %yesorno;     "0"   arrow-name       NAME          #IMPLIED     child-direction  %degrees;     #IMPLIED   child-separation %expression;  5   child-align      %alignments;  align-top  >  
     
     

    Creating New Shapes

     
    A new shape is defined using primitive shapes or other created shapes.
     
    The following example defines a rectangle with a double border.
     
      <newshape name=double-rect>  <rectangle>  <rectangle x=2 y=2 main=1></rectangle>  </rectangle>  </newshape>  
     
     
    One of the shapes inside the new shape must be declared as the MAIN shape. Any child element will be positioned inside the main shape.
     
      <shape based-on=double-rect line-width=3>  Here I use a new shape!  </shape>  
     
     
     

    An Example

     
    The following example demonstrates several GDHU features.
     
      <drawing>   <newshape name=vg> <!-- Vertical Group -->    <rectangle main=1 child-direction=270 line-width="-1">    </rectangle>   </newshape>   <newshape name=hg> <!-- Horizontal Group -->    <rectangle main=1 child-direction=0 line-width="-1">    </rectangle>   </newshape>     <shape based-on=vg>    <rectangle shape-id=d1>     <title>System X</title>    </rectangle>      <shape based-on=hg>     <shape like=d1 shape-id=d2>      <subtitle>Subsystem A</subtitle>      <para>This is text. This is text.</para>     </shape>     <shape like=d1 shape-id=d3>      <subtitle>Subsystem B</subtitle>      <list>       <list-item>This is text.</list-item>       <list-item>This is also text.</list-item>      </list>     </shape>    </shape>   </shape>     <polyline>    <node attach-to=d1><node attach-to=d2 arrowed=1>    (mandatory)   </polyline>     <polyline>    <node attach-to=d1><node attach-to=d3 arrowed=1>    (optionsl)   </polyline>  </drawing>  
     
     
    Two new shapes, hg and vg , are created to handle horizontal and vertical alignment. The drawing consists of two invisible objects that have the sole purpose of grouping other objects, horizontally and vertically. Inside the rectangles elements from the parent DTD are used (title, subtitle, para, list and list-item). Connections are glued to objects. The connections have text "inside". The d2 and d3 shapes get their properties from the d1 shape.
     
    The drawing is easy to maintain and to refine. If a new box is added or if more text is added in any rectangle, an application will still be capable of formatting the drawing nicely.

    How STEP/SGML and XML/EDI Initiatives Will Impact Future Development of IETMs.   Table of contents   Indexes   Legal Issues of Electronic Commerce: Activity Policies, Intelligent Agents and Ethical Transactions