/usr/include/ossim/imaging/ossimImageFileWriter.h is in libossim-dev 1.7.21-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Frank Warmerdam (warmerdam@pobox.com)
//
// Description:
//
// Contains class declaration for ossimImageWriter
//*******************************************************************
// $Id: ossimImageFileWriter.h 11181 2007-06-07 19:57:14Z dburken $
#ifndef ossimImageFileWriter_HEADER
#define ossimImageFileWriter_HEADER
#include <fstream>
#include <ossim/base/ossimIoStream.h>
#include <ossim/imaging/ossimImageWriter.h>
#include <ossim/base/ossimFilename.h>
#include <ossim/base/ossimConnectableObjectListener.h>
#include <ossim/base/ossimProcessInterface.h>
#include <ossim/base/ossimObjectEvents.h>
#include <ossim/base/ossimProcessProgressEvent.h>
#include <ossim/base/ossimViewController.h>
/**
* Pure virtual base class for image file writers.
*
* There is normally one subclass of this class for each format supported
* for writing. This class roughly corresponds to the ImageHandler class
* used for reading images. Format specific ossimImageWriter's are normally
* instantiated by the ossimImageWriterFactory::createWriterInstance() method.
* ossimImageWriters should not be directly instantiated by application code.
*/
class OSSIMDLLEXPORT ossimImageFileWriter
: public ossimImageWriter,
public ossimProcessInterface,
public ossimConnectableObjectListener
{
public:
/**
* The writer will own the sequencer.
*/
ossimImageFileWriter(const ossimFilename& filename = ossimFilename(),
ossimImageSource* inputSource=0,
ossimObject* owner=0);
virtual ~ossimImageFileWriter();
virtual ossimObject* getObject();
virtual const ossimObject* getObject()const;
/**
* void getImageTypeList(std::vector<ossimString>& imageTypeList)const
*
* pure virtual
*
* Appends the writers image types to the "imageTypeList".
*
* This is the actual image type name. So for
* example, ossimTiffWriter has several image types. Some of these
* include TIFF_TILED, TIFF_TILED_BAND_SEPARATE ... etc.
* The ossimGdalWriter
* may include GDAL_IMAGINE_HFA, GDAL_RGB_NITF, GDAL_JPEG20000, ... etc.
*
* @param imageTypeList stl::vector<ossimString> list to append to.
*
* @note All writers should append to the list, not, clear it and then add
* their types.
*/
virtual void getImageTypeList(std::vector<ossimString>& imageTypeList)const=0;
/**
* bool hasImageType(const ossimString& imageType) const
*
* @param imageType string representing image type.
*
* @return true if "imageType" is supported by writer.
*/
virtual bool hasImageType(const ossimString& imageType) const;
/**
* Sets the output image tiling size if supported by the writer. If not
* supported this simply sets the sequencer(input) tile size.
*/
virtual void setTileSize(const ossimIpt& tileSize);
/**
* Will write an envi header file. If "theFilename" is "foo.tif"
* then this will write out "foo.hdr".
*/
virtual bool writeEnviHeaderFile() const;
/**
* Will write an ER Mapper header file. If "theFilename" is "foo.tif"
* then this will write out "foo.hdr".
*/
virtual bool writeErsHeaderFile() const;
/**
* Will write an external geometry file. If "theFilename" is "foo.tif"
* then this will write out "foo.geom".
*/
virtual bool writeExternalGeometryFile() const;
/**
* Will write an fgdc file. If "theFilename" is "foo.tif"
* then this will write out "foo.xml".
*/
virtual bool writeFgdcFile() const;
/**
* Returns true on success, false on error.
*/
virtual bool writeHistogramFile() const;
/**
* Will write a jpeg world file. If "theFilename" is "foo.tif"
* then this will write out "foo.jpw".
*/
virtual bool writeJpegWorldFile() const;
/**
* Write out an ossim overview file from the source_file.
* If source file is "foo.tif", this will create a "foo.ovr" in
* the same directory.
*
* @param source_file The file to create overview from.
*
* @param tiff_compress_type valid types:
* - COMPRESSION_JPEG
* - COMPRESSION_DEFLATE
* - COMPRESSION_PACKBITS
* - COMPRESSION_NONE=1 (default)
*
* @param jpeg_compress_quality Compression quality. Only valid with
* COMPRESSION_JPEG. Range 1 to 100 with 100 being the best.
* default = 75
*
* @return true on success, false on error.
*/
virtual bool writeOverviewFile(ossim_uint16 tiff_compress_type = 1,
ossim_int32 jpeg_compress_quality = 75)const;
/**
* Will write a readme file. If "theFilename" is "foo.tif"
* then this will write out "foo_readme.txt".
*/
virtual bool writeReadmeFile() const;
/**
* Will write a readme file. If "theFilename" is "foo.tif"
* then this will write out "foo.tfw".
*/
virtual bool writeTiffWorldFile() const;
/**
* Convenience method that calls meta data write methods that are flagged
* to be called. Attempts to write all files flagged to be written even
* if one file writer returns false.
*
* Currently calls these methods if flagged:
* writeEnviHeaderFile
* writeExternalGeometryFile
* writeFgdcFile
* writeJpegWorldFile
* writeReadmeFile
* writeTiffWorldFile
* writeOverviewFile
* writeHistogramFile
*
* @return true if all files flagged are written, false if not.
*/
virtual bool writeMetaDataFiles() const;
virtual void setAreaOfInterest(const ossimIrect& inputRect);
virtual void changeSequencer(ossimImageSourceSequencer* sequencer);
virtual ossimImageSourceSequencer* getSequencer();
virtual void initialize();
/**
* Calls:
* writeFile()
* writeMetaDataFiles()
*
* @return true on success, false on error.
*/
virtual bool execute();
/**
* @brief Method to write the image to a stream.
*
* This implementation does nothing and returns false.
* Derived classed should implement as needed.
*
* @return true on success, false on error.
*/
virtual bool writeStream();
/**
* @brief Sets the output stream to write to.
*
* This implementation in this class does nothing and returns false.
* Derived classed should implement as needed.
*
* @param stream The stream to write to.
*
* @return true if object can write to stream, false if not.
*/
virtual bool setOutputStream(ossimRefPtr<ossimOStream> stream);
/** tmp drb */
virtual bool setOutputStream(std::ostream& str);
/**
* @brief Method to return the stream attached to output.
*
* This implementation in this class does nothing and returns an empty
* ossimRefPtr<ossimOStream>.
* Derived classed should implement as needed.
*
* @return The stream wrapped around a ref pointer.
*/
virtual ossimRefPtr<ossimOStream> getOutputStream() const;
virtual void setPercentComplete(double percentComplete);
virtual void setOutputImageType(ossim_int32 type);
virtual void setOutputImageType(const ossimString& type);
virtual ossim_int32 getOutputImageType() const;
virtual ossimString getOutputImageTypeString() const;
virtual void setOutputName(const ossimString& outputName);
virtual void setFilename(const ossimFilename& file);
virtual const ossimFilename& getFilename()const;
virtual bool saveState(ossimKeywordlist& kwl,
const char* prefix=0)const;
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix=0);
virtual bool canConnectMyInputTo(ossim_int32 inputIndex,
const ossimConnectableObject* object)const;
virtual void disconnectInputEvent(ossimConnectionEvent& event);
virtual void connectInputEvent(ossimConnectionEvent& event);
virtual void propertyEvent(ossimPropertyEvent& event);
/**
* Control flags...
*/
virtual bool getWriteImageFlag() const;
virtual bool getWriteHistogramFlag() const;
virtual bool getWriteOverviewFlag() const;
virtual bool getScaleToEightBitFlag() const;
virtual bool getWriteEnviHeaderFlag() const;
virtual bool getWriteErsHeaderFlag() const;
virtual bool getWriteExternalGeometryFlag() const;
virtual bool getWriteFgdcFlag() const;
virtual bool getWriteJpegWorldFileFlag() const;
virtual bool getWriteReadmeFlag() const;
virtual bool getWriteTiffWorldFileFlag() const;
virtual void setWriteImageFlag(bool flag);
virtual void setWriteOverviewFlag(bool flag);
virtual void setWriteHistogramFlag(bool flag);
virtual void setScaleToEightBitFlag(bool flag);
virtual void setWriteEnviHeaderFlag(bool flag);
virtual void setWriteErsHeaderFlag(bool flag);
virtual void setWriteExternalGeometryFlag(bool flag);
virtual void setWriteFgdcFlag(bool flag);
virtual void setWriteJpegWorldFile(bool flag);
virtual void setWriteReadme(bool flag);
virtual void setWriteTiffWorldFile(bool flag);
virtual ossim_uint16 getOverviewCompressType() const;
virtual ossim_int32 getOverviewJpegCompressQuality() const;
virtual void setOverviewCompressType(ossim_uint16 type);
virtual void setOverviewJpegCompressQuality(ossim_int32 quality);
virtual void setProperty(ossimRefPtr<ossimProperty> property);
virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
/**
* Overrides base "addListener" this will capture the pointer and then call
* the base class "addListener". If overview building is enabled, the
* listener will be passed to the overview builder::addListener, and
* subsequently removed from the overview builder after the build overview
* call is complete. This it transparent to the caller of this method.
*
* @param listener The listener to add.
*
* @return Currently always returns true.
*
* @note Callers still should call "removeListener" after the writing
* process is complete.
*
* @note If called more than once, theProgressListener will contain
* the latest listener.
*/
virtual bool addListener(ossimListener* listener);
/**
* Overrides base "removeListener". Calls base "removeListener which will
* find and removes the listener.
* If "theProgressListener" pointer matches listener "theProgressListener"
* will be set to NULL.
*
* @param listener The listener to remove.
*
* @return Currently always returns true.
*/
virtual bool removeListener(ossimListener* listener);
/**
* If "point" the coordinate tie points are relative to the center of the
* pixel. If "area" the coordinate tie points are relative to the upper
* left corner of the pixel.
*
* For image types that are keyed, tiff for instance, this will set the
* geotiff key: GTRasterTypeGeoKey
*
* If meta data writers are enabled, world file writers for instance,
* this will also be propagated to them.
*
* Default in this writer is: OSSIM_PIXEL_IS_POINT
*
* @param type
* OSSIM_PIXEL_IS_POINT = center of pixel
* OSSIM_PIXEL_IS_AREA = upper left corner of pixel
*/
virtual void setPixelType(ossimPixelType type);
/**
* If "point" the coordinate tie points are relative to the center of the
* pixel. If "area" the coordinate tie points are relative to the upper
* left corner of the pixel.
*
* For image types that are keyed, tiff for instance, this will set the
* geotiff key: GTRasterTypeGeoKey
*
* If meta data writers are enabled, world file writers for instance,
* this will also be propagated to them.
* Default in this writer is: OSSIM_PIXEL_IS_POINT
*
* @param type
* "point" = center of pixel
* "area" = upper left corner of pixel
*
* @note If the downcased "type" is not equal to "point" or "area" pixel
* type will remain unchanged.
*/
virtual void setPixelType(const ossimString& type);
/**
* @return The pixel type as either OSSIM_PIXEL_IS_POINT or
* OSSIM_PIXEL_IS_AREA.
*/
virtual ossimPixelType getPixelType() const;
/**
* @param type ossimString to initialize which will either be "point" or
* "area".
*/
virtual void getPixelTypeString(ossimString& type) const;
protected:
/**
* Common world file writer method.
*
* @param file The file to write like "foo.tfw" or "foo.jpw".
*
* @return true on success, false on error.
*/
bool writeWorldFile(const ossimFilename& file) const;
/**
* Write out the file.
* @return true on success, false on error.
*/
virtual bool writeFile() = 0;
ossimImageSourceSequencer* theInputConnection;
ossimViewController* theViewController;
ossimListener* theProgressListener;
ossimFilename theFilename;
ossimString theOutputImageType;
bool theWriteImageFlag;
bool theWriteOverviewFlag;
bool theWriteHistogramFlag;
bool theScaleToEightBitFlag;
ossim_uint16 theOverviewCompressType;
ossim_int32 theOverviewJpegCompressQuality;
/**
* External meta data writer flags. Not really part of an image writer, put
* here for convenience. If true the writer will do the connection work
* for you.
*/
bool theWriteEnviHeaderFlag;
bool theWriteErsHeaderFlag;
bool theWriteExternalGeometryFlag;
bool theWriteFgdcFlag;
bool theWriteJpegWorldFileFlag;
bool theWriteReadmeFlag;
bool theWriteTiffWorldFileFlag;
/**
* If not a geographic projection this allows the user to set the linear
* units of the output tag to be:
*
* meters (default)
* us_survey_feet
* feet
*
* This will be propagated to writers that can switch types and to the
* associated metadata writers.
*/
ossimUnitType theLinearUnits;
/** OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1 */
ossimPixelType thePixelType;
TYPE_DATA
};
#endif
|