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
ossimTiling Class Reference

#include <ossimTiling.h>

Inheritance diagram for ossimTiling:
ossimObject ossimReferenced ossimTilingRect ossimTilingPoly

Public Types

enum  ossimTilingDeltaType { ossimTilingDeltaType_TOTAL_PIXELS, ossimTilingDeltaType_PER_PIXEL }
 

Public Member Functions

 ossimTiling ()
 
bool initialize (const ossimMapProjection &proj, const ossimIrect &boundingRect)
 
bool next (ossimRefPtr< ossimMapProjection > &resultProjection, ossimIrect &resultingBounds, ossimString &resultingName) const
 
void reset ()
 
void setTilingDistance (const ossimDpt &tilingDistance, ossimUnitType unitType)
 
void setDelta (const ossimDpt &delta, ossimTilingDeltaType deltaType)
 This sets the pixel delta. More...
 
void setTileNameMask (const ossimString &mask)
 This sets the tilename mask. More...
 
ossimString getTileNameMask () const
 
bool getRowCol (ossim_int64 &row, ossim_int64 &col, ossim_int64 tileId) const
 
bool getOrigin (ossimDpt &origin, ossim_int64 tileId) const
 
bool getOrigin (ossimDpt &origin, ossim_int64 row, ossim_int64 col) const
 
void setPaddingSizeInPixels (const ossimIpt &pizelOverlap)
 
ossimDpt getDeltaPerPixel () const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
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

void getConvertedTilingDistance (ossimDpt &pt) const
 
bool validate () const
 
bool isAngularUnit (ossimUnitType unitType) const
 
bool isLinearUnit (ossimUnitType unitType) const
 
void getTileName (ossimString &resultingName, ossim_int64 row, ossim_int64 col, ossim_int64 id) const
 
void clampGeographic (ossimDrect &rect) const
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

ossimDpt theTilingDistance
 The size of a tile in theTilingDistanceUnitType. More...
 
ossimUnitType theTilingDistanceUnitType
 The unit type for "theDelta", and "theTilingDistance". More...
 
ossimDpt theDelta
 If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels like 1024 x 1024. More...
 
ossimTilingDeltaType theDeltaType
 
ossim_int64 theOutputSizeInBytes
 If set tiling size is controlled by the desired output size in bytes. More...
 
ossim_uint32 theNumberOfBands
 Output number of bands. More...
 
ossim_uint32 theNumberOfBytesPerPixelPerBand
 Output number of bytes per pixel. More...
 
ossimDpt thePaddingSizeInPixels
 
ossimRefPtr< ossimMapProjectiontheMapProjection
 
ossimIrect theImageRect
 
ossimDrect theTilingRect
 
ossim_int64 theTileId
 
ossim_int64 theTotalHorizontalTiles
 
ossim_int64 theTotalVerticalTiles
 
ossim_int64 theTotalTiles
 
ossimString theTileNameMask
 
bool theEdgeToEdgeFlag
 This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary. More...
 

Detailed Description

Definition at line 24 of file ossimTiling.h.

Member Enumeration Documentation

◆ ossimTilingDeltaType

Enumerator
ossimTilingDeltaType_TOTAL_PIXELS 
ossimTilingDeltaType_PER_PIXEL 

Definition at line 28 of file ossimTiling.h.

Constructor & Destructor Documentation

◆ ossimTiling()

ossimTiling::ossimTiling ( )

Definition at line 27 of file ossimTiling.cpp.

