Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: MODIFIED: persistence ...

gef
Discussion topic

Back to topic list

CVS update: MODIFIED: persistence ...

Reply

Author toby
Full name Toby Baier
Date 2001-11-18 23:13:33 PST
Message User: toby
  Date: 01/11/18 23:13:33

  Modified: src/org/tigris/gef/persistence SVGWriter.java
  Log:
  fixed ellipses
  Obtained from:Andreas
  Submitted by:Toby
  
  Revision Changes Path
  1.7 +14 -11 gef/src/org/tigris/g​ef/persistence/SVGWr​iter.java
  
  http://gef.tigris.or​g/source/browse/gef/​src/org/tigris/gef/p​ersistence/SVGWriter​.java.diff?r1=1.6​&r2=1.7
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SVGWriter.java
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/gef/src/org/tigri​s/gef/persistence/SV​GWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- SVGWriter.java 2001/06/18 08:33:56 1.6
  +++ SVGWriter.java 2001/11/19 07:13:33 1.7
  @@ -24,7 +24,7 @@
   // File: SVGWriter.java
   // Classes: SVGWriter
   // Original Author: Andreas Rueckert <a_rueckert at gmx dot net>
  -// $Id: SVGWriter.java,v 1.6 2001/06/18 08:33:56 toby Exp $
  +// $Id: SVGWriter.java,v 1.7 2001/11/19 07:13:33 toby Exp $
   
   package org.tigris.gef.persistence;
   
  @@ -69,8 +69,10 @@
   
       // To keep the SVG output as simple as possible, I handle all
       // the transformations and the scaling in the writer.
  - private int xOffset = 0;
  - private int yOffset = 0;
  + private int _xOffset = 0;
  + private int _yOffset = 0;
  + private int _hInset = 10;
  + private int _vInset = 10;
       private double xScale = 1.0;
       private double yScale = 1.0;
       private String SVGns = "http://www.w3.org/2000/SVG";
  @@ -78,6 +80,7 @@
       public SVGWriter(OutputStream stream, Rectangle drawingArea) throws IOException, Exception {
           _p = new PrintWriter(stream);
       _drawingArea = drawingArea;
  + translate( _hInset - drawingArea.x, _vInset - drawingArea.y);
   
           DocumentBuilderFactory factory = DocumentBuilderFacto​ry.newInstance();
           factory.setNamespace​Aware(false);
  @@ -87,8 +90,8 @@
   
       _root = _svg.createElement( "svg");
           _root.setAttribute("xmlns","http://www.w3.org/2000/svg");
  - _root.setAttribute( "width", "" + scaleX(_drawingArea.width));
  - _root.setAttribute( "height", "" + scaleY(_drawingArea.height));
  + _root.setAttribute( "width", "" + (2 * _hInset + scaleX(_drawingArea.width)));
  + _root.setAttribute( "height", "" + (2 * _vInset + scaleY(_drawingArea.height)));
       }
   
       public Graphics create() { return this; }
  @@ -430,11 +433,11 @@
       }
   
       private int transformX( int x) {
  - return scaleX( x) + xOffset;
  + return scaleX( x) + _xOffset;
       }
   
       private int transformY( int y) {
  - return scaleY( y) + yOffset;
  + return scaleY( y) + _yOffset;
       }
   
       private void drawRect( int x, int y, int w, int h, String style) {
  @@ -473,8 +476,8 @@
   
       private void drawOval( int x, int y, int w, int h, String style) {
       Element oval = _svg.createElement( "ellipse");
  - oval.setAttribute( "cx", ""+transformX( x));
  - oval.setAttribute( "cy", ""+transformY( y));
  + oval.setAttribute( "cx", ""+transformX( x + w/2));
  + oval.setAttribute( "cy", ""+transformY( y + h/2));
       oval.setAttribute( "rx", ""+((double)scaleX( w))/2);
       oval.setAttribute( "ry", ""+((double)scaleY( h))/2);
       oval.setAttribute( "style", style);
  @@ -625,8 +628,8 @@
       }
   
       public void translate(int x, int y) {
  - this.xOffset = x;
  - this.yOffset = y;
  + this._xOffset = x;
  + this._yOffset = y;
       }
   
       public void scale(double xscale, double yscale) {
  
  
  

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe at gef dot tigris dot org
For additional commands, e-mail: cvs-help at gef dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: MODIFIED: persistence ... toby Toby Baier 2001-11-18 23:13:33 PST
Messages per page: