Download Now
Forums

    Reference TSvgNode

    Declared in Codebot.Render.SVG.pas on line 81

    A node keeps the attributes and style properties the parser does not know, so that a program can give the shapes of a document properties of its own. A custom property can be written as an attribute of an element, inside its style attribute, or in a rule of the style sheet for its class or id. Attribute reads one by name.
      TSvgNode = class
      protected
        function ApplyProperty(const Name, Value: string): Boolean;
        procedure ApplyStyle(S: string); virtual;
        procedure Parse(N: INode); virtual;
      public
        Doc: TSvgDocument;
        Parent: TSvgNode;
        Id: string;
        ClassId: string;
        Transform: string;
        Opacity: Float;
        Removed: Boolean;
        Style: TSvgStyle;
        StyleEx: TSvgStyleEx;
        constructor Create(ParentNode: TSvgNode); virtual;
        destructor Destroy; override;
        { Build the complete transform of the node }
        procedure BuildTransform(out T: TSvgTransform);
        { Return True if the node has a custom attribute or style property. With
          Inherit the nodes which contain this one are looked in as well. }
        function HasAttribute(const Name: string; Inherit: Boolean = True): Boolean;
        { Read a custom attribute or style property, or return Default if there is
          none. With Inherit a node without one takes it from the nearest node which
          contains it and has one. }
        function Attribute(const Name: string; const Default: string = ''; Inherit: Boolean = True): string;
        { Read a custom attribute as a number }
        function AttributeFloat(const Name: string; Default: Float = 0; Inherit: Boolean = True): Float;
        { The custom attributes and style properties of this node alone }
        property AttributeCount: Integer read GetAttributeCount;
        property AttributeNames[Index: Integer]: string read GetAttributeName;
        property AttributeValues[Index: Integer]: string read GetAttributeValue;
      end;

    See also

    Float in Codebot.System.pas
    INode in Codebot.Text.Xml.pas