Skip to content

Commit

Permalink
Update OverviewMap sample to use MapView.InteractionOptions instead o…
Browse files Browse the repository at this point in the history
…f IsHitTestVisible.
  • Loading branch information
katydalton committed Apr 27, 2015
1 parent b602163 commit 5b5164a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<UserControl x:Class="ArcGISRuntimeSDKDotNet_DesktopSamples.Samples.OverviewMap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid x:Name="layoutGrid">
<esri:MapView x:Name="MyMapView">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid x:Name="layoutGrid">
<esri:MapView x:Name="MyMapView">
<esri:Map InitialViewpoint="-5, 20, 50, 65, 4326">
<esri:ArcGISTiledMapServiceLayer ID="Basemap"
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
</esri:Map>
</esri:MapView>
<esri:ArcGISTiledMapServiceLayer ID="Basemap"
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
</esri:Map>
</esri:MapView>

<Border Background="White" BorderBrush="Black" BorderThickness="1"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="30" Padding="20" IsHitTestVisible="False">
Margin="30" Padding="20">
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
<esri:MapView x:Name="overviewMap" Width="300" Height="200">
<esri:MapView.InteractionOptions>
<esri:InteractionOptions IsEnabled="False"/>
</esri:MapView.InteractionOptions>
<esri:Map>
<esri:ArcGISTiledMapServiceLayer
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
</esri:Map>
<esri:MapView.GraphicsOverlays>
<esri:GraphicsOverlay ID="overviewOverlay">
Expand All @@ -36,5 +39,5 @@
</esri:MapView.GraphicsOverlays>
</esri:MapView>
</Border>
</Grid>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@

namespace ArcGISRuntimeSDKDotNet_DesktopSamples.Samples
{
/// <summary>
/// This sample demonstrates displaying an overview map to indicate the extent of the parent map.
/// </summary>
/// <title>Overview Map</title>
/// <category>Mapping</category>
public partial class OverviewMap : UserControl
{
/// <summary>Construct Overview Map sample control</summary>
public OverviewMap()
{
InitializeComponent();
MyMapView.ExtentChanged += MyMapView_ExtentChanged;
}
/// <summary>
/// This sample demonstrates displaying an overview map to indicate the extent of the parent map.
/// </summary>
/// <title>Overview Map</title>
/// <category>Mapping</category>
public partial class OverviewMap : UserControl
{
/// <summary>Construct Overview Map sample control</summary>
public OverviewMap()
{
InitializeComponent();
MyMapView.ExtentChanged += MyMapView_ExtentChanged;
}

private async void MyMapView_ExtentChanged(object sender, System.EventArgs e)
{
private async void MyMapView_ExtentChanged(object sender, System.EventArgs e)
{
var graphicsOverlay = overviewMap.GraphicsOverlays["overviewOverlay"];

// Update overview map graphic
// Update overview map graphic
Graphic g = graphicsOverlay.Graphics.FirstOrDefault();
if (g == null) //first time
{
g = new Graphic();
if (g == null) //first time
{
g = new Graphic();
graphicsOverlay.Graphics.Add(g);
}
g.Geometry = MyMapView.Extent;
}
g.Geometry = MyMapView.Extent;

// Adjust overview map scale
await overviewMap.SetViewAsync(MyMapView.Extent.GetCenter(), MyMapView.Scale * 15);
}
}
// Adjust overview map scale
await overviewMap.SetViewAsync(MyMapView.Extent.GetCenter(), MyMapView.Scale * 15);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
Margin="20"
BorderBrush="White"
BorderThickness="2"
Background="LightGray"
IsHitTestVisible="False">
Background="LightGray" >
<esri:MapView x:Name="overviewMap" Width="200" Height="200" >
<esri:MapView.InteractionOptions>
<esri:InteractionOptions IsEnabled="False"/>
</esri:MapView.InteractionOptions>
<esri:Map >
<layers:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
<layers:GraphicsLayer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<Page
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.OverviewMap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.OverviewMap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="using:Esri.ArcGISRuntime.Controls"
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
xmlns:symb="using:Esri.ArcGISRuntime.Symbology">

<Grid>
<esri:MapView x:Name="MyMapView">
<esri:Map>
<Grid>
<esri:MapView x:Name="MyMapView">
<esri:Map>
<esri:Map.InitialViewpoint>
<esri:ViewpointExtent XMin="-5" YMin="20" XMax="50" YMax="65" SpatialReferenceID="4326" />
</esri:Map.InitialViewpoint>
<layers:ArcGISTiledMapServiceLayer
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
</esri:Map>
</esri:MapView>
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
</esri:Map>
</esri:MapView>

<Border HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20"
BorderBrush="White" BorderThickness="2" Background="LightGray" IsHitTestVisible="False">
<esri:MapView x:Name="overviewMap" Width="300" Height="200" >
<esri:Map >
<Border HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20"
BorderBrush="White" BorderThickness="2" Background="LightGray">
<esri:MapView x:Name="overviewMap" Width="300" Height="200" >
<esri:MapView.InteractionOptions>
<esri:InteractionOptions IsEnabled="False"/>
</esri:MapView.InteractionOptions>
<esri:Map >
<layers:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
</esri:Map>
</esri:Map>
<esri:MapView.GraphicsOverlays>
<esri:GraphicsOverlay ID="overviewOverlay">
<esri:GraphicsOverlay.Renderer>
Expand All @@ -37,6 +40,6 @@
</esri:GraphicsOverlay>
</esri:MapView.GraphicsOverlays>
</esri:MapView>
</Border>
</Grid>
</Border>
</Grid>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@

namespace ArcGISRuntimeSDKDotNet_StoreSamples.Samples
{
/// <summary>
/// This sample demonstrates displaying an overview map to indicate the extent of the parent map.
/// </summary>
/// <title>Overview Map</title>
/// <category>Mapping</category>
/// <summary>
/// This sample demonstrates displaying an overview map to indicate the extent of the parent map.
/// </summary>
/// <title>Overview Map</title>
/// <category>Mapping</category>
public sealed partial class OverviewMap : Page
{
public OverviewMap()
{
this.InitializeComponent();
{
public OverviewMap()
{
this.InitializeComponent();
MyMapView.ExtentChanged += MyMapView_ExtentChanged;
}
}

private async void MyMapView_ExtentChanged(object sender, System.EventArgs e)
{
private async void MyMapView_ExtentChanged(object sender, System.EventArgs e)
{
var graphicsOverlay = overviewMap.GraphicsOverlays["overviewOverlay"];

// Update overview map graphic
Graphic g = graphicsOverlay.Graphics.FirstOrDefault();
if (g == null) //first time
{
g = new Graphic();
if (g == null) //first time
{
g = new Graphic();
graphicsOverlay.Graphics.Add(g);
}
g.Geometry = MyMapView.Extent;
}
g.Geometry = MyMapView.Extent;

// Adjust overview map scale
await overviewMap.SetViewAsync(MyMapView.Extent.GetCenter(), MyMapView.Scale * 15);
}
}
// Adjust overview map scale
await overviewMap.SetViewAsync(MyMapView.Extent.GetCenter(), MyMapView.Scale * 15);
}
}
}

0 comments on commit 5b5164a

Please sign in to comment.