forked from DarwinNE/FidoCadJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfidocadj_cpd.txt
1770 lines (1529 loc) · 71.2 KB
/
fidocadj_cpd.txt
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
Found a 91 line (361 tokens) duplication in the following files:
Starting at line 203 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 228 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
IOException E=new IOException("EV/EP: Invalid primitive:"+tokens[0]+
" programming error?");
throw E;
}
}
/** Get the control parameters of the given primitive.
@return a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
*/
public Vector<ParameterDescription> getControls()
{
Vector<ParameterDescription> v=super.getControls();
ParameterDescription pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(isFilled);
pd.description=Globals.messages.getString("ctrl_filled");
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new DashInfo(dashStyle);
pd.description=Globals.messages.getString("ctrl_dash_style");
pd.isExtension = true;
v.add(pd);
return v;
}
/** Set the control parameters of the given primitive.
This method is specular to getControls().
@param v a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
@return the next index in v to be scanned (if needed) after the
execution of this function.
*/
public int setControls(Vector<ParameterDescription> v)
{
int i=super.setControls(v);
ParameterDescription pd;
pd=(ParameterDescription)v.get(i);
++i;
// Check, just for sure...
if (pd.parameter instanceof Boolean)
isFilled=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof DashInfo)
dashStyle=((DashInfo)pd.parameter).style;
else
System.out.println("Warning: unexpected parameter!"+pd);
// Parameters validation and correction
if(dashStyle>=Globals.dashNumber)
dashStyle=Globals.dashNumber-1;
if(dashStyle<0)
dashStyle=0;
return i;
}
/** Gets the distance (in primitive's coordinates space) between a
given point and the primitive.
When it is reasonable, the behaviour can be binary (polygons,
ovals...). In other cases (lines, points), it can be proportional.
@param px the x coordinate of the given point.
@param py the y coordinate of the given point.
@return the distance in logical units.
*/
public int getDistanceToPoint(int px, int py)
{
// Here we check if the given point lies inside the text areas
if(checkText(px, py))
return 0;
int xa=Math.min(virtualPoint[0].x,virtualPoint[1].x);
int ya=Math.min(virtualPoint[0].y,virtualPoint[1].y);
int xb=Math.max(virtualPoint[0].x,virtualPoint[1].x);
int yb=Math.max(virtualPoint[0].y,virtualPoint[1].y);
if(isFilled){
if(GeometricDistances.pointInEllipse(xa,ya,xb-xa,yb-ya,px,py))
=====================================================================
Found a 64 line (326 tokens) duplication in the following files:
Starting at line 129 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveBezier.java
Starting at line 122 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveLine.java
}
/** Get the control parameters of the given primitive.
@return a vector of ParameterDescription containing each control
parameter.
*/
public Vector<ParameterDescription> getControls()
{
Vector<ParameterDescription> v=super.getControls();
ParameterDescription pd = new ParameterDescription();
pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(arrowStart);
pd.description=Globals.messages.getString("ctrl_arrow_start");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(arrowEnd);
pd.description=Globals.messages.getString("ctrl_arrow_end");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Integer.valueOf(arrowLength);
pd.description=Globals.messages.getString("ctrl_arrow_length");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Integer.valueOf(arrowHalfWidth);
pd.description=Globals.messages.getString("ctrl_arrow_half_width");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new ArrowInfo(arrowStyle);
pd.description=Globals.messages.getString("ctrl_arrow_style");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new DashInfo(dashStyle);
pd.description=Globals.messages.getString("ctrl_dash_style");
pd.isExtension = true;
v.add(pd);
return v;
}
/** Set the control parameters of the given primitive.
This method is specular to getControls().
@param v a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
@return the next index in v to be scanned (if needed) after the
execution of this function.
*/
public int setControls(Vector<ParameterDescription> v)
{
int i=super.setControls(v);
ParameterDescription pd;
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof Boolean)
arrowStart=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter 1!"+pd);
=====================================================================
Found a 50 line (294 tokens) duplication in the following files:
Starting at line 188 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveBezier.java
Starting at line 795 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveComplexCurve.java
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof Boolean)
arrowStart=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter 1!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof Boolean)
arrowEnd=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter 2!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof Integer)
arrowLength=((Integer)pd.parameter).intValue();
else
System.out.println("Warning: unexpected parameter 3!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof Integer)
arrowHalfWidth=((Integer)pd.parameter).intValue();
else
System.out.println("Warning: unexpected parameter 4!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof ArrowInfo)
arrowStyle=((ArrowInfo)pd.parameter).style;
else
System.out.println("Warning: unexpected parameter 5!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof DashInfo)
dashStyle=((DashInfo)pd.parameter).style;
else
System.out.println("Warning: unexpected parameter 6!"+pd);
// Parameters validation and correction
if(dashStyle>=Globals.dashNumber)
dashStyle=Globals.dashNumber-1;
if(dashStyle<0)
dashStyle=0;
return i;
}
/** Draw the graphic primitive on the given graphic context.
@param g the graphic context in which the primitive should be drawn.
@param coordSys the graphic coordinates system to be applied.
@param layerV the layer description.
*/
public void draw(GraphicsInterface g, MapCoordinates coordSys,
=====================================================================
Found a 85 line (269 tokens) duplication in the following files:
Starting at line 203 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 372 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitivePolygon.java
Starting at line 228 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
IOException E=new IOException("EV/EP: Invalid primitive:"+tokens[0]+
" programming error?");
throw E;
}
}
/** Get the control parameters of the given primitive.
@return a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
*/
public Vector<ParameterDescription> getControls()
{
Vector<ParameterDescription> v=super.getControls();
ParameterDescription pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(isFilled);
pd.description=Globals.messages.getString("ctrl_filled");
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new DashInfo(dashStyle);
pd.description=Globals.messages.getString("ctrl_dash_style");
pd.isExtension = true;
v.add(pd);
return v;
}
/** Set the control parameters of the given primitive.
This method is specular to getControls().
@param v a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
@return the next index in v to be scanned (if needed) after the
execution of this function.
*/
public int setControls(Vector<ParameterDescription> v)
{
int i=super.setControls(v);
ParameterDescription pd;
pd=(ParameterDescription)v.get(i);
++i;
// Check, just for sure...
if (pd.parameter instanceof Boolean)
isFilled=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter!"+pd);
pd=(ParameterDescription)v.get(i++);
if (pd.parameter instanceof DashInfo)
dashStyle=((DashInfo)pd.parameter).style;
else
System.out.println("Warning: unexpected parameter!"+pd);
// Parameters validation and correction
if(dashStyle>=Globals.dashNumber)
dashStyle=Globals.dashNumber-1;
if(dashStyle<0)
dashStyle=0;
return i;
}
/** Gets the distance (in primitive's coordinates space) between a
given point and the primitive.
When it is reasonable, the behaviour can be binary (polygons,
ovals...). In other cases (lines, points), it can be proportional.
@param px the x coordinate of the given point.
@param py the y coordinate of the given point.
@return the distance in logical units.
*/
public int getDistanceToPoint(int px, int py)
{
// Here we check if the given point lies inside the text areas
if(checkText(px, py))
return 0;
int xa=Math.min(virtualPoint[0].x,virtualPoint[1].x);
=====================================================================
Found a 50 line (268 tokens) duplication in the following files:
Starting at line 139 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveBezier.java
Starting at line 730 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveComplexCurve.java
Starting at line 135 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveLine.java
ParameterDescription pd = new ParameterDescription();
pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(arrowStart);
pd.description=Globals.messages.getString("ctrl_arrow_start");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Boolean.valueOf(arrowEnd);
pd.description=Globals.messages.getString("ctrl_arrow_end");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Integer.valueOf(arrowLength);
pd.description=Globals.messages.getString("ctrl_arrow_length");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=Integer.valueOf(arrowHalfWidth);
pd.description=Globals.messages.getString("ctrl_arrow_half_width");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new ArrowInfo(arrowStyle);
pd.description=Globals.messages.getString("ctrl_arrow_style");
pd.isExtension = true;
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new DashInfo(dashStyle);
pd.description=Globals.messages.getString("ctrl_dash_style");
pd.isExtension = true;
v.add(pd);
return v;
}
/** Set the control parameters of the given primitive.
This method is specular to getControls().
@param v a vector of ParameterDescription containing each control
parameter.
The first parameters should always be the virtual points.
@return the next index in v to be scanned (if needed) after the
execution of this function.
*/
public int setControls(Vector<ParameterDescription> v)
{
int i=super.setControls(v);
ParameterDescription pd;
pd=(ParameterDescription)v.get(i++);
=====================================================================
Found a 41 line (233 tokens) duplication in the following files:
Starting at line 130 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/dialogs/DialogExport.java
Starting at line 396 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/dialogs/DialogSymbolize.java
panel.setBorder(titled);
JButton ok=new JButton(Globals.messages.getString("Ok_btn"));
JButton cancel=new JButton(Globals.messages.getString("Cancel_btn"));
constraints.gridx=0;
constraints.gridy=1;
constraints.gridwidth=4;
constraints.gridheight=1;
constraints.anchor=GridBagConstraints.EAST;
constraints.insets=new Insets(20,20,20,20);
contentPane.add(panel, constraints);
constraints.gridx=0;
constraints.gridy=2;
constraints.gridwidth=4;
constraints.gridheight=1;
constraints.anchor=GridBagConstraints.EAST;
constraints.insets=new Insets(20,20,20,20);
// Put the OK and Cancel buttons and make them active.
Box b=Box.createHorizontalBox();
b.add(Box.createHorizontalGlue());
ok.setPreferredSize(cancel.getPreferredSize());
if (Globals.okCancelWinOrder) {
b.add(ok);
b.add(Box.createHorizontalStrut(12));
b.add(cancel);
} else {
b.add(cancel);
b.add(Box.createHorizontalStrut(12));
b.add(ok);
}
contentPane.add(b, constraints); // Add cancel button
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
=====================================================================
Found a 56 line (228 tokens) duplication in the following files:
Starting at line 188 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveComplexCurve.java
Starting at line 187 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitivePolygon.java
addPoint(px, py);
// ...then we do the swap
int dummy;
for(int i=nPoints-1; i>minv; --i) {
virtualPoint[i].x=virtualPoint[i-1].x;
virtualPoint[i].y=virtualPoint[i-1].y;
}
virtualPoint[minv].x=px;
virtualPoint[minv].y=py;
changed = true;
}
/** Add a point at the current ComplexCurve. The point is always added
at the end of the already existing path.
@param x the x coordinate of the point.
@param y the y coordinate of the point.
*/
public void addPoint(int x, int y)
{
if(nPoints+2>=storageSize) {
int o_n=storageSize;
int i;
storageSize += 10;
PointG[] nv = new PointG[storageSize];
for(i=0;i<o_n;++i) {
nv[i]=virtualPoint[i];
}
for(;i<storageSize;++i) {
nv[i]=new PointG();
}
virtualPoint=nv;
}
// And now we enter the position of the point we are interested with
virtualPoint[nPoints].x=x;
virtualPoint[nPoints++].y=y;
// We do need to shift the two points describing the position
// of the text lines
virtualPoint[getNameVirtualPointNumber()].x=x+5;
virtualPoint[getNameVirtualPointNumber()].y=y+5;
virtualPoint[getValueVirtualPointNumber()].x=x+5;
virtualPoint[getValueVirtualPointNumber()].y=y+10;
changed = true;
}
/** Create the CurveStorage associated to the complex curve. This is a crude
technique, but it is very easy to implement.
@param coordSys the coordinate mapping to be employed.
@return the CurveStorage approximating the complex curve.
*/
public CurveStorage createComplexCurve(MapCoordinates coordSys)
=====================================================================
Found a 70 line (208 tokens) duplication in the following files:
Starting at line 39 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/graphic/nil/ShapeNull.java
Starting at line 36 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/graphic/swing/ShapeSwing.java
public ShapeNull()
{
s=null;
}
/** Create a cubic curve (Bézier).
@param x0 the x coord. of the starting point of the Bézier curve.
@param y0 the y coord. of the starting point of the Bézier curve.
@param x1 the x coord. of the first handle.
@param y1 the y coord. of the first handle.
@param x2 the x coord. of the second handle.
@param y2 the y coord. of the second handle.
@param x3 the x coord. of the ending point of the Bézier curve.
@param y3 the y coord. of the ending point of the Bézier curve.
*/
public void createCubicCurve(int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3)
{
s = new CubicCurve2D.Float(x0, y0, x1, y1, x2, y2, x3, y3);
}
/** Create a general path with the given number of points.
@param npoints the number of points.
*/
public void createGeneralPath(int npoints)
{
s = new GeneralPath(GeneralPath.WIND_EVEN_ODD, npoints);
}
/** Obtain the bounding box of the curve.
@return the bounding box.
*/
public RectangleG getBounds()
{
Rectangle r=s.getBounds();
return new RectangleG(r.x, r.y, r.width, r.height);
}
/** Move the current position to the given coordinates.
@param x the x coordinate.
@param y the y coordinate.
*/
public void moveTo(float x, float y)
{
GeneralPath gp=(GeneralPath)s;
gp.moveTo(x,y);
}
/** Add a cubic curve from the current point.
@param x0 the x coord. of the first handle.
@param y0 the y coord. of the first handle
@param x1 the x coord. of the second handle.
@param y1 the y coord. of the second handle.
@param x2 the x coord. of the ending point of the Bézier curve.
@param y2 the y coord. of the ending point of the Bézier curve.
*/
public void curveTo(float x0, float y0, float x1, float y1,
float x2, float y2)
{
GeneralPath gp=(GeneralPath)s;
gp.curveTo(x0, y0,x1, y1,x2, y2);
}
/** Close the current path.
*/
public void closePath()
{
GeneralPath gp=(GeneralPath)s;
gp.closePath();
}
=====================================================================
Found a 49 line (186 tokens) duplication in the following files:
Starting at line 352 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportEPS.java
Starting at line 1335 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
}
/** Called when exporting an arrow.
@param x position of the tip of the arrow.
@param y position of the tip of the arrow.
@param xc direction of the tip of the arrow.
@param yc direction of the tip of the arrow.
@param l length of the arrow.
@param h width of the arrow.
@param style style of the arrow.
@throws IOException when things goes horribly wrong, for example if
the file in which the output is being done is not accessible.
*/
public void exportArrow(double x, double y, double xc, double yc,
double l, double h,
int style)
throws IOException
{
double s;
double alpha;
double x0;
double y0;
double x1;
double y1;
double x2;
double y2;
// At first we need the angle giving the direction of the arrow
// a little bit of trigonometry :-)
if (x==xc)
alpha = Math.PI/2.0+(y-yc<0.0?0.0:Math.PI);
else
alpha = Math.atan((double)(y-yc)/(double)(x-xc));
alpha += x-xc>0.0?0.0:Math.PI;
// Then, we calculate the points for the polygon
x0 = x - l*Math.cos(alpha);
y0 = y - l*Math.sin(alpha);
x1 = x0 - h*Math.sin(alpha);
y1 = y0 + h*Math.cos(alpha);
x2 = x0 + h*Math.sin(alpha);
y2 = y0 - h*Math.cos(alpha);
// Arrows are always done with dash 0
registerDash(0);
=====================================================================
Found a 43 line (175 tokens) duplication in the following files:
Starting at line 100 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 108 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
setLayer(layer);
}
/** Draw the graphic primitive on the given graphic context.
@param g the graphic context in which the primitive should be drawn.
@param coordSys the graphic coordinates system to be applied.
@param layerV the layer description.
*/
public void draw(GraphicsInterface g, MapCoordinates coordSys,
Vector layerV)
{
if(!selectLayer(g,layerV))
return;
drawText(g, coordSys, layerV, -1);
// in the oval primitive, the first two virtual points represent
// the two corners of the oval diagonal
if(changed) {
changed=false;
x1=coordSys.mapX(virtualPoint[0].x,virtualPoint[0].y);
y1=coordSys.mapY(virtualPoint[0].x,virtualPoint[0].y);
x2=coordSys.mapX(virtualPoint[1].x,virtualPoint[1].y);
y2=coordSys.mapY(virtualPoint[1].x,virtualPoint[1].y);
// Sort the coordinates
if (x1>x2) {
xa=x2;
xb=x1;
} else {
xa=x1;
xb=x2;
}
if (y1>y2) {
ya=y2;
yb=y1;
} else {
ya=y1;
yb=y2;
}
=====================================================================
Found a 55 line (174 tokens) duplication in the following files:
Starting at line 464 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveComplexCurve.java
Starting at line 95 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitivePolygon.java
}
/** Remove the control point of the spline closest to the given
coordinates, if the distance is less than a certain tolerance
@param x the x coordinate of the target
@param y the y coordinate of the target
@param tolerance the tolerance
*/
public void removePoint(int x, int y, double tolerance)
{
// We can not have a spline with less than three vertices
if (nPoints<=3)
return;
int i;
double distance;
double min_distance= GeometricDistances.pointToPoint(virtualPoint[0].x,
virtualPoint[0].y,x,y);
int sel_i=-1;
for(i=1;i<nPoints;++i) {
distance = GeometricDistances.pointToPoint(virtualPoint[i].x,
virtualPoint[i].y,x,y);
if (distance<min_distance) {
min_distance=distance;
sel_i=i;
}
}
// Check if the control node losest to the given coordinates
// is closer than the given tolerance
if(min_distance<=tolerance){
--nPoints;
for(i=0;i<nPoints;++i) {
// Shift all the points subsequent to the one which needs
// to be erased.
if(i>=sel_i) {
virtualPoint[i].x=virtualPoint[i+1].x;
virtualPoint[i].y=virtualPoint[i+1].y;
}
changed=true;
}
}
}
/** Draw the graphic primitive on the given graphic context.
@param g the graphic context in which the primitive should be drawn.
@param coordSys the graphic coordinates system to be applied.
@param layerV the layer description.
*/
public void draw(GraphicsInterface g, MapCoordinates coordSys,
=====================================================================
Found a 42 line (171 tokens) duplication in the following files:
Starting at line 230 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveLine.java
Starting at line 102 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 110 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
}
/** Draw the graphic primitive on the given graphic context.
@param g the graphic context in which the primitive should be drawn.
@param coordSys the graphic coordinates system to be applied.
@param layerV the layer description.
*/
public void draw(GraphicsInterface g, MapCoordinates coordSys,
Vector layerV)
{
if(!selectLayer(g,layerV))
return;
drawText(g, coordSys, layerV, -1);
// in the line primitive, the first two virtual points represent
// the beginning and the end of the segment to be drawn.
if(changed) {
changed=false;
x1=coordSys.mapX(virtualPoint[0].x,virtualPoint[0].y);
y1=coordSys.mapY(virtualPoint[0].x,virtualPoint[0].y);
x2=coordSys.mapX(virtualPoint[1].x,virtualPoint[1].y);
y2=coordSys.mapY(virtualPoint[1].x,virtualPoint[1].y);
// We store the coordinates in an ordered way in order to ease
// the determination of the clip rectangle.
if (x1>x2) {
xa=x2;
xb=x1;
} else {
xa=x1;
xb=x2;
}
if (y1>y2) {
ya=y2;
yb=y1;
} else {
ya=y1;
yb=y2;
}
=====================================================================
Found a 29 line (154 tokens) duplication in the following files:
Starting at line 369 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportEPS.java
Starting at line 1352 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 67 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/Arrow.java
{
double s;
double alpha;
double x0;
double y0;
double x1;
double y1;
double x2;
double y2;
// At first we need the angle giving the direction of the arrow
// a little bit of trigonometry :-)
if (x==xc)
alpha = Math.PI/2.0+(y-yc<0.0?0.0:Math.PI);
else
alpha = Math.atan((double)(y-yc)/(double)(x-xc));
alpha += x-xc>0.0?0.0:Math.PI;
// Then, we calculate the points for the polygon
x0 = x - l*Math.cos(alpha);
y0 = y - l*Math.sin(alpha);
x1 = x0 - h*Math.sin(alpha);
y1 = y0 + h*Math.cos(alpha);
x2 = x0 + h*Math.sin(alpha);
y2 = y0 - h*Math.cos(alpha);
=====================================================================
Found a 18 line (149 tokens) duplication in the following files:
Starting at line 660 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 687 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
addLeadZeros(head.length()+
obj_PDF[5].length()+
obj_PDF[6].length()+
obj_PDF[7].length()+
obj_PDF[8].length()+
fileLength +
closeObject.length()+
obj_PDF[4].length()+
obj_PDF[2].length()+
obj_PDF[1].length()+
obj_PDF[3].length()+
obj_PDF[9].length()+
obj_PDF[10].length()+
obj_PDF[11].length()+
obj_PDF[12].length()+
obj_PDF[13].length()+
obj_PDF[14].length()+
obj_PDF[15].length())+
=====================================================================
Found a 15 line (144 tokens) duplication in the following files:
Starting at line 181 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 204 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
IOException E=new IOException("bad arguments on EV/EP");
throw E;
}
int x1 = virtualPoint[0].x=Integer.parseInt(tokens[1]);
int y1 = virtualPoint[0].y=Integer.parseInt(tokens[2]);
virtualPoint[1].x=Integer.parseInt(tokens[3]);
virtualPoint[1].y=Integer.parseInt(tokens[4]);
virtualPoint[getNameVirtualPointNumber()].x=x1+5;
virtualPoint[getNameVirtualPointNumber()].y=y1+5;
virtualPoint[getValueVirtualPointNumber()].x=x1+5;
virtualPoint[getValueVirtualPointNumber()].y=y1+10;
if(N>5) parseLayer(tokens[5]);
if(tokens[0].equals("EP"))
=====================================================================
Found a 19 line (141 tokens) duplication in the following files:
Starting at line 620 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 657 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
obj_PDF[12].length())+
" 00000 n \n"+ // 13
addLeadZeros(head.length()+
obj_PDF[5].length()+
obj_PDF[6].length()+
obj_PDF[7].length()+
obj_PDF[8].length()+
fileLength +
closeObject.length()+
obj_PDF[4].length()+
obj_PDF[2].length()+
obj_PDF[1].length()+
obj_PDF[3].length()+
obj_PDF[9].length()+
obj_PDF[10].length()+
obj_PDF[11].length()+
obj_PDF[12].length()+
obj_PDF[13].length())+
=====================================================================
Found a 17 line (140 tokens) duplication in the following files:
Starting at line 641 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 687 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
addLeadZeros(head.length()+
obj_PDF[5].length()+
obj_PDF[6].length()+
obj_PDF[7].length()+
obj_PDF[8].length()+
fileLength +
closeObject.length()+
obj_PDF[4].length()+
obj_PDF[2].length()+
obj_PDF[1].length()+
obj_PDF[3].length()+
obj_PDF[9].length()+
obj_PDF[10].length()+
obj_PDF[11].length()+
obj_PDF[12].length()+
obj_PDF[13].length()+
obj_PDF[14].length())+
=====================================================================
Found a 21 line (137 tokens) duplication in the following files:
Starting at line 353 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveLine.java
Starting at line 181 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 204 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
IOException E=new IOException("bad arguments on LI");
throw E;
}
// Load the points in the virtual points associated to the
// current primitive.
int x1 = virtualPoint[0].x=Integer.parseInt(tokens[1]);
int y1 = virtualPoint[0].y=Integer.parseInt(tokens[2]);
virtualPoint[1].x=Integer.parseInt(tokens[3]);
virtualPoint[1].y=Integer.parseInt(tokens[4]);
virtualPoint[getNameVirtualPointNumber()].x=x1+5;
virtualPoint[getNameVirtualPointNumber()].y=y1+5;
virtualPoint[getValueVirtualPointNumber()].x=x1+5;
virtualPoint[getValueVirtualPointNumber()].y=y1+10;
if(N>5) parseLayer(tokens[5]);
// FidoCadJ extensions
if(N>6 && tokens[6].equals("FCJ")) {
=====================================================================
Found a 35 line (133 tokens) duplication in the following files:
Starting at line 756 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveComplexCurve.java
Starting at line 225 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 392 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitivePolygon.java
Starting at line 246 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
v.add(pd);
pd = new ParameterDescription();
pd.parameter=new DashInfo(dashStyle);
pd.description=Globals.messages.getString("ctrl_dash_style");
pd.isExtension = true;
v.add(pd);
return v;
}
/** Set the control parameters of the given primitive.
This method is specular to getControls().
@param v a vector of ParameterDescription containing each control
parameter. The first parameters should always be the virtual
points.
@return the next index in v to be scanned (if needed) after the
execution of this function.
*/
public int setControls(Vector<ParameterDescription> v)
{
int i=super.setControls(v);
ParameterDescription pd;
pd=(ParameterDescription)v.get(i);
++i;
// Check, just for sure...
if (pd.parameter instanceof Boolean)
isFilled=((Boolean)pd.parameter).booleanValue();
else
System.out.println("Warning: unexpected parameter!"+pd);
pd=(ParameterDescription)v.get(i++);
// Check, just for sure...
if (pd.parameter instanceof Boolean)
=====================================================================
Found a 27 line (133 tokens) duplication in the following files:
Starting at line 316 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveOval.java
Starting at line 335 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/primitives/PrimitiveRectangle.java
cmd+=virtualPoint[0].x+" "+virtualPoint[0].y+" "+
+virtualPoint[1].x+" "+virtualPoint[1].y+" "+
getLayer()+"\n";
if(extensions && (dashStyle>0 || hasName() || hasValue())) {
String text = "0";
if (name.length()!=0 || value.length()!=0)
text = "1";
cmd+="FCJ "+dashStyle+" "+text+"\n";
}
// The false is needed since saveText should not write the FCJ tag.
cmd+=saveText(false);
return cmd;
}
/** Export the primitive on a vector graphic format.
@param exp the export interface to employ.
@param cs the coordinate mapping to employ.
@throws IOException if a problem occurs, such as it is impossible to
write on the output file.
*/
public void export(ExportInterface exp, MapCoordinates cs)
throws IOException
{
exportText(exp, cs, -1);
exp.exportOval(cs.mapX(virtualPoint[0].x,virtualPoint[0].y),
=====================================================================
Found a 19 line (132 tokens) duplication in the following files:
Starting at line 602 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 638 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
Starting at line 657 of /Users/davidebucci/Desktop/Perso/FidoCadJ/src/net/sourceforge/fidocadj/export/ExportPDF.java
obj_PDF[11].length())+
" 00000 n \n"+ // 12
addLeadZeros(head.length()+
obj_PDF[5].length()+
obj_PDF[6].length()+
obj_PDF[7].length()+
obj_PDF[8].length()+
fileLength +
closeObject.length()+