API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt.geom. Arc2D View Javadoc
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457

/*
 * @(#)Arc2D.java	1.31 06/02/24
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package java.awt.geom;

import java.io.Serializable;

/**
 * <CODE>Arc2D</CODE> is the abstract superclass for all objects that 
 * store a 2D arc defined by a framing rectangle, 
 * start angle, angular extent (length of the arc), and a closure type 
 * (<CODE>OPEN</CODE>, <CODE>CHORD</CODE>, or <CODE>PIE</CODE>).
 * <p>
 * <a name="inscribes">
 * The arc is a partial section of a full ellipse which
 * inscribes the framing rectangle of its parent {@link RectangularShape}.
 * </a>
 * <a name="angles">
 * The angles are specified relative to the non-square
 * framing rectangle such that 45 degrees always falls on the line from
 * the center of the ellipse to the upper right corner of the framing
 * rectangle.
 * As a result, if the framing rectangle is noticeably longer along one
 * axis than the other, the angles to the start and end of the arc segment
 * will be skewed farther along the longer axis of the frame.
 * </a>
 * <p>
 * The actual storage representation of the coordinates is left to
 * the subclass.
 *
 * @version 10 Feb 1997
 * @author	Jim Graham
 * @since 1.2
 */
public abstract class Arc2D extends RectangularShape {

    /**
     * The closure type for an open arc with no path segments
     * connecting the two ends of the arc segment.
     * @since 1.2
     */
    public final static int OPEN = 0;

    /**
     * The closure type for an arc closed by drawing a straight
     * line segment from the start of the arc segment to the end of the 
     * arc segment.
     * @since 1.2
     */
    public final static int CHORD = 1;

    /**
     * The closure type for an arc closed by drawing straight line
     * segments from the start of the arc segment to the center
     * of the full ellipse and from that point to the end of the arc segment.
     * @since 1.2
     */
    public final static int PIE = 2;

    /**
     * This class defines an arc specified in {@code float} precision.
     * @since 1.2
     */
    public static class Float extends Arc2D implements Serializable { 
        /**
         * The X coordinate of the upper-left corner of the framing
         * rectangle of the arc.
         * @since 1.2
         * @serial
         */
	public float x;

        /**
         * The Y coordinate of the upper-left corner of the framing
         * rectangle of the arc.
         * @since 1.2
         * @serial
         */
	public float y;

        /**
         * The overall width of the full ellipse of which this arc is 
         * a partial section (not considering the
         * angular extents).
         * @since 1.2
         * @serial
         */
	public float width;

        /**
         * The overall height of the full ellipse of which this arc is 
         * a partial section (not considering the
         * angular extents).
         * @since 1.2
         * @serial
         */
  	public float height;

        /**
         * The starting angle of the arc in degrees.
         * @since 1.2
         * @serial
         */
	public float start;

        /**
         * The angular extent of the arc in degrees.
         * @since 1.2
         * @serial
         */
	public float extent;

        /**
         * Constructs a new OPEN arc, initialized to location (0, 0),
         * size (0, 0), angular extents (start = 0, extent = 0).
         * @since 1.2
         */
	public Float() {
	    super(OPEN);
	}

        /**
         * Constructs a new arc, initialized to location (0, 0),
         * size (0, 0), angular extents (start = 0, extent = 0), and
         * the specified closure type.
         *
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Float(int type) {
	    super(type);
	}

        /**
         * Constructs a new arc, initialized to the specified location,
         * size, angular extents, and closure type.
         *
         * @param x The X coordinate of the upper-left corner of  
         *          the arc's framing rectangle.
         * @param y The Y coordinate of the upper-left corner of  
         *          the arc's framing rectangle.
         * @param w The overall width of the full ellipse of which  
         *          this arc is a partial section.
         * @param h The overall height of the full ellipse of which this  
         *          arc is a partial section.
         * @param start The starting angle of the arc in degrees.
         * @param extent The angular extent of the arc in degrees.
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Float(float x, float y, float w, float h,
		     float start, float extent, int type) {
	    super(type);
	    this.x = x;
	    this.y = y;
	    this.width = w;
	    this.height = h;
	    this.start = start;
	    this.extent = extent;
	}

        /**
         * Constructs a new arc, initialized to the specified location,
         * size, angular extents, and closure type.
         *
         * @param ellipseBounds The framing rectangle that defines the 
         * outer boundary of the full ellipse of which this arc is a 
         * partial section.  
         * @param start The starting angle of the arc in degrees.  
         * @param extent The angular extent of the arc in degrees.  
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Float(Rectangle2D ellipseBounds,
		     float start, float extent, int type) {
	    super(type);
	    this.x = (float) ellipseBounds.getX();
	    this.y = (float) ellipseBounds.getY();
	    this.width = (float) ellipseBounds.getWidth();
	    this.height = (float) ellipseBounds.getHeight();
	    this.start = start;
	    this.extent = extent;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getX() {
	    return (double) x;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getY() {
	    return (double) y;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getWidth() {
	    return (double) width;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getHeight() {
	    return (double) height;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public double getAngleStart() {
	    return (double) start;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public double getAngleExtent() {
	    return (double) extent;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public boolean isEmpty() {
	    return (width <= 0.0 || height <= 0.0);
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setArc(double x, double y, double w, double h,
			   double angSt, double angExt, int closure) {
	    this.setArcType(closure);
	    this.x = (float) x;
	    this.y = (float) y;
	    this.width = (float) w;
	    this.height = (float) h;
	    this.start = (float) angSt;
	    this.extent = (float) angExt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setAngleStart(double angSt) {
	    this.start = (float) angSt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setAngleExtent(double angExt) {
	    this.extent = (float) angExt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	protected Rectangle2D makeBounds(double x, double y,
					 double w, double h) {
	    return new Rectangle2D.Float((float) x, (float) y,
					 (float) w, (float) h);
	}

        /*
         * JDK 1.6 serialVersionUID
         */
        private static final long serialVersionUID = 9130893014586380278L;

        /**
         * Writes the default serializable fields to the
         * <code>ObjectOutputStream</code> followed by a byte
         * indicating the arc type of this <code>Arc2D</code>
         * instance.
         *
         * @serialData
         * <ol>
         * <li>The default serializable fields.
         * <li>
         * followed by a <code>byte</code> indicating the arc type
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * </ol>
         */
        private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException
        {
            s.defaultWriteObject();

            s.writeByte(getArcType());
        }

        /**
         * Reads the default serializable fields from the
         * <code>ObjectInputStream</code> followed by a byte
         * indicating the arc type of this <code>Arc2D</code>
         * instance.
         *
         * @serialData
         * <ol>
         * <li>The default serializable fields.
         * <li>
         * followed by a <code>byte</code> indicating the arc type
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * </ol>
         */
        private void readObject(java.io.ObjectInputStream s)
            throws java.lang.ClassNotFoundException, java.io.IOException
        {
            s.defaultReadObject();

            try {
                setArcType(s.readByte());
            } catch (IllegalArgumentException iae) {
                throw new java.io.InvalidObjectException(iae.getMessage());
            }
        }
    }

    /**
     * This class defines an arc specified in {@code double} precision.
     * @since 1.2
     */
    public static class Double extends Arc2D implements Serializable {
        /**
         * The X coordinate of the upper-left corner of the framing
         * rectangle of the arc.
         * @since 1.2
         * @serial
         */
	public double x;

        /**
         * The Y coordinate of the upper-left corner of the framing
         * rectangle of the arc.
         * @since 1.2
         * @serial
         */
	public double y;

        /**
         * The overall width of the full ellipse of which this arc is 
         * a partial section (not considering the angular extents).
         * @since 1.2
         * @serial
         */
	public double width;

        /**
         * The overall height of the full ellipse of which this arc is 
         * a partial section (not considering the angular extents).
         * @since 1.2
         * @serial
         */
	public double height;

        /**
         * The starting angle of the arc in degrees.
         * @since 1.2
         * @serial
         */
	public double start;

        /**
         * The angular extent of the arc in degrees.
         * @since 1.2
         * @serial
         */
	public double extent;

        /**
         * Constructs a new OPEN arc, initialized to location (0, 0),
         * size (0, 0), angular extents (start = 0, extent = 0).
         * @since 1.2
         */
	public Double() {
	    super(OPEN);
	}

        /**
         * Constructs a new arc, initialized to location (0, 0),
         * size (0, 0), angular extents (start = 0, extent = 0), and
         * the specified closure type.
         *
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Double(int type) {
	    super(type);
	}

        /**
         * Constructs a new arc, initialized to the specified location,
         * size, angular extents, and closure type.
         *
         * @param x The X coordinate of the upper-left corner
         *          of the arc's framing rectangle.
         * @param y The Y coordinate of the upper-left corner
         *          of the arc's framing rectangle.
         * @param w The overall width of the full ellipse of which this  
         *          arc is a partial section.
         * @param h The overall height of the full ellipse of which this 
         *          arc is a partial section.
         * @param start The starting angle of the arc in degrees.
         * @param extent The angular extent of the arc in degrees.
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Double(double x, double y, double w, double h,
		      double start, double extent, int type) {
	    super(type);
	    this.x = x;
	    this.y = y;
	    this.width = w;
	    this.height = h;
	    this.start = start;
	    this.extent = extent;
	}

        /**
         * Constructs a new arc, initialized to the specified location,
         * size, angular extents, and closure type.
         *
         * @param ellipseBounds The framing rectangle that defines the 
         * outer boundary of the full ellipse of which this arc is a 
         * partial section.
         * @param start The starting angle of the arc in degrees.
         * @param extent The angular extent of the arc in degrees.
         * @param type The closure type for the arc: 
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * @since 1.2
         */
	public Double(Rectangle2D ellipseBounds,
		      double start, double extent, int type) {
	    super(type);
	    this.x = ellipseBounds.getX();
	    this.y = ellipseBounds.getY();
	    this.width = ellipseBounds.getWidth();
	    this.height = ellipseBounds.getHeight();
	    this.start = start;
	    this.extent = extent;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getX() {
	    return x;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getY() {
	    return y;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getWidth() {
	    return width;
	}

        /**
         * {@inheritDoc}
         * Note that the arc
         * <a href="Arc2D.html#inscribes">partially inscribes</a>
         * the framing rectangle of this {@code RectangularShape}.
         *
         * @since 1.2
         */
	public double getHeight() {
	    return height;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public double getAngleStart() {
	    return start;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */	
	public double getAngleExtent() {
	    return extent;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public boolean isEmpty() {
	    return (width <= 0.0 || height <= 0.0);
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setArc(double x, double y, double w, double h,
			   double angSt, double angExt, int closure) {
	    this.setArcType(closure);
	    this.x = x;
	    this.y = y;
	    this.width = w;
	    this.height = h;
	    this.start = angSt;
	    this.extent = angExt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setAngleStart(double angSt) {
	    this.start = angSt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	public void setAngleExtent(double angExt) {
	    this.extent = angExt;
	}

        /**
         * {@inheritDoc}
         * @since 1.2
         */
	protected Rectangle2D makeBounds(double x, double y,
					 double w, double h) {
	    return new Rectangle2D.Double(x, y, w, h);
	}

        /*
         * JDK 1.6 serialVersionUID
         */
        private static final long serialVersionUID = 728264085846882001L;

        /**
         * Writes the default serializable fields to the
         * <code>ObjectOutputStream</code> followed by a byte
         * indicating the arc type of this <code>Arc2D</code>
         * instance.
         *
         * @serialData
         * <ol>
         * <li>The default serializable fields.
         * <li>
         * followed by a <code>byte</code> indicating the arc type
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * </ol>
         */
        private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException
        {
            s.defaultWriteObject();

            s.writeByte(getArcType());
        }

        /**
         * Reads the default serializable fields from the
         * <code>ObjectInputStream</code> followed by a byte
         * indicating the arc type of this <code>Arc2D</code>
         * instance.
         *
         * @serialData
         * <ol>
         * <li>The default serializable fields.
         * <li>
         * followed by a <code>byte</code> indicating the arc type
         * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
         * </ol>
         */
        private void readObject(java.io.ObjectInputStream s)
            throws java.lang.ClassNotFoundException, java.io.IOException
        {
            s.defaultReadObject();

            try {
                setArcType(s.readByte());
            } catch (IllegalArgumentException iae) {
                throw new java.io.InvalidObjectException(iae.getMessage());
            }
        }
    }

    private int type;

    /**
     * This is an abstract class that cannot be instantiated directly.
     * Type-specific implementation subclasses are available for
     * instantiation and provide a number of formats for storing
     * the information necessary to satisfy the various accessor
     * methods below.
     * <p>
     * This constructor creates an object with a default closure
     * type of {@link #OPEN}.  It is provided only to enable
     * serialization of subclasses.
     *
     * @see java.awt.geom.Arc2D.Float
     * @see java.awt.geom.Arc2D.Double
     */
    Arc2D() {
        this(OPEN);
    }

    /**
     * This is an abstract class that cannot be instantiated directly.
     * Type-specific implementation subclasses are available for
     * instantiation and provide a number of formats for storing
     * the information necessary to satisfy the various accessor
     * methods below.
     *
     * @param type The closure type of this arc: 
     * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
     * @see java.awt.geom.Arc2D.Float
     * @see java.awt.geom.Arc2D.Double
     * @since 1.2
     */
    protected Arc2D(int type) {
	setArcType(type);
    }

    /**
     * Returns the starting angle of the arc.
     *
     * @return A double value that represents the starting angle 
     * of the arc in degrees.
     * @see #setAngleStart
     * @since 1.2
     */
    public abstract double getAngleStart();

    /**
     * Returns the angular extent of the arc.
     *
     * @return A double value that represents the angular extent 
     * of the arc in degrees.
     * @see #setAngleExtent
     * @since 1.2
     */
    public abstract double getAngleExtent();

    /**
     * Returns the arc closure type of the arc: {@link #OPEN}, 
     * {@link #CHORD}, or {@link #PIE}.
     * @return One of the integer constant closure types defined 
     * in this class.
     * @see #setArcType
     * @since 1.2
     */
    public int getArcType() {
	return type;
    }

    /**
     * Returns the starting point of the arc.  This point is the
     * intersection of the ray from the center defined by the
     * starting angle and the elliptical boundary of the arc.
     * 
     * @return A <CODE>Point2D</CODE> object representing the 
     * x,y coordinates of the starting point of the arc.
     * @since 1.2
     */
    public Point2D getStartPoint() {
	double angle = Math.toRadians(-getAngleStart());
	double x = getX() + (Math.cos(angle) * 0.5 + 0.5) * getWidth();
	double y = getY() + (Math.sin(angle) * 0.5 + 0.5) * getHeight();
	return new Point2D.Double(x, y);
    }

    /**
     * Returns the ending point of the arc.  This point is the
     * intersection of the ray from the center defined by the
     * starting angle plus the angular extent of the arc and the
     * elliptical boundary of the arc.
     *
     * @return A <CODE>Point2D</CODE> object representing the 
     * x,y coordinates  of the ending point of the arc.
     * @since 1.2
     */
    public Point2D getEndPoint() {
	double angle = Math.toRadians(-getAngleStart() - getAngleExtent());
	double x = getX() + (Math.cos(angle) * 0.5 + 0.5) * getWidth();
	double y = getY() + (Math.sin(angle) * 0.5 + 0.5) * getHeight();
	return new Point2D.Double(x, y);
    }

    /**
     * Sets the location, size, angular extents, and closure type of
     * this arc to the specified double values.
     *
     * @param x The X coordinate of the upper-left corner of the arc.
     * @param y The Y coordinate of the upper-left corner of the arc.
     * @param w The overall width of the full ellipse of which 
     *          this arc is a partial section.
     * @param h The overall height of the full ellipse of which 
     *          this arc is a partial section.
     * @param angSt The starting angle of the arc in degrees.
     * @param angExt The angular extent of the arc in degrees.
     * @param closure The closure type for the arc:
     * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
     * @since 1.2
     */
    public abstract void setArc(double x, double y, double w, double h,
				double angSt, double angExt, int closure);

    /**
     * Sets the location, size, angular extents, and closure type of
     * this arc to the specified values.
     *
     * @param loc The <CODE>Point2D</CODE> representing the coordinates of 
     * the upper-left corner of the arc.
     * @param size The <CODE>Dimension2D</CODE> representing the width 
     * and height of the full ellipse of which this arc is 
     * a partial section.
     * @param angSt The starting angle of the arc in degrees. 
     * @param angExt The angular extent of the arc in degrees. 
     * @param closure The closure type for the arc:
     * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
     * @since 1.2
     */ 
    public void setArc(Point2D loc, Dimension2D size,
		       double angSt, double angExt, int closure) {
	setArc(loc.getX(), loc.getY(), size.getWidth(), size.getHeight(),
	       angSt, angExt, closure);
    }

    /**
     * Sets the location, size, angular extents, and closure type of
     * this arc to the specified values.
     *
     * @param rect The framing rectangle that defines the 
     * outer boundary of the full ellipse of which this arc is a 
     * partial section.
     * @param angSt The starting angle of the arc in degrees. 
     * @param angExt The angular extent of the arc in degrees. 
     * @param closure The closure type for the arc:
     * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
     * @since 1.2
     */ 
    public void setArc(Rectangle2D rect, double angSt, double angExt,
		       int closure) {
	setArc(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(),
	       angSt, angExt, closure);
    }

    /**
     * Sets this arc to be the same as the specified arc.
     *
     * @param a The <CODE>Arc2D</CODE> to use to set the arc's values.
     * @since 1.2
     */
    public void setArc(Arc2D a) {
	setArc(a.getX(), a.getY(), a.getWidth(), a.getHeight(),
	       a.getAngleStart(), a.getAngleExtent(), a.type);
    }

    /**
     * Sets the position, bounds, angular extents, and closure type of
     * this arc to the specified values. The arc is defined by a center 
     * point and a radius rather than a framing rectangle for the full ellipse.
     *
     * @param x The X coordinate of the center of the arc. 
     * @param y The Y coordinate of the center of the arc. 
     * @param radius The radius of the arc.
     * @param angSt The starting angle of the arc in degrees.
     * @param angExt The angular extent of the arc in degrees. 
     * @param closure The closure type for the arc:
     * {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.     
     * @since 1.2
     */
    public void setArcByCenter(double x, double y, double radius,
			       double angSt, double angExt, int closure) {
	setArc(x - radius, y - radius, radius * 2.0, radius * 2.0,
	       angSt, angExt, closure);
    }

    /**
     * Sets the position, bounds, and angular extents of this arc to the 
     * specified value. The starting angle of the arc is tangent to the 
     * line specified by points (p1, p2), the ending angle is tangent to 
     * the line specified by points (p2, p3), and the arc has the 
     * specified radius.
     *
     * @param p1 The first point that defines the arc. The starting 
     * angle of the arc is tangent to the line specified by points (p1, p2).
     * @param p2 The second point that defines the arc. The starting 
     * angle of the arc is tangent to the line specified by points (p1, p2). 
     * The ending angle of the arc is tangent to the line specified by 
     * points (p2, p3).
     * @param p3 The third point that defines the arc. The ending angle 
     * of the arc is tangent to the line specified by points (p2, p3).
     * @param radius The radius of the arc.
     * @since 1.2
     */
    public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3,
				double radius) {
	double ang1 = Math.atan2(p1.getY() - p2.getY(),
				 p1.getX() - p2.getX());
	double ang2 = Math.atan2(p3.getY() - p2.getY(),
				 p3.getX() - p2.getX());
	double diff = ang2 - ang1;
	if (diff > Math.PI) {
	    ang2 -= Math.PI * 2.0;
	} else if (diff < -Math.PI) {
	    ang2 += Math.PI * 2.0;
	}
	double bisect = (ang1 + ang2) / 2.0;
	double theta = Math.abs(ang2 - bisect);
	double dist = radius / Math.sin(theta);
	double x = p2.getX() + dist * Math.cos(bisect);
	double y = p2.getY() + dist * Math.sin(bisect);
	// REMIND: This needs some work...
	if (ang1 < ang2) {
	    ang1 -= Math.PI / 2.0;
	    ang2 += Math.PI / 2.0;
	} else {
	    ang1 += Math.PI / 2.0;
	    ang2 -= Math.PI / 2.0;
	}
	ang1 = Math.toDegrees(-ang1);
	ang2 = Math.toDegrees(-ang2);
	diff = ang2 - ang1;
	if (diff < 0) {
	    diff += 360;
	} else {
	    diff -= 360;
	}
	setArcByCenter(x, y, radius, ang1, diff, type);
    }

    /**
     * Sets the starting angle of this arc to the specified double
     * value.
     *
     * @param angSt The starting angle of the arc in degrees.
     * @see #getAngleStart
     * @since 1.2
     */
    public abstract void setAngleStart(double angSt);

    /**
     * Sets the angular extent of this arc to the specified double
     * value.
     *
     * @param angExt The angular extent of the arc in degrees.
     * @see #getAngleExtent
     * @since 1.2
     */
    public abstract void setAngleExtent(double angExt);

    /**
     * Sets the starting angle of this arc to the angle that the
     * specified point defines relative to the center of this arc.
     * The angular extent of the arc will remain the same.
     *
     * @param p The <CODE>Point2D</CODE> that defines the starting angle.
     * @see #getAngleStart
     * @since 1.2
     */
    public void setAngleStart(Point2D p) {
	// Bias the dx and dy by the height and width of the oval.
	double dx = getHeight() * (p.getX() - getCenterX());
	double dy = getWidth() * (p.getY() - getCenterY());
	setAngleStart(-Math.toDegrees(Math.atan2(dy, dx)));
    }

    /**
     * Sets the starting angle and angular extent of this arc using two 
     * sets of coordinates. The first set of coordinates is used to 
     * determine the angle of the starting point relative to the arc's 
     * center. The second set of coordinates is used to determine the 
     * angle of the end point relative to the arc's center. 
     * The arc will always be non-empty and extend counterclockwise
     * from the first point around to the second point.
     *
     * @param x1 The X coordinate of the arc's starting point.
     * @param y1 The Y coordinate of the arc's starting point.
     * @param x2 The X coordinate of the arc's ending point.
     * @param y2 The Y coordinate of the arc's ending point.
     * @since 1.2
     */
    public void setAngles(double x1, double y1, double x2, double y2) {
	double x = getCenterX();
	double y = getCenterY();
	double w = getWidth();
	double h = getHeight();
	// Note: reversing the Y equations negates the angle to adjust
	// for the upside down coordinate system.
	// Also we should bias atans by the height and width of the oval.
	double ang1 = Math.atan2(w * (y - y1), h * (x1 - x));
	double ang2 = Math.atan2(w * (y - y2), h * (x2 - x));
	ang2 -= ang1;
	if (ang2 <= 0.0) {
	    ang2 += Math.PI * 2.0;
	}
	setAngleStart(Math.toDegrees(ang1));
	setAngleExtent(Math.toDegrees(ang2));
    }

    /**
     * Sets the starting angle and angular extent of this arc using  
     * two points. The first point is used to determine the angle of 
     * the starting point relative to the arc's center.
     * The second point is used to determine the angle of the end point
     * relative to the arc's center. 
     * The arc will always be non-empty and extend counterclockwise
     * from the first point around to the second point.
     *
     * @param p1 The <CODE>Point2D</CODE> that defines the arc's 
     * starting point. 
     * @param p2 The <CODE>Point2D</CODE> that defines the arc's 
     * ending point.
     * @since 1.2
     */
    public void setAngles(Point2D p1, Point2D p2) {
	setAngles(p1.getX(), p1.getY(), p2.getX(), p2.getY());
    }

    /**
     * Sets the closure type of this arc to the specified value: 
     * <CODE>OPEN</CODE>, <CODE>CHORD</CODE>, or <CODE>PIE</CODE>.
     *
     * @param type The integer constant that represents the closure 
     * type of this arc: {@link #OPEN}, {@link #CHORD}, or 
     * {@link #PIE}.
     *
     * @throws IllegalArgumentException if <code>type</code> is not
     * 0, 1, or 2.+
     * @see #getArcType
     * @since 1.2
     */
    public void setArcType(int type) {
	if (type < OPEN || type > PIE) {
	    throw new IllegalArgumentException("invalid type for Arc: "+type);
	}
	this.type = type;
    }

    /**
     * {@inheritDoc}
     * Note that the arc
     * <a href="Arc2D.html#inscribes">partially inscribes</a>
     * the framing rectangle of this {@code RectangularShape}.
     *
     * @since 1.2
     */
    public void setFrame(double x, double y, double w, double h) {
	setArc(x, y, w, h, getAngleStart(), getAngleExtent(), type);
    }

    /**
     * Returns the high-precision framing rectangle of the arc.  The framing  
     * rectangle contains only the part of this <code>Arc2D</code> that is 
     * in between the starting and ending angles and contains the pie
     * wedge, if this <code>Arc2D</code> has a <code>PIE</code> closure type.
     * <p>
     * This method differs from the 
     * {@link RectangularShape#getBounds() getBounds} in that the 
     * <code>getBounds</code> method only returns the bounds of the 
     * enclosing ellipse of this <code>Arc2D</code> without considering
     * the starting and ending angles of this <code>Arc2D</code>.
     * 
     * @return the <CODE>Rectangle2D</CODE> that represents the arc's 
     * framing rectangle.
     * @since 1.2
     */
    public Rectangle2D getBounds2D() {
	if (isEmpty()) {
	    return makeBounds(getX(), getY(), getWidth(), getHeight());
	}
	double x1, y1, x2, y2;
	if (getArcType() == PIE) {
	    x1 = y1 = x2 = y2 = 0.0;
	} else {
	    x1 = y1 = 1.0;
	    x2 = y2 = -1.0;
	}
	double angle = 0.0;
	for (int i = 0; i < 6; i++) {
	    if (i < 4) {
		// 0-3 are the four quadrants
		angle += 90.0;
		if (!containsAngle(angle)) {
		    continue;
		}
	    } else if (i == 4) {
		// 4 is start angle
		angle = getAngleStart();
	    } else {
		// 5 is end angle
		angle += getAngleExtent();
	    }
	    double rads = Math.toRadians(-angle);
	    double xe = Math.cos(rads);
	    double ye = Math.sin(rads);
	    x1 = Math.min(x1, xe);
	    y1 = Math.min(y1, ye);
	    x2 = Math.max(x2, xe);
	    y2 = Math.max(y2, ye);
	}
	double w = getWidth();
	double h = getHeight();
	x2 = (x2 - x1) * 0.5 * w;
	y2 = (y2 - y1) * 0.5 * h;
	x1 = getX() + (x1 * 0.5 + 0.5) * w;
	y1 = getY() + (y1 * 0.5 + 0.5) * h;
	return makeBounds(x1, y1, x2, y2);
    }

    /**
     * Constructs a <code>Rectangle2D</code> of the appropriate precision
     * to hold the parameters calculated to be the framing rectangle
     * of this arc.
     * 
     * @param x The X coordinate of the upper-left corner of the 
     * framing rectangle.
     * @param y The Y coordinate of the upper-left corner of the 
     * framing rectangle.
     * @param w The width of the framing rectangle.
     * @param h The height of the framing rectangle.
     * @return a <code>Rectangle2D</code> that is the framing rectangle
     *     of this arc.
     * @since 1.2
     */
    protected abstract Rectangle2D makeBounds(double x, double y,
					      double w, double h);

    /*
     * Normalizes the specified angle into the range -180 to 180.
     */
    static double normalizeDegrees(double angle) {
	if (angle > 180.0) {
	    if (angle <= (180.0 + 360.0)) {
		angle = angle - 360.0;
	    } else {
		angle = Math.IEEEremainder(angle, 360.0);
		// IEEEremainder can return -180 here for some input values...
		if (angle == -180.0) {
		    angle = 180.0;
		}
	    }
	} else if (angle <= -180.0) {
	    if (angle > (-180.0 - 360.0)) {
		angle = angle + 360.0;
	    } else {
		angle = Math.IEEEremainder(angle, 360.0);
		// IEEEremainder can return -180 here for some input values...
		if (angle == -180.0) {
		    angle = 180.0;
		}
	    }
	}
	return angle;
    }

    /**
     * Determines whether or not the specified angle is within the  
     * angular extents of the arc.
     *
     * @param angle The angle to test.
     *
     * @return <CODE>true</CODE> if the arc contains the angle, 
     * <CODE>false</CODE> if the arc doesn't contain the angle.
     * @since 1.2
     */
    public boolean containsAngle(double angle) {
	double angExt = getAngleExtent();
	boolean backwards = (angExt < 0.0);
	if (backwards) {
	    angExt = -angExt;
	}
	if (angExt >= 360.0) {
	    return true;
	}
	angle = normalizeDegrees(angle) - normalizeDegrees(getAngleStart());
	if (backwards) {
	    angle = -angle;
	}
	if (angle < 0.0) {
	    angle += 360.0;
	}

      
	return (angle >= 0.0) && (angle < angExt);
    }

    /**
     * Determines whether or not the specified point is inside the boundary 
     * of the arc.
     *
     * @param x The X coordinate of the point to test.
     * @param y The Y coordinate of the point to test.
     *
     * @return <CODE>true</CODE> if the point lies within the bound of 
     * the arc, <CODE>false</CODE> if the point lies outside of the 
     * arc's bounds.
     * @since 1.2
     */
    public boolean contains(double x, double y) {
	// Normalize the coordinates compared to the ellipse
	// having a center at 0,0 and a radius of 0.5.
	double ellw = getWidth();
	if (ellw <= 0.0) {
	    return false;
	}
	double normx = (x - getX()) / ellw - 0.5;
	double ellh = getHeight();
	if (ellh <= 0.0) {
	    return false;
	}
	double normy = (y - getY()) / ellh - 0.5;
	double distSq = (normx * normx + normy * normy);
	if (distSq >= 0.25) {
	    return false;
	}
	double angExt = Math.abs(getAngleExtent());
	if (angExt >= 360.0) {
	    return true;
	}
	boolean inarc = containsAngle(-Math.toDegrees(Math.atan2(normy,
								 normx)));
	if (type == PIE) {
	    return inarc;
	}
	// CHORD and OPEN behave the same way
	if (inarc) {
	    if (angExt >= 180.0) {
		return true;
	    }
	    // point must be outside the "pie triangle"
	} else {
	    if (angExt <= 180.0) {
		return false;
	    }
	    // point must be inside the "pie triangle"
	}
	// The point is inside the pie triangle iff it is on the same
	// side of the line connecting the ends of the arc as the center.
	double angle = Math.toRadians(-getAngleStart());
	double x1 = Math.cos(angle);
	double y1 = Math.sin(angle);
	angle += Math.toRadians(-getAngleExtent());
	double x2 = Math.cos(angle);
	double y2 = Math.sin(angle);
	boolean inside = (Line2D.relativeCCW(x1, y1, x2, y2, 2*normx, 2*normy) *
			  Line2D.relativeCCW(x1, y1, x2, y2, 0, 0) >= 0);
	return inarc ? !inside : inside;
    }

    /**
     * Determines whether or not the interior of the arc intersects 
     * the interior of the specified rectangle.
     *
     * @param x The X coordinate of the rectangle's upper-left corner. 
     * @param y The Y coordinate of the rectangle's upper-left corner. 
     * @param w The width of the rectangle.
     * @param h The height of the rectangle.
     *
     * @return <CODE>true</CODE> if the arc intersects the rectangle, 
     * <CODE>false</CODE> if the arc doesn't intersect the rectangle.
     * @since 1.2
     */
    public boolean intersects(double x, double y, double w, double h) {

	double aw = getWidth();
	double ah = getHeight();

	if ( w <= 0 || h <= 0 || aw <= 0 || ah <= 0 ) {
	    return false;
	}
	double ext = getAngleExtent();
	if (ext == 0) {
	    return false;
	}

	double ax  = getX();
	double ay  = getY();
	double axw = ax + aw;
	double ayh = ay + ah;
	double xw  = x + w;
	double yh  = y + h;

	// check bbox
	if (x >= axw || y >= ayh || xw <= ax || yh <= ay) {
	    return false;
	}

	// extract necessary data
	double axc = getCenterX();
	double ayc = getCenterY();
	Point2D sp = getStartPoint();
	Point2D ep = getEndPoint();
	double sx = sp.getX();
	double sy = sp.getY();
	double ex = ep.getX();
	double ey = ep.getY();

	/*
	 * Try to catch rectangles that intersect arc in areas
	 * outside of rectagle with left top corner coordinates
	 * (min(center x, start point x, end point x),
	 *  min(center y, start point y, end point y))
	 * and rigth bottom corner coordinates
	 * (max(center x, start point x, end point x),
	 *  max(center y, start point y, end point y)).
	 * So we'll check axis segments outside of rectangle above.
	 */
	if (ayc >= y && ayc <= yh) { // 0 and 180
	    if ((sx < xw && ex < xw && axc < xw &&
	         axw > x && containsAngle(0)) ||
	        (sx > x && ex > x && axc > x &&
	         ax < xw && containsAngle(180))) {
		return true;
	    }
	}
	if (axc >= x && axc <= xw) { // 90 and 270
	    if ((sy > y && ey > y && ayc > y &&
	         ay < yh && containsAngle(90)) ||
	        (sy < yh && ey < yh && ayc < yh &&
	         ayh > y && containsAngle(270))) {
		return true;
	    }
	}

	/*
	 * For PIE we should check intersection with pie slices;
	 * also we should do the same for arcs with extent is greater
	 * than 180, because we should cover case of rectangle, which
	 * situated between center of arc and chord, but does not
	 * intersect the chord.
	 */
	Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
	if (type == PIE || Math.abs(ext) > 180) {
	    // for PIE: try to find intersections with pie slices
	    if (rect.intersectsLine(axc, ayc, sx, sy) ||
		rect.intersectsLine(axc, ayc, ex, ey)) {
		return true;
	    }
	} else {
	    // for CHORD and OPEN: try to find intersections with chord
	    if (rect.intersectsLine(sx, sy, ex, ey)) {
		return true;
	    }
	}

	// finally check the rectangle corners inside the arc
	if (contains(x, y) || contains(x + w, y) ||
	    contains(x, y + h) || contains(x + w, y + h)) {
	    return true;
	}

	return false;
    }

    /**
     * Determines whether or not the interior of the arc entirely contains 
     * the specified rectangle.
     *
     * @param x The X coordinate of the rectangle's upper-left corner. 
     * @param y The Y coordinate of the rectangle's upper-left corner. 
     * @param w The width of the rectangle.
     * @param h The height of the rectangle.
     *
     * @return <CODE>true</CODE> if the arc contains the rectangle, 
     * <CODE>false</CODE> if the arc doesn't contain the rectangle.
     * @since 1.2
     */
    public boolean contains(double x, double y, double w, double h) {
	return contains(x, y, w, h, null);
    }

    /**
     * Determines whether or not the interior of the arc entirely contains 
     * the specified rectangle.
     *
     * @param r The <CODE>Rectangle2D</CODE> to test.
     *
     * @return <CODE>true</CODE> if the arc contains the rectangle, 
     * <CODE>false</CODE> if the arc doesn't contain the rectangle.
     * @since 1.2
     */  
    public boolean contains(Rectangle2D r) {
	return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight(), r);
    }

    private boolean contains(double x, double y, double w, double h,
			     Rectangle2D origrect) {
	if (!(contains(x, y) &&
	      contains(x + w, y) &&
	      contains(x, y + h) &&
	      contains(x + w, y + h))) {
	    return false;
	}
	// If the shape is convex then we have done all the testing
	// we need.  Only PIE arcs can be concave and then only if
	// the angular extents are greater than 180 degrees.
	if (type != PIE || Math.abs(getAngleExtent()) <= 180.0) {
	    return true;
	}
	// For a PIE shape we have an additional test for the case where
	// the angular extents are greater than 180 degrees and all four
	// rectangular corners are inside the shape but one of the
	// rectangle edges spans across the "missing wedge" of the arc.
	// We can test for this case by checking if the rectangle intersects
	// either of the pie angle segments.
	if (origrect == null) {
	    origrect = new Rectangle2D.Double(x, y, w, h);
	}
	double halfW = getWidth() / 2.0;
	double halfH = getHeight() / 2.0;
	double xc = getX() + halfW;
	double yc = getY() + halfH;
	double angle = Math.toRadians(-getAngleStart());
	double xe = xc + halfW * Math.cos(angle);
	double ye = yc + halfH * Math.sin(angle);
	if (origrect.intersectsLine(xc, yc, xe, ye)) {
	    return false;
	}
	angle += Math.toRadians(-getAngleExtent());
	xe = xc + halfW * Math.cos(angle);
	ye = yc + halfH * Math.sin(angle);
	return !origrect.intersectsLine(xc, yc, xe, ye);
    }

    /**
     * Returns an iteration object that defines the boundary of the
     * arc.
     * This iterator is multithread safe.
     * <code>Arc2D</code> guarantees that
     * modifications to the geometry of the arc
     * do not affect any iterations of that geometry that
     * are already in process.
     *
     * @param at an optional <CODE>AffineTransform</CODE> to be applied 
     * to the coordinates as they are returned in the iteration, or null 
     * if the untransformed coordinates are desired.
     *
     * @return A <CODE>PathIterator</CODE> that defines the arc's boundary.
     * @since 1.2
     */
    public PathIterator getPathIterator(AffineTransform at) {
	return new ArcIterator(this, at);
    }

    /**
     * Returns the hashcode for this <code>Arc2D</code>.
     * @return the hashcode for this <code>Arc2D</code>.
     * @since 1.6
     */
    public int hashCode() {
        long bits = java.lang.Double.doubleToLongBits(getX());
        bits += java.lang.Double.doubleToLongBits(getY()) * 37;
        bits += java.lang.Double.doubleToLongBits(getWidth()) * 43;
        bits += java.lang.Double.doubleToLongBits(getHeight()) * 47;
        bits += java.lang.Double.doubleToLongBits(getAngleStart()) * 53;
        bits += java.lang.Double.doubleToLongBits(getAngleExtent()) * 59;
        bits += getArcType() * 61;
        return (((int) bits) ^ ((int) (bits >> 32)));
    }

    /**
     * Determines whether or not the specified <code>Object</code> is
     * equal to this <code>Arc2D</code>.  The specified
     * <code>Object</code> is equal to this <code>Arc2D</code>
     * if it is an instance of <code>Arc2D</code> and if its
     * location, size, arc extents and type are the same as this
     * <code>Arc2D</code>.
     * @param obj  an <code>Object</code> to be compared with this
     *             <code>Arc2D</code>.
     * @return  <code>true</code> if <code>obj</code> is an instance
     *          of <code>Arc2D</code> and has the same values;
     *          <code>false</code> otherwise.
     * @since 1.6
     */
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof Arc2D) {
            Arc2D a2d = (Arc2D) obj;
            return ((getX() == a2d.getX()) &&
                    (getY() == a2d.getY()) &&
                    (getWidth() == a2d.getWidth()) &&
                    (getHeight() == a2d.getHeight()) &&
                    (getAngleStart() == a2d.getAngleStart()) &&
                    (getAngleExtent() == a2d.getAngleExtent()) &&
                    (getArcType() == a2d.getArcType()));
        }
        return false;
    }
}

Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar