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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
/****************************************************************************
** $Id: dl_jww.cpp,v 1.1.1.2 2010/02/08 11:58:29 zeronemo2007 Exp $
**
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
**
** This file is part of the dxflib project.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid dxflib Professional Edition licenses may use 
** this file in accordance with the dxflib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.ribbonsoft.com for further details.
**
** Contact info@ribbonsoft.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#include "dl_jww.h"

#include <algorithm>
#include <string>
#include <cstdio>
#include <cassert>
#include <cmath>

#include "dl_creationinterface.h"

#define SKIP_MOJI
#ifdef DEBUG
#include "rs_debug.h"
#endif

#define  ArraySize(arr)  (sizeof(arr)/sizeof(arr[0]))

static	int	colTable[] = {
	250,	//RS_Color(0x00, 0x00, 0x00)
	4,		//RS_Color(0x00, 0xC0, 0xC0)
	256,	//RS_Color(0x00, 0x00, 0x00)
	3,		//RS_Color(0x00, 0xC0, 0x00)
	2,		//RS_Color(0xC0, 0xC0, 0x00)
	6,		//RS_Color(0xC0, 0x00, 0xC0)
	5,		//RS_Color(0x00, 0x00, 0xFF)
	131,	//RS_Color(0x00, 0x80, 0x80)
	221,	//RS_Color(0xFF, 0x00, 0x80)
	8,		//RS_Color(0xC0, 0xC0, 0xC0)
	23,		//RS_Color(0xFF, 0x80, 0xFF)
	6,		//RS_Color(0xFF, 0, 0xFF)
	1,		//RS_Color(0xFF, 0, 0)
	7,		//RS_Color(0xFF, 0xFF, 0xFF)
	252,	//RS_Color(0x80, 0x80, 0x80)
	256		//RS_Color(0, 0, 0)
};

static	string	lTable[] = {
	"CONTINUOUS", //RS2::SolidLine
	"CONTINUOUS", //RS2::SolidLine
	"CONTINUOUS", //RS2::SolidLine
//	"DOT", //RS2::DotLine
//	"DOT2", //RS2::DotLine2
//	"DOTX2", //RS2::DotLineX2
	"DASHED", //RS2::DashLine
	"DASHED2", //RS2::DashLine2
	"DASHEDX2", //RS2::DashLineX2
//	"DASHDOT", //RS2::DashDotLine
//	"DASHDOT2", //RS2::DashDotLine2
//	"DASHDOTX2", //RS2::DashDotLineX2
//	"DIVIDE", //RS2::DivideLine
//	"DIVIDE2", //RS2::DivideLine2
//	"DIVIDEX2", //RS2::DivideLineX2
	"CENTER", //RS2::CenterLine
	"CENTER2", //RS2::CenterLine2
//	"CENTERX2", //RS2::CenterLineX2
	"BORDER", //RS2::BorderLine
	"BORDER2", //RS2::BorderLine2
	"BORDERX2", //RS2::BorderLineX2
	"ByLayer", //RS2::LineByLayer
	"ByBlock",//RS2::LineByBlock
};

static	string HEX[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"};

static double Deg(double ang)
{
	return ang / M_PI * 180.0;
}

/**
 * Default constructor.
 */
DL_Jww::DL_Jww() {
}



/**
 * Destructor.
 */
DL_Jww::~DL_Jww() {
}

void DL_Jww::CreateSen(DL_CreationInterface* creationInterface, CDataSen& DSen)
{
	string lName = HEX[DSen.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DSen.m_nGLayer] + "-" +
													HEX[DSen.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DSen.m_nLayer];
	// add layer
	creationInterface->addLayer(DL_LayerData(lName,0));
//#ifdef	DEBUG
    if(DSen.m_nPenStyle > ArraySize(lTable)-1)
        std::cout << "線種番号 " << (jwWORD)DSen.m_nPenStyle << std::endl;   //線種番号
    if(DSen.m_nPenColor > ArraySize(colTable)-1)
        std::cout << "線色番号 " << (jwWORD)DSen.m_nPenColor << std::endl;   //線色番号
    if(DSen.m_nPenWidth > 26)
        std::cout << "線色幅 " << (jwWORD)DSen.m_nPenWidth << std::endl;//線色幅
//#endif
    int width;
	if(DSen.m_nPenWidth > 26)
		width = 0;
	else
		width = DSen.m_nPenWidth;
	int color = colTable[DSen.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DSen.m_nPenColor];
	attrib = DL_Attributes(values[8],	  // layer
			       color,	      // color
			       width,	      // width
			       lTable[DSen.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DSen.m_nPenStyle]);	  // linetype
	creationInterface->setAttributes(attrib);

	creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );
	// correct some impossible attributes for layers:
/*
	attrib = creationInterface->getAttributes();
	if (attrib.getColor()==256 || attrib.getColor()==0) {
		attrib.setColor(7);
	}
	if (attrib.getWidth()<0) {
		attrib.setWidth(1);
	}
	if (!strcasecmp(attrib.getLineType().c_str(), "BYLAYER") ||
			!strcasecmp(attrib.getLineType().c_str(), "BYBLOCK")) {
		attrib.setLineType("CONTINUOUS");
	}
*/
	DL_LineData d(DSen.m_start.x,
				DSen.m_start.y,
				0.0,
				DSen.m_end.x,
				DSen.m_end.y,
				0.0);

	creationInterface->addLine(d);

#ifdef FINISHED
	RS_LineData data(RS_Vector(0.0, 0.0), RS_Vector(0.0, 0.0));
	RS_Line* line;

	data.startpoint = RS_Vector(DSen.m_start.x, DSen.m_start.y);
	data.endpoint = RS_Vector(DSen.m_end.x, DSen.m_end.y);
	line = new RS_Line(graphic, data);
	RS2::LineType ltype = lTable[DSen.m_nPenStyle];
	RS_Color col = colTable[DSen.m_nPenColor];
	RS2::LineWidth lw = lWidth[DSen.m_nPenWidth>26 ? 0 : DSen.m_nPenWidth];
	line->setPen(RS_Pen(col, lw, ltype));
			//画層設定
//画層
// m_nGLayer-m_nLayer
//_0-0_ から_0-F_
//	 ...
//_F-0_ から_F-F_
	RS_String lName = HEX[DSen.m_nGLayer > 0x0f ? 0: DSen.m_nGLayer] + "-" +
		HEX[DSen.m_nLayer > 0x0f ? 0: DSen.m_nLayer];
	if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
cout << jwdoc->vSen[i].m_nGLayer << " " << jwdoc->vSen[i].m_nLayer << endl;
std::cout << lName.ascii() << std::endl;
#endif
		RS_Layer* layer = new RS_Layer(lName);
		graphic->addLayer(layer);
	}
	line->setLayer(lName);
#ifdef	DEBUG
std::cout << "線種番号 " << (jwWORD)DSen.m_nPenStyle << std::endl;   //線種番号
std::cout << "線色番号 " << (jwWORD)DSen.m_nPenColor << std::endl;   //線色番号
std::cout << "線色幅 " << (jwWORD)DSen.m_nPenWidth << std::endl;//線色幅
#endif

	// add the line to the graphic
	graphic->addEntity(line);
	std::cout << *line;
#endif
}

void DL_Jww::CreateEnko(DL_CreationInterface* creationInterface, CDataEnko& DEnko)
{
	string lName = HEX[DEnko.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DEnko.m_nGLayer] + "-" +
													HEX[DEnko.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DEnko.m_nLayer];

	// add layer
	creationInterface->addLayer(DL_LayerData(lName,0));

	int width;
	if(DEnko.m_nPenWidth > 26)
		width = 0;
	else
		width = DEnko.m_nPenWidth;
	int color = colTable[DEnko.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DEnko.m_nPenColor];
	attrib = DL_Attributes(values[8],	  // layer
			       color,	      // color
			       width,	      // width
			       lTable[DEnko.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DEnko.m_nPenStyle]);	  // linetype
	creationInterface->setAttributes(attrib);

	creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );

	double angle1, angle2;
	//正円
	if(DEnko.m_bZenEnFlg){
		if(DEnko.m_dHenpeiRitsu == 1.0){
			DL_CircleData d(DEnko.m_start.x, DEnko.m_start.y, 0.0, DEnko.m_dHankei);
			creationInterface->addCircle(d);
		}else{
			double angle1, angle2;
			if(DEnko.m_radEnkoKaku > 0.0){
				angle1 = DEnko.m_radKaishiKaku;
				angle2 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
			}else{
				angle1 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
				angle2 = DEnko.m_radKaishiKaku;
			}
			angle1 = angle1 - floor(angle1 / (M_PI * 2.0)) * M_PI * 2.0;
			angle2 = angle2 - floor(angle2 / (M_PI * 2.0)) * M_PI * 2.0;
			if( angle2 <= angle1 )
				angle1 = angle1 - M_PI * 2.0;
			//楕円
			DL_EllipseData d(DEnko.m_start.x, DEnko.m_start.y, 0.0,
							DEnko.m_dHankei * cos(DEnko.m_radKatamukiKaku), DEnko.m_dHankei * sin(DEnko.m_radKatamukiKaku), 0.0,
							DEnko.m_dHenpeiRitsu,
							angle1, angle2);

			creationInterface->addEllipse(d);
		}
	}else{
		if(DEnko.m_dHenpeiRitsu == 1.0){
			//円弧
			if(DEnko.m_radEnkoKaku > 0.0){
				angle1 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku;
				angle2 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku + DEnko.m_radEnkoKaku;
			}else{
				angle1 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku + DEnko.m_radEnkoKaku;
				angle2 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku;
			}
			angle1 = angle1 - floor(angle1 / (M_PI * 2.0)) * M_PI * 2.0;
			angle2 = angle2 - floor(angle2 / (M_PI * 2.0)) * M_PI * 2.0;
			if( angle2 <= angle1 )
				angle1 = angle1 - M_PI * 2.0;
			DL_ArcData d(DEnko.m_start.x, DEnko.m_start.y, 0.0,
					DEnko.m_dHankei,
					Deg(angle1),
					Deg(angle2));

			creationInterface->addArc(d);
		}else{
			double angle1, angle2;
			if(DEnko.m_radEnkoKaku > 0.0){
				angle1 = DEnko.m_radKaishiKaku;
				angle2 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
			}else{
				angle1 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
				angle2 = DEnko.m_radKaishiKaku;
			}
			angle1 = angle1 - floor(angle1 / (M_PI * 2.0)) * M_PI * 2.0;
			angle2 = angle2 - floor(angle2 / (M_PI * 2.0)) * M_PI * 2.0;
			if( angle2 <= angle1 )
				angle1 = angle1 - M_PI * 2.0;
			//楕円
			DL_EllipseData d(DEnko.m_start.x, DEnko.m_start.y, 0.0,
							DEnko.m_dHankei * cos(DEnko.m_radKatamukiKaku), DEnko.m_dHankei * sin(DEnko.m_radKatamukiKaku), 0.0,
							DEnko.m_dHenpeiRitsu,
							angle1, angle2);

			creationInterface->addEllipse(d);
		}
	}
#ifdef FINISHED
	RS_CircleData data1(RS_Vector(0.0, 0.0), 0.0);
	RS_Circle* circle;
	RS_ArcData arc_data(RS_Vector(0.0, 0.0), 0.0, 0.0, 0.0, false);
	RS_Arc* arc;
	RS_Ellipse* elps;
	//正円
	if(DEnko.m_bZenEnFlg){
		if(DEnko.m_dHenpeiRitsu == 1.0){
			data1.center = RS_Vector(DEnko.m_start.x, DEnko.m_start.y);
			data1.radius = DEnko.m_dHankei;
			circle = new RS_Circle(graphic, data1);
			RS2::LineType ltype = lTable[DEnko.m_nPenStyle];
			RS_Color col = colTable[DEnko.m_nPenColor];
			RS2::LineWidth lw = lWidth[DEnko.m_nPenWidth > 26 ? 0 : DEnko.m_nPenWidth];//RS2::Width12
			circle->setPen(RS_Pen(col, lw, ltype));

			RS_String lName = HEX[DEnko.m_nGLayer > 0x0f ? 0:DEnko.m_nGLayer] + "-" +
				HEX[DEnko.m_nLayer > 0x0f ? 0: DEnko.m_nLayer];
			if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
std::cout << lName.ascii() << std::endl;
#endif
				RS_Layer* layer = new RS_Layer(lName);
				graphic->addLayer(layer);
			}
			circle->setLayer(lName);
			// add the line to the graphic
			graphic->addEntity(circle);
#ifdef DEBUG
std::cout << *circle;
#endif
		}else{
			//楕円
			double angle1, angle2;
			if(DEnko.m_radEnkoKaku > 0.0){
				angle1 = DEnko.m_radKaishiKaku;
				angle2 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
			}else{
				angle1 = DEnko.m_radKaishiKaku + DEnko.m_radEnkoKaku;
				angle2 = DEnko.m_radKaishiKaku;
			}
			angle1 = angle1 - floor(angle1 / (M_PI * 2.0)) * M_PI * 2.0;
			angle2 = angle2 - floor(angle2 / (M_PI * 2.0)) * M_PI * 2.0;
			if( angle2 <= angle1 )
				angle1 = angle1 - M_PI * 2.0;
			RS_EllipseData elps_data(RS_Vector(DEnko.m_start.x, DEnko.m_start.y),
									RS_Vector(DEnko.m_dHankei * cos(DEnko.m_radKatamukiKaku), DEnko.m_dHankei * sin(DEnko.m_radKatamukiKaku)),
									DEnko.m_dHenpeiRitsu,
									angle1, angle2, false);
			elps = new RS_Ellipse(graphic, elps_data);
			RS2::LineType ltype = lTable[DEnko.m_nPenStyle];
			RS_Color col = colTable[DEnko.m_nPenColor];
			RS2::LineWidth lw = lWidth[DEnko.m_nPenWidth > 26 ? 0 : DEnko.m_nPenWidth];//RS2::Width12
			elps->setPen(RS_Pen(col, lw, ltype));

			RS_String lName = HEX[DEnko.m_nGLayer > 0x0f ? 0:DEnko.m_nGLayer] + "-" +
				HEX[DEnko.m_nLayer > 0x0f ? 0: DEnko.m_nLayer];
			if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
				RS_Layer* layer = new RS_Layer(lName);
				graphic->addLayer(layer);
			}
			elps->setLayer(lName);
			// add the line to the graphic
			graphic->addEntity(elps);
		}
	}else{
		//円弧
		arc_data.center = RS_Vector(DEnko.m_start.x, DEnko.m_start.y);
		arc_data.radius = DEnko.m_dHankei;
		if(DEnko.m_radEnkoKaku > 0.0){
			arc_data.angle1 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku;
			arc_data.angle2 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku + DEnko.m_radEnkoKaku;
		}else{
			arc_data.angle1 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku + DEnko.m_radEnkoKaku;
			arc_data.angle2 = DEnko.m_radKaishiKaku + DEnko.m_radKatamukiKaku;
		}
		if( arc_data.angle2 <= arc_data.angle1 )
			arc_data.angle1 = arc_data.angle1 - M_PI * 2.0;
		arc_data.angle1 = Deg(arc_data.angle1);
		arc_data.angle2 = Deg(arc_data.angle2);
		arc_data.reversed = false;
		arc = new RS_Arc(graphic, arc_data);
		RS2::LineType ltype = lTable[DEnko.m_nPenStyle];
		RS_Color col = colTable[DEnko.m_nPenColor];
		RS2::LineWidth lw = lWidth[DEnko.m_nPenWidth > 26 ? 0 : DEnko.m_nPenWidth];//RS2::Width12
		arc->setPen(RS_Pen(col, lw, ltype));

		RS_String lName = HEX[DEnko.m_nGLayer > 0x0f ? 0:DEnko.m_nGLayer] + "-" +
			HEX[DEnko.m_nLayer > 0x0f ? 0: DEnko.m_nLayer];
		if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
std::cout << lName.ascii() << std::endl;
#endif
			RS_Layer* layer = new RS_Layer(lName);
			graphic->addLayer(layer);
		}
		arc->setLayer(lName);
		// add the line to the graphic
		graphic->addEntity(arc);
	}
#endif
}

