Changeset 30557
- Timestamp:
- Mar 14, 2008, 2:36:49 AM (16 years ago)
- Location:
- grass/trunk/lib/init
- Files:
-
- 2 edited
-
epsg_option.tcl (modified) (2 diffs)
-
file_option.tcl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/lib/init/epsg_option.tcl
r29510 r30557 237 237 [format [G_msg "g.proj returned the following message:\n%s"] $errMsg] \ 238 238 0 OK 239 } elseif {$dtrans ==""} {239 } elseif {$dtrans eq ""} { 240 240 # if nothing written to stdout, there was no choice of 241 241 # datum parameters and we need not do anything more 242 242 243 if {$errMsg !=""} {243 if {$errMsg ne ""} { 244 244 DialogGen .wrnDlg [G_msg "Informational output from g.proj"] info \ 245 245 [format [G_msg "g.proj returned the following informational message:\n%s"] $errMsg] \ … … 265 265 0 OK 266 266 } else { 267 if {$errMsg !=""} {267 if {$errMsg ne ""} { 268 268 DialogGen .wrnDlg [G_msg "Informational output from g.proj"] info \ 269 269 [format [G_msg "g.proj returned the following informational message:\n%s"] $errMsg] \ -
grass/trunk/lib/init/file_option.tcl
r29510 r30557 179 179 global mapset 180 180 181 # create new location from georeferenced file 182 catch {exec g.proj -c georef=$filepath location=$fileLocation} errMsg 181 set dtrans "" 182 catch {set dtrans [exec g.proj --q -c location=$fileLocation georef=$filepath datumtrans=-1]} errMsg 183 183 184 if {[lindex $::errorCode 0] eq "CHILDSTATUS"} { 184 DialogGen .wrnDlg [G_msg "WARNING: Error creating new location"] warning \ 185 [format [G_msg "Error creating new location from georeferenced file. \ 186 g.proj returned following message:\n\n%s"] $errMsg] \ 187 0 OK 188 } else { 185 DialogGen .wrnDlg [G_msg "Error creating location!"] error \ 186 [format [G_msg "g.proj returned the following message:\n%s"] $errMsg] \ 187 0 OK 188 } elseif {$dtrans eq ""} { 189 # if nothing written to stdout, there was no choice of 190 # datum parameters and we need not do anything more 191 192 if {$errMsg ne ""} { 193 DialogGen .wrnDlg [G_msg "Informational output from g.proj"] info \ 194 [format [G_msg "g.proj returned the following informational message:\n%s"] $errMsg] \ 195 0 OK 196 } 189 197 set location $fileLocation 190 198 set mapset "PERMANENT" 191 } 192 199 } else { 200 # user selects datum transform 201 #create dialog that lists datum transforms, asks user to enter a number and press OK 202 set paramset [fileOpt::sel_dtrans $dtrans] 203 204 # operation canceled 205 if {$paramset == -9} {return} 206 207 # create new location from georeferenced file 208 catch {exec g.proj --q -c georef=$filepath location=$fileLocation datumtrans=$paramset} errMsg 209 210 #catch any other errors 211 if {[lindex $::errorCode 0] eq "CHILDSTATUS"} { 212 DialogGen .wrnDlg [G_msg "Error creating location!"] warning \ 213 [format [G_msg "g.proj returned the following message:\n%s"] $errMsg] \ 214 0 OK 215 } else { 216 if {$errMsg ne ""} { 217 DialogGen .wrnDlg [G_msg "Informational output from g.proj"] info \ 218 [format [G_msg "g.proj returned the following informational message:\n%s"] $errMsg] \ 219 0 OK 220 } 221 set location $fileLocation 222 set mapset "PERMANENT" 223 } 224 } 193 225 194 226 return 195 227 196 228 } 229 230 proc fileOpt::sel_dtrans {dtrans} { 231 232 # Dialog for selecting optional datum transform parameters 233 # Argument is stdout from g.proj 234 235 # default is not to specify datum transformation 236 set fileOpt::dtnum 0 237 238 # Create a popup search dialog 239 toplevel .dtrans_sel 240 wm title .dtrans_sel [G_msg "Select datum transformation parameters:"] 241 set row1 [frame .dtrans_sel.frame1] 242 set row3 [frame .dtrans_sel.frame3] 243 244 radiobutton $row1.0 -value 0 -variable fileOpt::dtnum -wraplength 640 -justify left -text [G_msg "Continue without specifying parameters - if used when creating a location, other GRASS modules will use the \"default\" (likely non-optimum) parameters for this datum if necessary in the future."] 245 pack $row1.0 -anchor w 246 247 set dtrans [split $dtrans "\n"] 248 for {set i 0} { $i < [llength $dtrans] } {incr i} { 249 set thisnum [lindex $dtrans $i] 250 if {$thisnum == "---"} { 251 continue 252 } 253 set thisdesc $thisnum. 254 while { [incr i] < [llength $dtrans] && [lindex $dtrans $i] != "---"} { 255 set thisdesc ${thisdesc}\n[lindex $dtrans $i] 256 } 257 radiobutton $row1.$thisnum -variable fileOpt::dtnum -value $thisnum -wraplength 640 -justify left -text $thisdesc 258 pack $row1.$thisnum -anchor w 259 } 260 261 pack $row1 262 263 Button $row3.ok -text [G_msg "OK"] -padx 10 -bd 1 \ 264 -command "destroy .dtrans_sel" 265 pack $row3.ok -side left -padx 3 266 button $row3.cancel -text [G_msg "Cancel"] -padx 10 -bd 1 \ 267 -command "set fileOpt::dtnum -9; destroy .dtrans_sel" 268 pack $row3.cancel -side left -padx 3 269 pack $row3 -anchor center -pady 3 270 271 tkwait window .dtrans_sel 272 return $fileOpt::dtnum 273 274 }
Note:
See TracChangeset
for help on using the changeset viewer.
