Revision: 76276
http://sourceforge.net/p/brlcad/code/76276
Author: starseeker
Date: 2020-07-07 15:12:58 +0000 (Tue, 07 Jul 2020)
Log Message:
-----------
Break gdal derived code out of plugin into its own file
Modified Paths:
--------------
brlcad/trunk/doc/legal/embedded/CMakeLists.txt
brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt
brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
Added Paths:
-----------
brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin1.txt
brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin2.txt
brlcad/trunk/src/libgcv/plugins/gdal/gdal_ll.cpp
Removed Paths:
-------------
brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin.txt
Modified: brlcad/trunk/doc/legal/embedded/CMakeLists.txt
===================================================================
--- brlcad/trunk/doc/legal/embedded/CMakeLists.txt 2020-07-07 14:26:00 UTC
(rev 76275)
+++ brlcad/trunk/doc/legal/embedded/CMakeLists.txt 2020-07-07 15:12:58 UTC
(rev 76276)
@@ -19,7 +19,8 @@
fontstash.txt
gct.txt
gecode.txt
- gdal_gcv_plugin.txt
+ gdal_gcv_plugin1.txt
+ gdal_gcv_plugin2.txt
halfedge.txt
humanize.txt
hv3.txt
Deleted: brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin.txt
===================================================================
--- brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin.txt 2020-07-07 14:26:00 UTC
(rev 76275)
+++ brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin.txt 2020-07-07 15:12:58 UTC
(rev 76276)
@@ -1,21 +0,0 @@
-Copyright (c) 2013 Tom Browder
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-
-file:/src/libgcv/plugins/gdal/gdal.cpp
Copied: brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin1.txt (from rev 76275,
brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin.txt)
===================================================================
--- brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin1.txt
(rev 0)
+++ brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin1.txt 2020-07-07
15:12:58 UTC (rev 76276)
@@ -0,0 +1,21 @@
+Copyright (c) 2013 Tom Browder
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+file:/src/libgcv/plugins/gdal/gdal.cpp
Added: brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin2.txt
===================================================================
--- brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin2.txt
(rev 0)
+++ brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin2.txt 2020-07-07
15:12:58 UTC (rev 76276)
@@ -0,0 +1,23 @@
+Copyright (c) 1998, Frank Warmerdam
+Copyright (c) 2007-2015, Even Rouault <even.rouault at spatialys.com>
+Copyright (c) 2015, Faza Mahamood
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+file:/src/libgcv/plugins/gdal/gdal_ll.cpp
Property changes on: brlcad/trunk/doc/legal/embedded/gdal_gcv_plugin2.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt 2020-07-07 14:26:00 UTC
(rev 76275)
+++ brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt 2020-07-07 15:12:58 UTC
(rev 76276)
@@ -1,6 +1,6 @@
if(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
include_directories(SYSTEM ${GDAL_INCLUDE_DIR})
- LIBGCV_ADD_PLUGIN(gdal "gdal.cpp" "librt;libbu;${GDAL_LIBRARY}")
+ LIBGCV_ADD_PLUGIN(gdal "gdal.cpp;gdal_ll.cpp" "librt;libbu;${GDAL_LIBRARY}")
endif(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
CMAKEFILES(gdal.cpp)
Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2020-07-07 14:26:00 UTC
(rev 76275)
+++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2020-07-07 15:12:58 UTC
(rev 76276)
@@ -61,6 +61,9 @@
#include "gcv/util.h"
#include "wdb.h"
+// Function based on gdalinfo code
+extern int gdal_ll(GDALDatasetH hDataset, double *lat_center, double
*long_center);
+
struct gdal_read_options
{
const char *proj;
@@ -118,78 +121,6 @@
return 1;
}
-/* Pull the latitude and longitude out of the dataset. Based on gdalinfo
code, so
- * this function (gdal_ll) is:
- *
- * Copyright (c) 1998, Frank Warmerdam
- * Copyright (c) 2007-2015, Even Rouault <even.rouault at spatialys.com>
- * Copyright (c) 2015, Faza Mahamood
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-HIDDEN int
-gdal_ll(GDALDatasetH hDataset, double *lat_center, double *long_center)
-{
- double longitude, latitude;
- double adfGeoTransform[6];
- const char *pzp = NULL;
- OGRCoordinateTransformationH htfm = NULL;
- double gx = GDALGetRasterXSize(hDataset)/2.0;
- double gy = GDALGetRasterYSize(hDataset)/2.0;
- if(GDALGetGeoTransform(hDataset, adfGeoTransform) == CE_None ) {
- longitude = adfGeoTransform[0] + adfGeoTransform[1] * gx +
adfGeoTransform[2] * gy;
- latitude = adfGeoTransform[3] + adfGeoTransform[4] * gx +
adfGeoTransform[5] * gy;
- pzp = GDALGetProjectionRef(hDataset);
- } else {
- return 0;
- }
-
- if(pzp != NULL && strlen(pzp) > 0) {
- OGRSpatialReferenceH hpj, hll = NULL;
- hpj = OSRNewSpatialReference( pzp );
- if(hpj != NULL) hll = OSRCloneGeogCS(hpj);
- if(hll != NULL) {
- CPLPushErrorHandler(CPLQuietErrorHandler);
- /* The bit we need... */
- htfm = OCTNewCoordinateTransformation(hpj, hll);
- CPLPopErrorHandler();
- OSRDestroySpatialReference(hll);
- }
- if(hpj != NULL) OSRDestroySpatialReference(hpj);
- }
-
- if(htfm != NULL) {
- if (OCTTransform(htfm,1,&longitude,&latitude,NULL)) {
- if (lat_center) (*lat_center) = latitude;
- if (long_center) (*long_center) = longitude;
- } else {
- return 0;
- }
- } else {
- if (lat_center) (*lat_center) = latitude;
- if (long_center) (*long_center) = longitude;
- }
- bu_log("lat: %f, long: %f\n", latitude, longitude);
-
- return 1;
-}
-
HIDDEN void
gdal_elev_minmax(GDALDatasetH ds)
{
Added: brlcad/trunk/src/libgcv/plugins/gdal/gdal_ll.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/gdal_ll.cpp
(rev 0)
+++ brlcad/trunk/src/libgcv/plugins/gdal/gdal_ll.cpp 2020-07-07 15:12:58 UTC
(rev 76276)
@@ -0,0 +1,95 @@
+/* Pull the latitude and longitude out of the dataset. Based on gdalinfo
code, so
+ * this function (gdal_ll) is:
+ *
+ * Copyright (c) 1998, Frank Warmerdam
+ * Copyright (c) 2007-2015, Even Rouault <even.rouault at spatialys.com>
+ * Copyright (c) 2015, Faza Mahamood
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "common.h"
+
+/* GDAL headers */
+#include <gdal.h>
+#include <gdalwarper.h>
+#include <gdal_utils.h>
+#include <cpl_conv.h>
+#include <cpl_string.h>
+#include <cpl_multiproc.h>
+#include <ogr_spatialref.h>
+#include "vrtdataset.h"
+
+#include "bu/log.h"
+
+int
+gdal_ll(GDALDatasetH hDataset, double *lat_center, double *long_center)
+{
+ double longitude, latitude;
+ double adfGeoTransform[6];
+ const char *pzp = NULL;
+ OGRCoordinateTransformationH htfm = NULL;
+ double gx = GDALGetRasterXSize(hDataset)/2.0;
+ double gy = GDALGetRasterYSize(hDataset)/2.0;
+ if(GDALGetGeoTransform(hDataset, adfGeoTransform) == CE_None ) {
+ longitude = adfGeoTransform[0] + adfGeoTransform[1] * gx +
adfGeoTransform[2] * gy;
+ latitude = adfGeoTransform[3] + adfGeoTransform[4] * gx +
adfGeoTransform[5] * gy;
+ pzp = GDALGetProjectionRef(hDataset);
+ } else {
+ return 0;
+ }
+
+ if(pzp != NULL && strlen(pzp) > 0) {
+ OGRSpatialReferenceH hpj, hll = NULL;
+ hpj = OSRNewSpatialReference( pzp );
+ if(hpj != NULL) hll = OSRCloneGeogCS(hpj);
+ if(hll != NULL) {
+ CPLPushErrorHandler(CPLQuietErrorHandler);
+ /* The bit we need... */
+ htfm = OCTNewCoordinateTransformation(hpj, hll);
+ CPLPopErrorHandler();
+ OSRDestroySpatialReference(hll);
+ }
+ if(hpj != NULL) OSRDestroySpatialReference(hpj);
+ }
+
+ if(htfm != NULL) {
+ if (OCTTransform(htfm,1,&longitude,&latitude,NULL)) {
+ if (lat_center) (*lat_center) = latitude;
+ if (long_center) (*long_center) = longitude;
+ } else {
+ return 0;
+ }
+ } else {
+ if (lat_center) (*lat_center) = latitude;
+ if (long_center) (*long_center) = longitude;
+ }
+ bu_log("lat: %f, long: %f\n", latitude, longitude);
+
+ return 1;
+}
+
+// Local Variables:
+// tab-width: 8
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: t
+// c-file-style: "stroustrup"
+// End:
+// ex: shiftwidth=4 tabstop=8
Property changes on: brlcad/trunk/src/libgcv/plugins/gdal/gdal_ll.cpp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits