Przeglądaj źródła

Merge https://trac.osgeo.org/grass/changeset/31283 from 6.4

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@31456 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 17 lat temu
rodzic
commit
d320438362
3 zmienionych plików z 28 dodań i 24 usunięć
  1. 8 8
      lib/init/epsg_option.tcl
  2. 3 3
      lib/init/file_option.tcl
  3. 17 13
      lib/init/gis_set.tcl

+ 8 - 8
lib/init/epsg_option.tcl

@@ -49,18 +49,18 @@
 #############################################################################
 
 namespace eval epsgOpt {
-	variable browsedepsg #path to EPSG code file
-	variable epsgLocation #name of new location to be created
-	variable epsg_code  #EPSG code number
-	variable searchterm #text string searched in EPSG file
+	variable browsedepsg ;#path to EPSG code file
+	variable epsgLocation ;#name of new location to be created
+	variable epsg_code  ;#EPSG code number
+	variable searchterm ;#text string searched in EPSG file
 	variable dir 
-	variable start #starting index for searching EPSG text widget
-	variable epsgtxt #text widget with EPSG definitions and codes
-	variable dtnum #datum transformation number
+	variable start ;#starting index for searching EPSG text widget
+	variable epsgtxt ;#text widget with EPSG definitions and codes
+	variable dtnum ;#datum transformation number
 	global env
 	global database 
 	global refresh
-	global mingw #test to see if we are running a windows version in mingw
+	global mingw ;#test to see if we are running a windows version in mingw
 
 
 }

+ 3 - 3
lib/init/file_option.tcl

@@ -43,11 +43,11 @@
 # 
 #############################################################################
 namespace eval fileOpt {
-	variable fileLocation #name of new location to be created
-	variable filepath  #path to georeferenced file
+	variable fileLocation ;#name of new location to be created
+	variable filepath  ;#path to georeferenced file
 	global env
 	global database 
-	global mingw #test to see if we are running a windows version in mingw
+	global mingw ;#test to see if we are running a windows version in mingw
 	global refresh
 }
 

+ 17 - 13
lib/init/gis_set.tcl

@@ -118,7 +118,6 @@ proc putGRASSRC { filename } {
 
 proc CheckLocation {} {
 	# Returns 0, if location is invalid, 1 othervise.
-	# Are hardcoded / in path's OK? They where here before me :) Maris.
     global database location
     
     set found 0
@@ -138,12 +137,9 @@ proc CheckLocation {} {
     } else {
         cdir $dir
         .frame0.frameNMS.second.entry configure -state disabled
-        if {[file isdirectory "PERMANENT"]} {
-            # All good locations have valid PERMANENT mapset.
-            if {[file exists "$dir/PERMANENT/DEFAULT_WIND"] != 0} {
-                set found 1
-                .frame0.frameNMS.second.entry configure -state normal
-            }
+        if {[file isdirectory "PERMANENT"] && [file exists "$dir/PERMANENT/DEFAULT_WIND"]} {
+            set found 1
+            .frame0.frameNMS.second.entry configure -state normal
         }
     }
     
@@ -151,6 +147,16 @@ proc CheckLocation {} {
     return $found
 }
 
+proc CheckMapset {} {
+	global database location mapset
+	
+	if { $mapset == "" } { return 0; }
+	
+	if { [file exists "$database/$location/$mapset/WIND"] } {
+		return 1
+	}
+	return 0
+}
 
 #############################################################################
 proc gisSetWindow {} {
@@ -483,12 +489,11 @@ proc gisSetWindow {} {
 				0 OK;
 			set mapset ""
             } else {
-                if {[file exists "$database/$location/$mapset/WIND"] == 0} {
+                if {[CheckMapset] == 0} {
                     DialogGen .wrnDlg [G_msg "WARNING: invalid mapset"] warning \
                     [format [G_msg "Warning: <%s> is not a valid mapset"] $mapset] \
                     0 OK;
-                }
-                if { $mapset != "" && [file exists "$database/$location/$mapset/WIND"] != 0} {
+                } else {
                     puts stdout "GISDBASE='$database';"
                     puts stdout "LOCATION_NAME='$location';"
                     puts stdout "MAPSET='$mapset';"
@@ -647,12 +652,11 @@ proc gisSetWindow {} {
 				0 OK;
 			set mapset ""
             } else {
-                if {[file exists "$database/$location/$mapset/WIND"] == 0} {
+                if {[CheckMapset] == 0} {
                     DialogGen .wrnDlg [G_msg "WARNING: invalid mapset"] warning \
                     [format [G_msg "Warning: <%%s> is not a valid mapset"] $mapset] \
                     0 OK;
-                }
-                if { $mapset != "" && [file exists "$database/$location/$mapset/WIND"] != 0} {
+                } else {
                     puts stdout "GISDBASE='$database';"
                     puts stdout "LOCATION_NAME='$location';"
                     puts stdout "MAPSET='$mapset';"