1 The XML document structure of MS Visio software
Visio is a powerful, with a large number of customer-oriented office vector graphics software system, with its unique mold, template, towed drawing methods and intelligent graphics and other technologies and swept the world. To facilitate the full integration and sharing of Visio document information with other application systems, especially for internet-based applications, Microsoft announced in 2004 that it provides a reference Schema for visio--of Visio documents in a free license format. DATADIAGRAMML ".
The Visio XML document is "Visiodocument" as the root tag, and its child nodes describe the shape information, text information, data information of the document mainly in the hierarchy of "table (Sheet)", "section", "Row (Row)" and "cell". Control information, structure information and partial meta information. The descendants of a document's top-level node as shown in Figure 1, the "stylesheets", "Masters", and "pages" are three important child node tags in the Visio XML document that define the style, master, and page composition on which the document is based, and are subordinate to the "pages" The "Shape" node in the hierarchy is the basic, core, and primary component of the document and can be initialized as an instance of the corresponding master in the "Masters" hierarchy, and can inherit style attributes such as the line style, padding, and text defined in "StyleSheets". In addition, the Type property of the Shape node has the Group and shape options, in this way, the former can be used to further group the shape, so that the "shape" node itself can form a complex tree structure, and the underlying node can inherit some attributes of the high-level node. In addition, the "Shape" node under the "Masters" level is a defined and descriptive area of the user-defined line style, segment endpoint, and fill shape, in addition to the base class of the Shape object under the Pages hierarchy.
Similar to Microsoft's other Office software, Visio prescribes its internal variable types, units of measure, and operational functions, but Visio uses a broader range of formulas, especially when the definition of attributes in cell-level nodes is almost entirely defined as a formula. The application of this formula has its own distinctive features: first, although the value of the document editing by the user using Visio Software may change at any time, the corresponding value of each formula at any point is computed and recorded statically in the XML document. In this way, the third party program does not need to involve too many functions and formulas to parse and compute; the second is that, for a length unit, Visio converts it into an internal unit (inches) and records it in an XML document, regardless of the unit of measure the user specifies, which eliminates the need for third-party programs to involve excessive unit conversions.
The coordinate system and transformation of the structure 2.1 shape of 2 Shape objects
Visio describes the geometry and text attributes of a Shape object in a ShapeSheet table, which contains two important sections, the shape Transform. Section "and" Text Transform. Section ", in Visio XML documents, the two sections are labeled" XForm "and" Textxform ", respectively describing the Shape object's geometry and the position and range of the text. Taking the "XForm" node as an example, the geometry position of the shape can be completely determined by the node value of its child nodes "PinX", "PinY", "Width", "Height", "LocPinX", "LocPinY", "Angle", "flipx", "flipy". , size, rotation angle and horizontal or vertical flip state, the principle is shown in Figure 2.
This transformation can be easily implemented with the AffineTransform class in Java AWT. Assuming that the "context coordinate transformation" on which shape is based--the transformation of the Visio document display, such as scaling, panning, and flipping, or the transformation of its group objects--is TX, the coordinate transformation for the correct display of shape should be:
Tx.clone (). Translate (PinX, PinY). Rotate (Angle). Translate (-locpinx,-locpiny). Scale (-FLIPX,-FLIPY)