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

#include <ossimRectangleCutFilter.h>

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

Public Types

enum  ossimRectangleCutType { OSSIM_RECTANGLE_NULL_INSIDE = 0, OSSIM_RECTANGLE_NULL_OUTSIDE = 1 }
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Public Member Functions

 ossimRectangleCutFilter (ossimObject *owner, ossimImageSource *inputSource=NULL)
 
 ossimRectangleCutFilter (ossimImageSource *inputSource=NULL)
 
void setRectangle (const ossimIrect &rect)
 
const ossimIrectgetRectangle () const
 
ossimRectangleCutType getCutType () const
 
void setCutType (ossimRectangleCutType cutType)
 
ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 This will return the bounding rect of the source. More...
 
virtual void getValidImageVertices (vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 
ossimRefPtr< ossimImageDatagetTile (const ossimIrect &rect, ossim_uint32 resLevel=0)
 
virtual void initialize ()
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=NULL) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=NULL)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
- Public Member Functions inherited from ossimImageSourceFilter
 ossimImageSourceFilter (ossimObject *owner=NULL)
 
 ossimImageSourceFilter (ossimImageSource *inputSource)
 
 ossimImageSourceFilter (ossimObject *owner, ossimImageSource *inputSource)
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 
virtual ossim_uint32 getNumberOfInputBands () const
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void refreshEvent (ossimRefreshEvent &event)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual 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 getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Returns the min pixel of the band. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () 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
 

Protected Attributes

ossimIrect theRectangle
 
ossimRectangleCutType theCutType
 
vector< ossimDpttheDecimationList
 
- 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
 

Additional Inherited Members

- 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)
 

Detailed Description

Definition at line 16 of file ossimRectangleCutFilter.h.

Member Enumeration Documentation

◆ ossimRectangleCutType

Enumerator
OSSIM_RECTANGLE_NULL_INSIDE 
OSSIM_RECTANGLE_NULL_OUTSIDE 

Definition at line 19 of file ossimRectangleCutFilter.h.

Constructor & Destructor Documentation

◆ ossimRectangleCutFilter() [1/2]

ossimRectangleCutFilter::ossimRectangleCutFilter ( ossimObject owner,
ossimImageSource inputSource = NULL 
)

◆ ossimRectangleCutFilter() [2/2]

ossimRectangleCutFilter::ossimRectangleCutFilter ( ossimImageSource inputSource = NULL)

Member Function Documentation

◆ getBoundingRect()

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

This will return the bounding rect of the source.

We can have several sources which are in a chain to modify the bounding image rect. lets say you are next to an image handler then it will return the bounding rect for that image. If you are at the right side of a resampler then you will get a bounding rect along the image view plane. This is going to be a very import method for both image writers, mosaics or anything that needs to operate only within the bounds of an image.

Reimplemented from ossimImageSource.

Definition at line 171 of file ossimRectangleCutFilter.cpp.

Referenced by getValidImageVertices().

172 {
173  if(traceDebug())
174  {
175  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRectangleCutFilter::getBoundingRect DEBUG: entered..." << std::endl;
176  }
177  ossimIrect result;
178 
179  result.makeNan();
180  if(!theInputConnection)
181  {
182  if(traceDebug())
183  {
184  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRectangleCutFilter::getBoundingRect DEBUG: Input connection was not valid so leaving" << std::endl;
185  }
186  return result;
187  }
188 
189  result = theInputConnection->getBoundingRect(resLevel);
190  if(isSourceEnabled())
191  {
193  {
194  ossimDpt decimation;
195  getDecimationFactor(resLevel, decimation);
196  ossimIrect cutRect = theRectangle;
197  if(!decimation.hasNans())
198  {
199  cutRect = theRectangle*decimation;
200  }
201  result = cutRect;
202  }
203  }
204 
205  if(traceDebug())
206  {
207  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRectangleCutFilter::getBoundingRect DEBUG: cut rect = " << result << std::endl;
208  }
209  return result;
210 }
ossimRectangleCutType theCutType
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
bool hasNans() const
Definition: ossimDpt.h:67
void makeNan()
Definition: ossimIrect.h:329
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getCutType()

