1 /** 2 * UGENE - Integrated Bioinformatics Tools. 3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru> 4 * http://ugene.net 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program 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 this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 */ 21 22 #ifndef _U2_EXTRACT_ASSEMBLY_TASK_H_ 23 #define _U2_EXTRACT_ASSEMBLY_TASK_H_ 24 25 #include <U2Core/BaseDocumentFormats.h> 26 #include <U2Core/Task.h> 27 #include <U2Core/U2Region.h> 28 29 namespace U2 { 30 31 class AssemblyObject; 32 class DocumentProviderTask; 33 class ExtractAssemblyRegionTask; 34 35 struct ExtractAssemblyRegionTaskSettings { ExtractAssemblyRegionTaskSettingsExtractAssemblyRegionTaskSettings36 ExtractAssemblyRegionTaskSettings(QString fileUrl, int assemblyLength, AssemblyObject *o) 37 : fileUrl(fileUrl), regionToExtract(U2_REGION_MAX), 38 fileFormat(BaseDocumentFormats::UGENEDB), assemblyLength(assemblyLength), obj(o), addToProject(false) { 39 } 40 QString fileUrl; 41 U2Region regionToExtract; 42 DocumentFormatId fileFormat; 43 int assemblyLength; 44 AssemblyObject *obj; 45 bool addToProject; 46 }; 47 48 class ExtractAssemblyRegionAndOpenViewTask : public Task { 49 Q_OBJECT 50 public: 51 ExtractAssemblyRegionAndOpenViewTask(const ExtractAssemblyRegionTaskSettings &settings); 52 53 void prepare(); 54 55 QList<Task *> onSubTaskFinished(Task *subTask); 56 57 private: 58 ExtractAssemblyRegionTaskSettings settings; 59 ExtractAssemblyRegionTask *extractTask; 60 }; 61 62 class ExtractAssemblyRegionTask : public Task { 63 Q_OBJECT 64 public: 65 ExtractAssemblyRegionTask(const ExtractAssemblyRegionTaskSettings &settings); 66 67 void run(); 68 69 private: 70 ExtractAssemblyRegionTaskSettings settings; 71 }; 72 73 } // namespace U2 74 75 #endif 76