MapEllipseGeometry Center property not updating

5 posts, 1 answers
  1. Alex
    Alex avatar
    10 posts
    Member since:
    Nov 2010

    Posted 21 Jan 2011 Link to this post

    I'm working with the MapEllipseGeometry to get the centering right per this thread: http://www.telerik.com/community/forums/silverlight/map/mapellipse-center.aspx

    But I'm having problems with the MapEllipseGeometry center property not updating when properties change.

    The Parent RadMap's center property (which is bound to the same ViewModel property that the MapEllipseGeometry's center binds to) updates fine  & the MapEllipseGeometry's RadiusY and RadiusX update fine as well (which are all databound to the same object in my ViewModel).

    Here is the code for the MapEllipseGeometry & RadMap XAML and my ViewModel code for the properties associated with them
    <telerik:RadMap x:Name="RadMap" Center="{Binding SelectedGeofenceCenter}" ZoomLevel="10" DistanceUnit="Mile" Height="389" VerticalAlignment="Top" Margin="-10,4,-6,0" >
                        <telerik:RadMap.Provider>
                            <telerik:BingMapProvider ApplicationId="" />
                        </telerik:RadMap.Provider>
                        <telerik:InformationLayer>
                           <telerik:MapPath Fill="Red" Opacity=".6"
                                Stroke="Orange" StrokeThickness="2" >
                                <telerik:MapPath.Data>
                                    <telerik:MapEllipseGeometry x:Name="GeoEllipse" Center="{Binding SelectedGeofenceCenter}" RadiusX="{Binding SelectedGeofence.Radius}" RadiusY="{Binding  SelectedGeofence.Radius}"/>
                                </telerik:MapPath.Data>
                            </telerik:MapPath>
                        </telerik:InformationLayer>
                    </telerik:RadMap>
    //Last Location Center       
            public string LastLocationCenter
            {
                get
                {
                    return String.Format("{0},{1}", LastLocation.Lat, LastLocation.Lon);
                }
                 
            }
    public LocationPoint LastLocation
            {
                get
                {
                    return lastLocation;
                }
                set
                {
                    lastLocation = value;
                    RaisePropertyChanged("LastLocation");
                    RaisePropertyChanged("LastLocationCenter");
                }
            }

    I took out the ApplicationId.

    Any suggestions of why this is happening?

  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 25 Jan 2011 Link to this post

    Hi Alex,

    Thank you for the feedback.
    This problem will be fixed during implementation of the following task in our PITS system:
    http://www.telerik.com/support/pits.aspx#/public/silverlight/4352

    As workaround you can remove and then to add the map path element to the information layer for correcting of the ellipse location.
    The sample code is below.

    <telerik:RadMap x:Name="RadMap" Center="{Binding SelectedGeofenceCenter}" ZoomLevel="10" DistanceUnit="Mile" Height="389" VerticalAlignment="Top" Margin="-10,4,-6,0"
        CenterChanged="RadMap_CenterChanged">
                        <telerik:RadMap.Provider>
                            <telerik:BingMapProvider ApplicationId="" />
                        </telerik:RadMap.Provider>
                        <telerik:InformationLayer x:Name="informationLayer">
                           <telerik:MapPath x:Name="GeoPath" Fill="Red" Opacity=".6"
                                Stroke="Orange" StrokeThickness="2" >
                                <telerik:MapPath.Data>
                                    <telerik:MapEllipseGeometry x:Name="GeoEllipse" Center="{Binding SelectedGeofenceCenter}" RadiusX="{Binding SelectedGeofence.Radius}" RadiusY="{Binding  SelectedGeofence.Radius}"/>
                                </telerik:MapPath.Data>
                            </telerik:MapPath>
                        </telerik:InformationLayer>
                    </telerik:RadMap>
    private void RadMap_CenterChanged(object sender, EventArgs e)
    {
        this.informationLayer.Items.Remove(this.GeoPath);
        this.informationLayer.Items.Add(this.GeoPath);
    }


    Kind regards,
    Andrey Murzov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Alex
    Alex avatar
    10 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post

    Thanks, that seems to do the trick! :)
  5. Alex
    Alex avatar
    10 posts
    Member since:
    Nov 2010

    Posted 09 Jun 2011 Link to this post

    Hello,

    I just updated my project with the latest release of telerik silverlight controls and it seemed to have broken this exact piece of code. It seems to be having problems with the Center property. To be specific coordinates "36,-111" which is what is returned from the web service I'm consuming.

    I took the binding off the Center property to test with hard coded values. "0,0" works ok. But when I put  "36,-111" which is a completely valid set or coordinates, it gives me a "value does not fall between the expected range" ArgumentException 4004.

    Can you guys help me out on this one please?

    Update: Also the radiusX and radiusY is set to 4000. When I change it to 25 it seems to work regardless of the coordinates it binds to. Is there a limit on what size the radiusX and radiusY can be?
  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Jun 2011 Link to this post

    Hi Alex,

    The RadiusX and RadiusY propertyes are set in the RadMap distance units (miles in your case). Do you really need ellipse with 4000 miles radius? This ellipse has North-West corner (which is a base for many internal calculations) far outside of the coordinate system supported by Mercator projection.

    Regards,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner