net.sf.latexdraw.parsers.svg
Class SVGLineElement

java.lang.Object
  extended by net.sf.latexdraw.parsers.svg.SVGElement
      extended by net.sf.latexdraw.parsers.svg.SVGLineElement
All Implemented Interfaces:
java.lang.Cloneable, org.w3c.dom.Element, org.w3c.dom.Node

public class SVGLineElement
extends SVGElement

Defines the SVG tag line.

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.

10/11/07

Since:
0.1
Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
 
Fields inherited from class net.sf.latexdraw.parsers.svg.SVGElement
attributes, children, name, ownerDocument, parent, stylesCSS, transform
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
SVGLineElement(double x1, double y1, double x2, double y2, SVGDocument owner)
          Creates an SVGLine.
SVGLineElement(org.w3c.dom.Node n, SVGElement p)
          SVGElement.SVGElement(Node, SVGElement)
SVGLineElement(SVGDocument doc)
          Creates an SVG line (0,0 ; 0,0)
 
Method Summary
 boolean checkAttributes()
          Check if the SVG element is valid according to the SVG specification.
 boolean enableRendering()
          According to the SVG specification, some attributes may lead to disables rendering of the element (e.g. width=0, height=0,...).
 double getX1()
           
 double getX2()
           
 double getY1()
           
 double getY2()
           
 void setX1(double x1)
          Sets the first X-coordinate of the line.
 void setX2(double x2)
          Sets the second X-coordinate of the line.
 void setY1(double y1)
          Sets the first Y-coordinate of the line.
 void setY2(double y2)
          Sets the second Y-coordinate of the line.
 
Methods inherited from class net.sf.latexdraw.parsers.svg.SVGElement
appendChild, cloneNode, compareDocumentPosition, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getChildNodes, getChildren, getDef, getElementsByTagName, getElementsByTagNameNS, getFeature, getFill, getFirstChild, getFontFamily, getFontSize, getFontStyle, getFontWeight, getId, getLastChild, getLocalName, getNamespaceURI, getNbChildren, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getRootElement, getSchemaTypeInfo, getStroke, getStrokeDasharray, getStrokeLinecap, getStrokeLinejoin, getStrokeMiterlimit, getStrokeWidth, getStylesCSS, getSVGAttribute, getSVGRoot, getTagName, getTextContent, getTransform, getUsablePrefix, getUsablePrefix, getUserData, getWholeTransform, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, lookupPrefixUsable, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setAttributes, setFill, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeName, setNodeValue, setOwnerDocument, setParent, setPrefix, setStroke, setStrokeDashArray, setStrokeDashOffset, setStrokeLineCap, setStrokeLineJoin, setStrokeMiterLevel, setStrokeWidth, setTextContent, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SVGLineElement

public SVGLineElement(org.w3c.dom.Node n,
                      SVGElement p)
               throws MalformedSVGDocument
SVGElement.SVGElement(Node, SVGElement)

Throws:
MalformedSVGDocument

SVGLineElement

public SVGLineElement(double x1,
                      double y1,
                      double x2,
                      double y2,
                      SVGDocument owner)
               throws MalformedSVGDocument
Creates an SVGLine.

Parameters:
owner - The owner document.
x1 - The X-coordinate of the first point of the line.
x2 - The X-coordinate of the second point of the line.
y1 - The Y-coordinate of the first point of the line.
y2 - The Y-coordinate of the second point of the line.
Throws:
MalformedSVGDocument - If the given coordinates are not valid.
Since:
0.1

SVGLineElement

public SVGLineElement(SVGDocument doc)
Creates an SVG line (0,0 ; 0,0)

Parameters:
doc - The owner document.
Since:
0.1
Method Detail

getX1

public double getX1()
Returns:
The x-axis coordinate of the start of the line (0 if there it does not exist or it is not a length).
Since:
0.1

getY1

public double getY1()
Returns:
The y-axis coordinate of the start of the line (0 if there it does not exist or it is not a length).
Since:
0.1

getX2

public double getX2()
Returns:
The x-axis coordinate of the end of the line (0 if there it does not exist or it is not a length).
Since:
0.1

getY2

public double getY2()
Returns:
The y-axis coordinate of the end of the line (0 if there it does not exist or it is not a length).
Since:
0.1

setX1

public void setX1(double x1)
Sets the first X-coordinate of the line.

Parameters:
x1 - The first X-coordinate of the line.
Since:
2.0.0

setX2

public void setX2(double x2)
Sets the second X-coordinate of the line.

Parameters:
x2 - The second X-coordinate of the line.
Since:
2.0.0

setY1

public void setY1(double y1)
Sets the first Y-coordinate of the line.

Parameters:
y1 - The first Y-coordinate of the line.
Since:
2.0.0

setY2

public void setY2(double y2)
Sets the second Y-coordinate of the line.

Parameters:
y2 - The second Y-coordinate of the line.
Since:
2.0.0

checkAttributes

public boolean checkAttributes()
Description copied from class: SVGElement
Check if the SVG element is valid according to the SVG specification.

Specified by:
checkAttributes in class SVGElement
Returns:
True if valid.

enableRendering

public boolean enableRendering()
Description copied from class: SVGElement
According to the SVG specification, some attributes may lead to disables rendering of the element (e.g. width=0, height=0,...). This method checks these conditions depending of the SVG element.

Specified by:
enableRendering in class SVGElement
Returns:
True if the element can be rendered.