ossimRectangleCutFilter::ossimRectangleCutType ossimRectangleCutFilter::getCutType ( ) const

Definition at line 298 of file ossimRectangleCutFilter.cpp.

References theCutType.

299 {
300  return theCutType;
301 }
ossimRectangleCutType theCutType

◆ getRectangle()

const ossimIrect & ossimRectangleCutFilter::getRectangle ( ) const

Definition at line 293 of file ossimRectangleCutFilter.cpp.

References theRectangle.

294 {
295  return theRectangle;
296 }

◆ getTile()

ossimRefPtr< ossimImageData > ossimRectangleCutFilter::getTile ( const ossimIrect rect,
ossim_uint32  resLevel = 0 
)
virtual
Returns
the requested region of interest

Reimplemented from ossimImageSource.

Definition at line 41 of file ossimRectangleCutFilter.cpp.

References ossimIrect::completely_within(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getImageRectangle(), ossimImageSource::getTile(), ossimImageData::getWidth(), ossimIrect::hasNans(), ossimIrect::intersects(), ossimSource::isSourceEnabled(), min, OSSIM_EMPTY, OSSIM_NULL, OSSIM_RECTANGLE_NULL_INSIDE, OSSIM_RECTANGLE_NULL_OUTSIDE, ossimImageData::setNull(), theCutType, theDecimationList, ossimImageSourceFilter::theInputConnection, theRectangle, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, x, ossimIpt::y, and y.

44 {
46 
47  if ( theInputConnection && isSourceEnabled() && ( theRectangle.hasNans() == false ) )
48  {
49  ossim_int32 decimationIndex = min((ossim_int32)resLevel,
50  (ossim_int32)theDecimationList.size()-1);
51 
52  // Compute cut rect for resLevel:
53  ossimIrect cutRect = theRectangle*theDecimationList[decimationIndex];
54 
55  // Check intersection of our cut rect:
56  bool requestIntersects = rect.intersects( cutRect );
57  bool requestCompletelyWithin = rect.completely_within(cutRect);
58 
59  if ( ( ( theCutType == OSSIM_RECTANGLE_NULL_OUTSIDE ) && requestIntersects ) ||
60  ( ( theCutType == OSSIM_RECTANGLE_NULL_INSIDE ) && !requestCompletelyWithin ) )
61  {
62  // Grab tile from the input.
63  tile = theInputConnection->getTile(rect, resLevel);
64 
65  if ( tile.valid() )
66  {
67  if ( tile->getDataObjectStatus() != OSSIM_NULL &&
68  tile->getDataObjectStatus() != OSSIM_EMPTY )
69  {
70  ossimIrect inputRectangle = tile->getImageRectangle();
71 
72  if( theCutType == OSSIM_RECTANGLE_NULL_OUTSIDE ) // Typical case...
73  {
74  if ( !requestCompletelyWithin )
75  {
76  // Clip the tile:
77  ossim_int32 ulx = inputRectangle.ul().x;
78  ossim_int32 uly = inputRectangle.ul().y;
79  ossim_int32 w = tile->getWidth();
80  ossim_int32 h = tile->getHeight();
81  ossim_int32 offset = 0;
82  ossimIpt tempPoint(ulx, uly);
83 
84  for(ossim_int32 y = 0; y < h; ++tempPoint.y,++y)
85  {
86  tempPoint.x = ulx;
87  for(ossim_int32 x = 0; x < w; ++tempPoint.x,++x)
88  {
89  if(!cutRect.pointWithin(tempPoint))
90  {
91  tile->setNull(offset);
92  }
93  ++offset;
94  }
95  }
96  tile->validate();
97  }
98  }
99  else // Null inside...
100  {
101  // Note if complete within requested rect this block was bypassed entirely.
102  ossim_int32 ulx = inputRectangle.ul().x;
103  ossim_int32 uly = inputRectangle.ul().y;
104  ossim_int32 w = tile->getWidth();
105  ossim_int32 h = tile->getHeight();
106  ossim_int32 offset = 0;
107  ossimIpt tempPoint(ulx, uly);
108 
109  for(ossim_int32 y = 0; y < h; ++tempPoint.y,++y)
110  {
111  tempPoint.x = ulx;
112  for(ossim_int32 x = 0; x < w; ++tempPoint.x,++x)
113  {
114  if(cutRect.pointWithin(tempPoint))
115  {
116  tile->setNull(offset);
117  }
118  ++offset;
119  }
120  }
121  tile->validate();
122  }
123 
124  } // Matches: if ( tile->getDataObjectStatus() ...
125 
126  } // Matches: if ( tile.valid() )
127 
128  } // Matches: if ( ( ( theCutType == OSSI ...
129 
130  } // Matches: if ( theInputConnection && enabled && ...
131 
132  return tile;
133 } // End: ossimRectangleCutFilter::getTile( ... )
ossimRectangleCutType theCutType
vector< ossimDpt > theDecimationList
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
bool completely_within(const ossimIrect &rect) const
Definition: ossimIrect.cpp:425
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
virtual ossimIrect getImageRectangle() const
void setNull(ossim_uint32 offset)
ossim_int32 y
Definition: ossimIpt.h:142
bool hasNans() const
Definition: ossimIrect.h:337
ossim_int32 x
Definition: ossimIpt.h:141
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getValidImageVertices()

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

Definition at line 148 of file ossimRectangleCutFilter.cpp.

References getBoundingRect(), ossimIrect::ll(), ossimIrect::lr(), OSSIM_CLOCKWISE_ORDER, ossimIrect::ul(), and ossimIrect::ur().

152 {
153  ossimIrect rect = getBoundingRect();
154 
155  if(ordering == OSSIM_CLOCKWISE_ORDER)
156  {
157  validVertices.push_back(rect.ul());
158  validVertices.push_back(rect.ur());
159  validVertices.push_back(rect.lr());
160  validVertices.push_back(rect.ll());
161  }
162  else
163  {
164  validVertices.push_back(rect.ul());
165  validVertices.push_back(rect.ll());
166  validVertices.push_back(rect.lr());
167  validVertices.push_back(rect.ur());
168  }
169 }
ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
const ossimIpt & ul() const
Definition: ossimIrect.h:274
const ossimIpt & ll() const
Definition: ossimIrect.h:277
const ossimIpt & lr() const
Definition: ossimIrect.h:276
const ossimIpt & ur() const
Definition: ossimIrect.h:275

◆ initialize()

void ossimRectangleCutFilter::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Reimplemented in ossimEastingNorthingCutter.

Definition at line 212 of file ossimRectangleCutFilter.cpp.

References ossimImageSource::getDecimationFactors(), ossimIrect::hasNans(), setRectangle(), theDecimationList, ossimImageSourceFilter::theInputConnection, and theRectangle.

Referenced by ossimEastingNorthingCutter::initialize().

213 {
214  theDecimationList.clear();
216  {
218  }
219  if(theDecimationList.empty())
220  {
221  theDecimationList.push_back(ossimDpt(1,1));
222  }
223  if(theRectangle.hasNans())
224  {
226  }
227 }
void setRectangle(const ossimIrect &rect)
vector< ossimDpt > theDecimationList
ossimImageSource * theInputConnection
bool hasNans() const
Definition: ossimIrect.h:337
virtual void getDecimationFactors(std::vector< ossimDpt > &decimations) const
Will return an array of all decimations for each resolution level.

◆ loadState()

bool ossimRectangleCutFilter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = NULL 
)
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.

