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

#include <ossimImageDataHelper.h>

Public Member Functions

 ossimImageDataHelper (ossimImageData *imageData=0)
 
void setImageData (ossimImageData *imageData)
 
void fill (const double *values, const ossimIrect &rect, bool clipPoly=true)
 
void fill (const double *values, std::vector< ossimPolygon > &regionList, bool clipPoly=true)
 
void fill (const ossimRgbVector &color, std::vector< ossimPolygon > &regionList, bool clipPoly=true)
 
void fill (const ossimRgbVector &color, const ossimIrect &rect, bool clipPoly=true)
 
void fill (const double *values, const ossimPolygon &region, bool clipPoly=true)
 
void fill (const ossimRgbVector &color, const ossimPolygon &region, bool clipPoly=true)
 
void copyInputToThis (const void *input, const ossimPolygon &region, bool clipPoly=true)
 

Public Attributes

ossimImageDatatheImageData
 

Protected Member Functions

template<class T >
void fill (T dummyVariable, const double *values, const ossimPolygon &region, bool clipPoly)
 
template<class T >
void fill (T dummyVariable, const double *values, const ossimIrect &region, bool clipPoly)
 
template<class T >
void copyInputToThis (const T *inputBuf, const ossimPolygon &region, bool clipPoly)
 
template<class T >
void fill (T dummyVariable, const double *values, const ossimPolygon &region)
 
template<class T >
void fill (T dummyVariable, const double *values, const ossimIrect &region)
 
template<class T >
void copyInputToThis (const T *inputBuf, const ossimPolygon &region)
 

Protected Attributes

ossimIpt theOrigin
 
ossimIrect theImageRectangle
 
ossimPolyArea2d thePolyImageRectangle
 

Detailed Description

Definition at line 17 of file ossimImageDataHelper.h.

Constructor & Destructor Documentation

◆ ossimImageDataHelper()

ossimImageDataHelper::ossimImageDataHelper ( ossimImageData imageData = 0)

This must be a valid image data object

Definition at line 18 of file ossimImageDataHelper.cpp.

References setImageData().

19 {
20  setImageData(imageData);
21 }
void setImageData(ossimImageData *imageData)

Member Function Documentation

◆ copyInputToThis() [1/3]

void ossimImageDataHelper::copyInputToThis ( const void *  input,
const ossimPolygon region,
bool  clipPoly = true 
)

The input is assumed to have the same origin, size and scalar as this object. This will implement a selection

Definition at line 39 of file ossimImageDataHelper.cpp.

References ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT32, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, and theImageData.

Referenced by copyInputToThis(), and ossimPolyCutter::getTile().

42 {
43  if(!theImageData) return;
44  switch(theImageData->getScalarType())
45  {
46  case OSSIM_UCHAR:
47  {
48  copyInputToThis(reinterpret_cast<const ossim_uint8*>(input),
49  region,
50  clipPoly);
51  break;
52  }
53  case OSSIM_USHORT16:
54  case OSSIM_USHORT11:
55  case OSSIM_USHORT12:
56  case OSSIM_USHORT13:
57  case OSSIM_USHORT14:
58  case OSSIM_USHORT15:
59  {
60  copyInputToThis(reinterpret_cast<const ossim_uint16*>(input),
61  region,
62  clipPoly);
63  break;
64  }
65  case OSSIM_SSHORT16:
66  {
67  copyInputToThis(reinterpret_cast<const ossim_sint16*>(input),
68  region,
69  clipPoly);
70  break;
71  }
72  case OSSIM_SINT32:
73  {
74  copyInputToThis(reinterpret_cast<const ossim_sint32*>(input),
75  region,
76  clipPoly);
77  break;
78  }
79  case OSSIM_FLOAT:
81  {
82  copyInputToThis(reinterpret_cast<const float*>(input),
83  region,
84  clipPoly);
85  break;
86  }
87  case OSSIM_DOUBLE:
89  {
90  copyInputToThis(reinterpret_cast<const double*>(input),
91  region,
92  clipPoly);
93  break;
94  }
96  default:
97  {
98  break;
99  }
100  }
101 }
16 bit unsigned integer (15 bits used)
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
ossimImageData * theImageData
void copyInputToThis(const void *input, const ossimPolygon &region, bool clipPoly=true)
32 bit signed integer
32 bit normalized floating point
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ copyInputToThis() [2/3]

