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

#include <ossimGpkgReader.h>

Inheritance diagram for ossimGpkgReader:
ossimImageHandler ossimImageSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimGpkgReader ()
 default constructor More...
 
virtual ~ossimGpkgReader ()
 virtual destructor More...
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &rect, ossim_uint32 resLevel=0)
 Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab from the image. More...
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 Returns the number of bands in the image. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossim_uint32 getNumberOfLines (ossim_uint32 resLevel=0) const
 Returns the number of lines in the image. More...
 
virtual ossim_uint32 getNumberOfSamples (ossim_uint32 resLevel=0) const
 Returns the number of samples in the image. More...
 
virtual ossimIrect getImageRectangle (ossim_uint32 resLevel=0) const
 Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. 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)
 Set propterty method. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 Get propterty method. More...
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Get propterty names. More...
 
virtual ossimScalarType getOutputScalarType () const
 Returns the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the width of the output tile. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the height of the output tile. More...
 
virtual ossim_uint32 getImageTileWidth () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
virtual ossim_uint32 getImageTileHeight () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
virtual void close ()
 Close method. More...
 
virtual ossim_uint32 getNumberOfEntries () const
 
virtual ossim_uint32 getCurrentEntry () const
 
virtual void getEntryList (std::vector< ossim_uint32 > &entryList) const
 Gets the entry list. More...
 
virtual void getEntryNames (std::vector< ossimString > &entryNames) const
 Get the list of entry names. More...
 
virtual bool setCurrentEntry (ossim_uint32 entryIdx)
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Returns the number of decimation levels. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 
virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry ()
 
- Public Member Functions inherited from ossimImageHandler
 ossimImageHandler ()
 Constructor (default): More...
 
virtual ~ossimImageHandler ()
 Destructor: Derived classes should implement. More...
 
virtual void initialize ()
 initialize Does nothing in this class. More...
 
virtual bool openOverview ()
 Searches for an overview. More...
 
virtual bool openOverview (const ossimFilename &overview_file)
 Calls closeOverview(), then attempts to open the overview_file. More...
 
virtual void closeOverview ()
 If theOverview is initialized it will be deleted and set to NULL. More...
 
virtual const ossimImageHandlergetOverview () const
 
virtual bool hasOverviews () const
 
virtual ossimFilename createDefaultOverviewFilename () const
 
virtual ossimFilename createDefaultGeometryFilename () const
 
virtual ossimFilename createDefaultMetadataFilename () const
 
virtual ossimFilename createDefaultHistogramFilename () const
 
virtual ossimFilename createDefaultValidVerticesFilename () const
 
virtual bool writeValidImageVertices (const std::vector< ossimIpt > &vertices, const ossimFilename &file=ossimFilename(""))
 Outputs vertices to file and updates the internal vertex array variable "theValidImageVertices". More...
 
virtual bool openValidVertices (const ossimFilename &vertices_file)
 Opens the valid image vertices file and sets theValidImageVerticesFile variable. More...
 
virtual bool openValidVertices ()
 Creates vertices file name based on image, then tries to open. More...
 
virtual bool open (const ossimFilename &imageFile, ossim_uint32 entryIndex)
 Opens the image file. More...
 
virtual bool open (const ossimFilename &imageFile)
 
virtual bool open (std::shared_ptr< ossim::ImageHandlerState > state)
 
