Logo
Distributed Genetic Programming Framework
print print

File org.sfc.xml.formats.SVGWriter.java

Here you can find all the information about the file org.sfc.xml.formats.SVGWriter.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2005 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2005-08-20 19:19:03
 * Original Filename: org.sfc.xml.formats.SVGWriter.java
 * Version          : 1.0.2
 * Last modification: 2006-03-07
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */

 
package org.sfc.xml.formats;

import org.xml.sax.SAXException;

import org.sfc.xml.formats.meta.SVGTag;
import org.sfc.xml.formats.meta.Unit;

/**
 * This class may be used to dynamically create SVGWriter content.
 *
 * @author Thomas Weise
 */

public class SVGWriter extends XMLPropagate
  {
/**
 * The math ml namespace.
 */

  private static  final String  SVG_NS = "http://www.w3.org/2000/svg";
  
/**
 * Create a new math ml processor.
 * @param p_dest  Any given source object that can be converted to a
 *                <code>Writer</code> by the <code>IO</code> class.
 * @throws SAXException  If something goes wrong.
 */
  public  SVGWriter  (final Object p_dest) throws SAXException                 
    {
    this(p_dest, true);
    }
  
/**
 * Create a new math ml processor.
 * @param p_dest  Any given source object that can be converted to a
 *                <code>Writer</code> by the <code>IO</code> class.
 * @param p_is_owner  <code>true</code> if this sax propagate is the sole
 *                    owner of the sax writer, meaning that when the
 *                    propagate starts a document, the sax writer starts a
 *                    document too (and the same goes for ending a
 *                    document).
 * @throws SAXException  If something goes wrong.
 */
  SVGWriter  (final Object     p_dest,
              final boolean    p_is_owner) throws SAXException                 
    {
    super(p_dest, p_is_owner);
    }
  
/**
 * This method must be called to startup the xml production.
 * @param p_width   The width of the svg graphic.
 * @param p_w_unit  The width unit.
 * @param p_height  The height of the svg graphic.
 * @param p_h_unit  The height unit.
 * @throws  SAXException  If something goes sax-like wrong. 
 * @throws  SVGException  If something goes wrong with svg. 
 */
  public  final void  start_document  (final  float   p_width,
                                       final  Unit    p_w_unit,
                                       final  float   p_height,
                                       final  Unit    p_h_unit) 
                        throws SAXException
    {
    if((p_width <= 0.0f) || (p_height <= 0.0f)) throw new SVGException();
    
    start_document();
    
    if(this.is_owner())
      {
      this.start_dtd("svg""-//W3C//DTD SVG 20010904//EN",
             "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd");
      this.end_dtd();
      }
    
    this.start_element(SVG_NS, "svg");
    this.attribute("width",
                   p_width + ((p_w_unit != null) ?
                                    p_w_unit.toString() :
                                    Unit.DEFAULT.toString()));
    this.attribute("height",
                   p_height + ((p_h_unit != null) ?
                                    p_h_unit.toString() :
                                    Unit.DEFAULT.toString()));
    }

/**
 * This method must be called to shutdoen the xml production.
 * @throws  SAXException  If something goes sax-like wrong.  
 */
  @Override
  public  final void  end_document ()  throws SAXException
    {
    this.end_element();
    super.end_document();
    }
  
/**
 * This method will be invoked to begin svg tags.
 * @param p_tag The tag to begin.
 * @throws  SAXException    If something at sax-level fails.
 * @throws  SVGException  If mathml creation failed.
 */
  public final void  tag(final SVGTag p_tag) throws SAXException
    {
    this.start_element(p_tag.toString());
    }
  }

File Information:

file name:SVGWriter.java
package:org.sfc.xml.formats
qualified name:org.sfc.xml.formats.SVGWriter.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/xml/formats/SVGWriter.java
size:4.595 KB (4706 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-03-07 04:20:28 GMT+0000
last access: 2018-04-21 04:07:53 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2018-01-07 12:03:34 GMT+0000 served at 2018-04-21 04:07:53 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo