|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.latexdraw.generators.svg.LShapeSVGGenerator<S>
abstract class LShapeSVGGenerator<S extends IShape>
This class allows the generation or the importation of SVG parameters to a general LaTeXDraw shape.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
05/30/10
Field Summary | |
---|---|
protected S |
shape
The shape model use for the generation. |
protected static java.lang.String |
SVG_URL_TOKEN_BEGIN
The beginning of the token used to declare a URL in an SVG document. |
Constructor Summary | |
---|---|
protected |
LShapeSVGGenerator(S sh)
Creates the SVG generator. |
Method Summary | |
---|---|
void |
applyTransformation(SVGTransform t)
Applies an SVG transformation on the shape. |
void |
applyTransformations(SVGElement elt)
Applies the set of transformations that concerned the given SVG element to the shape. |
protected void |
getGradientPoints(java.awt.geom.Point2D.Float p1,
java.awt.geom.Point2D.Float p2,
boolean ignoreMidPt)
Gets the points needed to the gradient definition. |
protected SVGElement |
getLaTeXDrawElement(SVGGElement elt,
java.lang.String type)
|
protected double |
getPositionGap()
If a figure can move its border, we have to compute the difference between the PSTricks shape and the SVG shape. |
S |
getShape()
|
protected static SVGCircleElement |
getShowPointsDot(SVGDocument doc,
double rad,
IPoint pt,
java.awt.Color col)
Creates an SVG circle that represents a dot for the option 'show points'. |
protected static SVGLineElement |
getShowPointsLine(SVGDocument doc,
double thickness,
java.awt.Color col,
IPoint p1,
IPoint p2,
double blackDash,
double whiteDash,
boolean hasDble,
double dotSep,
double doubleSep)
Creates a line with the style of the 'show points' option. |
SVGPathSegList |
getSVGHatchingsPath()
|
private void |
getSVGHatchingsPath2(SVGPathSegList path,
double hAngle,
IRectangle bound)
|
java.lang.String |
getSVGID()
|
protected void |
homogeniseArrowFrom(IArrow source,
IArrow target)
Copies the parameters of the first arrow to the second arrow (only the parameters of the current style are copied). |
void |
homogeniseArrows(IArrow ah1,
IArrow ah2)
When the arrows are read from an SVG document, we need to set the parameters of the first arrow to the second arrow and vise et versa; because the arrows of a shape share the same parameters. |
static void |
setDashedDotted(org.w3c.dom.Element elt,
double blackDash,
double whiteDash,
double dotSep,
java.lang.String lineStyle,
boolean hasDoubleBorders,
double thickness,
double doubleSep)
Sets the line style to the given SVG element. |
static void |
setDashedDotted(IShape shape,
java.lang.String dashArray,
java.lang.String linecap)
Sets the figure properties concerning the line properties. |
static void |
setFill(IShape shape,
java.lang.String fill,
SVGDefsElement defs)
Sets the fill properties to the given figure. |
static void |
setLineColour(IShape shape,
java.lang.String stoke)
Sets the colour of the line of the shape with the given SVG stroke. |
void |
setNumber(SVGGElement g)
Sets the ID of the figure according to the ID attribute of the SVGGElement, or an increment of meter if a problem occur. |
protected void |
setSVGArrow(IArrow ah,
java.lang.String arrowID,
SVGElement elt)
Sets the given arrow head using the SVG arrow with the ID arrowID |
protected void |
setSVGArrow(SVGElement parent,
int arrowPos,
boolean isShadow,
SVGDocument doc,
SVGDefsElement defs)
|
protected void |
setSVGAttributes(SVGDocument doc,
SVGElement root,
boolean shadowFills)
Sets the SVG attribute of the current figure. |
protected void |
setSVGBorderBackground(SVGElement elt,
SVGElement root)
When a shape has a shadow and is filled, the background of its borders must be filled with the colour of the interior of the shape. |
protected void |
setSVGDbleBordersParameters(SVGElement elt)
Sets the double borders parameters of the figure by using an SVG element. |
protected void |
setSVGDoubleBordersAttributes(org.w3c.dom.Element elt)
Sets the double borders parameters to the given SVG element if the current figure has double borders. |
protected void |
setSVGLatexdrawParameters(SVGElement elt)
|
protected void |
setSVGParameters(SVGElement elt)
Sets the global parameters of the figure by using an SVG element. |
protected void |
setSVGRotationAttribute(org.w3c.dom.Element elt)
|
protected void |
setSVGShadowAttributes(org.w3c.dom.Element elt,
boolean shadowFills)
|
protected void |
setSVGShadowParameters(SVGElement elt)
Sets the shadow parameters of the figure by using an SVG element having "type:shadow". |
static void |
setThickness(IShape shape,
java.lang.String strokeWidth,
java.lang.String stroke)
Sets the thickness of the given figure with the given SVG stroke-width. |
static void |
setThickness(SVGElement elt,
double thickness,
boolean hasDoubleBorders,
double doubleSep)
Sets the given thickness to the given SVG element. |
abstract SVGElement |
toSVG(SVGDocument doc)
Creates an SVG element from the current latexdraw shape. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected S extends IShape shape
protected static final java.lang.String SVG_URL_TOKEN_BEGIN
Constructor Detail |
---|
protected LShapeSVGGenerator(S sh)
sh
- The shape used for the generation.
java.lang.IllegalArgumentException
- If the given shape is null.Method Detail |
---|
public java.lang.String getSVGID()
public void setNumber(SVGGElement g)
g
- The SVGGElement.public void applyTransformations(SVGElement elt)
elt
- The element that contains the SVG transformation list.public void applyTransformation(SVGTransform t)
t
- The SVG transformation to apply.public void homogeniseArrows(IArrow ah1, IArrow ah2)
ah1
- The first arrow.ah2
- The second arrow.protected void setSVGArrow(SVGElement parent, int arrowPos, boolean isShadow, SVGDocument doc, SVGDefsElement defs)
protected void homogeniseArrowFrom(IArrow source, IArrow target)
source
- The arrow that will be copied.target
- The arrow that will be set.homogeniseArrows(IArrow, IArrow)
protected void setSVGShadowParameters(SVGElement elt)
elt
- The source element.protected void setSVGDbleBordersParameters(SVGElement elt)
elt
- The SVG element.protected void setSVGLatexdrawParameters(SVGElement elt)
protected void setSVGParameters(SVGElement elt)
elt
- The SVG element.protected void setSVGArrow(IArrow ah, java.lang.String arrowID, SVGElement elt)
ah
- The arrow head to set.arrowID
- The SVG ID of the SVG arrow head.elt
- An element of the SVG document (useful to get the defs of the document).protected SVGElement getLaTeXDrawElement(SVGGElement elt, java.lang.String type)
elt
- The source g
element.type
- The type of the latexdraw element (double borders, shadow, main), if null, the main element is returned.
public static void setThickness(IShape shape, java.lang.String strokeWidth, java.lang.String stroke)
shape
- The figure to set.strokeWidth
- The SVG stroke-width to convert.stroke
- The stroke.public abstract SVGElement toSVG(SVGDocument doc)
doc
- The SVG document.
protected void setSVGRotationAttribute(org.w3c.dom.Element elt)
elt
- Rotates the SVG element.
java.lang.IllegalArgumentException
- If elt is null.protected void setSVGDoubleBordersAttributes(org.w3c.dom.Element elt)
elt
- The element to set.
java.lang.IllegalArgumentException
- If elt is null.protected void setSVGShadowAttributes(org.w3c.dom.Element elt, boolean shadowFills)
elt
- The element to set if the current figure has a shadow.shadowFills
- True if a shadow must fill the figure.
java.lang.IllegalArgumentException
- If elt is null.protected void setSVGAttributes(SVGDocument doc, SVGElement root, boolean shadowFills)
doc
- The original document with which, all the elements will be created.root
- The root element of the document.shadowFills
- True if a shadow must fill the figure.
java.lang.IllegalArgumentException
- If the root or the "defs" part of the document is null.public SVGPathSegList getSVGHatchingsPath()
private void getSVGHatchingsPath2(SVGPathSegList path, double hAngle, IRectangle bound)
getSVGHatchingsPath()
protected void getGradientPoints(java.awt.geom.Point2D.Float p1, java.awt.geom.Point2D.Float p2, boolean ignoreMidPt)
p1
- The first point to set.p2
- The second point to set.ignoreMidPt
- True, gradientMidPt will be ignored.
java.lang.IllegalArgumentException
- If p1 or p2 is null.public static void setLineColour(IShape shape, java.lang.String stoke)
shape
- The shape to set.stoke
- The stroke of the shape.public static void setFill(IShape shape, java.lang.String fill, SVGDefsElement defs)
shape
- The figure to set.fill
- The fill propertiesdefs
- The definition that may be useful to the the fill properties (url), may be null.public static void setDashedDotted(IShape shape, java.lang.String dashArray, java.lang.String linecap)
shape
- The figure to set.dashArray
- The dash array SVG property.linecap
- The line cap SVG property.public static void setThickness(SVGElement elt, double thickness, boolean hasDoubleBorders, double doubleSep)
elt
- The element to set.thickness
- The thickness to set.hasDoubleBorders
- True: the shape has double borders and it must be considered during the computation of the thickness.doubleSep
- The size of the double borders.public static void setDashedDotted(org.w3c.dom.Element elt, double blackDash, double whiteDash, double dotSep, java.lang.String lineStyle, boolean hasDoubleBorders, double thickness, double doubleSep)
elt
- The element to set.blackDash
- The black dash of the line for dashed line style.whiteDash
- The white dash of the line for dashed line style.dotSep
- The separation between dots for dotted line style.lineStyle
- The line style to set to the SVG element.hasDoubleBorders
- True: the shape has double borders.thickness
- The thickness to set to the element.doubleSep
- The size of the double borders.protected double getPositionGap()
protected static SVGLineElement getShowPointsLine(SVGDocument doc, double thickness, java.awt.Color col, IPoint p1, IPoint p2, double blackDash, double whiteDash, boolean hasDble, double dotSep, double doubleSep)
doc
- The document owner.thickness
- The thickness of the line to create.col
- The colour of the line.p1
- The first point of the line.p2
- The second point of the line.blackDash
- The black dash interval.whiteDash
- The white dash interval.hasDble
- Defines if the shape had double borders.dotSep
- The dot interval.
protected void setSVGBorderBackground(SVGElement elt, SVGElement root)
elt
- The element that will be set to define the background of the borders.root
- The root element to which 'elt' will be appended.protected static SVGCircleElement getShowPointsDot(SVGDocument doc, double rad, IPoint pt, java.awt.Color col)
doc
- The document owner.rad
- The radius of the circle.pt
- The position of the point.col
- The colour of the dot.
public S getShape()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |