Scaled MapPinPoint on RadMap

3 posts, 0 answers
  1. James
    James avatar
    12 posts
    Member since:
    Jan 2012

    Posted 09 Jan 2013 Link to this post

    I am building a large facility map that will show facility equipment using a RadMap with bitmaps to portray equipment (computers, printers, etc).  MapPinPoint seems to be the best approach to this.  I can successfully add a MapPinPoint to a RadMap with code like this:

    Uri uri = new Uri("/Printer.jpg", UriKind.Relative);

    MapPinPoint newMapPoint = new MapPinPoint();
    newMapPoint.ImageSource = new BitmapImage(uri);
    newMapPoint.Text = "Test";
    MapLayer.SetLocation(newMapPoint, new Location(19.70240, -154.08088));
    informationLayer.Items.Add(newMapPoint);

    This displays the image MapPinPoint with the correct image but introduces a zoom issue.  When I zoom in/out, I need the MapPinPoint to keep its scale.  If I zoom in, the image should get larger and I zoom out the image should get smaller.

    How do I accomplish this?  Or, is there a better approach to add image items on the map on the fly and have them scale with zooms?

    Thanks.
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Jan 2013 Link to this post

    Hi James,

    You can use the MinScale, MaxScale and BaseZoomLevel attachable properties of MapLayer. They can be applied to any framework element and they allow to make the framework element scaleable relatively to the zoom level.
    The sample code is below.
    Uri uri = new Uri("/Printer.jpg", UriKind.Relative);
     
    MapPinPoint newMapPoint = new MapPinPoint();
    newMapPoint.ImageSource = new BitmapImage(uri);
    newMapPoint.Text = "Test";
    MapLayer.SetLocation(newMapPoint, new Location(19.70240, -154.08088));
     
    MapLayer.SetMinScale(newMapPoint, 0);
    MapLayer.SetMaxScale(newMapPoint, double.PositiveInfinity);
    MapLayer.SetBaseZoomLevel(newMapPoint, 10);
     
    informationLayer.Items.Add(newMapPoint);

    All the best,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. James
    James avatar
    12 posts
    Member since:
    Jan 2012

    Posted 21 Jan 2013 Link to this post

    This worked great.  Thanks very much.
Back to Top