![Page 1: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/1.jpg)
Validation of a CGM Graphic Against the Web CGM
ProfileStuart Galt
The Boeing Company
![Page 2: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/2.jpg)
Agenda
• What is the WebCGM profile
• The process
• Hard parts
![Page 3: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/3.jpg)
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.
![Page 4: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/4.jpg)
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
![Page 5: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/5.jpg)
WebCGM is intelligent
• Contains graphic primitives– Lines, polylines, polygons– Rectangles, circles, ellipses, arcs– Graphical text
• Non graphical content– Metadata– Hierarchies objects– Links
![Page 6: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/6.jpg)
The Process
CGM fileXML schema
validatorXML
version
WebCGMprofile
schema
![Page 7: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/7.jpg)
CGM to XML
• CGM graphic primitives are converted directly
• Containers are used to represent internal state changes
![Page 8: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/8.jpg)
CGM primitives
• Circle centered (4252, 2385) radius 150 • Binary CGM
41 86 10 9c 09 51 00 96
• XML<Circle><Point x=“4252” y=“2385”/><Radius r=“150”/></Circle>
![Page 9: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/9.jpg)
CGM primitives (cont’d)
• Restricted Text
<RestrictedText final="yes"><DeltaBox dx="400" dy="97"/><Point x="914" y="1953"/><StringFixed>NOTE:</StringFixed></RestrictedText>
![Page 10: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/10.jpg)
CGM primitives (cont’d)
• Polygon
<Polygon><Point x="3175" y="3879"/><Point x="3085" y="3833"/><Point x="3075" y="3866"/></Polygon>
![Page 11: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/11.jpg)
CGM States
• Container elements used to mark state changes– Metafile defaults
<MetafileDefaultsReplacement> …defaults go here …</MetafileDefaultsReplacement>
![Page 12: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/12.jpg)
CGM States (cont’d)
– Picture Descriptor and Picture Open State
<Picture><StringFixed>Picture Description</StringFixed>
…Picture descriptor data here…
<BeginPictureBody/>…Picture data here…</Picture>
![Page 13: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/13.jpg)
ComputerGraphicsMetafile
BegMF Picture EndMF
Picture
BegPicPictureBody
EndPic
PictureBody
BegPicBody
MetafileDescriptor
PictureDescriptor
PictureOpen
CGM States
![Page 14: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/14.jpg)
MetafileDecsriptor
MFVersion MFDesc VDCType
FontList
IntegerPrec
CharSetList
RealPrec
CharCoding
IndexPrec
NamePrec
ColrPrec
MaxVDCExt
ColrIndexPrec MaxColrIndex ColrValueExt MFElemlist
SetPriExt ColrModel ColrCalib FontProp GlyphMap SymLibList
optrep
Metafile Descriptor
![Page 15: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/15.jpg)
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
![Page 16: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/16.jpg)
The Schema
• Some elements are easy to represent
• Some are hard
![Page 17: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/17.jpg)
Metafile Version
<element name="MetafileDescriptor"><complexType>
<sequence>
<element name="MetafileVersion"><attribute name=“version” use=“required”
type=“integer” minInclusive=“1”
maxInclusive=“4”/>
</element>
<all>
<element name="MetafileDescription" type="string"/>
...other required elements go here...</all></sequence></complexType></element>
![Page 18: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/18.jpg)
Non Graphical Text String
<simpleType name=“NonGraphicText”>
<restriction base=“string”>
<minlength value=“0”/>
<maxlength value=“254”/>
</restriction>
</simpleType>
![Page 19: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/19.jpg)
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
![Page 20: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/20.jpg)
The Hard Part
• Branching logic– If (condition a) then
foo else
bar
![Page 21: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/21.jpg)
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.
![Page 22: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company](https://reader033.vdocument.in/reader033/viewer/2022052307/5513da275503463a298b5565/html5/thumbnails/22.jpg)
What’s Ahead
• Complete mapping CGM binary to XML
• Finish WebCGM schema
• Work to continue in CGM Open Consortium: http://www.cgmopen.org