Reimplemented in ossimEastingNorthingCutter.

Definition at line 255 of file ossimRectangleCutFilter.cpp.

References ossimString::c_str(), ossimString::empty(), ossimKeywordlist::find(), ossimImageSourceFilter::loadState(), ossimIrect::loadState(), OSSIM_RECTANGLE_NULL_INSIDE, OSSIM_RECTANGLE_NULL_OUTSIDE, theCutType, theRectangle, ossimString::toLong(), and ossimIrect::toRect().

257 {
258  ossimString newPrefix = prefix;
259 
260  ossimString rect = kwl.find(prefix, "rect");
261  if(!rect.empty())
262  {
263  theRectangle.toRect(rect);
264  }
265  else
266  {
267  newPrefix+="clip_rect.";
268 
269  theRectangle.loadState(kwl, newPrefix.c_str());
270  }
271 
272  const char* cutType = kwl.find(prefix, "cut_type");
273  if(cutType)
274  {
275  ossimString c = cutType;
276  if(c == "null_inside")
277  {
279  }
280  else if(c == "null_outside")
281  {
283  }
284  else
285  {
286  theCutType = static_cast<ossimRectangleCutType>(ossimString(cutType).toLong());
287  }
288  }
289 
290  return ossimImageSourceFilter::loadState(kwl, prefix);
291 }
ossimRectangleCutType theCutType
const char * find(const char *key) const
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Definition: ossimIrect.cpp:641
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
long toLong() const
toLong&#39;s deprecated, please use the toInts...
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
bool empty() const
Definition: ossimString.h:411
bool toRect(const ossimString &rectString)
expected Format: form 1: ( 30, -90, 512, 512, [LH|RH] ) -x- -y- -w- -h- -Right or left handed- ...
Definition: ossimIrect.cpp:359

