public final class SVGUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SVGUtils.SplitConsumer
This interface allows that
split(String, List, SplitConsumer) to consume data an indicate whether to further add new characters or consume the currentData. |
| Modifier and Type | Method and Description |
|---|---|
static <TShape extends javafx.scene.shape.Shape> |
applyStyle(TShape shape,
SVGCssStyle style,
SVGDataProvider dataProvider)
Applies the basic style every
Shape supports to the given shape. |
static void |
combineStylesAndResolveInheritance(SVGCssStyle style,
SVGCssStyle otherStyle)
This method will use the properties of the given style, if any property uses inheritance, the given otherStyle will be used to resolve it.
|
static javafx.scene.transform.Transform |
getTransform(String data)
Returns the combined transformations available in the given string.
|
static javafx.scene.transform.Transform |
getTransform(SVGElementBase.Matrix matrix,
String data,
boolean checkIfStartWithMatrix)
Gets the
Transform that is represented by the given data. |
static javafx.scene.paint.Paint |
parseColor(String data,
SVGDataProvider dataProvider)
Resolves the given data into a paint.
|
static <TSVGElementBase extends SVGElementBase<?>> |
resolveIRI(String data,
SVGDataProvider dataProvider,
Class<TSVGElementBase> clazz)
Returns the element which might be referenced by the given data.
|
static List<String> |
split(String toSplit,
List<Character> delimiters,
SVGUtils.SplitConsumer dataConsumer)
This method will iterate through the given toSplit and call the dataConsumer
Function when the current character in toSplit is contained in the delimiters. |
static String |
stripIRIIdentifiers(String data)
Strips the given
String from the IRI identifiers if any. |
public static String stripIRIIdentifiers(String data) throws IllegalArgumentException
String from the IRI identifiers if any.data - the String to be stripped, must not be null or empty.IllegalArgumentException - if data is null or empty.public static <TSVGElementBase extends SVGElementBase<?>> TSVGElementBase resolveIRI(String data, SVGDataProvider dataProvider, Class<TSVGElementBase> clazz) throws SVGException, IllegalArgumentException
Constants.IRI_IDENTIFIER in order to be
resolved as a reference.TSVGElementBase - the type of element which is expected.data - the string which contains the reference to resolve.dataProvider - the SVGDataProvider which contains the data which is referenced.clazz - the class of the element that is expected.SVGElementBase which is referenced by the data or null if the data does not reference an element.SVGException - if the data references a resource which is not contained in the SVGDataProvider.IllegalArgumentException - if either the data is null or empty, the dataProvider is null or the clazz is null.public static javafx.scene.paint.Paint parseColor(String data, SVGDataProvider dataProvider) throws SVGException, IllegalArgumentException
data - data to be resolveddataProvider - the SVGDataProvider to be used, must not be nullPaint which represents the colorSVGException - if the data references another element which is not found in the given data dataProvider.IllegalArgumentException - if the the data is empty, the dataProvider is null.public static <TShape extends javafx.scene.shape.Shape> void applyStyle(TShape shape,
SVGCssStyle style,
SVGDataProvider dataProvider)
throws IllegalArgumentException
Shape supports to the given shape.TShape - type of the shape to be usedshape - Shape to which the the styles should be applied, must not be nullstyle - SVGCssStyle to use, must not be nulldataProvider - the SVGDataProvider to be usedIllegalArgumentException - if either shape or style is nullpublic static void combineStylesAndResolveInheritance(SVGCssStyle style, SVGCssStyle otherStyle) throws IllegalArgumentException
style - SVGCssStyle which contains the properties which are to be set, must not be null.otherStyle - the SVGCssStyle to use as a parent in order to resolve the inheritance, must not be null.IllegalArgumentException - if either style or inheritanceResolver are null.public static javafx.scene.transform.Transform getTransform(String data) throws SVGException
data - the string which contains the transformation data.SVGException - if there is an error in the transformation data of the given string.public static javafx.scene.transform.Transform getTransform(SVGElementBase.Matrix matrix, String data, boolean checkIfStartWithMatrix) throws SVGException
Transform that is represented by the given data. The data must meet the following requirements.
Data can start with the name of the provide SVGElementBase.Matrix, in which case checkIfStartWithMatrix must be true,
otherwise an exception will occur when the actual data is processed.
Data must contain the values separated with a coma (e.g. 1,2,3). Optionally the values can be embraces with ().matrix - the matrix to usedata - the data to be used, must not be null or empty or SVGElementBase.Matrix#NONE.checkIfStartWithMatrix - determines if the given data is to be checked if it starts with the SVGElementBase.Matrix#nameTransform which contains the transformation represented by the data.IllegalArgumentException - if the given data is empty or matrix is SVGElementBase.Matrix#NONE.SVGException - if there is an error in the transformation data of the given string.public static List<String> split(String toSplit, List<Character> delimiters, SVGUtils.SplitConsumer dataConsumer) throws SVGException, IllegalArgumentException
Function when the current character in toSplit is contained in the delimiters.
The String passed to the dataConsumer will contain all the characters read in the String that are NOT considered delimiters. When the dataConsumer returns true, the passed
String will be added to the list of results. A new call to the dataConsumer will then contain a new String.toSplit - the String which is to be parsed, must not be null or empty.delimiters - the characters which indicate a delimiter in the toSplit, must not be null or empty.dataConsumer - the Function to be called when a character that is a delimiter is read, must not be null.Strings which are between the delimiters of the toSplit if any or an empty list.SVGException - is rethrown by the dataConsumerIllegalArgumentException - if either toSplit, delimiter or dataConsumer are null or empty.Copyright © 2016 Saxonia Systems AG. All rights reserved.