49 static ossimTrace traceDebug(
"ossimLasReader:debug");
51 static const char GSD_KW[] =
"gsd";
52 static const char SCAN_KW[] =
"scan";
85 static const char M[] =
"ossimLasReader::open";
102 m_str.seekg(0, std::ios_base::beg);
106 if ( (dataFormatId == 0) || (dataFormatId == 1) || (dataFormatId == 2) ||
107 (dataFormatId == 3) || (dataFormatId == 4) )
130 if ( traceDebug() && result )
139 if ( !result )
close();
217 m_ul.
y + scale.
y / 2.0 - TILE_RECT.
ul().
y * scale.
y);
226 const ossimDpt LR_PROG_PT( UL_PROG_PT.x + TILE_WIDTH * scale.
x,
227 UL_PROG_PT.y - TILE_HEIGHT * scale.
y);
232 cout <<
"m_ul: " <<
m_ul 233 <<
"\nm_gsd: " <<
m_gsd 234 <<
"\nscale: " << scale
237 <<
"\nPROJ_RECT: " << PROJ_RECT
238 <<
"\nTILE_RECT: " << TILE_RECT
239 <<
"\nUL_PROG_PT: " << UL_PROG_PT << endl;
250 std::vector<ossimLasReader::Bucket> bucket( TILE_SIZE );
259 while (
m_str.good() )
266 lasPt.
x = lasPtRec->
getX() * SCALE_X + OFFSET_X;
267 lasPt.
y = lasPtRec->
getY() * SCALE_Y + OFFSET_Y;
278 ossim_int32 bucketIndex = line * TILE_WIDTH + samp;
281 if ( ( bucketIndex >= 0 ) && ( bucketIndex < TILE_SIZE ) )
285 bucket[bucketIndex].add( z );
286 bucket[bucketIndex].setRed(lasPtRec->
getRed());
287 bucket[bucketIndex].setGreen(lasPtRec->
getGreen());
288 bucket[bucketIndex].setBlue(lasPtRec->
getBlue());
289 bucket[bucketIndex].setIntensity(lasPtRec->
getIntensity());
294 if (
m_str.eof() )
break;
309 std::vector<ossim_uint16> tempBuf(TILE_SIZE * BANDS);
315 if(band == 0) buffer[i] = bucket[i].getRed();
316 if(band == 1) buffer[i] = bucket[i].getGreen();
317 if(band == 2) buffer[i] = bucket[i].getBlue();
327 buf[i] = bucket[i].getIntensity();
337 buf[i] = bucket[i].getValue();
366 if (resLevel) result = (result>>resLevel);
377 if (resLevel) result = (result>>resLevel);
418 entryList.push_back(0);
419 entryList.push_back(1);
420 entryList.push_back(2);
442 std::vector<ossim_uint32> entryList;
444 std::vector<ossim_uint32>::const_iterator i = entryList.begin();
445 while ( i != entryList.end() )
447 if ( (*i) == entryIdx )
571 while(largestImageDimension > STOP_DIMENSION)
573 largestImageDimension /= 2;
595 const char* lookup = kwl.
find(prefix, GSD_KW);
600 lookup = kwl.
find(prefix, SCAN_KW);
613 if ( property.
valid() )
615 if ( property->
getName() == GSD_KW )
618 property->valueToString(s);
625 else if ( property->
getName() == SCAN_KW )
628 property->valueToString(s);
641 if ( name == GSD_KW )
646 else if ( name == SCAN_KW )
683 if ( dynamic_cast<ossimMapProjection*>( proj.
get() ) )
762 <<
"ossimLasReader::initProjection WARN Could not cast to map projection!" 804 const char* lookup = geomKwl.
find(
"image0.linear_units");
807 std::string units = lookup;
808 if ( units ==
"meters" )
812 else if ( units ==
"feet" )
816 else if ( units ==
"us_survey_feet" )
823 <<
"ossimLibLasReader::initUnits WARN:\n" 824 <<
"Unhandled linear units code: " << units << std::endl;
839 static const char M[] =
"ossimLasReader::initValues";
867 while (
m_str.good() )
875 x = lasPtRec->
getX() * SCALE_X + OFFSET_X;
876 y = lasPtRec->
getY() * SCALE_Y + OFFSET_Y;
877 z = lasPtRec->
getZ() * SCALE_Z + OFFSET_Z;
890 if (
m_str.eof() )
break;
951 <<
"\nminZ: " << pt.
x 952 <<
"\nmaxZ: " << pt.
y <<
"\n";
956 <<
"Bounds from scan:" 960 <<
"\nmaxZ: " <<
m_maxZ <<
"\n";
967 static const char M[] =
"ossimLasReader::parseVarRecords";
974 std::streampos origPos =
m_str.tellg();
978 m_str.seekg(pos, std::ios_base::beg);
1008 m_str.read((
char*)&reserved, 2);
1009 m_str.read(uid, 16);
1010 m_str.read((
char*)&recordId, 2);
1011 m_str.read((
char*)&length, 2);
1012 m_str.read(des, 32);
1017 endian->
swap(recordId);
1018 endian->
swap(length);
1025 <<
"\nrecordId: " << recordId
1026 <<
"\nlength: " << length
1031 if (recordId == 34735)
1033 geoKeyLength = length/2;
1036 delete [] geoKeyBlock;
1039 m_str.read((
char*)geoKeyBlock, length);
1042 endian->
swap(geoKeyBlock, geoKeyLength);
1045 else if (recordId == 34736)
1047 geoDoubleLength = length/8;
1048 if ( geoDoubleBlock )
1050 delete [] geoDoubleBlock;
1053 m_str.read((
char*)geoDoubleBlock, length);
1056 endian->
swap(geoDoubleBlock, geoDoubleLength);
1059 else if (recordId == 34737)
1061 geoAsciiLength = length;
1064 delete [] geoAsciiBlock;
1067 m_str.read((
char*)geoAsciiBlock, length);
1071 m_str.seekg(length, ios_base::cur);
1089 geoDoubleLength,geoDoubleBlock,
1090 geoAsciiLength,geoAsciiBlock,
1136 delete [] geoKeyBlock;
1141 delete [] geoDoubleBlock;
1146 delete [] geoAsciiBlock;
1150 m_str.seekg(origPos);
1168 static const char M[] =
"ossimLasReader::initFromExternalMetadata";
1171 bool result =
false;
1175 if ( fgdcFile.
exists() == false )
1183 if ( fgdcDoc->
open( fgdcFile ) )
1191 if ( ( units ==
"feet" ) || ( units ==
"international feet" ) )
1195 else if ( units ==
"survey feet" )
1267 ossim_float64 d = std::pow(2.0, static_cast<double>(resLevel));
virtual std::ostream & print(std::ostream &out) const =0
virtual ossim_uint32 getNumberOfInputBands() const
Gets bands.
bool open(const ossimFilename &file)
open method.
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
virtual void close()
Close method.
ossim_uint32 getNumberOfVlrs() const
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
char ossim_int8
Previous DLL import export section.
bool pointWithin(const ossimDpt &pt, double epsilon=0.0) const
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossimRefPtr< ossimImageData > m_tile
virtual ossim_uint16 getRed() const =0
ossimUnitConversionTool * m_unitConverter
ossimLasReader()
default constructor
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
virtual const ossim_uint16 * getUshortBuf() const
Container class for LAS point record type 1.
virtual ossim_int32 getY() const =0
Represents serializable keyword/value map.
void convertToMeters(ossim_float64 &value) const
virtual double getMinPixelValue(ossim_uint32 band=0) const
void setGsd(const ossim_float64 &gsd)
Sets m_gsd data member and projection if projection is set.
const char * find(const char *key) const
bool checkSignature(std::istream &in) const
Checks for LASF in first four bytes.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
virtual ossimString getShortName() const
virtual ossim_uint32 getCurrentEntry() const
ossim_uint32 height() const
bool getImageGeometry(ossimKeywordlist &geomKwl, ossim_uint32 entryIndex) const
Extracts geometry info to keyword list.
const ossim_float64 & getMaxX() const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual bool isGeographic() const
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
virtual ossimString getLongName() const
const ossimIpt & ul() const
const ossim_float64 & getScaleFactorY() const
void getScale(ossimDpt &scale, ossim_uint32 resLevel) const
Get the scale for resLevel.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual bool open()
open method.
virtual bool isOpen() const
is open method.
OSSIM_DLL ossimByteOrder byteOrder()
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
bool initFromExternalMetadata()
Looks for external FGDC text file to initialize projection from.
const ossim_float64 & getScaleFactorZ() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Set propterty method.
ossim_uint32 getOffsetToPointData() const
virtual ossim_uint32 getTileWidth() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Get propterty method.
const ossim_float64 & getMinX() const
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
unsigned short ossim_uint16
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setImageSize(const ossimIpt &size)
Container class for LAS point record type 1.
virtual ossim_int32 getZ() const =0
virtual bool extendGeometry(ossimImageHandler *handler) const
virtual void initialize()
Initialize the data buffer.
virtual void setMetersPerPixel(const ossimDpt &gsd)
const ossim_float64 & getOffsetX() const
ossimScalarType getOutputScalarType() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
virtual void setNullPix(ossim_float64 null_pix)
virtual ossim_uint32 getImageTileWidth() const
Gets tile width.
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
const ossim_float64 & getOffsetZ() const
virtual ossim_uint16 getIntensity() const =0
Container class for LAS point record type 4.
virtual ossim_uint32 getTileHeight() const
virtual ossimDataObjectStatus validate() const
virtual const ossimDatum * getDatum() const
ossimLasPointRecordInterface * getNewPointRecord() const
Returns a point of type.
const ossim_float64 & getScaleFactorX() const
virtual ossim_uint32 getImageTileHeight() const
Gets tile height.
bool toBool() const
String to numeric methods.
void initUnits(const ossimKeywordlist &geomKwl)
unsigned long long ossim_uint64
void readStream(std::istream &in)
Method to initialize from input stream.
unsigned int ossim_uint32
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
void toPoint(const std::string &s)
Initializes this point from string.
virtual ossim_int32 getX() const =0
const ossim_float64 & getMaxY() const
ossim_float64 toFloat64() const
const ossim_float64 & getOffsetY() const
virtual ossimIrect getImageRectangle() const
Support data container for FGDC in text format.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
const ossim_float64 & getMinZ() const
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
virtual void close()
Deletes the overview and clears the valid image vertices.
ossim_uint8 getPointDataFormatId() const
ossim_uint32 width() const
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
virtual void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual const ossim_float32 * getFloatBuf() const
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Gets lines.
static ossimProjectionFactoryRegistry * instance()
virtual void readStream(std::istream &in)=0
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Get propterty names.
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
Container class for LAS point record type 3.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
void getProjection(ossimRefPtr< ossimProjection > &proj)
Gets projection from Spatial_Reference_Information block.
virtual ossim_uint16 getBlue() const =0
ossimString toString(ossim_uint32 precision=15) const
void getFilenameWithThisExt(const ossimString &ext, ossimFilename &f) const
Returns the image file with extension set using supplentary directory for dirname if set...
virtual void setMaxPix(ossim_float64 max_pix)
virtual ossim_uint32 getNumberOfDecimationLevels() const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
const ossim_float64 & getMaxZ() const
virtual void completeOpen()
Will complete the opening process.
virtual double getNullPixelValue(ossim_uint32 band=0) const
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Gets samples.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
ossim_uint32 area() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
OSSIM Interface for LAS point record types.
virtual void setUlTiePoints(const ossimGpt &gpt)
#define RTTI_DEF1(cls, name, b1)
ossim_uint16 getHeaderSize() const
virtual ossimDpt getMetersPerPixel() const
Container class for LAS point record type 2.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
virtual void setMinPix(ossim_float64 min_pix)
virtual ~ossimLasReader()
virtual destructor
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
Gets entry list.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossim_uint16 getGreen() const =0
const ossim_float64 & getMinY() const
const ossimString & getName() const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
void getAltitudeDistanceUnits(std::string &units) const
Gets units from Altitude_Distance_Units.
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
ossimRefPtr< ossimProjection > m_proj