File indexing completed on 2024-05-12 05:39:54
0001 /*************************************************************************** 0002 * Copyright (C) 2020 by Renaud Guezennec * 0003 * http://www.rolisteam.org/contact * 0004 * * 0005 * This software 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 #ifndef VECTORIALMAPMESSAGEHELPER_H 0021 #define VECTORIALMAPMESSAGEHELPER_H 0022 0023 #include <QHash> 0024 #include <QString> 0025 #include <QVariant> 0026 #include <core_global.h> 0027 #include <map> 0028 0029 class VectorialMapController; 0030 class NetworkMessageReader; 0031 class Character; 0032 class CharacterVision; 0033 namespace vmap 0034 { 0035 class CharacterItemController; 0036 class VisualItemController; 0037 class SightController; 0038 } // namespace vmap 0039 class CORE_EXPORT VectorialMapMessageHelper 0040 { 0041 public: 0042 VectorialMapMessageHelper(); 0043 0044 // send off ITEMS 0045 static void sendOffNewItem(const std::map<QString, QVariant>& args, const QString& mapId); 0046 static void sendOffHighLight(const QPointF& p, const qreal& penSize, const QColor& color, const QString& mapId); 0047 static void readHighLight(VectorialMapController* ctrl, NetworkMessageReader* msg); 0048 static void sendOffRemoveItems(const QStringList ids, const QString& mapId); 0049 static QStringList readRemoveItems(NetworkMessageReader* msg); 0050 0051 // read message items 0052 static void readVectorialMapController(VectorialMapController* ctrl, const QByteArray& array); 0053 static QByteArray saveVectorialMap(VectorialMapController* ctrl); 0054 static void fetchModelFromMap(const QHash<QString, QVariant>& params, VectorialMapController* ctrl, bool isRemote); 0055 static QHash<QString, QVariant> itemsToHash(const QList<vmap::VisualItemController*>& ctrls); 0056 static void fetchSightController(vmap::SightController* ctrl,const QHash<QString, QVariant>& params); 0057 0058 // CharaterItem controller 0059 static void fetchCharacterItem(const std::map<QString, QVariant>& params, vmap::CharacterItemController* ctrl); 0060 static void fetchCharacter(const std::map<QString, QVariant>& params, Character* character); 0061 static void fetchCharacterVision(const std::map<QString, QVariant>& params, CharacterVision* vision); 0062 }; 0063 0064 #endif // VECTORIALMAPMESSAGEHELPER_H