redream.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef REDREAM_H
  2. #define REDREAM_H
  3. #include <QString>
  4. #include <boost/any.hpp>
  5. #include <map>
  6. #include <QList>
  7. typedef std::map<std::string, boost::any> PlistDict;
  8. typedef std::vector<boost::any> PlistArray;
  9. class Redream
  10. {
  11. public:
  12. static Redream* getInstance();
  13. /**
  14. * @brief 创建房间时创建一个red模版
  15. * @return
  16. */
  17. bool createRedream(QString filePath);
  18. /**
  19. * @brief 创建物件时导入red文件
  20. * @return
  21. */
  22. void addObjectToRedream(std::string filePath, std::vector<std::string> object);
  23. /**
  24. * @brief 从red文件中删除一个物件
  25. * @return
  26. */
  27. void deleteObjectFromRedream(std::string filePath, std::vector<std::string> object);
  28. /**
  29. * @brief 从red文件中获取时间线信息
  30. * @return
  31. */
  32. QList<QString> getTimelineFromRedream(std::string filePath);
  33. /**
  34. * @brief 创建家具时导入red文件
  35. * @return
  36. */
  37. void addFurnitureToRedream(std::string filePath, std::string furnitureId);
  38. /**
  39. * @brief 从red文件中删除一个家具
  40. * @return
  41. */
  42. void deleteFurnitureFromRedream(std::string filePath, std::string furnitureId);
  43. /**
  44. * @brief 查询家具的位置信息
  45. * @return
  46. */
  47. std::array<qreal, 2> getFurniturePos(std::string filePath, std::string furnitureId);
  48. /**
  49. * @brief 误操作可能会导致家具节点丢失, 检查家具是否丢失,如果已丢失,则在特定地方重新创建一下
  50. * @return
  51. */
  52. void checkFurnitureIsLost(std::string filePath, std::string furnitureId);
  53. //redream节点丢失问题
  54. void syncAllFurnitureRedreamNodes(QString roomId);
  55. int getFurnitureLocalZOrder(std::string filePath, std::string furnitureId);
  56. private:
  57. PlistDict _addChildren(std::string furnitureId);
  58. PlistArray _addProperties(std::string furnitureId);
  59. };
  60. #endif // REDREAM_H