DXFImport.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /**
  2. * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved.
  3. *
  4. * This file is part of the QCAD project.
  5. *
  6. * QCAD is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * QCAD is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with QCAD.
  18. */
  19. include("scripts/Edit/Paste/Paste.js");
  20. include("scripts/EAction.js");
  21. include("scripts/simple.js");
  22. /**
  23. * \class ImportFile
  24. * \brief Inserts a file into the drawing.
  25. * The target point is specified by the user.
  26. * \ingroup ecma_edit
  27. */
  28. function DXFImport(guiAction, fileName) {
  29. Paste.call(this, guiAction);
  30. this.sourceDocument = new RDocument(new RMemoryStorage(), createSpatialIndex());
  31. this.sourceDi = new RDocumentInterface(this.sourceDocument);
  32. this.sourceDi.setNotifyListeners(false);
  33. // unit tests pass file name directly to action:
  34. this.fileName = fileName;
  35. this.blockName = undefined;
  36. this.asBlock = false;
  37. this.newLayerData = new Array();
  38. this.newPointEntityData = new Array();
  39. this.newLineEntityData = new Array();
  40. this.newArcEntityData = new Array();
  41. this.newCircleEntityData = new Array();
  42. this.newPolylineEntityData = new Array();
  43. this.newBlockEntityData = new Array();
  44. this.newTextEntityData = new Array();
  45. this.ratio = 1.0;
  46. // this.setUiOptions(DXFImport.includeBasePath + "/DXFImport.ui");
  47. }
  48. DXFImport.prototype = new Paste();
  49. DXFImport.includeBasePath = includeBasePath;
  50. DXFImport.prototype.beginEvent = function () {
  51. // Paste.prototype.beginEvent.call(this);
  52. var fileDialogInfo;
  53. if (!isNull(this.fileName)) {
  54. fileDialogInfo = [this.fileName, ""];
  55. }
  56. else {
  57. fileDialogInfo = this.getFileName();
  58. }
  59. // workaround for Qt keyboard focus bug:
  60. var appWin = RMainWindowQt.getMainWindow();
  61. if (!isNull(appWin)) {
  62. appWin.activateWindow();
  63. appWin.raise();
  64. appWin.setFocus(Qt.OtherFocusReason);
  65. }
  66. if (isNull(fileDialogInfo)) {
  67. destr(this.sourceDi);
  68. this.sourceDi = undefined;
  69. this.terminate();
  70. return;
  71. }
  72. // var ok = this.readTxt(fileDialogInfo[0]);
  73. try {
  74. var di = this.getDocumentInterface(); // getAssignDocumentInterface(1);
  75. var file = di.importFile(fileDialogInfo[0], fileDialogInfo[1], false);
  76. di.regenerateScenes();
  77. di.autoZoom();
  78. if (file !== RDocumentInterface.IoErrorNoError) {
  79. EAction.handleUserWarning(qsTr("Error while importing file %1").arg(fileDialogInfo[0]));
  80. if (!isNull(this.sourceDi)) {
  81. destr(this.sourceDi);
  82. this.sourceDi = undefined;
  83. }
  84. this.terminate();
  85. }
  86. var entities = this.sourceDocument.queryAllEntities(false, false, RS.EntityImage);
  87. EAction.handleUserWarning("entities: " + entities.toString());
  88. for (var i = 0; i < entities.length; i++) {
  89. var entityId = entities[i];
  90. var direct = this.sourceDocument.queryEntityDirect(entityId);
  91. var scale = direct.scale(new RVector(0.001, 0.001), new RVector(0, 0));
  92. EAction.handleUserWarning("scale: " + scale.toString());
  93. }
  94. return;
  95. } catch (error) {
  96. EAction.handleUserWarning("error: " + error.toString());
  97. }
  98. };
  99. DXFImport.prototype.finishEvent = function () {
  100. if (!isNull(this.sourceDi)) {
  101. destr(this.sourceDi);
  102. }
  103. Paste.prototype.finishEvent.call(this);
  104. };
  105. DXFImport.prototype.initOperation = function (op) {
  106. if (this.asBlock && !isNull(this.blockName) && this.blockName.length > 0) {
  107. op.setBlockName(this.blockName);
  108. }
  109. // op.setCopyAllLayers(true);
  110. // op.setCopyEmptyBlocks(true);
  111. };
  112. DXFImport.prototype.getFileName = function () {
  113. var appWin = EAction.getMainWindow();
  114. // if(RSettings.getStringValue("OpenProject/Current","") == ""){
  115. // QMessageBox.critical(appWin,
  116. // qsTr("提示"),
  117. // qsTr("请先选择工程路径"));
  118. // return;
  119. // }
  120. var lastOpenFileDir = RSettings.getStringValue("OpenProject/Current", RSettings.getDocumentsLocation());
  121. var filterAll = qsTr("地形文件") + " (*.dxf);";
  122. var fileDialog = new QFileDialog(appWin, qsTr("请选择地形文件"), lastOpenFileDir, "");
  123. fileDialog.setNameFilters([filterAll]);
  124. fileDialog.selectNameFilter(filterAll);
  125. fileDialog.setOption(QFileDialog.DontUseNativeDialog, getDontUseNativeDialog());
  126. if (!isNull(QFileDialog.DontUseCustomDirectoryIcons)) {
  127. fileDialog.setOption(QFileDialog.DontUseCustomDirectoryIcons, true);
  128. }
  129. fileDialog.fileMode = QFileDialog.ExistingFiles;
  130. fileDialog.setLabelText(QFileDialog.FileType, qsTr("Format:"));
  131. if (!fileDialog.exec()) {
  132. destr(fileDialog);
  133. EAction.activateMainWindow();
  134. return undefined;
  135. }
  136. var fileNames = fileDialog.selectedFiles();
  137. if (fileNames.length === 0) {
  138. destr(fileDialog);
  139. EAction.activateMainWindow();
  140. return undefined;
  141. }
  142. var fileName = fileNames[0];
  143. var suffix = new QFileInfo(fileName).suffix();
  144. suffix = suffix.toUpperCase();
  145. var imageFormats = QImageReader.supportedImageFormats();
  146. for (var i = 0; i < imageFormats.length; i++) {
  147. var format = imageFormats[i];
  148. if (suffix === format.toString().toUpperCase()) {
  149. include("scripts/Draw/Image/Image.js");
  150. var imageAction = new Image();
  151. imageAction.fileName = fileName;
  152. this.getDocumentInterface(0).queueAction(imageAction);
  153. this.terminate();
  154. return;
  155. }
  156. }
  157. var nameFilter = fileDialog.selectedNameFilter();
  158. destr(fileDialog);
  159. EAction.activateMainWindow();
  160. //this.blockName = new QFileInfo(fileNames[0]).baseName();
  161. //RSettings.setValue("ImportFile/BlockName", new QFileInfo(fileNames[0]).baseName());
  162. var optionsToolBar = EAction.getOptionsToolBar();
  163. if (!isNull(optionsToolBar)) {
  164. var leBlockName = optionsToolBar.findChild("BlockName");
  165. if (!isNull(leBlockName)) {
  166. var blockName = new QFileInfo(fileNames[0]).completeBaseName();
  167. blockName = RDxfServices.getSafeBlockName(blockName);
  168. leBlockName.text = blockName;
  169. }
  170. }
  171. return [fileNames[0], nameFilter];
  172. };
  173. DXFImport.prototype.slotAsBlockChanged = function (value) {
  174. this.asBlock = value;
  175. this.updatePreview(true);
  176. };
  177. DXFImport.prototype.slotBlockNameChanged = function (value) {
  178. this.blockName = value;
  179. this.updatePreview(true);
  180. };
  181. DXFImport.prototype.readTxt = function (file) {
  182. var reader = new QFile(file);
  183. var flags = makeQIODeviceOpenMode(QIODevice.ReadOnly, QIODevice.Text);
  184. if (!reader.open(flags)) {
  185. EAction.handleUserWarning("cannot open file: " + file);
  186. return false;
  187. }
  188. var pLineNo = 0;
  189. //每次都去文件中的一行,然后输出读取到的字符串lyz
  190. var ts = new QTextStream(reader);
  191. setUtf8Codec(ts);
  192. do {
  193. var code = ts.readLine().trim();
  194. var value = ts.readLine().trim();
  195. //var textLine = ts.readLine().trim();
  196. // EAction.handleUserWarning(textLine);
  197. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  198. code = code.replace(/\r\n/g, "");
  199. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  200. value = value.replace(/\r\n/g, "");
  201. // EAction.handleUserMessage(textLine2);
  202. // var code = parseInt(textLine.substring(0, 3));
  203. // var value = textLine.substring(3).trim();
  204. //读取图层数据 liyz
  205. if (code == '2' && value == 'LAYER') {
  206. //EAction.handleUserWarning('Layer Info...............................');
  207. var LayerName = '';
  208. var LayerColor = '';
  209. var LayerLineType = '';
  210. var LayerLineWidth = '';
  211. do {
  212. code = ts.readLine().trim();
  213. value = ts.readLine().trim();
  214. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  215. code = code.replace(/\r\n/g, "");
  216. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  217. value = value.replace(/\r\n/g, "");
  218. if (code == '2') {
  219. LayerName = value;
  220. }
  221. else if (code == '62') {
  222. LayerColor = value;
  223. }
  224. else if (code == '6') {
  225. LayerLineType = value;
  226. }
  227. else if (code == '370') {
  228. LayerLineWidth = value;
  229. this.newLayerData.push([LayerName, LayerColor, LayerLineType, LayerLineWidth]);
  230. // EAction.handleUserWarning(LayerName + ', ' + LayerColor + ', ' + LayerLineType+ ', ' +LayerLineWidth);
  231. }
  232. } while (!ts.atEnd() && value != 'ENDTAB' && value != 'ENDSEC' && value != 'EOF');
  233. }
  234. //读取点数据 liyz
  235. if (code == '0' && value == 'POINT') {
  236. //EAction.handleUserWarning('Point Info...............................');
  237. var POINT_X = '';
  238. var POINT_Y = '';
  239. var POINT_Layer = '';
  240. do {
  241. code = ts.readLine().trim();
  242. value = ts.readLine().trim();
  243. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  244. code = code.replace(/\r\n/g, "");
  245. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  246. value = value.replace(/\r\n/g, "");
  247. if (code == '8') {
  248. POINT_Layer = value;
  249. }
  250. else if (code == '10') {
  251. POINT_X = value;
  252. }
  253. else if (code == '20') {
  254. POINT_Y = value;
  255. this.newPointEntityData.push([parseFloat(POINT_X), parseFloat(POINT_Y), POINT_Layer]);
  256. // EAction.handleUserWarning(POINT_X + ', ' + POINT_Y + ', ' + POINT_Layer);
  257. break;
  258. }
  259. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  260. }
  261. //读取线数据 liyz
  262. if (code == '0' && value == 'LINE') {
  263. // EAction.handleUserWarning('Line Info...............................');
  264. var StartPOINT_X = '';
  265. var StartPOINT_Y = '';
  266. var EndPOINT_X = '';
  267. var EndPOINT_Y = '';
  268. var Line_Layer = '';
  269. do {
  270. code = ts.readLine().trim();
  271. value = ts.readLine().trim();
  272. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  273. code = code.replace(/\r\n/g, "");
  274. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  275. value = value.replace(/\r\n/g, "");
  276. //EAction.handleUserMessage(code);
  277. //EAction.handleUserMessage(value);
  278. if (code == '8') {
  279. Line_Layer = value;
  280. }
  281. else if (code == '10') {
  282. StartPOINT_X = value;
  283. }
  284. else if (code == '20') {
  285. StartPOINT_Y = value;
  286. }
  287. else if (code == '11') {
  288. EndPOINT_X = value;
  289. }
  290. else if (code == '21') {
  291. EndPOINT_Y = value;
  292. this.newLineEntityData.push([parseFloat(StartPOINT_X), parseFloat(StartPOINT_Y), parseFloat(EndPOINT_X), parseFloat(EndPOINT_Y), Line_Layer]);
  293. //EAction.handleUserWarning(StartPOINT_X + ', ' + StartPOINT_Y + ', ' + EndPOINT_X + ', ' + EndPOINT_Y + ', ' + Line_Layer);
  294. break;
  295. }
  296. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  297. }
  298. //读取圆数据 liyz
  299. if (code == '0' && value == 'CIRCLE') {
  300. // EAction.handleUserWarning('Circle Info...............................');
  301. var CirclePOINT_X = '';
  302. var CirclePOINT_Y = '';
  303. var Circle_R = '';
  304. var Circle_Layer = '';
  305. do {
  306. code = ts.readLine().trim();
  307. value = ts.readLine().trim();
  308. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  309. code = code.replace(/\r\n/g, "");
  310. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  311. value = value.replace(/\r\n/g, "");
  312. //EAction.handleUserMessage(code);
  313. //EAction.handleUserMessage(value);
  314. if (code == '8') {
  315. Circle_Layer = value;
  316. }
  317. else if (code == '10') {
  318. CirclePOINT_X = value;
  319. }
  320. else if (code == '20') {
  321. CirclePOINT_Y = value;
  322. }
  323. else if (code == '40') {
  324. Circle_R = value;
  325. this.newCircleEntityData.push([parseFloat(CirclePOINT_X), parseFloat(CirclePOINT_Y), parseFloat(Circle_R), Circle_Layer]);
  326. //EAction.handleUserWarning(CirclePOINT_X + ', ' + CirclePOINT_Y + ', ' + Circle_R + ', ' + Circle_Layer);
  327. break;
  328. }
  329. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  330. }
  331. //读取弧数据 liyz
  332. if (code == '0' && value == 'ARC') {
  333. // EAction.handleUserWarning('Arc Info...............................');
  334. var ArcPOINT_X = '';
  335. var ArcPOINT_Y = '';
  336. var Arc_R = '';
  337. var Arc_StartAngle = '';
  338. var Arc_EndAngle = '';
  339. var Arc_Layer = '';
  340. do {
  341. code = ts.readLine().trim();
  342. value = ts.readLine().trim();
  343. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  344. code = code.replace(/\r\n/g, "");
  345. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  346. value = value.replace(/\r\n/g, "");
  347. //EAction.handleUserMessage(code);
  348. //EAction.handleUserMessage(value);
  349. if (code == '8') {
  350. Arc_Layer = value;
  351. }
  352. else if (code == '10') {
  353. ArcPOINT_X = value;
  354. }
  355. else if (code == '20') {
  356. ArcPOINT_Y = value;
  357. }
  358. else if (code == '40') {
  359. Arc_R = value;
  360. }
  361. else if (code == '50') {
  362. Arc_StartAngle = value;
  363. }
  364. else if (code == '51') {
  365. Arc_EndAngle = value;
  366. this.newArcEntityData.push([parseFloat(ArcPOINT_X), parseFloat(ArcPOINT_Y), parseFloat(Arc_R), parseFloat(Arc_StartAngle), parseFloat(Arc_EndAngle), Arc_Layer]);
  367. //EAction.handleUserWarning(ArcPOINT_X + ', ' + ArcPOINT_Y + ', ' + Arc_R + ', ' + Arc_StartAngle + ', ' + Arc_EndAngle + ', ' + Arc_Layer);
  368. break;
  369. }
  370. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  371. }
  372. //读取多线段数据 liyz
  373. if (code == '0' && value == 'LWPOLYLINE') {
  374. // EAction.handleUserWarning('Polyline Info...............................');
  375. var PolyPOINT_X = '';
  376. var PolyPOINT_Y = '';
  377. var PolyPOINT_Num = 0;
  378. var Poly_Layer = '';
  379. var TempPolyLineData = new Array();
  380. do {
  381. code = ts.readLine().trim();
  382. value = ts.readLine().trim();
  383. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  384. code = code.replace(/\r\n/g, "");
  385. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  386. value = value.replace(/\r\n/g, "");
  387. //EAction.handleUserWarning(code);
  388. //EAction.handleUserWarning(value);
  389. if (code == '8') {
  390. Poly_Layer = value;
  391. }
  392. else if (code == '90') {
  393. PolyPOINT_Num = parseInt(value);
  394. //EAction.handleUserWarning(PolyPOINT_Num.toString());
  395. }
  396. else if (code == '10') {
  397. PolyPOINT_X = value;
  398. }
  399. else if (code == '20') {
  400. PolyPOINT_Y = value;
  401. TempPolyLineData.push([parseFloat(PolyPOINT_X), parseFloat(PolyPOINT_Y)]);
  402. }
  403. if (TempPolyLineData.length == PolyPOINT_Num && PolyPOINT_Num > 0) {
  404. this.newPolylineEntityData.push([TempPolyLineData, Poly_Layer]);
  405. // EAction.handleUserWarning(TempPolyLineData.toString());
  406. break;
  407. }
  408. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  409. }
  410. //读取块数据 liyz
  411. if (code == '0' && value == 'BLOCK') {
  412. // EAction.handleUserWarning('Block Info...............................');
  413. var BlockName = '';
  414. var Block_X = '';
  415. var Block_Y = '';
  416. var BlockLayer = '';
  417. do {
  418. code = ts.readLine().trim();
  419. value = ts.readLine().trim();
  420. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  421. code = code.replace(/\r\n/g, "");
  422. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  423. value = value.replace(/\r\n/g, "");
  424. if (code == '8') {
  425. BlockLayer = value;
  426. }
  427. else if (code == '2') {
  428. BlockName = value;
  429. }
  430. else if (code == '10') {
  431. Block_X = value;
  432. }
  433. else if (code == '20') {
  434. Block_Y = value;
  435. this.newBlockEntityData.push([BlockName, parseFloat(Block_X), parseFloat(Block_Y), BlockLayer]);
  436. //EAction.handleUserWarning(BlockName + ', ' + Block_X + ', ' + Block_Y+ ', ' +BlockLayer);
  437. }
  438. } while (!ts.atEnd() && value != 'ENDBLK' && value != 'ENDSEC' && value != 'EOF');
  439. }
  440. //读文本数据 liyz
  441. if (code == '0' && value == 'TEXT') {
  442. EAction.handleUserWarning('TEXT Info...............................');
  443. var TextName = '';
  444. var Text_X = '';
  445. var Text_Y = '';
  446. var Text_Hight = 0.0;
  447. // var Text_angle = 0.0;
  448. //var Text_font = '';
  449. var TextLayer = '';
  450. do {
  451. code = ts.readLine().trim();
  452. value = ts.readLine().trim();
  453. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  454. code = code.replace(/\r\n/g, "");
  455. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  456. value = value.replace(/\r\n/g, "");
  457. if (code == '8') {
  458. TextLayer = value;
  459. }
  460. else if (code == '10') {
  461. Text_X = value;
  462. }
  463. else if (code == '20') {
  464. Text_Y = value;
  465. }
  466. else if (code == '40') {
  467. Text_Hight = value;
  468. }
  469. else if (code == '1') {
  470. TextName = value;
  471. this.newTextEntityData.push([TextName, parseFloat(Text_X), parseFloat(Text_Y), parseFloat(Text_Hight), TextLayer]);
  472. EAction.handleUserWarning(TextName + ', ' + Text_X + ', ' + Text_Y + ', ' + Text_Hight + ', ' + TextLayer);
  473. break;
  474. }
  475. } while (!ts.atEnd() && value != 'ENDBLK' && value != 'ENDSEC' && value != 'EOF');
  476. }
  477. pLineNo++;
  478. }
  479. while (!ts.atEnd());
  480. //EAction.handleUserMessage(this.newLayerData.toString());
  481. //EAction.handleUserMessage(this.newPointEntityData.toString());
  482. //EAction.handleUserMessage(this.newLineEntityData.toString());
  483. //EAction.handleUserMessage(this.newCircleEntityData.toString());
  484. //EAction.handleUserMessage(this.newArcEntityData.toString());
  485. this.applyOperation();
  486. reader.close();
  487. return true;
  488. }
  489. DXFImport.prototype.applyOperation = function (preview) {
  490. var LineColor = new RColor(105, 105, 105);
  491. var PointColor = new RColor(255, 0, 0);
  492. var CircleColor = new RColor(255, 255, 255);
  493. var ArcColor = new RColor(0, 255, 0);
  494. //添加图层 liyz
  495. for (var i = 0; i < this.newLayerData.length; i++) {
  496. addLayerToView(this.newLayerData[i][0], null/*this.newLayerData[i][1]*/, this.newLayerData[i][2], parseInt(this.newLayerData[i][3]), 1);
  497. //addLayerToView(this.newLayerData[i][0], null, null, null, 0);
  498. }
  499. //绘制点 liyz
  500. for (var i = 0; i < this.newPointEntityData.length; i++) {
  501. addPointToView(this.newPointEntityData[i][0], this.newPointEntityData[i][1], 1);
  502. }
  503. //绘制线 liyz
  504. for (var i = 0; i < this.newLineEntityData.length; i++) {
  505. addLineToView(this.newLineEntityData[i][0], this.newLineEntityData[i][1], this.newLineEntityData[i][2], this.newLineEntityData[i][3], 1);
  506. }
  507. //绘制多线段 liyz
  508. for (var i = 0; i < this.newPolylineEntityData.length; i++) {
  509. addPolylinetoView(this.newPolylineEntityData[i][0], false, false, 1, LineColor);
  510. }
  511. //绘制圆 liyz
  512. for (var i = 0; i < this.newCircleEntityData.length; i++) {
  513. addCircleToView(this.newCircleEntityData[i][0], this.newCircleEntityData[i][1], this.newCircleEntityData[i][2], 1, CircleColor);
  514. }
  515. //绘制弧 liyz
  516. for (var i = 0; i < this.newArcEntityData.length; i++) {
  517. addArctoView(this.newArcEntityData[i][0], this.newArcEntityData[i][1], this.newArcEntityData[i][2],
  518. this.newArcEntityData[i][3], this.newArcEntityData[i][4], false, 1, ArcColor);
  519. }
  520. //绘制文字 liyz
  521. for (var i = 0; i < this.newTextEntityData.length; i++) {
  522. addSimpleTextToView(this.newTextEntityData[i][0], this.newTextEntityData[i][1], this.newTextEntityData[i][2],
  523. this.newTextEntityData[i][3], null, null, null, null, null, null, 1);
  524. }
  525. var di = getAssignDocumentInterface(1);
  526. if (!isNull(di)) {
  527. // di.regenerateScenes();
  528. di.autoZoom();
  529. }
  530. return true;
  531. }