◆ saveState()

bool ossimRectangleCutFilter::saveState ( ossimKeywordlist kwl,
const char *  prefix = NULL 
) 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.

Reimplemented in ossimEastingNorthingCutter.

Definition at line 229 of file ossimRectangleCutFilter.cpp.

References ossimKeywordlist::add(), OSSIM_RECTANGLE_NULL_INSIDE, OSSIM_RECTANGLE_NULL_OUTSIDE, ossimImageSourceFilter::saveState(), ossimIrect::saveState(), theCutType, and theRectangle.

Referenced by ossimEastingNorthingCutter::saveState().

231 {
232  ossimString newPrefix = prefix;
233  newPrefix+="clip_rect.";
234 
235  theRectangle.saveState(kwl, newPrefix);
236 
238  {
239  kwl.add(prefix,
240  "cut_type",
241  "null_inside",
242  true);
243  }
245  {
246  kwl.add(prefix,
247  "cut_type",
248  "null_outside",
249  true);
250  }
251 
252  return ossimImageSourceFilter::saveState(kwl, prefix);
253 }
ossimRectangleCutType theCutType
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimIrect.cpp:589
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.

◆ setCutType()

void ossimRectangleCutFilter::setCutType ( ossimRectangleCutType  cutType)

Definition at line 303 of file ossimRectangleCutFilter.cpp.

References theCutType.

Referenced by ossimChipProcTool::getChip().

304 {
305  theCutType = cutType;
306 }
ossimRectangleCutType theCutType

◆ setRectangle()

void ossimRectangleCutFilter::setRectangle ( const ossimIrect rect)

Definition at line 135 of file ossimRectangleCutFilter.cpp.

References ossimImageSource::getBoundingRect(), ossimIrect::hasNans(), ossimImageSourceFilter::theInputConnection, and theRectangle.

Referenced by ossimChipProcTool::getChip(), initialize(), ossimIgen::outputProduct(), and ossimGpkgWriter::reInitializeCutters().

136 {
137  theRectangle = rect;
138 
139  if(theRectangle.hasNans())
140  {
142  {
144  }
145  }
146 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
ossimImageSource * theInputConnection
bool hasNans() const
Definition: ossimIrect.h:337

Member Data Documentation

◆ theCutType

ossimRectangleCutType ossimRectangleCutFilter::theCutType
protected

◆ theDecimationList

vector<ossimDpt> ossimRectangleCutFilter::theDecimationList
protected

Definition at line 53 of file ossimRectangleCutFilter.h.

Referenced by getTile(), and initialize().

◆ theRectangle

ossimIrect ossimRectangleCutFilter::theRectangle
protected

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