void DL_Jww::CreateTen(DL_CreationInterface* creationInterface, CDataTen& DTen)
{
	string lName = HEX[DTen.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DTen.m_nGLayer] + "-" +
													HEX[DTen.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DTen.m_nLayer];

	// add layer
	creationInterface->addLayer(DL_LayerData(lName,0));
	int width;
	if(DTen.m_nPenWidth > 26)
		width = 0;
	else
		width = DTen.m_nPenWidth;
	int color = colTable[DTen.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DTen.m_nPenColor];
	attrib = DL_Attributes(values[8],	  // layer
			       color,	      // color
			       width,	      // width
			       lTable[DTen.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DTen.m_nPenStyle]);	  // linetype
	creationInterface->setAttributes(attrib);

	creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );

	DL_PointData d(DTen.m_start.x, DTen.m_start.y, 0.0);
	creationInterface->addPoint(d);
#ifdef FINISHED
	RS_PointData data2(RS_Vector(0.0, 0.0));
	RS_Point*	point;

	data2.pos = RS_Vector(DTen.m_start.x, DTen.m_start.y);
	point = new RS_Point(graphic, data2);
	RS2::LineType ltype = lTable[DTen.m_nPenStyle];
	RS_Color col = colTable[DTen.m_nPenColor];
	RS2::LineWidth lw = lWidth[DTen.m_nPenWidth > 26 ? 0 :DTen.m_nPenWidth];//RS2::Width12
	point->setPen(RS_Pen(col, RS2::Width23, ltype));
	//画層設定
	RS_String lName = HEX[DTen.m_nGLayer > 0x0f ? 0 : DTen.m_nGLayer] + "-" + 
		HEX[DTen.m_nLayer > 0x0f ? 0: DTen.m_nLayer];
	if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
std::cout << lName.ascii() << std::endl;
#endif
		RS_Layer* layer = new RS_Layer(lName);
		graphic->addLayer(layer);
	}
	point->setLayer(lName);
	// add the line to the graphic
	graphic->addEntity(point);
#ifdef DEBUG
std::cout << *point;
#endif
#endif
}

void DL_Jww::CreateMoji(DL_CreationInterface* creationInterface, CDataMoji& DMoji)
{
	string lName = HEX[DMoji.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DMoji.m_nGLayer] + "-" +
													HEX[DMoji.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DMoji.m_nLayer];

	// add layer
	creationInterface->addLayer(DL_LayerData(lName,0));

	int width;
	if(DMoji.m_nPenWidth > 26)
		width = 0;
	else
		width = DMoji.m_nPenWidth;
	int color = colTable[DMoji.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DMoji.m_nPenColor];
	attrib = DL_Attributes(values[8],	  // layer
			       color,	      // color
			       width,	      // width
			       lTable[DMoji.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DMoji.m_nPenStyle]);	  // linetype
	creationInterface->setAttributes(attrib);

	creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );

	DL_TextData d(
		// insertion point
		DMoji.m_start.x, DMoji.m_start.y, 0.0,
		// alignment point
		0.0, 0.0, 0.0,
		// height
		DMoji.m_dSizeY,
		// x scale
		1.0,
		// generation flags
		0,
		// h just
		0,
		// v just
		0,
		// text
		DMoji.m_string,
		// style
		string("japanese"),
		// angle
		DMoji.m_degKakudo / 180.0 * M_PI);

	creationInterface->addText(d);
#ifdef FINISHED
	QTextCodec* codec = QTextCodec::codecForName("SJIS");
	RS_TextData data3(RS_Vector(0.0, 0.0),
				10,//double height,
				10,//double width,
				RS2::VAlignMiddle,
				RS2::HAlignCenter,
				RS2::LeftToRight,
				RS2::AtLeast,
				1.0,//double lineSpacingFactor,
				RS_String(""),//const RS_String& text,
				RS_String(""),
				0.0,//double angle,
				RS2::Update);
	RS_Text*	text;
	data3.insertionPoint = RS_Vector(DMoji.m_start.x, DMoji.m_start.y);
	data3.height = DMoji.m_dSizeY;
	data3.width = DMoji.m_dSizeX;
	data3.valign = RS2::VAlignBottom;//VAlignMiddle;
	data3.halign = RS2::HAlignLeft;//HAlignCenter;
	data3.drawingDirection = RS2::LeftToRight;
	data3.lineSpacingStyle = RS2::Exact;
	data3.lineSpacingFactor = DMoji.m_dKankaku;//1.0;
	//コード変換
	size_t left = DMoji.m_string.length();
	char* sjis = (char *)DMoji.m_string.c_str();
	char buf[200];
	//memset(buf, NULL, 1000);
	char* p = buf;
	size_t bufleft = 200;
#ifdef _WINDOWS
	// エンコーディングの変換:iconvを使う場合
	iconv_t cd = iconv_open(UTF8_CES, SHIFTJIS_CES);
#ifdef	DEBUG
printf("sjis = %x, p = %x\n", sjis, p);
#endif
	size_t r = iconv(cd, (const char **)(&sjis), &left, &p, &bufleft);//const_cast<char**>
#ifdef	DEBUG
printf("sjis = %x, p = %x\n", sjis, p);
printf("sjis = %x %x %x %x, p = %x %x %x %x\n", sjis[0],sjis[1],sjis[2],sjis[3], buf[0],buf[1],buf[2],buf[3]);
printf("r = %d, left = %d, bufleft = %d\n", r, left, bufleft);
#endif
	*p = '\0';
	iconv_close(cd);
#else
//	int ires = SJIS2UTF8N(sjis,buf,bufleft);
	int nBytesOut;
    strncpy(buf, sizeof(buf) -1, (const char *)CUnicodeF::sjis_to_euc((const unsigned char *)sjis/*, &nBytesOut*/));
//	QTextCodec* codec = QTextCodec::codecForName("eucJP");
//	data3.text = codec->toUnicode(buf);
#endif
//	data3.text = codec->toUnicode(sjis);
	data3.text = RS_String::fromUtf8(buf);
	data3.style = RS_String("japanese-euc");
	data3.angle = DMoji.m_degKakudo / 180.0 * M_PI;
