AcPlPlotInfoValidator.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef _ACPLPLOTINFOVALIDATOR_H
  11. #define _ACPLPLOTINFOVALIDATOR_H
  12. #include "AcPlObject.h"
  13. #include "AcPlPlotInfo.h"
  14. class AcPlPlotInfo;
  15. // Default media matching weights
  16. #define DEFAULT_MEDIA_GROUP_WEIGHT 50
  17. #define DEFAULT_SHEET_MEDIA_GROUP_WEIGHT 10
  18. #define DEFAULT_MEDIA_BOUNDS_WEIGHT 100
  19. #define DEFAULT_PRINTABLE_BOUNDS_WEIGHT 10
  20. #define DEFAULT_DIMENSIONAL_WEIGHT 50
  21. #define DEFAULT_SHEET_DIMENSIONAL_WEIGHT 10
  22. #define DEFAULT_THRESHOLD 500
  23. class AcPlPlotInfoValidator : public AcPlObject
  24. {
  25. public:
  26. ACPL_PORT AcPlPlotInfoValidator();
  27. ACPL_PORT virtual ~AcPlPlotInfoValidator();
  28. ACPL_DECLARE_MEMBERS(AcPlPlotInfoValidator);
  29. public:
  30. // Supported media matching policies
  31. enum MatchingPolicy {
  32. kMatchDisabled = 1, // no media matching (default)
  33. kMatchEnabled, // look for matching media and use if found
  34. kMatchEnabledCustom, // create and save custom media size if necessary
  35. kMatchEnabledTmpCustom // create temporary custom media size if necessary
  36. };
  37. // Possible result codes from isCustomPossible()
  38. enum eCustomSizeResult {
  39. ePossible = 0x0000,
  40. eMustCreatePC3 = 0x0001, // no PC3 file, one is required
  41. eRotationRequired = 0x0002, // size only possible with 90 degree rotation
  42. ePC3DirReadOnly = 0x0004,
  43. ePMPDirReadOnly = 0x0008,
  44. ePMPDirMissing = 0x0010,
  45. eUnknownErrPMPDir = 0x0020,
  46. ePC3FileReadOnly = 0x0040,
  47. eSizeTooBig = 0x0080,
  48. eException = 0x0100,
  49. eUnknownErrPC3File = 0x0200,
  50. eUnknownErrPMPFile = 0x0400,
  51. ePMPFileReadOnly = 0x0800,
  52. eWidthAndHeightMustBePositive = 0x1000,
  53. eDeviceLoadFailed = 0x2000
  54. };
  55. // Validate an AcPlPlotInfo object
  56. ACPL_PORT virtual Acad::ErrorStatus validate(AcPlPlotInfo& info);
  57. // Returns a bitwise-OR of eCustomSizeResults bits indicating whether
  58. // a custom size is possible for the plot info object provided, using the
  59. // current media size and device specified in the info object.
  60. ACPL_PORT virtual unsigned long isCustomPossible(AcPlPlotInfo& info) const;
  61. // Media matching policy used by validator
  62. ACPL_PORT void setMediaMatchingPolicy(MatchingPolicy policy);
  63. ACPL_PORT MatchingPolicy matchingPolicy() const;
  64. // Media matching weights
  65. ACPL_PORT void setMediaGroupWeight(unsigned int weight = DEFAULT_MEDIA_GROUP_WEIGHT);
  66. ACPL_PORT unsigned int mediaGroupWeight() const;
  67. ACPL_PORT void setSheetMediaGroupWeight(unsigned int weight = DEFAULT_SHEET_MEDIA_GROUP_WEIGHT);
  68. ACPL_PORT unsigned int sheetMediaGroupWeight() const;
  69. ACPL_PORT void setMediaBoundsWeight(unsigned int weight = DEFAULT_MEDIA_BOUNDS_WEIGHT);
  70. ACPL_PORT unsigned int mediaBoundsWeight() const;
  71. ACPL_PORT void setPrintableBoundsWeight(unsigned int weight = DEFAULT_PRINTABLE_BOUNDS_WEIGHT);
  72. ACPL_PORT unsigned int printableBoundsWeight() const;
  73. ACPL_PORT void setDimensionalWeight(unsigned int weight = DEFAULT_DIMENSIONAL_WEIGHT);
  74. ACPL_PORT unsigned int dimensionalWeight() const;
  75. ACPL_PORT void setSheetDimensionalWeight(unsigned int weight = DEFAULT_SHEET_DIMENSIONAL_WEIGHT);
  76. ACPL_PORT unsigned int sheetDimensionalWeight() const;
  77. // Media matching threshold
  78. ACPL_PORT void setMediaMatchingThreshold(unsigned int threshold = DEFAULT_THRESHOLD);
  79. ACPL_PORT unsigned int mediaMatchingThreshold() const;
  80. protected:
  81. // Media matching members
  82. unsigned int m_mediaBoundsWeight;
  83. unsigned int m_dimensionalWeight;
  84. unsigned int m_mediaGroupWeight;
  85. unsigned int m_printableBoundsWeight;
  86. unsigned int m_sheetDimensionalWeight;
  87. unsigned int m_sheetMediaGroupWeight;
  88. unsigned int m_matchingThreshold;
  89. MatchingPolicy m_matchingPolicy;
  90. };
  91. #endif // _ACPLPLOTINFOVALIDATOR_H