Top Banner
Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company
22

Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company.

Mar 26, 2015

Download

Documents

Ava Schmidt
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Validation of a CGM Graphic Against the Web CGM Profile Stuart Galt The Boeing Company.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

What’s Ahead

• Complete mapping CGM binary to XML

• Finish WebCGM schema

• Work to continue in CGM Open Consortium: http://www.cgmopen.org