#ifdef DEBUG
RS_DEBUG->setLevel(RS_Debug::D_DEBUGGING);
#endif
	data3.updateMode = RS2::Update;
	//jwDWORD m_nMojiShu;//文字種(斜体文字は20000、ボールド体は10000を加えた数値)

	text = new RS_Text(graphic, data3);
	RS2::LineType ltype = lTable[DMoji.m_nPenStyle];
	RS_Color col = colTable[DMoji.m_nPenColor];
	RS2::LineWidth lw = lWidth[DMoji.m_nPenWidth > 26 ? 0 : DMoji.m_nPenWidth];//RS2::Width12
	text->setPen(RS_Pen(col, RS2::Width08, ltype));

	//画層設定
	RS_String lName = HEX[DMoji.m_nGLayer > 0x0f ? 0: DMoji.m_nGLayer] + "-" +
		HEX[DMoji.m_nLayer > 0x0f ? 0 : DMoji.m_nLayer];
	if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
std::cout << lName.ascii() << std::endl;
#endif
		RS_Layer* layer = new RS_Layer(lName);
		graphic->addLayer(layer);
	}
	text->setLayer(lName);
	// add the line to the graphic
	graphic->addEntity(text);
#ifdef DEBUG
std::cout << data3.height << "  " << data3.width << std::endl;
std::cout << *text;
#endif
#endif
}

void DL_Jww::CreateSolid(DL_CreationInterface* /*creationInterface*/, CDataSolid& /*DSolid*/)
{
}

void DL_Jww::CreateSunpou(DL_CreationInterface* creationInterface, CDataSunpou& DSunpou)
{
	string lName = HEX[DSunpou.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DSunpou.m_nGLayer] + "-" +
													HEX[DSunpou.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DSunpou.m_nLayer];

	// add layer
	creationInterface->addLayer(DL_LayerData(lName,0));
	int width;
	if(DSunpou.m_nPenWidth > 26)
		width = 0;
	else
		width = DSunpou.m_nPenWidth;
	int color = colTable[DSunpou.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DSunpou.m_nPenColor];
	attrib = DL_Attributes(values[8],	  // layer
			       color,	      // color
			       width,	      // width
			       lTable[DSunpou.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DSunpou.m_nPenStyle]);	  // linetype
	creationInterface->setAttributes(attrib);

	creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );

	CreateSen(creationInterface, DSunpou.m_Sen);	//線分メンバ
	CreateMoji(creationInterface, DSunpou.m_Moji);	//文字メンバ
#ifdef FINISHED
//	if(DSunpou.nOldVersionSave >=420){
////	jwWORD m_bSxfMode;	//SXFのモード
//		CreateSen(graphic, DSunpou.m_SenHo1);	//補助線1
//		CreateSen(graphic, DSunpou.m_SenHo2);	//補助線2
//		CreateTen(graphic, DSunpou.m_Ten1);	//矢印(点)1
//		CreateTen(graphic, DSunpou.m_Ten2);	//矢印(点)2
//		CreateTen(graphic, DSunpou.m_TenHo1);	//基準点1
//		CreateTen(graphic, DSunpou.m_TenHo2);	//基準点2
//	}
#endif
}

void DL_Jww::CreateBlock(DL_CreationInterface* /*creationInterface*/, CDataBlock& /*DBlock*/)
{
#ifdef FINISHED
/*	int BlockSize=jwdoc->pBlockList->getBlockListCount();
	for(int i=0; i < BlockSize; i++ )
	{
		int Count=jwdoc->pBlockList->GetDataListCount(i);
		for( int j=0 ; j < Count; j++)
		{
			switch(jwdoc->pBlockList->GetDataType(i,j))
			{
			case	Sen :
				CreateSen(graphic, jwdoc->pBlockList->GetCDataSen(i,j));
				break;
			case	Enko:
				CreateEnko(graphic, jwdoc->pBlockList->GetCDataEnko(i,j));
				break;
			case	Ten:
				CreateTen(graphic, jwdoc->pBlockList->GetCDataTen(i,j));
				break;
			case	Moji:
				CreateMoji(graphic, jwdoc->pBlockList->GetCDataMoji(i,j));
				break;
			case	Solid:
				CreateSolid(graphic, jwdoc->pBlockList->GetCDataSolid(i,j));
				break;
			case	Sunpou:
				CreateSunpou(graphic, jwdoc->pBlockList->GetCDataSunpou(i,j));
				break;
			case	Block:
				CreateBlock(graphic, jwdoc->pBlockList->GetCDataBlock(i,j));
				break;
			}
		}
	}
*/
#endif
}

/**
 * @brief Reads the given file and calls the appropriate functions in
 * the given creation interface for every entity found in the file.
 *
 * @param file Input
 *		Path and name of file to read
 * @param creationInterface
 *		Pointer to the class which takes care of the entities in the file.
 *
 * @retval true If \p file could be opened.
 * @retval false If \p file could not be opened.
 */
