Changeset 628:83050d993186
- Timestamp:
- 05/09/08 14:04:07 (2 years ago)
- Branch:
- default
- Convert:
- svn:1766ff46-f334-0410-ab20-d63176f87757/trunk@695
- Location:
- src/detail
- Files:
-
- 2 edited
-
Makefile.am (modified) (1 diff)
-
reader10.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/detail/Makefile.am
r330 r628 1 1 2 INCLUDES = -I../../include -I../../include/detail 2 #if LIBGEOTIFF_IS_CONFIG 3 EXTRA_DEFS = -DHAVE_LIBGEOTIFF 4 #endif 5 6 INCLUDES = -I../../include -I../../include/detail @GEOTIFF_INC@ $(EXTRA_DEFS) 3 7 4 8 noinst_LTLIBRARIES = liblasdetail.la -
src/detail/reader10.cpp
r588 r628 45 45 #include <liblas/lasheader.hpp> 46 46 #include <liblas/laspoint.hpp> 47 48 #ifdef HAVE_LIBGEOTIFF 49 #include <geotiff.h> 50 #include <geo_simpletags.h> 51 #endif /* HAVE_LIBGEOTIFF */ 52 47 53 // std 48 54 #include <fstream> … … 203 209 // TODO: Under construction 204 210 // Testing reading of VLRecords with GeoKeys 205 //ReadGeoreference(header);211 ReadGeoreference(header); 206 212 207 213 return true; … … 210 216 bool ReaderImpl::ReadGeoreference(LASHeader const& header) 211 217 { 218 #ifndef HAVE_LIBGEOTIFF 219 return false; 220 #else 212 221 // TODO: Under construction 213 214 222 VLRHeader vlrh = { 0 }; 215 223 std::string const uid("LASF_Projection"); 224 ST_TIFF *st = ST_Create(); 216 225 217 226 m_ifs.seekg(header.GetHeaderSize(), std::ios::beg); … … 223 232 if (uid == vlrh.userId && 34735 == vlrh.recordId) 224 233 { 225 std::cout << "GeoKeyDirectoryTag: " << vlrh.recordId << std::endl; 226 227 GeoKeysHeader gkh = { 0 }; 228 read_n(gkh, m_ifs, sizeof(GeoKeysHeader)); 229 230 std::cout << "--Header: " << gkh.keyDirectoryVersion << " ; " << gkh.keyRevision << " ; " << gkh.minorRevision << " ; " << gkh.numberOfKeys << std::endl; 231 232 for (uint16_t j = 0; j < gkh.numberOfKeys; ++j) 233 { 234 GeoKeyEntry gke = { 0 }; 235 read_n(gke, m_ifs, sizeof(GeoKeyEntry)); 236 237 std::cout << "---KeyEntry: " << gke.keyId << " ; " << gke.tiffTagLocation<< " ; " << gke.count << " ; " << gke.valueOffset << std::endl; 238 } 234 int count = vlrh.recordLengthAfterHeader / sizeof(short); 235 uint16_t *geokeys = new uint16_t[count]; 236 read_n(geokeys, m_ifs, vlrh.recordLengthAfterHeader); 237 ST_SetKey( st, vlrh.recordId, count, STT_SHORT, geokeys ); 238 delete[] geokeys; 239 239 } 240 240 else if (uid == vlrh.userId && 34736 == vlrh.recordId) 241 241 { 242 std::cout << "GeoDoubleParamsTag: " << vlrh.recordId << std::endl; 243 242 int count = vlrh.recordLengthAfterHeader / sizeof(double); 243 double *values = new double[count]; 244 read_n(values, m_ifs, vlrh.recordLengthAfterHeader); 245 ST_SetKey( st, vlrh.recordId, count, STT_DOUBLE, values ); 246 delete[] values; 247 } 248 else if (uid == vlrh.userId && 34737 == vlrh.recordId) 249 { 250 int count = vlrh.recordLengthAfterHeader / sizeof(char); 251 char *values = new char[count]; 252 read_n(values, m_ifs, vlrh.recordLengthAfterHeader); 253 ST_SetKey( st, vlrh.recordId, count, STT_ASCII, values ); 254 delete[] values; 255 } 256 else 257 { 244 258 std::istream::pos_type const pos = m_ifs.tellg(); 245 259 m_ifs.seekg(pos + std::istream::pos_type(vlrh.recordLengthAfterHeader)); 246 260 } 247 else if (uid == vlrh.userId && 34737 == vlrh.recordId) 248 { 249 std::cout << "GeoAsciiParamsTag: " << vlrh.recordId << std::endl; 250 251 std::istream::pos_type const pos = m_ifs.tellg(); 252 m_ifs.seekg(pos + std::istream::pos_type(vlrh.recordLengthAfterHeader)); 253 } 254 else 255 { 256 std::istream::pos_type const pos = m_ifs.tellg(); 257 m_ifs.seekg(pos + std::istream::pos_type(vlrh.recordLengthAfterHeader)); 258 } 259 } 260 261 } 262 263 GTIF *gtif = GTIFNewSimpleTags( st ); 264 GTIFPrint(gtif,0,0); 265 GTIFFree( gtif ); 266 ST_Destroy( st ); 267 261 268 return true; 269 #endif /* def HAVE_LIBGEOTIFF */ 262 270 } 263 271
Note: See TracChangeset
for help on using the changeset viewer.
