ThinkGeo.com    |     Documentation    |     Premium Support

TrackZoomIn in 3.0?

Basically my problem is the same as that documented in this case: gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5621/afv/topic/Default.aspx


We, too, are converting a 2.0 application to a 3.0 application.  However, the solution documented in that other case doesn't work for my users.  They are Police Officers and sit in a car with the laptop offset to the right. We need to provide the functionality for one handed use as much as possible.  The 2.0 model of clicking a button and then drawing a rectangle to change the extent worked beautifully.


Holding down the control key, while a neat and powerful enhancement, just doesn't work for our customers.  Plus it is hidden functionality and isn't obvious to them. 


Is there any way to provide 2.0 like functionality as well for TrackZoomIn?


Thank you!


Karl



There is a project in the Code Community that responds exactely to your concern, Track Zoom In without Shift. Please, check it out :


code.thinkgeo.com/projects/show/trackzoomwithout



Thanks!  That is a huge step in the right direction. 
  
 What if I want to retain the new shift-left click zoom AND have the option of putting it into a deliberate TrackZoomIn mode like the example does?  This would give the best of both worlds . . . 
  
 Currently the example will draw a rectangle when doing a shift left click, but ultimately does nothing . . . 
  
 Thanks again.  Sorry I’m still behind the learning curve on your new architecture . . . 
  
 Karl

I am glad we put you on the right direction. Tomorrow, we will have some sample code for retaining the shift-left click track zoom in while being in the TrackZoomIn mode.Thank you.

Karl,


Thanks for your post and questions.
 
I did some change on based on the code from the code community, hope it is
What you are trying to achieve:

    class ModeInteractiveOverlay: ExtentInteractiveOverlay
    {
        public enum Mode { TrackZoomIn,Pan };
        private Mode mode;
        public ModeInteractiveOverlay() 
        {
            //Sets default mode to TrackZoomIn.
            base.PanMode = MapPanMode.Disabled;
            base.LeftClickDragMode = MapLeftClickDragMode.ZoomInWithKey;
            //base.LeftClickDragKey = Keys.None;
            mode = Mode.TrackZoomIn;
        }
 
        public Mode MapMode
        {
            get { return mode; }
            set { 
                    mode = value;
                    if (mode == Mode.TrackZoomIn)
                    {
                        base.PanMode = MapPanMode.Disabled;
                        base.LeftClickDragMode = MapLeftClickDragMode.ZoomInWithKey;
                        //base.LeftClickDragKey = Keys.None;
                    }
                    else if (mode == Mode.Pan)
                    {
                        base.PanMode = MapPanMode.StandardPanning;
                        base.LeftClickDragMode = MapLeftClickDragMode.Disabled;
                        //base.LeftClickDragKey = Keys.None;
                    }
                }
        }
 
        protected override InteractiveResult MouseDownCore(InteractionArguments interactionArguments)
        {
            InteractiveResult result = null;
            result = base.MouseDownCore(interactionArguments);
 
            if (MapMode == Mode.TrackZoomIn)
            {
                base.PanAndTrackZoomState.IsLeftClickDragKeyPressed = true;
                base.LeftClickDragKey = Keys.None;
            }
            else
            {
                base.PanAndTrackZoomState.IsLeftClickDragKeyPressed = false;
                base.LeftClickDragKey = Keys.Shift;
            }
 
            return result;
        }
    }


 
 
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Yale, 
  
 Thanks for the code, but it isn’t quite doing what I want.  It will now zoom in when IN TrackZoomIn Mode, but NOT when in Pan mode. 
  
 What I want is when it is in Pan mode, for it to do all of your regular default behavior and TrackZoomIn when the shift key is being use.  Then when in TrackZoomIn Mode, have it work as this example illustrates. 
  
 Karl

Yale, 
  
 Another thing I’m seeing is the first rectangle drawn does not display.  Once you zoom in once or pan the map, it seems to work, though . . . 
  
 Karl

Ok. Through some trial and error, I got it working better with the following code.


I'm still having problems getting the first rectangle to draw, however.


Here's the code:


class ModeInteractiveOverlay : ExtentInteractiveOverlay
    {
        public enum Mode { TrackZoomIn, Pan };
        private Mode mode;
        public ModeInteractiveOverlay()
        {
            //Sets default mode to TrackZoomIn.
            base.PanMode = MapPanMode.Disabled;
            base.LeftClickDragMode = MapLeftClickDragMode.ZoomInWithKey;
            //base.LeftClickDragKey = Keys.None;
            mode = Mode.TrackZoomIn;
        }

        public Mode MapMode
        {
            get { return mode; }
            set
            {
                mode = value;
                if (mode == Mode.TrackZoomIn)
                {
                    base.PanMode = MapPanMode.Disabled;
                    base.LeftClickDragMode = MapLeftClickDragMode.ZoomInWithKey;
                    base.LeftClickDragKey = Keys.None;
                }
                else if (mode == Mode.Pan)
                {
                    base.PanMode = MapPanMode.Default;
                    base.LeftClickDragMode = MapLeftClickDragMode.ZoomInWithKey;
                    base.LeftClickDragKey = Keys.ShiftKey;
                }
            }
        }

        protected override InteractiveResult MouseDownCore(InteractionArguments interactionArguments)
        {
            InteractiveResult result = null;
            result = base.MouseDownCore(interactionArguments);

            if (MapMode == Mode.TrackZoomIn)
            {
                base.PanAndTrackZoomState.IsLeftClickDragKeyPressed = true;
                base.LeftClickDragKey = Keys.None;
            }
            //else
            //{
                //base.PanAndTrackZoomState.IsLeftClickDragKeyPressed = false;
                //base.LeftClickDragKey = Keys.Shift;
                //return base.MouseDownCore(interactionArguments);
            //}

            return result;
        }
    }



I tested your ExtentInteractiveOverlay on my side and I don’t see any of the behavior you are describing such as having problems getting the first rectangle to draw. To help Yang’s work, could you describe exactly what steps you are following to have that behavior and what version of DesktopEdition.dll are you on? Thank you.

Desktop edition dll is version 3.1.299 dated 11/16/2009.


I changed the behavior of the example.  It defaults to Pan mode and in that mode it behaves with your regular default functionality.  You can then click on the appropriate button to put it in a Track Zoom In mode.


In looking at it now, the first rectangle comes up after a significant delay (about 4 seconds) as long as you keep the left mouse button down that long.


I have attached my latest version.



1878-TrackZoomInWithoutShiftKey.zip (64.1 KB)

I tested your attached app with the references of the latest DesktopEdition.dll and MapSuiteCore.dll and I am not experiencing any of the behavior you are describing. I would make sure you have the latest development dlls.