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

#include <ossimAnnotationSource.h>

Inheritance diagram for ossimAnnotationSource:
ossimImageSourceFilter ossimImageSource ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced ossimAnnotationMapGridSource ossimEsriShapeFileFilter ossimGdalOgrVectorAnnotation ossimGeoAnnotationSource ossimMapCompositionSource ossimVpfAnnotationSource

Public Types

typedef std::vector< ossimRefPtr< ossimAnnotationObject > > AnnotationObjectListType
 
- 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

 ossimAnnotationSource (ossimImageSource *inputSource=0)
 
virtual ~ossimAnnotationSource ()
 
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 ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual void initialize ()
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 
virtual void setNumberOfBands (ossim_uint32 bands)
 
virtual bool addObject (ossimAnnotationObject *anObject)
 
virtual bool deleteObject (ossimAnnotationObject *anObject)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual void computeBoundingRect ()
 
AnnotationObjectListType pickObjects (const ossimDpt &imagePoint)
 
AnnotationObjectListType pickObjects (const ossimDrect &imageRect)
 
const AnnotationObjectListTypegetObjectList () const
 
AnnotationObjectListTypegetObjectList ()
 
void deleteAll ()
 
virtual void drawAnnotations (ossimRefPtr< ossimImageData > tile)
 
- 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 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 Member Functions

void allocate (const ossimIrect &rect)
 
void destroy ()
 
 ossimAnnotationSource (const ossimAnnotationSource &rhs)
 
- 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

ossimDrect theRectangle
 
ossim_uint32 theNumberOfBands
 
ossimRefPtr< ossimRgbImagetheImage
 
ossimRefPtr< ossimImageDatatheTile
 
AnnotationObjectListType theAnnotationObjectList
 
- Protected Attributes inherited from ossimImageSourceFilter
ossimImageSourcetheInputConnection
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Detailed Description

Definition at line 33 of file ossimAnnotationSource.h.

Member Typedef Documentation

◆ AnnotationObjectListType

Definition at line 36 of file ossimAnnotationSource.h.

Constructor & Destructor Documentation

◆ ossimAnnotationSource() [1/2]

ossimAnnotationSource::ossimAnnotationSource ( ossimImageSource inputSource = 0)

◆ ~ossimAnnotationSource()

ossimAnnotationSource::~ossimAnnotationSource ( )
virtual

Definition at line 32 of file ossimAnnotationSource.cpp.

References deleteAll(), and destroy().

◆ ossimAnnotationSource() [2/2]

ossimAnnotationSource::ossimAnnotationSource ( const ossimAnnotationSource rhs)
inlineprotected

Definition at line 120 of file ossimAnnotationSource.h.

ossimImageSourceFilter(ossimObject *owner=NULL)

Member Function Documentation

◆ addObject()

bool ossimAnnotationSource::addObject ( ossimAnnotationObject anObject)
virtual

◆ allocate()

void ossimAnnotationSource::allocate ( const ossimIrect rect)
protected

Definition at line 47 of file ossimAnnotationSource.cpp.

References ossimIrect::height(), ossimImageData::initialize(), theImage, theNumberOfBands, theTile, and ossimIrect::width().

Referenced by ossimMapCompositionSource::getTile(), and getTile().

48 {
49  if (!theImage)
50  {
51  theImage = new ossimRgbImage();
52  }
53 
54  if (!theTile)
55  {
56  theTile = new ossimU8ImageData( this,
58  rect.width(),
59  rect.height() );
61  }
62 }
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual void initialize()
Initialize the data buffer.
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimRefPtr< ossimRgbImage > theImage
ossimRefPtr< ossimImageData > theTile

◆ computeBoundingRect()

void ossimAnnotationSource::computeBoundingRect ( )
virtual

Reimplemented in ossimEsriShapeFileFilter, ossimGdalOgrVectorAnnotation, ossimGeoAnnotationSource, and ossimVpfAnnotationSource.

Definition at line 316 of file ossimAnnotationSource.cpp.

References ossimDrect::combine(), ossimDrect::hasNans(), ossimDrect::makeNan(), theAnnotationObjectList, and theRectangle.

