S57 Display Properties

This sample demonstrates using the global static HydrographicS52DisplayProperties object to control the display properties of an HydrographicS57Layer, such as the Color Scheme or Safety Contour Depth. Various UI controls are bound to the properties of the default HydrographicS52DisplayProperties instance. A MarkupExtension is used to facilitate the data binding to enum values and avoids the need to create ObjectDataProviders. For more information see Enum GetValues markup extension and Markup Extensions and WPF XAML. Additionally, a value converter is defined to translate between the flags enum that determines the DisplayCagetory. Electronic Navigation Chart (ENC) objects are grouped into three predefined display categories: base; standard; and other, which can be used in combination to achieve the desired display.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.S57DisplayProperties"
             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>
            <local:FlagsEnumValueConverter x:Key="FlagsConverter"/>
          
           
        </Grid.Resources>

        <Grid>
            <esri:Map x:Name="MyMap"  UseAcceleratedDisplay="True" Grid.ColumnSpan="2" 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="S57Layer"  ID="S57">
                    <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:Map>

            <Grid HorizontalAlignment="Left" Margin="2,2,0,2" Height="550" VerticalAlignment="Top" Width="500">
                <Grid.RowDefinitions>
                    <RowDefinition Height="105"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="95"/>
                    <RowDefinition Height="190"/>
                    <RowDefinition Height="55"/>
                </Grid.RowDefinitions>

                <!-- Main dark blue UI panel-->
                <Rectangle Height="550" Grid.RowSpan="6" VerticalAlignment="Top" Fill="White" Stroke="Gray" >
                    <Rectangle.Effect>
                        <DropShadowEffect/>
                    </Rectangle.Effect>
                </Rectangle>

                <!-- Pale blue background -->
                <Rectangle Grid.RowSpan="6" Margin="5" Fill="#DDFFFFFF" Stroke="DarkGray" />
                
                <TextBlock Text="S52 Display Properties"  FontWeight="ExtraBold" Margin="10,5,5,5"/>

                <!-- Color Scheme, Units and Symbolization -->
                <GroupBox Margin="10,15,10,0" Grid.Row="0" >
                    <GroupBox.Header>
                        <Label>Color Scheme, Units and Symbolization</Label>
                    </GroupBox.Header>
                    <StackPanel  Orientation="Vertical" >
                        <!-- Color Scheme & Depth Display Units -->
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Color Scheme:"  Margin="5,0,0,0" Width="80" VerticalAlignment="Top"/>
                            <ComboBox ItemsSource="{Binding Source={local:EnumValuesExtension {x:Type esri:S52ColorScheme}}}" 
                                  SelectedItem="{Binding Path=ColorScheme, Mode=TwoWay}" Width="120" />
                            <TextBlock Text="Depth Units:" Margin="5,0,0,0"  Width="80" VerticalAlignment="Top"/>
                            <ComboBox ItemsSource="{Binding Source={local:EnumValuesExtension {x:Type esri:S52DisplayDepthUnits}}}"  
                                  SelectedItem="{Binding Path=DisplayDepthUnits, Mode=TwoWay}" Width="120" />
                        </StackPanel>
                        <!-- Point and Area Symbolization Type -->
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                            <TextBlock Text="Area:"  Margin="5,0,0,0" Width="80" VerticalAlignment="Center"/>
                            <ComboBox ItemsSource="{Binding Source={local:EnumValuesExtension {x:Type esri:S52AreaSymbolizationType}}}"
                                   SelectedItem="{Binding Path=AreaSymbolizationType, Mode=TwoWay}" Width="120" />
                            <TextBlock Text="Point:" Margin="5,0,0,0"  Width="80" VerticalAlignment="Center"/>
                            <ComboBox ItemsSource="{Binding Source={local:EnumValuesExtension {x:Type esri:S52PointSymbolizationType}}}" 
                                          SelectedItem="{Binding Path=PointSymbolizationType, Mode=TwoWay}" Width="120" />
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <!-- Display Categories & Depth Areas -->
                <StackPanel  Grid.Row="1"  Margin="10,-5,10,0" Orientation="Horizontal" >
                    <GroupBox>
                        <GroupBox.Header>
                            <Label>Display Categories</Label>
                        </GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                            <CheckBox Content="Base" IsChecked="{Binding Path=DisplayCategory, Converter={StaticResource FlagsConverter},
                            ConverterParameter={x:Static esri:S52DisplayCategory.DisplayBase}}" Margin="5,0,0,0" />
                            <CheckBox Content="Standard" IsChecked="{Binding Path=DisplayCategory, Converter={StaticResource FlagsConverter},
                            ConverterParameter={x:Static esri:S52DisplayCategory.Standard}}"  Margin="5,0,0,0"/>
                            <CheckBox Content="Other" IsChecked="{Binding Path=DisplayCategory, Converter={StaticResource FlagsConverter},
                            ConverterParameter={x:Static esri:S52DisplayCategory.Other}}" Margin="5,0,5,0"/>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Margin="5,0,0,0">
                        <GroupBox.Header>
                            <Label>Depth Areas</Label>
                        </GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                            <ComboBox ItemsSource="{Binding Source={local:EnumValuesExtension {x:Type esri:S52DepthShades}}}" 
                                      SelectedItem="{Binding Path=DepthShades, Mode=TwoWay}" Width="60" />
                            <TextBlock Text="Depth Shades" Margin="5,0,0,0"  Width="80" />
                            <CheckBox Content="Shallow Depth Pattern" IsChecked="{Binding Path=ShallowDepthPattern}" />
                        </StackPanel>
                    </GroupBox>
                </StackPanel>

                <!-- Depth Contours -->
                <GroupBox Grid.Row="2" Margin="10,-5,10,0" >
                    <GroupBox.Header>
                        <Label>Depth Contours</Label>
                    </GroupBox.Header>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Width="50" Text="Shallow:" VerticalAlignment="Top"/>
                            <TextBox Text="{Binding Path=ShallowContourMeters}" Width="50" VerticalAlignment="Top"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Margin="5,0,0,0"  Width="45" Text="Safety:" VerticalAlignment="Top"/>
                            <TextBox Text="{Binding Path=SafetyContourMeters}" Width="50" VerticalAlignment="Top"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Margin="5,0,0,0"  Width="40" Text="Deep:" VerticalAlignment="Top"/>
                            <TextBox Text="{Binding Path=DeepContourMeters}" Width="50" VerticalAlignment="Top"/>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <!-- Text Groups -->
                <StackPanel Grid.Row="3" Margin="10,-5,10,0">
                    <GroupBox>
                        <GroupBox.Header>
                            <Label>Text Groups</Label>
                        </GroupBox.Header>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Margin="5,0,0,0" Grid.Column="0" Orientation="Vertical">
                                <CheckBox Content="Important Text" IsChecked="{Binding Path=TextGroupProperties.ImportantText}" />
                                <CheckBox Content="Light Descriptions" IsChecked="{Binding Path=TextGroupProperties.LightDescriptionString}" />
                                <CheckBox Content="Nature Of Seabed" IsChecked="{Binding Path=TextGroupProperties.NatureOfSeabed}" />
                                <CheckBox Content="Magnetic Variation And Swept Depth" IsChecked="{Binding Path=TextGroupProperties.MagneticVariationAndSweptDepth}" />
                            </StackPanel>
                            <StackPanel Margin="5,0,0,0" Grid.Column="1" Orientation="Vertical">
                                <CheckBox Content="Names For Position Reporting" IsChecked="{Binding Path=TextGroupProperties.NamesForPositionReporting}" />
                                <CheckBox Content="Notes On Chart Data" IsChecked="{Binding Path=TextGroupProperties.NoteOnChartData}" />
                                <CheckBox Content="Geographic Names" IsChecked="{Binding Path=TextGroupProperties.GeographicNames}" />
                                <CheckBox Content="Berth Number" IsChecked="{Binding Path=TextGroupProperties.BerthNumber}" />

                            </StackPanel>
                        </Grid>
                    </GroupBox>
                </StackPanel>

                <!-- View Over Groups -->
                <GroupBox Grid.Row="4" Margin="10,-5,10,0">
                    <GroupBox.Header>
                        <Label>View Over Groups</Label>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <StackPanel  Grid.Column="0" Margin="5,0,0,0" Orientation="Vertical" >
                            <CheckBox Content="Unknown objects" IsChecked="{Binding Path=ViewGroupProperties.UnknownObjects}" />
                            <CheckBox Content="Chart data coverage" IsChecked="{Binding Path=ViewGroupProperties.ChartDataCoverage}" />
                            <CheckBox Content="Standard land areas" IsChecked="{Binding Path=ViewGroupProperties.StandardLandAreas}" />
                            <CheckBox Content="Area Of depth less than safety contour" IsChecked="{Binding Path=ViewGroupProperties.AreaOfDepthLessThanSafetyContour}" />
                            <CheckBox Content="Water and seabed features" IsChecked="{Binding Path=ViewGroupProperties.WaterAndSeabedFeatures}" />
                            <CheckBox Content="Traffic routes" IsChecked="{Binding Path=ViewGroupProperties.TrafficRoutes}" />
                            <CheckBox Content="Cautionary areas" IsChecked="{Binding Path=ViewGroupProperties.CautionaryAreas}" />
                            <CheckBox Content="Information areas" IsChecked="{Binding Path=ViewGroupProperties.InformationAreas}" />
                            <CheckBox Content="Buoys and beacons" IsChecked="{Binding Path=ViewGroupProperties.BuoysAndBeacons}" />
                            <CheckBox Content="Lights" IsChecked="{Binding Path=Lights}" />
                        </StackPanel>
                        <StackPanel  Grid.Column="1" Margin="5,0,0,0" Orientation="Vertical" >
                            <CheckBox Content="Fog signals" IsChecked="{Binding Path=ViewGroupProperties.FogSignals}" />
                            <CheckBox Content="Radar" IsChecked="{Binding Path=ViewGroupProperties.Radar}" />
                            <CheckBox Content="Services" IsChecked="{Binding Path=ViewGroupProperties.Services}" />
                            <CheckBox Content="Information about chart data" IsChecked="{Binding Path=ViewGroupProperties.InformationAboutChartData}" />
                            <CheckBox Content="Other land areas" IsChecked="{Binding Path=ViewGroupProperties.OtherLandAreas}" />
                            <CheckBox Content="Soundings" IsChecked="{Binding Path=ViewGroupProperties.Soundings}" />
                            <CheckBox Content="Depth contours currents magnetics" IsChecked="{Binding Path=ViewGroupProperties.DepthContoursCurrentsMagnetics}" />
                            <CheckBox Content="Seabed and obstructions" IsChecked="{Binding Path=ViewGroupProperties.SeabedAndObstructions}" />
                            <CheckBox Content="Services and small craft facilities" IsChecked="{Binding Path=ViewGroupProperties.ServicesAndSmallCraftFacilities}" />
                        </StackPanel>
                    </Grid>
                </GroupBox>

                <!-- Miscellaneous -->
                <GroupBox Grid.Row="5" Margin="10,-5,10,10" >
                    <GroupBox.Header>
                        <Label>Miscellaneous</Label>
                    </GroupBox.Header>
                    <StackPanel Margin="5,0,0,0" Orientation="Horizontal">
                        <CheckBox Margin="5,0,0,0" Content="Display National Object Name" IsChecked="{Binding Path=DisplayNationalObjectName}" />
                        <CheckBox Margin="5,0,0,0" Content="Honor Scamin" IsChecked="{Binding Path=HonorScamin}" />
                    </StackPanel>
                </GroupBox>
           
            </Grid>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014