virtual bool buildHistogram (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histogram for image file. More...
 
virtual bool buildAllHistograms (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histograms for all image entries. More...
 
virtual bool buildOverview (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for theImageFile. More...
 
virtual bool buildAllOverviews (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for all image entries. More...
 
virtual bool buildOverview (const ossimFilename &filename, ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build an over file for filename. More...
 
ossimRefPtr< ossimMultiResLevelHistogramgetImageHistogram () const
 Fetches the current entry image's histogram. More...
 
virtual void setImageGeometry (ossimImageGeometry *geom)
 Sets the image geometry object. More...
 
virtual void saveImageGeometry () const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 Returns zero-based bounding rectangle of the image. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 
virtual void getDecimationFactors (vector< ossimDpt > &decimations) const
 This returns all decimation for all levels. More...
 
virtual ossim_uint32 getNumberOfReducedResSets () const
 This method is obsolete. More...
 
virtual void setFilename (const ossimFilename &filename)
 Sets the filename. More...
 
virtual const ossimFilenamegetFilename () const
 Returns the filename. More...
 
virtual bool isValidRLevel (ossim_uint32 resLevel) const
 Determines if the passed in reslution level is valid. More...
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 Connection rule. More...
 
virtual void getValidImageVertices (vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual bool isBandSelector () const
 Indicates whether or not the image handler can control output band selection via the setOutputBandList method. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &band_list)
 If the image handler "isBandSeletor()" then the band selection of the output chip can be controlled. More...
 
virtual bool setOutputToInputBandList ()
 If the image handler "isBandSeletor()" then the band selection of the output are set to input or identity. More...
 
virtual bool isIdentityBandList (const std::vector< ossim_uint32 > &bandList) const
 Convenience method to see if band list is identity. More...
 
virtual bool isImageTiled () const
 Indicates whether or not the image is tiled internally. More...
 
virtual bool hasMetaData () const
 
virtual ossimRefPtr< ossimNBandLutDataObjectgetLut () const
 
virtual bool hasLut () const
 
virtual void loadMetaData ()
 There is an external file with an omd extension. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Retuns the min pixel value. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual void setMinPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set min pixel value. More...
 
virtual void setMaxPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set max pixel value. More...
 
virtual void setNullPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set null pixel value. More...
 
virtual void getEntryName (ossim_uint32 entryIdx, std::string &name) const
 Get the name of entry as a string. More...
 
bool useEntryIndex () const
 Convenience method to determine if entry index should be used for support files, e.g. More...
 
ossimFilename getOverviewFile () const
 
ossimFilename getFilenameWithThisExtension (const ossimString &ext, bool set_e0_prefix=false) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
void getFilenameWithThisExt (const ossimString &ext, ossimFilename &f) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
ossim_uint32 getStartingResLevel () const
 
void setStartingResLevel (ossim_uint32 level)
 
bool getOpenOverviewFlag () const
 
void setOpenOverviewFlag (bool flag)
 Sets theOpenOverviewFlag. More...
 
virtual void setSupplementaryDirectory (const ossimFilename &dir)
 Sets the supplementary directory. More...
 
virtual const ossimFilenamegetSupplementaryDirectory () const
 Returns the supplementary directory. More...
 
const ossimStringgetImageID () const
 Fetches the image ID. More...
 
void setImageID (const ossimString &id)
 Sets the image ID in case it is externally generated. More...
 
ossimPixelType getPixelType () const
 Returns the raster pixel alignment type. More...
 
virtual bool getRgbBandList (std::vector< ossim_uint32 > &bandList) const
 Convenience method to get the zero based rgb output band list. More...
 
template<class T >
std::shared_ptr< T > getStateAs ()
 
template<class T >
std::shared_ptr< const T > getStateAs () const
 
std::shared_ptr< ossim::ImageHandlerState > getState ()
 
std::shared_ptr< const ossim::ImageHandlerState > getState () const
 
void setState (std::shared_ptr< ossim::ImageHandlerState > state)
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 Initializes bandList. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual bool isIndexedData () const
 
- 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 addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
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
 

Protected Member Functions

virtual bool open ()
 open method. More...
 
- Protected Member Functions inherited from ossimImageHandler
virtual ossimRefPtr< ossimImageGeometrygetExternalImageGeometry () const
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry () const
 
virtual bool getOverviewTile (ossim_uint32 resLevel, ossimImageData *result)
 Method to get an overview tile. More...
 
bool initVertices (const char *file)
 Opens file and attempts to initialize the valid image vertices. More...
 
virtual void completeOpen ()
 Will complete the opening process. More...
 
void initImageParameters (ossimImageGeometry *geom) const
 Convenience method to set things needed in the image geometry from the image handler. More...
 
virtual void establishDecimationFactors ()
 Virtual method determines the decimation factors at each resolution level. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &inBandList, std::vector< ossim_uint32 > &outBandList)
 Convenience method to set output band list. More...
 
void getFilenameWithNoExtension (ossimFilename &f) const
 Get filename with no extension, using supplentary directory for dirname if set. More...
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- 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)
 

Private Member Functions

bool initImageParams ()
 
void allocate ()
 Allocates m_tile. More...
 
void fillTile (ossim_uint32 resLevel, const ossimIrect &tileRect, const ossimIrect &clipRect, ossimImageData *tile)
 
ossimRefPtr< ossimImageDatagetTile (ossim_uint32 resLevel, ossimIpt index)
 
ossimRefPtr< ossimImageDatauncompressPngTile (const ossimGpkgTileRecord &tile, const ossimIpt &tileSize)
 Uncompresses png tile to m_cacheTile. More...
 
void getTileIndexes (ossim_uint32 resLevel, const ossimIrect &clipRect, std::vector< ossimIpt > &tileIndexes) const
 
void getTileSize (ossim_uint32 resLevel, ossimIpt &tileSize) const
 
ossim_uint32 getNumberOfZoomLevels () const
 
void computeGsd (ossimDpt &gsd) const
 

Private Attributes

ossimRefPtr< ossimImageHandlerm_ih
 
ossimRefPtr< ossimImageDatam_tile
 
ossimRefPtr< ossimImageDatam_cacheTile
 
sqlite3 * m_db
 
ossim_uint32 m_currentEntry
 
ossim_uint32 m_bands
 
ossimScalarType m_scalar
 
ossim_uint32 m_tileWidth
 
ossim_uint32 m_tileHeight
 
std::vector< ossimGpkgTileEntrym_entries
 
ossimRefPtr< ossimCodecBasem_jpegCodec
 
ossimRefPtr< ossimCodecBasem_pngCodec
 

Additional Inherited Members

- Public Types inherited from ossimImageHandler
enum  ossimImageHandlerOverviewCompressionType {
  OSSIM_OVERVIEW_COMPRESSION_NONE = 0, OSSIM_OVERVIEW_COMPRESSION_JPEG, OSSIM_OVERVIEW_COMPRESSION_LZW, OSSIM_OVERVIEW_COMPRESSION_DEFLATE,
  OSSIM_OVERVIEW_COMPRESSION_PACKBITS
}
 
- 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
 
- Protected Attributes inherited from ossimImageHandler
ossimFilename theImageFile
 
ossimFilename theOverviewFile
 
ossimFilename theSupplementaryDirectory
 
ossimRefPtr< ossimImageHandlertheOverview
 
vector< ossimIpttheValidImageVertices
 
ossimImageMetaData theMetaData
 
ossimRefPtr< ossimImageGeometrytheGeometry
 
ossimRefPtr< ossimNBandLutDataObjecttheLut
 
std::vector< ossimDpttheDecimationFactors
 
ossimString theImageID
 
ossim_uint32 theStartingResLevel
 theStartingResLevel If set to something other than zero(default) this is indicative that the reader is an overview. More...
 
bool theOpenOverviewFlag
 If true opening of overviews will be attempted. More...
 
ossimPixelType thePixelType
 
std::shared_ptr< ossim::ImageHandlerState > m_state
 
- 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
 

Detailed Description

Definition at line 27 of file ossimGpkgReader.h.

Constructor & Destructor Documentation

◆ ossimGpkgReader()

ossimGpkgReader::ossimGpkgReader ( )

default constructor

Definition at line 57 of file ossimGpkgReader.cpp.

58  :
60  m_ih(0),
61  m_tile(0),
62  m_cacheTile(0),
63  m_db(0),
64  m_currentEntry(0),
65  m_bands(0),
67  m_tileWidth(0),
68  m_tileHeight(0),
69  m_entries(0)
70 {
71  if (traceDebug())
72  {
74  << "ossimGpkgReader::ossimGpkgReader entered...\n";
75 #ifdef OSSIM_ID_ENABLED
77  << "OSSIM_ID: " << OSSIM_ID << "\n";
78 #endif
79  }
80 }
ossim_uint32 m_tileWidth
ossim_uint32 m_tileHeight
ossimRefPtr< ossimImageHandler > m_ih
ossim_uint32 m_currentEntry
std::vector< ossimGpkgTileEntry > m_entries
ossimRefPtr< ossimImageData > m_tile
ossimRefPtr< ossimImageData > m_cacheTile
ossimImageHandler()
Constructor (default):
ossimScalarType m_scalar
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 m_bands

◆ ~ossimGpkgReader()

ossimGpkgReader::~ossimGpkgReader ( )
virtual

virtual destructor

Definition at line 82 of file ossimGpkgReader.cpp.

References close(), and isOpen().

83 {
84  if (isOpen())
85  {
86  close();
87  }
88 }
virtual void close()
Close method.
bool isOpen() const
Derived classes must implement this method to be concrete.

Member Function Documentation

◆ allocate()

void ossimGpkgReader::allocate ( )
private

Allocates m_tile.

Called on first getTile.

Definition at line 90 of file ossimGpkgReader.cpp.

References ossimImageDataFactory::create(), ossimImageData::initialize(), ossimImageDataFactory::instance(), and m_tile.

Referenced by getTile().

91 {
93  m_tile->initialize();
94 }
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimRefPtr< ossimImageData > m_tile
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const

◆ close()

void ossimGpkgReader::close ( )
virtual

Close method.

Reimplemented from ossimImageHandler.

Definition at line 474 of file ossimGpkgReader.cpp.

References ossimImageHandler::close(), isOpen(), m_db, and m_entries.

Referenced by ~ossimGpkgReader().

475 {
476  if ( isOpen() )
477  {
479  }
480  if ( m_db )
481  {
482  sqlite3_close( m_db );
483  m_db = 0;
484  }
485  m_entries.clear();
486 }
std::vector< ossimGpkgTileEntry > m_entries
virtual void close()
Deletes the overview and clears the valid image vertices.
bool isOpen() const
Derived classes must implement this method to be concrete.

◆ computeGsd()

void ossimGpkgReader::computeGsd ( ossimDpt gsd) const
private

Definition at line 994 of file ossimGpkgReader.cpp.

References m_currentEntry, and m_entries.

995 {
996  if ( m_currentEntry < m_entries.size() )
997  {
998  m_entries[m_currentEntry].getGsd( 0, gsd );
999  }
1000 
1001  if (traceDebug())
1002  {
1004  << "ossimGpkgReader::computeGsd DEBUG:\ngsd: " << gsd << "\n";
1005  }
1006 
1007 } // End: ossimGpkgReader::computeGsd
ossim_uint32 m_currentEntry
std::vector< ossimGpkgTileEntry > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ fillTile()

void ossimGpkgReader::fillTile ( ossim_uint32  resLevel,
const ossimIrect tileRect,
const ossimIrect clipRect,
ossimImageData tile 
)
private
Note
this method assumes that setImageRectangle has been called on theTile.

Definition at line 168 of file ossimGpkgReader.cpp.

References ossimIrect::clipToRect(), ossimImageData::getBuf(), ossimImageData::getImageRectangle(), getTile(), getTileIndexes(), OSSIM_BSQ, and ossimImageData::validate().

Referenced by getTile().

172 {
173  if ( tile )
174  {
175  // Get the tile indexes needed to fill the clipRect.
176  std::vector<ossimIpt> tileIndexes;
177  getTileIndexes( resLevel, clipRect, tileIndexes );
178 
179  std::vector<ossimIpt>::const_iterator i = tileIndexes.begin();
180  while ( i != tileIndexes.end() )
181  {
182  ossimRefPtr<ossimImageData> id = getTile( resLevel, (*i) );
183  if ( id.valid() )
184  {
185  ossimIrect tileClipRect = clipRect.clipToRect( id->getImageRectangle() );
186  id->unloadTile( tile->getBuf(), tileRect, tileClipRect, OSSIM_BSQ );
187  }
188  ++i;
189  }
190 
191  tile->validate();
192  }
193 }
void getTileIndexes(ossim_uint32 resLevel, const ossimIrect &clipRect, std::vector< ossimIpt > &tileIndexes) const
virtual ossimDataObjectStatus validate() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
virtual ossimIrect getImageRectangle() const
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
virtual const void * getBuf() const

◆ getClassName()

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

Reimplemented from ossimObject.

Definition at line 449 of file ossimGpkgReader.cpp.

450 {
451  return ossimString("ossimGpkgReader");
452 }

◆ getCurrentEntry()

ossim_uint32 ossimGpkgReader::getCurrentEntry ( ) const
virtual
Returns
The current entry number.

Reimplemented from ossimImageHandler.

Definition at line 493 of file ossimGpkgReader.cpp.

References m_currentEntry.

494 {
495  return m_currentEntry;
496 }
ossim_uint32 m_currentEntry

◆ getEntryList()

void ossimGpkgReader::getEntryList ( std::vector< ossim_uint32 > &  entryList) const
virtual

Gets the entry list.

Parameters
entryListThis is the list to initialize with entry indexes.

Reimplemented from ossimImageHandler.

Definition at line 498 of file ossimGpkgReader.cpp.

References m_entries.

499 {
500  for ( ossim_uint32 i = 0; i < m_entries.size(); ++i )
501  {
502  entryList.push_back(i);
503  }
504 }
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries

◆ getEntryNames()

void ossimGpkgReader::getEntryNames ( std::vector< ossimString > &  entryNames) const
virtual

Get the list of entry names.

This implementation uses the entry tile table name.

Parameters
getEntryNamesList to initialize with strings associated with entries.

Reimplemented from ossimImageHandler.

Definition at line 506 of file ossimGpkgReader.cpp.

References m_entries.

507 {
508  std::vector<ossimGpkgTileEntry>::const_iterator i = m_entries.begin();
509  while ( i != m_entries.end() )
510  {
511  entryNames.push_back( ossimString((*i).getTileMatrixSet().m_table_name) );
512  ++i;
513  }
514 }
std::vector< ossimGpkgTileEntry > m_entries

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimGpkgReader::getImageGeometry ( )
virtual
Returns
Returns the image geometry object associated with this tile source or NULL if non defined. The geometry contains full-to-local image transform as well as projection (image-to-world).

Reimplemented from ossimImageHandler.

Definition at line 589 of file ossimGpkgReader.cpp.

References ossimImageGeometryRegistry::extendGeometry(), ossimRefPtr< T >::get(), ossimImageHandler::getExternalImageGeometry(), getInternalImageGeometry(), ossimImageGeometry::getProjection(), ossimImageHandler::initImageParameters(), ossimImageGeometryRegistry::instance(), and ossimImageHandler::theGeometry.

590 {
591  if ( !theGeometry )
592  {
593  //---
594  // Check for external geom - this is a file.geom not to be confused with
595  // geometries picked up from dot.xml, dot.prj, dot.j2w and so on. We
596  // will check for that later if the getInternalImageGeometry fails.
597  //---
599 
600  if ( !theGeometry )
601  {
602  // Check the internal geometry first to avoid a factory call.
604 
605  //---
606  // WARNING:
607  // Must create/set the geometry at this point or the next call to
608  // ossimImageGeometryRegistry::extendGeometry will put us in an infinite loop
609  // as it does a recursive call back to ossimImageHandler::getImageGeometry().
610  //---
611  if ( !theGeometry )
612  {
614  }
615 
616  // Check for set projection.
617  if ( !theGeometry->getProjection() )
618  {
619  // Last try factories for projection.
621  }
622  }
623 
624  // Set image things the geometry object should know about.
626 
627  if (traceDebug())
628  {
630  << "ossimGpkgReader::getImageGeometry geometry:\n"
631  << *(theGeometry.get()) << "\n";
632  }
633 
634  }
635  return theGeometry;
636 
637 } // End: ossimGpkgReader::getImageGeometry()
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
virtual bool extendGeometry(ossimImageHandler *handler) const
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getImageRectangle()

ossimIrect ossimGpkgReader::getImageRectangle ( ossim_uint32  resLevel = 0) const
virtual

Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in.

Note that rrds 0 is the highest resolution rrds.

Reimplemented from ossimImageHandler.

Definition at line 245 of file ossimGpkgReader.cpp.

References getNumberOfLines(), and getNumberOfSamples().

Referenced by getTile().

246 {
247  return ossimIrect(0,
248  0,
249  getNumberOfSamples(resLevel) - 1,
250  getNumberOfLines(resLevel) - 1);
251 }
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Returns the number of lines in the image.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Returns the number of samples in the image.

◆ getImageTileHeight()

ossim_uint32 ossimGpkgReader::getImageTileHeight ( ) const
virtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 434 of file ossimGpkgReader.cpp.

References m_tileHeight.

Referenced by getTileHeight().

435 {
436  return m_tileHeight;
437 }
ossim_uint32 m_tileHeight

◆ getImageTileWidth()

ossim_uint32 ossimGpkgReader::getImageTileWidth ( ) const
virtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 429 of file ossimGpkgReader.cpp.

References m_tileWidth.

Referenced by getTileWidth().

430 {
431  return m_tileWidth;
432 }
ossim_uint32 m_tileWidth

◆ getInternalImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimGpkgReader::getInternalImageGeometry ( )
virtual
Parameters
Methodto get geometry from the embedded JP2 GeoTIFF Box.

Definition at line 639 of file ossimGpkgReader.cpp.

Referenced by getImageGeometry().

640 {
641  static const char M[] = "ossimGpkgReader::getInternalImageGeometry";
642 
644  if (traceDebug())
645  {
646  ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
647  }
648 
649  if ( m_currentEntry < m_entries.size() )
650  {
651  ossimRefPtr<ossimMapProjection> mapProj = m_entries[m_currentEntry].getNewMapProjection();
652 
653  if ( mapProj.valid() )
654  {
655  ossimRefPtr<ossimProjection> proj = mapProj.get();
656  if ( proj.valid() )
657  {
658  // Create and assign projection to our ossimImageGeometry object.
659  geom = new ossimImageGeometry();
660  geom->setProjection( proj.get() );
661  if (traceDebug())
662  {
663  ossimNotify(ossimNotifyLevel_DEBUG) << "Created geometry...\n";
664  }
665  }
666  }
667  }
668 
669  if (traceDebug())
670  {
671  if ( geom.valid() )
672  {
673  ossimNotify(ossimNotifyLevel_DEBUG) << M << " exited...\n";
674  }
675  }
676 
677  return geom;
678 
679 } // End: ossimGpkgReader::getInternalImageGeometry()
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossim_uint32 m_currentEntry
bool valid() const
Definition: ossimRefPtr.h:75
std::vector< ossimGpkgTileEntry > m_entries
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getLongName()

ossimString ossimGpkgReader::getLongName ( ) const
virtual
Returns
"ossim gpkg"

Reimplemented from ossimObject.

Definition at line 444 of file ossimGpkgReader.cpp.

445 {
446  return ossimString("ossim Geo Package reader");
447 }

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimGpkgReader::getNumberOfDecimationLevels ( ) const
virtual

Returns the number of decimation levels.

This returns the total number of decimation levels. It is important to note that res level 0 or full resolution is included in the list and has decimation values 1.0, 1.0

Returns
The number of decimation levels.

Reimplemented from ossimImageHandler.

Definition at line 553 of file ossimGpkgReader.cpp.

References ossimImageHandler::getNumberOfDecimationLevels(), getNumberOfZoomLevels(), ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

554 {
555  // Internal overviews.
557 
558  if (theOverview.valid())
559  {
560  // Add external overviews.
562  }
563 
564  return result;
565 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
ossim_uint32 getNumberOfZoomLevels() const
unsigned int ossim_uint32
ossimRefPtr< ossimImageHandler > theOverview

◆ getNumberOfEntries()

ossim_uint32 ossimGpkgReader::getNumberOfEntries ( ) const
virtual
Returns
The number of entries (images) in the image file.

Reimplemented from ossimImageHandler.

Definition at line 488 of file ossimGpkgReader.cpp.

References m_entries.

Referenced by setCurrentEntry().

489 {
490  return (ossim_uint32)m_entries.size();
491 }
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries

◆ getNumberOfInputBands()

ossim_uint32 ossimGpkgReader::getNumberOfInputBands ( ) const
virtual

Returns the number of bands in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageSource.

Definition at line 454 of file ossimGpkgReader.cpp.

References m_bands.

455 {
456  return m_bands;
457 }
ossim_uint32 m_bands

◆ getNumberOfLines()

ossim_uint32 ossimGpkgReader::getNumberOfLines ( ossim_uint32  resLevel = 0) const
virtual

Returns the number of lines in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageHandler.

Definition at line 396 of file ossimGpkgReader.cpp.

References ossimImageHandler::getNumberOfLines(), m_currentEntry, m_entries, ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

Referenced by getImageRectangle().

397 {
398  ossim_uint32 result = 0;
399  if ( m_currentEntry < m_entries.size() )
400  {
401  if ( resLevel < m_entries[m_currentEntry].getTileMatrix().size() )
402  {
403  result = m_entries[m_currentEntry].getNumberOfLines( resLevel );
404  }
405  else if ( theOverview.valid() )
406  {
407  result = theOverview->getNumberOfLines(resLevel);
408  }
409  }
410  return result;
411 }
ossim_uint32 m_currentEntry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries
ossimRefPtr< ossimImageHandler > theOverview

◆ getNumberOfOutputBands()

ossim_uint32 ossimGpkgReader::getNumberOfOutputBands ( ) const
virtual

Returns the number of bands in a tile returned from this TileSource.

Note: we are supporting sources that can have multiple data objects. If you want to know the scalar type of an object you can pass in the

Reimplemented from ossimImageSource.

Definition at line 459 of file ossimGpkgReader.cpp.

References m_bands.

Referenced by getTile().

460 {
461  return m_bands;
462 }
ossim_uint32 m_bands

◆ getNumberOfSamples()

ossim_uint32 ossimGpkgReader::getNumberOfSamples ( ossim_uint32  resLevel = 0) const
virtual

Returns the number of samples in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageHandler.

Definition at line 413 of file ossimGpkgReader.cpp.

References ossimImageHandler::getNumberOfSamples(), m_currentEntry, m_entries, ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

Referenced by getImageRectangle().

414 {
415  ossim_uint32 result = 0;
416  if ( m_currentEntry < m_entries.size() )
417  {
418  if ( resLevel < m_entries[m_currentEntry].getTileMatrix().size() )
419  {
420  result = m_entries[m_currentEntry].getNumberOfSamples( resLevel );
421  }
422  else if ( theOverview.valid() )
423  {
424  result = theOverview->getNumberOfSamples(resLevel);
425  }
426  }
427  return result;
428 }
ossim_uint32 m_currentEntry
bool valid() const
Definition: ossimRefPtr.h:75
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries
ossimRefPtr< ossimImageHandler > theOverview
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.

◆ getNumberOfZoomLevels()

ossim_uint32 ossimGpkgReader::getNumberOfZoomLevels ( ) const
private
Returns
Number of internal zoom levels.

Definition at line 567 of file ossimGpkgReader.cpp.

References m_currentEntry, and m_entries.

Referenced by getNumberOfDecimationLevels(), and getTile().

568 {
569  ossim_uint32 result = 0;
570 
571  //---
572  // Index 0 is the highest zoom_level which is the best resolution or r0 in ossim terms.
573  // In GeoPackage zoom_level 0 is the lowest resolution.
574  //---
575  if ( m_currentEntry < (ossim_uint32)m_entries.size())
576  {
577  size_t matrixSize = m_entries[m_currentEntry].getTileMatrix().size();
578  if ( matrixSize )
579  {
580  result =
581  m_entries[m_currentEntry].getTileMatrix()[0].m_zoom_level -
582  m_entries[m_currentEntry].getTileMatrix()[ matrixSize-1 ].m_zoom_level + 1;
583  }
584  }
585 
586  return result;
587 }
ossim_uint32 m_currentEntry
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries

◆ getOutputScalarType()

ossimScalarType ossimGpkgReader::getOutputScalarType ( ) const
virtual

Returns the output pixel type of the tile source.

Reimplemented from ossimImageSource.

Definition at line 464 of file ossimGpkgReader.cpp.

References m_scalar.

465 {
466  return m_scalar;
467 }
ossimScalarType m_scalar

◆ getProperty()

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

Get propterty method.

Overrides ossimImageHandler::getProperty.

Parameters
nameProperty name to get.

Reimplemented from ossimImageHandler.

Definition at line 275 of file ossimGpkgReader.cpp.

References ossimImageHandler::getProperty().

276 {
278  prop = ossimImageHandler::getProperty(name);
279  return prop;
280 }
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const

◆ getPropertyNames()

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

Get propterty names.

Overrides ossimImageHandler::getPropertyNames.

Parameters
propertyNamesArray to initialize.

Reimplemented from ossimImageHandler.

Definition at line 282 of file ossimGpkgReader.cpp.

References ossimImageHandler::getPropertyNames().

283 {
285 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getShortName()

ossimString ossimGpkgReader::getShortName ( ) const
virtual
Returns
"gpkg"

Reimplemented from ossimObject.

Definition at line 439 of file ossimGpkgReader.cpp.

440 {
441  return ossimString("ossim_gpkg_reader");
442 }

◆ getTile() [1/3]

ossimRefPtr< ossimImageData > ossimGpkgReader::getTile ( const ossimIrect rect,
ossim_uint32  resLevel = 0 
)
virtual

Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab from the image.

Satisfies pure virtual from TileSource class.

Reimplemented from ossimImageSource.

Definition at line 96 of file ossimGpkgReader.cpp.

References allocate(), ossimRefPtr< T >::get(), ossimDataObject::getDataObjectStatus(), m_tile, ossimImageData::makeBlank(), OSSIM_NULL, ossimImageData::setImageRectangle(), and ossimRefPtr< T >::valid().

Referenced by fillTile().

98 {
99  if ( !m_tile )
100  {
101  allocate();
102  }
103 
104  if (m_tile.valid())
105  {
106  // Image rectangle must be set prior to calling getTile.
107  m_tile->setImageRectangle(rect);
108 
109  if ( getTile( m_tile.get(), resLevel ) == false )
110  {
112  {
113  m_tile->makeBlank();
114  }
115  }
116  }
117 
118  return m_tile;
119 }
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
void allocate()
Allocates m_tile.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
ossimRefPtr< ossimImageData > m_tile
virtual void makeBlank()
Initializes data to null pixel values.

◆ getTile() [2/3]

bool ossimGpkgReader::getTile ( ossimImageData result,
ossim_uint32  resLevel = 0 
)
virtual

Method to get a tile.

Parameters
resultThe tile to stuff. Note The requested rectangle in full image space and bands should be set in the result tile prior to passing. It will be an error if: result.getNumberOfBands() != this->getNumberOfOutputBands()
Returns
true on success false on error. If return is false, result is undefined so caller should handle appropriately with makeBlank or whatever.

Reimplemented from ossimImageSource.

Definition at line 121 of file ossimGpkgReader.cpp.

References ossimIrect::clipToRect(), fillTile(), getImageRectangle(), ossimImageData::getImageRectangle(), ossimImageData::getNumberOfBands(), getNumberOfOutputBands(), getNumberOfZoomLevels(), ossimImageHandler::getOverviewTile(), ossimIrect::intersects(), isOpen(), ossimSource::isSourceEnabled(), ossimImageHandler::isValidRLevel(), m_tile, ossimImageData::makeBlank(), ossimReferenced::ref(), status, and ossimReferenced::unref().

123 {
124  bool status = false;
125 
126  //---
127  // Not open, this tile source bypassed, or invalid res level,
128  // return a blank tile.
129  //---
130  if( isOpen() && isSourceEnabled() && isValidRLevel(resLevel) &&
131  result && (result->getNumberOfBands() == getNumberOfOutputBands()) )
132  {
133  result->ref(); // Increment ref count.
134 
135  if ( resLevel < getNumberOfZoomLevels() )
136  {
137  status = true;
138 
139  ossimIrect tileRect = result->getImageRectangle();
140  ossimIrect imageRect = getImageRectangle(resLevel);
141 
142  //---
143  // Format allows for missing tiles so alway make blank in case tile
144  // is not filled completely.
145  //---
146  m_tile->makeBlank();
147 
148  if ( imageRect.intersects(tileRect) )
149  {
150  // Make a clip rect.
151  ossimIrect clipRect = tileRect.clipToRect( imageRect );
152 
153  // This will validate the tile at the end.
154  fillTile(resLevel, tileRect, clipRect, result);
155  }
156  }
157  else
158  {
159  status = getOverviewTile(resLevel, result);
160  }
161 
162  result->unref(); // Decrement ref count.
163  }
164 
165  return status;
166 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfBands() const
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
void fillTile(ossim_uint32 resLevel, const ossimIrect &tileRect, const ossimIrect &clipRect, ossimImageData *tile)
void ref() const
increment the reference count by one, indicating that this object has another pointer which is refere...
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
ossim_uint32 getNumberOfZoomLevels() const
virtual ossimIrect getImageRectangle() const
ossimRefPtr< ossimImageData > m_tile
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in...
void unref() const
decrement the reference count by one, indicating that a pointer to this object is referencing it...
return status
virtual void makeBlank()
Initializes data to null pixel values.
bool isOpen() const
Derived classes must implement this method to be concrete.

◆ getTile() [3/3]

ossimRefPtr< ossimImageData > ossimGpkgReader::getTile ( ossim_uint32  resLevel,
ossimIpt  index 
)
private

Definition at line 779 of file ossimGpkgReader.cpp.

781 {
782  static const char MODULE[] = "ossimGpkgReader::getTile(resLevel, index)";
783  if (traceDebug())
784  {
786  << MODULE << " entered..."
787  << "\nresLevel: " << resLevel << " index: " << index << "\n";
788  }
789 
790  ossimRefPtr<ossimImageData> result = 0;
791 
792  if ( m_db )
793  {
794  if ( m_currentEntry < m_entries.size() )
795  {
796  if ( resLevel < m_entries[m_currentEntry].getTileMatrix().size() )
797  {
798  std::string tableName =
799  m_entries[m_currentEntry].getTileMatrix()[resLevel].m_table_name;
800  ossim_int32 zoomLevel =
801  m_entries[m_currentEntry].getTileMatrix()[resLevel].m_zoom_level;
802  const char *zLeftover; // Tail of unprocessed SQL
803  sqlite3_stmt *pStmt = 0; // The current SQL statement
804  std::ostringstream sql;
805  sql << "SELECT id, zoom_level, tile_column, tile_row, tile_data from "
806  << tableName
807  << " WHERE zoom_level=" << zoomLevel
808  << " AND tile_column=" << index.x
809  << " AND tile_row=" << index.y;
810 
811  if (traceDebug())
812  {
814  << MODULE << " sql:\n" << sql.str() << "\n";
815  }
816 
817  int rc = sqlite3_prepare_v2(
818  m_db, // Database handle
819  sql.str().c_str(),// SQL statement, UTF-8 encoded
820  -1, // Maximum length of zSql in bytes.
821  &pStmt, // OUT: Statement handle
822  &zLeftover); // OUT: Pointer to unused portion of zSql
823  if ( rc == SQLITE_OK )
824  {
825  int nCol = sqlite3_column_count( pStmt );
826  if ( nCol )
827  {
828  // Read the row:
829  rc = sqlite3_step(pStmt);
830  if (rc == SQLITE_ROW) // || (rc == SQLITE_DONE) )
831  {
832  ossimGpkgTileRecord tile;
833  tile.setCopyTileFlag(true);
834  if (tile.init( pStmt ) )
835  {
836  ossimIpt tileSize;
837  m_entries[m_currentEntry].getTileMatrix()[resLevel].getTileSize(tileSize);
839  switch ( tile.getTileType() )
840  {
842  {
843  // we need to cache this instead of allocating a new codec every tile
844  // for now just getting it to compile with registry implementation
845  //
846  if( !m_jpegCodec.valid() )
847  {
849  createCodec(ossimString("jpeg"));
850  }
851 
852  codec = m_jpegCodec.get();
853  break;
854  }
856  {
857  if( !m_pngCodec.valid() )
858  {
860  createCodec(ossimString("png"));
861  }
862  codec = m_pngCodec.get();
863  break;
864  }
865  default:
866  {
867  if (traceDebug())
868  {
870  << "Unhandled type: " << tile.getTileType() << endl;;
871  }
872  result = 0;
873  break;
874  }
875  }
876 
877  if ( codec.valid() )
878  {
879  if ( codec->decode(tile.m_tile_data, m_cacheTile ) )
880  {
881  result = m_cacheTile;
882  }
883  else
884  {
886  << "WARNING: decode failed...\n";
887  }
888  }
889 
890  if ( result.valid() )
891  {
892  // Set the tile origin in image space.
893  ossimIpt origin( index.x*tileSize.x,
894  index.y*tileSize.y );
895 
896  // Subtract the sub image offset if any:
897  ossimIpt subImageOffset(0,0);
898  m_entries[m_currentEntry].getSubImageOffset( resLevel, subImageOffset );
899  origin -= subImageOffset;
900 
901  result->setOrigin( origin );
902  }
903  else if (traceDebug())
904  {
906  << MODULE << " WARNING: result is null!\n";
907  }
908  }
909  }
910 
911  } // Matches: if ( nCol )
912 
913  } // Matches: if ( rc == SQLITE_OK )
914 
915  sqlite3_finalize(pStmt);
916 
917  } // Matches: if(resLevel<m_entries[m_currentEntry].getTileMatrix().size())
918 
919  } // Matches: if ( m_currentEntry < m_entries.size() )
920 
921  } // Matches: if ( m_db )
922 
923  if (traceDebug())
924  {
926  << MODULE << " exit result is " << (result.valid()?"set.":"null.") << "\n";
927  }
928 
929  return result;
930 
931 } // End: ossimGpkgReader::getTile( resLevel, index )
static ossimCodecFactoryRegistry * instance()
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
ossim_uint32 m_currentEntry
std::vector< ossim_uint8 > m_tile_data
bool valid() const
Definition: ossimRefPtr.h:75
bool init(sqlite3_stmt *pStmt)
Initialize from database.
ossimRefPtr< ossimCodecBase > m_jpegCodec
virtual bool decode(const std::vector< ossim_uint8 > &in, ossimRefPtr< ossimImageData > &out) const =0
Decode method.
std::vector< ossimGpkgTileEntry > m_entries
virtual void setOrigin(const ossimIpt &origin)
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimImageData > m_cacheTile
ossimGpkgTileType getTileType() const
ossimRefPtr< ossimCodecBase > m_pngCodec
ossim_int32 x
Definition: ossimIpt.h:141
void setCopyTileFlag(bool flag)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ getTileHeight()

ossim_uint32 ossimGpkgReader::getTileHeight ( ) const
virtual

Returns the height of the output tile.

Reimplemented from ossimImageSource.

Definition at line 384 of file ossimGpkgReader.cpp.

References ossim::defaultTileSize(), getImageTileHeight(), and ossimIpt::y.

385 {
386  ossim_uint32 result = getImageTileHeight();
387  if (!result)
388  {
389  ossimIpt tileSize;
390  ossim::defaultTileSize(tileSize);
391  result = tileSize.y;
392  }
393  return result;
394 }
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
unsigned int ossim_uint32
ossim_int32 y
Definition: ossimIpt.h:142

◆ getTileIndexes()

void ossimGpkgReader::getTileIndexes ( ossim_uint32  resLevel,
const ossimIrect clipRect,
std::vector< ossimIpt > &  tileIndexes 
) const
private

Definition at line 195 of file ossimGpkgReader.cpp.

References getTileSize(), ossimIrect::lr(), m_currentEntry, m_entries, ossimIrect::stretchToTileBoundary(), ossimIrect::ul(), ossimIpt::x, x, ossimIpt::y, and y.

Referenced by fillTile().

198 {
199  ossimIpt tileSize;
200  getTileSize( resLevel, tileSize );
201 
202  if ( tileSize.x && tileSize.y )
203  {
204  ossimIrect expandedRect = clipRect;
205 
206  // Add the sub image offset if any:
207  ossimIpt subImageOffset(0,0);
208  if ( m_currentEntry < m_entries.size() )
209  {
210  m_entries[m_currentEntry].getSubImageOffset( resLevel, subImageOffset );
211  expandedRect += subImageOffset;
212  }
213 
214  expandedRect.stretchToTileBoundary( tileSize );
215 
216  ossim_int32 y = expandedRect.ul().y;
217  while ( y < expandedRect.lr().y )
218  {
219  ossim_int32 x = expandedRect.ul().x;
220  while ( x < expandedRect.lr().x )
221  {
222  ossimIpt index( x/tileSize.x, y/tileSize.y );
223  tileIndexes.push_back( index );
224  x += tileSize.x;
225  }
226  y += tileSize.y;
227  }
228  }
229 }
ossim_uint32 x
ossim_uint32 m_currentEntry
ossim_uint32 y
const ossimIpt & ul() const
Definition: ossimIrect.h:274
std::vector< ossimGpkgTileEntry > m_entries
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_int32 y
Definition: ossimIpt.h:142
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
Definition: ossimIrect.cpp:212
ossim_int32 x
Definition: ossimIpt.h:141
void getTileSize(ossim_uint32 resLevel, ossimIpt &tileSize) const
int ossim_int32

◆ getTileSize()

void ossimGpkgReader::getTileSize ( ossim_uint32  resLevel,
ossimIpt tileSize 
) const
private

Definition at line 231 of file ossimGpkgReader.cpp.

References m_currentEntry, m_entries, ossimIpt::x, and ossimIpt::y.

Referenced by getTileIndexes().

232 {
233  if ( m_currentEntry < (ossim_uint32)m_entries.size() )
234  {
235  if ( resLevel < (ossim_uint32)m_entries[m_currentEntry].getTileMatrix().size() )
236  {
237  tileSize.x =
238  (ossim_int32)m_entries[m_currentEntry].getTileMatrix()[resLevel].m_tile_width;
239  tileSize.y =
240  (ossim_int32)m_entries[m_currentEntry].getTileMatrix()[resLevel].m_tile_height;
241  }
242  }
243 }
ossim_uint32 m_currentEntry
unsigned int ossim_uint32
std::vector< ossimGpkgTileEntry > m_entries
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ getTileWidth()

ossim_uint32 ossimGpkgReader::getTileWidth ( ) const
virtual

Returns the width of the output tile.

Reimplemented from ossimImageSource.

Definition at line 372 of file ossimGpkgReader.cpp.

References ossim::defaultTileSize(), getImageTileWidth(), and ossimIpt::x.

373 {
374  ossim_uint32 result = getImageTileWidth();
375  if (!result)
376  {
377  ossimIpt tileSize;
378  ossim::defaultTileSize(tileSize);
379  result = tileSize.x;
380  }
381  return result;
382 }
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
unsigned int ossim_uint32
ossim_int32 x
Definition: ossimIpt.h:141

◆ initImageParams()

bool ossimGpkgReader::initImageParams ( )
private

Definition at line 681 of file ossimGpkgReader.cpp.

Referenced by setCurrentEntry().

682 {
683  static const char MODULE[] = "ossimGpkgReader::initImageParams";
684  if (traceDebug())
685  {
686  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
687  }
688 
689  bool result = false;
690  if ( m_db )
691  {
692  if ( m_currentEntry < m_entries.size() )
693  {
694  if ( m_entries[m_currentEntry].getTileMatrix().size() )
695  {
696  ossimIpt index(-1,-1);
697 
698  std::string tableName = m_entries[m_currentEntry].getTileMatrix()[0].m_table_name;
699  ossim_int32 zoomLevel = m_entries[m_currentEntry].getTileMatrix()[0].m_zoom_level;
700 
701  // Get the first tile for the highest res zoom level.
702 
703  const char *zLeftover; // Tail of unprocessed SQL
704  sqlite3_stmt *pStmt = 0; // The current SQL statement
705 
706  std::ostringstream sql;
707  sql << "SELECT min(id), tile_column, tile_row from "
708  << tableName << " WHERE zoom_level=" << zoomLevel;
709 
710  if (traceDebug())
711  {
713  << "sql:\n" << sql.str() << "\n";
714  }
715 
716  int rc = sqlite3_prepare_v2(m_db, // Database handle
717  sql.str().c_str(),// SQL statement, UTF-8 encoded
718  -1, // Maximum length of zSql in bytes.
719  &pStmt, // OUT: Statement handle
720  &zLeftover); // OUT: Pointer to unused portion of zSql
721  if ( rc == SQLITE_OK )
722  {
723  int nCol = sqlite3_column_count( pStmt );
724  if ( nCol == 3 )
725  {
726  // Read the row:
727  rc = sqlite3_step(pStmt);
728  if ( rc == SQLITE_ROW )
729  {
730  index.x = sqlite3_column_int(pStmt, 1);
731  index.y = sqlite3_column_int(pStmt, 2);
732  }
733  }
734  }
735 
736  sqlite3_finalize(pStmt);
737 
738  if ( (index.x > -1) && (index.y > -1) )
739  {
740  // Grab a tile:
741  ossimRefPtr<ossimImageData> tile = getTile( 0, index );
742  if ( tile.valid() )
743  {
744  // Set the bands:
745  m_bands = tile->getNumberOfBands();
746 
747  // Set the scalar type:
748  m_scalar = tile->getScalarType();
749 
750  // Set tile size:
751  m_tileWidth = tile->getWidth();
752  m_tileHeight = tile->getHeight();
753  result = true;
754  }
755  }
756 
757  if ( !result )
758  {
759  // Set to some default:
760  m_bands = 3;
762  m_tileWidth = 256;
763  m_tileHeight = 256;
764  result = true;
765  }
766  }
767  }
768  }
769 
770  if ( traceDebug() )
771  {
773  << MODULE << " exit status = " << (result?"true":"false") << "\n";
774  }
775 
776  return result;
777 }
virtual ossim_uint32 getWidth() const
ossim_uint32 m_tileWidth
ossim_uint32 m_tileHeight
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
ossim_uint32 m_currentEntry
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getHeight() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
std::vector< ossimGpkgTileEntry > m_entries
virtual ossimScalarType getScalarType() const
8 bit unsigned integer
ossimScalarType m_scalar
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32
ossim_uint32 m_bands

◆ isOpen()

bool ossimGpkgReader::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 469 of file ossimGpkgReader.cpp.

References m_db.

Referenced by close(), getTile(), setCurrentEntry(), and ~ossimGpkgReader().

470 {
471  return (m_db != 0 );
472 }

◆ loadState()

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

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

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 259 of file ossimGpkgReader.cpp.

References ossimImageHandler::loadState(), and open().

261 {
262  bool result = false;
263  if (ossimImageHandler::loadState(kwl, prefix))
264  {
265  result = open();
266  }
267  return result;
268 }
virtual bool open()
open method.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.

◆ open()

bool ossimGpkgReader::open ( )
protectedvirtual

open method.

Returns
true on success, false on error.

Implements ossimImageHandler.

Definition at line 287 of file ossimGpkgReader.cpp.

References status.

Referenced by loadState().

288 {
289  static const char M[] = "ossimGpkgReader::open";
290 
291  bool status = false;
292 
293  if (traceDebug())
294  {
296  << M << " entered..." << "\nFile: " << theImageFile.c_str() << "\n";
297  }
298 
299  // Start with a clean slate.
300  if (isOpen())
301  {
302  close();
303  }
304 
305  std::ifstream str;
306  str.open(theImageFile.c_str(), std::ios_base::in | std::ios_base::binary);
307 
308  if ( ossim_gpkg::checkSignature( str ) )
309  {
310  if ( ossim_gpkg::checkApplicationId( str ) == false )
311  {
312  // Just issue a warning at this point as this requirement is new...
313  if (traceDebug())
314  {
316  << M << " WARNING!"
317  << "File: " << theImageFile << " does not have required application_id!"
318  << "\nProceeding anyway...\n";
319  }
320  }
321 
322  int rc = sqlite3_open_v2( theImageFile.c_str(), &m_db, SQLITE_OPEN_READONLY, 0);
323  if ( rc == SQLITE_OK )
324  {
325  m_entries.clear();
327 
328  if ( m_entries.size() )
329  {
331 
332  if (traceDebug())
333  {
334  std::vector<ossimGpkgTileEntry>::const_iterator i = m_entries.begin();
335  while ( i != m_entries.end() )
336  {
337  ossimNotify(ossimNotifyLevel_DEBUG) << (*i) << "\n";
338  ++i;
339  }
340  }
341  if (traceValidate())
342  {
343  std::vector<ossimGpkgTileEntry>::const_iterator i = m_entries.begin();
344  while ( i != m_entries.end() )
345  {
346  (*i).printValidate( ossimNotify(ossimNotifyLevel_DEBUG) );
347  ++i;
348  }
349  }
350  }
351 
352  }
353  }
354 
355  if ( !status )
356  {
357  close();
358  }
359  else
360  {
361  completeOpen();
362  }
363  if (traceDebug())
364  {
366  << M << " exit status: " << (status?"true":"false") << "\n";
367  }
368 
369  return status;
370 }
void getTileEntries(sqlite3 *db, std::vector< ossimGpkgTileEntry > &entries)
Gets all the tile entries.
bool checkApplicationId(std::istream &in)
Check application_id.
ossimFilename theImageFile
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
virtual void close()
Close method.
bool checkSignature(std::istream &in)
Check signature method.
std::vector< ossimGpkgTileEntry > m_entries
return status
virtual void completeOpen()
Will complete the opening process.
bool isOpen() const
Derived classes must implement this method to be concrete.
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
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ saveState()

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

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 253 of file ossimGpkgReader.cpp.

References ossimImageHandler::saveState().

255 {
256  return ossimImageHandler::saveState(kwl, prefix);
257 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.

◆ setCurrentEntry()

bool ossimGpkgReader::setCurrentEntry ( ossim_uint32  entryIdx)
virtual
Parameters
entryIdxEntry number to select.
Note
The implementation does nothing. Derived classes that handle multiple images should override.
Returns
true if it was able to set the current entry and false otherwise.

Reimplemented from ossimImageHandler.

Definition at line 516 of file ossimGpkgReader.cpp.

References ossimString::clear(), ossimImageHandler::completeOpen(), getNumberOfEntries(), initImageParams(), isOpen(), m_currentEntry, m_tile, ossimImageHandler::theGeometry, and ossimImageHandler::theOverviewFile.

517 {
518  bool result = true;
519  if ( m_currentEntry != entryIdx )
520  {
521  if ( entryIdx < getNumberOfEntries() )
522  {
523  m_currentEntry = entryIdx;
524 
525  if ( isOpen() )
526  {
527  // Zero out the tile to force an allocate() call.
528  m_tile = 0;
529 
530  // Clear the geometry.
531  theGeometry = 0;
532 
533  // Must clear or openOverview will use last entries.
535 
536  // This intitializes bands, scalar, tile width, height...
537  initImageParams();
538 
539  if ( result )
540  {
541  completeOpen();
542  }
543  }
544  }
545  else
546  {
547  result = false; // Entry index out of range.
548  }
549  }
550  return result;
551 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
ossimRefPtr< ossimImageGeometry > theGeometry
ossim_uint32 m_currentEntry
ossimRefPtr< ossimImageData > m_tile
virtual ossim_uint32 getNumberOfEntries() const
virtual void completeOpen()
Will complete the opening process.
bool isOpen() const
Derived classes must implement this method to be concrete.
ossimFilename theOverviewFile

◆ setProperty()

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

Set propterty method.

Overrides ossimImageHandler::setProperty.

Current property name handled: "scale" One double value representing the scale in meters per pixel. It is assumed the scale is same for x and y direction.

Parameters
propertyto set.

Reimplemented from ossimImageHandler.

Definition at line 270 of file ossimGpkgReader.cpp.

References ossimImageHandler::setProperty().

271 {
273 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)

◆ uncompressPngTile()

ossimRefPtr< ossimImageData > ossimGpkgReader::uncompressPngTile ( const ossimGpkgTileRecord tile,
const ossimIpt tileSize 
)
private

Uncompresses png tile to m_cacheTile.

Parameters
tileTile record.
tileSizeSize of tile.

Definition at line 933 of file ossimGpkgReader.cpp.

References ossimRefPtr< T >::get(), ossimImageSource::getTile(), ossimImageHandlerRegistry::instance(), m_ih, ossimGpkgTileRecord::m_tile_data, ossimStreamReaderInterface::open(), ossimImageHandlerRegistry::open(), ossimRefPtr< T >::valid(), ossimIpt::x, and ossimIpt::y.

935 {
936  ossimRefPtr<ossimImageData> result = 0;
937 
938  //---
939  // This copies the data to a stringbuf. TODO, use tile data
940  // directly.
941  //---
942  if ( tile.m_tile_data.size() )
943  {
944  std::string data( (char*)&tile.m_tile_data.front(),
945  tile.m_tile_data.size() );
946 
947  // ossim::istringstream is(data);
948  std::shared_ptr<ossim::istream> is;
949 
950  std::shared_ptr<ossim::istringstream> testIs =
951  std::make_shared<ossim::istringstream>();
952  testIs->str( data );
953  is = testIs;
954  if ( m_ih.valid() )
955  {
956  // Have an image handler from previous open:
958  dynamic_cast<ossimStreamReaderInterface*>( m_ih.get() );
959  if ( sri )
960  {
961  // if ( sri->open( &is, 0, false ) == false )
962  if ( sri->open( is, std::string("gpkg_tile")) == false )
963  {
964  // Per the spec tile mime types can be mixed.
965  m_ih = 0;
966  }
967  }
968  else
969  {
970  m_ih = 0;
971  }
972  }
973 
974  if ( !m_ih )
975  {
976  // m_ih = ossimImageHandlerRegistry::instance()->open( &is, 0, false );
977  m_ih = ossimImageHandlerRegistry::instance()->open( is, std::string("gpkg_tile"), false );
978  }
979 
980  if ( m_ih.valid() )
981  {
982  // Get the raw rectangle:
983  ossimIrect rect( 0, 0, tileSize.x - 1, tileSize.y - 1 );
984 
985  // Get the tile from the image handler:
986  result = m_ih->getTile( rect, 0 );
987  }
988  }
989 
990  return result;
991 
992 } // ossimGpkgReader::uncompressPngTile
ossimRefPtr< ossimImageHandler > m_ih
std::vector< ossim_uint8 > m_tile_data
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
bool valid() const
Definition: ossimRefPtr.h:75
ossim_int32 y
Definition: ossimIpt.h:142
virtual bool open(std::shared_ptr< ossim::istream > &str, const std::string &connectionString)=0
Pure virtual open method that takes a stream.
static ossimImageHandlerRegistry * instance()
ossim_int32 x
Definition: ossimIpt.h:141
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

Member Data Documentation

◆ m_bands

ossim_uint32 ossimGpkgReader::m_bands
private

Definition at line 279 of file ossimGpkgReader.h.

Referenced by getNumberOfInputBands(), and getNumberOfOutputBands().

◆ m_cacheTile

ossimRefPtr<ossimImageData> ossimGpkgReader::m_cacheTile
private

Definition at line 275 of file ossimGpkgReader.h.

◆ m_currentEntry

ossim_uint32 ossimGpkgReader::m_currentEntry
private

◆ m_db

sqlite3* ossimGpkgReader::m_db
private

Definition at line 277 of file ossimGpkgReader.h.

Referenced by close(), and isOpen().

◆ m_entries

std::vector<ossimGpkgTileEntry> ossimGpkgReader::m_entries
private

◆ m_ih

ossimRefPtr<ossimImageHandler> ossimGpkgReader::m_ih
private

Definition at line 272 of file ossimGpkgReader.h.

Referenced by uncompressPngTile().

◆ m_jpegCodec

ossimRefPtr<ossimCodecBase> ossimGpkgReader::m_jpegCodec
mutableprivate

Definition at line 286 of file ossimGpkgReader.h.

◆ m_pngCodec

ossimRefPtr<ossimCodecBase> ossimGpkgReader::m_pngCodec
mutableprivate

Definition at line 287 of file ossimGpkgReader.h.

◆ m_scalar

ossimScalarType ossimGpkgReader::m_scalar
private

Definition at line 280 of file ossimGpkgReader.h.

Referenced by getOutputScalarType().

◆ m_tile

ossimRefPtr<ossimImageData> ossimGpkgReader::m_tile
private

Definition at line 274 of file ossimGpkgReader.h.

Referenced by allocate(), getTile(), and setCurrentEntry().

◆ m_tileHeight

ossim_uint32 ossimGpkgReader::m_tileHeight
private

Definition at line 282 of file ossimGpkgReader.h.

Referenced by getImageTileHeight().

◆ m_tileWidth

ossim_uint32 ossimGpkgReader::m_tileWidth
private

Definition at line 281 of file ossimGpkgReader.h.

Referenced by getImageTileWidth().


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