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

#include <ossimImageRenderer.h>

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

Classes

class  ossimRendererSubRectInfo
 

Public Member Functions

 ossimImageRenderer ()
 
 ossimImageRenderer (ossimImageSource *inputSource, ossimImageViewTransform *imageViewTrans=NULL)
 
virtual ~ossimImageRenderer ()
 
virtual ossimString getLongName () const
 
virtual ossimString getShortName () const
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &origin, ossim_uint32 resLevel=0)
 the resampler will need the tile request to come from the view. More...
 
virtual void initialize ()
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 m_Resampler will adjust the rect to whatever the view is. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. 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...
 
void setImageViewTransform (ossimImageViewTransform *transform)
 
ossimImageViewTransformgetImageViewTransform ()
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns instance to the input image geometry. More...
 
virtual bool setView (ossimObject *baseObject)
 
ossimFilterResamplergetResampler ()
 
virtual ossimObjectgetView ()
 
virtual const ossimObjectgetView () const
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (vector< ossimDpt > &decimations) const
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual void setAutoUpdateInputTransformFlag (bool flag)
 
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...
 
void setMaxLevelsToCompute (ossim_uint32 maxLevels)
 
ossim_uint32 getMaxLevelsToCompute () const
 
void connectInputEvent (ossimConnectionEvent &event)
 
void disconnectInputEvent (ossimConnectionEvent &event)
 
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
 
virtual void enableSource ()
 Enables source. More...
 
virtual void disableSource ()
 Disables source. More...
 
virtual void setEnableFlag (bool flag)
 Sets the enable flag. 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...
 
- 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 bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
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 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 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 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 bool getEnableFlag () const
 
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 ossimString getClassName () 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
 
- Public Member Functions inherited from ossimViewInterface
 ossimViewInterface ()
 
 ossimViewInterface (ossimObject *base)
 
virtual ~ossimViewInterface ()
 
virtual void refreshView ()
 
ossimObjectgetBaseObject ()
 

Private Member Functions

void recursiveResample (ossimRefPtr< ossimImageData > outputData, const ossimRendererSubRectInfo &rectInfo, ossim_uint32 level)
 
void fillTile (ossimRefPtr< ossimImageData > outputData, const ossimRendererSubRectInfo &rectInfo)
 
ossimIrect getBoundingImageRect () const
 
void checkIVT ()
 this is called on a property event and on input connection changes. More...
 
void initializeBoundingRects ()
 Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately. More...
 
ossimRefPtr< ossimImageDatagetTileAtResLevel (const ossimIrect &boundingRect, ossim_uint32 resLevel)
 
template<class T >
void resampleTileToDecimation (T dummyVariable, ossimRefPtr< ossimImageData > result, ossimRefPtr< ossimImageData > tile, ossim_uint32 multiplier)
 
long computeClosestResLevel (const std::vector< ossimDpt > &decimationFactors, double scale) const
 
void stretchQuadOut (const ossimDpt &amount, ossimDpt &ul, ossimDpt &ur, ossimDpt &lr, ossimDpt &ll)
 
void allocate ()
 Called on first getTile, will initialize all data needed. More...
 
void deallocate ()
 Deletes all allocated tiles. More...
 

Private Attributes

ossimFilterResamplerm_Resampler
 
ossimRefPtr< ossimImageDatam_BlankTile
 
ossimRefPtr< ossimImageDatam_Tile
 
ossimRefPtr< ossimImageDatam_TemporaryBuffer
 
ossim_uint32 m_StartingResLevel
 This is going to allow us to chain multiple renderers together. More...
 
ossimRefPtr< ossimImageViewTransformm_ImageViewTransform
 
ossimIrect m_inputR0Rect
 
ossimIrect m_viewRect
 
bool m_rectsDirty
 
ossim_uint32 m_MaxRecursionLevel
 
bool m_AutoUpdateInputTransform
 
ossim_uint32 m_MaxLevelsToCompute
 
ossimPolyArea2d m_viewArea
 
bool m_crossesDateline
 

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 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)
 
- 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
 
- Protected Attributes inherited from ossimViewInterface
ossimObjecttheObject
 

Detailed Description

Definition at line 26 of file ossimImageRenderer.h.

Constructor & Destructor Documentation

◆ ossimImageRenderer() [1/2]

ossimImageRenderer::ossimImageRenderer ( )

Definition at line 1039 of file ossimImageRenderer.cpp.

References m_ImageViewTransform, m_Resampler, and ossimViewInterface::theObject.

1040 :
1043 m_Resampler(0),
1044 m_BlankTile(0),
1045 m_Tile(0),
1049 m_inputR0Rect(),
1050 m_viewRect(),
1051 m_rectsDirty(true),
1054 m_MaxLevelsToCompute(999999) // something large so it will always compute
1055 {
1059 }
ossimObject * theObject
ossimRefPtr< ossimImageData > m_Tile
ossimImageSourceFilter(ossimObject *owner=NULL)
ossim_uint32 m_StartingResLevel
This is going to allow us to chain multiple renderers together.
ossimFilterResampler * m_Resampler
ossimRefPtr< ossimImageData > m_BlankTile
ossimRefPtr< ossimImageData > m_TemporaryBuffer
ossim_uint32 m_MaxLevelsToCompute
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
ossim_uint32 m_MaxRecursionLevel

◆ ossimImageRenderer() [2/2]

ossimImageRenderer::ossimImageRenderer ( ossimImageSource inputSource,
ossimImageViewTransform imageViewTrans = NULL 
)

Definition at line 1061 of file ossimImageRenderer.cpp.

References m_ImageViewTransform, m_Resampler, ossimViewInterface::theObject, and ossimRefPtr< T >::valid().

1063  : ossimImageSourceFilter(inputSource),
1064  ossimViewInterface(0),
1065  m_Resampler(0),
1066  m_BlankTile(0),
1067  m_Tile(0),
1068  m_TemporaryBuffer(0),
1069  m_StartingResLevel(0),
1070  m_ImageViewTransform(imageViewTrans),
1071  m_inputR0Rect(),
1072  m_viewRect(),
1073  m_rectsDirty(true),
1076  m_MaxLevelsToCompute(999999) // something large so it will always compute
1077 {
1081  {
1083  }
1084 }
ossimObject * theObject
ossimRefPtr< ossimImageData > m_Tile
bool valid() const
Definition: ossimRefPtr.h:75
ossimImageSourceFilter(ossimObject *owner=NULL)
ossim_uint32 m_StartingResLevel
This is going to allow us to chain multiple renderers together.
ossimFilterResampler * m_Resampler
ossimRefPtr< ossimImageData > m_BlankTile
ossimRefPtr< ossimImageData > m_TemporaryBuffer
ossim_uint32 m_MaxLevelsToCompute
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
ossim_uint32 m_MaxRecursionLevel

◆ ~ossimImageRenderer()

ossimImageRenderer::~ossimImageRenderer ( )
virtual

Definition at line 1086 of file ossimImageRenderer.cpp.

References m_ImageViewTransform, and m_Resampler.

1087 {
1089 
1090  if(m_Resampler)
1091  {
1092  delete m_Resampler;
1093  m_Resampler = 0;
1094  }
1095 }
ossimFilterResampler * m_Resampler
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

Member Function Documentation

◆ allocate()

void ossimImageRenderer::allocate ( )
private

Called on first getTile, will initialize all data needed.

Definition at line 1764 of file ossimImageRenderer.cpp.

References ossimImageDataFactory::create(), deallocate(), ossimImageData::initialize(), ossimImageDataFactory::instance(), m_BlankTile, m_Tile, and ossimImageSourceFilter::theInputConnection.

1765 {
1766  deallocate();
1767 
1768  if(theInputConnection)
1769  {
1772 
1773  m_Tile->initialize();
1774  }
1775 }
ossimRefPtr< ossimImageData > m_Tile
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimRefPtr< ossimImageData > m_BlankTile
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
void deallocate()
Deletes all allocated tiles.

◆ checkIVT()

void ossimImageRenderer::checkIVT ( )
private

this is called on a property event and on input connection changes.

Definition at line 2037 of file ossimImageRenderer.cpp.

References ossimRefPtr< T >::get(), ossimImageViewProjectionTransform::getImageGeometry(), ossimImageSource::getImageGeometry(), ossimConnectableObject::getInput(), ossimSource::isSourceEnabled(), ossimImageViewTransform::isValid(), m_ImageViewTransform, and PTR_CAST.

Referenced by connectInputEvent(), getImageGeometry(), initialize(), propertyEvent(), setEnableFlag(), and setImageViewTransform().

