OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ossimPdfWriter Class Reference

References: More...

#include <ossimPdfWriter.h>

Inheritance diagram for ossimPdfWriter:
ossimImageFileWriter ossimImageWriter ossimProcessInterface ossimConnectableObjectListener ossimOutputSource ossimListener ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Types

enum  ossimPdfImageType { UNKNOWN = 0, JPEG = 1, RAW = 2 }
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 

Public Member Functions

 ossimPdfWriter ()
 default constructor More...
 
virtual ~ossimPdfWriter ()
 virtual destructor More...
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual ossimString getExtension () const
 Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions. More...
 
virtual void getImageTypeList (std::vector< ossimString > &imageTypeList) const
 void getImageTypeList(std::vector<ossimString>& imageTypeList)const More...
 
virtual bool isOpen () const
 
virtual bool open ()
 Open method. More...
 
virtual void close ()
 Closes file. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 saves the state of the object. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Will set the property whose name matches the argument "property->getName()". More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 Gets property for name. More...
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Pushes this's names onto the list of property names. More...
 
virtual bool hasImageType (const ossimString &imageType) const
 bool hasImageType(const ossimString& imageType) const More...
 
virtual bool writeStream ()
 Method to write the image to a stream. More...
 
virtual bool setOutputStream (std::ostream &stream)
 Sets the output stream to write to. More...
 
