1 package fr.orsay.lri.varna.models.rna;
3 import java.awt.geom.Point2D;
4 import java.awt.geom.Point2D.Double;
5 import java.io.Serializable;
7 import javax.xml.transform.sax.TransformerHandler;
9 import org.xml.sax.SAXException;
10 import org.xml.sax.helpers.AttributesImpl;
12 public class VARNAPoint implements Serializable {
14 private static final long serialVersionUID = 8815373295131046029L;
16 public double x = 0.0;
17 public double y = 0.0;
19 public void toXML(TransformerHandler hd) throws SAXException
25 public static String XML_ELEMENT_NAME = "p";
26 public static String XML_VAR_ROLE_NAME = "r";
27 public static String XML_VAR_X_NAME = "x";
28 public static String XML_VAR_Y_NAME = "y";
30 public void toXML(TransformerHandler hd, String role) throws SAXException
32 AttributesImpl atts = new AttributesImpl();
35 atts.addAttribute("","",XML_VAR_ROLE_NAME,"CDATA",""+role);
37 atts.addAttribute("","",XML_VAR_X_NAME,"CDATA",""+x);
38 atts.addAttribute("","",XML_VAR_Y_NAME,"CDATA",""+y);
39 hd.startElement("","",XML_ELEMENT_NAME,atts);
40 hd.endElement("","",XML_ELEMENT_NAME);
46 public VARNAPoint(double px, double py)
50 public VARNAPoint(Point2D.Double p)
65 public Point2D.Double toPoint2D()
67 return new Point2D.Double(x,y);
70 public String toString()
72 return "("+x+","+y+")" ;