template<class T >
void ossimImageDataHelper::copyInputToThis ( const T *  inputBuf,
const ossimPolygon region,
bool  clipPoly 
)
protected

Definition at line 343 of file ossimImageDataHelper.cpp.

References copyInputToThis(), ossimPolyArea2d::getVisiblePolygons(), and thePolyImageRectangle.

346 {
347  if(clipPoly)
348  {
349  ossimPolyArea2d polyArea(region);
350  ossimPolyArea2d clipArea = polyArea&thePolyImageRectangle;
351 
352  vector<ossimPolygon> clipList;
353  // clipArea.getAllVisiblePolygons(clipList);
354  clipArea.getVisiblePolygons(clipList);
355 
356  for(ossim_uint32 i = 0; i < clipList.size();++i)
357  {
358  copyInputToThis( inputBuf, clipList[i] );
359  }
360  }
361  else
362  {
363  copyInputToThis( inputBuf, region );
364  }
365 }
ossimPolyArea2d thePolyImageRectangle
void copyInputToThis(const void *input, const ossimPolygon &region, bool clipPoly=true)
unsigned int ossim_uint32
bool getVisiblePolygons(vector< ossimPolygon > &polyList) const

◆ copyInputToThis() [3/3]

template<class T >
void ossimImageDataHelper::copyInputToThis ( const T *  inputBuf,
const ossimPolygon region 
)
protected

Definition at line 368 of file ossimImageDataHelper.cpp.

References ossimImageData::getBuf(), ossimImageData::getHeight(), ossimPolygon::getIntegerBounds(), ossimImageData::getNumberOfBands(), ossimPolygon::getVertexCount(), ossimImageData::getWidth(), n, theImageData, theOrigin, ossimIpt::x, ossimIpt::y, and y.

