/**************************************************************************** Copyright (C) 2010-2012 the Office National des Forêts (ONF), France All rights reserved. Contact : alexandre.piboule@onf.fr Developers : Alexandre PIBOULE (ONF) This file is part of PluginONF library. PluginONF 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. PluginONF 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 PluginONF. If not, see . *****************************************************************************/ #include "onf_filterbyintensity.h" #include "ct_pointcloudindex/ct_pointcloudindexvector.h" #include "ct_iterator/ct_pointiterator.h" #include "ct_view/ct_genericconfigurablewidget.h" ONF_FilterByIntensity::ONF_FilterByIntensity(QString pluginName) : CT_AbstractFilter_LAS(pluginName) { _intensityThreshold = false; } ONF_FilterByIntensity::ONF_FilterByIntensity(const ONF_FilterByIntensity &other) : CT_AbstractFilter_LAS(other) { _intensityThreshold = other._intensityThreshold; } QString ONF_FilterByIntensity::getShortDisplayableName() const { return tr("Filtrer par intensité"); } QString ONF_FilterByIntensity::getDetailledDisplayableName() const { return tr("Filtrer par intensité"); } CT_AbstractConfigurableWidget* ONF_FilterByIntensity::createConfigurationWidget() { CT_GenericConfigurableWidget* configDialog = new CT_GenericConfigurableWidget(); configDialog->addInt(tr("Seuil d'intensité"), "", 0, 65535, _intensityThreshold); return configDialog; } QString ONF_FilterByIntensity::getShortDescription() const { return tr("Filtrer par intensité"); } QString ONF_FilterByIntensity::getDetailledDescription() const { return tr("Ne conserve que les points dont l'intesité est supérieure au seuil."); } void ONF_FilterByIntensity::saveSettings(SettingsWriterInterface &writer) const { SuperClass::saveSettings(writer); writer.addParameter(this, "intensityThreshold", _intensityThreshold); } bool ONF_FilterByIntensity::restoreSettings(SettingsReaderInterface &reader) { if(!SuperClass::restoreSettings(reader)) return false; QVariant value; if(reader.parameter(this, "filterByClassif", value)) _intensityThreshold = value.toDouble(); return true; } CT_AbstractConfigurableElement *ONF_FilterByIntensity::copy() const { return new ONF_FilterByIntensity(*this); } bool ONF_FilterByIntensity::validatePoint(const CT_PointIterator &pointIt, const CT_LASData &LASData) { Q_UNUSED(pointIt) if (LASData._Intensity < _intensityThreshold) {return false;} return true; }