Referenced by initialize().

317 {
319 
320  if(theAnnotationObjectList.size()>0)
321  {
322  ossimDrect rect;
323  theAnnotationObjectList[0]->computeBoundingRect();
324 
325  theAnnotationObjectList[0]->getBoundingRect(theRectangle);
326 
327  AnnotationObjectListType::iterator object =
328  (theAnnotationObjectList.begin()+1);
329  while(object != theAnnotationObjectList.end())
330  {
331  (*object)->computeBoundingRect();
332  (*object)->getBoundingRect(rect);
333  if(theRectangle.hasNans())
334  {
335  theRectangle = rect;
336  }
337  else if(!rect.hasNans())
338  {
340  }
341  ++object;
342  }
343  }
344 }
void makeNan()
Definition: ossimDrect.h:388
ossimDrect combine(const ossimDrect &rect) const
Definition: ossimDrect.h:826
bool hasNans() const
Definition: ossimDrect.h:396
AnnotationObjectListType theAnnotationObjectList

◆ deleteAll()

void ossimAnnotationSource::deleteAll ( )

Clears theAnnotationObjectList vector. All elements are deleted.

Definition at line 399 of file ossimAnnotationSource.cpp.

References theAnnotationObjectList.

Referenced by ossimEsriShapeFileFilter::loadShapeFile(), ossimVpfAnnotationSource::openDatabase(), and ~ossimAnnotationSource().

400 {
401  AnnotationObjectListType::iterator obj;
402 
403  theAnnotationObjectList.clear();
404 }
AnnotationObjectListType theAnnotationObjectList

◆ deleteObject()

bool ossimAnnotationSource::deleteObject ( ossimAnnotationObject anObject)
virtual

Will delete an object from the list. Note: the passed in pointer is no long valid.

Definition at line 224 of file ossimAnnotationSource.cpp.

References theAnnotationObjectList.

225 {
226  if(anObject)
227  {
228  AnnotationObjectListType::iterator current =
229  theAnnotationObjectList.begin();
230  while(current != theAnnotationObjectList.end())
231  {
232  if(*current == anObject)
233  {
234  theAnnotationObjectList.erase(current);
235  return true;
236  }
237  ++current;
238  }
239  }
240 
241  return false;
242 }
AnnotationObjectListType theAnnotationObjectList

◆ destroy()

void ossimAnnotationSource::destroy ( )
protected

Definition at line 38 of file ossimAnnotationSource.cpp.

References theImage, and theTile.

Referenced by initialize(), setNumberOfBands(), and ~ossimAnnotationSource().

39 {
40  // theImage is an ossimRefPtr<ossimRgbImage> so this is not a leak.
41  theImage = 0;
42 
43  // theTile is an ossimRefPtr<ossimImageData> so this is not a leak.
44  theTile = 0;
45 }
ossimRefPtr< ossimRgbImage > theImage
ossimRefPtr< ossimImageData > theTile

◆ drawAnnotations()

void ossimAnnotationSource::drawAnnotations ( ossimRefPtr< ossimImageData tile)
virtual

Reimplemented in ossimMapCompositionSource, ossimEsriShapeFileFilter, ossimGdalOgrVectorAnnotation, and ossimVpfAnnotationSource.

Definition at line 406 of file ossimAnnotationSource.cpp.

References ossimRgbImage::getImageData(), ossimRgbImage::setCurrentImageData(), theAnnotationObjectList, theImage, and ossimRefPtr< T >::valid().

Referenced by ossimEsriShapeFileFilter::drawAnnotations(), ossimMapCompositionSource::drawAnnotations(), and getTile().

