validation of a cgm graphic against the web cgm profile stuart galt the boeing company

Post on 26-Mar-2015

224 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Validation of a CGM Graphic Against the Web CGM

ProfileStuart 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

The Process

CGM fileXML schema

validatorXML

version

WebCGMprofile

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<Circle><Point x=“4252” y=“2385”/><Radius r=“150”/></Circle>

CGM primitives (cont’d)

• Restricted Text

<RestrictedText final="yes"><DeltaBox dx="400" dy="97"/><Point x="914" y="1953"/><StringFixed>NOTE:</StringFixed></RestrictedText>

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

<MetafileDefaultsReplacement> …defaults go here …</MetafileDefaultsReplacement>

CGM States (cont’d)

– Picture Descriptor and Picture Open State

<Picture><StringFixed>Picture Description</StringFixed>

…Picture descriptor data here…

<BeginPictureBody/>…Picture data here…</Picture>

ComputerGraphicsMetafile

BegMF Picture EndMF

Picture

BegPicPictureBody

EndPic

PictureBody

BegPicBody

MetafileDescriptor

PictureDescriptor

PictureOpen

CGM States

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

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

<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>

Non Graphical Text String

<simpleType name=“NonGraphicText”>

<restriction base=“string”>

<minlength value=“0”/>

<maxlength value=“254”/>

</restriction>

</simpleType>

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

top related