Package org.eclipse.nebula.cwt.svg
Class SvgShape
- java.lang.Object
-
- org.eclipse.nebula.cwt.svg.SvgElement
-
- org.eclipse.nebula.cwt.svg.SvgGraphic
-
- org.eclipse.nebula.cwt.svg.SvgShape
-
public class SvgShape extends SvgGraphic
An SvgShape is a graphical svg element which can be directly applied to a given graphics context.
Shapes consist of:- circle
- ellipse
- line
- polygon
- polyline
- rectangle
- path
See also: http://www.w3.org/TR/SVG/shapes.html
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.graphics.Path
path
(package private) org.eclipse.swt.graphics.PathData
pathData
-
Fields inherited from class org.eclipse.nebula.cwt.svg.SvgGraphic
description, fill, stroke, title, transform
-
-
Constructor Summary
Constructors Constructor Description SvgShape(SvgContainer container, java.lang.String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(org.eclipse.swt.graphics.GC gc)
Apply this svg graphic to the given graphics context.boolean
contains(float x, float y, org.eclipse.swt.graphics.GC gc, boolean outline)
Returns whether or not the given point is contained by this shape.private void
doApply(org.eclipse.swt.graphics.GC gc)
private void
doFill(org.eclipse.swt.graphics.GC gc)
private void
doStroke(org.eclipse.swt.graphics.GC gc)
(package private) float[]
getBounds()
private int
getRadiusX()
private int
getRadiusY()
-
Methods inherited from class org.eclipse.nebula.cwt.svg.SvgGraphic
getDescription, getFill, getStroke, getTitle, getTransform
-
Methods inherited from class org.eclipse.nebula.cwt.svg.SvgElement
getAncestry, getContainer, getElement, getFragment, getId, getViewport, setContainer
-
-
-
-
Constructor Detail
-
SvgShape
SvgShape(SvgContainer container, java.lang.String id)
-
-
Method Detail
-
doApply
private void doApply(org.eclipse.swt.graphics.GC gc)
-
apply
public void apply(org.eclipse.swt.graphics.GC gc)
Description copied from class:SvgGraphic
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.
- Specified by:
apply
in classSvgGraphic
- Parameters:
gc
- the gc to use in all graphics operations
-
contains
public boolean contains(float x, float y, org.eclipse.swt.graphics.GC gc, boolean outline)
Returns whether or not the given point is contained by this shape.- Parameters:
x
-y
-gc
-outline
-- Returns:
- true if the given point is contained, false otherwise
- See Also:
Path.contains(float, float, GC, boolean)
-
doFill
private void doFill(org.eclipse.swt.graphics.GC gc)
-
doStroke
private void doStroke(org.eclipse.swt.graphics.GC gc)
-
getBounds
float[] getBounds()
-
getRadiusX
private int getRadiusX()
-
getRadiusY
private int getRadiusY()
-
-