~ubuntu-branches/debian/squeeze/latexdraw/squeeze

« back to all changes in this revision

Viewing changes to latexDraw/parsers/svg/elements/path/SVGPathSegCurvetoQuadratic.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-05-03 23:49:35 UTC
  • Revision ID: james.westby@ubuntu.com-20090503234935-cls7n48x018g0vk2
Tags: upstream-2.0.2+1
ImportĀ upstreamĀ versionĀ 2.0.2+1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package latexDraw.parsers.svg.elements.path;
 
2
 
 
3
/**
 
4
 * Defines the SVGPath quadratic curveto segment.<br>
 
5
 *<br>
 
6
 * This file is part of LaTeXDraw.<br>
 
7
 * Copyright (c) 2005-2008 Arnaud BLOUIN<br>
 
8
 *<br>
 
9
 *  LaTeXDraw is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.<br>
 
13
 *<br>
 
14
 *  LaTeXDraw is distributed without any warranty; without even the 
 
15
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 
16
 *  PURPOSE. See the GNU General Public License for more details.<br>
 
17
 *<br>
 
18
 * 10/20/07<br>
 
19
 * @author Arnaud BLOUIN<br>
 
20
 * @version 0.1<br>
 
21
 * @since 0.1
 
22
 */
 
23
public class SVGPathSegCurvetoQuadratic extends SVGPathSeg
 
24
{
 
25
        /** The X-coordinate of the second point of the curve. @since 0.1 */
 
26
        protected double x;
 
27
        
 
28
        /** The Y-coordinate of the second point of the curve. @since 0.1 */
 
29
        protected double y;
 
30
        
 
31
        /** The x-coordinate of the first control point. @since 0.1 */
 
32
        protected double x1;
 
33
        
 
34
        /** The y-coordinate of the first control point. @since 0.1 */
 
35
        protected double y1;
 
36
        
 
37
        
 
38
        /**
 
39
         * The main constructor.
 
40
         * @param x The X-coordinate of the second point of the curve.
 
41
         * @param y The Y-coordinate of the second point of the curve.
 
42
         * @param x1 The x-coordinate of the first control point.
 
43
         * @param y1 The y-coordinate of the first control point
 
44
         * @param isRelative isRelative True: the path segment is relative, false it is absolute.
 
45
         */
 
46
        public SVGPathSegCurvetoQuadratic(double x, double y, double x1, double y1, boolean isRelative)
 
47
        {
 
48
                super(isRelative);
 
49
                
 
50
                this.x = x;
 
51
                this.y = y;
 
52
                this.x1 = x1;
 
53
                this.y1 = y1;
 
54
        }
 
55
        
 
56
        
 
57
        
 
58
        @Override
 
59
        public String toString()
 
60
        {
 
61
                StringBuffer stringBuffer = new StringBuffer();
 
62
                
 
63
                stringBuffer.append((isRelative() ? "q" : "Q")); //$NON-NLS-1$ //$NON-NLS-2$
 
64
                stringBuffer.append(' ');
 
65
                stringBuffer.append(x1);
 
66
                stringBuffer.append(' ');
 
67
                stringBuffer.append(y1);
 
68
                stringBuffer.append(' ');
 
69
                stringBuffer.append(x);
 
70
                stringBuffer.append(' ');
 
71
                stringBuffer.append(y);
 
72
                
 
73
                return stringBuffer.toString();
 
74
        }
 
75
        
 
76
        
 
77
        
 
78
        /**
 
79
         * @return the x.
 
80
         * @since 0.1
 
81
         */
 
82
        public double getX()
 
83
        {
 
84
                return x;
 
85
        }
 
86
 
 
87
        
 
88
        /**
 
89
         * @return the y.
 
90
         * @since 0.1
 
91
         */
 
92
        public double getY()
 
93
        {
 
94
                return y;
 
95
        }
 
96
 
 
97
        
 
98
        /**
 
99
         * @return the x1.
 
100
         * @since 0.1
 
101
         */
 
102
        public double getX1()
 
103
        {
 
104
                return x1;
 
105
        }
 
106
 
 
107
        
 
108
        /**
 
109
         * @return the y1.
 
110
         * @since 0.1
 
111
         */
 
112
        public double getY1()
 
113
        {
 
114
                return y1;
 
115
        }
 
116
 
 
117
 
 
118
        @Override
 
119
        public PathSeg getType()
 
120
        {
 
121
                return isRelative() ? PathSeg.CURVETO_QUADRATIC_REL : PathSeg.CURVETO_QUADRATIC_ABS;
 
122
        }
 
123
}