Select to view content in your preferred language

Rubberband AOI

3534
3
Jump to solution
05-21-2013 12:25 PM
JerrySchultz
Occasional Contributor
Is there a plan to support the standard zooming in a JMap using rubberbanding (Shift-leftmouse button) ?
0 Kudos
1 Solution

Accepted Solutions
EliseAcheson1
Deactivated User
Hi,

I tried with the example provided, there are some some inputs::
in the provided functionality- you have to click mouse 4 times. in order to complete the rectangle to zoom in/out.
but this I would like to do like this::
When user clicks on Map using Left Mouse button and then drag the mouse (Keeping the Mouse button pressed; and while dragging it should draw the rectangle also.), and when use
releases the mouse, it should draw the rectangle and zoom in/out.  
This also save the end user's time. and its very user friendly also.


The sample 'Switch Overlays' that Mark mentioned has exactly the functionality you describe above. When you click the 'Zoom Box Overlay' button, the overlay gets activated. Now you can press the mouse to get the initial corner of the zoom box, then drag and see the rectangle being drawn, and when you release the mouse it zooms to this rectangle/envelope.

The source code for this is in the toolkit, the class is called ZoomBoxOverlay (com.esri.client.toolkit.overlays). You can get to the source code via your IDE by adding the toolkit jar to a project and expanding the classes as appropriate, or the toolkit sources jar is in <install location>/sdk/jars called ArcGIS_Runtime_Java_Toolkit-sources which you can unzip and browse through.

~elise

View solution in original post

0 Kudos
3 Replies
MarkBaird
Esri Regular Contributor
You can do it with the current release (10.1.1) using the API.

We've got a sample which demonstrates exactly this functionality.  Take a look at Toolkit -> Overlays -> Switch Overlays

Press the "Zoom Box" button to see it in action.  All of the code for this is in the sample application too.

Let me know if this helps

Mark
0 Kudos
RavindraSingh
Frequent Contributor
I tried with the example provided, there are some some inputs::
in the provided functionality- you have to click mouse 4 times. in order to complete the rectangle to zoom in/out.
but this I would like to do like this::
When user clicks on Map using Left Mouse button and then drag the mouse (Keeping the Mouse button pressed; and while dragging it should draw the rectangle also.), and when use
releases the mouse, it should draw the rectangle and zoom in/out.  
This also save the end user's time. and its very user friendly also.


I have attached the screenshot of the same tool available in ArcMap also.

Can you help me how can i achieve this. I have to write the custom code for this. so can you please guide me in this.

Thanks.
0 Kudos
EliseAcheson1
Deactivated User
Hi,

I tried with the example provided, there are some some inputs::
in the provided functionality- you have to click mouse 4 times. in order to complete the rectangle to zoom in/out.
but this I would like to do like this::
When user clicks on Map using Left Mouse button and then drag the mouse (Keeping the Mouse button pressed; and while dragging it should draw the rectangle also.), and when use
releases the mouse, it should draw the rectangle and zoom in/out.  
This also save the end user's time. and its very user friendly also.


The sample 'Switch Overlays' that Mark mentioned has exactly the functionality you describe above. When you click the 'Zoom Box Overlay' button, the overlay gets activated. Now you can press the mouse to get the initial corner of the zoom box, then drag and see the rectangle being drawn, and when you release the mouse it zooms to this rectangle/envelope.

The source code for this is in the toolkit, the class is called ZoomBoxOverlay (com.esri.client.toolkit.overlays). You can get to the source code via your IDE by adding the toolkit jar to a project and expanding the classes as appropriate, or the toolkit sources jar is in <install location>/sdk/jars called ArcGIS_Runtime_Java_Toolkit-sources which you can unzip and browse through.

~elise
0 Kudos