39 #include <ogr_spatialref.h> 43 #ifdef OSSIM_ID_ENABLED 44 static const char OSSIM_ID[] =
"$Id";
49 static double maxRasterSize = 2048.0;
50 static double maxBlockSideSize = 1024.0;
52 static ossimTrace traceDebug(
"ossimMG4LidarReader:debug");
53 static ossimTrace traceDump(
"ossimMG4LidarReader:dump");
57 "ossimMG4LidarReader",
128 static const char MODULE[] =
"ossimMG4LidarReader::open";
133 << MODULE <<
" entered...\n" 152 m_reader = MG4PointReader::create();
156 int numPoints =
m_reader->getNumPoints();
161 double average_pt_spacing = sqrt(1.0 / pts_per_area) ;
162 double cell_side = average_pt_spacing;
189 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
199 const double gWidth =
m_reader->getBounds().x.length() ;
200 const double gHeight =
m_reader->getBounds().y.length() ;
203 double xRes = pow(2.0, zoom) * gWidth / maxRasterSize ;
204 double yRes = pow(2.0, zoom) * gHeight / maxRasterSize ;
270 Bounds bounds(UL_PT.lon, LR_PT.lon,
271 UL_PT.lat, LR_PT.lat,
272 -HUGE_VAL, +HUGE_VAL);
276 PointIterator* iter =
m_reader->createIterator(bounds, fraction,
m_reader->getPointInfo(), NULL);
284 double* dataValues =
new double[clipRect.
width()*clipRect.
height()];
285 while((count = iter->getNextPoints(points)) != 0)
288 for(
size_t i = 0; i < count; i += 1)
290 const ChannelData* channelX = points.getChannel(CHANNEL_NAME_X);
291 const ChannelData* channelY = points.getChannel(CHANNEL_NAME_Y);
292 const ChannelData* channelZ = points.getChannel(CHANNEL_NAME_Z);
294 const void *dataX = channelX->getData();
295 const void *dataY = channelY->getData();
296 const void *dataZ = channelZ->getData();
298 lasPt.
x =
static_cast<const double*
>(dataX)[i];
299 lasPt.
y =
static_cast<const double*
>(dataY)[i];
307 dataValues[bufIndex] =
static_cast<const double*
>(dataZ)[i];
381 static const char MODULE[] =
"ossimMG4LidarReader::getInternalImageGeometry";
415 DataType pixelType =
m_reader->getChannel(channelId).getDataType();
428 case DATATYPE_UINT16:
433 case DATATYPE_SINT16:
438 case DATATYPE_UINT32:
443 case DATATYPE_SINT32:
448 case DATATYPE_FLOAT32:
453 case DATATYPE_FLOAT64:
472 const char* wkt =
m_reader->getWKT();
475 OGRSpatialReferenceH hSRS = NULL;
478 hSRS = OSRNewSpatialReference(NULL);
479 if(OSRImportFromWkt( hSRS, (
char**)&wkt) != OGRERR_NONE)
481 OSRDestroySpatialReference( hSRS );
486 const char* epsg_code = OSRGetAttrValue(hSRS,
"AUTHORITY", 1);
491 const char* units = OSRGetAttrValue(hSRS,
"UNIT", 0);
492 bool bGeog = OSRIsGeographic(hSRS);
526 double xMin =
m_reader->getBounds().x.min;
527 double yMax =
m_reader->getBounds().y.max;
560 template<
typename DTYPE>
563 DTYPE retval =
static_cast<DTYPE
>(0);
564 switch (channel->getDataType())
566 case (DATATYPE_FLOAT64):
567 retval =
static_cast<DTYPE
>(
static_cast<const double*
>(channel->getData())[idx]);
569 case (DATATYPE_FLOAT32):
570 retval =
static_cast<DTYPE
>(
static_cast<const float *
>(channel->getData())[idx]);
572 case (DATATYPE_SINT32):
573 retval =
static_cast<DTYPE
>(
static_cast<const long *
>(channel->getData())[idx]);
575 case (DATATYPE_UINT32):
576 retval =
static_cast<DTYPE
>(
static_cast<const unsigned long *
>(channel->getData())[idx]);
578 case (DATATYPE_SINT16):
579 retval =
static_cast<DTYPE
>(
static_cast<const short *
>(channel->getData())[idx]);
581 case (DATATYPE_UINT16):
582 retval =
static_cast<DTYPE
>(
static_cast<const unsigned short *
>(channel->getData())[idx]);
584 case (DATATYPE_SINT8):
585 retval =
static_cast<DTYPE
>(
static_cast<const char *
>(channel->getData())[idx]);
587 case (DATATYPE_UINT8):
588 retval =
static_cast<DTYPE
>(
static_cast<const unsigned char *
>(channel->getData())[idx]);
590 case (DATATYPE_SINT64):
591 retval =
static_cast<DTYPE
>(
static_cast<const GIntBig *
>(channel->getData())[idx]);
593 case (DATATYPE_UINT64):
594 retval =
static_cast<DTYPE
>(
static_cast<const GUIntBig *
>(channel->getData())[idx]);
virtual ossim_uint32 getNumberOfDecimationLevels() const
Returns the number of decimation levels.
virtual void loadBand(const void *src, const ossimIrect &src_rect, ossim_uint32 band)
virtual bool isSourceEnabled() const
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
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 bool open()
Open method.
Represents serializable keyword/value map.
virtual ossimString getClassName() const
Returns class name.
RTTI_DEF1_INST(ossimMG4LidarReader, "ossimMG4LidarReader", ossimImageHandler) ossimMG4LidarReader
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 height() const
virtual void closeEntry()
Method to close current entry.
virtual bool isOpen() const
Method to test for open file stream.
virtual bool isGeographic() const
const ossimIpt & ul() const
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
bool intersects(const ossimIrect &rect) const
ossimScalarType m_scalarType
virtual bool extendGeometry(ossimImageHandler *handler) const
virtual void initialize()
Initialize the data buffer.
virtual void setMetersPerPixel(const ossimDpt &gsd)
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
bool completely_within(const ossimIrect &rect) const
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry() const
ossim_uint32 m_numberOfSamples
Has sub image offset.
ossim_uint32 m_numberOfLines
static ossimImageDataFactory * instance()
ossimProjection * getGeoProjection()
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Gets the number of samples for res level.
void getDataType(ossim_int32 channelId)
virtual ossimDataObjectStatus validate() const
unsigned int ossim_uint32
virtual ossimString getShortName() const
Returns short name.
virtual void close()
Deletes the overview and clears the valid image vertices.
static ossimString downcase(const ossimString &aString)
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
ossimIrect clipToRect(const ossimIrect &rect) const
virtual ~ossimMG4LidarReader()
virtural destructor
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.
static ossimProjectionFactoryRegistry * instance()
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual void makeBlank()
Initializes data to null pixel values.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual void completeOpen()
Will complete the opening process.
ossimRefPtr< ossimImageHandler > theOverview
void openZoomLevel(ossim_int32 zoom)
ossimRefPtr< ossimImageData > m_tile
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimString getLongName() const
Returns long name.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual void setUlTiePoints(const ossimGpt &gpt)
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
virtual void setScalarType(ossimScalarType type)
See ossimScalarType in ossimConstants for a full list.
ossimMG4LidarReader()
default construtor
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Method to grab a tile(rectangle) from image.
MG4PointReader * m_reader
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
const DTYPE getChannelElement(const ChannelData *channel, size_t idx)
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Gets number of lines for res level.