[GRASS-SVN] r50521 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 28 07:02:07 EST 2012
Author: martinl
Date: 2012-01-28 04:02:07 -0800 (Sat, 28 Jan 2012)
New Revision: 50521
Modified:
grass/trunk/lib/vector/Vlib/header.c
Log:
vlib: Vect_get_ogr_*() - better check for HAVE_OGR
Modified: grass/trunk/lib/vector/Vlib/header.c
===================================================================
--- grass/trunk/lib/vector/Vlib/header.c 2012-01-28 11:21:43 UTC (rev 50520)
+++ grass/trunk/lib/vector/Vlib/header.c 2012-01-28 12:02:07 UTC (rev 50521)
@@ -259,6 +259,15 @@
*/
const char *Vect_get_ogr_dsn_name(const struct Map_info *Map)
{
+#ifndef HAVE_OGR
+ G_warning(_("GRASS is not compiled with OGR support"));
+#else
+ if (Map->format != GV_FORMAT_OGR &&
+ Map->format != GV_FORMAT_OGR_DIRECT)
+ G_warning(_("Format of vector map <%s> is not OGR"),
+ Vect_get_full_name(Map));
+#endif
+
return Map->fInfo.ogr.dsn;
}
@@ -271,6 +280,15 @@
*/
const char *Vect_get_ogr_layer_name(const struct Map_info *Map)
{
+#ifndef HAVE_OGR
+ G_warning(_("GRASS is not compiled with OGR support"));
+#else
+ if (Map->format != GV_FORMAT_OGR &&
+ Map->format != GV_FORMAT_OGR_DIRECT)
+ G_warning(_("Format of vector map <%s> is not OGR"),
+ Vect_get_full_name(Map));
+#endif
+
return Map->fInfo.ogr.layer_name;
}
@@ -286,12 +304,20 @@
*/
const char *Vect_get_ogr_format_info(const struct Map_info *Map)
{
-#ifdef HAVE_OGR
+#ifndef HAVE_OGR
+ G_warning(_("GRASS is not compiled with OGR support"));
+#else
+ if (Map->format != GV_FORMAT_OGR &&
+ Map->format != GV_FORMAT_OGR_DIRECT)
+ G_warning(_("Format of vector map <%s> is not OGR"),
+ Vect_get_full_name(Map));
+
if (!Map->fInfo.ogr.ds)
return NULL;
return G_store(OGR_Dr_GetName(OGR_DS_GetDriver(Map->fInfo.ogr.ds)));
#endif
+
return NULL;
}
@@ -305,10 +331,17 @@
*/
const char *Vect_get_ogr_geometry_type(const struct Map_info *Map)
{
-#ifdef HAVE_OGR
+#ifndef HAVE_OGR
+ G_warning(_("GRASS is not compiled with OGR support"));
+#else
OGRwkbGeometryType Ogr_geom_type;
OGRFeatureDefnH Ogr_feature_defn;
+ if (Map->format != GV_FORMAT_OGR &&
+ Map->format != GV_FORMAT_OGR_DIRECT)
+ G_warning(_("Format of vector map <%s> is not OGR"),
+ Vect_get_full_name(Map));
+
if (!Map->fInfo.ogr.layer)
return NULL;
@@ -317,6 +350,7 @@
return OGRGeometryTypeToName(Ogr_geom_type);
#endif
+
return NULL;
}
More information about the grass-commit
mailing list