28  :theTilingDistance(0,0),
30  theDelta(0,0),
35  thePaddingSizeInPixels(0.0, 0.0),
37  theImageRect(),
38  theTilingRect(),
39  theTileId(-1),
42  theTotalTiles(0),
44  theEdgeToEdgeFlag(false)
45 {
46 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
ossim_int64 theTileId
Definition: ossimTiling.h:176
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
ossim_int64 theTotalVerticalTiles
Definition: ossimTiling.h:178
ossimIrect theImageRect
Definition: ossimTiling.h:174
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
ossim_int64 theTotalTiles
Definition: ossimTiling.h:179
ossim_uint32 theNumberOfBytesPerPixelPerBand
Output number of bytes per pixel.
Definition: ossimTiling.h:170
ossim_int64 theOutputSizeInBytes
If set tiling size is controlled by the desired output size in bytes.
Definition: ossimTiling.h:149
ossim_int64 theTotalHorizontalTiles
Definition: ossimTiling.h:177
ossimDrect theTilingRect
Definition: ossimTiling.h:175
ossim_uint32 theNumberOfBands
Output number of bands.
Definition: ossimTiling.h:158
ossimString theTileNameMask
Definition: ossimTiling.h:180
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
ossimDpt thePaddingSizeInPixels
Definition: ossimTiling.h:172
bool theEdgeToEdgeFlag
This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary...
Definition: ossimTiling.h:186

Member Function Documentation

◆ clampGeographic()

void ossimTiling::clampGeographic ( ossimDrect rect) const
protected

Definition at line 669 of file ossimTiling.cpp.

References ossimDpt::lat, ossimDpt::lon, ossimDrect::lr(), ossimDrect::orientMode(), and ossimDrect::ul().

670 {
671  ossimDpt ul = rect.ul();
672  ossimDpt lr = rect.lr();
673 
674  if(ul.lat > 90) ul.lat = 90.0;
675  if(lr.lat < -90.0) lr.lat = -90.0;
676 
677  if(ul.lon < -180) ul.lon = -180;
678  if(lr.lon > 180) lr.lon = 180;
679 
680  rect = ossimDrect(ul, lr, rect.orientMode());
681 }
const ossimDpt & ul() const
Definition: ossimDrect.h:339
ossimCoordSysOrientMode orientMode() const
Definition: ossimDrect.h:414
double lat
Definition: ossimDpt.h:165
double lon
Definition: ossimDpt.h:164
const ossimDpt & lr() const
Definition: ossimDrect.h:341

◆ getConvertedTilingDistance()

void ossimTiling::getConvertedTilingDistance ( ossimDpt pt) const
protected
Returns
The tiling distance converted to either degrees or meters.

Definition at line 947 of file ossimTiling.cpp.

References ossimMapProjection::isGeographic(), ossimMapProjection::origin(), OSSIM_DEGREES, OSSIM_METERS, OSSIM_PIXEL, ossimNotify(), ossimNotifyLevel_WARN, ossimUnitConversionTool::setValue(), theMapProjection, theTilingDistance, theTilingDistanceUnitType, ossimDpt::x, and ossimDpt::y.

Referenced by getOrigin().

948 {
950  {
951  pt = theTilingDistance;
952  return;
953  }
954  if (!theMapProjection)
955  {
956  // This should not happen...
958  << "ossimTiling::getConvertedTilingDistance WARNING"
959  << " projection not set!" << endl;
960  pt = theTilingDistance;
961  return;
962  }
964  1.0,
966 
968  {
969  unitConverter.setValue(theTilingDistance.x,
971  pt.x = unitConverter.getValue(OSSIM_DEGREES);
972 
973  unitConverter.setValue(theTilingDistance.y,
975  pt.y = unitConverter.getValue(OSSIM_DEGREES);
976  }
977  else
978  {
979  unitConverter.setValue(theTilingDistance.x,
981  pt.x = unitConverter.getValue(OSSIM_METERS);
982 
983  unitConverter.setValue(theTilingDistance.y,
985  pt.y = unitConverter.getValue(OSSIM_METERS);
986  }
987 }
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
void setValue(double value, ossimUnitType unitType=OSSIM_METERS)
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
virtual bool isGeographic() const
virtual ossimGpt origin() const
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
double x
Definition: ossimDpt.h:164
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getDeltaPerPixel()

ossimDpt ossimTiling::getDeltaPerPixel ( ) const

Definition at line 544 of file ossimTiling.cpp.

References ossimMapProjection::isGeographic(), ossimMapProjection::origin(), OSSIM_DEGREES, OSSIM_METERS, ossimTilingDeltaType_TOTAL_PIXELS, ossimUnitConversionTool::setValue(), theDelta, theDeltaType, theMapProjection, theTilingDistance, theTilingDistanceUnitType, ossimDpt::x, and ossimDpt::y.

Referenced by next().

545 {
546 
547  ossimDpt result = theDelta;
548 
549  if (!theMapProjection)
550  {
551  return result;
552  }
553 
555  {
558  }
559 
561  1.0,
564  {
565  unitConverter.setValue(result.x, theTilingDistanceUnitType);
566  result.x = unitConverter.getValue(OSSIM_DEGREES);
567 
568  unitConverter.setValue(result.y,
570  result.y = unitConverter.getValue(OSSIM_DEGREES);
571  }
572  else
573  {
574  unitConverter.setValue(result.x,
576  result.x = unitConverter.getValue(OSSIM_METERS);
577 
578  unitConverter.setValue(result.y,
580  result.y = unitConverter.getValue(OSSIM_METERS);
581  }
582 
583  return result;
584 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
void setValue(double value, ossimUnitType unitType=OSSIM_METERS)
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
virtual bool isGeographic() const
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
virtual ossimGpt origin() const
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
double x
Definition: ossimDpt.h:164

◆ getOrigin() [1/2]

bool ossimTiling::getOrigin ( ossimDpt origin,
ossim_int64  tileId 
) const

Definition at line 501 of file ossimTiling.cpp.

References getRowCol().

Referenced by getTileName(), ossimTilingRect::next(), and next().

503 {
504  ossim_int64 row=0;
505  ossim_int64 col=0;
506 
507  bool result = getRowCol(row, col, tileId);
508  if(result)
509  {
510  result = getOrigin(origin, row, col);
511  }
512 
513  return result;
514 }
bool getOrigin(ossimDpt &origin, ossim_int64 tileId) const
bool getRowCol(ossim_int64 &row, ossim_int64 &col, ossim_int64 tileId) const
long long ossim_int64

◆ getOrigin() [2/2]

bool ossimTiling::getOrigin ( ossimDpt origin,
ossim_int64  row,
ossim_int64  col 
) const

Definition at line 516 of file ossimTiling.cpp.

References getConvertedTilingDistance(), ossimDrect::orientMode(), OSSIM_RIGHT_HANDED, theTilingRect, theTotalHorizontalTiles, theTotalVerticalTiles, ossimDrect::ul(), ossimDpt::x, and ossimDpt::y.

519 {
520  bool result = false;
521 
522  if((col < static_cast<ossim_int64>(theTotalHorizontalTiles)) &&
523  (row < static_cast<ossim_int64>(theTotalVerticalTiles)))
524  {
525  ossimDpt convertedTilingDistance;
526  getConvertedTilingDistance(convertedTilingDistance);
527 
528  result = true;
530  {
531  origin.x = theTilingRect.ul().x + col*convertedTilingDistance.x;
532  origin.y = theTilingRect.ul().y - row*convertedTilingDistance.y;
533  }
534  else
535  {
536  origin.x = theTilingRect.ul().x + col*convertedTilingDistance.x;
537  origin.y = theTilingRect.ul().y + row*convertedTilingDistance.y;
538  }
539  }
540 
541  return result;
542 }
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
ossim_int64 theTotalVerticalTiles
Definition: ossimTiling.h:178
void getConvertedTilingDistance(ossimDpt &pt) const
ossimCoordSysOrientMode orientMode() const
Definition: ossimDrect.h:414
ossim_int64 theTotalHorizontalTiles
Definition: ossimTiling.h:177
ossimDrect theTilingRect
Definition: ossimTiling.h:175
double x
Definition: ossimDpt.h:164

◆ getRowCol()

bool ossimTiling::getRowCol ( ossim_int64 row,
ossim_int64 col,
ossim_int64  tileId 
) const

Definition at line 481 of file ossimTiling.cpp.

References theTotalHorizontalTiles, theTotalTiles, and theTotalVerticalTiles.

Referenced by getOrigin(), ossimTilingRect::next(), and next().

484 {
485  bool result = true;
486 
487  if((theTotalHorizontalTiles > 0)&&
488  (tileId < theTotalTiles))
489  {
490  row = tileId/static_cast<ossim_int64>(theTotalHorizontalTiles);
491  col = tileId%static_cast<ossim_int64>(theTotalHorizontalTiles);
492  if((col >= static_cast<ossim_int32>(theTotalHorizontalTiles)) &&
493  (row >= static_cast<ossim_int32>(theTotalVerticalTiles)))
494  {
495  result = false;
496  }
497  }
498  return result;
499 }
ossim_int64 theTotalVerticalTiles
Definition: ossimTiling.h:178
ossim_int64 theTotalTiles
Definition: ossimTiling.h:179
ossim_int64 theTotalHorizontalTiles
Definition: ossimTiling.h:177
long long ossim_int64

◆ getTileName()

void ossimTiling::getTileName ( ossimString resultingName,
ossim_int64  row,
ossim_int64  col,
ossim_int64  id 
) const
protected

Definition at line 586 of file ossimTiling.cpp.

References ossimString::c_str(), ossimString::contains(), getOrigin(), ossimDpt::lat, ossimDpt::lon, OSSIM_DEGREES, ossimString::substitute(), theTileNameMask, theTilingDistance, theTilingDistanceUnitType, and ossimDpt::x.

Referenced by ossimTilingRect::next(), and next().

590 {
591  if(theTileNameMask == "")
592  {
593  ostringstream idString;
594  idString << id;
595  resultingName = ossimString("tile") + idString.str().c_str();
596  }
597  else if(theTileNameMask.contains("%SRTM%"))
598  {
599  // must be a 1x1 degree tiling distance
600  //
602  (theTilingDistance.x == 1.0)&&
603  (theTilingDistance.x == 1.0))
604  {
605  ostringstream latString;
606  ostringstream lonString;
607 
608  resultingName = "";
609  ossimDpt origin;
610  getOrigin(origin, row, col);
611  // the name is lower left and not upper left
612  // subtract one degree
613  //
614  origin.lat -=1;
615  latString << setfill('0') << setw(2) << fabs(origin.lat);
616  lonString << setfill('0') << setw(3) << fabs(origin.lon);
617 
618  if(origin.lat < 0.0)
619  {
620  resultingName += "S";
621  }
622  else
623  {
624  resultingName += "N";
625  }
626  resultingName += latString.str().c_str();
627  if(origin.lon < 0.0)
628  {
629  resultingName += "W";
630  }
631  else
632  {
633  resultingName += "E";
634  }
635  resultingName += lonString.str().c_str();
636  resultingName += ".hgt";
637  }
638  }
639  else
640  {
641  ostringstream rowString;
642  ostringstream colString;
643  ostringstream idString;
644  ostringstream oRowString;
645  ostringstream oColString;
646  ossimDpt origin;
647  getOrigin(origin, row, col);
648 
649  rowString << row;
650  colString << col;
651  idString << id;
652  oRowString << row;
653  oColString << col;
654 
655  resultingName = theTileNameMask;
656  resultingName = resultingName.substitute("%r%",
657  rowString.str().c_str());
658  resultingName = resultingName.substitute("%c%",
659  colString.str().c_str());
660  resultingName = resultingName.substitute("%i%",
661  idString.str().c_str());
662  resultingName = resultingName.substitute("%oc",
663  oColString.str().c_str());
664  resultingName = resultingName.substitute("%or",
665  oRowString.str().c_str());
666  }
667 }
ossimString substitute(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false) const
Substitutes searchKey string with replacementValue and returns a string.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
bool contains(char aChar) const
Definition: ossimString.h:58
double lat
Definition: ossimDpt.h:165
bool getOrigin(ossimDpt &origin, ossim_int64 tileId) const
double lon
Definition: ossimDpt.h:164
ossimString theTileNameMask
Definition: ossimTiling.h:180
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
double x
Definition: ossimDpt.h:164
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

◆ getTileNameMask()

ossimString ossimTiling::getTileNameMask ( ) const

Definition at line 476 of file ossimTiling.cpp.

References theTileNameMask.

477 {
478  return theTileNameMask;
479 }
ossimString theTileNameMask
Definition: ossimTiling.h:180

◆ initialize()

bool ossimTiling::initialize ( const ossimMapProjection proj,
const ossimIrect boundingRect 
)

Definition at line 48 of file ossimTiling.cpp.

Referenced by ossimIgen::outputProduct().

50 {
51  if(traceDebug())
52  {
54  << "ossimTiling::initialize DEBUG: Entered..."
55  << "\nBounding rect === " << boundingRect
56  << std::endl;
57  }
58 
59  bool result = true;
61  theImageRect = boundingRect;
62 
63  result = validate();
64 
65  ossimDpt convertedTilingDistance = theTilingDistance;
66 
67  if(result)
68  {
69  // Let's setup the bounding tile rect.
71  {
72  getConvertedTilingDistance(convertedTilingDistance);
73 
75  {
76  ossimGpt ul;
77  ossimGpt ur;
78  ossimGpt lr;
79  ossimGpt ll;
80 
82  ul);
84  ur);
86  lr);
88  ll);
89 
91  ossimDpt(ur),
92  ossimDpt(lr),
93  ossimDpt(ll),
95 
96  if(traceDebug())
97  {
99  << "DEBUG: Geographic input bounds = "
100  << theTilingRect
101  << std::endl;
102  }
103 
104  theTilingRect.stretchToTileBoundary(convertedTilingDistance);
105 
106  if(traceDebug())
107  {
109  << "DEBUG: Geographic input bounds stretched = "
110  << theTilingRect << std::endl;
111  }
112 
114 
115  if(traceDebug())
116  {
118  << "DEBUG: Geographic input bounds clamped = "
119  << theTilingRect << std::endl;
120  }
121 
122  } // End "if(theMapProjection->isGeographic())"
123 
124  else // meters
125  {
126  ossimDpt ul;
127  ossimDpt ur;
128  ossimDpt lr;
129  ossimDpt ll;
130 
132  ul);
134  ur);
136  lr);
138  ll);
140  ur,
141  lr,
142  ll,
144 
145  theTilingRect.stretchToTileBoundary(convertedTilingDistance);
146  }
147  }
148  else
149  {
150  ossim_int32 remainderX = (ossim_int32)((theImageRect.width()%((ossim_int32)theDelta.x)) != 0);
151  ossim_int32 remainderY = (ossim_int32)((theImageRect.height()%((ossim_int32)theDelta.y)) != 0);
152 
154  (remainderX*theDelta.x));
156  (remainderY*theDelta.y));
158  theImageRect.ul().y,
159  theImageRect.ul().x + (w-1),
160  theImageRect.ul().y + (h-1));
161 
162  // since we are pixel space we force delta to be 1 pixel unit
163  //
164  theDelta.x = 1.0;
165  theDelta.y = 1.0;
167  }
168  }
169 
170  theTotalHorizontalTiles = ossim::round<int>(fabs(theTilingRect.ur().x - theTilingRect.ul().x)/convertedTilingDistance.x);
171  theTotalVerticalTiles = ossim::round<int>(fabs(theTilingRect.ur().y - theTilingRect.lr().y)/convertedTilingDistance.y);
173 
174  // reset the tile id to the beginning
175  //
176  reset();
177 
178  if(traceDebug())
179  {
181 
183  << "\nossimTiling::initialize DEBUG: Leaving..." << std::endl;
184  }
185  return result;
186 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
virtual ossimObject * dup() const =0
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
ossim_uint32 height() const
Definition: ossimIrect.h:487
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
virtual bool isGeographic() const
const ossimIpt & ul() const
Definition: ossimIrect.h:274
ossim_int64 theTotalVerticalTiles
Definition: ossimTiling.h:178
ossimIrect theImageRect
Definition: ossimTiling.h:174
const ossimIpt & ll() const
Definition: ossimIrect.h:277
void getConvertedTilingDistance(ossimDpt &pt) const
void clampGeographic(ossimDrect &rect) const
virtual ossimGpt lineSampleToWorld(const ossimDpt &projectedPoint) const
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
bool validate() const
virtual void lineSampleToEastingNorthing(const ossimDpt &liineSample, ossimDpt &eastingNorthing) const
ossim_int64 theTotalTiles
Definition: ossimTiling.h:179
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossim_int64 theTotalHorizontalTiles
Definition: ossimTiling.h:177
virtual std::ostream & print(std::ostream &out) const
Generic print method.
const ossimIpt & ur() const
Definition: ossimIrect.h:275
ossimDrect theTilingRect
Definition: ossimTiling.h:175
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
void stretchToTileBoundary(const ossimDpt &widthHeight)
Definition: ossimDrect.cpp:396
ossim_int32 y
Definition: ossimIpt.h:142
const ossimDpt & ur() const
Definition: ossimDrect.h:340
double x
Definition: ossimDpt.h:164
ossim_int32 x
Definition: ossimIpt.h:141
const ossimDpt & lr() const
Definition: ossimDrect.h:341
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ isAngularUnit()

bool ossimTiling::isAngularUnit ( ossimUnitType  unitType) const
protected

Definition at line 408 of file ossimTiling.cpp.

References OSSIM_DEGREES, OSSIM_MINUTES, OSSIM_RADIANS, and OSSIM_SECONDS.

409 {
410  bool result = false;
411 
412  switch(unitType)
413  {
414  case OSSIM_DEGREES:
415  case OSSIM_RADIANS:
416  case OSSIM_SECONDS:
417  case OSSIM_MINUTES:
418  {
419  result = true;
420  break;
421  }
422  default:
423  {
424  break;
425  }
426  }
427  return result;
428 }

◆ isLinearUnit()

bool ossimTiling::isLinearUnit ( ossimUnitType  unitType) const
protected

Definition at line 430 of file ossimTiling.cpp.

References OSSIM_FEET, OSSIM_METERS, OSSIM_MILES, OSSIM_MILLIMETERS, OSSIM_NAUTICAL_MILES, and OSSIM_US_SURVEY_FEET.

431 {
432  bool result = false;
433 
434  switch(unitType)
435  {
436  case OSSIM_METERS:
437  case OSSIM_FEET:
440  case OSSIM_MILES:
441  case OSSIM_MILLIMETERS:
442  {
443  result = true;
444  break;
445  }
446  default:
447  {
448  break;
449  }
450  }
451  return result;
452 
453 }

