Select to view content in your preferred language

GetFullExtent zooming out, but Dynamic Layers are blank

2132
16
02-18-2011 06:14 AM
KevinSesock
Emerging Contributor
We're not sure if this has to do with our service, or with our silverlight viewer, but we have an issue with when zooming out to the full extent of our map, set by the ConstrainFullExtent property, we have an issue where our dynamic layers disappear. This seems to be similar to this issue, here:

http://forums.arcgis.com/threads/18071-Graphic-objects-disappearing-when-zoom-in-out?highlight=Layer...

As in one of our other maps (currently on API 2.0), we have the issue where when full zoomed out, zooming in requires several mouse clicks that don't seem to zoom you in very fast.

Both maps seem to have an issue where our Dynamic layer "disappears" at full extent. This is most easily replicated by Map.ZoomTo(Map.Layers.GetFullExtent()); (in our Legacy Toolbar, the Full Extent button).

Our map experiencing this issue, is here:

http://www.owrb.ok.gov/learn/GWQ-sl/

You may have to adjust your browser size, as it doesn't do this at all browser sizes.
0 Kudos
16 Replies
KevinSesock
Emerging Contributor
Any further thoughts?
0 Kudos
DanielWalton
Frequent Contributor
Have you tried expanding the constraint extents out some to see if it goes away? Or shrinking them down a bit to contain all the service layers extents? I think the problem lies in you having defined so many different extents (on the map, the service, and the sublayers). Just a guess though.
0 Kudos
KevinSesock
Emerging Contributor
Just did. It actually seems to make it worse. If we go in further that seems to help some. Here is my question at this point:

We have three dynamic layers. Two of which are for these wells we're showing, one of which contains the county and PLSS boundaries for the entire state. The two well layers are set to the same extent (in ArcMap, they're set to the maximum extent of the visible layers), and the same of the PLSS layer, but it's set to a much larger extent (as it takes up the entire state). Setting every service to the same (as the PLSS service), and changing our ConstrainedExtent to match improves the situation, but it's still not perfect.

Removing the PLSS service from the layers doesn't seem to help, either. The only thing that causes this to stop is removing the ConstrainedExtentBehavior, but then unfortunately we don't have any option to Constrain the Extent. Can anyone confirm this as a bug?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Kevin,

I eventually reproduced your issue with 2.1.

The good news (let's begin with this one:)) is that I was not able to reproduce the issue with the current version I am working with, so hopefully this will work well with the next version (2.2).

The less good news is that I have had hard time to find out a workaround, and I am not sure the workaround I found covers all cases (but I think it makes things much better anyway).

To test the workaround:
- Remove the ConstraintExtentBehavior
- Wire up the extentchanged and extentchanging events of the map to the following ConstraintExtent code:

private Envelope _constrainedExtent = null;
private bool _hasExtentBeenSet = false;
private Envelope _lastExtent = null;
private void ConstraintExtent(object sender, ExtentEventArgs e)
{
var map = sender as Map;
if (map == null) return;
Envelope newExtent = e.NewExtent.Clone();
 
if (_constrainedExtent == null) // In this sample : initialize contrainted extent to first the extent
_constrainedExtent = newExtent;
 
if ((newExtent.XMin >= _constrainedExtent.XMin && newExtent.XMax <= _constrainedExtent.XMax && // completely within
newExtent.YMin >= _constrainedExtent.YMin && newExtent.YMax <= _constrainedExtent.YMax) ||
(newExtent.XMin >= _constrainedExtent.XMin && newExtent.XMax <= _constrainedExtent.XMax && // width within and height outside
newExtent.YMin <= _constrainedExtent.YMin && newExtent.YMax >= _constrainedExtent.YMax) ||
(newExtent.XMin <= _constrainedExtent.XMin && newExtent.XMax >= _constrainedExtent.XMax && // height within and width outside
newExtent.YMin >= _constrainedExtent.YMin && newExtent.YMax <= _constrainedExtent.YMax))
{
if (_hasExtentBeenSet)
{
_hasExtentBeenSet = false;
map.ZoomTo(newExtent.Expand(0.999)); // hack to force the refresh of the layers
}
return;
}
 
if (newExtent.Equals(_lastExtent))
return;
 
_lastExtent = newExtent;
 
if (newExtent.Width <= _constrainedExtent.Width && newExtent.Height <= _constrainedExtent.Height)
{
// Pan enough  to respect constraint
double dx = Math.Min(_constrainedExtent.XMax - newExtent.XMax, Math.Max(_constrainedExtent.XMin - newExtent.XMin, 0));
double dy = Math.Min(_constrainedExtent.YMax - newExtent.YMax, Math.Max(_constrainedExtent.YMin - newExtent.YMin, 0));
newExtent.XMin += dx; newExtent.XMax += dx;
newExtent.YMin += dy; newExtent.YMax += dy;
map.PanTo(newExtent);
}
else
{
// Change extent to respect constraint
newExtent = newExtent.Intersection(_constrainedExtent);
map.Extent = newExtent;
_hasExtentBeenSet = true;
}
}


Hope this help.
0 Kudos
KevinSesock
Emerging Contributor
We're dialing in the initial extent that works best. The behavior of both the behavior and this event handler seems erratic, but there seems to be no reason for that. At one initial extent, there's nothing drawn, at another, it works perfectly all the way through. We'll get it dialed in, however, and let you know.

Any kind of ETA on that 2.2 API? 😉
0 Kudos
JenniferNery
Esri Regular Contributor
We also are not aware of ETA for v2.2, we just know that it may be soon:) From dev team, it goes through a series of approval and processing from other teams so potential due date is hard to tell.
0 Kudos
KevinSesock
Emerging Contributor
We would be happy to volunteer for beta testing! Seriously, though, thanks for the help. This code above will more than suffice for the time being until 2.2 comes out.
0 Kudos