Transcript Validation of a CGM Graphic Against the Web CGM Profile
Validation of a CGM Graphic Against the Web CGM Profile
Stuart Galt The Boeing Company
Agenda
• • •
What is the WebCGM profile The process Hard parts
WebCGM
• •
CGM (ISO 8632) vector and composite vector/raster graphic format.
WebCGM is a profile used to specify the subset of the CGM standard that will be used to exchange data on the web.
WebCGM History
• • • • •
1987 - ISO approved CGM as a Standard 1995 - CGM became a registered mime type 1996 W3C published “Scalable Graphics Requirements” 1997 W3C published “Use of CGM as a Scalable Graphic Format” 1999 - WebCGM 1.0 approved in January
WebCGM is intelligent
• •
Contains graphic primitives
– – –
Lines, polylines, polygons Rectangles, circles, ellipses, arcs Graphical text Non graphical content
– – –
Metadata Hierarchies objects Links
CGM file
The Process
XML version XML schema validator WebCGM profile schema
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 9c 09 51 00 96 XML
CGM primitives (cont’d)
•
Restricted Text
CGM primitives (cont’d)
•
Polygon
CGM States
•
Container elements used to mark state changes
–
Metafile defaults
…defaults go here …
CGM States (cont’d)
–
Picture Descriptor and Picture Open State
CGM
BegMF Metafile Descriptor Computer Graphics Metafile Picture
States
Picture EndMF BegPic Picture Descriptor Picture Body EndPic Picture Body BegPicBody Picture Open
Metafile
VDCType Metafile Decsriptor
opt rep
Descriptor
IntegerPrec RealPrec MFVersion MFDesc IndexPrec ColrPrec ColrIndexPrec MaxColrIndex ColrValueExt MFElemlist FontList CharSetList CharCoding NamePrec MaxVDCExt SetPriExt ColrModel ColrCalib FontProp GlyphMap SymLibList
Validating WebCGM
•
Current state:
–
Profile validation tool exists for WebCGM in binary encoding
•
Metacheck
–
With a WebCGM schema defined
•
General purpose tools would be available
The Schema
• •
Some elements are easy to represent Some are hard
Metafile Version
Non Graphical Text String
The Hard
•
Some elements are restricted (or required based on the value of the metafile version
–
If version == 3 then a RestrictedTextType element must appear before the first RestrictedText element
–
If ColorSelectionMode 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 WebCGM 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 WebCGM schema Work to continue in CGM Open Consortium: http://www.cgmopen.org