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
ossimTiledImagePatch Class Reference

Class to fill a patch from input tiles requested on even tile boundaries with a tile size typically matching the input, with some output tile size different from the input. More...

#include <ossimTiledImagePatch.h>

Inheritance diagram for ossimTiledImagePatch:
ossimImageSourceFilter ossimImageSource ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimTiledImagePatch ()
 default constructor More...
 
virtual void initialize ()
 Initializes bounding rects and tile size(if not set) from input. More...
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, 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 ossimString getClassName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getShortName () const
 
const ossimIptgetInputTileSize () const
 
bool setInputTileSize (const ossimIpt &tileSize)
 Sets the input tile size. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load the class state from a keyword list. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
- Public Member Functions inherited from ossimImageSourceFilter
 ossimImageSourceFilter (ossimObject *owner=NULL)
 
 ossimImageSourceFilter (ossimImageSource *inputSource)
 
 ossimImageSourceFilter (ossimObject *owner, ossimImageSource *inputSource)
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 
virtual ossim_uint32 getNumberOfInputBands () const
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void refreshEvent (ossimRefreshEvent &event)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
- 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 getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Returns the min pixel of the band. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 This will return the bounding rect of the source. 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 ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. 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
 
- 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 &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

virtual ~ossimTiledImagePatch ()
 virtual protected destructor More...
 
- Protected Member Functions inherited from ossimImageSourceFilter
virtual ~ossimImageSourceFilter ()
 
- 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

void allocateTile ()
 Allocates the tile. More...
 
bool isValidRLevel (ossim_uint32 resLevel) const
 Test the bounds of resLevel. More...
 
 ossimTiledImagePatch (const ossimTiledImagePatch &)
 Private to disallow use... More...
 
ossimTiledImagePatchoperator= (const ossimTiledImagePatch &)
 Private to disallow use... More...
 

Private Attributes

ossimRefPtr< ossimImageDatam_tile
 
ossimIpt m_inputTileSize
 

Additional Inherited Members

- 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 ossimImageSourceFilter
ossimImageSourcetheInputConnection
 
- 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 ossimListener
bool theListenerEnableFlag
 

Detailed Description

Class to fill a patch from input tiles requested on even tile boundaries with a tile size typically matching the input, with some output tile size different from the input.

Definition at line 29 of file ossimTiledImagePatch.h.

Constructor & Destructor Documentation

◆ ossimTiledImagePatch() [1/2]

ossimTiledImagePatch::ossimTiledImagePatch ( )

default constructor

Definition at line 21 of file ossimTiledImagePatch.cpp.

22  :
23  ossimImageSourceFilter(), // base class
24  m_tile(0),
26 {
28 }
void makeNan()
Definition: ossimIpt.h:56
ossimImageSourceFilter(ossimObject *owner=NULL)
ossimRefPtr< ossimImageData > m_tile

◆ ~ossimTiledImagePatch()

ossimTiledImagePatch::~ossimTiledImagePatch ( )
protectedvirtual

virtual protected destructor

Definition at line 30 of file ossimTiledImagePatch.cpp.

31 {
32 }

◆ ossimTiledImagePatch() [2/2]

ossimTiledImagePatch::ossimTiledImagePatch ( const ossimTiledImagePatch )
private

Private to disallow use...

Definition at line 222 of file ossimTiledImagePatch.cpp.

223  : m_tile(0),
225 {
226 }
ossimRefPtr< ossimImageData > m_tile

Member Function Documentation

◆ allocateTile()

void ossimTiledImagePatch::allocateTile ( )
private

Allocates the tile.

Called on first getTile.

Definition at line 209 of file ossimTiledImagePatch.cpp.

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

Referenced by getTile().

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

◆ getClassName()

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

Reimplemented from ossimObject.

Definition at line 154 of file ossimTiledImagePatch.cpp.

155 {
156  return ossimString("ossimTiledImagePatch");
157 }

◆ getInputTileSize()

const ossimIpt & ossimTiledImagePatch::getInputTileSize ( ) const
Returns
The reference to the input tile size.

Definition at line 169 of file ossimTiledImagePatch.cpp.

References m_inputTileSize.

170 {
171  return m_inputTileSize;
172 }

◆ getLongName()

ossimString ossimTiledImagePatch::getLongName ( ) const
virtual
Returns
"OSSIM tiled image patch"

Reimplemented from ossimObject.

Definition at line 159 of file ossimTiledImagePatch.cpp.

160 {
161  return ossimString("OSSIM tiled image patch");
162 }

◆ getShortName()

ossimString ossimTiledImagePatch::getShortName ( ) const
virtual
Returns
"tiled_image_patch"

Reimplemented from ossimObject.

Definition at line 164 of file ossimTiledImagePatch.cpp.

