Validation of a CGM Graphic Against the Web
Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company
Agenda • What is the Web. CGM profile • The process • Hard parts
Web. CGM • CGM (ISO 8632) vector and composite vector/raster graphic format. • Web. CGM is a profile used to specify the subset of the CGM standard that will be used to exchange data on the web.
Web. CGM History • 1987 - ISO approved CGM as a Standard • 1995 - CGM became a registered mime type • 1996 - W 3 C published “Scalable Graphics Requirements” • 1997 - W 3 C published “Use of CGM as a Scalable Graphic Format” • 1999 - Web. CGM 1. 0 approved in January
Web. CGM is intelligent • Contains graphic primitives – Lines, polylines, polygons – Rectangles, circles, ellipses, arcs – Graphical text • Non graphical content – Metadata – Hierarchies objects – Links
The Process
CGM to XML • CGM graphic primitives are converted directly • Containers are used to represent internal state changes
CGM primitives • Circle centered (4252, 2385) radius 150 • Binary CGM 41 86 10 9 c 09 51 00 96 • XML <Circle> <Point x=“ 4252” y=“ 2385”/> <Radius r=“ 150”/> </Circle>
CGM primitives (cont’d) • Restricted Text <Restricted. Text final="yes"> <Delta. Box dx="400" dy="97"/> <Point x="914" y="1953"/> <String. Fixed>NOTE: </String. Fixed> </Restricted. Text>
CGM primitives (cont’d) • Polygon <Polygon> <Point x="3175" y="3879"/> <Point x="3085" y="3833"/> <Point x="3075" y="3866"/> </Polygon>
CGM States • Container elements used to mark state changes – Metafile defaults <Metafile. Defaults. Replacement> …defaults go here … </Metafile. Defaults. Replacement>
CGM States (cont’d) – Picture Descriptor and Picture Open State <Picture> <String. Fixed>Picture Description</String. Fixed> …Picture descriptor data here… <Begin. Picture. Body/> …Picture data here… </Picture>
CGM Beg. MF States Computer Graphics Metafile Descriptor Picture End. MF Picture Body End. Picture Beg. Picture Descriptor Picture Body Beg. Pic. Body Picture Open
Metafile Decsriptor Metafile Descriptor opt rep MFVersion MFDesc Index. Prec Colr. Index. Prec Font. List Char. Set. List Set. Pri. Ext Colr. Model VDCType Colr. Calib Integer. Prec Max. Colr. Index Real. Prec Colr. Value. Ext MFElemlist Char. Coding Name. Prec Max. VDCExt Font. Prop Glyph. Map Sym. Lib. List
Validating Web. CGM • Current state: – Profile validation tool exists for Web. CGM in binary encoding • Metacheck – With a Web. CGM schema defined • General purpose tools would be available
The Schema • Some elements are easy to represent • Some are hard
Metafile Version <element name="Metafile. Descriptor"> <complex. Type> <sequence> <element name="Metafile. Version"> <attribute name=“version” use=“required” type=“integer” min. Inclusive=“ 1” max. Inclusive=“ 4”/> </element> <all> <element name="Metafile. Description" type="string"/> . . . other required elements go here. . . </all></sequence></complex. Type></element>
Non Graphical Text String <simple. Type name=“Non. Graphic. Text”> <restriction base=“string”> <minlength value=“ 0”/> <maxlength value=“ 254”/> </restriction> </simple. Type>
The Hard • Some elements are restricted (or required based on the value of the metafile version – If version == 3 then a Restricted. Text. Type element must appear before the first Restricted. Text element – If Color. Selection. Mode is indexed color is index value, else color is RGB values
The Hard Part • Branching logic – If (condition a) then foo else bar
Conclusion • Creation of a schema that enforces Web. CGM profile allows simple XML schema validator to validate conformance of CGM graphics. • This approach could also be used to simplify validation of other binary structured formats.
What’s Ahead • Complete mapping CGM binary to XML • Finish Web. CGM schema • Work to continue in CGM Open Consortium: http: //www. cgmopen. org
- Slides: 22