Get List of items showing on map grid.

3 posts, 0 answers
  1. Paul Grothe
    Paul Grothe avatar
    26 posts
    Member since:
    Apr 2010

    Posted 13 Jan 2015 Link to this post

    I am trying to have a RadGridView holding data for all the points visible on the map.  As the map moves and zooms the grid needs to update to display only those points actually visible.  None of the lists I've been able to put together give me everything on the map but only what is displayed.  Do I actually have to find the 4 corners of the visible area and do the calculations myself?

    <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="250" />
            </Grid.RowDefinitions>
            <telerik:RadMap x:Name="radCarrierMap" Center="40.7254808779182,-96.9034722532031" ZoomLevel="4" DistanceUnit="Mile" 
                          ZoomingFinished="radCarrierMap_ZoomingFinished" ZoomChanging="radCarrierMap_ZoomChanging" PanningFinished="radCarrierMap_PanningFinished" CenterChanging="radCarrierMap_CenterChanging">
                <telerik:RadMap.Providers>
                    <telerik:BingMapProvider />
                </telerik:RadMap.Providers>

                <telerik:InformationLayer x:Name="informationLayer">
                    <telerik:InformationLayer.ItemTemplate>
                        <DataTemplate>
                            <Grid telerik:MapLayer.BaseZoomLevel="{Binding BaseZoomLevel}"
                          telerik:MapLayer.Location="{Binding ItemLocation}"
                          telerik:MapLayer.ZoomRange="{Binding ItemZoomRange}">
                                <Ellipse x:Name="PART_Ellipse"
                                  Width="20"
                                  Height="20"
                                  Stroke="Red"
                                  StrokeThickness="3"
                                  Fill="Transparent">
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="{Binding Caption}" />
                                    </ToolTipService.ToolTip>
                                </Ellipse>
                            </Grid>
                        </DataTemplate>
                    </telerik:InformationLayer.ItemTemplate>
                </telerik:InformationLayer>

                <telerik:DynamicLayer x:Name="dynamicLayer">
                    <telerik:DynamicLayer.ZoomGridList>
                        <telerik:ZoomGrid LatitudesCount="2"
                                  LongitudesCount="2"
                                  MinZoom="3" />
                        <telerik:ZoomGrid LatitudesCount="15"
                                  LongitudesCount="15"
                                  MinZoom="10" />
                    </telerik:DynamicLayer.ZoomGridList>
                </telerik:DynamicLayer>
                <telerik:VirtualizationLayer x:Name="vLayer">


                </telerik:VirtualizationLayer>
            </telerik:RadMap>

            <Border BorderThickness="2" BorderBrush="Black" Height="110" Width="300" Margin="10,10,0,3" HorizontalAlignment="Left" VerticalAlignment="Top" >
                <StackPanel>
                    <StackPanel.Background>
                        <SolidColorBrush Color="Black" Opacity="0.7" />
                    </StackPanel.Background>
                    <StackPanel Margin="5,0,5,0">
                        <TextBlock Margin="0,10,0,0" Foreground="LightGray" Text="Address Search:"/>
                        <telerik:RadAutoCompleteBox Name="tbAddressSearch" VerticalAlignment="Top"
                                                          SelectionMode="Single"
                                                          WatermarkContent="Type an address"
                                                          TextSearchMode="Contains"
                                                          TextSearchPath="Address1"
                                                          AutoCompleteMode="Suggest"
                                                          DropDownItemTemplate="{StaticResource AddressSearchTemplate}" 
                                                   SearchTextChanged="tbAddressSearch_SearchTextChanged" 
                                              SelectionChanged="tbAddressSearch_SelectionChanged" />
                        <TextBlock Margin="0,10,0,0" Foreground="LightGray" Text="Search Radius:"/>
                        <TextBox Name="tbSearchRadius" Width="50" HorizontalAlignment="Left" Text="30"  LostFocus="tbSearchRadius_LostFocus"  />
                    </StackPanel>
                </StackPanel>
            </Border>
            <telerik:RadGridView x:Name="TargetCarrierGrid" AutoGenerateColumns="False" Grid.Row="2"  
                               ItemsSource="webService"  RowIndicatorVisibility="Collapsed" ShowGroupPanel="False" 
                               SelectionChanged="TargetCarrierGrid_SelectionChanged" CanUserInsertRows="False" IsReadOnly="True">
                <telerik:RadGridView.Columns>

                    <telerik:GridViewDataColumn Header="Name"
                                              DataMemberBinding="{Binding Namek__BackingField}"
                                              IsReadOnly="False" Width="150" TextWrapping="Wrap" >
                    </telerik:GridViewDataColumn>

                    <telerik:GridViewDataColumn Header="Miles"
                                              DataMemberBinding="{Binding Milesk__BackingField}"
                                              IsReadOnly="False" Width="60" />
                    <telerik:GridViewDataColumn Header="Phone"
                                              DataMemberBinding="{Binding Phonek__BackingField}"
                                              IsReadOnly="False" Width="100" TextWrapping="Wrap" />
                    <telerik:GridViewDataColumn Header="City-State"
                                              DataMemberBinding="{Binding Locationk__BackingField}"
                                              IsReadOnly="False" Width="120" TextWrapping="Wrap" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </Grid>
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 16 Jan 2015 Link to this post

    Hi Paul,

    I am contacting you to inform you that we are currently working on your requirement. However, we will need more time to completely investigate your case. We will contact you again as soon as we have more information to share with you .

    Thank you for your patience.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 20 Jan 2015 Link to this post

    Hi Paul,

    Thank you for your patience. We found an approach that will fit your scenario.

    You can take advantage of the RadMap.LocationRect property. It exposes a method that checks if given coordinates or rectangle is visible on the map. This method is called Contains(). 

    In order to achieve your requirement you can traverse all the pins of the map and check if the location of each one is contained by the viewport (using the Contains() method). Furthermore you can create a collection holding all pins that are currently visible and use that collection to fill your grid.

    Please give this approach a try and let us know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top