[4] | 1 | #ifndef _EXPORTER_H_ |
---|
| 2 | #define _EXPORTER_H_ |
---|
| 3 | |
---|
| 4 | #include <QtXml> |
---|
| 5 | |
---|
| 6 | namespace projection |
---|
| 7 | { |
---|
| 8 | |
---|
| 9 | /** |
---|
| 10 | * Projection settings export class. |
---|
| 11 | */ |
---|
| 12 | class Exporter |
---|
| 13 | { |
---|
| 14 | public: |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * Constructor. |
---|
| 18 | * |
---|
| 19 | * @param pModel Projection model. |
---|
| 20 | */ |
---|
| 21 | Exporter(ProjectionModel* pModel); |
---|
| 22 | |
---|
| 23 | /** |
---|
| 24 | * Destructor. |
---|
| 25 | */ |
---|
| 26 | virtual ~Exporter(); |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * Enable or disable soft edge blending. |
---|
| 30 | * |
---|
| 31 | * @param bSoftEdge True if soft edge blending is enabled. |
---|
| 32 | */ |
---|
| 33 | void setSoftEdge(bool bSoftEdgeBlend); |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * Check whether sof edge blending is enabled or not. |
---|
| 37 | * |
---|
| 38 | * @return True if soft edge blending is enabled. |
---|
| 39 | */ |
---|
| 40 | bool getSoftEdge() const { return m_bSoftEdge; } |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * Set width of the soft edge blending. |
---|
| 44 | * |
---|
| 45 | * @param blendWidth Width of the soft edge blending. |
---|
| 46 | */ |
---|
| 47 | void setBlendEdgeWidth(int blendEdgeWidth); |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * Retrieve width of the soft edge blending. |
---|
| 51 | * |
---|
| 52 | * @return Width of the soft edge blending. |
---|
| 53 | */ |
---|
| 54 | int getBlendEdgeWidth() const { return m_blendEdgeWidth; } |
---|
| 55 | |
---|
| 56 | /** |
---|
| 57 | * Set gamma curve of blend map edge. |
---|
| 58 | * |
---|
| 59 | * @param gamma Curve exponent of blend map edge. |
---|
| 60 | */ |
---|
| 61 | void setBlendEdgeExponent(float blendEdgeExponent); |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | * Retrieve curve exponent of blend map edge. |
---|
| 65 | * |
---|
| 66 | * @return Curve exponent of blend map edge. |
---|
| 67 | */ |
---|
| 68 | float getBlendEdgeExponent() const { return m_blendEdgeExponent; } |
---|
| 69 | |
---|
| 70 | /** |
---|
| 71 | * Set width of distortion map to export. |
---|
| 72 | * |
---|
| 73 | * @param width Width of distortion map to export. |
---|
| 74 | */ |
---|
| 75 | void setExportWidth(int exportWidth); |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * Retrieve width of distortion map to export. |
---|
| 79 | * |
---|
| 80 | * @return Width of distortion map to export. |
---|
| 81 | */ |
---|
| 82 | int getExportWidth() const { return m_exportWidth; } |
---|
| 83 | |
---|
| 84 | /** |
---|
| 85 | * Set height of distortion map to export. |
---|
| 86 | * |
---|
| 87 | * @param height Height of distortion map to export. |
---|
| 88 | */ |
---|
| 89 | void setExportHeight(int exportHeight); |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | * Retrieve height of distortion map to export. |
---|
| 93 | * |
---|
| 94 | * @return Height of distortion map to export. |
---|
| 95 | */ |
---|
| 96 | int getExportHeight() const { return m_exportHeight; } |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * Set file name pattern of distortion map file. |
---|
| 100 | * |
---|
| 101 | * @param pattern File name pattern of distortion map file. |
---|
| 102 | */ |
---|
| 103 | void setDistortMapFileNamePattern(const QString& pattern) { m_distortMapFileNamePattern = pattern; } |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * Retrieve file name pattern of distortion map file. |
---|
| 107 | * |
---|
| 108 | * @return File name pattern of distortion map file. |
---|
| 109 | */ |
---|
| 110 | QString getDistortMapFileNamePattern() const { return m_distortMapFileNamePattern; } |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * Set file name pattern of blend map file. |
---|
| 114 | * |
---|
| 115 | * @param pattern File name pattern of blend map file. |
---|
| 116 | */ |
---|
| 117 | void setBlendMapFileNamePattern(const QString& pattern) { m_blendMapFileNamePattern = pattern; } |
---|
| 118 | |
---|
| 119 | /** |
---|
| 120 | * Retrieve file name pattern of blend map file. |
---|
| 121 | * |
---|
| 122 | * @return File name pattern of blend map file. |
---|
| 123 | */ |
---|
| 124 | QString getBlendMapFileNamePattern() const { return m_blendMapFileNamePattern; } |
---|
| 125 | |
---|
| 126 | /** |
---|
| 127 | * Set file name pattern of rendering matrix file. |
---|
| 128 | * |
---|
| 129 | * @param pattern File name pattern of view matrix file. |
---|
| 130 | */ |
---|
| 131 | void setViewMatrixFileNamePattern(const QString& pattern) { m_viewMatrixFileNamePattern = pattern; } |
---|
| 132 | |
---|
| 133 | /** |
---|
| 134 | * Retrieve file name pattern of view matrix file. |
---|
| 135 | * |
---|
| 136 | * @return File name pattern of view matrix file. |
---|
| 137 | */ |
---|
| 138 | QString getViewMatrixFileNamePattern() const { return m_viewMatrixFileNamePattern; } |
---|
| 139 | |
---|
| 140 | /** |
---|
| 141 | * Export projection settings to file. |
---|
| 142 | * |
---|
| 143 | * @param fileName File name of the projection settings. |
---|
| 144 | * @return True if successfully exported. |
---|
| 145 | */ |
---|
| 146 | bool exportDataset(const QString& fileName); |
---|
| 147 | |
---|
| 148 | /** |
---|
| 149 | * Create a color encoded coordinate texture and retrieve its texture object index. |
---|
| 150 | * |
---|
| 151 | * @return Texture object index of the encoded coordinate texture. |
---|
| 152 | */ |
---|
| 153 | unsigned int getTexCoordColorTexture(); |
---|
| 154 | |
---|
| 155 | /** |
---|
| 156 | * Create a color encoded coordinate texture (green and blue channel) and retrieve its texture object index. |
---|
| 157 | * |
---|
| 158 | * @return Texture object index of the encoded coordinate texture (red channel). |
---|
| 159 | */ |
---|
| 160 | unsigned int getTexCoordColorRTexture(); |
---|
| 161 | |
---|
| 162 | /** |
---|
| 163 | * Create an edge blending texture and retrieve its texture object index. |
---|
| 164 | * |
---|
| 165 | * @return Texture object index of the edge blending texture. |
---|
| 166 | */ |
---|
| 167 | unsigned int getBlendingAreaTexture(); |
---|
| 168 | |
---|
| 169 | /** |
---|
| 170 | * Restore the export settings from XML data. |
---|
| 171 | * |
---|
| 172 | * @param element Parent XML element of the export settings data. |
---|
| 173 | */ |
---|
| 174 | bool initFromDOMElement(const QDomElement& element); |
---|
| 175 | |
---|
| 176 | /** |
---|
| 177 | * Store the current export settings as XML data. |
---|
| 178 | * |
---|
| 179 | * @param name XML node name of the data. |
---|
| 180 | * @param doc XML document to store the data. |
---|
| 181 | * @return Current export settings data as XML data. |
---|
| 182 | */ |
---|
| 183 | QDomElement domElement(const QString& name, QDomDocument& doc) const; |
---|
| 184 | |
---|
| 185 | protected: |
---|
| 186 | |
---|
| 187 | bool m_bSoftEdge; //!< True if soft edge blending is enabled. |
---|
| 188 | int m_blendEdgeWidth; //!< Width of the soft edge blending. |
---|
| 189 | float m_blendEdgeExponent; //!< Curve exponent of blend map edge. |
---|
| 190 | int m_exportWidth; //!< Width of distortion map to export. |
---|
| 191 | int m_exportHeight; //!< Height of distortion map to export. |
---|
| 192 | QString m_distortMapFileNamePattern; //!< File name pattern of distortion map file. |
---|
| 193 | QString m_blendMapFileNamePattern; //!< File name pattern of blend map file. |
---|
| 194 | QString m_viewMatrixFileNamePattern; //!< File name pattern of view matrix file. |
---|
| 195 | |
---|
| 196 | unsigned int m_texCoordColorTexIndex; //!< Texture object index of the encoded coordinate texture (green and blue channels). |
---|
| 197 | unsigned int m_texCoordColorRTexIndex; //!< Texture object index of the encoded coordinate texture (red channel). |
---|
| 198 | unsigned int m_blendAreaTexIndex; //!< Texture object index of the edge blending texture. |
---|
| 199 | |
---|
| 200 | ProjectionModel* m_pModel; //!< Projection model. |
---|
| 201 | }; |
---|
| 202 | |
---|
| 203 | }; // projection |
---|
| 204 | |
---|
| 205 | #endif // _EXPORTER_H_ |
---|