forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathHandler.java
More file actions
254 lines (229 loc) · 10.3 KB
/
PathHandler.java
File metadata and controls
254 lines (229 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.mxgraph.util.svg;
/**
* This interface must be implemented and then registred as the
* handler of a <code>PathParser</code> instance in order to be
* notified of parsing events.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
*/
public interface PathHandler
{
/**
* Invoked when the path starts.
* @exception ParseException if an error occured while processing the path
*/
void startPath() throws ParseException;
/**
* Invoked when the path ends.
* @exception ParseException if an error occured while processing the path
*/
void endPath() throws ParseException;
/**
* Invoked when a relative moveto command has been parsed.
* <p>Command : <b>m</b>
* @param x the relative x coordinate for the end point
* @param y the relative y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void movetoRel(float x, float y) throws ParseException;
/**
* Invoked when an absolute moveto command has been parsed.
* <p>Command : <b>M</b>
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void movetoAbs(float x, float y) throws ParseException;
/**
* Invoked when a closepath has been parsed.
* <p>Command : <b>z</b> | <b>Z</b>
* @exception ParseException if an error occured while processing the path
*/
void closePath() throws ParseException;
/**
* Invoked when a relative line command has been parsed.
* <p>Command : <b>l</b>
* @param x the relative x coordinates for the end point
* @param y the relative y coordinates for the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoRel(float x, float y) throws ParseException;
/**
* Invoked when an absolute line command has been parsed.
* <p>Command : <b>L</b>
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoAbs(float x, float y) throws ParseException;
/**
* Invoked when an horizontal relative line command has been parsed.
* <p>Command : <b>h</b>
* @param x the relative X coordinate of the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoHorizontalRel(float x) throws ParseException;
/**
* Invoked when an horizontal absolute line command has been parsed.
* <p>Command : <b>H</b>
* @param x the absolute X coordinate of the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoHorizontalAbs(float x) throws ParseException;
/**
* Invoked when a vertical relative line command has been parsed.
* <p>Command : <b>v</b>
* @param y the relative Y coordinate of the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoVerticalRel(float y) throws ParseException;
/**
* Invoked when a vertical absolute line command has been parsed.
* <p>Command : <b>V</b>
* @param y the absolute Y coordinate of the end point
* @exception ParseException if an error occured while processing the path
*/
void linetoVerticalAbs(float y) throws ParseException;
/**
* Invoked when a relative cubic bezier curve command has been parsed.
* <p>Command : <b>c</b>
* @param x1 the relative x coordinate for the first control point
* @param y1 the relative y coordinate for the first control point
* @param x2 the relative x coordinate for the second control point
* @param y2 the relative y coordinate for the second control point
* @param x the relative x coordinate for the end point
* @param y the relative y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoCubicRel(float x1, float y1, float x2, float y2, float x,
float y) throws ParseException;
/**
* Invoked when an absolute cubic bezier curve command has been parsed.
* <p>Command : <b>C</b>
* @param x1 the absolute x coordinate for the first control point
* @param y1 the absolute y coordinate for the first control point
* @param x2 the absolute x coordinate for the second control point
* @param y2 the absolute y coordinate for the second control point
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x,
float y) throws ParseException;
/**
* Invoked when a relative smooth cubic bezier curve command has
* been parsed. The first control point is assumed to be the
* reflection of the second control point on the previous command
* relative to the current point.
* <p>Command : <b>s</b>
* @param x2 the relative x coordinate for the second control point
* @param y2 the relative y coordinate for the second control point
* @param x the relative x coordinate for the end point
* @param y the relative y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoCubicSmoothRel(float x2, float y2, float x, float y)
throws ParseException;
/**
* Invoked when an absolute smooth cubic bezier curve command has
* been parsed. The first control point is assumed to be the
* reflection of the second control point on the previous command
* relative to the current point.
* <p>Command : <b>S</b>
* @param x2 the absolute x coordinate for the second control point
* @param y2 the absolute y coordinate for the second control point
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoCubicSmoothAbs(float x2, float y2, float x, float y)
throws ParseException;
/**
* Invoked when a relative quadratic bezier curve command has been parsed.
* <p>Command : <b>q</b>
* @param x1 the relative x coordinate for the control point
* @param y1 the relative y coordinate for the control point
* @param x the relative x coordinate for the end point
* @param y the relative x coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoQuadraticRel(float x1, float y1, float x, float y)
throws ParseException;
/**
* Invoked when an absolute quadratic bezier curve command has been parsed.
* <p>Command : <b>Q</b>
* @param x1 the absolute x coordinate for the control point
* @param y1 the absolute y coordinate for the control point
* @param x the absolute x coordinate for the end point
* @param y the absolute x coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoQuadraticAbs(float x1, float y1, float x, float y)
throws ParseException;
/**
* Invoked when a relative smooth quadratic bezier curve command
* has been parsed. The control point is assumed to be the
* reflection of the control point on the previous command
* relative to the current point.
* <p>Command : <b>t</b>
* @param x the relative x coordinate for the end point
* @param y the relative y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoQuadraticSmoothRel(float x, float y) throws ParseException;
/**
* Invoked when an absolute smooth quadratic bezier curve command
* has been parsed. The control point is assumed to be the
* reflection of the control point on the previous command
* relative to the current point.
* <p>Command : <b>T</b>
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException;
/**
* Invoked when a relative elliptical arc command has been parsed.
* <p>Command : <b>a</b>
* @param rx the X axis radius for the ellipse
* @param ry the Y axis radius for the ellipse
* @param xAxisRotation the rotation angle in degrees for the ellipse's
* X-axis relative to the X-axis
* @param largeArcFlag the value of the large-arc-flag
* @param sweepFlag the value of the sweep-flag
* @param x the relative x coordinate for the end point
* @param y the relative y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag,
boolean sweepFlag, float x, float y) throws ParseException;
/**
* Invoked when an absolute elliptical arc command has been parsed.
* <p>Command : <b>A</b>
* @param rx the X axis radius for the ellipse
* @param ry the Y axis radius for the ellipse
* @param xAxisRotation the rotation angle in degrees for the ellipse's
* X-axis relative to the X-axis
* @param largeArcFlag the value of the large-arc-flag
* @param sweepFlag the value of the sweep-flag
* @param x the absolute x coordinate for the end point
* @param y the absolute y coordinate for the end point
* @exception ParseException if an error occured while processing the path
*/
void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag,
boolean sweepFlag, float x, float y) throws ParseException;
}