- Public Member Functions inherited from ossimImageFileWriter
 ossimImageFileWriter (const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
 The writer will own the sequencer. More...
 
virtual ~ossimImageFileWriter ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual bool getOutputHasInternalOverviews (void) const
 Examples of writers that always generate internal overviews are ossim_kakadu_jp2 and ossim_kakadu_nitf_j2k. More...
 
virtual void setTileSize (const ossimIpt &tileSize)
 Sets the output image tiling size if supported by the writer. More...
 
virtual bool writeEnviHeaderFile ()
 Will write an envi header file. More...
 
virtual bool writeErsHeaderFile ()
 Will write an ER Mapper header file. More...
 
virtual bool writeExternalGeometryFile ()
 Will write an external geometry file. More...
 
virtual bool writeFgdcFile ()
 Will write an fgdc file. More...
 
virtual bool writeHistogramFile ()
 Returns true on success, false on error. More...
 
virtual bool writeJpegWorldFile ()
 Will write a jpeg world file. More...
 
virtual bool writeOverviewFile (ossim_uint16 tiff_compress_type=1, ossim_int32 jpeg_compress_quality=75, bool includeR0=false)
 Write out an ossim overview file from the source_file. More...
 
virtual bool writeReadmeFile ()
 Will write a readme file. More...
 
virtual bool writeTiffWorldFile ()
 Will write a world file. More...
 
virtual bool writeWorldFile ()
 Will write a world file. More...
 
virtual bool writeMetaDataFiles ()
 Convenience method that calls meta data write methods that are flagged to be called. More...
 
virtual void setAreaOfInterest (const ossimIrect &inputRect)
 
virtual void changeSequencer (ossimImageSourceSequencer *sequencer)
 Sets the sequencer and connects it to the input of this. More...
 
virtual ossimImageSourceSequencergetSequencer ()
 
virtual void initialize ()
 Initialize method. More...
 
virtual bool execute ()
 Calls: writeFile() writeMetaDataFiles() More...
 
virtual bool setOutputStream (ossimRefPtr< ossimOStream > stream)
 Sets the output stream to write to. More...
 
virtual ossimRefPtr< ossimOStreamgetOutputStream () const
 Method to return the stream attached to output. More...
 
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 ossimFilenamegetFilename () const
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual bool getWriteImageFlag () const
 Control flags... More...
 
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 bool getWriteWorldFileFlag () 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 void setWriteWorldFile (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 bool addListener (ossimListener *listener)
 Overrides base "addListener" this will capture the pointer and then call the base class "addListener". More...
 
virtual bool removeListener (ossimListener *listener)
 Overrides base "removeListener". More...
 
virtual void setPixelType (ossimPixelType type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual void setPixelType (const ossimString &type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual ossimPixelType getPixelType () const
 
virtual void getPixelTypeString (ossimString &type) const
 
- Public Member Functions inherited from ossimImageWriter
 ossimImageWriter (ossimObject *owner=NULL)
 
 ossimImageWriter (ossimObject *owner, ossim_uint32 numberOfInputs, ossim_uint32 numberOfOutputs, bool inputListIsFixed, bool outputListIsFixed)
 
virtual ~ossimImageWriter ()
 
virtual bool setViewingRect (const ossimIrect &aRect)
 
virtual ossimIrect getAreaOfInterest () const
 
- Public Member Functions inherited from ossimOutputSource
 ossimOutputSource (ossimObject *owner=NULL)
 
 ossimOutputSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimOutputSource ()
 
virtual bool open (const ossimString &outputName)
 
virtual const ossimStringgetOutputName ()
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
virtual void abort ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Private Member Functions

virtual bool writeFile ()
 Writes the file to disk or a stream. More...
 
void writeHeader (std::ostream *str)
 Writes header. More...
 
void writeCatalog (std::ostream *str, std::vector< std::streamoff > &xref)
 Writes Catalog object. More...
 
void writePages (std::ostream *str, std::vector< std::streamoff > &xref)
 Writes Outlines object. More...
 
void writeInfo (std::ostream *str, std::vector< std::streamoff > &xref)
 Writes document infomation dictionary. More...
 
bool writeImage (std::ostream *str)
 Writes the image dictionary and associated objects. More...
 
void writeJpegTile (std::ostream *str, std::vector< std::streamoff > &xref, ossimImageData *id, const ossimIrect &aoi, ossimIrect &outputTileRect)
 Write a JPEG-compresses the raster tile buffer to the output stream provided. More...
 
void writeRawTile (std::ostream *str, std::vector< std::streamoff > &xref, ossimImageData *id, const ossimIrect &aoi, ossimIrect &outputTileRect)
 Write raw raster tile buffer to the output stream provided. More...
 
void writeXref (std::ostream *str, const std::vector< std::streamoff > &xref)
 Writes Cross Reference(xref) section. More...
 
void writeTrailer (std::ostream *str, ossim_uint32 entrySize, std::streamoff xrefOffset)
 Writes trailer. More...
 
void setupInputChain ()
 Writes "dummy" or blank object just to keep object references in line. More...
 
ossimPdfImageType getImageType () const
 Gets the enumerated value of IMAGE_TYPE_KW lookup. More...
 
void getImageType (std::string &type) const
 Initializes image type from IMAGE_TYPE_KW lookup. More...
 
void addOption (const std::string &key, const std::string &value)
 Adds option to m_kwl with mutex lock. More...
 
void getLowerLeftPageOffset (const ossimIrect &aoi, ossimIpt &offset) const
 Gets the page size. More...
 
void getLgiDict (ossimImageGeometry *geom, const ossimIrect &aoi, std::string &s) const
 Get the LGIDict string. More...
 
void getLgiDictProjection (ossimImageGeometry *geom, std::string &s) const
 Gets projection part of LGIDict string. More...
 
void getLgiDictCtm (ossimImageGeometry *geom, const ossimIrect &aoi, std::string &s) const
 Gets Coordinate Transformation Matrix(CTM) part of LGIDict string from geom. More...
 
void getLgiDictDatum (ossimImageGeometry *geom, std::string &s) const
 Gets datum part of LGIDict string from geom. More...
 
void getLgiDictDescription (ossimImageGeometry *geom, std::string &s) const
 Gets description part of LGIDict string from geom. More...
 
void getLgiDictProjectionType (ossimImageGeometry *geom, std::string &s) const
 Gets neatline part of LGIDict string from geom. More...
 
ossim_uint32 getEpsgCode (const ossimImageGeometry *geom) const
 Gets the EPSG/PCS code from geometry. More...
 
void getTitle (std::string &s) const
 Gets the Title. More...
 
void getAuthor (std::string &s) const
 Gets the Author. More...
 
void getSubject (std::string &s) const
 Gets the Subject. More...
 
void getKeywords (std::string &s) const
 Gets the Keywords. More...
 
void getCreator (std::string &s) const
 Gets the Creator. More...
 
void getProducer (std::string &s) const
 Gets the Producer. More...
 
void getCreationDate (std::string &s) const
 Gets the Producer. More...
 
void getModDate (std::string &s) const
 Gets the Producer. More...
 
void getGmtDate (std::string &s) const
 Get's the date in format of: (D:YYYYMMDDHHmmSSZ00'00') More...
 
void getTileSize (std::string &s) const
 Gets tiles size as string. More...
 
void getTileSize (ossimIpt &tileSize) const
 Gets Tile size as integer point. More...
 
std::string getTileString (ossim_uint32 x, ossim_uint32 y) const
 

Private Attributes

std::ostream * m_str
 
bool m_ownsStream
 
ossimRefPtr< ossimConnectableObjectm_savedInput
 Holds the origin end of the chain connected to theInputConnection. More...
 
ossimRefPtr< ossimKeywordlistm_kwl
 Holds all options in key, value pair map. More...
 
std::mutex m_mutex
 

Additional Inherited Members

- Protected Member Functions inherited from ossimImageFileWriter
bool writeWorldFile (const ossimFilename &file)
 Common world file writer method. More...
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 
- Protected Attributes inherited from ossimImageFileWriter
ossimRefPtr< ossimImageSourceSequencertheInputConnection
 
ossimRefPtr< ossimViewControllertheViewController
 
ossimListenertheProgressListener
 
ossimFilename theFilename
 
ossimString theOutputImageType
 
bool theWriteImageFlag
 
bool theWriteOverviewFlag
 
bool theWriteHistogramFlag
 
bool theScaleToEightBitFlag
 
ossim_uint16 theOverviewCompressType
 
ossim_int32 theOverviewJpegCompressQuality
 
bool theWriteEnviHeaderFlag
 External meta data writer flags. More...
 
bool theWriteErsHeaderFlag
 
bool theWriteExternalGeometryFlag
 
bool theWriteFgdcFlag
 
bool theWriteJpegWorldFileFlag
 
bool theWriteReadmeFlag
 
bool theWriteTiffWorldFileFlag
 
bool theWriteWorldFileFlag
 
bool theAutoCreateDirectoryFlag
 
ossimUnitType theLinearUnits
 If not a geographic projection this allows the user to set the linear units of the output tag to be: More...
 
ossimPixelType thePixelType
 OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1. More...
 
- Protected Attributes inherited from ossimImageWriter
ossimIrect theAreaOfInterest
 
- Protected Attributes inherited from ossimOutputSource
ossimString theOutputName
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Detailed Description

References:

Adobe PDF Reference sixth edition, Version 1.7 November 2006 pdf_reference_1-7.pdf

PDF Georegistration Encoding Best Practice Version (2.2 OGC 08-139r3) 08-139r3_PDF_Geo-registration_Encoding_Best_Practice_Version_2.2.pdf

Note
Spaces and newlines for formatting have been left in the code for sanity purposes only. Code is heavily traced. You can enable trace on any ossim application with "-T ossimPdfWriter".

Definition at line 45 of file ossimPdfWriter.h.

Member Enumeration Documentation

◆ ossimPdfImageType

Enumerator
UNKNOWN 
JPEG 
RAW 

Definition at line 49 of file ossimPdfWriter.h.

50  {
51  UNKNOWN = 0,
52  JPEG = 1, // JPEG
53  RAW = 2 // general raster, band interleaved by pixel(BIP)
54  };

Constructor & Destructor Documentation

◆ ossimPdfWriter()

ossimPdfWriter::ossimPdfWriter ( )

default constructor

◆ ~ossimPdfWriter()

virtual ossimPdfWriter::~ossimPdfWriter ( )
virtual

virtual destructor

Member Function Documentation

◆ addOption()

void ossimPdfWriter::addOption ( const std::string &  key,
const std::string &  value 
)
private

Adds option to m_kwl with mutex lock.

Parameters
key
value

Definition at line 1405 of file ossimPdfWriter.cpp.

References ossimKeywordlist::addPair(), m_kwl, m_mutex, and ossimRefPtr< T >::valid().

Referenced by setProperty().

1406 {
1407  m_mutex.lock();
1408  if ( m_kwl.valid() )
1409  {
1410  if ( key.size() && value.size() )
1411  {
1412  m_kwl->addPair( key, value );
1413  }
1414  }
1415  m_mutex.unlock();
1416 }
bool valid() const
Definition: ossimRefPtr.h:75
std::mutex m_mutex
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ close()

void ossimPdfWriter::close ( )
virtual

Closes file.

Implements ossimOutputSource.

Definition at line 1082 of file ossimPdfWriter.cpp.

References m_ownsStream, and m_str.

Referenced by open().

1083 {
1084  if (m_str)
1085  {
1086  m_str->flush();
1087 
1088  if (m_ownsStream)
1089  {
1090  delete m_str;
1091  m_str = 0;
1092  m_ownsStream = false;
1093  }
1094  }
1095 }
std::ostream * m_str

◆ getAuthor()

void ossimPdfWriter::getAuthor ( std::string &  s) const
private

Gets the Author.

Looks in m_kwl for options keyword: "Author"

Defaults to "ossim" if not found.

Parameters
sInitialed by this.

Definition at line 1761 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), and m_kwl.

Referenced by getProperty().

1762 {
1763  // Check if in keyword list.
1764  s = m_kwl->findKey( AUTHOR_KW );
1765 
1766  if ( s.empty() )
1767  {
1768  s = "ossim"; // Default: ???
1769  }
1770 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ getClassName()

virtual ossimString ossimPdfWriter::getClassName ( ) const
virtual
Returns
"ossimPdfWriter"

Reimplemented from ossimObject.

◆ getCreationDate()

void ossimPdfWriter::getCreationDate ( std::string &  s) const
private

Gets the Producer.

Looks in m_kwl for options keyword: "CreationDate"

Defaults to current time if not found.

Parameters
sInitialed by this.

NOTE: This is a formatted string in the form of: D:YYYYMMDDHHmmSSOHH'mm'

Definition at line 1806 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), getGmtDate(), and m_kwl.

Referenced by getProperty().

1807 {
1808  // Check if in keyword list.
1809  s = m_kwl->findKey( CREATION_DATE_KW );
1810 
1811  if ( s.empty() )
1812  {
1813  getGmtDate( s );
1814  }
1815 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.
void getGmtDate(std::string &s) const
Get&#39;s the date in format of: (D:YYYYMMDDHHmmSSZ00&#39;00&#39;)

◆ getCreator()

void ossimPdfWriter::getCreator ( std::string &  s) const
private

Gets the Creator.

Looks in m_kwl for options keyword: "Creator"

Defaults to "ossim" if not found.

Parameters
sInitialed by this.

Definition at line 1784 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), and m_kwl.

Referenced by getProperty().

1785 {
1786  // Check if in keyword list.
1787  s = m_kwl->findKey( CREATOR_KW );
1788 
1789  if ( s.empty() )
1790  {
1791  s = "ossim"; // Default: ???
1792  }
1793 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ getEpsgCode()

ossim_uint32 ossimPdfWriter::getEpsgCode ( const ossimImageGeometry geom) const
private

Gets the EPSG/PCS code from geometry.

Parameters
geomImage geometry.
Returns
EPSG code or 32767 on error.

Definition at line 1703 of file ossimPdfWriter.cpp.

References ossimRefPtr< T >::get(), ossimMapProjection::getPcsCode(), ossimImageGeometry::getProjection(), and ossimRefPtr< T >::valid().

1704 {
1705  ossim_uint32 code = 32767;
1706  if ( geom )
1707  {
1709  if ( proj.valid() )
1710  {
1711  // Map projection:
1713  dynamic_cast<const ossimMapProjection*>( proj.get() );
1714 
1715  if ( mapProj.valid() )
1716  {
1717  code = mapProj->getPcsCode();
1718  }
1719  }
1720  }
1721  return code;
1722 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getPcsCode() const
Returns the EPSG PCS code or 32767 if the projection is a custom (non-EPSG) projection.
unsigned int ossim_uint32
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).

◆ getExtension()

ossimString ossimPdfWriter::getExtension ( ) const
virtual

Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions.

Parameters
imageTypestring representing image type.
Returns
the 3-letter string extension.

Reimplemented from ossimImageFileWriter.

Definition at line 1102 of file ossimPdfWriter.cpp.

1103 {
1104  return ossimString("pdf");
1105 }

◆ getGmtDate()

void ossimPdfWriter::getGmtDate ( std::string &  s) const
private

Get's the date in format of: (D:YYYYMMDDHHmmSSZ00'00')

Parameters
sInitialed by this.

NOTE: Date code is NOT thread safe.

Definition at line 1828 of file ossimPdfWriter.cpp.

Referenced by getCreationDate(), and getModDate().

1829 {
1830  // Get the time:
1831  time_t now;
1832  time(&now);
1833 
1834  // Convert to UTC:
1835  tm* gt = gmtime(&now);
1836 
1837  if ( gt )
1838  {
1839  //---
1840  // Format(26 charactors including trailing null):
1841  // (D:YYYYMMDDHHmmSSZ00'00')
1842  char dateChars[26];
1843  dateChars[25] = '\0';
1844  strftime(dateChars, 26, "(D:%Y%m%d%H%M%SZ00'00')", gt);
1845  s = dateChars;
1846  }
1847 
1848 } // End: ossimPdfWriter::getGmtDate

◆ getImageType() [1/2]

ossimPdfWriter::ossimPdfImageType ossimPdfWriter::getImageType ( ) const
private

Gets the enumerated value of IMAGE_TYPE_KW lookup.

This is the image type of the stream embedded in the pdf. Default "raw" if not found.

Returns
ossimPdfImageType, e.g. PNG, RAW...

Definition at line 1369 of file ossimPdfWriter.cpp.

References ossimString::downcase(), JPEG, ossimNotify(), ossimNotifyLevel_WARN, RAW, ossimString::string(), and UNKNOWN.

Referenced by getProperty(), and while().

1370 {
1372 
1373  // Get the type and downcase.
1374  ossimString os;
1375  getImageType( os.string() );
1376  os.downcase();
1377 
1378  if ( os == "jpeg" )
1379  {
1380  result = ossimPdfWriter::JPEG;
1381  }
1382  else if ( os == "raw" )
1383  {
1384  result = ossimPdfWriter::RAW;
1385  }
1386  else
1387  {
1388  // Unknown value:
1390  << "ossimPdfWriter::getImageCompression WARN\n"
1391  << "Unhandled image compression type: " << os << std::endl;
1392  }
1393  return result;
1394 }
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
ossimPdfImageType getImageType() const
Gets the enumerated value of IMAGE_TYPE_KW lookup.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ getImageType() [2/2]

void ossimPdfWriter::getImageType ( std::string &  type) const
private

Initializes image type from IMAGE_TYPE_KW lookup.

This is the image type of the stream embedded in the pdf. Default "raw" if not found.

Parameters
typeInitialized by this.

Definition at line 1396 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), ossimKeywordNames::IMAGE_TYPE_KW, and m_kwl.

1397 {
1398  type = m_kwl->findKey( std::string(ossimKeywordNames::IMAGE_TYPE_KW) );
1399  if ( type.empty() )
1400  {
1401  type = "jpeg"; // default
1402  }
1403 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.
static const char * IMAGE_TYPE_KW

◆ getImageTypeList()

void ossimPdfWriter::getImageTypeList ( std::vector< ossimString > &  imageTypeList) const
virtual

void getImageTypeList(std::vector<ossimString>& imageTypeList)const

Appends this writer image types to list "imageTypeList".

This writer only has one type "pdf".

Parameters
imageTypeListstl::vector<ossimString> list to append to.

Implements ossimImageFileWriter.

Definition at line 1097 of file ossimPdfWriter.cpp.

1098 {
1099  imageTypeList.push_back(ossimString("ossim_pdf"));
1100 }

◆ getKeywords()

void ossimPdfWriter::getKeywords ( std::string &  s) const
private

Gets the Keywords.

Looks in m_kwl for options keyword: "Keywords"

Default: No default, empty string if not found.

Parameters
sInitialed by this.

Definition at line 1778 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), and m_kwl.

Referenced by getProperty().

1779 {
1780  // Check if in keyword list.
1781  s = m_kwl->findKey( KEYWORDS_KW );
1782 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ getLgiDict()

void ossimPdfWriter::getLgiDict ( ossimImageGeometry geom,
const ossimIrect aoi,
std::string &  s 
) const
private

Get the LGIDict string.

Parameters
geomImage geometry.
aoiArea of interest.
sInitialized by this.

Definition at line 1451 of file ossimPdfWriter.cpp.

References getLgiDictCtm(), getLgiDictDescription(), getLgiDictProjection(), and ossimIrect::hasNans().

1454 {
1455  s.clear(); // Empty string indicates error.
1456 
1457  if ( geom && !aoi.hasNans() )
1458  {
1459  // Coordinate Transformation Matrix (CTM)
1460  std::string ctmString;
1461  getLgiDictCtm( geom, aoi, ctmString );
1462 
1463  if ( ctmString.size() )
1464  {
1465  // ProjectionType
1466  std::string projectionString;
1467  getLgiDictProjection( geom, projectionString );
1468 
1469  if ( projectionString.size() )
1470  {
1471  //---
1472  // Neatline: Not required for single frame.
1473  // std::string neatLineString;
1474  // getLgiDictNeatline( geom, neatLineString );
1475  //---
1476 
1477  // if ( neatLineString.size() )
1478  // {
1479  // cout << "d..." << endl;
1480 
1481  // Description
1482  std::string descriptionString;
1483  getLgiDictDescription( geom, descriptionString );
1484 
1485  if ( descriptionString.size() )
1486  {
1487  std::ostringstream os;
1488  os << "/LGIDict"
1489  << "[<<"
1490  << ctmString
1491  << "/Version(2.1)"
1492  << projectionString
1493  // << neatLineString
1494  << descriptionString
1495  << "/Type/LGIDict>>]";
1496 
1497  s = os.str();
1498  // }
1499  }
1500  }
1501  }
1502  }
1503 
1504 } // End: ossimPdfWriter::getLgiDictString
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
void getLgiDictProjection(ossimImageGeometry *geom, std::string &s) const
Gets projection part of LGIDict string.
void getLgiDictCtm(ossimImageGeometry *geom, const ossimIrect &aoi, std::string &s) const
Gets Coordinate Transformation Matrix(CTM) part of LGIDict string from geom.
bool hasNans() const
Definition: ossimIrect.h:337
void getLgiDictDescription(ossimImageGeometry *geom, std::string &s) const
Gets description part of LGIDict string from geom.

◆ getLgiDictCtm()

void ossimPdfWriter::getLgiDictCtm ( ossimImageGeometry geom,
const ossimIrect aoi,
std::string &  s 
) const
private

Gets Coordinate Transformation Matrix(CTM) part of LGIDict string from geom.

Parameters
geomImage geometry.
aoiArea of interest.
sInitialized by this or cleared on error.

Definition at line 1605 of file ossimPdfWriter.cpp.

References ossimRefPtr< T >::get(), ossimImageGeometry::getDegreesPerPixel(), ossimImageGeometry::getProjection(), ossimDpt::hasNans(), ossimMapProjection::isGeographic(), ossim::isnan(), ossimGpt::lat, ossimIrect::ll(), ossimImageGeometry::localToWorld(), ossimGpt::lon, ossimDpt::makeNan(), ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by getLgiDict().

1608 {
1609  s.clear(); // Empty string indicates error.
1610 
1611  ossimDpt scale;
1612  scale.makeNan();
1613  ossimDpt dTie;
1614  dTie.makeNan();
1615 
1617  if ( proj.valid() )
1618  {
1619  ossimRefPtr<ossimMapProjection> mapProj = dynamic_cast<ossimMapProjection*>( proj.get() );
1620  if ( mapProj.valid() )
1621  {
1622  if ( mapProj->isGeographic() )
1623  {
1624  // Degrees per pixel.
1625  geom->getDegreesPerPixel( scale );
1626 
1627  if ( !scale.hasNans() )
1628  {
1629  // Tie point: Lat, lon of lower left corner.
1630  ossimGpt gTie;
1631  geom->localToWorld( ossimDpt( aoi.ll() ), gTie );
1632 
1633  // Check just lat and lon disregard height.
1634  if ( !ossim::isnan(gTie.lon) && !ossim::isnan(gTie.lon) )
1635  {
1636  dTie.x = gTie.lon;
1637  dTie.y = gTie.lat;
1638  }
1639  }
1640  }
1641  }
1642  }
1643 
1644  if ( !scale.hasNans() && !dTie.hasNans() )
1645  {
1646  //---
1647  // Example string:
1648  // (0.0000381944)(0.0000000000)(0.0000000000)(0.0000381944)(-77.0558525000)(38.8388091667)
1649  // NOTE: (0,0) is lower left corner in pdf space.
1650  ossim_float64 d = 0.0;
1651  std::ostringstream os;
1652  os << setprecision(15) // Not sure if this should be 10??? (drb)
1653  << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
1654  << std::setfill('0')
1655  << "/CTM[(" << scale.x << ")(" << d << ")(" << d << ")("
1656  << scale.y << ")(" << dTie.x << ")(" << dTie.y << ")]";
1657 
1658  s = os.str();
1659  }
1660 
1661 } // End: ossimPdfWriter::getCtmString
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
virtual bool isGeographic() const
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
const ossimIpt & ll() const
Definition: ossimIrect.h:277
double ossim_float64
ossim_float64 lon
Definition: ossimGpt.h:266
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
bool hasNans() const
Definition: ossimDpt.h:67
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
double x
Definition: ossimDpt.h:164
ossim_float64 lat
Definition: ossimGpt.h:265
void makeNan()
Definition: ossimDpt.h:65
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getLgiDictDatum()

void ossimPdfWriter::getLgiDictDatum ( ossimImageGeometry geom,
std::string &  s 
) const
private

Gets datum part of LGIDict string from geom.

Parameters
geomImage geometry.
sInitialized by this or cleared on error.

Definition at line 1506 of file ossimPdfWriter.cpp.

References ossimDatum::code(), ossimImageGeometry::getAsMapProjection(), ossimMapProjection::getDatum(), ossimString::string(), and ossimRefPtr< T >::valid().

Referenced by getLgiDictProjection().

1508 {
1509  s.clear();
1510  if ( geom )
1511  {
1513  if ( mapProj.valid() )
1514  {
1515  const ossimDatum* datum = mapProj->getDatum();
1516  if ( datum )
1517  {
1518  s = "/Datum(";
1519  s += datum->code().string();
1520  s += ")";
1521  }
1522  }
1523  }
1524 
1525 } // End: ossimPdfWriter::getLgiDictDatum
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
virtual const ossimString & code() const
Definition: ossimDatum.h:57
virtual const ossimDatum * getDatum() const
const std::string & string() const
Definition: ossimString.h:414

◆ getLgiDictDescription()

void ossimPdfWriter::getLgiDictDescription ( ossimImageGeometry geom,
std::string &  s 
) const
private

Gets description part of LGIDict string from geom.

Parameters
geomImage geometry.
sInitialized by this or cleared on error.

Definition at line 1527 of file ossimPdfWriter.cpp.

References ossimDatum::code(), ossimImageGeometry::getAsMapProjection(), ossimMapProjection::getDatum(), ossimString::string(), and ossimRefPtr< T >::valid().

Referenced by getLgiDict(), and getLgiDictProjection().

1529 {
1530  s.clear();
1531  if ( geom )
1532  {
1534  if ( mapProj.valid() )
1535  {
1536  const ossimDatum* datum = mapProj->getDatum();
1537  if ( datum )
1538  {
1539  std::string code = datum->code().string();
1540 
1541  if ( code == "WGE" )
1542  {
1543  s = "/Description(WGS 84)";
1544  }
1545  }
1546  }
1547  }
1548 
1549 } // End: ossimPdfWriter::getLgiDictDescription
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
virtual const ossimString & code() const
Definition: ossimDatum.h:57
virtual const ossimDatum * getDatum() const
const std::string & string() const
Definition: ossimString.h:414

◆ getLgiDictProjection()

void ossimPdfWriter::getLgiDictProjection ( ossimImageGeometry geom,
std::string &  s 
) const
private

Gets projection part of LGIDict string.

Parameters
geomImage geometry.
sInitialized by this.

Definition at line 1569 of file ossimPdfWriter.cpp.

References getLgiDictDatum(), getLgiDictDescription(), and getLgiDictProjectionType().

Referenced by getLgiDict().

1571 {
1572  s.clear(); // Empty string indicates error.
1573 
1574  // Projection:
1575  std::string projType;
1576  getLgiDictProjectionType( geom, projType );
1577 
1578  // Datum:
1579  std::string datumString;
1580  getLgiDictDatum( geom, datumString );
1581 
1582  // Description
1583  std::string descriptionString;
1584  getLgiDictDescription( geom, descriptionString );
1585 
1586  if ( projType.size() && datumString.size() )
1587  {
1588  std::ostringstream os;
1589  os << "/Projection<<"
1590  << projType
1591  << descriptionString
1592  << datumString
1593  << "/Type/Projection>>"
1594  << "/Display<<"
1595  << projType
1596  << descriptionString
1597  << datumString
1598  << "/Type/Projection>>";
1599 
1600  s = os.str();
1601  }
1602 
1603 } // End: ossimPdfWriter::getLgiDictProjection
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
void getLgiDictProjectionType(ossimImageGeometry *geom, std::string &s) const
Gets neatline part of LGIDict string from geom.
void getLgiDictDatum(ossimImageGeometry *geom, std::string &s) const
Gets datum part of LGIDict string from geom.
void getLgiDictDescription(ossimImageGeometry *geom, std::string &s) const
Gets description part of LGIDict string from geom.

◆ getLgiDictProjectionType()

void ossimPdfWriter::getLgiDictProjectionType ( ossimImageGeometry geom,
std::string &  s 
) const
private

Gets neatline part of LGIDict string from geom.

Parameters
geomImage geometry.
sInitialized by this or cleared on error. Gets projection type part of LGIDict string from geom.
geomImage geometry.
sInitialized by this or cleared on error.

Definition at line 1663 of file ossimPdfWriter.cpp.

References ossimRefPtr< T >::get(), ossimImageGeometry::getAsMapProjection(), ossimUtmProjection::getHemisphere(), ossimUtmProjection::getZone(), ossimMapProjection::isGeographic(), and ossimRefPtr< T >::valid().

Referenced by getLgiDictProjection().

1664 {
1665  //---
1666  // Initialize the projection string from geometry:
1667  // Currently only coded for geographic and UTM projection.
1668  //---
1669 
1670  s.clear(); // Empty string indicates error.
1671 
1672  if ( geom )
1673  {
1675  if ( mapProj.valid() )
1676  {
1677  if ( mapProj->isGeographic() )
1678  {
1679  s = "/ProjectionType(GEOGRAPHIC)";
1680  }
1681  else
1682  {
1683  // Check for UTM:
1685  dynamic_cast<const ossimUtmProjection*>( mapProj.get() );
1686  if ( utmProj.valid() )
1687  {
1688  ossim_int32 zone = utmProj->getZone();
1689  char hemisphere = utmProj->getHemisphere();
1690  std::ostringstream os;
1691  os << "/ProjectionType(UT)"
1692  << "/Zone(" << zone << ")"
1693  << "/Hemisphere(" << hemisphere << ")";
1694  s = os.str();
1695  }
1696  }
1697  }
1698 
1699  } // Matches if ( geom )
1700 
1701 } // End: ossimPdfWriter::getProjectionType
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
virtual bool isGeographic() const
ossim_int32 getZone() const
int ossim_int32

◆ getLongName()

virtual ossimString ossimPdfWriter::getLongName ( ) const
virtual
Returns
"ossim pdf writer"

Reimplemented from ossimObject.

◆ getLowerLeftPageOffset()

void ossimPdfWriter::getLowerLeftPageOffset ( const ossimIrect aoi,
ossimIpt offset 
) const
private

Gets the page size.

Takes into account image width, height, and annotations.

Parameters
widthWidth of image.
heightHeight of image.
sizeInitialized by this. Gets page offset for image from lower left corner of media box.
aoiArea of interest.
offsetInitialized by this.

Definition at line 1432 of file ossimPdfWriter.cpp.

References ossimIrect::hasNans(), ossimIpt::x, and ossimIpt::y.

Referenced by if().

1433 {
1434  if ( aoi.hasNans() == false )
1435  {
1436  // Get the page size.
1437  // ossimIpt mediaBoxSize;
1438  // getMediaBoxSize( mediaBoxSize );
1439 
1440  // Temp hard coded. (drb)
1441  offset.x = 0;
1442  offset.y = 0;
1443  }
1444  else
1445  {
1446  offset.x = 0;
1447  offset.y = 0;
1448  }
1449 }
ossim_int32 y
Definition: ossimIpt.h:142
bool hasNans() const
Definition: ossimIrect.h:337
ossim_int32 x
Definition: ossimIpt.h:141

◆ getModDate()

void ossimPdfWriter::getModDate ( std::string &  s) const
private

Gets the Producer.

Looks in m_kwl for options keyword: "ModDate"

Defaults to current time if not found.

Parameters
sInitialed by this.

NOTE: This is a formatted string in the form of: D:YYYYMMDDHHmmSSOHH'mm'

Definition at line 1817 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), getGmtDate(), and m_kwl.

Referenced by getProperty().

1818 {
1819  // Check if in keyword list.
1820  s = m_kwl->findKey( MOD_DATE_KW );
1821 
1822  if ( s.empty() )
1823  {
1824  getGmtDate( s );
1825  }
1826 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.
void getGmtDate(std::string &s) const
Get&#39;s the date in format of: (D:YYYYMMDDHHmmSSZ00&#39;00&#39;)

◆ getProducer()

void ossimPdfWriter::getProducer ( std::string &  s) const
private

Gets the Producer.

Looks in m_kwl for options keyword: "Producer"

Defaults to "ossim" if not found.

Parameters
sInitialed by this.

Definition at line 1795 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), and m_kwl.

1796 {
1797  // Check if in keyword list.
1798  s = m_kwl->findKey( PRODUCER_KW );
1799 
1800  if ( s.empty() )
1801  {
1802  s = "ossim"; // Default: ???
1803  }
1804 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ getProperty()

ossimRefPtr< ossimProperty > ossimPdfWriter::getProperty ( const ossimString name) const
virtual

Gets property for name.

Parameters
nameName of property to return.
Returns
A pointer to a property object which matches "name".

Reimplemented from ossimImageFileWriter.

Definition at line 1146 of file ossimPdfWriter.cpp.

References ossimRefPtr< T >::get(), getAuthor(), getCreationDate(), getCreator(), getImageType(), getKeywords(), getModDate(), ossimImageFileWriter::getProperty(), getSubject(), getTileSize(), ossimKeywordNames::IMAGE_TYPE_KW, ossimKeywordNames::OUTPUT_TILE_SIZE_KW, ossimString::size(), and ossimString::string().

1147 {
1148  ossimRefPtr<ossimProperty> prop = 0;
1149 
1150  if ( name.size() )
1151  {
1152  if ( name == AUTHOR_KW )
1153  {
1154  ossimString value;
1155  getAuthor( value.string() );
1157  new ossimStringProperty( name, value, true);
1158  prop = stringProp.get();
1159  }
1160  else if ( name == CREATOR_KW )
1161  {
1162  ossimString value;
1163  getCreator( value.string() );
1165  new ossimStringProperty( name, value, true);
1166  prop = stringProp.get();
1167  }
1168  else if ( name == CREATION_DATE_KW )
1169  {
1170  ossimString value;
1171  getCreationDate( value.string() );
1173  new ossimStringProperty( name, value, true);
1174  prop = stringProp.get();
1175  }
1176  else if ( name == ossimKeywordNames::IMAGE_TYPE_KW )
1177  {
1178  ossimString value;
1179  getImageType( value.string() );
1181  new ossimStringProperty( name, value, false); // editable flag = false
1182 
1183  // Alway support jpeg.
1184  stringProp->addConstraint( ossimString("jpeg") );
1185 
1186  // Alway support raw (general raster).
1187  stringProp->addConstraint( ossimString("raw") );
1188 
1189  prop = stringProp.get();
1190  }
1191  else if ( name == KEYWORDS_KW )
1192  {
1193  ossimString value;
1194  getKeywords( value.string() );
1196  new ossimStringProperty( name, value, true);
1197  prop = stringProp.get();
1198  }
1199  else if ( name == MOD_DATE_KW )
1200  {
1201  ossimString value;
1202  getModDate( value.string() );
1204  new ossimStringProperty( name, value, true);
1205  prop = stringProp.get();
1206  }
1207  else if( name == ossimKeywordNames::OUTPUT_TILE_SIZE_KW )
1208  {
1209  ossimString value;
1210  getTileSize( value.string() );
1212  new ossimStringProperty( name, value, false);
1213  stringProp->addConstraint(ossimString("16"));
1214  stringProp->addConstraint(ossimString("32"));
1215  stringProp->addConstraint(ossimString("64"));
1216  stringProp->addConstraint(ossimString("128"));
1217  stringProp->addConstraint(ossimString("256"));
1218  stringProp->addConstraint(ossimString("512"));
1219  stringProp->addConstraint(ossimString("1024"));
1220  stringProp->addConstraint(ossimString("2048"));
1221  prop = stringProp.get();
1222  }
1223  else if ( name == SUBJECT_KW )
1224  {
1225  ossimString value;
1226  getSubject( value.string() );
1228  new ossimStringProperty( name, value, true);
1229  prop = stringProp.get();
1230  }
1231  else if ( name == TITLE_KW )
1232  {
1233  ossimString value;
1234  getSubject( value.string() );
1236  new ossimStringProperty( name, value, true);
1237  prop = stringProp.get();
1238  }
1239  else
1240  {
1241  prop = ossimImageFileWriter::getProperty(name);
1242  }
1243  }
1244 
1245  return prop;
1246 
1247 } // End: ossimPdfWriter::getProperty
void getCreator(std::string &s) const
Gets the Creator.
static const char * OUTPUT_TILE_SIZE_KW
void getKeywords(std::string &s) const
Gets the Keywords.
void getModDate(std::string &s) const
Gets the Producer.
void getSubject(std::string &s) const
Gets the Subject.
std::string::size_type size() const
Definition: ossimString.h:405
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossimPdfImageType getImageType() const
Gets the enumerated value of IMAGE_TYPE_KW lookup.
void getTileSize(std::string &s) const
Gets tiles size as string.
void getCreationDate(std::string &s) const
Gets the Producer.
void getAuthor(std::string &s) const
Gets the Author.
static const char * IMAGE_TYPE_KW
const std::string & string() const
Definition: ossimString.h:414

◆ getPropertyNames()

void ossimPdfWriter::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Pushes this's names onto the list of property names.

Parameters
propertyNamesarray to add this's property names to.

Reimplemented from ossimImageFileWriter.

Definition at line 1249 of file ossimPdfWriter.cpp.

References ossimImageFileWriter::getPropertyNames(), ossimKeywordNames::IMAGE_TYPE_KW, and ossimKeywordNames::OUTPUT_TILE_SIZE_KW.

1250 {
1251  propertyNames.push_back( ossimString( AUTHOR_KW ) );
1252  propertyNames.push_back( ossimString( CREATOR_KW ) );
1253  propertyNames.push_back( ossimString( CREATION_DATE_KW ) );
1254  propertyNames.push_back( ossimString( ossimKeywordNames::IMAGE_TYPE_KW ) );
1255  propertyNames.push_back( ossimString( KEYWORDS_KW ) );
1256  propertyNames.push_back( ossimString( MOD_DATE_KW ) );
1257  propertyNames.push_back( ossimString( ossimKeywordNames::OUTPUT_TILE_SIZE_KW ) );
1258  propertyNames.push_back( ossimString( PRODUCER_KW ) );
1259  propertyNames.push_back( ossimString( SUBJECT_KW ) );
1260  propertyNames.push_back( ossimString( TITLE_KW ) );
1261 
1263 }
static const char * OUTPUT_TILE_SIZE_KW
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
static const char * IMAGE_TYPE_KW

◆ getShortName()

virtual ossimString ossimPdfWriter::getShortName ( ) const
virtual
Returns
"pdf writer"

Reimplemented from ossimObject.

◆ getSubject()

void ossimPdfWriter::getSubject ( std::string &  s) const
private

Gets the Subject.

Looks in m_kwl for options keyword: "Subject"

Default: No default, empty string if not found.

Parameters
sInitialed by this.

Definition at line 1772 of file ossimPdfWriter.cpp.

References ossimKeywordlist::findKey(), and m_kwl.

Referenced by getProperty().

1773 {
1774  // Check if in keyword list.
1775  s = m_kwl->findKey( SUBJECT_KW );
1776 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.

◆ getTileSize() [1/2]

void ossimPdfWriter::getTileSize ( std::string &  s) const
private

Gets tiles size as string.

Looks in m_kwl for options keyword: "output_tile_size"

Defaults to 1024 if not found.

Parameters
sInitialized by this.

Definition at line 1850 of file ossimPdfWriter.cpp.

References ossim::defaultTileSize(), ossimKeywordlist::findKey(), m_kwl, ossimKeywordNames::OUTPUT_TILE_SIZE_KW, ossimString::string(), ossimString::toString(), and ossimIpt::x.

Referenced by getProperty(), and getTileSize().

1851 {
1852  // Check if in keyword list.
1853  s = m_kwl->findKey( std::string( ossimKeywordNames::OUTPUT_TILE_SIZE_KW ) );
1854  if ( s.empty() )
1855  {
1856  ossimIpt tileSize;
1857  ossim::defaultTileSize( tileSize );
1858  s = ossimString::toString( tileSize.x ).string();
1859  }
1860 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
static const char * OUTPUT_TILE_SIZE_KW
static ossimString toString(bool aValue)
Numeric to string methods.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.
ossim_int32 x
Definition: ossimIpt.h:141
const std::string & string() const
Definition: ossimString.h:414

◆ getTileSize() [2/2]

void ossimPdfWriter::getTileSize ( ossimIpt tileSize) const
private

Gets Tile size as integer point.

Defaults to 1024x1024 if not found.

Parameters
tileSizeInitialized by this.

Definition at line 1862 of file ossimPdfWriter.cpp.

References getTileSize(), ossimString::toInt32(), ossimIpt::x, and ossimIpt::y.

1863 {
1864  std::string s;
1865  getTileSize( s );
1866  if ( s.size() )
1867  {
1868  tileSize.x = ossimString(s).toInt32();
1869  }
1870  else
1871  {
1872  tileSize.x = 1024; // default
1873  }
1874  tileSize.y = tileSize.x;
1875 }
ossim_int32 toInt32() const
void getTileSize(std::string &s) const
Gets tiles size as string.
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141

◆ getTileString()

std::string ossimPdfWriter::getTileString ( ossim_uint32  x,
ossim_uint32  y 
) const
private
Returns
string for x and y in the form of (x=1, y=3): "/Tile_0001_0003"

Definition at line 1877 of file ossimPdfWriter.cpp.

References x, and y.

Referenced by for(), and if().

1878 {
1879  // Format like: /Tile_0001_0002
1880  std::ostringstream os;
1881  os << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
1882  << std::setfill('0')
1883  << "/Tile_"
1884  << std::setw(4) << x
1885  << "_"
1886  << std::setw(4) << y;
1887 
1888  return os.str();
1889 }
ossim_uint32 x
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
ossim_uint32 y

◆ getTitle()

void ossimPdfWriter::getTitle ( std::string &  s) const
private

Gets the Title.

Looks in m_kwl for options keyword: "Title"

Defaults to basename of output file if not found.

Parameters
sInitialed by this.

Definition at line 1746 of file ossimPdfWriter.cpp.

References ossimFilename::file(), ossimKeywordlist::findKey(), m_kwl, ossimString::size(), ossimString::string(), and ossimImageFileWriter::theFilename.

1747 {
1748  // Check if in keyword list.
1749  s = m_kwl->findKey( TITLE_KW );
1750 
1751  if ( s.empty() )
1752  {
1753  if ( theFilename.size() )
1754  {
1755  // Set to basename of file.
1756  s = theFilename.file().string();
1757  }
1758  }
1759 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options in key, value pair map.
std::string::size_type size() const
Definition: ossimString.h:405
ossimFilename file() const
const std::string & string() const
Definition: ossimString.h:414

◆ hasImageType()

bool ossimPdfWriter::hasImageType ( const ossimString imageType) const
virtual

bool hasImageType(const ossimString& imageType) const

Parameters
imageTypestring representing image type.
Returns
true if "imageType" is supported by writer.

Reimplemented from ossimImageFileWriter.

Definition at line 1107 of file ossimPdfWriter.cpp.

1108 {
1109  bool result = false;
1110  if ( (imageType == "ossim_pdf") || (imageType == "image/pdf")||(imageType == "application/pdf") )
1111  {
1112  result = true;
1113  }
1114  return result;
1115 }

◆ isOpen()

bool ossimPdfWriter::isOpen ( ) const
virtual
Returns
true if open, false if not.

Implements ossimOutputSource.

Definition at line 1036 of file ossimPdfWriter.cpp.

References m_str.

1037 {
1038  bool result = false;
1039  if (m_str)
1040  {
1041  const std::ofstream* fs = dynamic_cast<const std::ofstream*>(m_str);
1042  if ( fs )
1043  {
1044  result = fs->is_open();
1045  }
1046  else
1047  {
1048  // Pointer good enough...
1049  result = true;
1050  }
1051  }
1052  return result;
1053 }
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
std::ostream * m_str

◆ loadState()

bool ossimPdfWriter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Returns
True on success, false on error.

Reimplemented from ossimImageFileWriter.

Definition at line 1030 of file ossimPdfWriter.cpp.

References ossimImageFileWriter::loadState().

1032 {
1033  return ossimImageFileWriter::loadState(kwl, prefix);
1034 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)

◆ open()

bool ossimPdfWriter::open ( )
virtual

Open method.

Returns
True on success, false on error.

Implements ossimOutputSource.

Definition at line 1056 of file ossimPdfWriter.cpp.

References ossimString::c_str(), close(), m_ownsStream, m_str, ossimString::size(), and ossimImageFileWriter::theFilename.

1057 {
1058  bool result = false;
1059 
1060  close();
1061 
1062  // Check for empty filenames.
1063  if (theFilename.size())
1064  {
1065  std::ofstream* os = new std::ofstream();
1066  os->open(theFilename.c_str(), ios::out | ios::binary);
1067  if(os->is_open())
1068  {
1069  m_str = os;
1070  m_ownsStream = true;
1071  result = true;
1072  }
1073  else
1074  {
1075  delete os;
1076  os = 0;
1077  }
1078  }
1079  return result;
1080 }
std::string::size_type size() const
Definition: ossimString.h:405
virtual void close()
Closes file.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
std::ostream * m_str

◆ saveState()

bool ossimPdfWriter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

saves the state of the object.

Reimplemented from ossimImageFileWriter.

Definition at line 1024 of file ossimPdfWriter.cpp.

References ossimImageFileWriter::saveState().

1026 {
1027  return ossimImageFileWriter::saveState(kwl, prefix);
1028 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

◆ setOutputStream()

bool ossimPdfWriter::setOutputStream ( std::ostream &  stream)
virtual

Sets the output stream to write to.

The stream will not be closed/deleted by this object.

Parameters
outputThe stream to write to.

Reimplemented from ossimImageFileWriter.

Definition at line 1265 of file ossimPdfWriter.cpp.

References m_ownsStream, and m_str.

1266 {
1267  if (m_ownsStream && m_str)
1268  {
1269  delete m_str;
1270  }
1271  m_str = &stream;
1272  m_ownsStream = false;
1273  return true;
1274 }
std::ostream * m_str

◆ setProperty()

void ossimPdfWriter::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Will set the property whose name matches the argument "property->getName()".

Parameters
propertyObject containing property to set.

Reimplemented from ossimImageFileWriter.

Definition at line 1117 of file ossimPdfWriter.cpp.

References addOption(), ossimKeywordNames::IMAGE_TYPE_KW, ossimKeywordNames::OUTPUT_TILE_SIZE_KW, ossimImageFileWriter::setProperty(), ossimRefPtr< T >::valid(), and ossimProperty::valueToString().

1118 {
1119  if ( property.valid() )
1120  {
1121  std::string name = property->getName().string();
1122  if ( name.size() )
1123  {
1124  if ( ( name == ossimKeywordNames::IMAGE_TYPE_KW ) ||
1125  ( name == AUTHOR_KW ) ||
1126  ( name == CREATOR_KW ) ||
1127  ( name == CREATION_DATE_KW ) ||
1128  ( name == KEYWORDS_KW ) ||
1129  ( name == MOD_DATE_KW ) ||
1131  ( name == PRODUCER_KW ) ||
1132  ( name == SUBJECT_KW ) ||
1133  ( name == TITLE_KW ) )
1134  {
1135  addOption( name, property->valueToString().string() );
1136  }
1137  else
1138  {
1140  }
1141  }
1142  }
1143 
1144 } // ossimPdfWriter::setProperty
virtual void valueToString(ossimString &valueResult) const =0
static const char * OUTPUT_TILE_SIZE_KW
bool valid() const
Definition: ossimRefPtr.h:75
void addOption(const std::string &key, const std::string &value)
Adds option to m_kwl with mutex lock.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
static const char * IMAGE_TYPE_KW

◆ setupInputChain()

void ossimPdfWriter::setupInputChain ( )
private

Writes "dummy" or blank object just to keep object references in line.

Parameters
strStream to write to.
xrefTo capture object positions. Sets up input image source. This sets up the chain fed to theInputConnection which is an image source sequencer. This will remap input to eight bit if not already and make input one or three band depending on number of bands. Also sets m_saveInput for reconnection at the end of write.

Definition at line 1276 of file ossimPdfWriter.cpp.

References ossimRefPtr< T >::get(), ossimConnectableObject::getInput(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getOutputScalarType(), m_savedInput, OSSIM_UINT8, and ossimImageFileWriter::theInputConnection.

1277 {
1278  if ( theInputConnection.get() )
1279  {
1280  // Capture the input to the image source sequencer(theInputConnection).
1282 
1285 
1286  if( inputScalar != OSSIM_UINT8 )
1287  {
1288  // Make eight bit.
1289  if (traceDebug())
1290  {
1292  << "ossimPdfWriter::setupInputChain WARNING:"
1293  << "\nData is being scaled to 8 bit!"
1294  << "\nOriginal scalar type: "
1296  getEntryString(inputScalar).c_str()
1297  << std::endl;
1298  }
1299 
1300  //---
1301  // Attach a scalar remapper to the end of the input chain. This will
1302  // need to be unattached and deleted at the end of this.
1303  //---
1305 
1306  // Connect remapper's input to sequencer input.
1308 
1309  // Connet sequencer to remapper.
1311 
1312  // Initialize connections.
1314  }
1315 
1316  // Must be one or three band. Note bands are zero based...
1317  if ( ( bands != 1 ) && ( bands != 3 ) )
1318  {
1319  std::vector<ossim_uint32> bandList;
1320 
1321  // Always have one band.
1322  bandList.push_back( 0 );
1323 
1324  if ( bands > 3 )
1325  {
1326  // Use the first three bands.
1327  bandList.push_back( 1 );
1328  bandList.push_back( 2 );
1329  }
1330 
1331  if (traceDebug())
1332  {
1334  << "ossimPdfWriter::setupInputChain WARNING:"
1335  << "\nOutput bands must be 1 or 3 and are being filterd!"
1336  << "\nOriginal band count: " << bands
1337  << "\nNew band count: " << bandList.size()
1338  << std::endl;
1339  }
1340 
1342 
1343  // Set the the band selector list.
1344  bs->setOutputBandList( bandList );
1345 
1346  // Connect band selector's input to sequencer input.
1348 
1349  // Connet sequencer to band selector.
1351 
1352  // Initialize connections.
1354  }
1355 
1356  if ( m_savedInput != theInputConnection->getInput( 0 ) )
1357  {
1358  //---
1359  // If the input to the image source sequencer change the AOI
1360  // MUST be reset as it gets wiped.
1361  //---
1363  }
1364 
1365  } // Matches: if ( theInputConnection )
1366 
1367 } // End: void ossimPdfWriter::setupInputChain()
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossimIrect theAreaOfInterest
ossimRefPtr< ossimConnectableObject > m_savedInput
Holds the origin end of the chain connected to theInputConnection.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
virtual void setAreaOfInterest(const ossimIrect &areaOfInterest)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
unsigned int ossim_uint32
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
ossimScalarType
virtual void setOutputBandList(const vector< ossim_uint32 > &outputBandList, bool disablePassThru=false)
Sets the output band list.
8 bit unsigned integer
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ writeCatalog()

void ossimPdfWriter::writeCatalog ( std::ostream *  str,
std::vector< std::streamoff > &  xref 
)
private

Writes Catalog object.

Parameters
strStream to write to.
xrefTo capture object positions.

◆ writeFile()

virtual bool ossimPdfWriter::writeFile ( )
privatevirtual

Writes the file to disk or a stream.

Returns
true on success, false on error.

Implements ossimImageFileWriter.

◆ writeHeader()

void ossimPdfWriter::writeHeader ( std::ostream *  str)
private

Writes header.

Parameters
strStream to write to.

◆ writeImage()

bool ossimPdfWriter::writeImage ( std::ostream *  str)
private

Writes the image dictionary and associated objects.

Parameters
strStream to write to.
Returns
true on success, false on error.

◆ writeInfo()

void ossimPdfWriter::writeInfo ( std::ostream *  str,
std::vector< std::streamoff > &  xref 
)
private

Writes document infomation dictionary.

Parameters
strStream to write to.
xrefOffsetOffset to cross reference(xref) table.

◆ writeJpegTile()

void ossimPdfWriter::writeJpegTile ( std::ostream *  str,
std::vector< std::streamoff > &  xref,
ossimImageData id,
const ossimIrect aoi,
ossimIrect outputTileRect 
)
private

Write a JPEG-compresses the raster tile buffer to the output stream provided.

Parameters
strStream to write to.
xrefTo capture object positions.
idPointer to tile data.
aoiArea of interest.
outputTileRectInitialized by this with output tile rect clamped to aoi.

Definition at line 721 of file ossimPdfWriter.cpp.

References ossimImageData::getHeight(), ossimImageData::getImageRectangle(), ossimImageData::getOrigin(), ossimImageData::getUcharBuf(), ossimImageData::getWidth(), ossimImageData::initialize(), jpeg_cpp_stream_dest(), ossimIrect::lr(), OSSIM_BIP, OSSIM_UINT8, ossimImageData::setOrigin(), TRUE, ossimIpt::x, and ossimIpt::y.

Referenced by while().

726 {
727  //---
728  // Most of code and comments below are from jpeg-6b "example.c" file. See
729  // http://www4.cs.fau.de/Services/Doc/graphics/doc/jpeg/libjpeg.html
730  //---
731 
732  //---
733  // Initialize JPEG compression library:
734  // Note: JDIMENSION is typedefed to an unsigned int.
735  //---
736  struct jpeg_compress_struct cinfo;
737  struct jpeg_error_mgr jerr;
738  cinfo.err = jpeg_std_error( &jerr );
739  jpeg_create_compress(&cinfo);
740 
741  //---
742  // Need to define a custom ostream destination manager for jpeglib to write compressed block:
743  // Note: Write the tile to a temp memory stream to get the size up front.
744  //---
745  std::ostringstream tileStream;
746  jpeg_cpp_stream_dest(&cinfo, tileStream);
747 
748 
749  // Setting the parameters of the output file here.
750  const ossim_uint32 BANDS = id->getNumberOfBands();
751  const ossim_uint32 TW = id->getWidth();
752  const ossim_uint32 TH = id->getHeight();
753 
754 
755  // Assign width, height clamping to the aoi.
756  cinfo.image_width = ossim::min<ossim_uint32>(
757  TW, aoi.lr().x - id->getOrigin().x + 1 );
758  cinfo.image_height = ossim::min<ossim_uint32>(
759  TH, aoi.lr().y - id->getOrigin().y + 1 );
760  cinfo.input_components = BANDS;
761 
762  // Capture the output tile rect:
763  outputTileRect = ossimIrect( id->getOrigin(),
764  ossimIpt( id->getOrigin().x + cinfo.image_width - 1,
765  id->getOrigin().y + cinfo.image_height - 1 ) );
766 
767  // colorspace of input image
768  if ( BANDS == 3 )
769  {
770  cinfo.in_color_space = JCS_RGB;
771  }
772  else
773  {
774  cinfo.in_color_space = JCS_GRAYSCALE;
775  }
776 
777  // Default compression parameters...
778  jpeg_set_defaults( &cinfo );
779 
780  /* Now do the compression .. */
781  jpeg_start_compress( &cinfo, TRUE );
782 
783  // Compress the tile on line at a time:
784  JSAMPLE** samp_array = new JSAMPLE* [cinfo.image_height];
785 
786  //---
787  // Get a pointer to the source data.
788  // Needs to be band interleaved by pixel(BIP), so convert if needed.
789  //---
790  ossimRefPtr<ossimImageData> tempTile = 0;
791  ossim_uint8* tile = 0;
792  if ( ( BANDS == 1 ) &&
793  ( cinfo.image_width == id->getWidth() ) &&
794  ( cinfo.image_height == id->getHeight() ) )
795  {
796  tile = id->getUcharBuf();
797  }
798  else
799  {
800  // Convert from OSSIM's native BSQ interleave to BIP.
801  tempTile = new ossimImageData(
802  0, OSSIM_UINT8, BANDS, cinfo.image_width, cinfo.image_height );
803  tempTile->setOrigin( id->getOrigin() );
804  tempTile->initialize();
805  tile = tempTile->getUcharBuf();
806  id->unloadTile( tile, tempTile->getImageRectangle(), OSSIM_BIP );
807  }
808 
809  for ( ossim_uint32 row=0; row<cinfo.image_height; ++row )
810  {
811  samp_array[row] = (JSAMPLE*) tile + row*cinfo.input_components*cinfo.image_width;
812  }
813 
814  jpeg_write_scanlines( &cinfo, samp_array, cinfo.image_height );
815 
816  //---
817  // Clean up after done compressing:
818  // Note: MUST do before writing to output stream below.
819  //---
820  jpeg_finish_compress( &cinfo );
821  jpeg_destroy_compress( &cinfo );
822  delete [] samp_array;
823  samp_array = 0;
824 
825  // Capture position:
826  xref.push_back( (std::streamoff)str->tellp() );
827 
828  std::ostringstream os1;
829  os1 << xref.size() << " 0 obj\n"
830  << " << /Type /XObject\n"
831  << " /Subtype /Image\n"
832  << " /Length " << tileStream.str().size() << "\n"
833  << " /Filter[/DCTDecode]\n"
834  << " /BitsPerComponent 8"
835  << " /ColorSpace " << (BANDS==1?"/DeviceGray\n":"/DeviceRGB\n")
836  << " /Width " << cinfo.image_width
837  << " /Height " << cinfo.image_height
838  << " >>\n"
839  << "stream\n";
840 
841  str->write( os1.str().data(), os1.str().size() );
842 
843  if ( traceLog() )
844  {
846  << os1.str()
847  << "*** image stream not displayed ***\n"
848  << "endstream\n"
849  << "endobj\n\n";
850  }
851 
852  // Write the image tile from memory to output stream.
853  str->write( tileStream.str().data(), tileStream.str().size() );
854 
855  // Close out stream object.
856  *str << "\n"
857  << "endstream\n"
858  << "endobj\n";
859 
860 } // End: ossimPdfWriter::writeJpegTile( ... )
virtual ossim_uint32 getWidth() const
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual const ossim_uint8 * getUcharBuf() const
virtual ossim_uint32 getHeight() const
virtual void initialize()
Initialize the data buffer.
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
const ossimIpt & lr() const
Definition: ossimIrect.h:276
virtual void setOrigin(const ossimIpt &origin)
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
OSSIM_DLL void jpeg_cpp_stream_dest(jpeg_compress_struct *cinfo, std::ostream &stream)
Method which uses memory instead of a FILE* to write to.
virtual const ossimIpt & getOrigin() const
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ writePages()

void ossimPdfWriter::writePages ( std::ostream *  str,
std::vector< std::streamoff > &  xref 
)
private

Writes Outlines object.

Parameters
strStream to write to.
xrefTo capture object positions. Writes Pages object.
strStream to write to.
xrefTo capture object positions.

◆ writeRawTile()

void ossimPdfWriter::writeRawTile ( std::ostream *  str,
std::vector< std::streamoff > &  xref,
ossimImageData id,
const ossimIrect aoi,
ossimIrect outputTileRect 
)
private

Write raw raster tile buffer to the output stream provided.

Parameters
strStream to write to.
xrefTo capture object positions.
idPointer to tile data.
aoiArea of interest.
outputTileRectInitialized by this with output tile rect clamped to aoi.

Definition at line 862 of file ossimPdfWriter.cpp.

References ossimImageData::getHeight(), ossimImageData::getImageRectangle(), ossimImageData::getOrigin(), ossimImageData::getSizeInBytes(), ossimImageData::getUcharBuf(), ossimImageData::getWidth(), ossimImageData::initialize(), ossimIrect::lr(), OSSIM_BIP, OSSIM_UINT8, ossimImageData::setOrigin(), ossimIpt::x, and ossimIpt::y.

Referenced by while().

867 {
868  const ossim_uint32 BANDS = id->getNumberOfBands();
869  const ossim_uint32 TW = id->getWidth();
870  const ossim_uint32 TH = id->getHeight();
871 
872  // Assign width, height clamping to the aoi.
873  ossim_uint32 width = ossim::min<ossim_uint32>(
874  TW, aoi.lr().x - id->getOrigin().x + 1 );
875  ossim_uint32 height = ossim::min<ossim_uint32>(
876  TH, aoi.lr().y - id->getOrigin().y + 1 );
877 
878  // Capture the output tile rect:
879  outputTileRect = ossimIrect( id->getOrigin(),
880  ossimIpt( id->getOrigin().x + width - 1,
881  id->getOrigin().y + height - 1 ) );
882 
883  //---
884  // Get a pointer to the source data.
885  // Needs to be band interleaved by pixel(BIP), so convert if needed.
886  //---
887  ossimRefPtr<ossimImageData> tempTile = 0;
888  ossim_uint8* tile = 0;
889  ossim_uint32 length = 0;
890  if ( ( BANDS == 1 ) && ( width == id->getWidth() ) && ( height == id->getHeight() ) )
891  {
892  tile = id->getUcharBuf();
893  length = id->getSizeInBytes();
894  }
895  else
896  {
897  // Convert from OSSIM's native BSQ interleave to BIP.
898  tempTile = new ossimImageData( 0, OSSIM_UINT8, BANDS, width, height );
899  tempTile->setOrigin( id->getOrigin() );
900  tempTile->initialize();
901  tile = tempTile->getUcharBuf();
902  id->unloadTile( tile, tempTile->getImageRectangle(), OSSIM_BIP );
903  length = tempTile->getSizeInBytes();
904  }
905 
906  // Capture position:
907  xref.push_back( (std::streamoff)str->tellp() );
908 
909  std::ostringstream os1;
910  os1 << xref.size() << " 0 obj\n"
911  << " << /Type /XObject\n"
912  << " /Subtype /Image\n"
913  << " /Length " << length << "\n"
914  << " /BitsPerComponent 8"
915  << " /ColorSpace " << (BANDS==1?"/DeviceGray\n":"/DeviceRGB\n")
916  << " /Width " << width
917  << " /Height " << height
918  << " >>\n"
919  << "stream\n";
920 
921  str->write( os1.str().data(), os1.str().size() );
922 
923  if ( traceLog() )
924  {
926  << os1.str()
927  << "*** image stream not displayed ***\n"
928  << "endstream\n"
929  << "endobj\n\n";
930  }
931 
932  // Write the image tile from memory to output stream.
933  str->write( (char*)tile, length );
934 
935  // Close out stream object.
936  *str << "\n"
937  << "endstream\n"
938  << "endobj\n";
939 
940 } // End ossimPdfWriter::writeRawTile( ... )
virtual ossim_uint32 getWidth() const
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual const ossim_uint8 * getUcharBuf() const
virtual ossim_uint32 getHeight() const
virtual void initialize()
Initialize the data buffer.
virtual ossim_uint32 getSizeInBytes() const
Returns the total number of bytes for all bands.
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
const ossimIpt & lr() const
Definition: ossimIrect.h:276
virtual void setOrigin(const ossimIpt &origin)
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
virtual const ossimIpt & getOrigin() const
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ writeStream()

virtual bool ossimPdfWriter::writeStream ( )
virtual

Method to write the image to a stream.

Returns
true on success, false on error.

Reimplemented from ossimImageFileWriter.

◆ writeTrailer()

void ossimPdfWriter::writeTrailer ( std::ostream *  str,
ossim_uint32  entrySize,
std::streamoff  xrefOffset 
)
private

Writes trailer.

Parameters
strStream to write to.
entrySizeNumber of entries, one plus object count.
xrefOffsetOffset to cross reference(xref) table.

Definition at line 974 of file ossimPdfWriter.cpp.

977 {
978  if ( str )
979  {
981  os << "trailer\n"
982  << " << /Size " << entrySize << "\n"
983  << " /Root 1 0 R\n"
984  << " /Info " << entrySize-1 << " 0 R\n"
985  << " >>\n"
986  << "startxref\n"
987  << xrefOffset << "\n"
988  << "%%EOF\n";
989  // << "%%EOF";
990 
991  str->write( os.str().data(), os.str().size() );
992 
993  if ( traceLog() )
994  {
995  ossimNotify(ossimNotifyLevel_DEBUG) << os.str() << "\n";
996  }
997  }
998 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ writeXref()

void ossimPdfWriter::writeXref ( std::ostream *  str,
const std::vector< std::streamoff > &  xref 
)
private

Writes Cross Reference(xref) section.

Parameters
strStream to write to.
xrefArray of object offsets.

Definition at line 942 of file ossimPdfWriter.cpp.

944 {
945  if ( str )
946  {
948  os << "xref\n"
949  << "0 " << (xref.size()+1) << "\n"
950  << "0000000000 65535 f \n";
951 
952  std::vector<std::streamoff>::const_iterator i = xref.begin();
953  while ( i != xref.end() )
954  {
955  os << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
956  << std::setfill('0')
957  << std::setw(10)
958  << (*i)
959  << " 00000 n \n";
960  ++i;
961  }
962 
963  // os << "\n";
964 
965  str->write( os.str().data(), os.str().size() );
966 
967  if ( traceLog() )
968  {
969  ossimNotify(ossimNotifyLevel_DEBUG) << os.str() << "\n";
970  }
971  }
972 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Data Documentation

◆ m_kwl

ossimRefPtr<ossimKeywordlist> ossimPdfWriter::m_kwl
private

Holds all options in key, value pair map.

Definition at line 547 of file ossimPdfWriter.h.

Referenced by addOption(), getAuthor(), getCreationDate(), getCreator(), getImageType(), getKeywords(), getModDate(), getProducer(), getSubject(), getTileSize(), and getTitle().

◆ m_mutex

std::mutex ossimPdfWriter::m_mutex
private

Definition at line 549 of file ossimPdfWriter.h.

Referenced by addOption().

◆ m_ownsStream

bool ossimPdfWriter::m_ownsStream
private

Definition at line 539 of file ossimPdfWriter.h.

Referenced by close(), open(), and setOutputStream().

◆ m_savedInput

ossimRefPtr<ossimConnectableObject> ossimPdfWriter::m_savedInput
private

Holds the origin end of the chain connected to theInputConnection.

Definition at line 544 of file ossimPdfWriter.h.

Referenced by setupInputChain().

◆ m_str

std::ostream* ossimPdfWriter::m_str
private

Definition at line 538 of file ossimPdfWriter.h.

Referenced by close(), isOpen(), open(), and setOutputStream().


The documentation for this class was generated from the following files: