Exemplo n.º 1
0
        /// <summary>
        /// Create a Bookmark Info Tip object representing the specified Bookmark pin
        /// </summary>
        /// <param name="pin">Bookmark Pin to create the info tip</param>
        public BookmarkInfoTip(BookmarkPin pin)
        {
            InitializeComponent();

            ttp = pin;
            TT_Num.Text = pin.Bookmark.ID;
            TT_SEV.Text = pin.Bookmark.getBookmarkPriorityString();

            /* Change the background color of the Priority text accordingly */
            switch (TT_SEV.Text)
            {
                case "High":
                    TT_SEV.Foreground = new SolidColorBrush(Colors.Red);
                    SS_SEV.Value = 1;
                    break;
                case "Medium":
                    TT_SEV.Foreground = new SolidColorBrush(Colors.Yellow);
                    SS_SEV.Value = 2;
                    break;
                case "Low":
                    TT_SEV.Foreground = new SolidColorBrush(Colors.Green);
                    SS_SEV.Value = 3;
                    break;
                default:
                    TT_SEV.Foreground = new SolidColorBrush(Colors.Gray);
                    break;
            }

            TT_DES.Text = pin.Description;
            TT_LOC.Text = pin.Bookmark.MapCoordinate.ToString();

            ShowMapButton.Visibility = Visibility.Visible;
        }
Exemplo n.º 2
0
 public void BookmarkPinWithPointConstructorTest()
 {
     //Constructor with screen point
     Point screenPoint = new Point(200, 200);
     BookmarkPin target = new BookmarkPin(screenPoint);
     Assert.AreEqual(screenPoint, target.ScreenPt);
 }
Exemplo n.º 3
0
 public void BookmarkPinWithBookmarkPinConstructorTest()
 {
     Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     Point screenPoint = new Point(200, 200);
     BookmarkPin target = new BookmarkPin(bm, screenPoint);
     Assert.AreEqual(bm, target.Bookmark);
     Assert.AreEqual(screenPoint, target.ScreenPt);
 }
Exemplo n.º 4
0
 public void BookmarkTest()
 {
     Point screenPoint = new Point(200, 200);
     Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkPin target = new BookmarkPin(bm, screenPoint);
     Bookmark actual;
     actual = target.Bookmark;
     Assert.AreEqual(bm, actual);
 }
Exemplo n.º 5
0
        public void AddBookmarkPinTest()
        {
            ArcGisMap target = new ArcGisMap();
            BookmarkPin pin = new BookmarkPin(new Point(100, 50));
            GraphicsLayer graphicsLayer = target.Map.Layers["BookmarksLayer"] as GraphicsLayer;
            int initialCount = graphicsLayer.Graphics.Count;
            target.AddBookmarkPin(pin);
            int finalCount = graphicsLayer.Graphics.Count;

            Assert.AreEqual(initialCount + 1, finalCount);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
 public void DescriptionBlockTest()
 {
     Point screenPoint = new Point(200, 200);
     Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkPin target = new BookmarkPin(bm, screenPoint);
     TextBlock expected = new TextBlock();
     expected.Text = "This is a description";
     TextBlock actual;
     target.DescriptionBlock = expected;
     actual = target.DescriptionBlock;
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 8
0
 public void YTest()
 {
     Point screenPoint = new Point(200, 100);
     BookmarkPin target = new BookmarkPin(screenPoint);
     int actual;
     actual = target.Y;
     Assert.AreEqual(100, actual);
 }
Exemplo n.º 9
0
 public void TapTest()
 {
     Point screenPoint = new Point(200, 200);
     BookmarkPin target = new BookmarkPin(screenPoint);
     //newly created pin should have not been tapped
     Assert.AreEqual(false, target.isActive);
     target.Tap();
     //after its tapped, it should be active now
     Assert.AreEqual(true, target.isActive);
     target.Tap();
     //now it should be false again
     Assert.AreEqual(false, target.isActive);
 }
Exemplo n.º 10
0
 public void ScreenPtTest()
 {
     Point screenPoint = new Point(200, 200);
     BookmarkPin target = new BookmarkPin(screenPoint);
     Point expected = new Point(300, 300);
     Point actual;
     target.ScreenPt = expected;
     actual = target.ScreenPt;
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 11
0
 public void PriorityTest()
 {
     Point screenPoint = new Point(200, 200);
     Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkPin target = new BookmarkPin(bm, screenPoint);
     Bookmark.BookmarkPriority expected = Bookmark.BookmarkPriority.High;
     Bookmark.BookmarkPriority actual;
     target.Priority = expected;
     actual = target.Priority;
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Used for demo purpose. Populates the background map with BookmarkPins representing the location of each Bookmark.
 /// </summary>
 public void CreateBookmarkPins(List<GISforTT_API.Bookmark> bmrks)
 {
     foreach (GISforTT_API.Bookmark tt in bmrks)
     {
         Point pt = Map.MapToScreen(tt.MapCoordinate);
         BookmarkPin ttpin = new BookmarkPin(tt, pt);
         AddBookmarkPin(ttpin);
     }
 }
Exemplo n.º 13
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);
        }