◆ loadState()

bool ossimTiling::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimObject.

Reimplemented in ossimTilingRect, and ossimTilingPoly.

Definition at line 760 of file ossimTiling.cpp.

References distance(), ossimKeywordlist::find(), ossimUnitTypeLut::getEntryNumber(), ossimUnitTypeLut::instance(), ossimKeywordlist::numberOf(), OSSIM_PIXEL, ossimTilingDeltaType_PER_PIXEL, ossimTilingDeltaType_TOTAL_PIXELS, setTileNameMask(), theDelta, theDeltaType, theEdgeToEdgeFlag, theNumberOfBands, theNumberOfBytesPerPixelPerBand, theOutputSizeInBytes, thePaddingSizeInPixels, theTileNameMask, theTilingDistance, theTilingDistanceUnitType, ossimString::toBool(), ossimString::toInt32(), ossimString::toInt64(), ossimDpt::x, x, ossimDpt::y, and y.

762 {
763  bool result = false;
764 
765  // Get the mask if any.
766  theTileNameMask = kwl.find(prefix, "tile_name_mask");
768 
769  const char* paddingSizeInPixels = kwl.find(prefix,
770  "padding_size_in_pixels");
771  if (paddingSizeInPixels)
772  {
773  ossimString x,y;
774  std::istringstream padding(ossimString(paddingSizeInPixels).c_str());
775  padding >> x >> y;
776  thePaddingSizeInPixels.x = x.toFloat64();
777  thePaddingSizeInPixels.y = y.toFloat64();
778  }
779 
780  // Check to tile by size in bytes.
781  const char* lookup;
782  if (kwl.numberOf(prefix, "output_size_in_"))
783  {
784  lookup = kwl.find(prefix, "output_size_in_bytes");
785  if (lookup)
786  {
788  }
789  lookup = kwl.find(prefix, "output_size_in_kilo_bytes");
790  if (lookup)
791  {
792  theOutputSizeInBytes = ossimString(lookup).toInt64() * 1024;
793  }
794  lookup = kwl.find(prefix, "output_size_in_mega_bytes");
795  if (lookup)
796  {
797  theOutputSizeInBytes = ossimString(lookup).toInt64() * 1024 * 1024;
798  }
799  }
800 
802  {
803 
804  lookup = kwl.find(prefix, "output_bands");
805  if (lookup)
806  {
808  }
809  lookup = kwl.find(prefix, "output_bytes_per_pixel_per_band");
810  if (lookup)
811  {
813  }
814 
815  ossim_int64 pixelsPerBand = theOutputSizeInBytes /
817 
818  ossim_int32 oneDimension =
819  static_cast<ossim_int32>(floor(sqrt((double)pixelsPerBand)));
820 
821  //---
822  // TODO: Clamp to power of two option. (drb)
823  //---
824  // theDelta.x = oneDimension;
825  // theDelta.y = oneDimension;
826  // theTilingDistance.x = 1;
827  // theTilingDistance.y = 1;
828 
829  theDelta.x = 1;
830  theDelta.y = 1;
831  theTilingDistance.x = oneDimension;
832  theTilingDistance.y = oneDimension;
835  result = true;
836  }
837  else
838  {
839  const char* tilingDistance = kwl.find(prefix,
840  "tiling_distance");
841  const char* tilingDistanceType = kwl.find(prefix,
842  "tiling_distance_type");
843  const char* delta = kwl.find(prefix,
844  "delta");
845 
846  const char* deltaType = kwl.find(prefix,
847  "delta_type");
848 
849  result = tilingDistance&&tilingDistanceType&&delta&&deltaType&&paddingSizeInPixels;
850  ossimString x,y;
851  std::istringstream distance(ossimString(tilingDistance).c_str());
852  distance >> x >> y;
853  theTilingDistance.x = x.toFloat64();
854  theTilingDistance.y = y.toFloat64();
855  if(theTilingDistance.x <= 0.0)
856  {
857  theTilingDistance.x = 1.0;
858  }
859  if(theTilingDistance.y<=0.0)
860  {
862  }
863 
864  // unitLut.getTableIndexString(theTilingDistanceUnitType), ?????
865 
868  ossimString(tilingDistanceType).c_str());
869 
870  theDelta = ossimDpt(0,0);
871  x="";
872  y="";
873  std::istringstream deltaValues(ossimString(delta).c_str());
874  deltaValues >> x >> y;
875  theDelta.x = x.toFloat64();
876  theDelta.y = y.toFloat64();
877 
878  if(theDelta.x <= 0.0)
879  {
880  theDelta.x = 1.0;
881  }
882 
883  if(theDelta.y <= 0.0)
884  {
885  theDelta.y = theDelta.x;
886  }
887 
888  if(ossimString(deltaType).downcase().contains("total"))
889  {
891  }
892  else
893  {
895  }
896  }
897 
898  lookup = kwl.find(prefix, "edge_to_edge");
899  if ( lookup )
900  {
902  }
903 
904  if (traceDebug())
905  {
907  }
908 
909  return result;
910 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossim_uint32 x
ossim_uint32 numberOf(const char *str) const
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
ossimUnitType
ossim_uint32 y
const char * find(const char *key) const
double y
Definition: ossimDpt.h:165
virtual ossim_int32 getEntryNumber(const char *entry_string, bool case_insensitive=true) const
ossim_int32 toInt32() const
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
void setTileNameMask(const ossimString &mask)
This sets the tilename mask.
bool toBool() const
String to numeric methods.
ossim_uint32 theNumberOfBytesPerPixelPerBand
Output number of bytes per pixel.
Definition: ossimTiling.h:170
ossim_int64 theOutputSizeInBytes
If set tiling size is controlled by the desired output size in bytes.
Definition: ossimTiling.h:149
virtual std::ostream & print(std::ostream &out) const
Generic print method.
ossim_uint32 theNumberOfBands
Output number of bands.
Definition: ossimTiling.h:158
ossimString theTileNameMask
Definition: ossimTiling.h:180
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
ossimDpt thePaddingSizeInPixels
Definition: ossimTiling.h:172
double x
Definition: ossimDpt.h:164
long long ossim_int64
ossim_int64 toInt64() const
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
float distance(double lat1, double lon1, double lat2, double lon2, int units)
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
bool theEdgeToEdgeFlag
This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary...
Definition: ossimTiling.h:186
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ next()

bool ossimTiling::next ( ossimRefPtr< ossimMapProjection > &  resultProjection,
ossimIrect resultingBounds,
ossimString resultingName 
) const

Definition at line 188 of file ossimTiling.cpp.

References ossimGpt::datum(), getDeltaPerPixel(), getOrigin(), getRowCol(), getTileName(), ossimMapProjection::isGeographic(), ossimDpt::lat, ossimDpt::lon, ossimMapProjection::origin(), OSSIM_PIXEL, ossimTilingDeltaType_TOTAL_PIXELS, ossimMapProjection::setDecimalDegreesPerPixel(), ossimMapProjection::setMetersPerPixel(), ossimMapProjection::setUlTiePoints(), theDelta, theDeltaType, theEdgeToEdgeFlag, theMapProjection, thePaddingSizeInPixels, theTileId, theTilingDistance, theTilingDistanceUnitType, theTotalTiles, ossimIpt::x, ossimDpt::x, ossimIpt::y, and ossimDpt::y.

Referenced by ossimIgen::outputProduct().

191 {
192  bool result = true;
193 
195  {
196  ossimDpt origin;
197  ossim_int64 row=0;
198  ossim_int64 col=0;
199 
200  getRowCol(row, col, theTileId);
201 
202  getTileName(resultingName,
203  row, col, theTileId);
204 
205  getOrigin(origin, row, col);
206 
208  {
209  ossimIpt ul = origin;
210 
211  resultingBounds =
214  ul.x + ((ossim_int32)theTilingDistance.x-1) +
216  ul.y + ((ossim_int32)theTilingDistance.y-1) +
218  }
219  else
220  {
221 
222  ossimDpt deltaPerPixel = getDeltaPerPixel();
223  ossimIpt pixels;
224 
226  {
227  pixels = theDelta;
228  }
229  else
230  {
233  }
234 
236  {
237  if ( theEdgeToEdgeFlag )
238  {
240  ossimGpt( origin.lat - (deltaPerPixel.y/2.0),
241  origin.lon + (deltaPerPixel.x/2.0),
242  0.0,
243  theMapProjection->origin().datum()) );
244  }
245  else
246  {
248  ossimGpt(origin.lat,
249  origin.lon,
250  0.0,
252 
253  }
255  }
256  else
257  {
258  if ( theEdgeToEdgeFlag )
259  {
261  ossimDpt( origin.x + (deltaPerPixel.x/2.0),
262  origin.y - (deltaPerPixel.y/2.0) ) );
263  }
264  else
265  {
266  theMapProjection->setUlTiePoints(ossimDpt(origin.x, origin.y));
267  }
268  theMapProjection->setMetersPerPixel(deltaPerPixel);
269  }
270  resultingBounds = ossimIrect(-(ossim_int32)thePaddingSizeInPixels.x,
272  (pixels.x-1) + (ossim_int32)thePaddingSizeInPixels.x,
273  (pixels.y-1) + (ossim_int32)thePaddingSizeInPixels.y);
274  }
275  resultProjection = theMapProjection;
276 
277  ++theTileId;
278  if(traceDebug()&&resultProjection.valid())
279  {
280  ossimKeywordlist projKwl;
281 
282  resultProjection->saveState(projKwl);
284  << "ossimTiling::next DEBUG: rect = " << resultingBounds
285  << "\nproj = " << projKwl
286  << "\ntileName = " << resultingName
287  << "\norigin = " << origin << std::endl;
288  }
289  }
290  else
291  {
292  result = false;
293  }
294 
295 
296  return result;
297 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
Represents serializable keyword/value map.
ossim_int64 theTileId
Definition: ossimTiling.h:176
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
virtual bool isGeographic() const
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
void getTileName(ossimString &resultingName, ossim_int64 row, ossim_int64 col, ossim_int64 id) const
virtual void setMetersPerPixel(const ossimDpt &gsd)
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
ossimDpt getDeltaPerPixel() const
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
double lat
Definition: ossimDpt.h:165
virtual ossimGpt origin() const
ossim_int64 theTotalTiles
Definition: ossimTiling.h:179
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
bool getOrigin(ossimDpt &origin, ossim_int64 tileId) const
bool getRowCol(ossim_int64 &row, ossim_int64 &col, ossim_int64 tileId) const
double lon
Definition: ossimDpt.h:164
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
ossim_int32 y
Definition: ossimIpt.h:142
ossimDpt thePaddingSizeInPixels
Definition: ossimTiling.h:172
double x
Definition: ossimDpt.h:164
long long ossim_int64
virtual void setUlTiePoints(const ossimGpt &gpt)
ossim_int32 x
Definition: ossimIpt.h:141
bool theEdgeToEdgeFlag
This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary...
Definition: ossimTiling.h:186
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ print()

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

