Select to view content in your preferred language

Issue with graphic object display on map after zoom in

1018
1
02-01-2011 07:27 PM
chitrasrivastava
Emerging Contributor
Hi,

I am from SAP Labs Bangalore and we are developing a GIS appication in silverlight 4.
We have observed a issue sometimes that if we display a graphic symbol on map and then zoom in , then move the map (pan) in correct direction to locate the object again . Sometimes the symbol doesn't appear on map by itself , we have to trigger zoom out then the object gets displayed again.

Please look into the issue.

Regards,
Chitra
0 Kudos
1 Reply
vipulsoni
Regular Contributor
Hi,

I am from SAP Labs Bangalore and we are developing a GIS appication in silverlight 4.
We have observed a issue sometimes that if we display a graphic symbol on map and then zoom in , then move the map (pan) in correct direction to locate the object again . Sometimes the symbol doesn't appear on map by itself , we have to trigger zoom out then the object gets displayed again.

Please look into the issue.

Regards,
Chitra


I have some pointers here (have this code running in one of my application for zooming to graphics in find features tool, it works perfect for me), which might help you I guess...


DataGrid dataGrid = sender as DataGrid;

            int selectedIndex = dataGrid.SelectedIndex;
            if (selectedIndex > -1)
            {
                FindResult findResult = (FindResult)FindDetailsDataGrid.SelectedItem;
                Graphic graphic = findResult.Feature;
                ESRI.ArcGIS.Client.Geometry.Geometry geom = findResult.Feature.Geometry;

                if (geom.GetType() == typeof(ESRI.ArcGIS.Client.Geometry.Polygon))
                {
                    graphic.Symbol = LayoutRoot.Resources["MyFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                }

                if (geom.GetType() == typeof(ESRI.ArcGIS.Client.Geometry.Polyline))
                {
                    graphic.Symbol = LayoutRoot.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                }

                if (geom.GetType() == typeof(ESRI.ArcGIS.Client.Geometry.MapPoint))
                {
                    graphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                }

                genmethods.ClearGraphik(Map, true, graphic);
                genmethods.Flash(graphic);

                int _zoomDistance = 200;

                Envelope objZoomExtent = new Envelope(graphic.Geometry.Extent.XMax + _zoomDistance, graphic.Geometry.Extent.YMax + _zoomDistance, graphic.Geometry.Extent.XMin - _zoomDistance, graphic.Geometry.Extent.YMin - _zoomDistance);
                Map.ZoomTo(objZoomExtent.Extent);
            }
0 Kudos