1 package fr.orsay.lri.varna.models.export;
4 import java.awt.Dimension;
7 import java.awt.geom.Ellipse2D;
8 import java.awt.geom.GeneralPath;
9 import java.io.FileWriter;
10 import java.io.IOException;
12 import fr.orsay.lri.varna.exceptions.ExceptionWritingForbidden;
13 import fr.orsay.lri.varna.models.rna.RNA;
15 public class SecStrProducerGraphics implements VueVARNAGraphics{
16 SecStrDrawingProducer _ss;
20 public SecStrProducerGraphics(SecStrDrawingProducer ss)
25 public void draw(GeneralPath s) {
26 _ss.fillPolygon(s, getColor());
29 public void drawArc(double x, double y, double rx, double ry,
30 double angleStart, double angleEnd) {
31 // TODO Auto-generated method stub
35 public void drawLine(double x1, double y1, double x2, double y2) {
36 _ss.drawLine(x1, -y1, x2, -y2, _thickness);
39 public void drawCircle(double x, double y, double r) {
40 _ss.drawCircle(x+0.5*r, -y-0.5*r, 0.5*r, _thickness);
43 public void drawRect(double x, double y, double w, double h) {
44 // TODO Auto-generated method stub
48 public void drawRoundRect(double x, double y, double w, double h,
49 double rx, double ry) {
50 // TODO Auto-generated method stub
54 public void drawStringCentered(String res, double x, double y) {
55 _ss.drawText(x, -y, res);
58 public void fill(GeneralPath s) {
59 _ss.fillPolygon(s, getColor());
62 public void fillCircle(double x, double y, double r) {
63 _ss.fillCircle(x+0.5*r, -y-0.5*r, 0.5*r, _thickness, _ss.getCurrentColor());
66 public void fillRect(double x, double y, double w, double h) {
67 // TODO Auto-generated method stub
71 public void fillRoundRect(double x, double y, double w, double h,
72 double rx, double ry) {
73 // TODO Auto-generated method stub
76 public Color getColor() {
77 return _ss.getCurrentColor();
80 public Dimension getStringDimension(String s) {
81 // TODO Auto-generated method stub
85 public void setColor(Color c) {
89 public void setSelectionStroke() {
90 // TODO Auto-generated method stub
94 public void setFont(Font f) {
95 //System.out.println("Font "+f.getSize2D());
96 _ss.setFont(_ss.FONT_HELVETICA_BOLD,f.getSize2D());
99 public void setPlainStroke() {
100 // TODO Auto-generated method stub
104 public void setStrokeThickness(double t) {
108 public void saveToDisk(String path) throws ExceptionWritingForbidden
112 fout = new FileWriter(path);
113 fout.write(_ss.export());
115 } catch (IOException e) {
116 throw new ExceptionWritingForbidden(e.getMessage());