[GRASS-SVN] r38636 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 8 05:39:49 EDT 2009


Author: mmetz
Date: 2009-08-08 05:39:49 -0400 (Sat, 08 Aug 2009)
New Revision: 38636

Modified:
   grass/trunk/lib/vector/Vlib/header.c
   grass/trunk/lib/vector/Vlib/init_head.c
   grass/trunk/lib/vector/Vlib/open.c
Log:
initialize and set proj and zone in vector head

Modified: grass/trunk/lib/vector/Vlib/header.c
===================================================================
--- grass/trunk/lib/vector/Vlib/header.c	2009-08-08 09:34:14 UTC (rev 38635)
+++ grass/trunk/lib/vector/Vlib/header.c	2009-08-08 09:39:49 UTC (rev 38636)
@@ -130,7 +130,7 @@
     Vect_set_map_date(Map, "");
     Vect_set_scale(Map, 1);
     Vect_set_comment(Map, "");
-    Vect_set_zone(Map, 0);
+    Vect_set_zone(Map, -1);
     Vect_set_thresh(Map, 0.);
 
     G_debug(1, "Vect__read_head(): vector = %s@%s", Map->name, Map->mapset);
@@ -458,7 +458,6 @@
     return 0;
 }
 
-
 /*!
    \brief Get projection zone from map header
 
@@ -472,21 +471,39 @@
 }
 
 /*!
+   \brief Set projection in map header
+
+   \param Map vector map
+
+   PROJECTION_XY  0 - x,y (Raw imagery),
+   PROJECTION_UTM 1 - UTM   Universal Transverse Mercator,
+   PROJECTION_SP  2 - State Plane (in feet),
+   PROJECTION_LL  3 - Latitude-Longitude
+   
+   \return 0 on success
+ */
+int Vect_set_proj(struct Map_info *Map, int proj)
+{
+    Map->proj = proj;
+    
+    return 0;
+}
+
+/*!
    \brief Get projection from map header
 
    \param Map vector map
 
-   \return PROJECTION_XY  - x,y (Raw imagery),
-   \return PROJECTION_UTM - UTM   Universal Transverse Mercator,
-   \return PROJECTION_SP  - State Plane (in feet),
-   \return PROJECTION_LL  - Latitude-Longitude
+   \return PROJECTION_XY  0 - x,y (Raw imagery),
+   \return PROJECTION_UTM 1 - UTM   Universal Transverse Mercator,
+   \return PROJECTION_SP  2 - State Plane (in feet),
+   \return PROJECTION_LL  3 - Latitude-Longitude
  */
 int Vect_get_proj(const struct Map_info *Map)
 {
     return (Map->proj);
 }
 
-
 /*!
    \brief Query cartographic projection name of vector map
 

Modified: grass/trunk/lib/vector/Vlib/init_head.c
===================================================================
--- grass/trunk/lib/vector/Vlib/init_head.c	2009-08-08 09:34:14 UTC (rev 38635)
+++ grass/trunk/lib/vector/Vlib/init_head.c	2009-08-08 09:39:49 UTC (rev 38636)
@@ -58,11 +58,14 @@
     Map->head.line_3 = NULL;
     Vect_set_comment(Map, "");
 
-    /* scale, zone, threshold */
+    /* scale, threshold */
     Vect_set_scale(Map, 1);
-    Vect_set_zone(Map, 0);
     Vect_set_thresh(Map, 0.0);
 
+    /* proj, zone */
+    Vect_set_proj(Map, -1);
+    Vect_set_zone(Map, -1);
+
     /* support variables */
     Map->plus.Spidx_built = 0;
     Map->plus.release_support = 0;

Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c	2009-08-08 09:34:14 UTC (rev 38635)
+++ grass/trunk/lib/vector/Vlib/open.c	2009-08-08 09:39:49 UTC (rev 38636)
@@ -224,6 +224,9 @@
 	}
     }
     Map->format = format;
+
+    Vect_set_proj(Map, G_projection());
+    Vect_set_zone(Map, G_zone());
     
     /* Read vector head */
     if (!ogr_mapset && Vect__read_head(Map) != 0) {
@@ -234,7 +237,11 @@
 	G_warning(_("Unable to read head file of vector <%s>"),
 		  Vect_get_full_name(Map));
     }
-    
+
+    /* zone not set */
+    if (Vect_get_zone(Map) == -1)
+	Vect_set_zone(Map, G_zone());
+
     G_debug(1, "Level request = %d", level_request);
 
     /* There are only 2 possible open levels, 1 and 2. Try first to open 'support' files
@@ -629,6 +636,9 @@
     Map->head.with_z = with_z;
     Map->plus.do_uplist = 0;
 
+    Vect_set_proj(Map, G_projection());
+    Vect_set_zone(Map, G_zone());
+
     Map->dblnk = Vect_new_dblinks_struct();
 
     return 1;



More information about the grass-commit mailing list