예제 #1
0
        public void BookmarkInfoTipConstructorTest()
        {
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.MapPoint(120, 20), "Test Bookmark", "This is the ID", Bookmark.BookmarkPriority.Medium);
            BookmarkPin pin = new BookmarkPin(bm, new Point(110, 50));

            BookmarkInfoTip target = new BookmarkInfoTip(pin);

            Assert.AreEqual(target.getBookmarkPin(), pin);
            Assert.AreEqual(target.getBookmarkNumTextBlock().Text, pin.Bookmark.ID);
            Assert.AreEqual(target.getBookmarkSevTextBlock().Text, pin.Bookmark.getBookmarkPriorityString());
            Assert.AreEqual(target.getBookmarkSevTextBlock().Foreground, new SolidColorBrush(Colors.Yellow));
            Assert.AreEqual(target.getBookmarkSevSlider().Value, 2);
            Assert.AreEqual(target.getDescriptionTextBox().Text, pin.Description);
            Assert.AreEqual(target.getLocationTextBox().Text, pin.Bookmark.MapCoordinate.ToString());
            Assert.AreEqual(target.getShowMapButton().Visibility, Visibility.Visible);
        }
예제 #2
0
        /// <summary>
        /// Add a bookmark pin to the BookmarksLayer on the map. Works only if the BookmarksLayer is created and added to the map.
        /// </summary>
        /// <param name="pin">BookmarkPin to be added</param>
        public void AddBookmarkPin(BookmarkPin pin)
        {
            if (!MapLayersManager.Instance.bookmarkLayerAdded) return;

            GraphicsLayer graphicsLayer = MyMap.Layers["BookmarksLayer"] as GraphicsLayer;
            if (graphicsLayer == null) return;

            BookmarkPinGraphic graphic = new BookmarkPinGraphic();

            graphic.Geometry = new MapPoint(pin.Bookmark.MapCoordinate.X, pin.Bookmark.MapCoordinate.Y);
            if (pin.Priority == GISforTT_API.Bookmark.BookmarkPriority.High)
            {
                graphic.Symbol = LayoutRoot.Resources["HighPriorityPinSymbol"] as SimpleMarkerSymbol;
            }
            else if (pin.Priority == GISforTT_API.Bookmark.BookmarkPriority.Medium)
            {
                graphic.Symbol = LayoutRoot.Resources["MeduimPriorityPinSymbol"] as SimpleMarkerSymbol;
            }
            else if (pin.Priority == GISforTT_API.Bookmark.BookmarkPriority.Low)
            {
                graphic.Symbol = LayoutRoot.Resources["LowPriorityPinSymbol"] as SimpleMarkerSymbol;
            }

            /* Which mouse button event to listen for? */
            //graphic.MouseRightButtonDown += new MouseButtonEventHandler(graphic_MouseRightButtonDown);
            graphic.MouseLeftButtonDown += new MouseButtonEventHandler(graphic_MouseLeftButtonDown);

            BookmarkInfoTip mapTip = null;
            if (isBgMap)
            {
                mapTip = new BookmarkInfoTip(pin);
                /* prepare the MapTip in the background map but don't make it visible */
                mapTip.Visibility = Visibility.Collapsed;

                BackgroundMapLayer.Instance.AddMapTip(mapTip, pin.ScreenPt, 0.0);
            }
            else
            {
                mapTip = new BookmarkInfoTip(pin);
            }

            graphic.MapTip = mapTip;

            graphicsLayer.Graphics.Add(graphic);
        }
예제 #3
0
        /// <summary>
        /// Add a bookmark info tip to the background layer
        /// </summary>
        /// <param name="mapTip">info tip widget to be added</param>
        /// <param name="screen_point">location of addition</param>
        /// <param name="orientation">orientation of the widget</param>
        public void AddMapTip(BookmarkInfoTip mapTip, Point screen_point, double orientation)
        {
            mapTip.Orientation = orientation;
            mapTip.Center = screen_point;

            BackgroundScatterView.Items.Add(mapTip);
        }