/** * Copyright (c) 2011-2016 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("../Modify.js"); include("scripts/ShapeAlgorithms.js"); function Explode(guiAction) { Modify.call(this, guiAction); } Explode.prototype = new Modify(); Explode.getPreferencesCategory = function() { return [qsTr("Modify"), qsTr("Explode")]; }; Explode.prototype.beginEvent = function() { Modify.prototype.beginEvent.call(this); var di = this.getDocumentInterface(); Explode.explodeSelection(di, this); this.terminate(); }; /** * Explodes all selected entities. * \param di Document interface * \param action Action object (used to assign text to transaction), optional */ Explode.explodeSelection = function(di, action) { var document = di.getDocument(); var storage = document.getStorage(); var ids = document.querySelectedEntities(); var i, k, e, n; var polyline, shapes, shape; var op = new RAddObjectsOperation(); if (!isNull(action)) { op.setText(action.getToolTitle()); } for (i=0; i0) { for (k=0; k1 || data.getRowCount()>1) { for (var col=0; col