File indexing completed on 2024-04-28 05:38:12

0001 /***************************************************************************
0002  *   Copyright (C) 2015 by Renaud Guezennec                                *
0003  *   https://rolisteam.org/contact                   *
0004  *                                                                         *
0005  *   rolisteam is free software; you can redistribute it and/or modify     *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 
0021 #ifndef SIGHTITEM_H
0022 #define SIGHTITEM_H
0023 
0024 #include "characteritem.h"
0025 #include "data/charactervision.h"
0026 #include "rwidgets_global.h"
0027 #include "visualitem.h"
0028 #include <QConicalGradient>
0029 #include <QGradient>
0030 #include <QRadialGradient>
0031 /*class FogSingularity
0032 {
0033 public:
0034     FogSingularity(QPolygonF* poly= nullptr, bool isAdding= false);
0035     const QPolygonF* getPolygon() const;
0036 
0037     bool isAdding() const;
0038     void fillMessage(NetworkMessageWriter* msg);
0039     void readItem(NetworkMessageReader* msg);
0040     void setPolygon(QPolygonF*);
0041 
0042 private:
0043     QPolygonF* m_poly;
0044     bool m_adding;
0045 };*/
0046 namespace vmap
0047 {
0048 class SightController;
0049 }
0050 /**
0051  * @brief The SightItem class
0052  */
0053 class RWIDGET_EXPORT SightItem : public VisualItem
0054 {
0055     Q_OBJECT
0056 public:
0057     /**
0058      * @brief SightItem
0059      * @param characterItemMap
0060      */
0061     explicit SightItem(vmap::SightController* ctrl);
0062     /**
0063      * @brief ~SightItem
0064      */
0065     virtual ~SightItem();
0066     /**
0067      * @brief setNewEnd
0068      * @param nend
0069      */
0070     virtual void setNewEnd(const QPointF& nend) override;
0071     /**
0072      * @brief boundingRect
0073      * @return
0074      */
0075     virtual QRectF boundingRect() const override;
0076     // void monitorView();
0077     /**
0078      * @brief paint
0079      * @param painter
0080      * @param option
0081      * @param widget
0082      */
0083     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
0084     virtual void updateItemFlags() override;
0085 public slots:
0086     /**
0087      * @brief moveVision
0088      * @param id
0089      * @param pos
0090      */
0091     void moveVision(qreal id, QPointF& pos);
0092     /**
0093      * @brief removeVision vision to the given character.
0094      * @param item
0095      */
0096     // void removeVision(CharacterItem* item);
0097 private:
0098     QPointer<vmap::SightController> m_sightCtrl;
0099 };
0100 
0101 #endif // SIGHTITEM_H