GOOD APPLICATION BUT BASIC GIS TOOLS MISSING

1193
15
04-19-2012 06:23 AM
warrenkinyua
New Contributor II
Dear ESRI

Many thanks for silver light builder.The Application is very easy to use and Powerful but I cant find the following basic GIS Tools:

1.Measure Tool
2.Querry Tool
3.Find Tool
4.BookMarks Tool

Where can I get these add-inns without starting to code?

I greatly appreciate the attribute table functions


Regards
0 Kudos
15 Replies
GalAvraham
New Contributor II
Brian, many thanks for sharing this tool. I was looking for such implementation.
Can you supply, for a non-programmer, a short explanation on how to add this functionality to an already deployed application? Where exactly in code one need to add this in order to have the measure tool available for the user?
Thanks in advance

Gal
0 Kudos
OlegLukyanov
New Contributor III
Yes Gal,  I agree

I try Brian's  code with
http://help.arcgis.com/en/webapps/silverlightviewer/help/index.html#/Extending_the_ArcGIS_Viewer_for...

http://video.esri.com/watch/1181/configuring-and-customizing-arcgis-viewer-for-silverlight/
but I need also first detailing step by step for beginners.

I think best to do it with Brian's code and some ArcGIS API fo SL samples.

BTW. What are future plans for developing Viewer and new features?

Oleg
0 Kudos
BrianLeroux
Occasional Contributor III
The first thing you need to learn is how to create/deploy a custom layout. This link, Creating a Custom Layout,  explains that process.

You can place my code in different locations depending on where in the map you would like to see the measuring control panel. I used the accordian layout as my starting template. Create a copy of the accordian.xaml and name it whaterver you want. For my example You should find the area around line 571 that startes esri:map. This is where I implement my custom tools. Here is my code expanded a little so you can see where I implemented it. I actually have 2 tools in here. One is the measurinf tools and the other is a tranparency slide that changes the transparency of the selected layer. I changed both items to Visible so they will always show for you. You can take a look at the viewer help and samples for instructions to create a toggle to turn these on and off using an add-in. I'll be glad to answer any questions if I can.