bool DL_Jww::in(const string& file, DL_CreationInterface* creationInterface) {
	//JWWファイル読み取り
	string ofile("");
	JWWDocument* jwdoc = new JWWDocument((std::string&)file, ofile);
	if(!jwdoc->Read())
		return false;
	//DXF変数設定
	creationInterface->setVariableString("$DWGCODEPAGE", "SJIS", 7);
	creationInterface->setVariableString("$TEXTSTYLE", "japanese", 7);
	//線分データ
	for( unsigned int i = 0; i < jwdoc->vSen.size(); i++ )
		CreateSen(creationInterface, jwdoc->vSen[i]);
	//円弧データ
	for( unsigned int i = 0; i < jwdoc->vEnko.size(); i++ )
		CreateEnko(creationInterface, jwdoc->vEnko[i]);
	//点データ
	for( unsigned int i = 0; i < jwdoc->vTen.size(); i++ )
		CreateTen(creationInterface, jwdoc->vTen[i]);
	//文字データ
	for( unsigned int i = 0; i < jwdoc->vMoji.size(); i++ )
		CreateMoji(creationInterface, jwdoc->vMoji[i]);
	//寸法
    for(unsigned int i=0 ; i < jwdoc->vSunpou.size(); i++ )
		CreateSunpou(creationInterface, jwdoc->vSunpou[i]);
	//ソリッド
    for(unsigned int i=0 ; i < jwdoc->vSolid.size(); i++ )
		CreateSolid(creationInterface, jwdoc->vSolid[i]);
	//部品
    for(unsigned int i=0 ; i < jwdoc->vBlock.size(); i++)
		CreateBlock(creationInterface, jwdoc->vBlock[i]);
	delete jwdoc;

	return true;
}

/**
 * Processes a group (pair of group code and value).
 *
 * @param creationInterface Handle to class that creates entities and
 * other CAD data from DXF group codes
 *
 * @param groupCode Constant indicating the data type of the group.
 * @param groupValue The data value.
 *
 * @retval true if done processing current entity and new entity begun
 * @retval false if not done processing current entity
*/
bool DL_Jww::processJwwGroup(DL_CreationInterface* /*creationInterface*/,
                             int /*groupCode*/, const char */*groupValue*/) {
	return true;
}



/**
 * Adds a variable from the DXF file.
 */
