Source code: jpicedt/format/latex/parser/PicBezierExpression.java
1 /* jPicEdt version 1.3.2, a picture editor for LaTeX.
2 Copyright (C) 1999-2002 Sylvain Reynal
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 Sylvain Reynal
19 Département de Physique
20 Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA)
21 6, avenue du Ponceau
22 95014 CERGY CEDEX
23 FRANCE
24
25 Tel : 00 +33 130 736 245
26 Fax : 00 +33 130 736 667
27 e-mail : reynal@ensea.fr
28 jPicEdt web page : http://www.jpicedt.org
29 */
30
31 package jpicedt.format.latex.parser;
32
33 import jpicedt.graphic.io.parser.*;
34 import jpicedt.graphic.model.*;
35
36 /**
37 * Rules for parsing quad curves with a PicEdt syntax :
38 *
39 * PicBezier :
40 * %Bezier 0|1 0|1 (x1,y1)(xC,yC)(x2,y2) dash=value
41 * Any string
42 * %End Bezier
43 * dash is optional. The whole expression MUST hold on a single line (as opposed to LaTeX or eepic commands)
44 */
45 public class PicBezierExpression extends SequenceExpression implements ExpressionConstants {
46
47 public PicBezierExpression(Pool pool){
48
49 super(true); // throw IncompleteSequence Exception
50 add(new LaTeXInstanciationExpression("%Bezier", new PicBezierQuad(),pool));
51 add(WHITE_SPACES);
52 add(new PicArrowTypeExpression(pool));
53 add(new LaTeXPicPointExpression(PicBezierQuad.P_1,pool));
54 add(WHITE_SPACES);
55 add(new LaTeXPicPointExpression(PicBezierQuad.P_CTRL,pool));
56 add(WHITE_SPACES);
57 add(new LaTeXPicPointExpression(PicBezierQuad.P_2,pool));
58 add(WHITE_SPACES);
59 add(new OptionalExpression(new PicDashStatement(pool)));
60 add(new PicEndExpression("%End Bezier"));
61 }
62
63 public String toString(){
64 return "[PicBezierExpression]";
65 }
66
67 } // PicBezierExpression