digit.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef WXVDIGIT_DIGIT_H
  2. #define WXVDIGIT_DIGIT_H
  3. #define GSQL_MAX 4000
  4. #include <vector>
  5. #include <map>
  6. class Digit
  7. {
  8. private:
  9. /* layer / max category */
  10. std::map<int, int> cats;
  11. DisplayDriver *display;
  12. int SetCategory(int, int);
  13. struct Map_info** OpenBackgroundVectorMap(const char *);
  14. int BreakLineAtIntersection(int, struct line_pnts*, int);
  15. int AddActionsBefore(void);
  16. void AddActionsAfter(int, int);
  17. /* settings */
  18. struct _settings {
  19. bool breakLines;
  20. bool addCentroid;
  21. bool catBoundary;
  22. } settings;
  23. /* undo/redo */
  24. enum action_type { ADD, DEL };
  25. struct action_meta {
  26. action_type type;
  27. int line;
  28. long offset;
  29. };
  30. std::map<int, std::vector<action_meta> > changesets;
  31. int changesetCurrent; /* first changeset to apply */
  32. int changesetEnd; /* last changeset to be applied */
  33. int AddActionToChangeset(int, action_type, int);
  34. int ApplyChangeset(int, bool);
  35. void FreeChangeset(int);
  36. int RemoveActionFromChangeset(int, action_type, int);
  37. public:
  38. Digit(DisplayDriver *, wxWindow *);
  39. ~Digit();
  40. int InitCats();
  41. int AddLine(int, std::vector<double>, int, int,
  42. const char*, int, double);
  43. int RewriteLine(int, std::vector<double>,
  44. const char*, int, double);
  45. int SplitLine(double, double, double,
  46. double);
  47. int DeleteLines(bool);
  48. int MoveLines(double, double, double,
  49. const char*, int, double);
  50. int FlipLines();
  51. int MergeLines();
  52. int BreakLines();
  53. int SnapLines(double);
  54. int ConnectLines(double);
  55. int TypeConvLines();
  56. int ZBulkLabeling(double, double, double, double,
  57. double, double);
  58. int CopyLines(std::vector<int>, const char*);
  59. int MoveVertex(double, double, double,
  60. double, double, double,
  61. const char*, int,
  62. double, double);
  63. int ModifyLineVertex(int, double, double, double,
  64. double);
  65. std::vector<int> SelectLinesByQuery(double, double, double,
  66. double, double, double, bool,
  67. int, int, double);
  68. double GetLineLength(int);
  69. double GetAreaSize(int);
  70. double GetAreaPerimeter(int);
  71. int CopyCats(std::vector<int>, std::vector<int>, bool);
  72. int GetCategory(int);
  73. std::map<int, std::vector<int> > GetLineCats(int);
  74. int SetLineCats(int, int, std::vector<int>, bool);
  75. std::vector<int> GetLayers();
  76. int Undo(int);
  77. int GetUndoLevel();
  78. void UpdateSettings(bool,
  79. bool, bool);
  80. };
  81. #endif /* WXVDIGIT_DIGIT_H */