Up to cover page | Back to Application configuration
WebCGM 2.1 — Appendixes
In addition to the listed editors of
this specification, the following individuals have contributed significantly
to the present WebCGM 2.1 specification:
- Forrest Carpenter, System Development Inc.
- David Cruikshank, The Boeing Company
- Franck Duluc, Airbus
- Stuart Galt, The Boeing Company
- Ulrich Laesche, Ematek Informatik GMBH
- Don Larson, Larson Software Technology
- Thierry Michel, W3C
- Robert Orosz, Auto-trol Technology
- Andrew Moorhouse, UK Ministry of Defence
- Dieter Weidenbrueck, PTC
Additionally, the following individuals made signficant contributions to
predecessor versions, WebCGM 2.0 and WebCGM 1.0:
- Ralf Berger, ITEDO
- Chris Lilley, W3C
- Thierry Michel, W3C
- Felix Sasaki, W3C
- Kentarou Fukuda, IBM
- Al Gilman, W3C Invited Expert
- Kevin O'Kane, Auto-trol Technology
- Maryse Da-Ponte, Airbus
- Bruce Garner, Analyst/Consultant
- Alan Hester, Xerox Corporation
- Bob Hopgood, CCLRC
- Brad Powell, Zeh Graphic Systems
- Dave Rahnis, Bentley Systems
- Lynne Rosenthal, NIST
- John Gebhardt, Intercap Graphics Systems
- Roy Platon, CCLRC
- Ty Bartosh, Jeppesen Inc.
This section is informative (non-normative).
- API, Application Programming Interface
- An Application Programming Interface (API) is a set of functions or
methods used to access some functionality.
- Application Structure, APS
- The CGM structure for grouping other elements and assigning them a
unique identifier, a type, and attaching attributes. WebCGM contains
five valid APS types: grobject, layer, para, subpara, grnode.
- APS Attribute, Application Structure Attribute
- The CGM element that is used to define and associate an attribute
with an APS. WebCGM contains ten valid APS Attribute types: region,
viewcontext, linkuri, layername, layerdesc, screentip, name, content,
visibility, interactivity.
- Cascading profile
- A method by which closely related profiles can be expressed
efficiently, by only enumerating the differences between a given
profile and a base profile such as WebCGM.
- CGM, Computer Graphics Metafile
- ISO/IEC standard 8632:1999 (CGM:1999), CGM is a metafile format
consisting of composite raster and scalable vector graphics
information.
- DOM, Document Object Model
- A Document Object Model is a platform- and language-neutral interface
that allows programs and scripts to dynamically access and manipulate
the content, structure and style of documents. WebCGM defines a DOM of
limited scope, allowing discovery and navigation of the WebCGM
structure tree, transient manipulation of styles and standardized
metadata, and discovery and manipulation of application-specific
metadata. The WebCGM DOM is based upon and borrows from the principles
the W3C DOM Level 2 and DOM Level 3 Recommendations.
- EBNF, Extended Bauer Normal Form
- A formal specification technique used in WebCGM to express pieces of
grammar and syntax such as the IRI fragment syntax.
- fragment (IRI fragment)
- As standardized in RFC 3986 and RFC 3987, the fragment is a part of a
IRI that is separated from the path/file name by a "#" character, and
provides information that is reserved for processing by agents that are
invoked by the browser to handle the resource information type of the
IRI. WebCGM standardizes the syntax and semantics of such fragments,
for transmitting object and picture selection and behavior information
to WebCGM viewers.
- handler, event handler
- An event handler is a method called by the WebCGM DOM implementation
whenever a specified event occurs. Users register the event types they
are interested in by calling the addEventListener() method of the
WebCGMMetafile object.
- host application
- The user agent, typically is a script that controls the behavior of a
web page. In the context of WebCGM the host application controls the
behavior of the WebCGM renderer through the DOM.
- host document
- The web page, contains a combination of both HTML and WebCGM
content.
- host environment
- The combination of the host application and the host document
- inheritance
- The determination of values of APS Attributes and Style Properties
for objects in the WebCGM hierarchical object tree, when all aspects
have not been explicitly specified for all objects in the tree. WebCGM
defines an inheritance model that is closely based on CSS (Cascading
Style Sheets, a W3C Recommendation).
- interactive region
- the effective geometric region for the purposes of all interactive
cursor and mouse operations, such as picking and mouseover. By default,
the drawn graphical primitives of the object define the
interactive region. For filled-area primitives this includes: the edge,
if edge visibility is 'on'; the interior, if the interior style is
other than 'empty' or 'hollow'; and, the boundary, for interior style
'hollow'. For all graphical primitive types, drawn graphical
primitives exclude any that are fully transparent (so a fully
transparent object is equivalent to an empty object, for purposes of
interactive region definition). If the object contains a 'region' APS Attribute, then
that region area is the interactive region.
- listener, event listener
- The event listener specifies the interface via which users register
event handlers with the WebCGM DOM implementation. This interface
consists of a single method, handleEvent(), which the WebCGM DOM
implementation calls whenever specified events occur. Users pass
WebCGMEventListener objects as arguments to the addEventListener()
method of the WebCGMMetafile object to register a specific event
handler with the WebCGM DOM implementation.
- locus
- A general definition from the Oxford dictionary defines
locus as: "Curve formed by all points satisfying particular
equation of relation between coordinates, or by point, line, or
surface, moving according to mathematically defined conditions." In the
WebCGM specification, locus refers to the set of points that comprise
the path or shape of a Graphical Primitive element, or in the
appropriate context, the combined shapes or paths collectively of all
of the Graphical Primitive elements in an Application Structure (APS).
I.e., the locus of an APS comprises the combined loci of all of the
graphical primitives in the APS. Locus does not include defining data
that are not part of the shape or path of the graphical primitive, such
as control points of Bezier primitives, or the center point of a
Circular Arc Center primitive.
- metadata
- Non graphical information contained within or associated with
standard graphical files, in WebCGM metadata supports such ancilliary
functions as hierarchical picture structuring, object identification
and navigation, and association of application-specific non-graphical
data with graphical objects.
- metafile
- A mechanism for retraining and transporting graphical data and
control information, containing a device independent description of one
or more pictures.
- namespace, NS
- A method devised and standardized by the XML Namespaces
standard, namespace provides a way to distinguish to which
specification and grammar elements and attributes belong, when
information from distinct XML languages is mixed in the same document.
WebCGM uses namespaces to separate standardized WebCGM XCF elements and
attributes from embedded and intermingled application-specific
metadata.
- Normalized Device Coordinates, NVDC
- The coordinate system that is used to communicate coordinate data
through the WebCGM DOM, NVDC is VDC normalized so that the origin is
lower-left and units are millimeters.
- object
- An Application Structure (grobject, para, subpara) or Picture in a
WebCGM.
- object behavior
- One of a set of (thirteen) ways in which the view of an object or
collection of objects is presented following the execution of a
hyperlink to the object(s). WebCGM standardizes a number of objects
that give complete control over the zoom, pan, and highlight aspects of
the view.
- picture behavior
- One of a set of ways in which the view of a picture (CGM) or document
(HTML) is handled following the execution of a hyperlink to the
content. Based on the 'target' attribute of the HTML 'a' tag, picture
behaviors allow the specification of the new view to occur in a new
window, to overwrite the whole contents of the source window, to
overwrite the parent window, etc.
- PPF, Profile Proforma
- A method of expressing profiles standardized in CGM:1999 (clause 9),
the PPF presents a profile as a single table covering all aspects of
the CGM standard, with a reference column (enumerating a Model Profile
or other base profile), and a column to define the target profile by
comparison to the reference column.
- Style Property
- A graphical attributes that may be applied and manipulated at the APS
or picture level, transiently, by WebCGM DOM and WebCGM XCF. WebCGM 2.0
defines nine style properties.
- target rectangle
- A rectangular region around the target object(s) that is used for the
application of object behaviors following hyperlink execution. The
target region is defined by APS Attributes and/or target geometry, and
for example provides the area to be encompassed by a zoomed view.
- WDOM, WebCGM DOM
- The WebCGM Document Object Model, this terminology is used when it is
needed to unambiguously distinguish the WebCGM DOM from the generalized
W3C DOM specifications.
- XCF, XML Companion File
- An XML file format defined by WebCGM, that can be used to externalize
metadata from WebCGM instances and bind it to objects in the
metafile.
This section is informative (non-normative).
Note: The following subsections list all significant changes applied
to the WebCGM 2.0 specification to derive this draft of the WebCGM 2.1
specification.
---200900821 current-editors-draft text includes all
of below changes---
---20090604 draft 2nd Last Call text includes all of
below changes---
- For elements lineCap, edgeCap, lineJoin, edgeJoin, lineTypeCont,
edgeTypeCont, restrTextType, changed attributes to #REQUIRED in section 9.3.3, in section 9.4, and in the external
DTD file (webcgm21config.dtd).
- For elements lineCap, edgeCap, lineJoin, edgeJoin, lineTypeCont,
edgeTypeCont, restrTextType in section 9.3.3, add
informative note about CGM:1999 default value(s).
- Added missing ELEMENT declarations for lineTypeCont (9.3.3.5) and
edgeTypeCont
(9.3.3.6).
- Removed WebCGM-invalid value "5" from lineCapInd and edgeCapInd in the
embedded complete ACI DTD
(9.4), and in the ACI External DTD file (webcgmConfig21.dtd).
- Removed WebCGM-invalid value "5" from the prose of lineCapInd (9.3.3.1).
- Throughout, yellow-highlight styling is turned on only for changes
since 1st LCWD (20080917), as listed in this appendix; previous styling
of "new in WebCGM 2.1" is turned off.
- In Chapter 8 ECMAScript, restored the
"setView(viewRect)" (and Boolean) fix, documented for but lost from the
20090130 WD. (See below).
- fixed missed occurrence of "defaultStyleProp" (changed to
"defaultAttributes") in the external ACI DTD file (
webcgmConfig21.dtd).
- improved wording of the scale
method and the rotate
method of the WebCGMMatrix
Interface.
- added "Identifiers for
the ACI DTD" subsection to Ch.9, and improved the "Conformance of ACI files"
subsection.
- corrected "maplist" to "mapList" and "dashlength" to "dashLength" in
DTD sections of ACI, Chapter 9, and in
the external DTD.
- improved getObjectExtent
description of contribution of graphical text elements to the object
extent (section 5.7.6).
- cleaned up XML 1.0 references throughout, and changed Chapter 2 XML Reference to XML 1.0
5th edition.
- changed directionVectors, gapWidth, lineTypeIndex from element to
attribute in section
9.3.3.10 and section
9.4
- changed dashLength from element to attribute in section 9.3.3.9 and section 9.4.
- replicated dashLength, directionVectors, gapWidth, lineTypeIndex in ACI external DTD file
(webcgmConfig21.dtd).
- increased limit on dash-gap list from 8 to 64 in LETD element (T.17.17
in Profile section
6.6).
- added center point to WebCGMMatrix scale() method and
WebCGMAppStructure scale()
method, as well corresponding code in ECMAScript Binding (Ch.8).
- explicitly pointed out in getObjectExtent description
that CGM clipping (which is in the class of excluded Control Elements)
does not affect the extent calculation.
- in getObjectExtent
description of section 5.7.6,
added clarification about contribution of raster elements to object
extent.
- added conceptual description
and examples of how Style Properties work, followiing the Style
Properties table and SP descriptions (section 5.7.6).
- changed initial value column of new 2.1 SPs to "metafile-value" in Style Property table
(section 5.7.6), added explanatory
"Initial values" paragraph.
- changed "defaultStyleProp" to "defaultAttributes" to fix typo in the complete ACI DTD.
- clarified that scaling is centered at NVDC (0,0) in description of scale utility method of WebCGMMatrix interface
(5.7.1.3).
- corrected cut-paste error in sx,sy descriptions of scale() method in section 5.7.6; also clarified
NVDC (0,0) as center of scaling operation.
- corrected "lineJoinInd" to "edgeJoinInd" in edgeJoin element
description of section
9.3.3.4.
---20090130 Working Draft includes all of below
changes---
- clarified return type in getStyleProperty (gSP) method, for both the gSP on the picture
interface as well as the gSP on the APS
interface.
- fixed editorial error for stroke-type in Style Properties table of section 5.7.5 — must be +/-
integer, not name.
- fixed typo in stroke-type SP
description of section 5.7.5
— changed "1-6" to "1-5"
- clarifed the wording of the "Note:" in cgmFont description of section 9.3.2.2, to remove
implication that the normalization's utility is unique to ISO Latin
1.
- added to the cgmFont description of section 9.3.2.2 the
specification that correct/consistent string comparisons may require
using a unicode normalization form.
- added references to Chapter 1 for the
charmod normalization spec
and the unicode normalization
appendix.
- clarified the wording of the CSS reference in the substitutionList
description of section
9.3.2.2.
- in section 5.7.5, changed setView
return type to boolean in the IDL and in the setView() description.
- In Chapter 8 ECMAScript, changed
"setView(view)" to "setView(viewRect) and changed the associated
specification of the return value Boolean.
- in the setView() description of
section 5.7.5, clarified the result
when the rectangle of the 'viewRect' parameter has a different aspect
ratio than the viewer's display rectangle.
- in the getObjectExtent
description of section 5.7.6,
changed "abstract locus" to "locus", and linked that to a new definition of locus in appendix "C. Glossary".
- removed the GZIP specifications from T.13.1 of section 6.2; moved GZIP
requirement to "7.1
conformance definitions"; fixed explanatory statements of "2.4 Encodings".
- in the getObjectExtent
description of section 5.7.6,
clarified the statement of the effect of Style Properties and APS
Attributes on the extent calculation.
- changed the method name 'union' to 'unionRect' in section 5.7.1.2, in the setView
description of section 5.7.5, and
in the WebCGMRect object specification of Ch.8 ECMAScript binding.
- in center column of T.14.4 and T.14.5 (section 6.3), changed 254 to
508; in center column of T.14.5 changed 1024 to 2048.
- in center and right columns of T.14.5 (section 6.3), changed "within
type D" to "within type D and type SDR".
- fixed editorial error in definition of Delimited
String in section 5.5.2.3 by changing "ListOf" to "List" in the
definitions.
- fixed formatting of "substitutionList=CDATA"
line in section 9.3.2.2.
---20080911 draft Last Call text includes all of below
changes---
---20080827 editor's draft includes all of below
changes---
---20080813 editor's draft includes all of below
changes---
- Fixed minor editorial errors in Chapter
9 (Application Configurable Items)
- Fixed omission of David Cruikshank from Acknowledgements.
- Added Ch.8 subsections to Detailed
TOC.
- Converted to W3C style sheets and cover page.
---20080625 draft (CD02) includes all of below
changes---
- Corrected "dashlength" to "dashLength" in the DTD bits of Ch.9 ACI, and in the external DTD file webcgmConfig21.dtd.
- Update ECMAScript (Ch.8) to align with
Ch.5 DOM changes: WebCGMRect, WebCGMMatrix, float datatypes replacing
some WebCGMString.
- Improve specifications of parameter in Chapter 9 with explicit "WebCGMString
List-of-number subtype" statements.
- Added non-normative "9.2.3 Association of ACI
files with viewers" to ACI chapter.
- Rules in 3.2.1.7 that
CGM:1999 layout rules take precedence over DOM geometric transform ("no
effect") on substring APS
- Update section 9.4 (complete
dtd of the ACI) and external DTD file webcgmConfig21.dtd.
- Update section 4.4
(complete dtd of the XCF) and external DTD file webcgm21.dtd.
- Integrate executable example into Regex
Example (Appendix F).
- Throughout Chapter 4 (XCF), change
"geometric transform style properties" to "geometric transform", and
"geometricTransformSP" to "geometricTransform".
- In Chapter 4 (XCF) geometricTransform
entity definition, change "matrix" to "setTransform".
- Adjust 4.3.1 for new
Float and WebCGMMatrix parameter types in DOM transform attributes and
parameters (old DOM types were WebCGMString).
- Fixed examples in 4.3.1
so that coordinates are proper NVDC (0.0-1.0).
- Clarify in 3.1.2.7 that
RT/AT layout rules of CGM:1999 have precedence over possible
substring-APS geometric transform.
---20080617 editor's draft includes all of below
changes---
---20080515 editor's draft includes all of below
changes---
---20080327 draft (CD01) includes all of below
changes---
- (CD01 added Ch.9 ACI file format, aci access from frag syntax in Ch.3,
aci-processing PI in Ch.4).
- (CD01 added new Style Properties to Ch.5 and Ch.4).
- Added geometric transform methods and getTransformSP to ECMAScript.
- Added getTransformSP() method to WebCGMAppStructure interface.
- Added entity geometricTransformSP to webcgm21.dtd.
- Added geometric transform SP to XCF, as
XML attributes, defining entity geometricTransformSP; description and
order caveat in sec.
4.3.1.
- Added more normative explanation and supporting material to "Geometric transform Style
Property"
- Added scale, translate, rotate, and matrix methods to WebCGMAppStructure interface.
- Added getStyleProperty() inquiry method to Picture interface and WebCGMAppStructure interface.
- Added getObjectExtent() to WebCGMAppStructure interface.
- Added setViewPort() to Picture
interface
- Added new style properties to sec.
4.3.2 and sec.4.4, along
with sec 5.7.5 and the XCF
DTD.
- Added GZIP requirement to Ch.6, Profile, T.13.1.
- Added new Ch.9, "Application
Configurable Items", fixed cover
page TOC, fixed detailed TOC, added
description to end of sec.
2.5.2 and 2.5.4.
- Added g-zip (RFC1952) to
normative references, added informative paragraph to 2.4 Encodings.
- Implemented placeholder 5.4.4 geometric
transform description.
- General makeover 2.0-to-2.1 of Chapter 5,
Document Object Model.
- General makeover 2.0-to-2.1 of Chapter 4,
XML Companion File .
- General makeover 2.0-to-2.1 of Chapter 8,
ECMAScript binding .
- added setRedraw() method to WebCGMMetafile interface, and to the
Ch.8 ECMAScript binding.
- added HTML script code for regular expression searching to new Appendix F and link to it from
"Examples" in 5.7.6.
- added getObjectExtent() method to 5.7.6 Interface WebCGMAppStructure and
the Ch.8 ECMAScript binding.
- General makeover 2.0-to-2.1 of Chapter 3,
Intelligent Content.
- General makeover 2.0-to-2.1 of Chapter
2, Concepts.
- General makeover 2.0-to-2.1 of Chapter 1,
Introduction.
- Integrated all 2.0 Errata (as of
2008-03-03).
- General makeover 2.0-to-2.1 of Ch.6
PPF.
- Implemented transparency clarifications: new text in 2.2.3, reference 2.2.3
from 3.4 'background', add
informative notes to T.18.3,
T.18.4, T.18.16, and T.21.1.
- For sub-string hot spot clarification, modified text in 3.2.1.1, 3.2.1.3, 3.2.1.4, and added new 3.2.1.7.
- Added ISO/IEC 8632-1:1999/Cor 2:2007 (sub-string hotspot clarification)
to 1.2 Normative
references.
- Revised Appendixes for general
2.0-to-2.1 makeover, restart "D. Change log", restart "What's new in
WebCGM 2.1".
- Revised Ch.7 Conformance clause so
that it's appropriate for 2.1, including:
- general 2.0-to-2.1 makeover;
- fixed test suite references in section
7.6
- preliminary rework of deprecation-obsoletion scheme for
2.0-to-2.1
- Remade document structure and file naming for WebCGM 2.1.
This section and its subsections are informative
(non-normative).
Topics such as internationalization and accessibility have been addressed
by W3C in other Recommendations available on the Technical Reports page. The
relationship between the specifications of technology modules, such as this
one, and those cross-cutting recommendations is discussed in the Specification
Guidelines. As suggested in the Specification Guidelines, this
section identifies some relationships between the capabilities afforded by
WebCGM features and accessibility requirements established by other
Recommendations.
Although a WebCGM metafile is a binary file format, it has systematic
grouping and annotation features that foster accessibility of WebCGM metafile
content. For example, graphical text is ideally stored as Unicode text
strings within the metafile, but to handle cases where graphical text images
are actually the result of other vector (e.g. stroking) or raster (e.g.,
bitmaps) graphics in the metafile, WebCGM has the attribute 'content' on the para and subpara
objects, that gives the text-string equivalent of the rendered graphical
text.
Features that are in the binary metafile itself will, unlike clear-text
formats such as HTML, XML, and SVG, require the cooperation and intervention
of the WebCGM authoring tools and viewers. As described in [Essential Components of Web
Accessibility], several components such as authoring tools, media viewers
and developers, have to work together to improve Web accessibility.
Therefore, the discussions in the following sections are recommendations to
content developers, and builders of authoring tools and viewers.
By Guideline 9 "Provide navigation mechanisms" of [UAAG10] a WebCGM viewer is expected to
let users interact with 'enabled' and significant objects in the image.
'Enabled' objects are those which accept user input, such as on screen
buttons. By the structure of WebCGM, each APS should be treated as a
significant object and be reachable by navigation techniques. By Guideline 1
"Support input and output device independence" the reach of keyboard-actuated
navigation should cover this whole set of navigation destinations.
Some notion of forward and backward motion among peer nodes in the WebCGM
image should be provided. This should by default move among paragraphs and
sub-paragraphs in the order in which they appear in the metafile. The
creators of WebCGM instances should ensure that this results in a sensible
reading order. However, efficient motion as called for in [UAAG10] Checkpoint
9.9, is not likely to result from one global list or loop of all the
plausible navigation destinations. Exploiting the structure of the metafile,
structured navigation could take hierarchical or categorical forms. In
hierarchical navigation, forward and back motion moves among peer nodes at
the same level in the layers-and-objects nesting tree. In categorical
navigation, the sequential navigation could exhibit navigation modes which
visit only 'grobject' nodes, or only the 'gropbject' nodes with a common
'name.' An example of hierarchical navigation is provided by the player
behavior for the [DAISY] standard digital talking book. An example of
categorical structured navigation is provided by the diverse navigation modes
of the Opera browser. The creators of WebCGM instances should ensure that the
layers-and-objects nesting forms a plausible table of contents as annotated
with the textual properties (see E.3 below) of the affected nodes, and that
collecting nodes of like 'name' forms meaningful slices of what is in the
scene.
In this version of WebCGM, there are no intra-metafile controls to alter
the navigation graph. In a scenario where such capability is desired, the private-namespace extension feature of
the XCF can be used to introduce further intelligence associated with the
contents of the metafile proper.
Web Content Accessibility Guidelines such as [WCAG10] require that essential
information be available in text form. Some key examples are:
- text alternatives for all text content, such as the 'alt' attribute on
an 'img' element in HTML and XHTML.
- labels for form controls such as the 'input' element type in HTML.
- the text content of hyperlinks should provide a standalone orientation
to where you are going if you follow the link.
WebCGM contains attributes that associate text with things in the depicted
scene, and can be used to meet these requirements.
- The 'content' ensures
that when there is text in a bitmap, the text content is available as
computer text.
- The 'screentip' attribute
is allowed on all objects (APS) Its behavior and usage parallel that of
the 'title' attribute in HTML.
- The 'layerdesc' attribute
is allowed on 'layer' APS
types. This should be used roughly as the 'longdesc' attribute in
HTML
- On hyperlinks ('linkuri'
APS attribute), the attribute components "Link Title" (in metafile
instances) or 'desc' (in XCF
instances) provide a textual identification of where the link goes.
Creators of WebCGM instances should ensure that the content
available through these features provides a good orientation to the link
destination.
This essential content, if not always presented to the user, must be
considered 'conditional content' in the sense of [UAAG10], Checkpoint
2.3. That checkpoint gives some latitude to the viewer as to
whether to present these attributes globally through view-mode controls or
locally in response to focus and inspect actions of the user.
WebCGM viewers should also make this textual information available to
assistive technology through the accessibility API appropriate to the
programming platform, following [UAAG10], Guideline
6.
Note. It might be thought that the 'name' APS attribute could or
should be used in a manner like 'alt' on 'img' in HTML. This is not the
design intent of the 'name' attribute. It has well-defined category, not
instance, semantics and associated categorical navigation behavior.
WebCGM versions 2.0 and higher support transient, display-time control of
a number of display
properties of objects. These can be manipulated via the WebCGM DOM, and
are also available via the XCF mechanism. Although WebCGM does not support conventional styling, an (external) XCF
can function similarly to an external style sheet. For improved
accessibility, WebCGM viewers should provide some user control of rendering.
Use of these mechanisms partially supports the recommendations of [WCAG10], Checkpoint 3.3 and
[UAAG10], Guideline
4.
By default, WebCGM viewers allow the user to navigate to and interact with
only enabled elements (i.e. element whose 'visibility' attribute is 'on').
Objects which are not visible do not display tooltips (the 'screentip' APS
attribute), may not be highlighted without making them visible, and may not
be navigated to via the picture behaviors (whether in picture fragments or
DOM src parameter).
In addition, WebCGM viewers can offer a mode where, at user option, the
'visibility' attribute is
ignored, for accessibility or debugging support. It meets a requirement of
[UAAG10], CheckPoint
9.3.
This section is informative (non-normative).
The advanced example in this section shows how the functionality of the WebCGMAppStructure interface can be used
to build useful convenience functions, in this case a function to search a
WebCGM instance for all APS that contain an APS Attribute of a given type,
whose value matches a given regular expression (regex).
EXAMPLE:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>WebCGM 2.0 regex example</title>
<script type="text/ecmascript">
var cgm;
var pic;
var mydiv;
var o;
var nl;
var res;
function loadCGM(fname) {
try {
var obj = document.getElementById('image');
obj.innerHTML = "<object id='cgm' type='image/cgm;Version=4;ProfileId=WebCGM' width='400' height='300' src='"+fname+"'>";
document.getElementById('cgm').getWebCGMDocument().src = fname;
cgm = document.getElementById('cgm').getWebCGMDocument();
pic = cgm.firstPicture;
mydiv = '<h2>Looking at file '+fname+'</h2>\n';
mydiv += '<p>Enter an attribute and regular expression then click the Submit button.</p>\n';
mydiv += '<form name="myform">\n';
mydiv += '<select name="attr">\n';
mydiv += '<option value="content">content</option>\n';
mydiv += '<option value="interactivity">interactivity</option>\n';
mydiv += '<option value="layerdesc">layerdesc</option>\n';
mydiv += '<option value="layername">layername</option>\n';
mydiv += '<option value="linkuri">linkuri</option>\n';
mydiv += '<option value="name">name</option>\n';
mydiv += '<option value="region">region</option>\n';
mydiv += '<option value="screentip">screentip</option>\n';
mydiv += '<option value="viewcontext">viewcontext</option>\n';
mydiv += '<option value="visibility">visibility</option>\n';
mydiv += '</select>\n';
mydiv += '<input type="text" name="regex" size="20"></input>\n';
mydiv += '<input type="button" value="Submit" onclick="processAttr(attr.value, regex.value)"></input>\n';
mydiv += '</form>\n';
var t = document.getElementById('attinput');
t.innerHTML = mydiv;
} catch (e) {
alert("loadCGM error " + e);
}
}
function processAttr(att, val) {
try {
o = '<p>Searching APS for attribute '+att + ' containing '+val+'</p>\n';
// Create a list of nodes and print out the attribute
// This part is not really needed it is mostly here as
// a sanity check.
nl = listNodes(pic.firstChild);
o+='<p>List of all nodes in the DOM tree. A "" implies normally means the attribute was not specified.</p><ul>';
for(i=0; i< nl.length; i++){
o+='<li>'+nl[i].apsId+' ('+att+'="'+nl[i].getAppStructureAttr(att)+'")</li>';
}
o+='</ul>';
// Now we just run through the list and remove nodes that do not match
res = new Array();
for(i=0; i<nl.length;i++) {
attVal = nl[i].getAppStructureAttr(att);
if(attVal.match(val)) {
res.push(nl[i]);
}
}
if( res.length < 1) {
o += '<p>No nodes found matching that regular expression</p>\n';
} else {
o+= '<p>The following nodes match the regular expression</p><ul>';
for(i=0; i< res.length; i++){
o+='<li>'+res[i].apsId+' ('+att+'="'+res[i].getAppStructureAttr(att)+'")</li>';
}
o+='</ul>';
}
var t = document.getElementById('attout');
t.innerHTML = o;
} catch(e) {
alert("processAttr error " + e);
}
}
// These are helper functions that I found on the web
// http://www.ibm.com/developerworks/xml/library/x-matters41.html
//
// They are needed because you need to walk the tree to
// create a list of all of the nodes in the tree.
// return next node in document order
function nextNode(node) {
if (!node) return null;
if (node.firstChild){
return node.firstChild;
} else {
return nextWide(node);
}
}
// helper function for nextNode()
function nextWide(node) {
if (!node) return null;
if (node.nextSibling) {
return node.nextSibling;
} else {
return nextWide(node.parentNode);
}
}
// return an WebCGMNodeList of all nodes, starting at startNode and
// continuing through the rest of the DOM tree
function listNodes(startNode) {
var node = startNode;
var list = new Array();
while(node) {
list[list.length] =node;
node = nextNode(node);
}
return list;
}
</script>
</head>
<body>
<h1>WebCGM 2.0 regex example</h1>
<table>
<tr>
<td id="image">Select a CGM image...</td>
</tr>
</table>
<br>
<input size="60" type="file" name="cgmfile" onChange="loadCGM(this.value)"/>
<div id="attinput">
</div>
<div id="attout">
</div>
</body>
</html>
View
this example as HTML-CGM (WebCGM-DOM-enabled browsers only.)
Back to top of Appendixes