Changeset 976:a81fe9716c7b
- Timestamp:
- 02/19/09 20:19:21 (18 months ago)
- Branch:
- default
- Convert:
- svn:1766ff46-f334-0410-ab20-d63176f87757/trunk@1054
- Files:
-
- 4 edited
-
include/liblas/capi/liblas.h (modified) (2 diffs)
-
include/liblas/lassrs.hpp (modified) (2 diffs)
-
src/las_c_api.cpp (modified) (4 diffs)
-
src/lassrs.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/liblas/capi/liblas.h
r941 r976 61 61 typedef struct LASVLRHS *LASVLRH; 62 62 typedef struct LASColorHS *LASColorH; 63 typedef struct LASSRSHS *LASSRSH; 64 65 66 /* Fake out the compiler if we don't have libgeotiff */ 67 #ifndef HAVE_LIBGEOTIFF 68 typedef struct GTIFS * GTIF; 69 #else 70 #include <geotiff.h> 71 #endif 72 63 73 64 74 LAS_C_START … … 1057 1067 1058 1068 1069 /****************************************************************************/ 1070 /* SRS Operations */ 1071 /****************************************************************************/ 1072 1073 /** Creates a new SRS 1074 * @return a new SRS 1075 */ 1076 LAS_DLL LASSRSH LASSRS_Create(void); 1077 1078 1079 LAS_DLL const GTIF* LASSRS_GetGTIF(LASSRSH hSRS); 1080 LAS_DLL char* LASSRS_GetWKT(LASSRSH hSRS); 1081 LAS_DLL LASError LASSRS_SetWKT(LASSRSH hSRS, const char* value); 1082 LAS_DLL char* LASSRS_GetProj4(LASSRSH hSRS); 1083 LAS_DLL LASError LASSRS_SetProj4(LASSRSH hSRS, const char* value); 1084 1085 1059 1086 LAS_C_END 1060 1087 #endif -
include/liblas/lassrs.hpp
r975 r976 147 147 void SetVLRs(const std::vector<LASVLR>& vlrs); 148 148 149 /// Add a VLR representing GeoTIFF keys to the SRS 150 void AddVLR(const LASVLR& vlr); 151 149 152 /// Return a copy of the LASVLRs that LASSRS maintains 150 153 std::vector<LASVLR> GetVLRs() const; … … 157 160 158 161 std::vector<LASVLR> m_vlrs; 162 bool IsGeoVLR(const LASVLR& vlr) const; 163 159 164 160 165 protected: -
src/las_c_api.cpp
r934 r976 50 50 #include <liblas/lasrecordheader.hpp> 51 51 #include <liblas/guid.hpp> 52 #include <liblas/lassrs.hpp> 52 53 #include <liblas/capi/las_config.h> 53 54 #include <liblas/capi/las_version.h> … … 60 61 typedef struct LASVLRHS *LASVLRH; 61 62 typedef struct LASColorHS *LASColorH; 62 63 typedef struct LASSRSHS *LASSRSH; 63 64 64 65 … … 73 74 #include <vector> 74 75 #include <cstdio> 76 75 77 using namespace liblas; 76 78 … … 1674 1676 } 1675 1677 1678 LAS_DLL LASSRSH LASSRS_Create(void) { 1679 return (LASSRSH) new LASSRS(); 1680 } 1681 1682 LAS_DLL void LASSRS_Destroy(LASSRSH hSRS){ 1683 VALIDATE_POINTER0(hSRS, "LASSRS_Destroy"); 1684 delete (LASSRS*)hSRS; 1685 hSRS = NULL; 1686 } 1687 1688 LAS_DLL const GTIF* LASSRS_GetGTIF(LASSRSH hSRS) { 1689 VALIDATE_POINTER1(hSRS, "LASSRS_GetGTIF", 0); 1690 1691 try { 1692 return ((LASSRS*) hSRS)->GetGTIF(); 1693 } 1694 catch (std::exception const& e) { 1695 LASError_PushError(LE_Failure, e.what(), "LASSRS_GetGTIF"); 1696 return 0; 1697 } 1698 } 1699 1700 LAS_DLL char* LASSRS_GetProj4(LASSRSH hSRS) 1701 { 1702 VALIDATE_POINTER1(hSRS, "LASSRS_GetProj4", NULL); 1703 LASSRS* srs = (LASSRS*)hSRS; 1704 1705 return strdup((srs)->GetProj4().c_str()); 1706 1707 } 1708 1709 LAS_DLL LASErrorEnum LASSRS_SetProj4(LASSRSH hSRS, const char* value) 1710 { 1711 VALIDATE_POINTER1(hSRS, "LASSRS_SetProj4", LE_Failure); 1712 VALIDATE_POINTER1(value, "LASSRS_SetProj4", LE_Failure); 1713 1714 try { 1715 ((LASSRS*) hSRS)->SetProj4(value); 1716 } 1717 catch (std::exception const& e) { 1718 LASError_PushError(LE_Failure, e.what(), "LASSRS_SetProj4"); 1719 return LE_Failure; 1720 } 1721 1722 return LE_None; 1723 } 1724 1725 LAS_DLL char* LASSRS_GetWKT(LASSRSH hSRS) 1726 { 1727 VALIDATE_POINTER1(hSRS, "LASSRS_GetWKT", NULL); 1728 LASSRS* srs = (LASSRS*)hSRS; 1729 1730 return strdup((srs)->GetWKT().c_str()); 1731 1732 } 1733 1734 LAS_DLL LASErrorEnum LASSRS_SetWKT(LASSRSH hSRS, const char* value) 1735 { 1736 VALIDATE_POINTER1(hSRS, "LASSRS_SetWKT", LE_Failure); 1737 VALIDATE_POINTER1(value, "LASSRS_SetWKT", LE_Failure); 1738 1739 try { 1740 ((LASSRS*) hSRS)->SetWKT(value); 1741 } 1742 catch (std::exception const& e) { 1743 LASError_PushError(LE_Failure, e.what(), "LASSRS_SetWKT"); 1744 return LE_Failure; 1745 } 1746 1747 return LE_None; 1748 } 1749 1750 LAS_DLL LASErrorEnum LASSRS_AddVLR(LASSRSH hSRS, const LASVLRH hVLR) { 1751 1752 VALIDATE_POINTER1(hSRS, "LASSRS_AddVLR", LE_Failure); 1753 VALIDATE_POINTER1(hVLR, "LASSRS_AddVLR", LE_Failure); 1754 1755 try { 1756 ((LASSRS*) hSRS)->AddVLR(*((LASVLR*)hVLR)); 1757 } 1758 catch (std::exception const& e) { 1759 LASError_PushError(LE_Failure, e.what(), "LASSRS_AddVLR"); 1760 return LE_Failure; 1761 } 1762 1763 1764 return LE_None; 1765 } 1766 1767 LAS_DLL LASErrorEnum LASSRS_ResetVLRs(LASSRSH hSRS) { 1768 1769 VALIDATE_POINTER1(hSRS, "LASSRS_ResetVLRs", LE_Failure); 1770 1771 try { 1772 ((LASSRS*) hSRS)->ResetVLRs(); 1773 } 1774 catch (std::exception const& e) { 1775 LASError_PushError(LE_Failure, e.what(), "LASSRS_ResetVLRs"); 1776 return LE_Failure; 1777 } 1778 1779 1780 return LE_None; 1781 } 1782 1676 1783 LAS_C_END 1677 1784 -
src/lassrs.cpp
r975 r976 114 114 for (i = vlrs.begin(); i != vlrs.end(); ++i) 115 115 { 116 //GTIFF_GEOKEYDIRECTORY == 34735 117 if (uid == (*i).GetUserId(true).c_str() && 34735 == (*i).GetRecordId()) { 116 if (IsGeoVLR(*i)) { 118 117 m_vlrs.push_back(*i); 119 118 } 120 121 // GTIFF_DOUBLEPARAMS == 34736 122 if (uid == (*i).GetUserId(true).c_str() && 34736 == (*i).GetRecordId()) { 123 m_vlrs.push_back(*i); 124 } 125 126 // GTIFF_ASCIIPARAMS == 34737 127 if (uid == (*i).GetUserId(true).c_str() && 34737 == (*i).GetRecordId()) { 128 m_vlrs.push_back(*i); 129 } 130 } 119 // //GTIFF_GEOKEYDIRECTORY == 34735 120 // if (uid == (*i).GetUserId(true).c_str() && 34735 == (*i).GetRecordId()) { 121 // m_vlrs.push_back(*i); 122 // } 123 // 124 // // GTIFF_DOUBLEPARAMS == 34736 125 // if (uid == (*i).GetUserId(true).c_str() && 34736 == (*i).GetRecordId()) { 126 // m_vlrs.push_back(*i); 127 // } 128 // 129 // // GTIFF_ASCIIPARAMS == 34737 130 // if (uid == (*i).GetUserId(true).c_str() && 34737 == (*i).GetRecordId()) { 131 // m_vlrs.push_back(*i); 132 // } 133 } 134 } 135 136 void LASSRS::AddVLR(const LASVLR& vlr) 137 { 138 if (IsGeoVLR(vlr)) { 139 m_vlrs.push_back(vlr); 140 } 141 } 142 bool LASSRS::IsGeoVLR(const LASVLR& vlr) const 143 { 144 std::string const uid("LASF_Projection"); 145 if (uid == vlr.GetUserId(true).c_str() && 34735 == vlr.GetRecordId()) { 146 return true; 147 } 148 149 // GTIFF_DOUBLEPARAMS == 34736 150 if (uid == vlr.GetUserId(true).c_str() && 34736 == vlr.GetRecordId()) { 151 return true; 152 } 153 154 // GTIFF_ASCIIPARAMS == 34737 155 if (uid == vlr.GetUserId(true).c_str() && 34737 == vlr.GetRecordId()) { 156 return true; 157 } 158 return false; 131 159 } 132 160 … … 376 404 { 377 405 delete poSRS; 378 throw std::invalid_argument("could not import proj4 into OSRSpatialReference GetProj4"); 379 return FALSE; 406 return std::string(""); 380 407 } 381 408
Note: See TracChangeset
for help on using the changeset viewer.