407 {
409 
410  if(theImage->getImageData().valid())
411  {
412  AnnotationObjectListType::iterator object =
413  theAnnotationObjectList.begin();
414  while(object != theAnnotationObjectList.end())
415  {
416  if((*object).valid())
417  {
418  (*object)->draw(*theImage);
419  }
420  ++object;
421  }
422  }
423 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > getImageData()
Will return the image data.
AnnotationObjectListType theAnnotationObjectList
ossimRefPtr< ossimRgbImage > theImage
void setCurrentImageData(ossimRefPtr< ossimImageData > &imageData)
Allows you to change the image data that this RgbImage object operates on.

◆ getBoundingRect()

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

Will return the bounding rectangle.

Reimplemented from ossimImageSource.

Reimplemented in ossimMapCompositionSource, ossimEsriShapeFileFilter, and ossimGdalOgrVectorAnnotation.

Definition at line 104 of file ossimAnnotationSource.cpp.

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

Referenced by ossimChipperUtil::addCrossHairAnnotation(), ossimVpfTileSource::getImageRectangle(), ossimVpfTileSource::getNumberOfLines(), and ossimVpfTileSource::getNumberOfSamples().

105 {
106  ossimIrect result;
107  result.makeNan();
108 
110  {
112  result = temp;
113  }
114 
115  if(result.hasNans())
116  {
117  result = theRectangle;
118  }
119  else if(!theRectangle.hasNans())
120  {
121  result.combine(theRectangle);
122  }
123 
124  return result;
125 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
ossimImageSource * theInputConnection
bool hasNans() const
Definition: ossimDrect.h:396
void makeNan()
Definition: ossimIrect.h:329
bool hasNans() const
Definition: ossimIrect.h:337
ossimIrect combine(const ossimIrect &rect) const
Definition: ossimIrect.cpp:543

◆ getNumberOfOutputBands()

ossim_uint32 ossimAnnotationSource::getNumberOfOutputBands ( ) const
virtual

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

Reimplemented from ossimImageSource.

Reimplemented in ossimMapCompositionSource.

Definition at line 73 of file ossimAnnotationSource.cpp.

References ossimImageSource::getNumberOfOutputBands(), ossimSource::isSourceEnabled(), ossimImageSourceFilter::theInputConnection, and theNumberOfBands.

Referenced by ossimVpfTileSource::getNumberOfInputBands(), ossimOgrGdalTileSource::getNumberOfInputBands(), ossimVpfTileSource::getNumberOfOutputBands(), and ossimOgrGdalTileSource::getNumberOfOutputBands().

74 {
76  {
78  }
79  return theNumberOfBands;
80 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossimImageSource * theInputConnection

◆ getObjectList() [1/2]

const ossimAnnotationSource::AnnotationObjectListType & ossimAnnotationSource::getObjectList ( ) const

Definition at line 426 of file ossimAnnotationSource.cpp.

References theAnnotationObjectList.

Referenced by operator<<().

427 {
429 }
AnnotationObjectListType theAnnotationObjectList

◆ getObjectList() [2/2]

ossimAnnotationSource::AnnotationObjectListType & ossimAnnotationSource::getObjectList ( )

Definition at line 431 of file ossimAnnotationSource.cpp.

References theAnnotationObjectList.

432 {
434 }
AnnotationObjectListType theAnnotationObjectList

◆ getOutputScalarType()

ossimScalarType ossimAnnotationSource::getOutputScalarType ( ) const
virtual

This will be used to query the output pixel type of the tile source.

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageSource.

Reimplemented in ossimMapCompositionSource.

Definition at line 64 of file ossimAnnotationSource.cpp.

References ossimImageSource::getOutputScalarType(), ossimSource::isSourceEnabled(), OSSIM_UINT8, and ossimImageSourceFilter::theInputConnection.

Referenced by ossimVpfTileSource::getOutputScalarType(), and ossimOgrGdalTileSource::getOutputScalarType().

65 {
67  {
69  }
70  return OSSIM_UINT8;
71 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
ossimImageSource * theInputConnection
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
8 bit unsigned integer

◆ getTile()

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

Reimplemented from ossimImageSource.

Reimplemented in ossimMapCompositionSource.

Definition at line 143 of file ossimAnnotationSource.cpp.

References allocate(), drawAnnotations(), ossimRefPtr< T >::get(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageSource::getTile(), ossimImageData::loadTile(), ossimImageData::makeBlank(), OSSIM_EMPTY, ossimImageData::setImageRectangleAndBands(), ossimSource::theEnableFlag, ossimImageSourceFilter::theInputConnection, theNumberOfBands, theTile, ossimRefPtr< T >::valid(), and ossimImageData::validate().

Referenced by ossimVpfTileSource::getTile(), and ossimOgrGdalTileSource::getTile().

145 {
146  ossimRefPtr<ossimImageData> inputTile = 0;
147 
148  //---
149  // NOTE:
150  // This source is written to be used with or without an input connection.
151  // So any call to inputTile should be preceeded by: if (inputTile.valid())"
152  //---
154  {
155  // Fetch tile from pointer from the input source.
156  inputTile = theInputConnection->getTile(tile_rect, resLevel);
157  }
158 
159  // Check for remap bypass:
160  if ( !theEnableFlag )
161  {
162  return inputTile;
163  }
164 
165  // Check for first time through or reallocation force by band change.
166  if ( !theTile )
167  {
168  allocate(tile_rect);
169  }
170 
171  // Allocation failed!
172  if(!theTile)
173  {
174  return inputTile;
175  }
176 
177  //---
178  // Set the image rectangle and bands. This will set the origin.
179  //
180  // NOTE: We do this before the "theTile->makeBlank()" call for efficiency
181  // since this will force a "ossimImageData::initialize()", which performs
182  // a "makeBlank" if a resize is needed due to tile rectangle or number
183  // of band changes.
184  //---
186 
187  //---
188  // Start with a blank tile.
189  //
190  // NOTE: This will not do anything if already blank.
191  //---
192  theTile->makeBlank();
193 
194  if(inputTile.valid() &&
195  inputTile->getBuf()&&
196  (inputTile->getDataObjectStatus()!=OSSIM_EMPTY))
197  {
198  //---
199  // Copy the input tile to the output tile performing scalar remap if
200  // needed.
201  //---
202  theTile->loadTile(inputTile.get());
203  }
204 
205  // Annotate the output tile.
207 
208  theTile->validate();
209 
210  return theTile;
211 }
bool theEnableFlag
Definition: ossimSource.h:62
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual ossimDataObjectStatus validate() const
virtual void setImageRectangleAndBands(const ossimIrect &rect, ossim_uint32 numberOfBands)
virtual void drawAnnotations(ossimRefPtr< ossimImageData > tile)
ossimImageSource * theInputConnection
virtual void makeBlank()
Initializes data to null pixel values.
virtual const void * getBuf() const
void allocate(const ossimIrect &rect)
ossimRefPtr< ossimImageData > theTile
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ initialize()

void ossimAnnotationSource::initialize ( )
virtual

Will allow this source to initialize its data objects. If it needs to it should call its connection to get what it needs.

Reimplemented from ossimImageSourceFilter.

Reimplemented in ossimMapCompositionSource.

Definition at line 83 of file ossimAnnotationSource.cpp.

References computeBoundingRect(), destroy(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceFilter::initialize(), setNumberOfBands(), and ossimImageSourceFilter::theInputConnection.

Referenced by ossimMapCompositionSource::initialize().

84 {
85  //---
86  // Call the base class initialize.
87  // Note: This will reset "theInputConnection" if it changed...
88  //---
90 
92  {
94 
95  // This will call destroy on band count change.
97  }
98  else
99  {
100  destroy();
101  }
102 }
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual void setNumberOfBands(ossim_uint32 bands)
ossimImageSource * theInputConnection

◆ loadState()

bool ossimAnnotationSource::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.

Reimplemented in ossimEsriShapeFileFilter, ossimMapCompositionSource, ossimGdalOgrVectorAnnotation, ossimGeoAnnotationSource, and ossimVpfAnnotationSource.

Definition at line 266 of file ossimAnnotationSource.cpp.

References addObject(), ossimString::c_str(), ossimKeywordlist::find(), ossimRefPtr< T >::get(), ossimObject::getClassName(), ossimKeywordlist::getNumberOfSubstringKeys(), ossimAnnotationObjectFactory::instance(), ossimImageSourceFilter::loadState(), ossimNotify(), ossimNotifyLevel_WARN, ossimString::toString(), and ossimRefPtr< T >::valid().

Referenced by ossimGeoAnnotationSource::loadState(), ossimGdalOgrVectorAnnotation::loadState(), and ossimEsriShapeFileFilter::loadState().

268 {
269  ossim_uint32 index = 0;
270  ossimString copyPrefix = prefix;
271  ossim_uint32 result = kwl.getNumberOfSubstringKeys(copyPrefix +
272  "object[0-9]+\\.");
273 
274  ossim_uint32 numberOfMatches = 0;
275  const ossim_uint32 MAX_INDEX = result + 100;
276 
277  while(numberOfMatches < result)
278  {
279  ossimString newPrefix = copyPrefix;
280  newPrefix += ossimString("object");
281  newPrefix += ossimString::toString(index);
282  newPrefix += ossimString(".");
283 
284  const char* lookup = kwl.find(newPrefix.c_str(), "type");
285  if (lookup)
286  {
287  ++numberOfMatches;
288 
291  create(kwl, newPrefix.c_str());
292  if (obj.valid())
293  {
294  if(!addObject(obj.get()))
295  {
297  << "ossimGeoAnnotationSource::loadState\n"
298  << "Object " << obj->getClassName()
299  << " is not a geographic object" << endl;
300  obj = 0;
301  }
302  }
303  }
304 
305  ++index;
306 
307  if (index > MAX_INDEX) // Avoid infinite loop...
308  {
309  break;
310  }
311  }
312 
313  return ossimImageSourceFilter::loadState(kwl, prefix);
314 }
ossim_uint32 getNumberOfSubstringKeys(const ossimString &regularExpression) const
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
static ossimAnnotationObjectFactory * instance()
virtual bool addObject(ossimAnnotationObject *anObject)
unsigned int ossim_uint32
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from 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
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ pickObjects() [1/2]

ossimAnnotationSource::AnnotationObjectListType ossimAnnotationSource::pickObjects ( const ossimDpt imagePoint)

Calls the isPointWithin all Annotation Objects. Note: Do not delete these objects.

Definition at line 346 of file ossimAnnotationSource.cpp.

References theAnnotationObjectList.

348 {
350  AnnotationObjectListType::iterator currentObject;
351 
352  currentObject = theAnnotationObjectList.begin();
353 
354  while(currentObject != theAnnotationObjectList.end())
355  {
356  if((*currentObject)->isPointWithin(imagePoint))
357  {
358  result.push_back(*currentObject);
359  }
360 
361  ++currentObject;
362  }
363  return result;
364 }
std::vector< ossimRefPtr< ossimAnnotationObject > > AnnotationObjectListType
AnnotationObjectListType theAnnotationObjectList

◆ pickObjects() [2/2]

ossimAnnotationSource::AnnotationObjectListType ossimAnnotationSource::pickObjects ( const ossimDrect imageRect)

Note: do not delete the objects returned.

Definition at line 366 of file ossimAnnotationSource.cpp.

References ossimAnnotationObject::isPointWithin(), ossimDrect::ll(), ossimDrect::lr(), theAnnotationObjectList, ossimDrect::ul(), and ossimDrect::ur().

368 {
370  AnnotationObjectListType::iterator currentObject;
371 
372  currentObject = theAnnotationObjectList.begin();
373 
374  while(currentObject != theAnnotationObjectList.end())
375  {
376  ossimRefPtr<ossimAnnotationObject> current = (*currentObject);
377  if(current->isPointWithin(imageRect.ul()))
378  {
379  result.push_back(*currentObject);
380  }
381  else if(current->isPointWithin(imageRect.ll()))
382  {
383  result.push_back(*currentObject);
384  }
385  else if(current->isPointWithin(imageRect.lr()))
386  {
387  result.push_back(*currentObject);
388  }
389  else if(current->isPointWithin(imageRect.ur()))
390  {
391  result.push_back(*currentObject);
392  }
393 
394  ++currentObject;
395  }
396  return result;
397 }
const ossimDpt & ul() const
Definition: ossimDrect.h:339
std::vector< ossimRefPtr< ossimAnnotationObject > > AnnotationObjectListType
AnnotationObjectListType theAnnotationObjectList
const ossimDpt & ur() const
Definition: ossimDrect.h:340
virtual bool isPointWithin(const ossimDpt &imagePoint) const
const ossimDpt & ll() const
Definition: ossimDrect.h:342
const ossimDpt & lr() const
Definition: ossimDrect.h:341

◆ saveState()

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

Saves the current state of this object.

Reimplemented from ossimImageSourceFilter.

Reimplemented in ossimEsriShapeFileFilter, ossimMapCompositionSource, ossimGdalOgrVectorAnnotation, ossimGeoAnnotationSource, and ossimVpfAnnotationSource.

Definition at line 244 of file ossimAnnotationSource.cpp.

References ossimString::c_str(), ossimImageSourceFilter::saveState(), theAnnotationObjectList, and ossimString::toString().

Referenced by ossimGeoAnnotationSource::saveState(), ossimGdalOgrVectorAnnotation::saveState(), and ossimEsriShapeFileFilter::saveState().

246 {
247  // Save the state of all annotation objects we have.
248  AnnotationObjectListType::const_iterator obj =
249  theAnnotationObjectList.begin();
250  ossim_uint32 objIdx = 0;
251  while (obj < theAnnotationObjectList.end())
252  {
253  ossimString newPrefix = prefix;
254 
255  newPrefix += (ossimString("object") +
256  ossimString::toString(objIdx) +
257  ossimString("."));
258  (*obj)->saveState(kwl, newPrefix.c_str());
259  ++objIdx;
260  ++obj;
261  }
262 
263  return ossimImageSourceFilter::saveState(kwl, prefix);
264 }
static ossimString toString(bool aValue)
Numeric to string methods.
unsigned int ossim_uint32
AnnotationObjectListType theAnnotationObjectList
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

◆ setNumberOfBands()

void ossimAnnotationSource::setNumberOfBands ( ossim_uint32  bands)
virtual
Parameters
bandsThis can be any number of bands; however, the annotator will only write to a max of 3, so if you have a 4 band image the fourth band will not be annotated.

Definition at line 127 of file ossimAnnotationSource.cpp.

References destroy(), ossimRefPtr< T >::get(), ossimImageData::getNumberOfBands(), theNumberOfBands, and theTile.

Referenced by initialize(), ossimEsriShapeFileFilter::ossimEsriShapeFileFilter(), ossimGdalOgrVectorAnnotation::ossimGdalOgrVectorAnnotation(), and ossimVpfTileSource::ossimVpfTileSource().

128 {
129  theNumberOfBands = bands;
130  if (theTile.get())
131  {
133  {
134  //---
135  // This will wide things slick and force an allocate()
136  // call on first getTile().
137  //---
138  destroy();
139  }
140  }
141 }
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > theTile

Member Data Documentation

◆ theAnnotationObjectList

AnnotationObjectListType ossimAnnotationSource::theAnnotationObjectList
protected

◆ theImage

ossimRefPtr<ossimRgbImage> ossimAnnotationSource::theImage
protected

This has all the routines we need for drawing lines, circles and polygons.

Definition at line 141 of file ossimAnnotationSource.h.

Referenced by allocate(), destroy(), ossimVpfAnnotationSource::drawAnnotations(), ossimEsriShapeFileFilter::drawAnnotations(), drawAnnotations(), and ossimMapCompositionSource::drawAnnotations().

◆ theNumberOfBands

ossim_uint32 ossimAnnotationSource::theNumberOfBands
protected

The output band can be set to 1 or 3 for grey or RGB scale. We will default this to a 1 band image.

Definition at line 135 of file ossimAnnotationSource.h.

Referenced by allocate(), getNumberOfOutputBands(), getTile(), and setNumberOfBands().

◆ theRectangle

ossimDrect ossimAnnotationSource::theRectangle
protected

What is the size of the image. This class is an image producer and it needs to know about its bounds. We will default the rectangle to an empty region.

Definition at line 128 of file ossimAnnotationSource.h.

Referenced by ossimVpfAnnotationSource::computeBoundingRect(), ossimGeoAnnotationSource::computeBoundingRect(), computeBoundingRect(), and getBoundingRect().

◆ theTile

ossimRefPtr<ossimImageData> ossimAnnotationSource::theTile
protected

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