Skip to content

Commit

Permalink
Update FeatureLayerMapTips sample to use Naperville Shelters FeatureS…
Browse files Browse the repository at this point in the history
…ervice.
  • Loading branch information
katydalton committed May 11, 2015
1 parent 5b5164a commit bf5b0b8
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 142 deletions.
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
<UserControl x:Class="ArcGISRuntimeSDKDotNet_DesktopSamples.Samples.FeatureLayerMapTips"
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>
<esri:MapView x:Name="MyMapView" WrapAround="True"
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>
<esri:MapView x:Name="MyMapView" WrapAround="True"
MouseMove="MyMapView_MouseMove">
<esri:Map>
<esri:ArcGISTiledMapServiceLayer
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<esri:Map InitialViewpoint="-88.35,41.61,-88.05,41.84,4326">

<esri:FeatureLayer x:Name="earthquakes" ID="featureLayer">
<esri:FeatureLayer.Renderer>
<esri:SimpleRenderer>
<esri:SimpleMarkerSymbol Color="LightBlue" Style="Circle" Size="12">
<esri:SimpleMarkerSymbol.Outline>
<esri:SimpleLineSymbol Color="Blue" Width="2" Style="Solid" />
</esri:SimpleMarkerSymbol.Outline>
</esri:SimpleMarkerSymbol>
</esri:SimpleRenderer>
</esri:FeatureLayer.Renderer>
<esri:FeatureLayer.FeatureTable>
<esri:ServiceFeatureTable
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
Where="magnitude >= 3.0" OutFields="*" />
</esri:FeatureLayer.FeatureTable>
</esri:FeatureLayer>
</esri:Map>
<esri:ArcGISTiledMapServiceLayer
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />

<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border x:Name="mapTip" Background="White" BorderBrush="Black" BorderThickness="2"
Padding="4" Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
<StackPanel>
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
<TextBlock Text="{Binding Attributes[magnitude], StringFormat='Magnitude: {0}'}" />
</StackPanel>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
</Grid>
<esri:FeatureLayer x:Name="shelters" ID="featureLayer">
<esri:FeatureLayer.Renderer>
<esri:SimpleRenderer>
<esri:SimpleMarkerSymbol Color="LightBlue" Style="Circle" Size="12">
<esri:SimpleMarkerSymbol.Outline>
<esri:SimpleLineSymbol Color="Blue" Width="2" Style="Solid" />
</esri:SimpleMarkerSymbol.Outline>
</esri:SimpleMarkerSymbol>
</esri:SimpleRenderer>
</esri:FeatureLayer.Renderer>
<esri:FeatureLayer.FeatureTable>
<esri:ServiceFeatureTable
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"
OutFields="*" />
</esri:FeatureLayer.FeatureTable>
</esri:FeatureLayer>
</esri:Map>

<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border x:Name="mapTip" Background="White" BorderBrush="Black" BorderThickness="2"
Padding="4" Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
<StackPanel>
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
<TextBlock Text="{Binding Attributes[capacity], StringFormat='Capacity: {0}'}" />
</StackPanel>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@