void DL_Jww::addSetting(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a layer that was read from the file via the creation interface.
 */
void DL_Jww::addLayer(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a block that was read from the file via the creation interface.
 */
void DL_Jww::addBlock(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Ends a block that was read from the file via the creation interface.
 */
void DL_Jww::endBlock(DL_CreationInterface* creationInterface) {
	creationInterface->endBlock();
}



/**
 * Adds a point entity that was read from the file via the creation interface.
 */
void DL_Jww::addPoint(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a line entity that was read from the file via the creation interface.
 */
void DL_Jww::addLine(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a polyline entity that was read from the file via the creation interface.
 */
void DL_Jww::addPolyline(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a polyline vertex entity that was read from the file 
 * via the creation interface.
 */
void DL_Jww::addVertex(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a spline entity that was read from the file via the creation interface.
 */
void DL_Jww::addSpline(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a knot to the previously added spline. 
 */
/*
void DL_Jww::addKnot(DL_CreationInterface* creationInterface) {
   std::cout << "DL_Jww::addKnot\n";
}
*/



/**
 * Adds a control point to the previously added spline. 
 */
/*
void DL_Jww::addControlPoint(DL_CreationInterface* creationInterface) {
	std::cout << "DL_Jww::addControlPoint\n";
}
*/



/**
 * Adds an arc entity that was read from the file via the creation interface.
 */
void DL_Jww::addArc(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a circle entity that was read from the file via the creation interface.
 */
void DL_Jww::addCircle(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an ellipse entity that was read from the file via the creation interface.
 */
void DL_Jww::addEllipse(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an insert entity that was read from the file via the creation interface.
 */
void DL_Jww::addInsert(DL_CreationInterface* /*creationInterface*/) {
}


/**
 * Adds a trace entity (4 edge closed polyline) that was read from the file via the creation interface.
 *
 * @author AHM
 */
void DL_Jww::addTrace(DL_CreationInterface* /*creationInterface*/) {
}

/**
 * Adds a solid entity (filled trace) that was read from the file via the creation interface.
 * 
 * @author AHM
 */
void DL_Jww::addSolid(DL_CreationInterface* /*creationInterface*/) {
}


/**
 * Adds an MText entity that was read from the file via the creation interface.
 */
void DL_Jww::addMText(DL_CreationInterface* /*creationInterface*/) {
}

/**
 * Handles additional MText data.
 */
bool DL_Jww::handleMTextData(DL_CreationInterface* /*creationInterface*/) {
	return true;
}



/**
 * Handles additional polyline data.
 */
bool DL_Jww::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) {
	return true;
}



/**
 * Handles additional spline data.
 */
bool DL_Jww::handleSplineData(DL_CreationInterface* /*creationInterface*/) {
	return true;
}



/**
 * Handles additional leader data.
 */
bool DL_Jww::handleLeaderData(DL_CreationInterface* /*creationInterface*/) {
	return true;
}



/**
 * Handles additional hatch data.
 */
bool DL_Jww::handleHatchData(DL_CreationInterface* /*creationInterface*/) {
	return true;
}




/**
 * Adds an text entity that was read from the file via the creation interface.
 */
void DL_Jww::addText(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an attrib entity that was read from the file via the creation interface.
 * @todo add attrib instead of normal text
 */
void DL_Jww::addAttrib(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * @return dimension data from current values.
 */
DL_DimensionData DL_Jww::getDimData() {
    // tin-pot@gmx.net 2011-12-29: make compiler happy.
    DL_DimensionData dummy(0.,0.,0.,0.,0.,0.,0,0,0,0.,"DUMMY","",0.);
    return dummy;
}



/**
 * Adds a linear dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimLinear(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an aligned dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimAligned(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a radial dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimRadial(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a diametric dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimDiametric(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an angular dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimAngular(DL_CreationInterface* /*creationInterface*/) {
}


/**
 * Adds an angular dimension entity that was read from the file via the creation interface.
 */
void DL_Jww::addDimAngular3P(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a leader entity that was read from the file via the creation interface.
 */
void DL_Jww::addLeader(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds a hatch entity that was read from the file via the creation interface.
 */
void DL_Jww::addHatch(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an image entity that was read from the file via the creation interface.
 */
void DL_Jww::addImage(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Adds an image definition that was read from the file via the creation interface.
 */
void DL_Jww::addImageDef(DL_CreationInterface* /*creationInterface*/) {
}



/**
 * Ends some special entities like hatches or old style polylines.
 */
void DL_Jww::endEntity(DL_CreationInterface* /*creationInterface*/) {
}


/**
 * Ends a sequence and notifies the creation interface.
 */
void DL_Jww::endSequence(DL_CreationInterface* /*creationInterface*/) {
}


/**
 * @brief Opens the given file for writing and returns a pointer
 * to the dxf writer. This pointer needs to be passed on to other
 * writing functions.
 *
 * @param file Full path of the file to open.
 *
 * @return Pointer to an ascii dxf writer object.
 */
DL_WriterA* DL_Jww::out(const char* /*file*/, DL_Codes::version /*version*/) {
#ifdef DEBUG
//	jwdoc->Save();
#endif
    return NULL; // tin-pot@gmx.net 2011-12-29: Make compiler happy.
}



/**
 * @brief Writes a DXF header to the file currently opened 
 * by the given DXF writer object.
 */
void DL_Jww::writeHeader(DL_WriterA& /*dw*/) {
}




/**
 * Writes a point entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writePoint(DL_WriterA& /*dw*/,
                        const DL_PointData& /*data*/,
                        const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a line entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeLine(DL_WriterA& /*dw*/,
                       const DL_LineData& /*data*/,
                       const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a polyline entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 * @see writeVertex
 */
void DL_Jww::writePolyline(DL_WriterA& /*dw*/,
                           const DL_PolylineData& /*data*/,
                           const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a single vertex of a polyline to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeVertex(DL_WriterA& /*dw*/,
                         const DL_VertexData& /*data*/) {
}

	
	
/**
 * Writes the polyline end. Only needed for DXF R12.
 */
void DL_Jww::writePolylineEnd(DL_WriterA& /*dw*/) {
}


/**
 * Writes a spline entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 * @see writeControlPoint
 */
void DL_Jww::writeSpline(DL_WriterA& /*dw*/,
                         const DL_SplineData& /*data*/,
                         const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a single control point of a spline to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeControlPoint(DL_WriterA& /*dw*/,
                               const DL_ControlPointData& /*data*/) {
}



/**
 * Writes a single knot of a spline to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeKnot(DL_WriterA& /*dw*/,
                       const DL_KnotData& /*data*/) {
}



/**
 * Writes a circle entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeCircle(DL_WriterA& /*dw*/,
                         const DL_CircleData& /*data*/,
                         const DL_Attributes& /*attrib*/) {
}



/**
 * Writes an arc entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeArc(DL_WriterA& /*dw*/,
                      const DL_ArcData& /*data*/,
                      const DL_Attributes& /*attrib*/) {
}



/**
 * Writes an ellipse entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeEllipse(DL_WriterA& /*dw*/,
                          const DL_EllipseData& /*data*/,
                          const DL_Attributes& /*attrib*/) {
}



/**
 * Writes an insert to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeInsert(DL_WriterA& /*dw*/,
                         const DL_InsertData& /*data*/,
                         const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a multi text entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeMText(DL_WriterA& /*dw*/,
                        const DL_MTextData& /*data*/,
                        const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a text entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeText(DL_WriterA& /*dw*/,
                       const DL_TextData& /*data*/,
                       const DL_Attributes& /*attrib*/) {
}


/**
 * Writes an aligned dimension entity to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific aligned dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimAligned(DL_WriterA& /*dw*/,
                             const DL_DimensionData& /*data*/,
                             const DL_DimAlignedData& /*edata*/,
                             const DL_Attributes& /*attrib*/) {
}

/**
 * Writes a linear dimension entity to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific linear dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimLinear(DL_WriterA& /*dw*/,
                            const DL_DimensionData& /*data*/,
                            const DL_DimLinearData& /*edata*/,
                            const DL_Attributes& /*attrib*/) {
}

/**
 * Writes a radial dimension entity to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific radial dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimRadial(DL_WriterA& /*dw*/,
                            const DL_DimensionData& /*data*/,
                            const DL_DimRadialData& /*edata*/,
                            const DL_Attributes& /*attrib*/) {
}

/**
 * Writes a diametric dimension entity to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific diametric dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimDiametric(DL_WriterA& /*dw*/,
                               const DL_DimensionData& /*data*/,
                               const DL_DimDiametricData& /*edata*/,
                               const DL_Attributes& /*attrib*/) {
}



/**
 * Writes an angular dimension entity to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific angular dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimAngular(DL_WriterA& /*dw*/,
                             const DL_DimensionData& /*data*/,
                             const DL_DimAngularData& /*edata*/,
                             const DL_Attributes& /*attrib*/) {
}

/**
 * Writes an angular dimension entity (3 points version) to the file.
 *
 * @param dw DXF writer
 * @param data Generic dimension data for from the file
 * @param data Specific angular dimension data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeDimAngular3P(DL_WriterA& /*dw*/,
                               const DL_DimensionData& /*data*/,
                               const DL_DimAngular3PData& /*edata*/,
                               const DL_Attributes& /*attrib*/) {
}

/**
 * Writes a leader entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 * @see writeVertex
 */
void DL_Jww::writeLeader(DL_WriterA& /*dw*/,
                         const DL_LeaderData& /*data*/,
                         const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a single vertex of a leader to the file.
 *
 * @param dw DXF writer
 * @param data Entity data
 */
void DL_Jww::writeLeaderVertex(DL_WriterA& /*dw*/,
                               const DL_LeaderVertexData& /*data*/) {
}



/**
 * Writes the beginning of a hatch entity to the file.
 * This must be followed by one or more writeHatchLoop()
 * calls and a writeHatch2() call.
 *
 * @param dw DXF writer
 * @param data Entity data.
 * @param attrib Attributes
 */
void DL_Jww::writeHatch1(DL_WriterA& /*dw*/,
                         const DL_HatchData& /*data*/,
                         const DL_Attributes& /*attrib*/) {
}



/**
 * Writes the end of a hatch entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data.
 * @param attrib Attributes
 */
void DL_Jww::writeHatch2(DL_WriterA& /*dw*/,
                         const DL_HatchData& /*data*/,
						 const DL_Attributes& /*attrib*/) {
}



/**
 * Writes the beginning of a hatch loop to the file. This
 * must happen after writing the beginning of a hatch entity.
 *
 * @param dw DXF writer
 * @param data Entity data.
 * @param attrib Attributes
 */
void DL_Jww::writeHatchLoop1(DL_WriterA& /*dw*/,
                             const DL_HatchLoopData& /*data*/) {
}



/**
 * Writes the end of a hatch loop to the file.
 *
 * @param dw DXF writer
 * @param data Entity data.
 * @param attrib Attributes
 */
void DL_Jww::writeHatchLoop2(DL_WriterA& /*dw*/,
							 const DL_HatchLoopData& /*data*/) {

}


/**
 * Writes the beginning of a hatch entity to the file.
 *
 * @param dw DXF writer
 * @param data Entity data.
 * @param attrib Attributes
 */
void DL_Jww::writeHatchEdge(DL_WriterA& /*dw*/,
                            const DL_HatchEdgeData& /*data*/) {
}



/**
 * Writes an image entity.
 *
 * @return IMAGEDEF handle. Needed for the IMAGEDEF counterpart.
 */
int DL_Jww::writeImage(DL_WriterA& /*dw*/,
                       const DL_ImageData& /*data*/,
                       const DL_Attributes& /*attrib*/) {

    return -1; // tin-pot@gmx.net 2011-12-29: Make compiler happy.
}



/**
 * Writes an image definiition entity.
 */
void DL_Jww::writeImageDef(DL_WriterA& /*dw*/,
                           int /*handle*/,
                           const DL_ImageData& /*data*/) {
}


/**
 * Writes a layer to the file. Layers are stored in the 
 * tables section of a DXF file.
 *
 * @param dw DXF writer
 * @param data Entity data from the file
 * @param attrib Attributes
 */
void DL_Jww::writeLayer(DL_WriterA& /*dw*/,
                        const DL_LayerData& /*data*/,
                        const DL_Attributes& /*attrib*/) {
}



/**
 * Writes a line type to the file. Line types are stored in the 
 * tables section of a DXF file.
 */
void DL_Jww::writeLineType(DL_WriterA& /*dw*/,
                           const DL_LineTypeData& /*data*/) {
}

/**
 * Writes the APPID section to the DXF file.
 *
 * @param name Application name
 */
void DL_Jww::writeAppid(DL_WriterA& /*dw*/, const string& /*name*/) {
}



/**
 * Writes a block's definition (no entities) to the DXF file.
 */
void DL_Jww::writeBlock(DL_WriterA& /*dw*/, const DL_BlockData& /*data*/) {
}



/**
 * Writes a block end.
 *
 * @param name Block name
 */
void DL_Jww::writeEndBlock(DL_WriterA& /*dw*/, const string& /*name*/) {
}



/**
 * Writes a viewport section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked VPORT section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeVPort(DL_WriterA& /*dw*/) {
}



/**
 * Writes a style section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked STYLE section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeStyle(DL_WriterA& /*dw*/) {
}



/**
 * Writes a view section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked VIEW section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeView(DL_WriterA& /*dw*/) {
}



/**
 * Writes a ucs section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked UCS section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeUcs(DL_WriterA& /*dw*/) {
}

/**
 * Writes a dimstyle section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked DIMSTYLE section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeDimStyle(DL_WriterA& /*dw*/,
                    double /*dimasz*/, double /*dimexe*/, double /*dimexo*/,
                       double /*dimgap*/, double /*dimtxt*/) {
}



/**
 * Writes a blockrecord section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked BLOCKRECORD section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeBlockRecord(DL_WriterA& /*dw*/) {
}

/**
 * Writes a single block record with the given name.
 */
void DL_Jww::writeBlockRecord(DL_WriterA& /*dw*/, const string& /*name*/) {
}



/**
 * Writes a objects section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked OBJECTS section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeObjects(DL_WriterA& /*dw*/) {
}


/**
 * Writes the end of the objects section. This section is needed in VER_R13.
 * Note that this method currently only writes a faked OBJECTS section
 * to make the file readable by Aut*cad.
 */
void DL_Jww::writeObjectsEnd(DL_WriterA& /*dw*/) {
}



/**
 * Checks if the given variable is known by the given DXF version.
 */
bool DL_Jww::checkVariable(const char* /*var*/, DL_Codes::version /*version*/) {
	return true;
}



/**
 * @returns the library version as int (4 bytes, each byte one version number).
 * e.g. if str = "2.0.2.0" getLibVersion returns 0x02000200
 */
int DL_Jww::getLibVersion(const char* /*str*/) {
    return -1; // tin-pot@gmx.net 2011-12-29: Make compiler happy.
}