370 {
371  int n;
372  int i;
373  int y;
374  ossim_int32 miny, maxy, minx, maxx;
375  int x1, y1;
376  int x2, y2;
377  int ind1, ind2;
378  // int ints;
379  vector<int> polyInts;
380  T* buf = reinterpret_cast<T*>(theImageData->getBuf());
381 
383  ossim_int32 bandOffset = 0;
384 
385  region.getIntegerBounds(minx, miny, maxx, maxy);
386  ossim_int32 rowOffset = (miny-theOrigin.y)*theImageData->getWidth();
387  n = region.getVertexCount();
388  /* Fix in 1.3: count a vertex only once */
389  for (y = miny; (y <= maxy); y++)
390  {
391  polyInts.clear();
392  // ints = 0;
393  for (i = 0; (i < n); i++)
394  {
395  if (!i)
396  {
397  ind1 = n - 1;
398  ind2 = 0;
399  }
400  else
401  {
402  ind1 = i - 1;
403  ind2 = i;
404  }
405  y1 = ossim::round<int>(region[ind1].y);
406  y2 = ossim::round<int>(region[ind2].y);
407  if (y1 < y2)
408  {
409  x1 = ossim::round<int>(region[ind1].x);
410  x2 = ossim::round<int>(region[ind2].x);
411  }
412  else if (y1 > y2)
413  {
414  y2 = ossim::round<int>(region[ind1].y);
415  y1 = ossim::round<int>(region[ind2].y);
416  x2 = ossim::round<int>(region[ind1].x);
417  x1 = ossim::round<int>(region[ind2].x);
418  }
419  else
420  {
421  continue;
422  }
423  if ((y >= y1) && (y < y2))
424  {
425  polyInts.push_back((y - y1) * (x2 - x1) / (y2 - y1) + x1);
426  }
427  else if ((y == maxy) && (y > y1) && (y <= y2))
428  {
429  polyInts.push_back((y - y1) * (x2 - x1) / (y2 - y1) + x1);
430  }
431  }
432  std::sort(polyInts.begin(), polyInts.end());
433 
434  for (i = 0; (i < (int)polyInts.size()); i += 2)
435  {
436  ossim_int32 startX = polyInts[i]-theOrigin.x;
437  ossim_int32 endX = polyInts[i+1]-theOrigin.x;
438  while(startX <= endX)
439  {
440  bandOffset = 0;
441  int band;
442  for(band = 0; band < (ossim_int32)theImageData->getNumberOfBands();++band)
443  {
444  buf[rowOffset+bandOffset+startX] = (inputBuf[rowOffset+bandOffset+startX]);
445  bandOffset += blockLength;
446  }
447  ++startX;
448  }
449  }
450  rowOffset += theImageData->getWidth();
451  }
452 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
ossim_uint32 y
virtual ossim_uint32 getHeight() const
ossimImageData * theImageData
void getIntegerBounds(ossim_int32 &minX, ossim_int32 &minY, ossim_int32 &maxX, ossim_int32 &maxY) const
ossim_uint32 getVertexCount() const
os2<< "> n<< " > nendobj n
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ fill() [1/10]

void ossimImageDataHelper::fill ( const double *  values,
const ossimIrect rect,
bool  clipPoly = true 
)

Definition at line 279 of file ossimImageDataHelper.cpp.

References ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, and theImageData.

Referenced by ossimMapCompositionSource::drawBorders(), fill(), and ossimPolyCutter::getTile().

282 {
283  switch(theImageData->getScalarType())
284  {
285  case OSSIM_UCHAR:
286  {
287  fill(static_cast<ossim_uint8>(0),
288  values,
289  region,
290  clipPoly);
291  break;
292  }
293  case OSSIM_USHORT16:
294  case OSSIM_USHORT11:
295  case OSSIM_USHORT12:
296  case OSSIM_USHORT13:
297  case OSSIM_USHORT14:
298  case OSSIM_USHORT15:
299  {
300  fill(static_cast<ossim_uint16>(0),
301  values,
302  region,
303  clipPoly);
304  break;
305  }
306  case OSSIM_SSHORT16:
307  {
308  fill(static_cast<ossim_sint16>(0),
309  values,
310  region,
311  clipPoly);
312  break;
313  }
314  case OSSIM_FLOAT:
316  {
317  fill(static_cast<float>(0),
318  values,
319  region,
320  clipPoly);
321  break;
322  }
323  case OSSIM_DOUBLE:
325  {
326  fill(static_cast<double>(0),
327  values,
328  region,
329  clipPoly);
330  break;
331  }
333  default:
334  {
335  break;
336  }
337  }
338 }
16 bit unsigned integer (15 bits used)
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
ossimImageData * theImageData
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
32 bit normalized floating point
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ fill() [2/10]

void ossimImageDataHelper::fill ( const double *  values,
std::vector< ossimPolygon > &  regionList,
bool  clipPoly = true 
)

Definition at line 118 of file ossimImageDataHelper.cpp.

References fill().

121 {
122  int i = 0;
123 
124  for(i = 0; i < (int)regionList.size();++i)
125  {
126  fill(values,
127  regionList[i],
128  clipPoly);
129  }
130 }
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)

◆ fill() [3/10]

void ossimImageDataHelper::fill ( const ossimRgbVector color,
std::vector< ossimPolygon > &  regionList,
bool  clipPoly = true 
)

Definition at line 103 of file ossimImageDataHelper.cpp.

References fill().

106 {
107  int i = 0;
108 
109  for(i = 0; i < (int)regionList.size();++i)
110  {
111  fill(color,
112  regionList[i],
113  clipPoly);
114  }
115 }
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)

◆ fill() [4/10]

void ossimImageDataHelper::fill ( const ossimRgbVector color,
const ossimIrect rect,
bool  clipPoly = true 
)

Definition at line 174 of file ossimImageDataHelper.cpp.

References fill(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageData::getNumberOfBands(), ossimRgbVector::getR(), ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, and theImageData.

177 {
178  double colorArray[3];
179 
180  colorArray[0] = color.getR();
181  colorArray[1] = color.getG();
182  colorArray[2] = color.getB();
183 
184  switch(theImageData->getScalarType())
185  {
186  case OSSIM_UCHAR:
187  {
188  if(theImageData->getNumberOfBands() <= 3)
189  {
190  fill(static_cast<ossim_uint8>(0),
191  colorArray,
192  region,
193  clipPoly);
194 
195  }
196  break;
197  }
199  case OSSIM_USHORT16:
200  case OSSIM_USHORT11:
201  case OSSIM_USHORT12:
202  case OSSIM_USHORT13:
203  case OSSIM_USHORT14:
204  case OSSIM_USHORT15:
205  case OSSIM_SSHORT16:
206  case OSSIM_FLOAT:
208  case OSSIM_DOUBLE:
210  {
211  break;
212  }
213  default:
214  break;
215  }
216 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getNumberOfBands() const
unsigned char getR() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
ossimImageData * theImageData
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
32 bit normalized floating point
unsigned char getB() const
unsigned char getG() const
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ fill() [5/10]

void ossimImageDataHelper::fill ( const double *  values,
const ossimPolygon region,
bool  clipPoly = true 
)

Values must be of the same type as the image data that we are writing to.

Definition at line 218 of file ossimImageDataHelper.cpp.

References fill(), ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, and theImageData.

221 {
222  switch(theImageData->getScalarType())
223  {
224  case OSSIM_UCHAR:
225  {
226  fill(static_cast<ossim_uint8>(0),
227  values,
228  region,
229  clipPoly);
230  break;
231  }
232  case OSSIM_USHORT16:
233  case OSSIM_USHORT11:
234  case OSSIM_USHORT12:
235  case OSSIM_USHORT13:
236  case OSSIM_USHORT14:
237  case OSSIM_USHORT15:
238  {
239  fill(static_cast<ossim_uint16>(0),
240  values,
241  region,
242  clipPoly);
243  break;
244  }
245  case OSSIM_SSHORT16:
246  {
247  fill(static_cast<ossim_sint16>(0),
248  values,
249  region,
250  clipPoly);
251  break;
252  }
253  case OSSIM_FLOAT:
255  {
256  fill(static_cast<float>(0),
257  values,
258  region,
259  clipPoly);
260  break;
261  }
262  case OSSIM_DOUBLE:
264  {
265  fill(static_cast<double>(0),
266  values,
267  region,
268  clipPoly);
269  break;
270  }
272  default:
273  {
274  break;
275  }
276  }
277 }
16 bit unsigned integer (15 bits used)
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
ossimImageData * theImageData
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
32 bit normalized floating point
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ fill() [6/10]

void ossimImageDataHelper::fill ( const ossimRgbVector color,
const ossimPolygon region,
bool  clipPoly = true 
)

Definition at line 132 of file ossimImageDataHelper.cpp.

References fill(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimImageData::getNumberOfBands(), ossimRgbVector::getR(), ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SCALAR_UNKNOWN, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, and theImageData.

135 {
136  double colorArray[3];
137 
138  colorArray[0] = color.getR();
139  colorArray[1] = color.getG();
140  colorArray[2] = color.getB();
141  switch(theImageData->getScalarType())
142  {
143  case OSSIM_UCHAR:
144  {
145  if(theImageData->getNumberOfBands() <= 3)
146  {
147  fill(static_cast<ossim_uint8>(0),
148  (const double*)colorArray,
149  region,
150  clipPoly);
151 
152  }
153  break;
154  }
156  case OSSIM_USHORT16:
157  case OSSIM_USHORT11:
158  case OSSIM_USHORT12:
159  case OSSIM_USHORT13:
160  case OSSIM_USHORT14:
161  case OSSIM_USHORT15:
162  case OSSIM_SSHORT16:
163  case OSSIM_FLOAT:
165  case OSSIM_DOUBLE:
167  default:
168  {
169  break;
170  }
171  }
172 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getNumberOfBands() const
unsigned char getR() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
ossimImageData * theImageData
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
32 bit normalized floating point
unsigned char getB() const
unsigned char getG() const
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ fill() [7/10]

template<class T >
void ossimImageDataHelper::fill ( dummyVariable,
const double *  values,
const ossimPolygon region,
bool  clipPoly 
)
protected

Definition at line 455 of file ossimImageDataHelper.cpp.

References fill(), ossimPolyArea2d::getVisiblePolygons(), and thePolyImageRectangle.

459 {
460  if(clipPoly)
461  {
462  ossimPolyArea2d polyArea(region);
463  ossimPolyArea2d clipArea = polyArea&thePolyImageRectangle;
464 
465  vector<ossimPolygon> clipList;
466 
467  clipArea.getVisiblePolygons(clipList);
468 
469  for(ossim_uint32 i = 0; i < clipList.size();++i)
470  {
471  fill( dummyVariable, values, clipList[i] );
472  }
473  }
474  else
475  {
476  fill( dummyVariable, values, region );
477  }
478 }
ossimPolyArea2d thePolyImageRectangle
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
unsigned int ossim_uint32
bool getVisiblePolygons(vector< ossimPolygon > &polyList) const

◆ fill() [8/10]

template<class T >
void ossimImageDataHelper::fill ( dummyVariable,
const double *  values,
const ossimIrect region,
bool  clipPoly 
)
protected

Definition at line 481 of file ossimImageDataHelper.cpp.

References ossimIrect::clipToRect(), fill(), ossimImageData::getImageRectangle(), and theImageData.

485 {
486  if(clipPoly)
487  {
488  fill(dummyVariable,
489  values,
491  }
492  else
493  {
494  fill(dummyVariable,
495  values,
496  region);
497  }
498 }
ossimImageData * theImageData
void fill(const double *values, const ossimIrect &rect, bool clipPoly=true)
virtual ossimIrect getImageRectangle() const
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501

◆ fill() [9/10]

template<class T >
void ossimImageDataHelper::fill ( dummyVariable,
const double *  values,
const ossimPolygon region 
)
protected

Definition at line 501 of file ossimImageDataHelper.cpp.

References abs, ossimImageData::getBuf(), ossimImageData::getHeight(), ossimPolygon::getIntegerBounds(), ossimImageData::getNumberOfBands(), ossimPolygon::getVertexCount(), ossimImageData::getWidth(), n, theImageData, theOrigin, ossimIpt::x, ossimIpt::y, and y.

504 {
505  int n;
506  int i;
507  int y;
508  ossim_int32 miny, maxy, minx, maxx;
509  int x1, y1;
510  int x2, y2;
511  int ind1, ind2;
512  // int ints;
513  vector<int> polyInts;
514  T* buf = reinterpret_cast<T*>(theImageData->getBuf());
515 
517  ossim_int32 bandOffset = 0;
518 
519  region.getIntegerBounds(minx, miny, maxx, maxy);
520  ossim_int32 rowOffset = (miny-theOrigin.y)*theImageData->getWidth();
521  n = region.getVertexCount();
522  /* Fix in 1.3: count a vertex only once */
523  for (y = miny; (y <= maxy); y++)
524  {
525  polyInts.clear();
526  // ints = 0;
527  for (i = 0; (i < n); i++)
528  {
529  if (!i)
530  {
531  ind1 = n - 1;
532  ind2 = 0;
533  }
534  else
535  {
536  ind1 = i - 1;
537  ind2 = i;
538  }
539  y1 = ossim::round<int>(region[ind1].y);
540  y2 = ossim::round<int>(region[ind2].y);
541  if (y1 < y2)
542  {
543  x1 = ossim::round<int>(region[ind1].x);
544  x2 = ossim::round<int>(region[ind2].x);
545  }
546  else if (y1 > y2)
547  {
548  y2 = ossim::round<int>(region[ind1].y);
549  y1 = ossim::round<int>(region[ind2].y);
550  x2 = ossim::round<int>(region[ind1].x);
551  x1 = ossim::round<int>(region[ind2].x);
552  }
553  else
554  {
555  continue;
556  }
557  if ((y >= y1) && (y < y2))
558  {
559  polyInts.push_back((y - y1) * (x2 - x1) / (y2 - y1) + x1);
560  }
561  else if ((y == maxy) && (y > y1) && (y <= y2))
562  {
563  polyInts.push_back((y - y1) * (x2 - x1) / (y2 - y1) + x1);
564  }
565  }
566  std::sort(polyInts.begin(), polyInts.end());
567 
568  for (i = 0; (i < (int)polyInts.size()); i += 2)
569  {
570  ossim_int32 startX = std::abs(polyInts[i]-theOrigin.x);
571  ossim_int32 endX = std::abs(polyInts[i+1]-theOrigin.x);
572  while(startX <= endX)
573  {
574  bandOffset = 0;
575  int band;
576  for(band = 0; band < (int)theImageData->getNumberOfBands();++band)
577  {
578  buf[rowOffset+bandOffset+startX] = (T)(values[band]);
579  bandOffset += blockLength;
580  }
581  ++startX;
582  }
583  }
584  rowOffset += theImageData->getWidth();
585  }
586 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
ossim_uint32 y
virtual ossim_uint32 getHeight() const
ossimImageData * theImageData
#define abs(a)
Definition: auxiliary.h:74
void getIntegerBounds(ossim_int32 &minX, ossim_int32 &minY, ossim_int32 &maxX, ossim_int32 &maxY) const
ossim_uint32 getVertexCount() const
os2<< "> n<< " > nendobj n
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ fill() [10/10]

template<class T >
void ossimImageDataHelper::fill ( dummyVariable,
const double *  values,
const ossimIrect region 
)
protected

Definition at line 589 of file ossimImageDataHelper.cpp.

References ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossimIrect::lr(), theImageData, theOrigin, ossimIrect::ul(), ossimIpt::x, ossimIpt::y, and y.

592 {
593  T* buf = reinterpret_cast<T*>(theImageData->getBuf());
594 
596  ossim_int32 bandOffset = 0;
597  ossim_int32 miny,maxy;
598  ossim_int32 minx, maxx;
599  ossim_int32 y = 0;
600  miny = region.ul().y-theOrigin.y;
601  maxy = region.lr().y-theOrigin.y;
602  minx = region.ul().x-theOrigin.x;
603  maxx = region.lr().x-theOrigin.x;
604 
605  ossim_int32 rowOffset = (miny)*theImageData->getWidth();
606  ossim_int32 startX = minx;
607  ossim_int32 endX = maxx;
609 
610  for (y = miny; (y <= maxy); ++y)
611  {
612  startX=minx;
613  while(startX <= endX)
614  {
615  bandOffset = 0;
616  int band = 0;
617  for(band = 0; band < bands;++band)
618  {
619  buf[rowOffset+bandOffset+startX] = (T)(values[band]);
620  bandOffset += blockLength;
621  }
622  ++startX;
623  }
624  rowOffset += theImageData->getWidth();
625  }
626 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
ossim_uint32 y
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossim_uint32 getHeight() const
ossimImageData * theImageData
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ setImageData()

void ossimImageDataHelper::setImageData ( ossimImageData imageData)

Definition at line 24 of file ossimImageDataHelper.cpp.

References ossimImageData::getImageRectangle(), theImageData, theImageRectangle, theOrigin, thePolyImageRectangle, and ossimIrect::ul().

Referenced by ossimPolyCutter::getTile(), and ossimImageDataHelper().

25 {
26  theImageData = imageData;
27  if(theImageData)
28  {
31 // thePolyImageRectangle = ossimPolyArea2d(theImageRectangle.ul(),
32 // theImageRectangle.ur(),
33 // theImageRectangle.lr(),
34 // theImageRectangle.ll());
36  }
37 }
ossimPolyArea2d thePolyImageRectangle
const ossimIpt & ul() const
Definition: ossimIrect.h:274
ossimImageData * theImageData
virtual ossimIrect getImageRectangle() const

Member Data Documentation

◆ theImageData

ossimImageData* ossimImageDataHelper::theImageData

Definition at line 61 of file ossimImageDataHelper.h.

Referenced by copyInputToThis(), fill(), and setImageData().

◆ theImageRectangle

ossimIrect ossimImageDataHelper::theImageRectangle
protected

Definition at line 66 of file ossimImageDataHelper.h.

Referenced by setImageData().

◆ theOrigin

ossimIpt ossimImageDataHelper::theOrigin
protected

Definition at line 65 of file ossimImageDataHelper.h.

Referenced by copyInputToThis(), fill(), and setImageData().

◆ thePolyImageRectangle

ossimPolyArea2d ossimImageDataHelper::thePolyImageRectangle
protected

Definition at line 67 of file ossimImageDataHelper.h.

Referenced by copyInputToThis(), fill(), and setImageData().


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