namespace ArcGISRuntimeSDKDotNet_DesktopSamples.Samples
{
/// <summary>
/// This sample shows how to display a map tip for a feature layer. In this example, the MouseMove event of the MapView is handled with code that performs a FeatureLayer HitTest / Query combination which returns a single feature for display in the mapTip element defined in the XAML.
/// </summary>
/// <title>Map Tips</title>
/// <summary>
/// This sample shows how to display a map tip for a feature layer. In this example, the MouseMove event of the MapView is handled with code that performs a FeatureLayer HitTest / Query combination which returns a single feature for display in the mapTip element defined in the XAML.
/// </summary>
/// <title>Map Tips</title>
/// <category>Layers</category>
/// <subcategory>Feature Layers</subcategory>
public partial class FeatureLayerMapTips : UserControl
{
{
private bool _isMapReady;

/// <summary>Construct Map Tips sample</summary>
public FeatureLayerMapTips()
{
InitializeComponent();
/// <summary>Construct Map Tips sample</summary>
public FeatureLayerMapTips()
{
InitializeComponent();

MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
}

private async void MyMapView_SpatialReferenceChanged(object sender, System.EventArgs e)
{
Expand All @@ -33,33 +33,33 @@ private async void MyMapView_SpatialReferenceChanged(object sender, System.Event
}

private async void MyMapView_MouseMove(object sender, MouseEventArgs e)
{
{
if (!_isMapReady)
return;

try
{
{
_isMapReady = false;

Point screenPoint = e.GetPosition(MyMapView);
var rows = await earthquakes.HitTestAsync(MyMapView, screenPoint);
if (rows != null && rows.Length > 0)
{
var features = await earthquakes.FeatureTable.QueryAsync(rows);
var rows = await shelters.HitTestAsync(MyMapView, screenPoint);
if (rows != null && rows.Length > 0)
{
var features = await shelters.FeatureTable.QueryAsync(rows);
mapTip.DataContext = features.FirstOrDefault();
mapTip.Visibility = System.Windows.Visibility.Visible;
}
else
mapTip.Visibility = System.Windows.Visibility.Collapsed;
}
catch
{
mapTip.Visibility = System.Windows.Visibility.Collapsed;
}
mapTip.Visibility = System.Windows.Visibility.Visible;
}
else
mapTip.Visibility = System.Windows.Visibility.Collapsed;
}
catch
{
mapTip.Visibility = System.Windows.Visibility.Collapsed;
}
finally
{
_isMapReady = true;
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Page
x:Class="ArcGISRuntimeSDKDotNet_PhoneSamples.Samples.FeatureLayerMapTips"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ArcGISRuntimeSDKDotNet_PhoneSamples.Samples"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="ArcGISRuntimeSDKDotNet_PhoneSamples.Samples.FeatureLayerMapTips"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ArcGISRuntimeSDKDotNet_PhoneSamples.Samples"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="using:Esri.ArcGISRuntime.Controls"
xmlns:layers="using:Esri.ArcGISRuntime.Layers"
xmlns:data="using:Esri.ArcGISRuntime.Data"
Expand All @@ -15,8 +15,11 @@
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<esri:MapView x:Name="MyMapView" WrapAround="True" >
<esri:Map>
<esri:Map.InitialViewpoint>
<esri:ViewpointExtent XMin="-88.35" YMin="41.61" XMax="-88.05" YMax="41.84" SpatialReferenceID="4326" />
</esri:Map.InitialViewpoint>
<layers:ArcGISTiledMapServiceLayer DisplayName="Basemap"
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />

<layers:FeatureLayer ID="FeatureLayer">
<layers:FeatureLayer.Renderer>
Expand All @@ -30,22 +33,21 @@
</layers:FeatureLayer.Renderer>
<layers:FeatureLayer.FeatureTable>
<data:ServiceFeatureTable
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
Where="magnitude >= 3.0" />
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"/>
</layers:FeatureLayer.FeatureTable>
</layers:FeatureLayer>
</esri:Map>

<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
<StackPanel>
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
<TextBlock>
<Run Text="Magnitude: " />
<Run Text="{Binding Attributes[magnitude]}" />
<Run Text="Capacity: " />
<Run Text="{Binding Attributes[capacity]}" />
</TextBlock>
</StackPanel>
</Border>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<Page
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.FeatureLayerMapTips"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ArcGISRuntimeSDKDotNet_StoreSamples.Samples.FeatureLayerMapTips"
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:data="using:Esri.ArcGISRuntime.Data"
xmlns:symb="using:Esri.ArcGISRuntime.Symbology">
xmlns:symb="using:Esri.ArcGISRuntime.Symbology">

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<esri:MapView x:Name="MyMapView" WrapAround="True" >
<esri:Map>
<esri:Map.InitialViewpoint>
<esri:ViewpointExtent XMin="-88.35" YMin="41.61" XMax="-88.05" YMax="41.84" SpatialReferenceID="4326" />
</esri:Map.InitialViewpoint>

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<esri:MapView x:Name="MyMapView" WrapAround="True" >
<esri:Map>
<layers:ArcGISTiledMapServiceLayer DisplayName="Basemap"
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />

<layers:FeatureLayer ID="FeatureLayer">
<layers:FeatureLayer.Renderer>
Expand All @@ -24,28 +28,27 @@
</symb:SimpleRenderer>
</layers:FeatureLayer.Renderer>
<layers:FeatureLayer.FeatureTable>
<data:ServiceFeatureTable
ServiceUri="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0"
Where="magnitude >= 3.0" />
</layers:FeatureLayer.FeatureTable>
</layers:FeatureLayer>
</esri:Map>

<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
<StackPanel>
<TextBlock Text="{Binding Attributes[datetime]}" FontWeight="Bold" />
<TextBlock>
<Run Text="Magnitude: " />
<Run Text="{Binding Attributes[magnitude]}" />
</TextBlock>
</StackPanel>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
</Grid>
<data:ServiceFeatureTable
ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"/>
</layers:FeatureLayer.FeatureTable>
</layers:FeatureLayer>
</esri:Map>

<esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border Background="#CC000000" BorderBrush="White" BorderThickness="2" Padding="4"
HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"
Visibility="Collapsed" esri:ViewBase.ViewOverlayAnchor="{Binding Geometry}">
<StackPanel>
<TextBlock Text="{Binding Attributes[facname]}" FontWeight="Bold" />
<TextBlock>
<Run Text="Capacity: " />
<Run Text="{Binding Attributes[capacity]}" />
</TextBlock>
</StackPanel>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays>
</esri:MapView>
</Grid>
</Page>
Loading

0 comments on commit bf5b0b8

Please sign in to comment.