/**************************************************************************** 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_stepgenerateray.h" GEN_StepGenerateRay::GEN_StepGenerateRay() : SuperClass() { _posX = 0; _posY = 0; _posZ = 0; _dirX = 1; _dirY = 1; _dirZ = 1; } QString GEN_StepGenerateRay::description() const { return tr("Créer un Rayon"); } CT_VirtualAbstractStep* GEN_StepGenerateRay::createNewInstance() const { return new GEN_StepGenerateRay(); } //////////////////// PROTECTED METHODS ////////////////// void GEN_StepGenerateRay::declareInputModels(CT_StepInModelStructureManager& manager) { manager.setNotNeedInputResult(); } void GEN_StepGenerateRay::declareOutputModels(CT_StepOutModelStructureManager& manager) { manager.addResult(m_hOutResult, tr("Generated Item")); manager.setRootGroup(m_hOutResult, m_hOutRootGroup); manager.addItem(m_hOutRootGroup, m_hOutBeam, tr("Generated Beam")); } void GEN_StepGenerateRay::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("Direction"), "", ""); postInputConfigDialog->addDouble("X", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _dirX); postInputConfigDialog->addDouble("Y", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _dirY); postInputConfigDialog->addDouble("Z", "", -std::numeric_limits::max(), std::numeric_limits::max(), 4, _dirZ); } void GEN_StepGenerateRay::compute() { assert(!(_dirX == 0 && _dirY == 0 && _dirZ == 0)); if (_dirX == 0 && _dirY == 0 && _dirZ == 0) {qDebug() << "GEN_StepGenerateRay::compute" << ", " << "_dirX == 0 && _dirY == 0 && _dirZ == 0";} for(CT_ResultGroup* result : m_hOutResult.iterateOutputs()) { CT_StandardItemGroup* rootGroup = m_hOutRootGroup.createInstance(); result->addRootGroup(m_hOutRootGroup, rootGroup); CT_Beam* itemOut_itemRay = new CT_Beam(Eigen::Vector3d(_posX, _posY, _posZ), Eigen::Vector3d(_dirX, _dirY, _dirZ)); rootGroup->addSingularItem(m_hOutBeam, itemOut_itemRay); } }