S57 Search
This sample shows how to use the the SearchAsync method to search an HydrographicS57Layer based on an input geometry and a buffer distance.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.S57Search" 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/client/2009" xmlns:local="clr-namespace:ArcGISWPFSDK"> <Grid> <Grid.Resources> <Style TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border x:Name="ItemBorder" BorderBrush="Black" Background="LightGray" BorderThickness="2" Margin="3"> <ContentPresenter Margin="2" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="ItemBorder" Property="BorderBrush" Value="Blue" /> </Trigger> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="ItemBorder" Property="BorderBrush" Value="Red"/> </Trigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsMouseOver" Value="False" /> <Condition Property="IsSelected" Value="False" /> </MultiTrigger.Conditions> <Setter TargetName="ItemBorder" Property="Opacity" Value="0.50" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Grid.Resources> <Grid> <esri:Map x:Name="MyMap" UseAcceleratedDisplay="True" Extent="-15090086, 4141039, -13113925 , 5862778" WrapAround="True" MinimumResolution="5"> <esri:ArcGISTiledMapServiceLayer ID="Ocean_BaseMap" Url="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" /> <esri:HydrographicS57Layer x:Name="_hydrographicS57Layer" ID="HydrographicS57Layer" > <esri:S57Cell Path="..\Data\s57_electronic_navigational_charts\US1WC01M\US1WC01M.000" /> <esri:S57Cell Path="..\Data\s57_electronic_navigational_charts\US1WC07M\US1WC07M.000" /> </esri:HydrographicS57Layer> <esri:GraphicsLayer x:Name="_searchResults" ID="Search Results" Opacity="0.5" /> <esri:GraphicsLayer x:Name="_searchGeometryDisplay" ID="Search Geometry" Opacity="0.5" /> </esri:Map> <Grid Width="300" Height="550" Margin="5,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"> <Grid.Resources> <DataTemplate x:Key="identifyResults"> <StackPanel Orientation="Vertical" Margin="5,5"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Acronym: " /> <TextBlock Text="{Binding Path=Acronym}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Long Name: " /> <TextBlock Text="{Binding Path=LongName}"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Cell Name: " /> <TextBlock Text="{Binding Path=CellName}"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Composition Scale: " /> <TextBlock Text="{Binding Path=CompositionScale}"/> </StackPanel> </StackPanel> </DataTemplate> </Grid.Resources> <Rectangle Height="550" Grid.RowSpan="6" VerticalAlignment="Top" Fill="White" Stroke="Gray" > <Rectangle.Effect> <DropShadowEffect/> </Rectangle.Effect> </Rectangle> <Rectangle Grid.RowSpan="6" Margin="5" Fill="#DDFFFFFF" Stroke="DarkGray" /> <StackPanel> <TextBlock Margin="10,10,5,0">Click on the map to perform an Identify operation.</TextBlock> <StackPanel Orientation="Horizontal"> <TextBlock Margin="10,5,5,0">Found:</TextBlock> <TextBlock Margin="5,5,5,0" x:Name="IdentifyResultsText"/> </StackPanel> <ListBox x:Name="ResultItems" ItemTemplate="{StaticResource identifyResults}" SelectionChanged="ResultItems_SelectionChanged" Width="280" Height="350" HorizontalContentAlignment="Stretch" Margin="10,5,10,10" /> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Width="280" Height="125"> <DataGrid x:Name="ResultAttributes" AutoGenerateColumns="True" HeadersVisibility="All" Background="White"> </DataGrid> </ScrollViewer> </StackPanel> </Grid> <Border Background="White" BorderThickness="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" BorderBrush="White"> <Border.Effect> <DropShadowEffect/> </Border.Effect> <Grid Margin="10" Background="White"> <StackPanel Orientation="Vertical"> <StackPanel x:Name="MyStackPanel" Orientation="Horizontal" Width="305" Height="60"> <Button Tag="DrawPoint" Margin="5" Click="Tool_Click" ToolTipService.ToolTip="Select with a point"> <Image Source="/Assets/Images/DrawPoint.png" Margin="2" /> </Button> <Button Tag="DrawPolyline" Margin="5" Click="Tool_Click" ToolTipService.ToolTip="Select with a polyline"> <Image Source="/Assets/Images/DrawPolyline.png" Margin="2" /> </Button> <Button Tag="DrawPolygon" Margin="5" Click="Tool_Click" ToolTipService.ToolTip="Select with a polygon"> <Image Source="/Assets/Images/DrawPolygon.png" Margin="2" /> </Button> <Button Tag="DrawRectangle" Margin="5" Click="Tool_Click" ToolTipService.ToolTip="Select with a rectangle"> <Image Source="/Assets/Images/DrawRectangle.png" Margin="2" /> </Button> <Button Tag="ClearStopDraw" Margin="5" Click="Tool_Click" Style="{x:Null}" ToolTipService.ToolTip="Clear map"> <Image Source="/Assets/Images/StopDraw.png" Margin="2" /> </Button> </StackPanel> <StackPanel Orientation="Horizontal" > <TextBlock Text="Buffer Distance:" Margin="2" Width="135"/> <TextBox x:Name="BufferDistance" Text="0" Width="150" Margin="2"/> </StackPanel> <StackPanel Orientation="Horizontal" > <TextBlock Text="Object Name (Acronym):" Margin="2" Width="135"/> <TextBox x:Name="SearchText" Text="" Width="150" Margin="2"/> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Button x:Name="SearchS57LayerButton" Click="SearchS57LayerButton_Click" Margin="2" Width="80">Search</Button> <Button x:Name="ClearResultsButton" Click="ClearResultsButton_Click" Margin="2" Width="80">Clear Results</Button> </StackPanel> </StackPanel> </Grid> </Border> </Grid> </Grid> </UserControl>
5/16/2014