DXFImport.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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. // 只再平面上加载
  75. var di = getAssignDocumentInterface(1); // this.sourceDi; // this.getDocumentInterface();
  76. var file = di.importFile(fileDialogInfo[0], fileDialogInfo[1], false);
  77. // di.regenerateScenes();
  78. // di.autoZoom();
  79. if (file !== RDocumentInterface.IoErrorNoError) {
  80. EAction.handleUserWarning(qsTr("Error while importing file %1").arg(fileDialogInfo[0]));
  81. if (!isNull(this.sourceDi)) {
  82. destr(this.sourceDi);
  83. this.sourceDi = undefined;
  84. }
  85. this.terminate();
  86. }
  87. var entities = this.sourceDocument.queryAllEntities(false, false, RS.EntityImage);
  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. }
  93. return;
  94. } catch (error) {
  95. EAction.handleUserWarning("error: " + error.toString());
  96. }
  97. };
  98. DXFImport.prototype.finishEvent = function () {
  99. if (!isNull(this.sourceDi)) {
  100. destr(this.sourceDi);
  101. }
  102. Paste.prototype.finishEvent.call(this);
  103. };
  104. DXFImport.prototype.initOperation = function (op) {
  105. if (this.asBlock && !isNull(this.blockName) && this.blockName.length > 0) {
  106. op.setBlockName(this.blockName);
  107. }
  108. // op.setCopyAllLayers(true);
  109. // op.setCopyEmptyBlocks(true);
  110. };
  111. DXFImport.prototype.getFileName = function () {
  112. var appWin = EAction.getMainWindow();
  113. // if(RSettings.getStringValue("OpenProject/Current","") == ""){
  114. // QMessageBox.critical(appWin,
  115. // qsTr("提示"),
  116. // qsTr("请先选择工程路径"));
  117. // return;
  118. // }
  119. var lastOpenFileDir = RSettings.getStringValue("OpenProject/Current", RSettings.getDocumentsLocation());
  120. var filterAll = qsTr("地形文件") + " (*.dxf);";
  121. var fileDialog = new QFileDialog(appWin, qsTr("请选择地形文件"), lastOpenFileDir, "");
  122. fileDialog.setNameFilters([filterAll]);
  123. fileDialog.selectNameFilter(filterAll);
  124. fileDialog.setOption(QFileDialog.DontUseNativeDialog, getDontUseNativeDialog());
  125. if (!isNull(QFileDialog.DontUseCustomDirectoryIcons)) {
  126. fileDialog.setOption(QFileDialog.DontUseCustomDirectoryIcons, true);
  127. }
  128. fileDialog.fileMode = QFileDialog.ExistingFiles;
  129. fileDialog.setLabelText(QFileDialog.FileType, qsTr("Format:"));
  130. if (!fileDialog.exec()) {
  131. destr(fileDialog);
  132. EAction.activateMainWindow();
  133. return undefined;
  134. }
  135. var fileNames = fileDialog.selectedFiles();
  136. if (fileNames.length === 0) {
  137. destr(fileDialog);
  138. EAction.activateMainWindow();
  139. return undefined;
  140. }
  141. var fileName = fileNames[0];
  142. var suffix = new QFileInfo(fileName).suffix();
  143. suffix = suffix.toUpperCase();
  144. var imageFormats = QImageReader.supportedImageFormats();
  145. for (var i = 0; i < imageFormats.length; i++) {
  146. var format = imageFormats[i];
  147. if (suffix === format.toString().toUpperCase()) {
  148. include("scripts/Draw/Image/Image.js");
  149. var imageAction = new Image();
  150. imageAction.fileName = fileName;
  151. this.getDocumentInterface(0).queueAction(imageAction);
  152. this.terminate();
  153. return;
  154. }
  155. }
  156. var nameFilter = fileDialog.selectedNameFilter();
  157. destr(fileDialog);
  158. EAction.activateMainWindow();
  159. //this.blockName = new QFileInfo(fileNames[0]).baseName();
  160. //RSettings.setValue("ImportFile/BlockName", new QFileInfo(fileNames[0]).baseName());
  161. var optionsToolBar = EAction.getOptionsToolBar();
  162. if (!isNull(optionsToolBar)) {
  163. var leBlockName = optionsToolBar.findChild("BlockName");
  164. if (!isNull(leBlockName)) {
  165. var blockName = new QFileInfo(fileNames[0]).completeBaseName();
  166. blockName = RDxfServices.getSafeBlockName(blockName);
  167. leBlockName.text = blockName;
  168. }
  169. }
  170. return [fileNames[0], nameFilter];
  171. };
  172. DXFImport.prototype.slotAsBlockChanged = function (value) {
  173. this.asBlock = value;
  174. this.updatePreview(true);
  175. };
  176. DXFImport.prototype.slotBlockNameChanged = function (value) {
  177. this.blockName = value;
  178. this.updatePreview(true);
  179. };
  180. DXFImport.prototype.readTxt = function (file) {
  181. var reader = new QFile(file);
  182. var flags = makeQIODeviceOpenMode(QIODevice.ReadOnly, QIODevice.Text);
  183. if (!reader.open(flags)) {
  184. EAction.handleUserWarning("cannot open file: " + file);
  185. return false;
  186. }
  187. var pLineNo = 0;
  188. //每次都去文件中的一行,然后输出读取到的字符串lyz
  189. var ts = new QTextStream(reader);
  190. setUtf8Codec(ts);
  191. do {
  192. var code = ts.readLine().trim();
  193. var value = ts.readLine().trim();
  194. //var textLine = ts.readLine().trim();
  195. // EAction.handleUserWarning(textLine);
  196. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  197. code = code.replace(/\r\n/g, "");
  198. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  199. value = value.replace(/\r\n/g, "");
  200. // EAction.handleUserMessage(textLine2);
  201. // var code = parseInt(textLine.substring(0, 3));
  202. // var value = textLine.substring(3).trim();
  203. //读取图层数据 liyz
  204. if (code == '2' && value == 'LAYER') {
  205. //EAction.handleUserWarning('Layer Info...............................');
  206. var LayerName = '';
  207. var LayerColor = '';
  208. var LayerLineType = '';
  209. var LayerLineWidth = '';
  210. do {
  211. code = ts.readLine().trim();
  212. value = ts.readLine().trim();
  213. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  214. code = code.replace(/\r\n/g, "");
  215. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  216. value = value.replace(/\r\n/g, "");
  217. if (code == '2') {
  218. LayerName = value;
  219. }
  220. else if (code == '62') {
  221. LayerColor = value;
  222. }
  223. else if (code == '6') {
  224. LayerLineType = value;
  225. }
  226. else if (code == '370') {
  227. LayerLineWidth = value;
  228. this.newLayerData.push([LayerName, LayerColor, LayerLineType, LayerLineWidth]);
  229. // EAction.handleUserWarning(LayerName + ', ' + LayerColor + ', ' + LayerLineType+ ', ' +LayerLineWidth);
  230. }
  231. } while (!ts.atEnd() && value != 'ENDTAB' && value != 'ENDSEC' && value != 'EOF');
  232. }
  233. //读取点数据 liyz
  234. if (code == '0' && value == 'POINT') {
  235. //EAction.handleUserWarning('Point Info...............................');
  236. var POINT_X = '';
  237. var POINT_Y = '';
  238. var POINT_Layer = '';
  239. do {
  240. code = ts.readLine().trim();
  241. value = ts.readLine().trim();
  242. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  243. code = code.replace(/\r\n/g, "");
  244. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  245. value = value.replace(/\r\n/g, "");
  246. if (code == '8') {
  247. POINT_Layer = value;
  248. }
  249. else if (code == '10') {
  250. POINT_X = value;
  251. }
  252. else if (code == '20') {
  253. POINT_Y = value;
  254. this.newPointEntityData.push([parseFloat(POINT_X), parseFloat(POINT_Y), POINT_Layer]);
  255. // EAction.handleUserWarning(POINT_X + ', ' + POINT_Y + ', ' + POINT_Layer);
  256. break;
  257. }
  258. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  259. }
  260. //读取线数据 liyz
  261. if (code == '0' && value == 'LINE') {
  262. // EAction.handleUserWarning('Line Info...............................');
  263. var StartPOINT_X = '';
  264. var StartPOINT_Y = '';
  265. var EndPOINT_X = '';
  266. var EndPOINT_Y = '';
  267. var Line_Layer = '';
  268. do {
  269. code = ts.readLine().trim();
  270. value = ts.readLine().trim();
  271. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  272. code = code.replace(/\r\n/g, "");
  273. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  274. value = value.replace(/\r\n/g, "");
  275. //EAction.handleUserMessage(code);
  276. //EAction.handleUserMessage(value);
  277. if (code == '8') {
  278. Line_Layer = value;
  279. }
  280. else if (code == '10') {
  281. StartPOINT_X = value;
  282. }
  283. else if (code == '20') {
  284. StartPOINT_Y = value;
  285. }
  286. else if (code == '11') {
  287. EndPOINT_X = value;
  288. }
  289. else if (code == '21') {
  290. EndPOINT_Y = value;
  291. this.newLineEntityData.push([parseFloat(StartPOINT_X), parseFloat(StartPOINT_Y), parseFloat(EndPOINT_X), parseFloat(EndPOINT_Y), Line_Layer]);
  292. //EAction.handleUserWarning(StartPOINT_X + ', ' + StartPOINT_Y + ', ' + EndPOINT_X + ', ' + EndPOINT_Y + ', ' + Line_Layer);
  293. break;
  294. }
  295. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  296. }
  297. //读取圆数据 liyz
  298. if (code == '0' && value == 'CIRCLE') {
  299. // EAction.handleUserWarning('Circle Info...............................');
  300. var CirclePOINT_X = '';
  301. var CirclePOINT_Y = '';
  302. var Circle_R = '';
  303. var Circle_Layer = '';
  304. do {
  305. code = ts.readLine().trim();
  306. value = ts.readLine().trim();
  307. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  308. code = code.replace(/\r\n/g, "");
  309. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  310. value = value.replace(/\r\n/g, "");
  311. //EAction.handleUserMessage(code);
  312. //EAction.handleUserMessage(value);
  313. if (code == '8') {
  314. Circle_Layer = value;
  315. }
  316. else if (code == '10') {
  317. CirclePOINT_X = value;
  318. }
  319. else if (code == '20') {
  320. CirclePOINT_Y = value;
  321. }
  322. else if (code == '40') {
  323. Circle_R = value;
  324. this.newCircleEntityData.push([parseFloat(CirclePOINT_X), parseFloat(CirclePOINT_Y), parseFloat(Circle_R), Circle_Layer]);
  325. //EAction.handleUserWarning(CirclePOINT_X + ', ' + CirclePOINT_Y + ', ' + Circle_R + ', ' + Circle_Layer);
  326. break;
  327. }
  328. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  329. }
  330. //读取弧数据 liyz
  331. if (code == '0' && value == 'ARC') {
  332. // EAction.handleUserWarning('Arc Info...............................');
  333. var ArcPOINT_X = '';
  334. var ArcPOINT_Y = '';
  335. var Arc_R = '';
  336. var Arc_StartAngle = '';
  337. var Arc_EndAngle = '';
  338. var Arc_Layer = '';
  339. do {
  340. code = ts.readLine().trim();
  341. value = ts.readLine().trim();
  342. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  343. code = code.replace(/\r\n/g, "");
  344. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  345. value = value.replace(/\r\n/g, "");
  346. //EAction.handleUserMessage(code);
  347. //EAction.handleUserMessage(value);
  348. if (code == '8') {
  349. Arc_Layer = value;
  350. }
  351. else if (code == '10') {
  352. ArcPOINT_X = value;
  353. }
  354. else if (code == '20') {
  355. ArcPOINT_Y = value;
  356. }
  357. else if (code == '40') {
  358. Arc_R = value;
  359. }
  360. else if (code == '50') {
  361. Arc_StartAngle = value;
  362. }
  363. else if (code == '51') {
  364. Arc_EndAngle = value;
  365. this.newArcEntityData.push([parseFloat(ArcPOINT_X), parseFloat(ArcPOINT_Y), parseFloat(Arc_R), parseFloat(Arc_StartAngle), parseFloat(Arc_EndAngle), Arc_Layer]);
  366. //EAction.handleUserWarning(ArcPOINT_X + ', ' + ArcPOINT_Y + ', ' + Arc_R + ', ' + Arc_StartAngle + ', ' + Arc_EndAngle + ', ' + Arc_Layer);
  367. break;
  368. }
  369. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  370. }
  371. //读取多线段数据 liyz
  372. if (code == '0' && value == 'LWPOLYLINE') {
  373. // EAction.handleUserWarning('Polyline Info...............................');
  374. var PolyPOINT_X = '';
  375. var PolyPOINT_Y = '';
  376. var PolyPOINT_Num = 0;
  377. var Poly_Layer = '';
  378. var TempPolyLineData = new Array();
  379. do {
  380. code = ts.readLine().trim();
  381. value = ts.readLine().trim();
  382. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  383. code = code.replace(/\r\n/g, "");
  384. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  385. value = value.replace(/\r\n/g, "");
  386. //EAction.handleUserWarning(code);
  387. //EAction.handleUserWarning(value);
  388. if (code == '8') {
  389. Poly_Layer = value;
  390. }
  391. else if (code == '90') {
  392. PolyPOINT_Num = parseInt(value);
  393. //EAction.handleUserWarning(PolyPOINT_Num.toString());
  394. }
  395. else if (code == '10') {
  396. PolyPOINT_X = value;
  397. }
  398. else if (code == '20') {
  399. PolyPOINT_Y = value;
  400. TempPolyLineData.push([parseFloat(PolyPOINT_X), parseFloat(PolyPOINT_Y)]);
  401. }
  402. if (TempPolyLineData.length == PolyPOINT_Num && PolyPOINT_Num > 0) {
  403. this.newPolylineEntityData.push([TempPolyLineData, Poly_Layer]);
  404. // EAction.handleUserWarning(TempPolyLineData.toString());
  405. break;
  406. }
  407. } while (!ts.atEnd() && code != '0' && value != 'ENDSEC' && value != 'EOF');
  408. }
  409. //读取块数据 liyz
  410. if (code == '0' && value == 'BLOCK') {
  411. // EAction.handleUserWarning('Block Info...............................');
  412. var BlockName = '';
  413. var Block_X = '';
  414. var Block_Y = '';
  415. var BlockLayer = '';
  416. do {
  417. code = ts.readLine().trim();
  418. value = ts.readLine().trim();
  419. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  420. code = code.replace(/\r\n/g, "");
  421. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  422. value = value.replace(/\r\n/g, "");
  423. if (code == '8') {
  424. BlockLayer = value;
  425. }
  426. else if (code == '2') {
  427. BlockName = value;
  428. }
  429. else if (code == '10') {
  430. Block_X = value;
  431. }
  432. else if (code == '20') {
  433. Block_Y = value;
  434. this.newBlockEntityData.push([BlockName, parseFloat(Block_X), parseFloat(Block_Y), BlockLayer]);
  435. //EAction.handleUserWarning(BlockName + ', ' + Block_X + ', ' + Block_Y+ ', ' +BlockLayer);
  436. }
  437. } while (!ts.atEnd() && value != 'ENDBLK' && value != 'ENDSEC' && value != 'EOF');
  438. }
  439. //读文本数据 liyz
  440. if (code == '0' && value == 'TEXT') {
  441. EAction.handleUserWarning('TEXT Info...............................');
  442. var TextName = '';
  443. var Text_X = '';
  444. var Text_Y = '';
  445. var Text_Hight = 0.0;
  446. // var Text_angle = 0.0;
  447. //var Text_font = '';
  448. var TextLayer = '';
  449. do {
  450. code = ts.readLine().trim();
  451. value = ts.readLine().trim();
  452. code = code.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  453. code = code.replace(/\r\n/g, "");
  454. value = value.replace(/[\t]+/g, " ").replace(/[\s]+/g, " ");
  455. value = value.replace(/\r\n/g, "");
  456. if (code == '8') {
  457. TextLayer = value;
  458. }
  459. else if (code == '10') {
  460. Text_X = value;
  461. }
  462. else if (code == '20') {
  463. Text_Y = value;
  464. }
  465. else if (code == '40') {
  466. Text_Hight = value;
  467. }
  468. else if (code == '1') {
  469. TextName = value;
  470. this.newTextEntityData.push([TextName, parseFloat(Text_X), parseFloat(Text_Y), parseFloat(Text_Hight), TextLayer]);
  471. EAction.handleUserWarning(TextName + ', ' + Text_X + ', ' + Text_Y + ', ' + Text_Hight + ', ' + TextLayer);
  472. break;
  473. }
  474. } while (!ts.atEnd() && value != 'ENDBLK' && value != 'ENDSEC' && value != 'EOF');
  475. }
  476. pLineNo++;
  477. }
  478. while (!ts.atEnd());
  479. //EAction.handleUserMessage(this.newLayerData.toString());
  480. //EAction.handleUserMessage(this.newPointEntityData.toString());
  481. //EAction.handleUserMessage(this.newLineEntityData.toString());
  482. //EAction.handleUserMessage(this.newCircleEntityData.toString());
  483. //EAction.handleUserMessage(this.newArcEntityData.toString());
  484. this.applyOperation();
  485. reader.close();
  486. return true;
  487. }
  488. DXFImport.prototype.applyOperation = function (preview) {
  489. var LineColor = new RColor(105, 105, 105);
  490. var PointColor = new RColor(255, 0, 0);
  491. var CircleColor = new RColor(255, 255, 255);
  492. var ArcColor = new RColor(0, 255, 0);
  493. //添加图层 liyz
  494. for (var i = 0; i < this.newLayerData.length; i++) {
  495. addLayerToView(this.newLayerData[i][0], null/*this.newLayerData[i][1]*/, this.newLayerData[i][2], parseInt(this.newLayerData[i][3]), 1);
  496. //addLayerToView(this.newLayerData[i][0], null, null, null, 0);
  497. }
  498. //绘制点 liyz
  499. for (var i = 0; i < this.newPointEntityData.length; i++) {
  500. addPointToView(this.newPointEntityData[i][0], this.newPointEntityData[i][1], 1);
  501. }
  502. //绘制线 liyz
  503. for (var i = 0; i < this.newLineEntityData.length; i++) {
  504. addLineToView(this.newLineEntityData[i][0], this.newLineEntityData[i][1], this.newLineEntityData[i][2], this.newLineEntityData[i][3], 1);
  505. }
  506. //绘制多线段 liyz
  507. for (var i = 0; i < this.newPolylineEntityData.length; i++) {
  508. addPolylinetoView(this.newPolylineEntityData[i][0], false, false, 1, LineColor);
  509. }
  510. //绘制圆 liyz
  511. for (var i = 0; i < this.newCircleEntityData.length; i++) {
  512. addCircleToView(this.newCircleEntityData[i][0], this.newCircleEntityData[i][1], this.newCircleEntityData[i][2], 1, CircleColor);
  513. }
  514. //绘制弧 liyz
  515. for (var i = 0; i < this.newArcEntityData.length; i++) {
  516. addArctoView(this.newArcEntityData[i][0], this.newArcEntityData[i][1], this.newArcEntityData[i][2],
  517. this.newArcEntityData[i][3], this.newArcEntityData[i][4], false, 1, ArcColor);
  518. }
  519. //绘制文字 liyz
  520. for (var i = 0; i < this.newTextEntityData.length; i++) {
  521. addSimpleTextToView(this.newTextEntityData[i][0], this.newTextEntityData[i][1], this.newTextEntityData[i][2],
  522. this.newTextEntityData[i][3], null, null, null, null, null, null, 1);
  523. }
  524. var di = getAssignDocumentInterface(1);
  525. if (!isNull(di)) {
  526. // di.regenerateScenes();
  527. di.autoZoom();
  528. }
  529. return true;
  530. }