Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:doc:xml_struct_elements_0.3 [28/08/2011 18:28] – marmei | en:doc:xml_struct_elements_0.3 [20/11/2014 14:01] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== The XML structure used to describe the items in QElectroTech 0.3 ====== | ||
+ | ... Or the creator of the guide elements in XML. This page is intended to describe the XML structure used to store the definitions of the elements used in QElectroTech. It is intended for developers TEQ but also to non-developers who want to do without the item editor. | ||
+ | ===== Example and general structure of an element definition ===== | ||
+ | <code xml> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <name lang=" | ||
+ | <name lang=" | ||
+ | </ | ||
+ | < | ||
+ | License: CC-BY | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <polygon x1=" | ||
+ | < | ||
+ | <line x1=" | ||
+ | < | ||
+ | <polygon x1=" | ||
+ | <circle x=" | ||
+ | < | ||
+ | <text x=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | This XML is an " | ||
+ | {{: | ||
+ | |||
+ | The doctype in the first line is not very important in that a DTD is not sufficient to fully validate an element definition | ||
+ | |||
+ | The main element is the XML tag " | ||
+ | |||
+ | ==== Dimensions of the element ==== | ||
+ | |||
+ | One of the first things to be specified in the definition of an element is its size: width (width) and height (height) in pixels. Both dimensions must be integer multiples of 10. If this is not the case, the TEQ will round to the next ten (eg 50 to 42 pixels). They determine the size and bounding rectangle of the item. | ||
+ | |||
+ | {{ schema_xml_element1.png |Schema explicatif}} | ||
+ | |||
+ | ==== Attachment point (hotspot) of the element ==== | ||
+ | |||
+ | The attachment point of the element is the point hanging on the mouse during a drag and drop the item. Must be integer coordinates. " | ||
+ | |||
+ | ==== Element Orientation ==== | ||
+ | |||
+ | We must then define what are the possible directions of the element. The orientation of the element is used when installing the drivers but also to prevent the user to rotate an element in a direction that would not make sense. The attribute policy is defined by a sequence of four characters, each character defines the behavior for an orientation. | ||
+ | |||
+ | * 1 <sup> st </ | ||
+ | * 2 <sup> nd </ | ||
+ | * 3 <sup> th </ | ||
+ | * 4 <sup> th </ | ||
+ | |||
+ | Each character can have the following value: | ||
+ | |||
+ | * D to " | ||
+ | * Y for " | ||
+ | * N for " | ||
+ | |||
+ | Example: orientation = " | ||
+ | |||
+ | ==== Internal Connections ==== | ||
+ | |||
+ | By default, it is not possible to connect two terminals of the same element. This behavior can be changed with the attribute " | ||
+ | |||
+ | ==== The rest of the definition ==== | ||
+ | |||
+ | The remaining definition is divided into three parts: the first is the definition of the name or names of the element with the XML element " | ||
+ | |||
+ | ===== Define one or more names for the element ===== | ||
+ | |||
+ | A given element has only one name per language. It is therefore possible to define as many names as possible translations. Depending on the language of the system (which may be different translations available for TEQ), the appropriate name is selected and displayed. Internally, the TEQ can handle file names. | ||
+ | |||
+ | The XML element " | ||
+ | |||
+ | Elements " | ||
+ | |||
+ | ===== Additional information | ||
+ | The XML element " | ||
+ | |||
+ | ===== Draw and dial element ===== | ||
+ | |||
+ | The definition of the design of the item is close enough to the encoding of an SVG image. Parts of the drawing are drawn in the same order as the XML elements, that is to say that an element may overlap its predecessors. Invalid XML elements are ignored. | ||
+ | ==== Attributes style ==== | ||
+ | |||
+ | For most of the XML elements representing a portion of the drawing, it is possible to define style attributes including on the type of stroke and fill of these parts of the drawing. | ||
+ | |||
+ | The use of " | ||
+ | |||
+ | <code xml> | ||
+ | <circle x=" | ||
+ | </ | ||
+ | === Line Style === | ||
+ | |||
+ | The line style is defined with the style " | ||
+ | |||
+ | * dashed: dotted line | ||
+ | * normal [default]: solid line | ||
+ | |||
+ | === Line Color === | ||
+ | |||
+ | The color of the line is defined with the style " | ||
+ | |||
+ | * white: white line | ||
+ | * black [default]: black line | ||
+ | |||
+ | This setting also applies to the text | ||
+ | |||
+ | === Line width === | ||
+ | |||
+ | The line thickness is defined with the style " | ||
+ | |||
+ | * thin: thin line, always displayed with a thickness of 1 pixel | ||
+ | * normal [default]: line normal | ||
+ | * none: no visible line | ||
+ | |||
+ | === Filling === | ||
+ | |||
+ | The filling is defined with the style " | ||
+ | |||
+ | * White: Fill in blank | ||
+ | * Black: black filler | ||
+ | * None [default]: no fill | ||
+ | |||
+ | === Attribute antialiasing === | ||
+ | |||
+ | In addition to the " | ||
+ | |||
+ | {{Antialiasing.png | Antialiasing}} \ \ An LED with and without antialiasing. Note that antialiasing is not always desirable. | ||
+ | |||
+ | === Bookmark === | ||
+ | |||
+ | The coordinates are relative to the reference whose origin is the attachment point (hotspot) and not the upper left corner of the rectangle bounding the element. The x axis is horizontal and moves to the right. The y-axis is vertical and goes down. The unit is pixel. The actual values are accepted (example: x = " | ||
+ | |||
+ | Do not leave the bounding rectangle element, under penalty of glitches. | ||
+ | ==== Line ==== | ||
+ | |||
+ | The line element accepts the following attributes: | ||
+ | |||
+ | * X1: abscissa of the first end of the line | ||
+ | * Y1: ordered the first end of the line | ||
+ | * X2: x-axis of the second end of the line | ||
+ | * Y2: ordered the second end of the line | ||
+ | * End1: type of tip to the first end | ||
+ | * Length1: length used to draw the tip of the first end. The default is " | ||
+ | * End2: type end to the second end | ||
+ | * Length2: length used to draw the tip of the second end. The default is " | ||
+ | |||
+ | The types of nozzles available are: | ||
+ | ^ ^ Tip value for the attribute \ \ end1 (or end2) ^ | ||
+ | | Normal | " | ||
+ | | Arrow simple | " | ||
+ | | Arrow triangular | " | ||
+ | | Circle | " | ||
+ | | Square | " | ||
+ | |||
+ | {{: Doc: endtypes.png |}} | ||
+ | ==== Rectangle | ||
+ | |||
+ | A rectangle is defined by the coordinates of its upper left corner and dimensions (width and height). Rect element accepts the following attributes: | ||
+ | |||
+ | * X: abscissa of the upper left corner of the rectangle | ||
+ | * Y: ordinate of upper left corner of the rectangle | ||
+ | * Width: width of the rectangle | ||
+ | * Height: height of the rectangle | ||
+ | |||
+ | ==== Ellipse ==== | ||
+ | |||
+ | An ellipse is defined by the rectangle in which it operates. The ellipse element accepts the following attributes: | ||
+ | |||
+ | * X: abscissa of the upper left corner of the rectangle | ||
+ | * Y: ordinate of upper left corner of the rectangle | ||
+ | * Width: width of the rectangle | ||
+ | * Height: height of the rectangle | ||
+ | |||
+ | ==== Circle ==== | ||
+ | |||
+ | The circle element is defined by the following attributes: | ||
+ | |||
+ | * X: abscissa of the upper left corner to square the circle | ||
+ | * Y: ordinate of upper left corner to square the circle | ||
+ | * Diameter: diameter of the circle | ||
+ | |||
+ | {{Ellipse-circle-arc.png | Ellipse, circle and arc}} | ||
+ | |||
+ | ==== Arc ==== | ||
+ | |||
+ | An arc is defined as a portion of an ellipse. The element of arc therefore shares attributes with the ellipse: | ||
+ | |||
+ | * X: abscissa of the upper left corner of the rectangle | ||
+ | * Y: ordinate of upper left corner of the rectangle | ||
+ | * Width: width of the rectangle | ||
+ | * Height: height of the rectangle | ||
+ | |||
+ | To these attributes would add two more: | ||
+ | |||
+ | * Start: start angle: the angle "0 degree" | ||
+ | * Angle: range (in degrees) of the arc and a positive value is in the opposite direction of clockwise | ||
+ | |||
+ | ==== Polygon ==== | ||
+ | |||
+ | The polygon is defined by a sequence of points. The " | ||
+ | code> xml> | ||
+ | <! - Draw a square -> | ||
+ | <polygon x1=" | ||
+ | <! - Draw three sides of the square -> | ||
+ | <polygon x1=" | ||
+ | </ Code> | ||
+ | ==== Text ==== | ||
+ | |||
+ | The text element accepts the following attributes: | ||
+ | |||
+ | * X: abscissa of the beginning of the text | ||
+ | * Y: ordinate of the start of the text | ||
+ | * Text: text to draw | ||
+ | * Size: size to use for the font | ||
+ | * Rotation: angle of the text (see details below) | ||
+ | |||
+ | The font is "Sans Serif" | ||
+ | |||
+ | You can set the default orientation angle of the text field with the attribute " | ||
+ | Its value is a decimal number that must be between -360.0 ° and 360.0 °. | ||
+ | 0 ° corresponds to the position of the small hand of a watch when it is 3 hours. | ||
+ | A negative number represents an angle in the opposite direction of clockwise while a positive value represents an angle in the direction of clockwise. | ||
+ | |||
+ | The positioning and rotation takes place over a point whose ordinate corresponds to the " | ||
+ | |||
+ | Note that, once the item placed on the scheme or its position or orientation can not be changed by the user. | ||
+ | |||
+ | ==== Terminal ==== | ||
+ | |||
+ | The terminals are the connection points used to connect components together by intermediates of drivers. There are always drawn last (ie above the other parts of the drawing), regardless of their location in the XML file. | ||
+ | |||
+ | So they take three attributes: | ||
+ | |||
+ | * X: abscissa of the terminal | ||
+ | * Y: ordinate of the terminal | ||
+ | * Orientation: | ||
+ | ==== Text fields ==== | ||
+ | |||
+ | Text fields are text editable by the user changes the text are recorded in drawings. | ||
+ | |||
+ | A text field is an XML element " | ||
+ | |||
+ | You can set the default orientation angle of the text field with the attribute " | ||
+ | |||
+ | The positioning and rotation are carried over ** in the middle left side of the text field **. | ||
+ | |||
+ | By default, the text field behaves so as to remain horizontal despite the rotations experienced by its parent (we say it does not follow the rotation of its parent element). This behavior can be changed with the attribute " |