165 {
166  return ossimString("tiled_image_patch");
167 }

◆ getTile() [1/2]

ossimRefPtr< ossimImageData > ossimTiledImagePatch::getTile ( const ossimIrect tileRect,
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 56 of file ossimTiledImagePatch.cpp.

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

58 {
59  if ( m_tile.valid() == false )
60  {
61  allocateTile(); // First time through...
62  }
63 
64  if ( m_tile.valid() )
65  {
66  // Image rectangle must be set prior to calling getTile.
67  m_tile->setImageRectangle(tileRect);
68 
69  if ( getTile( m_tile.get(), resLevel ) == false )
70  {
72  {
73  m_tile->makeBlank();
74  }
75  }
76  }
77 
78  return m_tile;
79 }
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, 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 ossimDataObjectStatus getDataObjectStatus() const
void allocateTile()
Allocates the tile.
virtual void makeBlank()
Initializes data to null pixel values.
ossimRefPtr< ossimImageData > m_tile

◆ getTile() [2/2]

bool ossimTiledImagePatch::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.
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 81 of file ossimTiledImagePatch.cpp.

References ossimIrect::clipToRect(), ossimRefPtr< T >::get(), ossimImageSource::getBoundingRect(), ossimDataObject::getDataObjectStatus(), ossimImageData::getImageRectangle(), ossimImageSource::getTile(), ossimIpt::hasNans(), ossimImageData::initialize(), ossimIrect::intersects(), ossimSource::isSourceEnabled(), isValidRLevel(), ossimImageData::loadTile(), ossimIrect::lr(), m_inputTileSize, ossimImageData::makeBlank(), OSSIM_EMPTY, OSSIM_NULL, status, ossimImageSourceFilter::theInputConnection, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, x, ossimIpt::y, and y.

82 {
83  bool status = false;
84 
85  if ( isSourceEnabled() && theInputConnection && isValidRLevel(resLevel) &&
86  result && (m_inputTileSize.hasNans() == false) )
87  {
88  status = true;
89 
90  // See if any point of the requested tile is in the image.
91  ossimIrect tile_rect = result->getImageRectangle();
92 
93  ossimIrect input_rect;
94  theInputConnection->getBoundingRect( input_rect, resLevel );
95 
96  if ( tile_rect.intersects( input_rect ) )
97  {
98  // Initialize the tile if needed as we're going to stuff it.
99  if (result->getDataObjectStatus() == OSSIM_NULL)
100  {
101  result->initialize();
102  }
103 
104  // If empty imput tiles are pulled the entire output tile might not be filled.
105  result->makeBlank();
106 
107  // Clip rect:
108  ossimIrect clip_rect = tile_rect.clipToRect( input_rect );
109 
110  // Zero based start point.
111  ossimIpt inputOrigin = clip_rect.ul() - input_rect.ul();
112 
113  // Zero based point on input tile boundary.
114  inputOrigin.x = (inputOrigin.x / m_inputTileSize.x) * m_inputTileSize.x;
115  inputOrigin.y = (inputOrigin.y / m_inputTileSize.y) * m_inputTileSize.y;
116 
117  // Shift back to original space:
118  inputOrigin += input_rect.ul();
119 
120  // Line loop:
121  for ( ossim_int32 y = inputOrigin.y; y < clip_rect.lr().y; y += m_inputTileSize.y )
122  {
123  // Sample loop:
124  for ( ossim_int32 x = inputOrigin.x; x < clip_rect.lr().x; x += m_inputTileSize.x )
125  {
126  ossimIrect rect( x, y, x + m_inputTileSize.x - 1, y + m_inputTileSize.y - 1 );
127 
128  ossimRefPtr<ossimImageData> tile = theInputConnection->getTile( rect, resLevel );
129  if ( tile.valid() )
130  {
131  if ( (tile->getDataObjectStatus() != OSSIM_NULL) &&
132  (tile->getDataObjectStatus() != OSSIM_EMPTY) )
133  {
134  result->loadTile( tile.get() );
135  }
136  }
137  }
138  }
139 
140  result->validate();
141 
142  }
143  else
144  {
145  // No part of requested tile within the image rectangle.
146  result->makeBlank();
147  }
148 
149  } // matches: if( isOpen() && isSourceEnabled() && isValidRLevel(level) )
150 
151  return status;
152 }
ossim_uint32 x
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimDataObjectStatus getDataObjectStatus() const
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
virtual void initialize()
Initialize the data buffer.
bool isValidRLevel(ossim_uint32 resLevel) const
Test the bounds of resLevel.
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
virtual ossimIrect getImageRectangle() const
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
return status
virtual void makeBlank()
Initializes data to null pixel values.
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
bool hasNans() const
Definition: ossimIpt.h:58
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ initialize()

void ossimTiledImagePatch::initialize ( )
virtual

Initializes bounding rects and tile size(if not set) from input.

Reimplemented from ossimImageSourceFilter.

Definition at line 34 of file ossimTiledImagePatch.cpp.

References ossimImageSource::getTileHeight(), ossimImageSource::getTileWidth(), ossimIpt::hasNans(), ossimImageSourceFilter::initialize(), m_inputTileSize, m_tile, ossimImageSourceFilter::theInputConnection, ossimIpt::x, and ossimIpt::y.

35 {
36  //---
37  // Call the base class initialize.
38  // Note: This will reset "theInputConnection" if it changed...
39  //---
41 
42  // Clear everything. The tile will be allocated on first getTile call.
43  m_tile = 0;
44 
45  // Get the input tile sizes:
46  if ( theInputConnection )
47  {
48  if ( m_inputTileSize.hasNans() )
49  {
52  }
53  }
54 }
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
ossimImageSource * theInputConnection
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimImageData > m_tile
ossim_int32 x
Definition: ossimIpt.h:141
bool hasNans() const
Definition: ossimIpt.h:58

◆ isValidRLevel()

bool ossimTiledImagePatch::isValidRLevel ( ossim_uint32  resLevel) const
private

Test the bounds of resLevel.

Definition at line 215 of file ossimTiledImagePatch.cpp.

References ossimImageSource::getNumberOfDecimationLevels().

Referenced by getTile().

216 {
217  // return (resLevel < m_inputBoundingRect.size());
218  return (resLevel < theInputConnection->getNumberOfDecimationLevels());
219 }
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.

◆ loadState()

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

Method to the load the class state from a keyword list.

Parameters
kwl
prefix
Returns
true on success, false on error.

Reimplemented from ossimImageSourceFilter.

Definition at line 189 of file ossimTiledImagePatch.cpp.

References ossimKeywordlist::findKey(), ossimImageSourceFilter::loadState(), m_inputTileSize, and ossimIpt::toPoint().

190 {
191  std::string myPrefix = (prefix ? prefix : "" );
192  std::string key = "tile_size";
193  std::string value = kwl.findKey( myPrefix, key );
194  if ( value.size() )
195  {
196  m_inputTileSize.toPoint( value );
197  }
198  return ossimImageSourceFilter::loadState(kwl, prefix);
199 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimIpt.cpp:170

◆ operator=()

ossimTiledImagePatch & ossimTiledImagePatch::operator= ( const ossimTiledImagePatch )
private

Private to disallow use...

Definition at line 229 of file ossimTiledImagePatch.cpp.

230 {
231  return *this;
232 }

◆ saveState()

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

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

Parameters
kwl
prefix
Returns
true on success, false on error.

Reimplemented from ossimImageSourceFilter.

Definition at line 201 of file ossimTiledImagePatch.cpp.

References ossimKeywordlist::addPair(), m_inputTileSize, ossimImageSourceFilter::saveState(), ossimString::string(), and ossimIpt::toString().

202 {
203  std::string myPrefix = (prefix ? prefix : "" );
204  std::string key = "tile_size";
205  kwl.addPair( myPrefix, key, m_inputTileSize.toString().string() );
206  return ossimImageSourceFilter::saveState(kwl, prefix);
207 }
ossimString toString() const
Definition: ossimIpt.cpp:139
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
const std::string & string() const
Definition: ossimString.h:414

◆ setInputTileSize()

bool ossimTiledImagePatch::setInputTileSize ( const ossimIpt tileSize)

Sets the input tile size.

Parameters
tileSize
Returns
true on success, false on error. On error m_inpuTileSize is set to nans.

Definition at line 174 of file ossimTiledImagePatch.cpp.

References ossimIpt::hasNans(), m_inputTileSize, ossimIpt::makeNan(), status, ossimIpt::x, and ossimIpt::y.

Referenced by ossimSingleImageChain::createRenderedChain().

175 {
176  bool status = true;
177  if ( ( tileSize.hasNans() == false ) && (tileSize.x > 0) && (tileSize.y > 0) )
178  {
179  m_inputTileSize = tileSize;
180  }
181  else
182  {
184  status = false;
185  }
186  return status;
187 }
void makeNan()
Definition: ossimIpt.h:56
return status
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
bool hasNans() const
Definition: ossimIpt.h:58

Member Data Documentation

◆ m_inputTileSize

ossimIpt ossimTiledImagePatch::m_inputTileSize
private

◆ m_tile

ossimRefPtr<ossimImageData> ossimTiledImagePatch::m_tile
private

Definition at line 118 of file ossimTiledImagePatch.h.

Referenced by allocateTile(), getTile(), and initialize().


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