Generic print method.

Derived classes should re-implement as they see fit.

Returns
std::ostream&

Reimplemented from ossimObject.

Definition at line 912 of file ossimTiling.cpp.

References ossimMapProjection::print(), theDelta, theDeltaType, theEdgeToEdgeFlag, theImageRect, theMapProjection, theNumberOfBands, theNumberOfBytesPerPixelPerBand, theOutputSizeInBytes, thePaddingSizeInPixels, theTileId, theTileNameMask, theTilingDistance, theTilingDistanceUnitType, theTilingRect, theTotalHorizontalTiles, theTotalTiles, theTotalVerticalTiles, and ossimRefPtr< T >::valid().

913 {
914  out << "theTilingDistance: " << theTilingDistance
915  << "\ntheTilingDistanceUnitType: " << theTilingDistanceUnitType
916  << "\ntheDelta: " << theDelta
917  << "\ntheDeltaType: " << theDeltaType
918  << "\nthePaddingSizeInPixels: " << thePaddingSizeInPixels
919  << "\ntheImageRect: " << theImageRect
920  << "\ntheTilingRect: " << theTilingRect
921  << "\ntheTileId: " << theTileId
922  << "\ntheTotalHorizontalTiles: " << theTotalHorizontalTiles
923  << "\ntheTotalVerticalTiles: " << theTotalVerticalTiles
924  << "\ntheTotalTiles: " << theTotalTiles
925  << "\ntheTileNameMask: " << theTileNameMask
926  << "\ntheOutputSizeInBytes: " << theOutputSizeInBytes
927  << "\ntheNumberOfBands: " << theNumberOfBands
928  << "\ntheNumberOfBytesPerPixelPerBand: " <<
930  << "\ntheEdgeToEdgeFlag: " << theEdgeToEdgeFlag
931  << "\n";
932 
933  if (theMapProjection.valid())
934  {
935  out << "\ntheMapProjection:\n";
936  theMapProjection->print(out);
937  }
938  else
939  {
940  out << "theMapProjection is not set.";
941  }
942  out << endl;
943 
944  return out;
945 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
ossim_int64 theTileId
Definition: ossimTiling.h:176
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
ossim_int64 theTotalVerticalTiles
Definition: ossimTiling.h:178
ossimIrect theImageRect
Definition: ossimTiling.h:174
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
ossim_int64 theTotalTiles
Definition: ossimTiling.h:179
ossim_uint32 theNumberOfBytesPerPixelPerBand
Output number of bytes per pixel.
Definition: ossimTiling.h:170
ossim_int64 theOutputSizeInBytes
If set tiling size is controlled by the desired output size in bytes.
Definition: ossimTiling.h:149
ossim_int64 theTotalHorizontalTiles
Definition: ossimTiling.h:177
ossimDrect theTilingRect
Definition: ossimTiling.h:175
ossim_uint32 theNumberOfBands
Output number of bands.
Definition: ossimTiling.h:158
ossimString theTileNameMask
Definition: ossimTiling.h:180
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
ossimDpt thePaddingSizeInPixels
Definition: ossimTiling.h:172
bool theEdgeToEdgeFlag
This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary...
Definition: ossimTiling.h:186
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.

◆ reset()

void ossimTiling::reset ( void  )

Definition at line 300 of file ossimTiling.cpp.

References theTileId.

301 {
302  theTileId = 0;
303 }
ossim_int64 theTileId
Definition: ossimTiling.h:176

◆ saveState()

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

Method to save the state of the object to a keyword list. Return true if ok or false on error.

Reimplemented from ossimObject.

Reimplemented in ossimTilingRect, and ossimTilingPoly.

Definition at line 683 of file ossimTiling.cpp.

References ossimKeywordlist::add(), ossimString::c_str(), ossimUnitTypeLut::instance(), ossimTilingDeltaType_TOTAL_PIXELS, theDelta, theDeltaType, theEdgeToEdgeFlag, theNumberOfBands, theNumberOfBytesPerPixelPerBand, theOutputSizeInBytes, thePaddingSizeInPixels, theTileNameMask, theTilingDistance, theTilingDistanceUnitType, ossimString::toString(), ossimDpt::x, and ossimDpt::y.

685 {
686  std::stringstream tilingDistance;
687 
688  tilingDistance << theTilingDistance.x << " " << theTilingDistance.y << std::endl;
689 
690  kwl.add(prefix,
691  "tiling_distance",
692  tilingDistance.str().c_str(),
693  true);
694 
695 
696  kwl.add(prefix,
697  "tiling_distance_type",
699  getTableIndexString(theTilingDistanceUnitType),
700  true);
701  std::ostringstream delta;
702  delta << theDelta.x << " " << theDelta.y;
703  kwl.add(prefix,
704  "delta",
705  delta.str().c_str(),
706  true);
707 
709  {
710  kwl.add(prefix,
711  "delta_type",
712  "total_pixels",
713  true);
714  }
715  else
716  {
717  kwl.add(prefix,
718  "delta_type",
719  "delta_per_pixels",
720  true);
721  }
722  std::ostringstream padding;
723 
724  padding << thePaddingSizeInPixels.x << " " << thePaddingSizeInPixels.y;
725  kwl.add(prefix,
726  "padding_size_in_pixels",
727  padding.str().c_str(),
728  true);
729 
730  kwl.add(prefix,
731  "tile_name_mask",
733  true);
734 
736  {
737  kwl.add(prefix,
738  "output_size_in_bytes",
740  true);
741  kwl.add(prefix,
742  "output_bands",
744  true);
745  kwl.add(prefix,
746  "output_bytes_per_pixel_per_band",
748  true);
749  }
750 
751  kwl.add(prefix,
752  "edge_to_edge",
754  true);
755 
756 
757  return true;
758 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
std::basic_stringstream< char > stringstream
Class for char mixed input and output memory streams.
Definition: ossimIosFwd.h:38
double y
Definition: ossimDpt.h:165
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
ossim_uint32 theNumberOfBytesPerPixelPerBand
Output number of bytes per pixel.
Definition: ossimTiling.h:170
ossim_int64 theOutputSizeInBytes
If set tiling size is controlled by the desired output size in bytes.
Definition: ossimTiling.h:149
ossim_uint32 theNumberOfBands
Output number of bands.
Definition: ossimTiling.h:158
ossimString theTileNameMask
Definition: ossimTiling.h:180
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
ossimDpt thePaddingSizeInPixels
Definition: ossimTiling.h:172
double x
Definition: ossimDpt.h:164
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
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
bool theEdgeToEdgeFlag
This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary...
Definition: ossimTiling.h:186

◆ setDelta()

void ossimTiling::setDelta ( const ossimDpt delta,
ossimTilingDeltaType  deltaType 
)

This sets the pixel delta.

The delta can either be TOTAL_PIXELS or UNIT_PER_PIXEL.

If the delta type is TOTAL_PIXELS then the unit per pixel is calculated from the theTilingDistance. This is very useful when wanting to be on even geographic boundaries and would like to have a fixed width and height for the pixels. Flight simulators use this tiling scheme for power of 2 outputs.

if the delta type is unit per pixel then the total pixels is computed form the theTilingDistance. This is useful when you might want whole number GSD's and whole numbered tile boundaries.

Definition at line 312 of file ossimTiling.cpp.

References theDelta, and theDeltaType.

314 {
315  theDelta = delta;
316  theDeltaType = deltaType;
317 }
ossimTilingDeltaType theDeltaType
Definition: ossimTiling.h:137
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134

◆ setPaddingSizeInPixels()

void ossimTiling::setPaddingSizeInPixels ( const ossimIpt pizelOverlap)

◆ setTileNameMask()

void ossimTiling::setTileNameMask ( const ossimString mask)

This sets the tilename mask.

The key tokens that are supported are.

r% Replaces with the row number of the current tile c% Replaces with the column number of the current tile i% Replaces with the current tile id. or% Replaces with the origin of the row oc% Replaces with the origin of the col SRTM% Replaces all filenames with the SRTM file name convention

Examples: tiler_c% assume r = 0 and c = 100 then this is replaced with tile0_100

Definition at line 455 of file ossimTiling.cpp.

References ossimString::contains(), and theTileNameMask.

Referenced by ossimTilingRect::loadState(), and loadState().

456 {
457  if(theTileNameMask == "")
458  {
459  theTileNameMask = "tile%i%";
460  }
461  if(mask.contains("%i%")||
462  mask.contains("%oc%")||
463  mask.contains("%or%")||
464  mask.contains("%r%")||
465  mask.contains("%c%")||
466  mask.contains("%SRTM%"))
467  {
468  theTileNameMask = mask;
469  }
470  else
471  {
472  theTileNameMask += "%i%";
473  }
474 }
bool contains(char aChar) const
Definition: ossimString.h:58
ossimString theTileNameMask
Definition: ossimTiling.h:180

◆ setTilingDistance()

void ossimTiling::setTilingDistance ( const ossimDpt tilingDistance,
ossimUnitType  unitType 
)
Parameters
tilingDistanceDistance in the specified units.
unitTypeCurrently only angular unit degrees, and linear unit meters are supported. If unitType is pixel unit then the delta per unit will be set to 1.

Definition at line 305 of file ossimTiling.cpp.

References theTilingDistance, and theTilingDistanceUnitType.

307 {
308  theTilingDistance = tilingDistance;
309  theTilingDistanceUnitType = unitType;
310 }
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122

◆ validate()

bool ossimTiling::validate ( ) const
protected

Definition at line 319 of file ossimTiling.cpp.

References FLT_EPSILON, ossimIrect::hasNans(), ossimMapProjection::isGeographic(), OSSIM_DEGREES, OSSIM_FEET, OSSIM_METERS, OSSIM_MILES, OSSIM_MILLIMETERS, OSSIM_MINUTES, OSSIM_NAUTICAL_MILES, OSSIM_PIXEL, OSSIM_RADIANS, OSSIM_SECONDS, OSSIM_US_SURVEY_FEET, ossimNotify(), ossimNotifyLevel_WARN, theDelta, theImageRect, theMapProjection, theTilingDistance, theTilingDistanceUnitType, ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

320 {
321  bool result = true;
322 
323  if(theMapProjection.valid())
324  {
326  {
328  {
329  case OSSIM_DEGREES:
330  case OSSIM_RADIANS:
331  case OSSIM_SECONDS:
332  case OSSIM_MINUTES:
333  case OSSIM_PIXEL:
334  {
335  break;
336  }
337  default:
338  {
340  << "ossimTiling::validate()\n"
341  << "Map projeciton requires tiling in angular units but the"
342  << "\nspacing is in non angular" << std::endl;
343  result = false;
344  }
345  }
346  }
347  else
348  {
350  {
351  case OSSIM_METERS:
352  case OSSIM_FEET:
355  case OSSIM_PIXEL:
356  case OSSIM_MILES:
357  case OSSIM_MILLIMETERS:
358  {
359  break;
360  }
361  default:
362  {
364  << "ossimTiling::validate()"
365  << "\nMap projeciton requires tiling using linear spacing"
366  << " but the spacing is in non linear" << std::endl;
367  result = false;
368  }
369  }
370  }
371  }
372  else
373  {
374  result = false;
376  << "ossimTiling::validate()"
377  << "\nthe image projection is null and so not valid"
378  << std::endl;
379  }
380  if((theDelta.x <= FLT_EPSILON) ||
381  (theDelta.y <= FLT_EPSILON))
382  {
384  << "ossimTiling::validate() the delta is too small or is negative"
385  << "value = " << theDelta << std::endl;
386  result = false;
387  }
390  {
392  << "ossimTiling::validate()"
393  << "\nthe tiling distance is too small or is negative"
394  << "Value = " << theTilingDistance << std::endl;
395  }
396 
397  if(theImageRect.hasNans())
398  {
400  << "ossimTiling::validate() the image rect has nans"
401  << std::endl;
402  result = false;
403  }
404 
405  return result;
406 }
ossimUnitType theTilingDistanceUnitType
The unit type for "theDelta", and "theTilingDistance".
Definition: ossimTiling.h:125
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimMapProjection > theMapProjection
Definition: ossimTiling.h:173
virtual bool isGeographic() const
ossimIrect theImageRect
Definition: ossimTiling.h:174
ossimDpt theDelta
If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels li...
Definition: ossimTiling.h:134
#define FLT_EPSILON
ossimDpt theTilingDistance
The size of a tile in theTilingDistanceUnitType.
Definition: ossimTiling.h:122
double x
Definition: ossimDpt.h:164
bool hasNans() const
Definition: ossimIrect.h:337
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Data Documentation

◆ theDelta

ossimDpt ossimTiling::theDelta
protected

If (theDeltaType == ossimTilingDeltaType_TOTAL_PIXELS) then this is the size of the tile in pixels like 1024 x 1024.

If (theDeltaType == ossimTilingDeltaType_PER_PIXEL) then this is the size of a single pixel like 1.0 meter.

Definition at line 134 of file ossimTiling.h.

Referenced by getDeltaPerPixel(), ossimTilingRect::loadState(), loadState(), next(), print(), saveState(), setDelta(), and validate().

◆ theDeltaType

ossimTilingDeltaType ossimTiling::theDeltaType
protected
See also
theDelta

Definition at line 137 of file ossimTiling.h.

Referenced by getDeltaPerPixel(), loadState(), next(), print(), saveState(), and setDelta().

◆ theEdgeToEdgeFlag

bool ossimTiling::theEdgeToEdgeFlag
protected

This flags the code to shift the tie point so that the edge of the pixel falls on the tile boundary.

default=false

Definition at line 186 of file ossimTiling.h.

Referenced by loadState(), next(), print(), and saveState().

◆ theImageRect

ossimIrect ossimTiling::theImageRect
protected

◆ theMapProjection

ossimRefPtr<ossimMapProjection> ossimTiling::theMapProjection
mutableprotected

◆ theNumberOfBands

ossim_uint32 ossimTiling::theNumberOfBands
protected

Output number of bands.

Needed to tile by output size in bytes.

default = 1

See also
theOutputSizeInBytes

Definition at line 158 of file ossimTiling.h.

Referenced by loadState(), print(), and saveState().

◆ theNumberOfBytesPerPixelPerBand

ossim_uint32 ossimTiling::theNumberOfBytesPerPixelPerBand
protected

Output number of bytes per pixel.

Needed to tile by output size in bytes.

default = 1

See also
theOutputSizeInBytes
Note
This bytes per single pixel, not all bands.

Definition at line 170 of file ossimTiling.h.

Referenced by loadState(), print(), and saveState().

◆ theOutputSizeInBytes

ossim_int64 ossimTiling::theOutputSizeInBytes
protected

If set tiling size is controlled by the desired output size in bytes.

Set by one of output_size_in_bytes, output_size_in_kilo_bytes, or output_size_in_mega_bytes. Always stored in bytes.

Note
kilo_byte = 1024 X 1024, mega_byte = 1024 X 1024 X 1024.
If set this relys on theNumberOfBands and theNumberOfBytesPerPixel need to alse be set correctly.

Definition at line 149 of file ossimTiling.h.

Referenced by loadState(), print(), and saveState().

◆ thePaddingSizeInPixels

ossimDpt ossimTiling::thePaddingSizeInPixels
protected

◆ theTileId

ossim_int64 ossimTiling::theTileId
mutableprotected

◆ theTileNameMask

ossimString ossimTiling::theTileNameMask
protected

◆ theTilingDistance

ossimDpt ossimTiling::theTilingDistance
protected

◆ theTilingDistanceUnitType

ossimUnitType ossimTiling::theTilingDistanceUnitType
protected

◆ theTilingRect

ossimDrect ossimTiling::theTilingRect
protected

Definition at line 175 of file ossimTiling.h.

Referenced by getOrigin(), and print().

◆ theTotalHorizontalTiles

ossim_int64 ossimTiling::theTotalHorizontalTiles
protected

Definition at line 177 of file ossimTiling.h.

Referenced by getOrigin(), getRowCol(), ossimTilingRect::next(), and print().

◆ theTotalTiles

ossim_int64 ossimTiling::theTotalTiles
protected

◆ theTotalVerticalTiles

ossim_int64 ossimTiling::theTotalVerticalTiles
protected

Definition at line 178 of file ossimTiling.h.

Referenced by getOrigin(), getRowCol(), ossimTilingRect::next(), and print().


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