/**************************************************************************** Copyright (C) 2010-2021 the Office National des Forêts (ONF), France All rights reserved. Contact : alexandre.piboule@onf.fr Developers : Michael Krebbs (Independant) Alexandre PIBOULE (ONF) This file is part of PluginGenerate library. PluginGenerate is free library: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PluginGenerate 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 Lesser General Public License along with PluginGenerate. If not, see . *****************************************************************************/ #include "gen_stepgeneratescanner.h" GEN_StepGenerateScanner::GEN_StepGenerateScanner() : SuperClass() { _posX = 0; _posY = 0; _posZ = 0; _initTheta = 0; _initPhi = 0; _hFov = 360; _vFov = 120; _hRes = 0.036; _vRes = 0.036; _clockWise = true; } QString GEN_StepGenerateScanner::description() const { return tr("Créer une Position de Scan"); } CT_VirtualAbstractStep* GEN_StepGenerateScanner::createNewInstance() const { return new GEN_StepGenerateScanner(); } //////////////////// PROTECTED METHODS ////////////////// void GEN_StepGenerateScanner::declareInputModels(CT_StepInModelStructureManager& manager) { manager.setNotNeedInputResult(); } void GEN_StepGenerateScanner::declareOutputModels(CT_StepOutModelStructureManager& manager) { manager.addResult(m_hOutResult, tr("Generated Item")); manager.setRootGroup(m_hOutResult, m_hOutRootGroup); manager.addItem(m_hOutRootGroup, m_hOutScanner, tr("Generated Scanner")); } void GEN_StepGenerateScanner::fillPostInputConfigurationDialog(CT_StepConfigurableDialog* postInputConfigDialog) { postInputConfigDialog->addText(tr("Position"), "", ""); postInputConfigDialog->addDouble("X", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _posX); postInputConfigDialog->addDouble("Y", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _posY); postInputConfigDialog->addDouble("Z", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _posZ); postInputConfigDialog->addText(tr("Initial angles"), "", ""); postInputConfigDialog->addDouble(tr("Theta"), tr("degres"), 0, 360, 4, _initTheta); postInputConfigDialog->addDouble(tr("Phi"), tr("degres"), 0, 180, 4, _initPhi); postInputConfigDialog->addText(tr("Field of view"), "", ""); postInputConfigDialog->addDouble(tr("Theta"), tr("degres"), -std::numeric_limits::max(), std::numeric_limits::max(), 4, _hFov); postInputConfigDialog->addDouble(tr("Phi"), tr("degres"), 0.0001, 180, 4, _vFov); postInputConfigDialog->addText(tr("Resolution"), "", ""); postInputConfigDialog->addDouble(tr("Theta"), tr("degres"), 0.0001, std::numeric_limits::max(), 4, _hRes); postInputConfigDialog->addDouble(tr("Phi"), tr("degres"), 0.0001, std::numeric_limits::max(), 4, _vRes); postInputConfigDialog->addEmpty(); postInputConfigDialog->addBool(tr("Clockwise"), "", "", _clockWise); } void GEN_StepGenerateScanner::compute() { for(CT_ResultGroup* result : m_hOutResult.iterateOutputs()) { CT_StandardItemGroup* rootGroup = m_hOutRootGroup.createInstance(); result->addRootGroup(m_hOutRootGroup, rootGroup); CT_Scanner* itemOut_itemScanner = new CT_Scanner(0, Eigen::Vector3d(_posX, _posY, _posZ), Eigen::Vector3d(0,0,1), _hFov, _vFov, _hRes, _vRes, _initTheta, _initPhi, _clockWise); rootGroup->addSingularItem(m_hOutScanner, itemOut_itemScanner); } }