DXFImport.js 22 KB

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