Download presentation
Presentation is loading. Please wait.
Published byAva Schmidt Modified over 11 years ago
1
Validation of a CGM Graphic Against the Web CGM Profile
Stuart Galt The Boeing Company
2
Agenda What is the WebCGM profile The process Hard parts
3
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. This is background and most everyone in the audience should know this. Feel free to ad-lib here.
4
WebCGM History 1987 - ISO approved CGM as a Standard
CGM became a registered mime type W3C published “Scalable Graphics Requirements” W3C published “Use of CGM as a Scalable Graphic Format” WebCGM 1.0 approved in January
5
WebCGM is intelligent Contains graphic primitives
Lines, polylines, polygons Rectangles, circles, ellipses, arcs Graphical text Non graphical content Metadata Hierarchies objects Links
6
The Process 1 – Convert CGM to XML
2 – get the profile schema provided by your standards body 3 – Take the above two pieces and validate the CGM instance
7
CGM to XML CGM graphic primitives are converted directly
Containers are used to represent internal state changes
8
CGM primitives Circle centered (4252, 2385) radius 150 Binary CGM XML
<Circle> <Point x=“4252” y=“2385”/> <Radius r=“150”/> </Circle>
9
CGM primitives (cont’d)
Restricted Text <RestrictedText final="yes"> <DeltaBox dx="400" dy="97"/> <Point x="914" y="1953"/> <StringFixed>NOTE:</StringFixed> </RestrictedText>
10
CGM primitives (cont’d)
Polygon <Polygon> <Point x="3175" y="3879"/> <Point x="3085" y="3833"/> <Point x="3075" y="3866"/> </Polygon>
11
CGM States Container elements used to mark state changes
Metafile defaults <MetafileDefaultsReplacement> …defaults go here … </MetafileDefaultsReplacement> Can be thought of similar to the “GSAVE” command in postscript. Major States : PCS Picture Closed State MDS Metafile Descriptor State DR Defaults Replacement Mode GSS Global Segment State DSS Picture Descriptor Segment State PDS Picture Descriptor State POS Picture Open State LSS Local Segment State SDS Structure Descriptor State SOS Structure Open State Minor States : FOS Figure Open State TOS Text Open State CPS Compound Path State PRS Protection Region State TAS Tile Array State
12
CGM States (cont’d) Picture Descriptor and Picture Open State
<Picture> <StringFixed>Picture Description</StringFixed> …Picture descriptor data here… <BeginPictureBody/> …Picture data here… </Picture>
13
CGM States Computer Graphics Metafile Metafile Descriptor Picture
EndMF BegMF Picture Picture Descriptor Picture Body EndPic BegPic Picture Body Picture Open BegPicBody
14
Metafile Descriptor Metafile Decsriptor MFVersion MFDesc VDCType
opt rep MFVersion MFDesc VDCType IntegerPrec RealPrec IndexPrec ColrPrec ColrIndexPrec MaxColrIndex ColrValueExt MFElemlist FontList CharSetList CharCoding NamePrec MaxVDCExt SetPriExt ColrModel ColrCalib FontProp GlyphMap SymLibList
15
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
16
The Schema Some elements are easy to represent Some are hard
17
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> The Metafile Version tag may appear only once in the CGM file, and must occur somewhere in the metafile descriptor section. There are a few other required elements in this descriptor section and could be represented in a schema by something like: The above example is a long way of saying that the Metafile Version tag must occur in the somewhere in the Metafile Descriptor section, but doesn't say exactly where. In addition the allowable values for the required version attribute are 1, 2, 3, or 4.
18
Non Graphical Text String
<simpleType name=“NonGraphicText”> <restriction base=“string”> <minlength value=“0”/> <maxlength value=“254”/> </restriction> </simpleType> A non-graphical text string is string that is not directly displayed on the graphic. An example would be the text associated with the CGM begin picture element. Non-graphical text strings are required to be less than 254 characters in length. By defining an element NonGraphicText type we can define it as a type of string with a length from 0 to 254 characters By defining the nongraphic text string attribute as: type=“NonGraphicText” We ensure that the string length requirement is met.<
19
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 Currently the author does not know how to represent some of the more complex restrictions in the WebCGM profile. There are several clauses that restrict (or require) an element based on the value of the metafile version. For example if you are in a version 3 metafile and you have a Restricted Text element, then you are required to have a Restricted Text Type element before the first Restricted Text element appears. I don’t know how to represent regular expressions and branching type logic using schema. One of the talks at the conference is about regular expressions in schema…
20
The Hard Part Branching logic If (condition a) then foo else bar
21
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.
22
What’s Ahead Complete mapping CGM binary to XML Finish WebCGM schema
Work to continue in CGM Open Consortium:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.