Index: /trunk/gui/scripts/mapviewer.tcl
===================================================================
--- /trunk/gui/scripts/mapviewer.tcl	(revision 4632)
+++ /trunk/gui/scripts/mapviewer.tcl	(revision 4633)
@@ -82,4 +82,5 @@
     protected method MouseScroll { direction }
     protected method Pan {option x y}
+    protected method Pin {option x y}
     protected method Rebuild {}
     protected method ReceiveMapInfo { args }
@@ -137,4 +138,5 @@
     private variable _sendEarthFile 0
     private variable _useServerManip 0
+    private variable _labelCount 0
 }
 
@@ -179,7 +181,7 @@
     # to update the Lat/Long coordinate display
     array set _motion {
-        compress        0
+        compress        1
         delay           100
-        enable          0
+        enable          1
         pending         0
         x               0
@@ -358,4 +360,10 @@
             [itcl::code $this camera go %x %y 0.4]
 
+        # Pin placemark annotations
+        bind $itk_component(view) <Control-ButtonPress-1> \
+            +[itcl::code $this Pin add %x %y]
+        bind $itk_component(view) <Control-ButtonPress-3> \
+            +[itcl::code $this Pin delete %x %y]
+
         # Bindings for rotation via mouse
         bind $itk_component(view) <ButtonPress-2> \
@@ -394,4 +402,6 @@
                 [itcl::code $this EventuallyHandleMotionEvent %x %y]
         }
+        #bind $itk_component(view) <Motion> \
+        #    +[itcl::code $this SendCmd "map pin hover %x %y"]
     }
 
@@ -455,5 +465,5 @@
         set sendResize 0
     }
-    set _start [clock clicks -milliseconds]
+    #set _start [clock clicks -milliseconds]
     if {$sendResize} {
         SendCmd "screen size $_width $_height"
@@ -847,5 +857,5 @@
 
 # ----------------------------------------------------------------------
-# USAGE: ReceiveImage -bytes <size> -type <type> -token <token>
+# USAGE: ReceiveImage -type <type> -token <token> -bytes <size>
 #
 # Invoked automatically whenever the "image" command comes in from
@@ -857,6 +867,6 @@
     set readyForNextFrame 1
     array set info {
+        -bytes 0
         -token "???"
-        -bytes 0
         -type image
     }
@@ -878,4 +888,6 @@
         return
     }
+    set timeReceived [clock clicks -milliseconds]
+    set elapsed [expr $timeReceived - $_start]
     set option [lindex $args 0]
     switch -- $option {
@@ -888,14 +900,14 @@
             }
             if {$len == 5} {
-                puts stderr "\[$token\] Map coords out of range"
+                puts stderr "\[$token - $elapsed\] Map coords out of range"
             } elseif {$len < 7} {
                 foreach { x y z } [lrange $args 2 end] break
-                puts stderr "\[$token\] Map coords: $x $y $z"
+                puts stderr "\[$token - $elapsed\] Map coords: $x $y $z"
             } elseif {$len < 8} {
                 foreach { x y z screenX screenY } [lrange $args 2 end] break
-                puts stderr "\[$token\] Map coords($screenX,$screenY): $x $y $z"
+                puts stderr "\[$token - $elapsed\] Map coords($screenX,$screenY): $x $y $z"
             } else {
                 foreach { x y z screenX screenY srs vert } [lrange $args 2 end] break
-                puts stderr "\[$token\] Map coords($screenX,$screenY): $x $y $z {$srs} {$vert}"
+                puts stderr "\[$token - $elapsed\] Map coords($screenX,$screenY): $x $y $z {$srs} {$vert}"
             }
         }
@@ -1156,5 +1168,6 @@
 
 itcl::body Rappture::MapViewer::MouseMotion {} {
-    SendCmd "mouse motion $_motion(x) $_motion(y)"
+    #SendCmd "mouse motion $_motion(x) $_motion(y)"
+    SendCmd "map pin hover $_motion(x) $_motion(y)"
     set _motion(pending) 0
 }
@@ -1286,4 +1299,19 @@
         default {
             error "bad option \"$option\": should be click, drag, release"
+        }
+    }
+}
+
+itcl::body Rappture::MapViewer::Pin {option x y} {
+    set _click(x) $x
+    set _click(y) $y
+    switch -- $option {
+        "add" {
+            incr _labelCount
+            set label "Label $_labelCount"
+            SendCmd [list "map" "pin" "add" $x $y $label]
+        }
+        "delete" {
+            SendCmd "map pin delete $x $y"
         }
     }
