/**************************************************************************** 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 . *****************************************************************************/ #ifndef ONF_ACTIONMODIFYDEM_H #define ONF_ACTIONMODIFYDEM_H #include #include "ctlibaction/ct_actions/abstract/ct_abstractactionforgraphicsview.h" #include "ct_itemdrawable/ct_scene.h" #include "ct_itemdrawable/ct_image2d.h" #include "tools/onf_colorlinearinterpolator.h" /** * @brief Action to select items, points, faces, edges, etc... * * You can use this action in your action if you want. Just call methods : * * init() * mousePressEvent() * etc..... * * in methods of your action. * * Dont forget to set the selection mode => setSelectionMode method */ class ONF_ActionModifyDEM : public CT_AbstractActionForGraphicsView { Q_OBJECT public: ONF_ActionModifyDEM(CT_AbstractItemDrawableWithPointCloud* scene, const CT_Image2D* originalDEM, CT_Image2D* modifiedDEM, const CT_AbstractImage2D* inred, const CT_AbstractImage2D* ingreen, const CT_AbstractImage2D* inblue); QString uniqueName() const override; QString title() const override; QString description() const override; QIcon icon() const override; QString type() const override; void init() override; bool mousePressEvent(QMouseEvent *e) override; bool mouseMoveEvent(QMouseEvent *e) override; bool mouseReleaseEvent(QMouseEvent *e) override; bool keyPressEvent(QKeyEvent *e) override; bool keyReleaseEvent(QKeyEvent *e) override; void drawOverlay(GraphicsViewInterface &view, QPainter &painter) override; CT_AbstractAction* createInstance() const override; /** * @brief change the selection mode for this action. The mode will be set to view * when the mousePressEvent() method is called * @return false if we are between mousePressEvent() and mouseReleaseEvent() */ bool setSelectionMode(GraphicsViewInterface::SelectionMode mode); GraphicsViewInterface::SelectionMode selectionMode() const; public slots: void colorizePoints(); void redraw(); void levelPoints(bool up, bool maxed); void razPoints(); void smooth(); private: QRect m_selectionRectangle; int m_status; GraphicsViewInterface::SelectionMode m_selectionMode; bool m_mousePressed; double _amplitudeRed; double _amplitudeGreen; double _amplitudeBlue; CT_AbstractItemDrawableWithPointCloud* _scene; const CT_Image2D* _originalDEM; CT_Image2D* _modifiedDEM; const CT_AbstractImage2D* _inred; const CT_AbstractImage2D* _ingreen; const CT_AbstractImage2D* _inblue; ONF_ColorLinearInterpolator _gradientGrey; GraphicsViewInterface::SelectionMode selectionModeToBasic(GraphicsViewInterface::SelectionMode mode) const; }; #endif // ONF_ACTIONMODIFYDEM_H