panel_main.tcl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. ##########################################################################
  2. #
  3. # Main panel and display controls for NVIZ
  4. # Probably originally written written ca. 1994 by
  5. # U.S. Army Construction Engineering Research Laboratory
  6. #
  7. # Updates 2005 by Massimo Cuomo, ACS - m.cuomo at acsys.it
  8. # Major update of GUI Nov 2006, Michael Barton, Arizona State University
  9. #
  10. ##########################################################################
  11. # COPYRIGHT: (C) 2006 by Michael Barton and the GRASS Development Team
  12. #
  13. # This program is free software under the GNU General Public
  14. # License (>=v2). Read the file COPYING that comes with GRASS
  15. # for details.
  16. #
  17. ##########################################################################
  18. # Default Priority for this panel
  19. #
  20. # priority is from 0 to 10
  21. # the lower the number, the quicker it will be bumped
  22. # 10 cannot be bumped
  23. # Panels will be loaded by the greater of 5 or their current priority
  24. #*** ACS_MODIFY 1.0 BEGIN ******************************************************
  25. # flags to enable(1)/disable(0) added FlyThrough Functions
  26. set Nv_(FlyThrough) 1
  27. if {$Nv_(FlyThrough)} {source $src_boot/etc/nviz2.2/scripts/flythrough.tcl}
  28. ###########################################################################
  29. # procedure to make main control area
  30. ###########################################################################
  31. global arw_clr arw_text_clr
  32. global src_boot
  33. source $src_boot/etc/nviz2.2/scripts/config.tcl
  34. proc mkmainPanel { BASE } {
  35. global Nv_
  36. global XY
  37. #Globals for draw features
  38. global surface vector sites volume
  39. global legend labels n_arrow scalebar
  40. global fringe fringe_elev fringe_color
  41. global n_arrow_x n_arrow_y n_arrow_z
  42. global arw_clr arw_text_clr
  43. global scalebar_x scalebar_y scalebar_z
  44. global bar_clr bar_text_clr
  45. global fringe_nw fringe_ne fringe_sw fringe_se
  46. global Nauto_draw
  47. #Set defaults
  48. set surface 1
  49. set vector 1
  50. set sites 1
  51. set volume 1
  52. set legend 0
  53. set labels 0
  54. set n_arrow 0
  55. set scalebar 0
  56. set fringe 0
  57. set fringe_color #AAAAAA
  58. #Set North Arrow defaults
  59. set n_arrow_x 999
  60. set n_arrow_y 999
  61. set n_arrow_z 999
  62. set arw_clr #000000
  63. set arw_text_clr #DDDDDD
  64. #Set Scalebar defaults
  65. set scalebar_x 999
  66. set scalebar_y 999
  67. set scalebar_z 999
  68. set bar_clr #000000
  69. set bar_text_clr #DDDDDD
  70. set Nv_(cursor) [$Nv_(TOP) cget -cursor]
  71. catch {destroy $BASE}
  72. # Initialize panel info
  73. if [catch {set Nv_($BASE)}] {
  74. set panel [St_create {window name size priority} $BASE "Main" 1 10]
  75. } else {
  76. set panel $Nv_($BASE)
  77. }
  78. frame $BASE -relief flat -borderwidth 0
  79. set Nv_(main_BASE) $BASE
  80. # make redraw button area
  81. pack [frame $BASE.redrawf -bd 1 -relief flat ] -padx 3 -pady 5 -side top -fill x -expand 1
  82. # frame for draw, clear, cancel buttons
  83. pack [frame $BASE.redrawf.f2 -relief flat -bd 0] -side top -fill x -expand 1
  84. # frame for auto checkbuttons
  85. pack [frame $BASE.redrawf.f1 -relief flat -bd 0] -side top -fill x -expand 1
  86. # frame for features to display menu buttons
  87. pack [frame $BASE.redrawf.f11 -relief flat -bd 0] -side top -fill x -expand 1
  88. #Execute buttons
  89. set drawbtn [button $BASE.redrawf.f2.exec -text DRAW -bd 1 -fg "darkgreen"]
  90. bind $drawbtn <1> "Nset_cancel 0"
  91. bind $drawbtn <B1-ButtonRelease> {Ndraw_all}
  92. help $drawbtn balloon "Draw selected features"
  93. set clearbtn [button $BASE.redrawf.f2.clear -text Clear -bd 1 -command {do_clear}]
  94. help $clearbtn balloon "Clear NVIZ display"
  95. set cancelbtn [button $BASE.redrawf.f2.cancel -text Cancel -bd 1 -command {Nset_cancel 1}]
  96. help $cancelbtn balloon "Cancel current draw"
  97. pack $drawbtn $clearbtn $cancelbtn \
  98. -side left -expand 1 -fill x
  99. # Auto check boxes
  100. set labl1 [label $BASE.redrawf.f1.label1 -text "Automatically render display:" -anchor w]
  101. set auto_d [checkbutton $BASE.redrawf.f1.autodraw \
  102. -onvalue 1 -offvalue 0 -variable Nauto_draw \
  103. -justify left -anchor center -padx 5]
  104. help $BASE.redrawf.f1.autodraw balloon "Automatically render display after changing parameters"
  105. $auto_d select
  106. pack $labl1 $auto_d -side left -expand 0 -fill x -pady 3
  107. #checkbuttons for features to draw
  108. set labl2 [label $BASE.redrawf.f11.label1 -text "Show features:" -anchor w]
  109. menubutton $BASE.redrawf.f11.m1 -menu $BASE.redrawf.f11.m1.m \
  110. -text "Main features..." -underline 0 -justify left \
  111. -indicator on -anchor center -relief raised -bd 1
  112. help $BASE.redrawf.f11.m1 balloon "Select main draw features"
  113. menubutton $BASE.redrawf.f11.m2 -menu $BASE.redrawf.f11.m2.m \
  114. -text "Decorations..." -underline 0 -justify left \
  115. -indicator on -anchor center -relief raised -bd 1
  116. help $BASE.redrawf.f11.m2 balloon "Select misc. draw features"
  117. menu $BASE.redrawf.f11.m1.m
  118. $BASE.redrawf.f11.m1.m add checkbutton -label "Surface" \
  119. -onvalue 1 -offvalue 0 -variable surface
  120. $BASE.redrawf.f11.m1.m add checkbutton -label "Vectors" \
  121. -onvalue 1 -offvalue 0 -variable vector
  122. $BASE.redrawf.f11.m1.m add checkbutton -label "Sites" \
  123. -onvalue 1 -offvalue 0 -variable sites
  124. $BASE.redrawf.f11.m1.m add checkbutton -label "Volumes" \
  125. -onvalue 1 -offvalue 0 -variable volume
  126. menu $BASE.redrawf.f11.m2.m
  127. $BASE.redrawf.f11.m2.m add checkbutton -label "Legend" \
  128. -onvalue 1 -offvalue 0 -variable legend
  129. $BASE.redrawf.f11.m2.m add checkbutton -label "Labels" \
  130. -onvalue 1 -offvalue 0 -variable labels
  131. $BASE.redrawf.f11.m2.m add checkbutton -label "North Arrow" \
  132. -onvalue 1 -offvalue 0 -variable n_arrow
  133. $BASE.redrawf.f11.m2.m add checkbutton -label "Scale Bar" \
  134. -onvalue 1 -offvalue 0 -variable scalebar
  135. $BASE.redrawf.f11.m2.m add checkbutton -label "Fringe" \
  136. -onvalue 1 -offvalue 0 -variable fringe
  137. pack $labl2 $BASE.redrawf.f11.m1 $BASE.redrawf.f11.m2 -side left \
  138. -expand 1 -fill x
  139. #pack frames
  140. pack [frame $BASE.midt -relief flat -bd 0] -side top -expand 1 -fill x -padx 5 -pady 5
  141. pack [frame $BASE.midf -relief flat -bd 0] -side left -expand 1 -padx 5
  142. # set view method radiobuttons
  143. set draw_lab [label $BASE.midt.lablev1 -text "View method:" -anchor w]
  144. set draw_var1 [radiobutton $BASE.midt.b1 -text "eye" \
  145. -variable draw_option -value 0 -width 8 \
  146. -command "change_display 1" ]
  147. set draw_var2 [radiobutton $BASE.midt.b2 -text "center" \
  148. -variable draw_option -value 1 -width 8 \
  149. -command "change_display 0" ]
  150. $draw_var1 select
  151. help $BASE.midt.b1 balloon "Change view by moving eye position"
  152. help $BASE.midt.b2 balloon "Change view by moving scene center position"
  153. if {$Nv_(FlyThrough)} {
  154. mkFlyButtons $BASE "midt" $draw_lab $draw_var1 $draw_var2
  155. } else {
  156. # original code
  157. pack $draw_lab $draw_var1 $draw_var2 -side left -expand 0
  158. }
  159. help $BASE.midt.b3 balloon "Change view using mouse to control fly-through"
  160. # make position "widget"
  161. set XY [Nv_mkXYScale $BASE.midf.pos puck XY_POS 125 125 105 105 update_eye_position]
  162. # make vertical exageration and eye height sliders
  163. set H [mk_hgt_slider $BASE.midf]
  164. set E [mk_exag_slider $BASE.midf]
  165. help $E.scale balloon "Set vertical exaggeration"
  166. help $E.entry balloon "Set vertical exaggeration"
  167. help $H.scale balloon "Set eye height"
  168. help $H.entry balloon "Set eye height"
  169. # make lookat buttons
  170. frame $BASE.midf.lookat -relief flat -borderwidth 0
  171. Label $BASE.midf.lookat.l -text "Look"
  172. Button $BASE.midf.lookat.here -text "here" -bd 1 \
  173. -helptext "Center view at point marked with mouse click" \
  174. -command {bind $Nv_(TOP).canvas <Button> {look_here %W %x %y
  175. if {$Nauto_draw == 1} {Ndraw_all}
  176. }}
  177. Button $BASE.midf.lookat.center -text "center" -bd 1 \
  178. -helptext "Center view at center of displayed surface" \
  179. -command { look_center
  180. if {$Nauto_draw == 1} {Ndraw_all}
  181. }
  182. Button $BASE.midf.lookat.top -text "top" -bd 1 \
  183. -helptext "View directly from above" \
  184. -command {
  185. # Nv_itemDrag $Nv_(main_BASE).midf.pos $Nv_(XY_POS) 62.5 62.5
  186. # note: below value is somewhat strange, but with 0.5 0.5 the map rotates:
  187. # update_eye_position 0.496802 0.50100
  188. set val2 [$Nv_(HEIGHT_SLIDER).f.entry get]
  189. Nset_focus_top $val2
  190. change_display 1
  191. update
  192. if {$Nauto_draw == 1} {Ndraw_all}
  193. }
  194. # CMB Nov.2006: As far as I can tell, this button does nothing. This command doesn't exist
  195. #button $BASE.midf.lookat.cancel -text "cancel" -bd 1 -command no_focus
  196. # make perspective and twist sliders
  197. frame $BASE.bframe -relief flat -bd 0
  198. frame $BASE.bframe.cframe -relief flat -borderwidth 0
  199. set P [Nv_mkScale $BASE.bframe.cframe.pers h perspective 120 3 40 Nchange_persp 0]
  200. set T [Nv_mkScale $BASE.bframe.cframe.tw h twist -180 180 0 Nchange_twist 0]
  201. help $BASE.bframe.cframe.pers balloon "Set field of view size (degrees)"
  202. help $BASE.bframe.cframe.tw balloon "Set twist angle (degrees)"
  203. # reset button goes here so it can reference P
  204. Button $BASE.midf.lookat.reset -text "reset" \
  205. -bd 1 -command "do_reset $XY $H $E $P $T" \
  206. -helptext "Reset view to default"
  207. pack $BASE.midf.lookat.l $BASE.midf.lookat.here \
  208. $BASE.midf.lookat.center $BASE.midf.lookat.top \
  209. $BASE.midf.lookat.reset -side top -fill x -expand 1 -anchor n
  210. pack $BASE.midf.lookat $XY -side left -expand 1 -padx 5 -anchor w
  211. pack $H $E -side left -expand y -padx 2
  212. pack $BASE.midf -side top -fill both -expand 1
  213. pack $BASE.bframe.cframe.pers $BASE.bframe.cframe.tw -side left -fill x -expand 1 -padx 3
  214. pack $BASE.bframe -side top -fill x -expand 1 -padx 3
  215. pack $BASE.bframe.cframe -side top -pady 5
  216. #*** ACS_MODIFY 1.0 BEGIN ******************************************************
  217. if {$Nv_(FlyThrough)} {
  218. set Nv_(TWIST_SLIDER) $T
  219. set Nv_(EXAG_SLIDER) $E
  220. }
  221. #*** ACS_MODIFY 1.0 END ******************************************************
  222. # According to the documentation, the Main panel can never be closed
  223. # button $BASE.close -text Close -command "Nv_closePanel $BASE" -anchor s
  224. # pack $BASE.close -side right
  225. return $panel
  226. }
  227. # Procedure to reset the main panel
  228. proc Nviz_main_reset {} {
  229. global Nv_
  230. # Simple, just invoke the reset button
  231. $Nv_(main_BASE).midf.lookat.reset invoke
  232. }
  233. # Procedure to save camera parameters
  234. proc Nviz_main_save { file_hook } {
  235. global Nv_
  236. set BASE $Nv_(main_BASE)
  237. #Get canvas size
  238. set width [lindex [$Nv_(TOP).canvas configure -width] 4]
  239. set height [lindex [$Nv_(TOP).canvas configure -height] 4]
  240. # Need to make this accurate
  241. # Also need to save "look here" information
  242. # TODO prob. need focus indication AND realto (if focused)
  243. puts $file_hook ">>>start main"
  244. puts $file_hook "$width $height"
  245. puts $file_hook "[$BASE.bframe.cframe.pers.f.entry get]"
  246. puts $file_hook "[$BASE.midf.zexag.f.entry get]"
  247. puts $file_hook "[$Nv_(HEIGHT_SLIDER).f.entry get]"
  248. puts $file_hook "[Nv_getXYPos XY_POS]"
  249. puts $file_hook "[Nhas_focus]"
  250. puts $file_hook "[Nget_focus]"
  251. # if not focused, should use view_to
  252. }
  253. # Procedure to load camera parameters
  254. proc Nviz_main_load { file_hook } {
  255. global Nv_
  256. # window size
  257. gets $file_hook data
  258. set win_width [lindex $data 0]
  259. set win_height [lindex $data 1]
  260. $Nv_(TOP).canvas configure -width $win_width -height $win_height
  261. pack $Nv_(TOP).canvas -side top -expand 1 -fill both
  262. # perspective
  263. gets $file_hook data
  264. Nv_setEntry $Nv_(main_BASE).bframe.cframe.pers.f.entry [expr int($data)]
  265. Nv_scaleCallback $Nv_(main_BASE).bframe.cframe.pers e 0 null [expr int($data)]
  266. update
  267. # zexag
  268. gets $file_hook data
  269. Nv_setEntry $Nv_(main_BASE).midf.zexag.f.entry $data
  270. Nv_floatscaleCallback $Nv_(main_BASE).midf.zexag e 2 null $data
  271. update
  272. # height
  273. gets $file_hook data
  274. Nv_setEntry $Nv_(HEIGHT_SLIDER).f.entry $data
  275. Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) e 2 null $data
  276. update
  277. # XY position
  278. gets $file_hook data
  279. set data [split "$data"]
  280. Nv_itemDrag $Nv_(main_BASE).midf.pos $Nv_(XY_POS) \
  281. [expr int([lindex $data 0] * 125)] [expr int([lindex $data 1] * 125)]
  282. update_eye_position [lindex $data 0] [lindex $data 1]
  283. update
  284. # focus
  285. gets $file_hook data
  286. set data [split "$data"]
  287. if {"[lindex $data 0]" == "1"} then {
  288. gets $file_hook data
  289. set data [split "$data"]
  290. Nset_focus [lindex $data 0] [lindex $data 1] [lindex $data 2]
  291. } else {
  292. # insert code to set view_to here
  293. Nset_focus_state 0
  294. }
  295. update
  296. }
  297. proc do_clear {} {
  298. # TEST Nset_draw both
  299. Nset_draw front
  300. Nready_draw
  301. Nclear
  302. Ndone_draw
  303. Nset_draw back
  304. }
  305. # TODO - if started with view file, use these params for reset
  306. proc do_reset {XY H E P T} {
  307. global Nv_
  308. global Nauto_draw
  309. appBusy
  310. Nset_focus_map
  311. Nv_itemDrag $XY $Nv_(XY_POS) 105 105
  312. Nv_xyCallback Nchange_position 125 125 105 105
  313. set exag [Nget_first_exag]
  314. set val $exag
  315. Nv_floatscaleCallback $E b 2 Nchange_exag $val
  316. set list [Nget_height]
  317. set val [lindex $list 0]
  318. Nv_floatscaleCallback $H b 2 update_height $val
  319. Nv_scaleCallback $P b 0 Nchange_persp 40
  320. Nv_scaleCallback $T b 0 Nchange_twist 0
  321. if {$Nauto_draw == 1} {Ndraw_all}
  322. appNotBusy
  323. }
  324. proc mk_exag_slider {W} {
  325. # init z-exag slider values
  326. set exag [Nget_first_exag]
  327. set val $exag
  328. set exag [expr $val * 10]
  329. set min 0
  330. Nv_mkFloatScale $W.zexag v z-exag $exag $min $val update_exag 1
  331. return $W.zexag
  332. }
  333. proc mk_hgt_slider {W} {
  334. global Nv_
  335. # init height slider values
  336. set list [Nget_height]
  337. set val [lindex $list 0]
  338. set min [lindex $list 1]
  339. set max [lindex $list 2]
  340. # make sliders
  341. set Nv_(HEIGHT_SLIDER) $W.height
  342. Nv_mkFloatScale $Nv_(HEIGHT_SLIDER) v height $max $min $val update_height 1
  343. return $Nv_(HEIGHT_SLIDER)
  344. }
  345. proc update_exag {exag} {
  346. global Nv_
  347. global draw_option
  348. if {$exag == 0.} {
  349. set exag [lindex [$Nv_(main_BASE).midf.zexag.scale configure -resolution] 4]
  350. Nv_setEntry $Nv_(main_BASE).midf.zexag.f.entry $exag
  351. Nv_floatscaleCallback $Nv_(main_BASE).midf.zexag e 2 null $exag
  352. }
  353. Nchange_exag $exag
  354. #*** ACS_MODIFY 1.0 BEGIN ******************************************************
  355. if {$draw_option == 3} {
  356. set ht1 [lindex [Nget_real_position 1] 2]
  357. set ht2 [lindex [Nget_height] 0]
  358. ## Update height to avoid scene jump
  359. ## Changing the exag changes the height
  360. if {$ht1 == $ht2} {
  361. Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) b 2 update_height $ht2
  362. } else {
  363. Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) b 2 update_height \
  364. [lindex [Nget_real_position 1] 2]
  365. }
  366. } else {
  367. # original 2 lines
  368. Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) b 2 update_height \
  369. [$Nv_(HEIGHT_SLIDER).f.entry get]
  370. }
  371. #*** ACS_MODIFY 1.0 END ********************************************************
  372. # Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) b 2 update_height [lindex [Nget_height] 0]
  373. # Nquick_draw
  374. }
  375. proc update_eye_position {x y} {
  376. global Nv_
  377. Nset_focus_state 1
  378. Nchange_position $x $y
  379. if {$Nv_(FollowView)} {
  380. set_lgt_position $x $y
  381. set x [expr int($x*125)]
  382. set y [expr int($y*125)]
  383. Nv_itemDrag $Nv_(LIGHT_XY) $Nv_(LIGHT_POS) $x $y
  384. }
  385. }
  386. proc update_center_position {x y} {
  387. global Nv_
  388. Nset_focus_state 1
  389. Nset_focus_gui $x $y
  390. if {$Nv_(FollowView)} {
  391. set_lgt_position $x $y
  392. set x [expr int($x*125)]
  393. set y [expr int($y*125)]
  394. Nv_itemDrag $Nv_(LIGHT_XY) $Nv_(LIGHT_POS) $x $y
  395. }
  396. }
  397. proc change_display {flag} {
  398. global XY Nv_
  399. global Nauto_draw
  400. set NAME $XY
  401. set NAME2 [winfo parent $NAME]
  402. catch "destroy $XY"
  403. if {$Nv_(FlyThrough)} {Nset_fly_mode -1}
  404. set h [lindex [Nget_real_position 1] 2]
  405. set min [lindex [Nget_height] 1]
  406. set max [lindex [Nget_height] 2]
  407. if {$flag == 1} {
  408. #draw eye position
  409. inform "Set eye position"
  410. set XY [Nv_mkXYScale $NAME puck XY_POS 125 125 105 105 update_eye_position]
  411. } elseif {$flag == 0} {
  412. #draw center position
  413. inform "Set center of view position"
  414. set XY [Nv_mkXYScale $NAME cross XY_POS 125 125 109 109 update_center_position]
  415. }
  416. if {$Nv_(FlyThrough)} {
  417. pack_XY
  418. } else {
  419. pack $XY -side left -before $Nv_(HEIGHT_SLIDER)
  420. }
  421. set Nv_(FlyThrough) 0
  422. update_height $h
  423. reset_res
  424. move_position
  425. if {$Nauto_draw == 1} {Ndraw_all}
  426. }
  427. proc reset_res { } {
  428. global Nv_
  429. set h [lindex [Nget_real_position 1] 2]
  430. set from [lindex [Nget_height] 1]
  431. set to [lindex [Nget_height] 2]
  432. Nv_floatscaleCallback $Nv_(HEIGHT_SLIDER) b 2 update_height $h
  433. $Nv_(HEIGHT_SLIDER).scale configure -resolution [expr -1.0 * (($to - $from)/140.0)]
  434. }
  435. proc update_height {h} {
  436. global Nv_
  437. Nset_focus_state 1
  438. Nchange_height $h
  439. if {$Nv_(FollowView)} {
  440. set val [lindex [Nget_real_position 1] 2]
  441. set min [lindex [Nget_height] 1]
  442. set max [lindex [Nget_height] 2]
  443. set h [expr int((100.0*($h -$min))/($max - $min))]
  444. Nv_floatscaleCallback $Nv_(LIGHT_HGT) b 2 set_lgt_hgt $h
  445. }
  446. }
  447. proc move_position {} {
  448. global Nv_ draw_option
  449. #Make sure in correct view mode
  450. Nset_focus_state 1
  451. if {$draw_option == 0} {
  452. #Move position puck
  453. set E [lindex [Nget_position] 0]
  454. if {$E < 0.} {set $E 0.}
  455. if {$E > 1.} {set $E 1.}
  456. set N [lindex [Nget_position] 1]
  457. set N [expr 1. - $N]
  458. if {$N < 0.} {set $N 0.}
  459. if {$N > 1.} {set $N 1.}
  460. set E [expr $E * 125.]
  461. set N [expr $N * 125.]
  462. Nv_itemDrag $Nv_(main_BASE).midf.pos $Nv_(XY_POS) $E $N
  463. update
  464. }
  465. if {$draw_option == 1} {
  466. #Move center of view cross hair
  467. set E [lindex [Nget_focus_gui] 0]
  468. if {$E > 1.} { set E 1.}
  469. if {$E < 0.} {set E 0.}
  470. set N [lindex [Nget_focus_gui] 1]
  471. if {$N > 1.} {set N 1.}
  472. if {$N < 0.} {set N 0.}
  473. set E [expr ($E * 125.)]
  474. #reverse northing for canvas
  475. set N [expr 125 - ($N * 125.)]
  476. Nv_itemDrag $Nv_(main_BASE).midf.pos $Nv_(XY_POS) $E $N
  477. update
  478. }
  479. }
  480. ###########################################
  481. # cursor setting and resetting functions
  482. proc setcursor { ctype } {
  483. global Nv_
  484. $Nv_(TOP).canvas configure -cursor $ctype
  485. return
  486. }
  487. proc restorecursor {} {
  488. global Nv_
  489. $can($mon) configure -cursor $Nv_(cursor)
  490. return
  491. }