<esri:Map x:Name="Map" HorizontalAlignment="Stretch" IsLogoVisible="False"  VerticalAlignment="Stretch" 
                      Grid.ColumnSpan="2" Grid.RowSpan="3" WrapAround="True"
                d:DataContext="{Binding Converter={StaticResource SampleGraphicsLayerConverter}, RelativeSource={RelativeSource Self}}"/>
            <Grid Grid.Column="{Binding ElementName=SidePanelContainer, Path=Visibility, Converter={StaticResource VisibilityToIntConverter}}"
                  Grid.ColumnSpan="{Binding ElementName=SidePanelContainer, Path=Visibility, Converter={StaticResource VisibilityToIntConverter}, ConverterParameter='1,2'}" Grid.RowSpan="{Binding Visibility, ConverterParameter=1\,2, Converter={StaticResource VisibilityToIntConverter}, ElementName=FeatureDataGridContainer}">

                <esri:MapProgressBar Map="{Binding ElementName=Map}" Width="250" Height="35" Style="{StaticResource MapProgressBarStyle}" Margin="10,5,0,2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Bottom"  />
                <ContentControl x:Name="ScaleBarContainer" 
                                                  Margin="20,0,0,2"                                                   
                                                  HorizontalAlignment="Left" 
                                                  HorizontalContentAlignment="Stretch"                                
                                                  VerticalAlignment="Bottom"                                                                                                     
                                                  Foreground="WhiteSmoke">
                    <ContentControl.Effect>
                        <DropShadowEffect BlurRadius="10" ShadowDepth="2" Opacity="1" Direction="300" />
                    </ContentControl.Effect>
                </ContentControl>

                <ContentControl x:Name="AttributionDisplayContainer"
                                HorizontalAlignment="Right" VerticalAlignment="Bottom" 
                                Margin="0,0,6,2"/>
                
     
                        <!--Measuring Tools-->
                <Grid x:Name="MeasureBox" HorizontalAlignment="Right" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" Visibility="Visible">
                    <Border Style="{StaticResource GlassyBorder}" Padding="10,3,10,3" Opacity="1">
                        <!--<Border.Effect>
                            <DropShadowEffect />
                        </Border.Effect>-->
                        <StackPanel >
                            <TextBlock Text="Measuring Tools" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
                            <TextBlock Text="Select Units:" Foreground="White" FontSize="12" Margin="2" />
                            <ComboBox x:Name="UnitCombo" Foreground="White" Margin="0,0,0,4" >
                                
                                <ComboBox.Items>
                                    <ComboBoxItem Content="Feet" IsSelected="True" Foreground="Black"/>
                                    <ComboBoxItem Content="Meters"  Foreground="Black"/>
                                    <ComboBoxItem Content="Miles"  Foreground="Black"/>
                                </ComboBox.Items>
                            </ComboBox>

                            <ComboBox x:Name="AreaCombo" Foreground="White">
                                <ComboBox.Items>
                                    <ComboBoxItem Content="SquareFeet" IsSelected="True"  Foreground="Black"/>
                                    <ComboBoxItem Content="SquareMeters"  Foreground="Black"/>
                                    <ComboBoxItem Content="SquareMiles"  Foreground="Black"/>
                                </ComboBox.Items>
                            </ComboBox>
                            <Rectangle Margin="0,10,0,10" Fill="White" Height="2" HorizontalAlignment="Stretch" />

                            <Button  Margin="0,0,0,2"                            
                            Content="Length(Line)"  >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <esri:MeasureAction                                  
                                    AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
                                    DisplayTotals="True"
                                    DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
                                    MapUnits="Meters"
                                    MeasureMode="Polyline"                                   
                                    FillSymbol="{StaticResource DefaultFillSymbol}"
                                    TargetName="Map"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Margin="0,2,0,2"                             
                            Content="Radius(Circle)"  >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <esri:MeasureAction                                  
                                    AreaUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
                                    DisplayTotals="True"
                                    DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
                                    MapUnits="Meters"
                                    MeasureMode="Radius"                                   
                                    FillSymbol="{StaticResource DefaultFillSymbol}"
                                    TargetName="Map"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button  Margin="0,2,0,2"                           
                            Content="Area(Polygon)"  >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <esri:MeasureAction                                  
                                    AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
                                    DisplayTotals="True"
                                    DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
                                    MapUnits="Meters"
                                    MeasureMode="Polygon"                                   
                                    FillSymbol="{StaticResource DefaultFillSymbol}"
                                    TargetName="Map"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            
                        </StackPanel>
                    </Border>

                </Grid>
                <!--Transparency Slider-->
                <Grid x:Name="TransparencyBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" Visibility="Visible">
                    <Border Style="{StaticResource GlassyBorder}" Padding="10,3,10,3" Opacity="1">
                        <!--<Border.Effect>
                            <DropShadowEffect />
                        </Border.Effect>-->
                        
                        <StackPanel Background="Transparent" Margin="0,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center">
                            <TextBlock Text="Layer Transparency" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />                            
                            <Slider  Height="23" Width="100" Name="slider1" Minimum="0" Maximum="1" Value="{Binding Path=SelectedLayer.Opacity, Mode=TwoWay, Source={StaticResource MapApplication}}" IsDirectionReversed="False" />
                        </StackPanel>
                    </Border>
                </Grid>

            </Grid>
0 Kudos
RichZwaap
Occasional Contributor III
Measure tool - that is coming soon and we will be posting that in the Code Gallery.


This can be found on ArcGIS.com here and is also available in the Viewer's code gallery.  This is a production quality, ready-to-use tool with full source code included.
0 Kudos
BrianLeroux
Occasional Contributor III
This can be found on ArcGIS.com here and is also available in the Viewer's code gallery.  This is a production quality, ready-to-use tool with full source code included.


The new Measuring Add-in works great. Thanks for putting this out. It will be very beneficial for a lot of people.

One thing I noticed is that you have to run a tool before specifying your units of measurement. It would be nice to have that option before measuring. If I decide to use your tool I will change myself but others that do not have the knowledge how to due that may benefit from a future update to the tool to allow this.
0 Kudos
GalAvraham
New Contributor II
Many thanks Brian for the explanation. This came shortly before the measure add-in was added to the code gallery, so we've implemented the add-in rather than looking into the code.
Thanks again.

Gal
0 Kudos