2038 {
2039  if(!isSourceEnabled())
2040  return;
2041 
2042  // Check validity of the IVT:
2044  return;
2045 
2046  // Detected uninitialized IVT. We are only concerned with projection IVTs (IVPTs) so
2047  // make sure that's what we're working with:
2051 
2052  if(!ivpt || !inputSrc)
2053  return; // nothing to do here yet.
2054 
2055  // Fetch the input image geometry from the IVPT to see if one needs to be established:
2057  if ( !inputGeom )
2058  {
2059  // Ask the input source for a geometry:
2060  inputGeom = inputSrc->getImageGeometry();
2061  if ( !inputGeom )
2062  {
2063  if(traceDebug())
2064  {
2065  ossimNotify(ossimNotifyLevel_WARN)<<"ossimImageRenderer::checkTransform() -- "
2066  "No input image geometry could be established for this renderer."<<endl;
2067  }
2068  return;
2069  }
2070  ivpt->setImageGeometry( inputGeom.get() );
2071  m_rectsDirty = true;
2072  }
2073 
2074  // Now check the output view geometry:
2075  ossimRefPtr<ossimImageGeometry> outputGeom = ivpt->getViewGeometry();
2076  if (!outputGeom)
2077  {
2079 
2080  //---
2081  // If the input geometry sports a map projection instead of a 3D
2082  // projector, use the same map projection for the view.
2083  //
2084  // Note: Don't use map projections with model transforms as they don't
2085  // allow for changing resolution.
2086  //---
2087  const ossimProjection* inputProj = inputGeom->getProjection();
2088  const ossimMapProjection* mapProj = PTR_CAST(ossimMapProjection, inputProj);
2089  if (mapProj && !mapProj->hasModelTransform() )
2090  {
2091  ossimProjection* my_proj = PTR_CAST(ossimProjection, mapProj->dup());
2092  myOutGeom->setProjection(my_proj);
2093  }
2094  else
2095  {
2096  // The input geometry uses a 3D projection, so let's default here to a
2097  // ossimEquDistCylProjection for the view:
2099  ossimDpt meters = inputGeom->getMetersPerPixel();
2100  double GSD = (meters.x + meters.y)/2.0;
2101  meters.x = GSD;
2102  meters.y = GSD;
2103  if(inputProj)
2104  {
2105  //---
2106  // Update the map projection. Since ossimMapProjection::setOrigin calls
2107  // ossimMapProjection::update we do that before setUlTiePoints as it in
2108  // turn calls setUlEastingNorthing(forward(gpt)) which depends on the orgin.
2109  //---
2110  myMapProj->setOrigin(inputProj->origin());
2111  myMapProj->setUlTiePoints( inputProj->origin() );
2112 
2113  }
2114  myMapProj->setMetersPerPixel(meters);
2115  myOutGeom->setProjection(myMapProj);
2116  }
2117 
2118  // Set up our IVT with the new output geometry:
2119  ivpt->setViewGeometry(myOutGeom.get());
2120 
2121  // Must reinitialize bounding rects before calling ossimImageGeometry::setImageSize().
2123 
2124  // Set the size on the ossimImageGeometry.
2125  ossimIrect rect;
2126  getBoundingRect(rect, 0);
2127  myOutGeom->setImageSize( rect.size() );
2128  }
2129 
2130  if ( m_rectsDirty )
2131  {
2133  }
2134 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimObject * dup() const =0
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
m_Resampler will adjust the rect to whatever the view is.
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
double y
Definition: ossimDpt.h:165
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
void setImageSize(const ossimIpt &size)
void setViewGeometry(ossimImageGeometry *g)
Assigns the geometry to use for output view. This object does NOT own the geometry.
ossimIpt size() const
Definition: ossimIrect.h:510
virtual void setMetersPerPixel(const ossimDpt &gsd)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
bool hasModelTransform() const
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0
double x
Definition: ossimDpt.h:164
virtual void setUlTiePoints(const ossimGpt &gpt)
void initializeBoundingRects()
Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setImageGeometry(ossimImageGeometry *g)
Assigns the geometry to use for input image. This object does NOT own the geometry.

◆ computeClosestResLevel()

long ossimImageRenderer::computeClosestResLevel ( const std::vector< ossimDpt > &  decimationFactors,
double  scale 
) const
private

Definition at line 1523 of file ossimImageRenderer.cpp.

References x.

1525 {
1526  long result = 0;
1527  long upper = (long)decimationFactors.size();
1528  bool done = false;
1529 
1530  if(upper > 1)
1531  {
1532  while((result < upper)&&!done)
1533  {
1534  if(scale < decimationFactors[result].x)
1535  {
1536  ++result;
1537  }
1538  else
1539  {
1540  done = true;
1541  }
1542  }
1543 
1544  // now use the higher res level and resample down
1545  //
1546  if(result)
1547  {
1548  --result;
1549  }
1550  }
1551  return result;
1552 }
ossim_uint32 x

◆ connectInputEvent()

void ossimImageRenderer::connectInputEvent ( ossimConnectionEvent event)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 1940 of file ossimImageRenderer.cpp.

References checkIVT(), ossimConnectableObject::getInput(), initialize(), m_ImageViewTransform, PTR_CAST, ossimImageSourceFilter::theInputConnection, and ossimRefPtr< T >::valid().

1941 {
1945 
1946  checkIVT();
1947  initialize();
1948 }
bool valid() const
Definition: ossimRefPtr.h:75
void checkIVT()
this is called on a property event and on input connection changes.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
ossimImageSource * theInputConnection
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ deallocate()

void ossimImageRenderer::deallocate ( )
private

Deletes all allocated tiles.

Definition at line 1757 of file ossimImageRenderer.cpp.

References m_BlankTile, m_TemporaryBuffer, and m_Tile.

Referenced by allocate(), and initialize().

1758 {
1759  m_Tile = 0;
1760  m_BlankTile = 0;
1761  m_TemporaryBuffer = 0;
1762 }
ossimRefPtr< ossimImageData > m_Tile
ossimRefPtr< ossimImageData > m_BlankTile
ossimRefPtr< ossimImageData > m_TemporaryBuffer

◆ disableSource()

void ossimImageRenderer::disableSource ( )
virtual

Disables source.

Overrides ossimSource::disableSource so bounding rects are recomputed on state change.

Reimplemented from ossimSource.

Definition at line 2555 of file ossimImageRenderer.cpp.

References ossimSource::isSourceEnabled(), and setEnableFlag().

2556 {
2557  if ( isSourceEnabled() )
2558  {
2559  setEnableFlag( false );
2560  }
2561 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setEnableFlag(bool flag)
Sets the enable flag.

◆ disconnectInputEvent()

void ossimImageRenderer::disconnectInputEvent ( ossimConnectionEvent event)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 1950 of file ossimImageRenderer.cpp.

References ossimRefPtr< T >::get(), m_ImageViewTransform, ossimImageViewProjectionTransform::setImageGeometry(), and ossimImageSourceFilter::theInputConnection.

1951 {
1954  if(ivpt)
1955  ivpt->setImageGeometry(0);
1956 
1957  theInputConnection = 0;
1958 }
ossimImageSource * theInputConnection
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
void setImageGeometry(ossimImageGeometry *g)
Assigns the geometry to use for input image. This object does NOT own the geometry.

◆ enableSource()

void ossimImageRenderer::enableSource ( )
virtual

Enables source.

Overrides ossimSource::enableSource so bounding rects are recomputed on state change.

Reimplemented from ossimSource.

Definition at line 2547 of file ossimImageRenderer.cpp.

References ossimSource::isSourceEnabled(), and setEnableFlag().

2548 {
2549  if ( isSourceEnabled() == false )
2550  {
2551  setEnableFlag( true );
2552  }
2553 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setEnableFlag(bool flag)
Sets the enable flag.

◆ fillTile()

void ossimImageRenderer::fillTile ( ossimRefPtr< ossimImageData outputData,
const ossimRendererSubRectInfo rectInfo 
)
private

Definition at line 1348 of file ossimImageRenderer.cpp.

References ossimImageRenderer::ossimRendererSubRectInfo::getAbsValueImageToViewScales(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageSource::getDecimationFactor(), ossimFilterResampler::getKernelSupport(), ossimImageSource::getNumberOfDecimationLevels(), getTileAtResLevel(), ossimImageRenderer::ossimRendererSubRectInfo::getViewRect(), ossimDpt::hasNans(), ossimDrect::height(), ossimImageRenderer::ossimRendererSubRectInfo::imageHasNans(), ossimDrect::lr(), ossimImageRenderer::ossimRendererSubRectInfo::m_Ill, ossimImageRenderer::ossimRendererSubRectInfo::m_Ilr, m_inputR0Rect, ossimImageRenderer::ossimRendererSubRectInfo::m_Iul, ossimImageRenderer::ossimRendererSubRectInfo::m_Iur, m_Resampler, m_StartingResLevel, ossimDpt::makeNan(), OSSIM_EMPTY, OSSIM_NULL, ossimFilterResampler::resample(), RSET_SEARCH_THRESHHOLD, ossimFilterResampler::setBoundingInputRect(), ossimFilterResampler::setScaleFactor(), status, ossimImageSourceFilter::theInputConnection, ossimDrect::ul(), ossimRefPtr< T >::valid(), ossimDrect::width(), ossimDpt::x, and ossimDpt::y.

Referenced by recursiveResample().

1350 {
1351  if(!outputData.valid() || !outputData->getBuf() || rectInfo.imageHasNans())
1352  {
1353  return;
1354  }
1355  ossimDrect vrect = rectInfo.getViewRect();
1356 
1357  ossimDpt imageToViewScale = rectInfo.getAbsValueImageToViewScales();
1358 
1359  if(imageToViewScale.hasNans()) return;
1360 
1361  ossimDpt tile_size = ossimDpt(vrect.width(), vrect.height());
1362  double kernelSupportX, kernelSupportY;
1363 
1364  double resLevelX = log( 1.0 / imageToViewScale.x )/ log( 2.0 );
1365  double resLevelY = log( 1.0 / imageToViewScale.y )/ log( 2.0 );
1366  double resLevel0 = resLevelX < resLevelY ? resLevelX : resLevelY;
1367  long closestFitResLevel = (long)floor( resLevel0 );
1368 
1369  //double averageScale = (imageToViewScale.x + imageToViewScale.y) / 2.0;
1370  //long closestFitResLevel = (long)floor( log( 1.0 / averageScale )/ log( 2.0 ) );
1371 
1372  ossim_uint32 resLevel = closestFitResLevel<0 ? 0:closestFitResLevel;
1373  resLevel += m_StartingResLevel;
1374 
1375  //---
1376  // ESH 02/2009: If requested resLevel is too high, let's lower it to one
1377  // that is ok.
1378  //---
1379 #if 0
1381  if ( (NUM_LEVELS > 0) && (resLevel >= NUM_LEVELS) )
1382  {
1383  resLevel = NUM_LEVELS - 1;
1384  }
1385 #endif
1386  //---
1387  // ESH 11/2008: Check the rset at the calculated resLevel to see
1388  // if it has the expected decimation factor. It it does, we can
1389  // use this rset and assume it is at resLevel.
1390  //---
1391  ossimDpt decimation;
1392  decimation.makeNan(); // initialize to nan.
1393  theInputConnection->getDecimationFactor(resLevel, decimation);
1394  double requestScale = 1.0 / (1<<resLevel);
1395  double closestScale = decimation.hasNans() ? requestScale : decimation.x;
1396 
1397 #if 0
1398  double differenceTest = 0.0;
1399  if (closestScale != 0.0)
1400  {
1401  differenceTest = (1.0/closestScale) - (1.0/requestScale);
1402  }
1403 
1404  //---
1405  // ESH 11/2008: Add in threshold test so search only happens when
1406  // necessary.
1407  // We do an rset search if 1 of 2 conditions is met: either
1408  // 1) the rset is really different in size from the requested size, or
1409  // 2) they're similar in size, and the actual rset is smaller than
1410  // the requested size.
1411  //---
1412  if ( (fabs(differenceTest) > RSET_SEARCH_THRESHHOLD) ||
1413  ((fabs(differenceTest) < RSET_SEARCH_THRESHHOLD) &&
1414  (differenceTest < 0.0) ) )
1415  {
1416  //---
1417  // ESH 11/2008: We test for the best rset. We assume
1418  // that decimation level always decreases as resLevel increases, so
1419  // the search can end before testing all rsets.
1420  //---
1421  ossim_uint32 savedResLevel = resLevel;
1422  closestScale = 1.0; // resLevel 0
1423  resLevel = 0;
1424  ossim_uint32 i;
1425  for( i=1; i<NUM_LEVELS; ++i )
1426  {
1427  theInputConnection->getDecimationFactor(i, decimation);
1428  if(decimation.hasNans() == false )
1429  {
1430  double testDiscrepancy = decimation.x - requestScale;
1431  if ( testDiscrepancy < 0.0 ) // we're done
1432  {
1433  break;
1434  }
1435  else
1436  {
1437  closestScale = decimation.x;
1438  resLevel = i;
1439  }
1440  }
1441  else // use the default value
1442  {
1443  closestScale = requestScale;
1444  resLevel = savedResLevel;
1445  break;
1446  }
1447  }
1448  }
1449 #endif
1450  ossimDpt nul(rectInfo.m_Iul.x*closestScale,
1451  rectInfo.m_Iul.y*closestScale);
1452  ossimDpt nll(rectInfo.m_Ill.x*closestScale,
1453  rectInfo.m_Ill.y*closestScale);
1454  ossimDpt nlr(rectInfo.m_Ilr.x*closestScale,
1455  rectInfo.m_Ilr.y*closestScale);
1456  ossimDpt nur(rectInfo.m_Iur.x*closestScale,
1457  rectInfo.m_Iur.y*closestScale);
1458 
1459  m_Resampler->getKernelSupport( kernelSupportX, kernelSupportY );
1460 
1461  ossimDrect boundingRect = ossimDrect( nul, nll, nlr, nur );
1462 
1463 
1464  boundingRect = ossimIrect((ossim_int32)floor(boundingRect.ul().x - (kernelSupportX)-.5),
1465  (ossim_int32)floor(boundingRect.ul().y - (kernelSupportY)-.5),
1466  (ossim_int32)ceil (boundingRect.lr().x + (kernelSupportX)+.5),
1467  (ossim_int32)ceil (boundingRect.lr().y + (kernelSupportY)+.5));
1468 
1469  ossimDrect requestRect = boundingRect;
1470 
1471  ossimRefPtr<ossimImageData> data = getTileAtResLevel(requestRect, resLevel);
1472 
1474  if( data.valid() )
1475  {
1476  status = data->getDataObjectStatus();
1477  }
1478  if( (status == OSSIM_NULL) || (status == OSSIM_EMPTY) )
1479  {
1480  return;
1481  }
1482 
1483  if((boundingRect.width() <2)&&(boundingRect.height()<2))
1484  {
1485 
1486 // return;
1487  }// std::cout << "SMALL RECT!!!!!!\n";
1488  else
1489  {
1490  ossimDrect inputRect = m_inputR0Rect;
1491  inputRect = inputRect*ossimDpt(closestScale, closestScale);
1492  m_Resampler->setBoundingInputRect(inputRect);
1493 
1494  double denominatorY = 1.0;
1495  if(tile_size.y > 2)
1496  {
1497  denominatorY = tile_size.y-1.0;
1498  }
1499 
1500  ossimDpt newScale( imageToViewScale.x / closestScale,
1501  imageToViewScale.y / closestScale );
1502  m_Resampler->setScaleFactor(newScale);
1503 
1504 
1505  //std::cout << "SPLIT VIEW RECT: " << vrect << std::endl;
1506  //std::cout << "VIEW RECT: " << outputData->getImageRectangle() << std::endl;
1507 
1508 
1509  m_Resampler->resample(data,
1510  outputData,
1511  vrect,
1512  nul,
1513  nur,
1514  ossimDpt( ( (nll.x - nul.x)/denominatorY ),
1515  ( (nll.y - nul.y)/denominatorY ) ),
1516  ossimDpt( ( (nlr.x - nur.x)/denominatorY ),
1517  ( (nlr.y - nur.y)/denominatorY ) ),
1518  tile_size);
1519  }
1520 
1521 }
ossim_float64 width() const
Definition: ossimDrect.h:522
bool valid() const
Definition: ossimRefPtr.h:75
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
void setScaleFactor(const ossimDpt &scale)
ossim_uint32 m_StartingResLevel
This is going to allow us to chain multiple renderers together.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.
ossimFilterResampler * m_Resampler
void setBoundingInputRect(const ossimIrect &rect)
ossimImageSource * theInputConnection
unsigned int ossim_uint32
ossimRefPtr< ossimImageData > getTileAtResLevel(const ossimIrect &boundingRect, ossim_uint32 resLevel)
bool hasNans() const
Definition: ossimDpt.h:67
ossim_float64 height() const
Definition: ossimDrect.h:517
return status
virtual void getKernelSupport(double &x, double &y) const
virtual const void * getBuf() const
double x
Definition: ossimDpt.h:164
#define RSET_SEARCH_THRESHHOLD
virtual void resample(const ossimRefPtr< ossimImageData > &input, ossimRefPtr< ossimImageData > &output, const ossimDpt &ul, const ossimDpt &ur, const ossimDpt &deltaUl, const ossimDpt &deltaUr, const ossimDpt &length)
ossimDataObjectStatus
Definitions for data object status.
const ossimDpt & lr() const
Definition: ossimDrect.h:341
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
void makeNan()
Definition: ossimDpt.h:65
int ossim_int32

◆ getBoundingImageRect()

ossimIrect ossimImageRenderer::getBoundingImageRect ( ) const
private

◆ getBoundingRect() [1/2]

ossimIrect ossimImageRenderer::getBoundingRect ( ossim_uint32  resLevel = 0) const
virtual

m_Resampler will adjust the rect to whatever the view is.

So it will project the full image rect onto the view and return the upright bounding rect.

Reimplemented from ossimImageSource.

Definition at line 1554 of file ossimImageRenderer.cpp.

1555 {
1556  //---
1557  // 01 November 2011:
1558  // Backed out expand code as the ossimImageViewProjectionTransform::getImageToViewBounds
1559  // does not handle image on the edge of international date line. D. Burken
1560  //---
1561 
1562  // The input bounding rect as returned here corresponds to "pixel-is-point", i.e., the center
1563  // of the pixel area for the corners and not the edges which extend 1/2 pixel in all
1564  // directions. Because the view is probably a different GSD, first expand the input
1565  // bounding rect to the edge before transforming to a view rect. Then shrink the view rect by
1566  // 1/2 pixel to get it to the pixel center (OSSIM convention for bounding rect -- this may
1567  // need to be revisited in light of the need to match edges, not pixel centers, OLK 09/11).
1568 
1569  // Code functionality moved to below method. (drb - 08 Nov. 2011)
1570 
1571  ossimIrect result;
1572  getBoundingRect( result, resLevel );
1573  return result;
1574 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
m_Resampler will adjust the rect to whatever the view is.

◆ getBoundingRect() [2/2]

void ossimImageRenderer::getBoundingRect ( ossimIrect rect,
ossim_uint32  resLevel = 0 
) const
virtual

Gets the bounding rectangle of the source.

This is the output view bounds.

Parameters
rectInitialized with bounding rectangle by this.
resLevelReduced resolution level if applicable.

Reimplemented from ossimImageSource.

Definition at line 1576 of file ossimImageRenderer.cpp.

References ossimImageSource::getBoundingRect(), ossimSource::isSourceEnabled(), m_viewRect, ossimIrect::makeNan(), and ossimImageSourceFilter::theInputConnection.

1577 {
1578  if ( isSourceEnabled() )
1579  {
1580  rect = m_viewRect;
1581  }
1582  else if ( theInputConnection )
1583  {
1584  rect = theInputConnection->getBoundingRect(resLevel);
1585  }
1586  else
1587  {
1588  rect.makeNan();
1589  }
1590 #if 0 /* Please leave for debug. */
1591  if(traceDebug())
1592  {
1594  << "ossimImageRenderer::getBoundingRect(rect, resLevel) debug:\nbounds = "
1595  << rect << "\n";
1596  }
1597 #endif
1598 }
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.
ossimImageSource * theInputConnection
void makeNan()
Definition: ossimIrect.h:329
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getDecimationFactor()

void ossimImageRenderer::getDecimationFactor ( ossim_uint32  resLevel,
ossimDpt result 
) const
virtual

Will return the decimation factor for the given resolution level.

the decimation is the scale from Resolution 0 or full res. Usually this is a power of 2 decimation where the decimation result is 1.0/2^resoltion.

Reimplemented from ossimImageSource.

Definition at line 2136 of file ossimImageRenderer.cpp.

References ossimImageSource::getDecimationFactor(), and ossimSource::isSourceEnabled().

2138 {
2139  if(isSourceEnabled())
2140  {
2141  result = ossimDpt(1,1);
2142  }
2143  else
2144  {
2146  result);
2147  }
2148 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.

◆ getDecimationFactors()

void ossimImageRenderer::getDecimationFactors ( vector< ossimDpt > &  decimations) const
virtual

Definition at line 2150 of file ossimImageRenderer.cpp.

References ossimImageSource::getDecimationFactors(), and ossimSource::isSourceEnabled().

2151 {
2152  if(isSourceEnabled())
2153  {
2154  decimations.push_back(ossimDpt(1,1));
2155  }
2156  else
2157  {
2159  }
2160 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void getDecimationFactors(std::vector< ossimDpt > &decimations) const
Will return an array of all decimations for each resolution level.

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimImageRenderer::getImageGeometry ( )
virtual

Returns instance to the input image geometry.

This may be a NULL pointer. This is only valid if the IVT is a projection type IVT (IVPT)

Reimplemented from ossimImageSource.

Definition at line 1916 of file ossimImageRenderer.cpp.

References checkIVT(), ossimRefPtr< T >::get(), ossimImageSource::getImageGeometry(), ossimImageViewProjectionTransform::getViewGeometry(), ossimSource::isSourceEnabled(), ossimImageViewTransform::isValid(), m_ImageViewTransform, ossimImageSourceFilter::theInputConnection, and ossimRefPtr< T >::valid().

1917 {
1919  if (isSourceEnabled())
1920  {
1921  // Make sure the IVT was properly initialized
1923  checkIVT();
1924 
1927  if (ivpt)
1928  {
1929  // we need to return the right side since the geometry changed to a view geometry
1930  geom = ivpt->getViewGeometry();
1931  }
1932  }
1933  else if (theInputConnection)
1934  {
1936  }
1937  return geom;
1938 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
bool valid() const
Definition: ossimRefPtr.h:75
void checkIVT()
this is called on a property event and on input connection changes.
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0

◆ getImageViewTransform()

ossimImageViewTransform* ossimImageRenderer::getImageViewTransform ( )
inline

Definition at line 84 of file ossimImageRenderer.h.

Referenced by ossimIvtGeomXformVisitor::visit().

84 { return m_ImageViewTransform.get(); }
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ getLongName()

ossimString ossimImageRenderer::getLongName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 2515 of file ossimImageRenderer.cpp.

2516 {
2517  return ossimString("Image Renderer");
2518 }

◆ getMaxLevelsToCompute()

ossim_uint32 ossimImageRenderer::getMaxLevelsToCompute ( ) const

Definition at line 2368 of file ossimImageRenderer.cpp.

References m_MaxLevelsToCompute.

2369 {
2370  return m_MaxLevelsToCompute;
2371 }
ossim_uint32 m_MaxLevelsToCompute

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimImageRenderer::getNumberOfDecimationLevels ( ) const
virtual

Will return the number of resolution levels.

Note: resolution level 0 is included in the return count.

Reimplemented from ossimImageSource.

Definition at line 2162 of file ossimImageRenderer.cpp.

References ossimImageSource::getNumberOfDecimationLevels(), and ossimSource::isSourceEnabled().

2163 {
2164  if(isSourceEnabled())
2165  {
2166  return 1;
2167  }
2168 
2170 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.

◆ getProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 1991 of file ossimImageRenderer.cpp.

References ossimProperty::clearChangeType(), ossimFilterResampler::getFilterTypes(), ossimFilterResampler::getMinifyFilterTypeAsString(), ossimImageSourceFilter::getProperty(), m_Resampler, ossimProperty::setCacheRefreshBit(), and ossimProperty::setReadOnlyFlag().

1992 {
1993  ossimString tempName = name;
1994 
1995  if((tempName == "Filter type")||
1996  (tempName == "filter_type"))
1997  {
1998  std::vector<ossimString> filterNames;
1999  m_Resampler->getFilterTypes(filterNames);
2000 
2001  ossimStringProperty* stringProp = new ossimStringProperty("filter_type",
2003  false,
2004  filterNames);
2005  stringProp->clearChangeType();
2006  stringProp->setReadOnlyFlag(false);
2007  stringProp->setCacheRefreshBit();
2008 
2009  return stringProp;
2010  }
2011 // else if(tempName == "Blur factor")
2012 // {
2013 // ossimNumericProperty* numericProperty = new ossimNumericProperty("Blur factor",
2014 // ossimString::toString((double)m_Resampler->getBlurFactor()));
2015 
2016 // numericProperty->setConstraints(0.0, 50.0);
2017 // numericProperty->setNumericType(ossimNumericProperty::ossimNumericPropertyType_FLOAT64);
2018 // numericProperty->setCacheRefreshBit();
2019 
2020 // return numericProperty;
2021 // }
2022 
2024 }
virtual void getFilterTypes(std::vector< ossimString > &filterTypes) const
ossimString getMinifyFilterTypeAsString() const
virtual void setReadOnlyFlag(bool flag)
ossimFilterResampler * m_Resampler
void clearChangeType()
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void setCacheRefreshBit()

◆ getPropertyNames()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 2026 of file ossimImageRenderer.cpp.

References ossimImageSourceFilter::getPropertyNames().

2027 {
2029 
2030  propertyNames.push_back("Filter type");
2031 // propertyNames.push_back("Blur factor");
2032 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getResampler()

ossimFilterResampler* ossimImageRenderer::getResampler ( )
inline

Definition at line 91 of file ossimImageRenderer.h.

Referenced by ossimKakaduJpipHandler::getTile().

91 { return m_Resampler; }
ossimFilterResampler * m_Resampler

◆ getShortName()

ossimString ossimImageRenderer::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 2520 of file ossimImageRenderer.cpp.

2521 {
2522  return ossimString("Image Renderer");
2523 }

◆ getTile()

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

the resampler will need the tile request to come from the view.

It will use the view to transoform this to world and then use the image's projection to get it into final line sample. This way the resampler can fill a tile width by height on the screen correctly.

Reimplemented from ossimImageSource.

Definition at line 1097 of file ossimImageRenderer.cpp.

Referenced by ossimKakaduJpipHandler::getTile().

1100 {
1101  // std::cout << "_________________________\n";
1102  static const char MODULE[] = "ossimImageRenderer::getTile";
1103  if(traceDebug())
1104  {
1106  << MODULE << " Requesting view rect = "
1107  << tileRect << endl;
1108  }
1109  // long w = tileRect.width();
1110  // long h = tileRect.height();
1111  // ossimIpt origin = tileRect.ul();
1112 
1113  if( !m_BlankTile.valid() || !m_Tile.valid() )
1114  {
1115  allocate();
1116  if ( !m_BlankTile.valid() || !m_Tile.valid() )
1117  {
1118  if(traceDebug())
1119  {
1121  << "ossimImageRenderer::getTile tile allocation failure!\n"
1122  << endl;
1123  }
1124  return ossimImageSourceFilter::getTile(tileRect, resLevel);
1125  }
1126  }
1127 
1128  m_BlankTile->setImageRectangle(tileRect);
1129 
1130  if(!theInputConnection)
1131  {
1132  return m_BlankTile;
1133  }
1134 
1137  {
1138  // This tile source bypassed, return the input tile source.
1139  return theInputConnection->getTile(tileRect, resLevel);
1140  }
1141 
1142  if( m_rectsDirty )
1143  {
1145 
1146  // We can't go on without these...
1147  if ( m_rectsDirty )
1148  {
1149  return m_BlankTile;
1150  }
1151  }
1152 
1153  if(m_viewRect.width() < 4 && m_viewRect.height() < 4)
1154  {
1155  return m_BlankTile;
1156  }
1157 
1158  if( !theInputConnection ||
1159  !m_viewRect.intersects(tileRect) ||
1160  !m_viewArea.intersects(tileRect) )
1161  {
1162  if(traceDebug())
1163  {
1165  << MODULE << "No intersection, Returning...." << endl;
1166  }
1167  return m_BlankTile;
1168  }
1169 
1170  // drb - handled above...
1171  // if(!m_Tile)
1172  // {
1173  // return theInputConnection->getTile(tileRect, resLevel);
1174  // }
1175 
1176  // Check for identity transform:
1178  {
1179  return theInputConnection->getTile(tileRect, resLevel);
1180  }
1181 
1182  // long tw = m_Tile->getWidth();
1183  // long th = m_Tile->getHeight();
1184 
1185  m_Tile->setImageRectangle(tileRect);
1186  m_Tile->makeBlank();
1187 
1188 
1189  //if(!(m_viewArea.intersects(ossimPolyArea2d(tileRect))))
1190  //{
1191  // return m_BlankTile;
1192  //}
1193 
1194 #if 0
1195  // expand a small patch just to alleviate errors in the size of the rect when resampling
1196  // ossimIrect viewRectClip = tileRect.clipToRect(ossimIrect(m_viewRect.ul() + ossimIpt(-8,-8),
1197  // m_viewRect.lr() + ossimIpt(8,8)));
1198  ossimIrect viewRectClip = tileRect.clipToRect(m_viewRect);
1199  std::cout << "_____________________" << std::endl;
1200  std::cout << "viewRectClip = " << viewRectClip << std::endl;
1201 // std::cout << "tileRect = " << tileRect << std::endl;
1202 // std::cout << "m_viewRect = " << m_viewRect << std::endl;
1203  ossimRendererSubRectInfo subRectInfo(viewRectClip.ul(),
1204  viewRectClip.ur(),
1205  viewRectClip.lr(),
1206  viewRectClip.ll());
1207 #else
1208  ossimRendererSubRectInfo subRectInfo(m_ImageViewTransform.get(),
1209  tileRect.ul(),
1210  tileRect.ur(),
1211  tileRect.lr(),
1212  tileRect.ll());
1213 
1214 
1215 #endif
1216  subRectInfo.m_viewBounds = &m_viewArea;
1217  subRectInfo.transformViewToImage();
1218 
1219  if((!m_viewArea.intersects(subRectInfo.getViewRect())))
1220 // if((!m_viewRect.intersects(subRectInfo.getViewRect())))
1221  {
1222  return m_BlankTile;
1223  }
1224  if(traceDebug())
1225  {
1227  << MODULE << " image rect = " << subRectInfo.getImageRect() << std::endl;
1228  }
1229 
1230  // If the image rect is completely outside of the valid image, there is no need to resample:
1231  // (OLK 11/18)
1232 // if ((!subRectInfo.imageHasNans())&&!m_inputR0Rect.intersects(subRectInfo.getImageRect()))
1233 // {
1234 // return m_Tile;
1235 // }
1236  recursiveResample(m_Tile, subRectInfo, 1);
1237 
1238  if(m_Tile.valid())
1239  {
1240  m_Tile->validate();
1241  }
1242  if(traceDebug())
1243  {
1245  << MODULE << "Returning...." << endl;
1246  }
1247  return m_Tile;
1248 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
ossimRefPtr< ossimImageData > m_Tile
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint32 height() const
Definition: ossimIrect.h:487
ossimPolyArea2d m_viewArea
bool intersects(const ossimPolyArea2d &rhs) const
const ossimIpt & ul() const
Definition: ossimIrect.h:274
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
void recursiveResample(ossimRefPtr< ossimImageData > outputData, const ossimRendererSubRectInfo &rectInfo, ossim_uint32 level)
const ossimIpt & ll() const
Definition: ossimIrect.h:277
ossimRefPtr< ossimImageData > m_BlankTile
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
const ossimIpt & ur() const
Definition: ossimIrect.h:275
virtual bool isIdentity() const =0
virtual void makeBlank()
Initializes data to null pixel values.
void initializeBoundingRects()
Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0
void allocate()
Called on first getTile, will initialize all data needed.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getTileAtResLevel()

ossimRefPtr< ossimImageData > ossimImageRenderer::getTileAtResLevel ( const ossimIrect boundingRect,
ossim_uint32  resLevel 
)
private

Definition at line 2203 of file ossimImageRenderer.cpp.

References ossimImageData::dup(), ossimImageSource::getBoundingRect(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageSource::getNumberOfDecimationLevels(), ossimRectilinearDataObject::getScalarType(), ossimImageSource::getTile(), ossimImageSource::getTileHeight(), ossimImageSource::getTileWidth(), ossimImageData::initialize(), ossimIrect::intersects(), ossimIrect::lr(), m_BlankTile, m_MaxLevelsToCompute, m_TemporaryBuffer, ossimImageData::makeBlank(), OSSIM_EMPTY, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_UINT16, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, resampleTileToDecimation(), ossimImageData::setImageRectangle(), ossimIrect::stretchToTileBoundary(), ossimImageSourceFilter::theInputConnection, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, and ossimIpt::y.

Referenced by fillTile().

2205 {
2206  if(!theInputConnection)
2207  {
2208  m_BlankTile->setImageRectangle(boundingRect);
2209 
2210  return m_BlankTile;
2211  }
2212 
2214 
2215  // ossim_uint32 maxValue = (ossim_uint32)ossim::max((ossim_uint32)m_BoundingRect.width(),
2216  // (ossim_uint32)m_BoundingRect.height());
2217  if(resLevel == 0)
2218  {
2219  return theInputConnection->getTile(boundingRect);
2220  }
2221  if(resLevel < levels)
2222  {
2223  if(theInputConnection)
2224  {
2225  return theInputConnection->getTile(boundingRect,
2226  resLevel);
2227  }
2228  else
2229  {
2230  return m_BlankTile;
2231  }
2232  }
2233  else if((resLevel - levels) < m_MaxLevelsToCompute)
2234  {
2235  // check to see how many decimations we must achiev for the
2236  // request
2237  //
2238  int decimations = (resLevel - (levels-1));
2241 
2242  ossim_int32 multiplier = (1 << decimations);
2243 
2244  ossim_int32 xIndex = 0;
2245  ossim_int32 yIndex = 0;
2246 
2247  // adjust the tilesize so it at least will cover the multiplier
2248  // We will probably come up with something better later but for now
2249  // this will do.
2250  if(multiplier > tileSize.x)
2251  {
2252  tileSize.x = multiplier;
2253  }
2254  if(multiplier > tileSize.y)
2255  {
2256  tileSize.y = multiplier;
2257  }
2258 
2259  // set the rect that covers the requested RLevel to the valid RLevel.
2260  // the valid RLevel is what is available on the input side.
2261  //
2262  ossimIrect requestedRectAtValidRLevel = boundingRect;
2263  requestedRectAtValidRLevel.stretchToTileBoundary(tileSize);
2264  ossimIrect mappedRequestedRect = requestedRectAtValidRLevel;
2265  requestedRectAtValidRLevel = requestedRectAtValidRLevel*((double)multiplier);
2266 
2267  if(!m_TemporaryBuffer)
2268  {
2270  m_TemporaryBuffer->setImageRectangle(mappedRequestedRect);
2272  }
2273  else
2274  {
2275  m_TemporaryBuffer->setImageRectangle(mappedRequestedRect);
2277  }
2278 
2279  // ossim_uint32 totalCount = ((requestedRectAtValidRLevel.lr().y-requestedRectAtValidRLevel.ul().y)*
2280  // (requestedRectAtValidRLevel.lr().x-requestedRectAtValidRLevel.ul().x));
2281  ossim_uint32 currentCount = 0;
2282  ossimIrect boundingRect = theInputConnection->getBoundingRect(levels-1);
2283  for(yIndex = requestedRectAtValidRLevel.ul().y;yIndex < requestedRectAtValidRLevel.lr().y; yIndex += tileSize.y)
2284  {
2285  for(xIndex = requestedRectAtValidRLevel.ul().x; xIndex < requestedRectAtValidRLevel.lr().x; xIndex+=tileSize.x)
2286  {
2287  ossimIrect request(xIndex,
2288  yIndex,
2289  xIndex + (tileSize.x-1),
2290  yIndex + (tileSize.y-1));
2291  ossimRefPtr<ossimImageData> data = theInputConnection->getTile(request, levels-1);
2292 
2293  if(data.valid() && (data->getDataObjectStatus()!=OSSIM_EMPTY)&&
2294  data->getBuf()&&
2295  boundingRect.intersects(request))
2296  {
2297  switch(data->getScalarType())
2298  {
2299  case OSSIM_UINT8:
2300  {
2303  data,
2304  multiplier);
2305  break;
2306  }
2307  case OSSIM_SINT16:
2308  {
2311  data,
2312  multiplier);
2313  break;
2314  }
2315  case OSSIM_UINT16:
2316  case OSSIM_USHORT11:
2317  case OSSIM_USHORT12:
2318  case OSSIM_USHORT13:
2319  case OSSIM_USHORT14:
2320  case OSSIM_USHORT15:
2321  {
2324  data,
2325  multiplier);
2326  break;
2327  }
2328  case OSSIM_FLOAT32:
2330  {
2333  data,
2334  multiplier);
2335  break;
2336  }
2337  case OSSIM_FLOAT64:
2339  {
2342  data,
2343  multiplier);
2344  break;
2345  }
2346  case OSSIM_SCALAR_UNKNOWN:
2347  default:
2348  {
2349  break;
2350  }
2351  }
2352  }
2353  ++currentCount;
2354  }
2355  }
2357  return m_TemporaryBuffer;
2358  }
2359 
2360  return 0;
2361 }
16 bit unsigned integer (15 bits used)
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
64 bit floating point
virtual void setImageRectangle(const ossimIrect &rect)
16 bit unsigned integer
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
16 bit signed integer
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimDataObjectStatus getDataObjectStatus() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.
32 bit floating point
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
unsigned short ossim_uint16
virtual void initialize()
Initialize the data buffer.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual ossimObject * dup() const
double ossim_float64
ossimRefPtr< ossimImageData > m_BlankTile
ossimRefPtr< ossimImageData > m_TemporaryBuffer
virtual ossimDataObjectStatus validate() const
signed short ossim_sint16
ossimImageSource * theInputConnection
unsigned int ossim_uint32
32 bit normalized floating point
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_uint32 m_MaxLevelsToCompute
void resampleTileToDecimation(T dummyVariable, ossimRefPtr< ossimImageData > result, ossimRefPtr< ossimImageData > tile, ossim_uint32 multiplier)
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
Definition: ossimIrect.cpp:212
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
unsigned char ossim_uint8
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
16 bit unsigned integer (12 bits used)

◆ getValidImageVertices()

void ossimImageRenderer::getValidImageVertices ( vector< ossimIpt > &  validVertices,
ossimVertexOrdering  ordering = OSSIM_CLOCKWISE_ORDER,
ossim_uint32  resLevel = 0 
) const
virtual

ordering specifies how the vertices should be arranged.

valid image vertices is basically the tightly fit convex hull of the image. Usually an image has NULL values and are internally not upright rectangular. This can cause problems some spatial filters.

We need to make sure that the resampler overrides this method. it needs to transform the vertices to the view's side.

Definition at line 1884 of file ossimImageRenderer.cpp.

References ossimImageSource::getValidImageVertices(), ossimImageViewTransform::imageToView(), ossimSource::isSourceEnabled(), ossimImageViewTransform::isValid(), m_ImageViewTransform, ossimImageSourceFilter::theInputConnection, and ossimRefPtr< T >::valid().

1887 {
1889  {
1890  theInputConnection->getValidImageVertices(validVertices, ordering, resLevel);
1891  if(isSourceEnabled())
1892  {
1893  ossim_uint32 inputSize = (ossim_uint32)validVertices.size();
1894  if(inputSize)
1895  {
1896  ossimDpt viewPt;
1897  ossim_uint32 idx = 0;
1898  // transform each point to the view
1899  for(idx = 0; idx < inputSize; ++idx)
1900  {
1901  m_ImageViewTransform->imageToView(validVertices[idx], viewPt);
1902 
1903  // round it to the nearest pixel
1904  //
1905  validVertices[idx] = ossimIpt(viewPt);
1906  }
1907  }
1908  }
1909  }
1910 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
bool valid() const
Definition: ossimRefPtr.h:75
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.
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual void imageToView(const ossimDpt &imagePoint, ossimDpt &viewPoint) const
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0

◆ getView() [1/2]

ossimObject * ossimImageRenderer::getView ( )
virtual

Implements ossimViewInterface.

Definition at line 1866 of file ossimImageRenderer.cpp.

References ossimViewInterface::getView(), m_ImageViewTransform, and ossimRefPtr< T >::valid().

1867 {
1869  {
1870  return m_ImageViewTransform->getView();
1871  }
1872  return 0;
1873 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimObject * getView()=0
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ getView() [2/2]

const ossimObject * ossimImageRenderer::getView ( ) const
virtual

Implements ossimViewInterface.

Definition at line 1875 of file ossimImageRenderer.cpp.

References ossimViewInterface::getView(), m_ImageViewTransform, and ossimRefPtr< T >::valid().

1876 {
1878  {
1879  return m_ImageViewTransform->getView();
1880  }
1881  return 0;
1882 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimObject * getView()=0
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ initialize()

void ossimImageRenderer::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 1735 of file ossimImageRenderer.cpp.

References checkIVT(), deallocate(), ossimImageSourceFilter::initialize(), initializeBoundingRects(), ossimSource::isSourceEnabled(), ossimImageViewTransform::isValid(), m_ImageViewTransform, m_rectsDirty, and ossimRefPtr< T >::valid().

Referenced by connectInputEvent(), ossimEquationUtil::initInputSources(), propertyEvent(), refreshEvent(), and setEnableFlag().

1736 {
1737  // Call the base class initialize.
1738  // Note: This will reset "theInputConnection" if it changed...
1740 
1741  deallocate();
1742 
1743  m_rectsDirty = true;
1744 
1745  // we will only do this if we are enabled for this could be expensive
1747  {
1748  checkIVT(); // This can initialize bounding rects and clear dirty flag.
1749  }
1750 
1751  if ( m_rectsDirty )
1752  {
1754  }
1755 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
bool valid() const
Definition: ossimRefPtr.h:75
void checkIVT()
this is called on a property event and on input connection changes.
void deallocate()
Deletes all allocated tiles.
void initializeBoundingRects()
Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0

◆ initializeBoundingRects()

void ossimImageRenderer::initializeBoundingRects ( )
private

Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.

Definition at line 1600 of file ossimImageRenderer.cpp.

References ossimPolyArea2d::add(), ossimIrect::combine(), ossimRefPtr< T >::get(), ossimImageSource::getBoundingRect(), ossimImageGeometry::getBoundingRect(), ossimImageGeometry::getCrossesDateline(), ossimImageViewProjectionTransform::getImageGeometry(), ossimImageViewTransform::getImageToViewBounds(), ossimImageGeometry::getMetersPerPixel(), ossimImageViewProjectionTransform::getViewGeometry(), ossimImageViewProjectionTransform::getViewSegments(), ossimDpt::hasNans(), ossimIrect::hasNans(), ossimDrect::height(), m_ImageViewTransform, m_inputR0Rect, m_rectsDirty, m_viewArea, m_viewRect, ossimIrect::makeNan(), ossim::max(), ossim::min(), ossimNotify(), ossimNotifyLevel_DEBUG, ossimImageSourceFilter::theInputConnection, ossimRefPtr< T >::valid(), ossimDrect::width(), and ossimDpt::y.

Referenced by initialize(), setImageViewTransform(), and setView().

1601 {
1602  m_rectsDirty = true;
1607  if (!m_inputR0Rect.hasNans() )
1608  {
1609  if(ivpt&&ivpt->getImageGeometry()&&ivpt->getViewGeometry())
1610  {
1611  // Little complicated but instead of always setting the edge walk
1612  // to a high number like 50 points per edge
1613  // we will look at the image to view scale change
1614  // and use that as a factor. So as the image zooms out we
1615  // need fewer points to estimate the edge.
1616  //
1617  // ossim_uint32 idx;
1618  std::vector<ossimDrect> boundList;
1619  ossimImageGeometry* igeom = ivpt->getImageGeometry(); // look at projected meters
1620  ossimImageGeometry* vgeom = ivpt->getViewGeometry(); // look at projected meters
1621  ossimDrect testRect;
1622  igeom->getBoundingRect(testRect);
1623  ossimDpt mpp = igeom->getMetersPerPixel();
1624  ossimDpt vmpp = vgeom->getMetersPerPixel();
1625  ossim_float64 scale = 1.0;
1626  ossim_uint32 maxLen = ossim::max(testRect.width(), testRect.height());
1627 
1628  // (GP March 2, 2017) determine goodMatch : test if we have either enough samples to closely match the post spacing
1629  // or if we have at least half the number of pixels along the edge of an image
1630  //
1631  // This is hopefully to help avoid when using the polygon for intersection to not have
1632  // bad intersection tests when zooming. We might have to rethink it and implement
1633  // this as a windowed edge walker. So when zooming we create a polygon that
1634  // is denser for only what the view can see and not the entire image. Basically interatively
1635  // tesselate the input image model based on bounding volumes and then create a dense edge walker
1636  // for what lies in the view at the given scale. Too much to implement right now so we will cheet
1637  // and take an easy way out for now.
1638  //
1639 
1640  if(!mpp.hasNans()&&!vmpp.hasNans())
1641  {
1642  scale = mpp.y/vmpp.y;
1643  if(scale > 1.0) scale = 1.0;
1644  }
1645  ossim_float64 mppTest = mpp.y;
1646  ossim_float64 divisor = mppTest; // default to 30 meter elevation
1647  if(mppTest < 500 )
1648  {
1649  if(mppTest >= 45 )
1650  {
1651  divisor = 90; // 90 meters
1652  }
1653  }
1654  else
1655  {
1656  divisor = 1000; // 1 kilometer
1657  }
1658  if(divisor < 30) divisor = 30.0;
1659 
1660 
1661  // now test to see if our edge walk is close to matching enough
1662  // points for a good match.
1663  //
1664  ossim_uint32 maxEdgeSample = ossim::min(static_cast<ossim_uint32>(50), maxLen);
1665  if(maxEdgeSample < 1) maxEdgeSample = 1;
1666  ossim_uint32 testEdgeSample = ossim::round<ossim_uint32>((maxLen*scale*mpp.y)/divisor);
1667 
1668  bool goodMatch = (testEdgeSample<=maxEdgeSample)||(testEdgeSample>=(maxLen>>1));
1669  ossim_float64 steps = ossim::min(testEdgeSample, maxEdgeSample);
1670 
1671  ossim_uint32 finalSteps = ossim::round<ossim_uint32>(steps);
1672  if(finalSteps<1) finalSteps=1;
1673  if(igeom->getCrossesDateline())
1674  {
1675  if(finalSteps < maxEdgeSample) finalSteps = maxEdgeSample;
1676  }
1677 
1678  ivpt->getViewSegments(boundList, m_viewArea, finalSteps);
1679  if(boundList.size())
1680  {
1681  m_viewRect = boundList[0];
1682  ossim_uint32 idx = 0;
1683 
1684  if(goodMatch)
1685  {
1686  m_viewArea = boundList[idx];
1687  }
1688  else
1689  {
1691  }
1692  for(idx=1;idx<boundList.size();++idx)
1693  {
1694  ossimIrect rectBounds = ossimIrect(boundList[idx]);
1695  m_viewRect = m_viewRect.combine(rectBounds);
1696  if(goodMatch)
1697  {
1698  m_viewArea.add(ossimPolygon(boundList[idx]));
1699  }
1700  else
1701  {
1702  m_viewArea.add(rectBounds);
1703  }
1704  } //
1705  if(!m_viewRect.hasNans())
1706  {
1707  m_rectsDirty = false;
1708  }
1709  } //END if boundList.size()
1710  }
1711  else if(m_ImageViewTransform.valid())
1712  {
1714 
1715  if(!m_viewRect.hasNans())
1716  {
1717  m_rectsDirty = false;
1718  }
1719 
1721  }
1722  }
1723  if ( m_rectsDirty )
1724  {
1725  m_viewRect.makeNan();
1726  }
1727 #if 0 /* Please leave for debug. */
1729  << "ossimImageRenderer::initializeBoundingRects() debug:\n"
1730  << "\ninput rect: " << m_inputR0Rect
1731  << "\nview rect: " << m_viewRect << endl;
1732 #endif
1733 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
T max(T a, T b)
Definition: ossimCommon.h:236
ossim_float64 width() const
Definition: ossimDrect.h:522
bool valid() const
Definition: ossimRefPtr.h:75
void getBoundingRect(ossimIrect &bounding_rect) const
Get the bounding rect of (0, 0) to (imageSize.x-1, imageSize.y-1).
double y
Definition: ossimDpt.h:165
ossimPolyArea2d m_viewArea
double ossim_float64
virtual ossimDrect getImageToViewBounds(const ossimDrect &imageRect) const
Computes the bounding rect in view space of the quad formed by the transformed image points of the in...
ossimImageSource * theInputConnection
unsigned int ossim_uint32
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
T min(T a, T b)
Definition: ossimCommon.h:203
bool hasNans() const
Definition: ossimDpt.h:67
void add(const ossimPolyArea2d &rhs)
ossim_float64 height() const
Definition: ossimDrect.h:517
virtual void getViewSegments(std::vector< ossimDrect > &viewBounds, ossimPolyArea2d &polyArea, ossim_uint32 numberOfEdgePoints=25) const
Because of the fact we can have dateline crossings there exist on the view plane both positive and ne...
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
void makeNan()
Definition: ossimIrect.h:329
bool hasNans() const
Definition: ossimIrect.h:337
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
ossimIrect combine(const ossimIrect &rect) const
Definition: ossimIrect.cpp:543
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadState()

bool ossimImageRenderer::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 ossimImageSourceFilter.

Definition at line 1798 of file ossimImageRenderer.cpp.

1800 {
1801  if (traceDebug())
1802  {
1804  << "ossimImageRenderer::loadState entered..." << endl;
1805 
1806 #ifdef OSSIM_ID_ENABLED
1808  << "OSSIM_ID: " << OSSIM_ID << endl;
1809 #endif
1810  }
1811 
1812  ossimString newPrefix = ossimString(prefix) + ossimString("image_view_trans.");
1813  bool result = ossimImageSourceFilter::loadState(kwl, prefix);
1814 
1815  if(m_Resampler)
1816  {
1817  m_Resampler->loadState(kwl,
1818  (ossimString(prefix)+"resampler.").c_str());
1819  }
1823  {
1825  }
1826  const char* maxLevelsToCompute = kwl.find(prefix,
1827  "max_levels_to_compute");
1828  if(maxLevelsToCompute)
1829  {
1830  m_MaxLevelsToCompute = ossimString(maxLevelsToCompute).toUInt32();
1831  }
1832 
1833  return result;
1834 }
static ossimImageViewTransformFactory * instance()
const char * find(const char *key) const
ossim_uint32 toUInt32() const
ossimFilterResampler * m_Resampler
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 m_MaxLevelsToCompute
virtual ossimImageViewTransform * createTransform(const ossimKeywordlist &kwl, const char *prefix=0)
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
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)

◆ propertyEvent()

void ossimImageRenderer::propertyEvent ( ossimPropertyEvent event)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 1960 of file ossimImageRenderer.cpp.

References checkIVT(), and initialize().

1961 {
1962  checkIVT();
1963  initialize();
1964 }
void checkIVT()
this is called on a property event and on input connection changes.

◆ recursiveResample()

void ossimImageRenderer::recursiveResample ( ossimRefPtr< ossimImageData outputData,
const ossimRendererSubRectInfo rectInfo,
ossim_uint32  level 
)
private

Definition at line 1250 of file ossimImageRenderer.cpp.

References fillTile(), ossimImageRenderer::ossimRendererSubRectInfo::getViewRect(), ossimIrect::height(), ossimImageRenderer::ossimRendererSubRectInfo::imageHasNans(), ossimImageRenderer::ossimRendererSubRectInfo::imageIsNan(), ossimPolyArea2d::intersects(), m_viewArea, ossimImageRenderer::ossimRendererSubRectInfo::splitView(), and ossimIrect::width().

1253 {
1254  // Removed recursion and just use the std::stack.
1255  //
1256  std::stack<ossimRendererSubRectInfo> rectStack;
1257  rectStack.push(rectInfo);
1258 
1259  while(!rectStack.empty())
1260  {
1261  ossimRendererSubRectInfo currentRectInfo = rectStack.top();
1262  ossimIrect tempViewRect = currentRectInfo.getViewRect();
1263  rectStack.pop();
1264  if(m_viewArea.intersects(tempViewRect))
1265  {
1266  if(tempViewRect.width() <2 ||
1267  tempViewRect.height() <2)
1268  {
1269  if(!currentRectInfo.imageHasNans())
1270  {
1271  fillTile(outputData,
1272  currentRectInfo);
1273  }
1274  }
1275  else
1276  {
1277  ossim_uint32 idx = 0;
1278  std::vector<ossimRendererSubRectInfo> splitRects;
1279  currentRectInfo.splitView(splitRects);
1280  if(!splitRects.empty())
1281  {
1282  for(idx = 0; idx < splitRects.size();++idx)
1283  {
1284  if(m_viewArea.intersects(splitRects[idx].getViewRect()))
1285  {
1286  rectStack.push(splitRects[idx]);
1287  }
1288  // recursiveResample(outputData,
1289  // splitRects[idx],
1290  // level + 1);
1291  }
1292  }
1293  else
1294  {
1295  if(!currentRectInfo.imageHasNans())
1296  {
1297  fillTile(outputData,
1298  currentRectInfo);
1299  }
1300  }
1301  }
1302 
1303  }
1304  }
1305  #if 0
1306  ossimIrect tempViewRect = rectInfo.getViewRect();
1307  if(rectInfo.imageIsNan())
1308  {
1309  return;
1310  }
1311 
1312  if(tempViewRect.width() <2 ||
1313  tempViewRect.height() <2)
1314  {
1315  if(!rectInfo.imageHasNans())
1316  {
1317  fillTile(outputData,
1318  rectInfo);
1319  }
1320  return;
1321  }
1322  //
1323  std::vector<ossimRendererSubRectInfo> splitRects;
1324  rectInfo.splitView(splitRects);
1325 
1326 //std::cout << "SHOULD BE SPLITTING: " << splitRects.size() <<"\n";
1327  ossim_uint32 idx = 0;
1328  if(!splitRects.empty())
1329  {
1330  // std::cout << "SPLITTING " << level << ", " << tempViewRect << "\n";
1331  for(idx = 0; idx < splitRects.size();++idx)
1332  {
1333  recursiveResample(outputData,
1334  splitRects[idx],
1335  level + 1);
1336  }
1337  }
1338  else if(!rectInfo.imageHasNans())
1339  {
1340  fillTile(outputData,
1341  rectInfo);
1342  }
1343  #endif
1344 }
ossim_uint32 height() const
Definition: ossimIrect.h:487
ossimPolyArea2d m_viewArea
bool intersects(const ossimPolyArea2d &rhs) const
void recursiveResample(ossimRefPtr< ossimImageData > outputData, const ossimRendererSubRectInfo &rectInfo, ossim_uint32 level)
unsigned int ossim_uint32
ossim_uint32 width() const
Definition: ossimIrect.h:500
void fillTile(ossimRefPtr< ossimImageData > outputData, const ossimRendererSubRectInfo &rectInfo)

◆ refreshEvent()

void ossimImageRenderer::refreshEvent ( ossimRefreshEvent event)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 2525 of file ossimImageRenderer.cpp.

References ossimRefPtr< T >::get(), ossimImageSource::getImageGeometry(), ossimEvent::getObject(), ossimRefreshEvent::getRefreshType(), ossimImageSourceFilter::initialize(), initialize(), m_ImageViewTransform, ossimRefreshEvent::REFRESH_GEOMETRY, ossimImageSourceFilter::refreshEvent(), ossimImageViewProjectionTransform::setImageGeometry(), and ossimImageSourceFilter::theInputConnection.

2526 {
2528  ossimImageSourceFilter::initialize(); // init connections
2529  if((event.getObject()!=this)&&
2531  {
2534  if(inputGeom)
2535  {
2538  if(ivpt)
2539  {
2540  ivpt->setImageGeometry(inputGeom.get());
2541  }
2542  }
2543  }
2544  initialize();
2545 }
const ossimObject * getObject() const
This is the originating object that originally produced the event.
Definition: ossimEvent.cpp:64
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual void refreshEvent(ossimRefreshEvent &event)
RefreshType getRefreshType() const
void setImageGeometry(ossimImageGeometry *g)
Assigns the geometry to use for input image. This object does NOT own the geometry.

◆ resampleTileToDecimation()

template<class T >
void ossimImageRenderer::resampleTileToDecimation ( dummyVariable,
ossimRefPtr< ossimImageData result,
ossimRefPtr< ossimImageData tile,
ossim_uint32  multiplier 
)
private

Definition at line 2374 of file ossimImageRenderer.cpp.

References ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getNumberOfBands(), ossimImageData::getOrigin(), ossimImageData::getWidth(), min, OSSIM_EMPTY, OSSIM_FULL, ossimIpt::x, and ossimIpt::y.

Referenced by getTileAtResLevel().

2378 {
2379  if(tile->getDataObjectStatus() == OSSIM_EMPTY ||
2380  !tile->getBuf())
2381  {
2382  return;
2383  }
2384 
2385  ossim_int32 maxX = (ossim_int32)tile->getWidth();
2386  ossim_int32 maxY = (ossim_int32)tile->getHeight();
2387  ossim_int32 resultHeight = result->getHeight();
2388  ossim_int32* offsetX = new ossim_int32[maxX];
2389  ossim_int32* offsetY = new ossim_int32[maxY];
2390  ossim_int32 i = 0;
2391  ossim_int32 resultWidth = (ossim_int32)result->getWidth();
2392  ossimIpt tileOrigin = tile->getOrigin();
2393  ossimIpt resultOrigin = result->getOrigin();
2394 
2395  // create a lookup table. that maps the tile to the result
2396  for(i = 0; i < maxX; ++i)
2397  {
2398  offsetX[i] = (i+tileOrigin.x)/(ossim_int32)multiplier - resultOrigin.x;
2399  if(offsetX[i] < 0 )
2400  {
2401  offsetX[i] = 0;
2402  }
2403  else if(offsetX[i] >= resultWidth)
2404  {
2405  offsetX[i] = resultWidth-1;
2406  }
2407  }
2408  for(i = 0; i < maxY; ++i)
2409  {
2410  offsetY[i] = ( ((i+tileOrigin.y)/(ossim_int32)multiplier) - resultOrigin.y);
2411  if(offsetY[i] < 0 )
2412  {
2413  offsetY[i] = 0;
2414  }
2415  else if(offsetY[i] >= resultHeight)
2416  {
2417  offsetY[i] = resultHeight-1;
2418  }
2419  offsetY[i] *= resultWidth;
2420  }
2421 
2422  if(tile->getDataObjectStatus() == OSSIM_FULL)
2423  {
2424  ossim_int32 numberOfBands = (ossim_int32)std::min(result->getNumberOfBands(),
2425  tile->getNumberOfBands());
2426  ossim_int32 band = 0;
2427  for(band = 0; band < numberOfBands; ++band)
2428  {
2429  T* tileBuf = static_cast<T*>(tile->getBuf(band));
2430  T* resultBuf = static_cast<T*>(result->getBuf(band));
2431  ossim_int32 dx = 0;
2432  ossim_int32 dy = 0;
2433  ossim_int32 boxAverageX = 0;
2434  ossim_int32 boxAverageY = 0;
2435  for(dy = 0; dy < maxY; dy+=multiplier)
2436  {
2437  for(dx = 0; dx < maxX; dx+=multiplier)
2438  {
2439  double sum = 0.0;
2440  for(boxAverageY = 0;
2441  ((boxAverageY < (ossim_int32)multiplier)&&
2442  ((boxAverageY+dy)<maxY)); ++boxAverageY)
2443  {
2444  for(boxAverageX = 0;
2445  ((boxAverageX < (ossim_int32)multiplier)&&
2446  ((boxAverageX+dx)<maxX)); ++boxAverageX)
2447  {
2448  sum += tileBuf[((boxAverageY+dy)*maxX + boxAverageX + dx)];
2449  }
2450  }
2451  sum /= (double)(multiplier*multiplier);
2452  resultBuf[ offsetX[dx] + offsetY[dy] ] = (T)sum;
2453  }
2454  }
2455  }
2456  }
2457  else
2458  {
2459  ossim_int32 numberOfBands = (ossim_int32)std::min(result->getNumberOfBands(),
2460  tile->getNumberOfBands());
2461  ossim_int32 band = 0;
2462  for(band = 0; band < numberOfBands; ++band)
2463  {
2464  T* tileBuf = static_cast<T*>(tile->getBuf(band));
2465  T* resultBuf = static_cast<T*>(result->getBuf(band));
2466  T tileBufNp = static_cast<T>(tile->getNullPix(band));
2467  ossim_int32 dx = 0;
2468  ossim_int32 dy = 0;
2469  ossim_int32 boxAverageX = 0;
2470  ossim_int32 boxAverageY = 0;
2471  for(dy = 0; dy < maxY; dy+=multiplier)
2472  {
2473  for(dx = 0; dx < maxX; dx+=multiplier)
2474  {
2475  double sum = 0.0;
2476  if(tileBuf[((dy+(multiplier>>1))*maxX + dx+(multiplier>>1))] != tileBufNp)
2477  {
2478  ossim_uint32 nullCount = 0;
2479  for(boxAverageY = 0;
2480  ((boxAverageY < (ossim_int32)multiplier)&&
2481  ((boxAverageY+dy)<maxY)); ++boxAverageY)
2482  {
2483  for(boxAverageX = 0;
2484  ((boxAverageX < (ossim_int32)multiplier)&&
2485  ((boxAverageX+dx)<maxX)); ++boxAverageX)
2486  {
2487  T value = tileBuf[((boxAverageY+dy)*maxX + boxAverageX + dx)];
2488  if(value != tileBufNp)
2489  {
2490  sum += value;
2491  }
2492  else
2493  {
2494  ++nullCount;
2495  }
2496  }
2497  }
2498  ossim_uint32 area = multiplier*multiplier;
2499  sum /= (double)(area);
2500  if(nullCount!= area)
2501  {
2502  resultBuf[ offsetX[dx] + offsetY[dy] ] = (T)sum;
2503  }
2504  }
2505  }
2506  }
2507  }
2508 
2509  }
2510 
2511  delete [] offsetX;
2512  delete [] offsetY;
2513 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
virtual const ossimIpt & getOrigin() const
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32

◆ saveState()

bool ossimImageRenderer::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 ossimImageSourceFilter.

Definition at line 1777 of file ossimImageRenderer.cpp.

References ossimKeywordlist::add(), ossimString::c_str(), m_ImageViewTransform, m_MaxLevelsToCompute, m_Resampler, ossimFilterResampler::saveState(), ossimImageViewTransform::saveState(), ossimImageSource::saveState(), and ossimRefPtr< T >::valid().

1779 {
1781  {
1782  ossimString newPrefix = ossimString(prefix) + ossimString("image_view_trans.");
1783 
1784  m_ImageViewTransform->saveState(kwl, newPrefix.c_str());
1785  }
1786  if(m_Resampler)
1787  {
1788  m_Resampler->saveState(kwl,
1789  (ossimString(prefix)+"resampler.").c_str());
1790  }
1791  kwl.add(prefix,
1792  "max_levels_to_compute",
1794 
1795  return ossimImageSource::saveState(kwl, prefix);
1796 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
bool valid() const
Definition: ossimRefPtr.h:75
ossimFilterResampler * m_Resampler
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossim_uint32 m_MaxLevelsToCompute
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
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
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ setAutoUpdateInputTransformFlag()

virtual void ossimImageRenderer::setAutoUpdateInputTransformFlag ( bool  flag)
inlinevirtual

Definition at line 99 of file ossimImageRenderer.h.

◆ setEnableFlag()

void ossimImageRenderer::setEnableFlag ( bool  flag)
virtual

Sets the enable flag.

Parameters
flagTrue to enable, false to disable.

Overrides ossimSource::setEnableFlag so bounding rects are recomputed on state change.

Reimplemented from ossimSource.

Definition at line 2563 of file ossimImageRenderer.cpp.

References checkIVT(), ossimSource::getEnableFlag(), initialize(), and ossimSource::setEnableFlag().

Referenced by disableSource(), and enableSource().

2564 {
2565  if ( getEnableFlag() != flag )
2566  {
2568  checkIVT();
2569  initialize();
2570  }
2571 }
void checkIVT()
this is called on a property event and on input connection changes.
virtual bool getEnableFlag() const
Definition: ossimSource.cpp:94
virtual void setEnableFlag(bool flag)
Definition: ossimSource.cpp:99

◆ setImageViewTransform()

void ossimImageRenderer::setImageViewTransform ( ossimImageViewTransform transform)

Definition at line 1836 of file ossimImageRenderer.cpp.

References checkIVT(), initializeBoundingRects(), ossimSource::isSourceEnabled(), ossimImageViewTransform::isValid(), m_ImageViewTransform, m_rectsDirty, and ossimRefPtr< T >::valid().

Referenced by ATP::AtpGenerator::constructChain(), ossimKakaduJpipHandler::getTile(), and ossimEquationUtil::initInputSources().

1837 {
1838  m_ImageViewTransform = ivt;
1839 
1840  m_rectsDirty = true; // Want to recompute bounding rects.
1841 
1843  {
1844  checkIVT(); // This can initialize bounding rects and clear dirty flag.
1845  }
1846 
1847  if ( m_rectsDirty )
1848  {
1850  }
1851 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
bool valid() const
Definition: ossimRefPtr.h:75
void checkIVT()
this is called on a property event and on input connection changes.
void initializeBoundingRects()
Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform
virtual bool isValid() const =0

◆ setMaxLevelsToCompute()

void ossimImageRenderer::setMaxLevelsToCompute ( ossim_uint32  maxLevels)

Definition at line 2363 of file ossimImageRenderer.cpp.

References m_MaxLevelsToCompute.

2364 {
2365  m_MaxLevelsToCompute = maxLevels;
2366 }
ossim_uint32 m_MaxLevelsToCompute

◆ setProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 1966 of file ossimImageRenderer.cpp.

References m_Resampler, ossimFilterResampler::setFilterType(), ossimImageSourceFilter::setProperty(), and ossimProperty::valueToString().

Referenced by ATP::AtpGenerator::constructChain().

1967 {
1968  ossimString tempName = property->getName();
1969 
1970  if((tempName == "Filter type")||
1971  (tempName == "filter_type"))
1972  {
1973  if(m_Resampler)
1974  {
1975  m_Resampler->setFilterType(property->valueToString());
1976  }
1977  }
1978  // else if(tempName == "Blur factor")
1979  // {
1980  // if(m_Resampler)
1981  // {
1982  // m_Resampler->setBlurFactor(property->valueToString().toDouble());
1983  // }
1984  // }
1985  else
1986  {
1988  }
1989 }
virtual void valueToString(ossimString &valueResult) const =0
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setFilterType(ossimFilterResamplerType filterType)
ossimFilterResampler * m_Resampler

◆ setView()

bool ossimImageRenderer::setView ( ossimObject baseObject)
virtual

The derived classes should overrid this method and return true or false whether it was able to cast the past in view to a view that it can interface to. So if you are a projective view you might cast to an ossimProjection. The ownsTheView specifies whether or not it owns the passed in view pointer. This will specifiy whether or not the derived classes need to re-allocate the pointer or just delete its old pointer and set it to the passed in pointer.

Implements ossimViewInterface.

Definition at line 1853 of file ossimImageRenderer.cpp.

References initializeBoundingRects(), m_ImageViewTransform, ossimViewInterface::setView(), and ossimRefPtr< T >::valid().

Referenced by main(), and ossimChipProcTool::propagateGeometryToChains().

1854 {
1855  bool new_view_set = false;
1857  {
1858  new_view_set = m_ImageViewTransform->setView(baseObject);
1859 
1860  // If view changes reset the bounding rects.
1862  }
1863  return new_view_set;
1864 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool setView(ossimObject *baseObject)=0
void initializeBoundingRects()
Initializes m_inputR0Rect and m_viewBoundingRect and sets m_rectsDirty appropriately.
ossimRefPtr< ossimImageViewTransform > m_ImageViewTransform

◆ stretchQuadOut()

void ossimImageRenderer::stretchQuadOut ( const ossimDpt amount,
ossimDpt ul,
ossimDpt ur,
ossimDpt lr,
ossimDpt ll 
)
private

Definition at line 2172 of file ossimImageRenderer.cpp.

References ossimDpt::length(), ossimDpt::x, and ossimDpt::y.

2177 {
2178  ossimDpt upper = ur - ul;
2179  ossimDpt right = lr - ur;
2180  ossimDpt bottom = ll - lr;
2181  ossimDpt left = ul - ll;
2182 
2183  upper = (upper*(1.0 / upper.length()));
2184  upper.x *= amount.x;
2185  upper.y *= amount.y;
2186  right = (right*(1.0 / right.length()));
2187  right.x *= amount.x;
2188  right.y *= amount.y;
2189  bottom = (bottom*(1.0 / bottom.length()));
2190  bottom.x *= amount.x;
2191  bottom.y *= amount.y;
2192  left = (left*(1.0 / left.length()));
2193  left.x *= amount.x;
2194  left.y *= amount.y;
2195 
2196 
2197  ul = ul - upper + left;
2198  ur = ur + upper - right;
2199  lr = lr + left - bottom;
2200  ll = ll - left + bottom;
2201 }
double y
Definition: ossimDpt.h:165
double length() const
Definition: ossimDpt.h:81
double x
Definition: ossimDpt.h:164

Member Data Documentation

◆ m_AutoUpdateInputTransform

bool ossimImageRenderer::m_AutoUpdateInputTransform
private

Definition at line 336 of file ossimImageRenderer.h.

◆ m_BlankTile

ossimRefPtr<ossimImageData> ossimImageRenderer::m_BlankTile
private

Definition at line 315 of file ossimImageRenderer.h.

Referenced by allocate(), deallocate(), and getTileAtResLevel().

◆ m_crossesDateline

bool ossimImageRenderer::m_crossesDateline
private

Definition at line 340 of file ossimImageRenderer.h.

◆ m_ImageViewTransform

ossimRefPtr<ossimImageViewTransform> ossimImageRenderer::m_ImageViewTransform
private

◆ m_inputR0Rect

ossimIrect ossimImageRenderer::m_inputR0Rect
private

Definition at line 331 of file ossimImageRenderer.h.

Referenced by fillTile(), and initializeBoundingRects().

◆ m_MaxLevelsToCompute

ossim_uint32 ossimImageRenderer::m_MaxLevelsToCompute
private

◆ m_MaxRecursionLevel

ossim_uint32 ossimImageRenderer::m_MaxRecursionLevel
private

Definition at line 335 of file ossimImageRenderer.h.

◆ m_rectsDirty

bool ossimImageRenderer::m_rectsDirty
private

◆ m_Resampler

ossimFilterResampler* ossimImageRenderer::m_Resampler
private

◆ m_StartingResLevel

ossim_uint32 ossimImageRenderer::m_StartingResLevel
private

This is going to allow us to chain multiple renderers together.

So if we have one renderer doing a scale and they pass an r-level down and we have another renderer within the chain he will be starting at a different r-level. The default will be r-level 0 request coming from the right.

Definition at line 328 of file ossimImageRenderer.h.

Referenced by fillTile().

◆ m_TemporaryBuffer

ossimRefPtr<ossimImageData> ossimImageRenderer::m_TemporaryBuffer
private

Definition at line 317 of file ossimImageRenderer.h.

Referenced by deallocate(), and getTileAtResLevel().

◆ m_Tile

ossimRefPtr<ossimImageData> ossimImageRenderer::m_Tile
private

Definition at line 316 of file ossimImageRenderer.h.

Referenced by allocate(), and deallocate().

◆ m_viewArea

ossimPolyArea2d ossimImageRenderer::m_viewArea
private

Definition at line 339 of file ossimImageRenderer.h.

Referenced by initializeBoundingRects(), and recursiveResample().

◆ m_viewRect

ossimIrect ossimImageRenderer::m_viewRect
private

Definition at line 332 of file ossimImageRenderer.h.

Referenced by getBoundingRect(), and initializeBoundingRects().


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