Class SvgGraphic

java.lang.Object
org.eclipse.nebula.cwt.svg.SvgElement
org.eclipse.nebula.cwt.svg.SvgGraphic
Direct Known Subclasses:
SvgContainer, SvgShape, SvgUse

public abstract class SvgGraphic
extends SvgElement
A base abstract class for all types of svg elements which can be applied (painted) to a graphics context. These may be shapes which can be painted directly, or containers which will paint their children.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) java.lang.String description  
    (package private) SvgFill fill  
    (package private) SvgStroke stroke  
    (package private) java.lang.String title  
    (package private) SvgTransform transform  
  • Constructor Summary

    Constructors 
    Constructor Description
    SvgGraphic​(SvgContainer container, java.lang.String id)  
  • Method Summary

    Modifier and Type Method Description
    abstract void apply​(org.eclipse.swt.graphics.GC gc)
    Apply this svg graphic to the given graphics context.
    java.lang.String getDescription()
    Returns the value of the desc element that is a child of this svg element.
    (package private) SvgFill getFill()  
    (package private) SvgStroke getStroke()  
    java.lang.String getTitle()
    Returns the value of the title element that is a child of this svg element.
    (package private) org.eclipse.swt.graphics.Transform getTransform​(org.eclipse.swt.graphics.GC gc)  

    Methods inherited from class org.eclipse.nebula.cwt.svg.SvgElement

    getAncestry, getContainer, getElement, getFragment, getId, getViewport, setContainer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • apply

      public abstract void apply​(org.eclipse.swt.graphics.GC gc)
      Apply this svg graphic to the given graphics context.

      Note that to support the rather abstract structure of svg, each time this method is called all transformations and css properties to be calculated and applied. If this is a shape, it will be painted to the graphics context. Containers will recursively make this call on their children.

      Parameters:
      gc - the gc to use in all graphics operations
    • getDescription

      public java.lang.String getDescription()
      Returns the value of the desc element that is a child of this svg element. If there is no desc element that is a direct decendent of this element, null is returned.
      Returns:
      the desc of this svg element
    • getFill

      SvgFill getFill()
    • getStroke

      SvgStroke getStroke()
    • getTransform

      org.eclipse.swt.graphics.Transform getTransform​(org.eclipse.swt.graphics.GC gc)
    • getTitle

      public java.lang.String getTitle()
      Returns the value of the title element that is a child of this svg element. If there is no title element that is a direct decendent of this element, null is returned.
      Returns:
      the title of this svg element