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

#include <ossimGeoAnnotationBitmap.h>

Inheritance diagram for ossimGeoAnnotationBitmap:
ossimGeoAnnotationObject ossimAnnotationObject ossimObject ossimReferenced

Public Member Functions

 ossimGeoAnnotationBitmap (const ossimGpt &center=ossimGpt(0, 0, 0), ossimRefPtr< ossimImageData > imageData=0, unsigned char r=255, unsigned char g=255, unsigned char b=255)
 
 ossimGeoAnnotationBitmap (const ossimGeoAnnotationBitmap &rhs)
 
virtual ossimObjectdup () const
 
virtual bool intersects (const ossimDrect &rect) const
 
virtual ossimGeoAnnotationBitmapgetNewClippedObject (const ossimDrect &rect) const
 
virtual void applyScale (double x, double y)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual void draw (ossimRgbImage &anImage) const
 
virtual void getBoundingRect (ossimDrect &rect) const
 
virtual void transform (ossimImageGeometry *projection)
 
virtual void setImageData (ossimRefPtr< ossimImageData > &imageData)
 
virtual void computeBoundingRect ()
 
- Public Member Functions inherited from ossimGeoAnnotationObject
 ossimGeoAnnotationObject (unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)
 
 ossimGeoAnnotationObject (const ossimGeoAnnotationObject &rhs)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Saves the current state of this object. 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...
 
- Public Member Functions inherited from ossimAnnotationObject
virtual ~ossimAnnotationObject ()
 
 ossimAnnotationObject (ossim_uint8 r=255, ossim_uint8 g=255, ossim_uint8 b=255, ossim_uint8 thickness=1)
 
virtual void applyScale (const ossimDpt &scale)
 
virtual ossimDrect getBoundingRect () const
 
virtual void setColor (ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
 
void getColor (ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b) const
 
ossim_uint8 getThickness () const
 
virtual void setThickness (ossim_uint8 thickness)
 
virtual bool isPointWithin (const ossimDpt &imagePoint) const
 
virtual ossimString getName () const
 
virtual void setName (const ossimString &name)
 
ossim_uint32 getId () const
 
virtual ossim_uint32 setId ()
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () 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
 
virtual void accept (ossimVisitor &visitor)
 
- 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
 

Protected Member Functions

virtual ~ossimGeoAnnotationBitmap ()
 
- Protected Member Functions inherited from ossimGeoAnnotationObject
virtual ~ossimGeoAnnotationObject ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

ossimGpt theCenterPoint
 
ossimDpt theProjectedPoint
 
ossimRefPtr< ossimImageDatatheImageData
 
- Protected Attributes inherited from ossimAnnotationObject
ossim_uint8 theRed
 
ossim_uint8 theGreen
 
ossim_uint8 theBlue
 
ossim_uint8 theThickness
 
ossimString theName
 
ossim_uint32 theId
 

Additional Inherited Members

- Static Public Member Functions inherited from ossimAnnotationObject
static ossim_uint32 getNextId ()
 
static void restIdCounter ()
 
- Static Protected Attributes inherited from ossimAnnotationObject
static ossim_uint32 theIdCounter = 0
 

Detailed Description

Definition at line 16 of file ossimGeoAnnotationBitmap.h.

Constructor & Destructor Documentation

◆ ossimGeoAnnotationBitmap() [1/2]

ossimGeoAnnotationBitmap::ossimGeoAnnotationBitmap ( const ossimGpt center = ossimGpt(0, 0, 0),
ossimRefPtr< ossimImageData imageData = 0,
unsigned char  r = 255,
unsigned char  g = 255,
unsigned char  b = 255 
)

Referenced by dup().

◆ ossimGeoAnnotationBitmap() [2/2]

ossimGeoAnnotationBitmap::ossimGeoAnnotationBitmap ( const ossimGeoAnnotationBitmap rhs)

Definition at line 48 of file ossimGeoAnnotationBitmap.cpp.

50  :
55 {
56 }
ossimGeoAnnotationObject(unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)
ossimRefPtr< ossimImageData > theImageData

◆ ~ossimGeoAnnotationBitmap()

ossimGeoAnnotationBitmap::~ossimGeoAnnotationBitmap ( )
protectedvirtual

Definition at line 58 of file ossimGeoAnnotationBitmap.cpp.

59 {
60 }

Member Function Documentation

◆ applyScale()

void ossimGeoAnnotationBitmap::applyScale ( double  x,
double  y 
)
virtual

Implements ossimAnnotationObject.

Definition at line 89 of file ossimGeoAnnotationBitmap.cpp.

References ossimNotify(), and ossimNotifyLevel_WARN.

90 {
92  << "ossimGeoAnnotationBitmap::applyScale WRNING: not implemented"
93  << std::endl;
94 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ computeBoundingRect()

void ossimGeoAnnotationBitmap::computeBoundingRect ( )
virtual

Implements ossimAnnotationObject.

Definition at line 200 of file ossimGeoAnnotationBitmap.cpp.

201 {
202  // nothing to be done since we don't support
203  // rotated bitmaps yet.
204 }

◆ draw()

void ossimGeoAnnotationBitmap::draw ( ossimRgbImage anImage) const
virtual

Implements ossimAnnotationObject.

Definition at line 103 of file ossimGeoAnnotationBitmap.cpp.

References ossimIrect::clipToRect(), ossimImageData::getBuf(), ossimRgbImage::getImageData(), ossimImageData::getImageRectangle(), ossimImageData::getNumberOfBands(), ossimIrect::height(), ossimIrect::intersects(), ossimNotify(), ossimNotifyLevel_WARN, ossimAnnotationObject::theBlue, ossimAnnotationObject::theGreen, theImageData, ossimAnnotationObject::theRed, ossimIrect::ul(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

104 {
105  ossimRefPtr<ossimImageData> destination = anImage.getImageData();
106 
107  if(!destination)
108  {
110  << "ossimGeoAnnotationBitmap::draw\n"
111  << "ERROR: can't draw annotation bitmap to NULL buffer" << endl;
112 
113  return;
114  }
115  ossimIrect destinationRect = destination->getImageRectangle();
117  if(!srcRect.intersects(destinationRect))
118  {
119  return;
120  }
121  ossimIrect clipRect = srcRect.clipToRect(destinationRect);
122 
123  long clipHeight = (long)clipRect.height();
124  long clipWidth = (long)clipRect.width();
125 
126 
127  if(clipRect.width() != 1.0 &&
128  clipRect.height() != 1.0)
129  {
130  long destinationOffset = (long)(((clipRect.ul().y - destinationRect.ul().y)* destinationRect.width()) +
131  (clipRect.ul().x - destinationRect.ul().x));
132  long srcOffset = (long)(((clipRect.ul().y - srcRect.ul().y)*srcRect.width()) +
133  (clipRect.ul().x - srcRect.ul().x));
134  long destinationIndex = destinationOffset;
135  long srcIndex = srcOffset;
136  long num_bands = destination->getNumberOfBands();
137  ossim_int32 s_width = (ossim_int32)srcRect.width();
138  ossim_int32 d_width = (ossim_int32)destinationRect.width();
139 
140  num_bands = num_bands > 3? 3:num_bands;
141 
142  const ossim_uint8* imageDataBuf = static_cast<const ossim_uint8*>(theImageData->getBuf());
143  unsigned char colorArray[3];
144  colorArray[0] = theRed;
145  colorArray[1] = theGreen;
146  colorArray[2] = theBlue;
147  for (long band=0; band<num_bands; ++band)
148  {
149  ossim_uint8* destinationBand = static_cast<ossim_uint8*>(destination->getBuf(band));
150  destinationIndex = destinationOffset;
151  srcIndex = srcOffset;
152  for(long line = 0; line < clipHeight; ++line)
153  {
154  for(long col = 0; col < clipWidth; ++col)
155  {
156  if(imageDataBuf[srcIndex + col])
157  {
158  destinationBand[destinationIndex + col] = colorArray[band];
159  }
160  }
161  srcIndex += s_width;
162  destinationIndex += d_width;
163  }
164  }
165  }
166 }
virtual ossim_uint32 getNumberOfBands() const
ossim_uint32 height() const
Definition: ossimIrect.h:487
const ossimIpt & ul() const
Definition: ossimIrect.h:274
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
ossimRefPtr< ossimImageData > getImageData()
Will return the image data.
virtual ossimIrect getImageRectangle() const
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossimRefPtr< ossimImageData > theImageData
ossim_int32 x
Definition: ossimIpt.h:141
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ dup()

ossimObject * ossimGeoAnnotationBitmap::dup ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 62 of file ossimGeoAnnotationBitmap.cpp.

References ossimGeoAnnotationBitmap().

Referenced by getNewClippedObject().

63 {
64  return new ossimGeoAnnotationBitmap(*this);
65 }
ossimGeoAnnotationBitmap(const ossimGpt &center=ossimGpt(0, 0, 0), ossimRefPtr< ossimImageData > imageData=0, unsigned char r=255, unsigned char g=255, unsigned char b=255)

◆ getBoundingRect()

void ossimGeoAnnotationBitmap::getBoundingRect ( ossimDrect rect) const
virtual

Implements ossimAnnotationObject.

Definition at line 168 of file ossimGeoAnnotationBitmap.cpp.

References ossimImageData::getImageRectangle(), theImageData, and ossimRefPtr< T >::valid().

169 {
170  rect = ossimDrect(0,0,0,0);
171 
172  if(theImageData.valid())
173  {
175  }
176 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimIrect getImageRectangle() const
ossimRefPtr< ossimImageData > theImageData

◆ getNewClippedObject()

ossimGeoAnnotationBitmap * ossimGeoAnnotationBitmap::getNewClippedObject ( const ossimDrect rect) const
virtual

Will allocate a new object that is clipped to the passed. in rect. Look at derived classes to see if the object is actually clipped or not. A new object is returned if it clips to the rect else NULL should be returned it doesn't clip.

Implements ossimAnnotationObject.

Definition at line 77 of file ossimGeoAnnotationBitmap.cpp.

References dup(), ossimNotify(), and ossimNotifyLevel_WARN.

79 {
81 
83  << "ossimGeoAnnotationBitmap::getNewClippedObject WRNING: "
84  << "not implemented" << std::endl;
85 
86  return result;
87 }
virtual ossimObject * dup() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ intersects()

bool ossimGeoAnnotationBitmap::intersects ( const ossimDrect rect) const
virtual

Implements ossimAnnotationObject.

Definition at line 67 of file ossimGeoAnnotationBitmap.cpp.

References ossimImageData::getImageRectangle(), ossimIrect::intersects(), theImageData, and ossimRefPtr< T >::valid().

68 {
69  if(theImageData.valid())
70  {
72  }
73 
74  return false;
75 }
bool valid() const
Definition: ossimRefPtr.h:75
bool intersects(const ossimIrect &rect) const
Definition: ossimIrect.cpp:183
virtual ossimIrect getImageRectangle() const
ossimRefPtr< ossimImageData > theImageData

◆ print()

std::ostream & ossimGeoAnnotationBitmap::print ( std::ostream &  out) const
virtual

Generic print method.

Derived classes should re-implement as they see fit.

Returns
std::ostream&

Reimplemented from ossimAnnotationObject.

Definition at line 97 of file ossimGeoAnnotationBitmap.cpp.

References theCenterPoint.

98 {
99  out << "center: " << theCenterPoint << endl;
100  return out;
101 }

◆ setImageData()

void ossimGeoAnnotationBitmap::setImageData ( ossimRefPtr< ossimImageData > &  imageData)
virtual

Definition at line 194 of file ossimGeoAnnotationBitmap.cpp.

References theImageData.

196 {
197  theImageData = imageData;
198 }
ossimRefPtr< ossimImageData > theImageData

◆ transform()

void ossimGeoAnnotationBitmap::transform ( ossimImageGeometry projection)
virtual

Add the projection interface to all geographically defined objects.

Implements ossimGeoAnnotationObject.

Definition at line 178 of file ossimGeoAnnotationBitmap.cpp.

References ossimImageData::getHeight(), ossimImageData::getWidth(), ossimImageData::setOrigin(), theCenterPoint, theImageData, theProjectedPoint, ossimRefPtr< T >::valid(), ossimImageGeometry::worldToLocal(), ossimDpt::x, and ossimDpt::y.

179 {
180  if(projection)
181  {
184  if(theImageData.valid())
185  {
188 
189  theImageData->setOrigin(origin);
190  }
191  }
192 }
virtual ossim_uint32 getWidth() const
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
virtual ossim_uint32 getHeight() const
virtual void setOrigin(const ossimIpt &origin)
ossimRefPtr< ossimImageData > theImageData
double x
Definition: ossimDpt.h:164
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.

Member Data Documentation

◆ theCenterPoint

ossimGpt ossimGeoAnnotationBitmap::theCenterPoint
protected

Definition at line 47 of file ossimGeoAnnotationBitmap.h.

Referenced by print(), and transform().

◆ theImageData

ossimRefPtr<ossimImageData> ossimGeoAnnotationBitmap::theImageData
protected

Definition at line 49 of file ossimGeoAnnotationBitmap.h.

Referenced by draw(), getBoundingRect(), intersects(), setImageData(), and transform().

◆ theProjectedPoint

ossimDpt ossimGeoAnnotationBitmap::theProjectedPoint
protected

Definition at line 48 of file ossimGeoAnnotationBitmap.h.

Referenced by transform().


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