[Liblas-commits] r1065 - in trunk: include/liblas python/tests src
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Feb 20 22:11:44 EST 2009
Author: hobu
Date: Fri Feb 20 22:11:44 2009
New Revision: 1065
URL: http://liblas.org/changeset/1065
Log:
make ResetVLRs private, clean up SetGeoreference
Modified:
trunk/include/liblas/lassrs.hpp
trunk/python/tests/Header.txt
trunk/python/tests/SRS.txt
trunk/src/las_c_api.cpp
trunk/src/lasheader.cpp
trunk/src/lassrs.cpp
Modified: trunk/include/liblas/lassrs.hpp
==============================================================================
--- trunk/include/liblas/lassrs.hpp (original)
+++ trunk/include/liblas/lassrs.hpp Fri Feb 20 22:11:44 2009
@@ -107,14 +107,6 @@
/// you have libgeotiff linked in.
const GTIF* GetGTIF();
- /// Reset the VLRs of the LASSRS using the existing GTIF* and ST_TIF*
- /// Until this method is called,
- /// the LASSRS will only contain a SRS description using the VLRs
- /// that it was first instantiated with. SetWKT and SetProj4 can
- /// be used to change the GTIF*
- void ResetVLRs();
-
-
/// Returns the OGC WKT describing Spatial Reference System.
/// If GDAL is linked, it uses GDAL's operations and methods to determine
/// the WKT. If GDAL is not linked, no WKT is returned.
@@ -160,6 +152,13 @@
std::vector<LASVLR> m_vlrs;
bool IsGeoVLR(const LASVLR& vlr) const;
+
+ /// Reset the VLRs of the LASSRS using the existing GTIF* and ST_TIF*
+ /// Until this method is called,
+ /// the LASSRS will only contain a SRS description using the VLRs
+ /// that it was first instantiated with. SetWKT and SetProj4 can
+ /// be used to change the GTIF*
+ void ResetVLRs();
protected:
Modified: trunk/python/tests/Header.txt
==============================================================================
--- trunk/python/tests/Header.txt (original)
+++ trunk/python/tests/Header.txt Fri Feb 20 22:11:44 2009
@@ -1,7 +1,9 @@
>>> from liblas import header
- >>> h = header.Header()
+ >>> import liblas
+ >>> h = header.Header()
+
>>> h.dataformat_id
0
@@ -92,7 +94,15 @@
>>> h.header_size
227
+
+ >>> def test_srs():
+ ... s = h.srs
+ ... if not liblas.HAVE_GDAL:
+ ... return s.proj4 == '+to_meter=1.0000000000'
+ ... if liblas.HAVE_GDAL:
+ ... return s.proj4 == ''
+ ... return False
- >>> s = h.srs
- >>> s.proj4
- ''
\ No newline at end of file
+ >>> test_srs()
+ True
+
Modified: trunk/python/tests/SRS.txt
==============================================================================
--- trunk/python/tests/SRS.txt (original)
+++ trunk/python/tests/SRS.txt Fri Feb 20 22:11:44 2009
@@ -1,4 +1,16 @@
>>> from liblas import srs
+ >>> import liblas
>>> s = srs.SRS()
>>> s.proj4
- ''
\ No newline at end of file
+ ''
+ >>> s.proj4 = '+proj=utm +zone=15 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
+
+ >>> def test_srs():
+ ... if not liblas.HAVE_GDAL:
+ ... return s.proj4 == '+proj=tmerc +lat_0=0.000000000 +lon_0=-93.000000000 +k=0.999600 +x_0=500000.000 +y_0=0.000 +ellps=WGS84 +units=m '
+ ... if liblas.HAVE_GDAL:
+ ... return s.proj4 == '+proj=utm +zone=15 +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
+ ... return False
+
+ >>> test_srs()
+ True
\ No newline at end of file
Modified: trunk/src/las_c_api.cpp
==============================================================================
--- trunk/src/las_c_api.cpp (original)
+++ trunk/src/las_c_api.cpp Fri Feb 20 22:11:44 2009
@@ -1748,21 +1748,6 @@
return LE_None;
}
-LAS_DLL LASErrorEnum LASSRS_ResetVLRs(LASSRSH hSRS) {
-
- VALIDATE_POINTER1(hSRS, "LASSRS_ResetVLRs", LE_Failure);
-
- try {
- ((LASSRS*) hSRS)->ResetVLRs();
- }
- catch (std::exception const& e) {
- LASError_PushError(LE_Failure, e.what(), "LASSRS_ResetVLRs");
- return LE_Failure;
- }
-
-
- return LE_None;
-}
LAS_DLL LASErrorEnum LASHeader_SetSRS(LASHeaderH hHeader, const LASSRSH hSRS) {
Modified: trunk/src/lasheader.cpp
==============================================================================
--- trunk/src/lasheader.cpp (original)
+++ trunk/src/lasheader.cpp Fri Feb 20 22:11:44 2009
@@ -742,31 +742,10 @@
}
void LASHeader::SetGeoreference()
-{
-// #ifndef HAVE_LIBGEOTIFF
-//
-// ;
-//
-// #else
-//
- m_srs.SetVLRs(m_vlrs);
- if (!m_srs.GetVLRs().size())
- {
- if (!m_proj4.empty() )
- {
- m_srs.SetProj4(m_proj4);
- }
- else
- {
- return ;
- }
-
- }
-
- m_srs.ResetVLRs();
-
+{
std::vector<LASVLR> vlrs = m_srs.GetVLRs();
+ // Wipe the GeoTIFF-related VLR records off of the LASHeader
ClearGeoKeyVLRs();
std::vector<LASVLR>::const_iterator i;
@@ -776,7 +755,6 @@
AddVLR(*i);
}
-// #endif // HAVE_LIBGEOTIFF
}
LASSRS LASHeader::GetSRS() const
Modified: trunk/src/lassrs.cpp
==============================================================================
--- trunk/src/lassrs.cpp (original)
+++ trunk/src/lassrs.cpp Fri Feb 20 22:11:44 2009
@@ -371,7 +371,7 @@
void LASSRS::SetWKT(std::string const& v)
{
- // if (! m_gtiff ) GetGTIF(); ResetVLRs();
+ if (! m_gtiff ) GetGTIF();
#ifdef HAVE_GDAL
@@ -384,6 +384,7 @@
{
throw std::runtime_error("The geotiff keys could not be written");
}
+ ResetVLRs();
#else
throw std::runtime_error("GDAL is not available, LASSRS could not be set from WKT");
@@ -442,7 +443,7 @@
void LASSRS::SetProj4(std::string const& v)
{
- // if (! m_gtiff ) GetGTIF(); ResetVLRs();
+ if (! m_gtiff ) GetGTIF(); ResetVLRs();
#ifdef HAVE_GDAL
@@ -500,6 +501,7 @@
}
#endif
#endif
+ ResetVLRs();
;
}
More information about the Liblas-commits
mailing list