| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /**
- * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved.
- *
- * This file is part of the QCAD project.
- *
- * QCAD is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * QCAD is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with QCAD.
- */
- include("scripts/library.js");
- include("scripts/File/File.js");
- include("scripts/Layer/Layer.js");
- /**
- * \class NewFile
- * \brief Creates a new document.
- * \ingroup ecma_file
- */
- function CloseProject(guiAction) {
- File.call(this, guiAction);
- }
- CloseProject.prototype = new File();
- CloseProject.includeBasePath = includeBasePath;
- /**
- * \param isOpen True if new is called from a file open function.
- */
- CloseProject.prototype.beginEvent = function () {
- var appWin = EAction.getMainWindow();
- var prjName = RSettings.getStringValue("OpenProject/Current", "");
- RSettings.setValue("OpenProject/Current", "");
- QMessageBox.information(appWin, qsTr("提示"), qsTr("已关闭工程:" + prjName));
- RSettings.setValue("OpenDisplayFile/PMFile", "");
- RSettings.setValue("OpenDisplayFile/ZDMFile", "");
- // 删除全部的PM
- var di1 = getAssignDocumentInterface(1);
- var document1 = getAssignDocument(1);
- var ids = document1.queryAllEntities();
- var op = new RDeleteObjectsOperation();
- for (i = 0; i < ids.length; i++) {
- var id = ids[i];
- op.deleteObject(document1.queryEntity(id));
- }
- di1.applyOperation(op);
- di1.clearPreview();
- di1.repaintViews();
- // 删除图层
- // Layer.removeAll(di1);
- // 删除全部的ZDM
- var di0 = getAssignDocumentInterface(0);
- var document0 = getAssignDocument(0);
- var ids0 = document0.queryAllEntities();
- var op0 = new RDeleteObjectsOperation();
- for (i = 0; i < ids0.length; i++) {
- var id = ids0[i];
- op0.deleteObject(document0.queryEntity(id));
- }
- di0.applyOperation(op0);
- di0.clearPreview();
- di0.repaintViews();
- // 删除图层
- // Layer.removeAll(di0);
- return;
- };
|