Beispiel #1
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);
 }
Beispiel #2
0
 public void BookmarkTest()
 {
     Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkListItem target = new BookmarkListItem(bookmark);
     Bookmark actual;
     actual = target.Bookmark;
     Assert.AreEqual(bookmark, actual);
 }
Beispiel #3
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);
 }
        /// <summary>
        /// Adds a Bookmark item to the BookmarkList
        /// </summary>
        /// <param name="inputBookmark">Bookmark to be added</param>
        public BookmarkListItem AddBookmark(Bookmark inputBookmark)
        {
            BookmarkListItem inputItem = new BookmarkListItem(inputBookmark);
            BookmarkListBox.Items.Add(inputItem);

            inputItem.Selected += new RoutedEventHandler(BookmarkListItem_Selected);

            return inputItem;
        }
Beispiel #5
0
 public void BookmarkListItemConstructorTest()
 {
     Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkListItem target = new BookmarkListItem(bookmark);
     Assert.AreEqual(bookmark, target.Bookmark);
     Assert.AreEqual("123", target.Bookmark.ID);
     Assert.AreEqual("Test Description", target.Bookmark.Description);
     Assert.AreEqual(Bookmark.BookmarkPriority.High, target.Bookmark.Priority);
 }
Beispiel #6
0
 public void IsOpenTest()
 {
     Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
     BookmarkListItem target = new BookmarkListItem(bookmark);
     bool expected = false; // newly created bookmark list item should not be open
     bool actual = target.IsOpen;
     //false by default
     Assert.AreEqual(expected, actual);
     target.IsOpen = true;//test the setter
     actual = target.IsOpen;
     Assert.AreEqual(true, actual);
 }
Beispiel #7
0
        /// <summary>
        /// Constructor for BookmarkPin.  Takes in the represented Bookmark and the screen point as arguments.
        /// </summary>
        /// <param name="bm">related bookmark</param>
        /// <param name="screenPoint">location of pin on screen</param>
        public BookmarkPin(Bookmark bm, Point screenPoint)
        {
            bookmark = bm;
            scr_pt = screenPoint;
            toggle = false;

            descriptionBlock = new TextBlock();
            descriptionBlock.Text = bm.Description;
            descriptionBlock.Height = 50;
            descriptionBlock.Width = 100;
            descriptionBlock.Background = new SolidColorBrush(Colors.White);
            descriptionBlock.Foreground = new SolidColorBrush(Colors.Black);
        }
Beispiel #8
0
        public void BookmarkConstructorTest()
        {
            Envelope envelope = new Envelope(new MapPoint(120, 10), new MapPoint(120, 20));
            string description = "A Test";
            string Id = "The ID";
            Bookmark.BookmarkPriority p = Bookmark.BookmarkPriority.High;
            Bookmark target = new Bookmark(envelope, description, Id, p);

            Assert.AreEqual(envelope, target.MapFrameEnvelope);
            Assert.AreEqual(description, target.Description);
            Assert.AreEqual(Id, target.ID);
            Assert.AreEqual(p, target.Priority);
        }
Beispiel #9
0
        public void BookmarkConstructorTest1()
        {
            MapPoint location = new MapPoint(110, 20);
            string description = "Another Test";
            string Id = "The new ID";
            Bookmark.BookmarkPriority p = Bookmark.BookmarkPriority.Low;
            Bookmark target = new Bookmark(location, description, Id, p);

            Assert.AreEqual(location, target.MapCoordinate);
            Assert.AreEqual(description, target.Description);
            Assert.AreEqual(Id, target.ID);
            Assert.AreEqual(p, target.Priority);
        }
Beispiel #10
0
        public void AddBookmarkTest()
        {
            BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance;
            tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical);

            Point pt = new Point(200, 200);
            double orientation = 180.00;
            BookmarkListFrame target = new BookmarkListFrame(pt, orientation);
            Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkListItem expected = new BookmarkListItem(bookmark);
            BookmarkListItem actual;
            actual = target.AddBookmark(bookmark);
            Assert.AreEqual(expected, actual);
        }
Beispiel #11
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);
        }
Beispiel #12
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);
 }
Beispiel #13
0
        public void BookmarkListItemsTest()
        {
            BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance;
            tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical);

            Point pt = new Point(200, 200);
            double orientation = 180.00;
            BookmarkListFrame_Accessor target = new BookmarkListFrame_Accessor(pt, orientation);
            Bookmark bm1 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            Bookmark bm2 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Bookmark 2", "321", Bookmark.BookmarkPriority.Low);
            BookmarkListItem item1 = new BookmarkListItem(bm1);
            BookmarkListItem item2 = new BookmarkListItem(bm2);
            target.BookmarkListItems.Clear();
            target.BookmarkListBox.Items.Add(item1);
            target.BookmarkListBox.Items.Add(item2);

            ItemCollection actual;
            actual = target.BookmarkListItems;
            //we should have 2 items
            Assert.AreEqual(2, actual.Count);
            //we should the the correct items
            Assert.AreEqual(item1, actual.GetItemAt(0));
            Assert.AreEqual(item2, actual.GetItemAt(1));
        }
Beispiel #14
0
        public void RemoveBookmarkItemTest()
        {
            BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance;
            tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical);

            Point pt = new Point(200, 200);
            double orientation = 180.00;
            BookmarkListFrame_Accessor target = new BookmarkListFrame_Accessor(pt, orientation);
            Bookmark bm1 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            Bookmark bm2 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Bookmark 2", "321", Bookmark.BookmarkPriority.Low);
            BookmarkListItem item1 = new BookmarkListItem(bm1);
            BookmarkListItem item2 = new BookmarkListItem(bm2);
            target.BookmarkListItems.Clear();
            target.BookmarkListBox.Items.Add(item1);
            target.BookmarkListBox.Items.Add(item2);
            //We should have 2 items in our list box now
            Assert.AreEqual(2, target.BookmarkListBox.Items.Count);
            target.RemoveBookmarkItem(item2);
            //we should have 1 item now
            Assert.AreEqual(1, target.BookmarkListBox.Items.Count);
            //the deleted item shouldn't be in the list
            Assert.AreEqual(false, target.BookmarkListItems.Contains(item2));
            //the non-deleted item should still be in the list
            Assert.AreEqual(true, target.BookmarkListItems.Contains(item1));

            target.RemoveBookmarkItem(item2);
            //trying to remove something not in the list should not do anything
            Assert.AreEqual(1, target.BookmarkListItems.Count);//we should still have 1 item in our list
        }
Beispiel #15
0
        public void DescriptionTest()
        {
            MapPoint location = new MapPoint(110, 20);
            string description = "Another Test";
            string Id = "The new ID";
            Bookmark.BookmarkPriority p = Bookmark.BookmarkPriority.Low;
            Bookmark target = new Bookmark(location, description, Id, p);

            string expected = "The new Desc";
            string actual;
            target.Description = expected;
            actual = target.Description;
            Assert.AreEqual(expected, actual);
        }
Beispiel #16
0
        public void getBookmarkPriorityStringTest()
        {
            MapPoint location = new MapPoint(100, 50);
            string description = "Testing the Priority String";
            string Id = "An ID";
            Bookmark.BookmarkPriority p = Bookmark.BookmarkPriority.Medium;
            Bookmark target = new Bookmark(location, description, Id, p);

            string expected = "Medium";
            string actual;
            actual = target.getBookmarkPriorityString();
            Assert.AreEqual(expected, actual);
        }
Beispiel #17
0
        /// <summary>
        /// Adds a new MapFrame to the layer via the BookmarkPins.
        /// 
        /// The position of the MapFrame (centre) is the same as the related BookmarkPin.  
        /// The orientation of the frame is also defined. The map extent of the frame is the same as the related Bookmark.
        /// </summary>
        /// <param name="bookmark">Related Bookmark</param>
        /// <param name="centerPt">Center point to place the map frame on the screen</param>
        /// <param name="orientation">Orientation of the map frame</param>
        /// <param name="fromBookmarkList">true if the map frame is created from the Bookmark list, false otherwise</param>
        /// <returns></returns>
        public MapFrame CreateMapFrame(Bookmark bookmark, Point centerPt, double orientation, bool fromBookmarkList)
        {
            /* if it is already open, dont open again */
            if (bookmark.MapFrameCurrentlyOpen == true)
            {
                BackgroundMapLayer.Instance.BringMapFrameToFront(bookmark);
                return null;
            }

            Envelope mapExtent = new Envelope();
            double frameHeight = 270;
            double frameWidth = 270;
            Point frameCenter = centerPt;
            double frameOri = orientation;

            // TODO: Check if this makes a difference or if it is not needed
            if (fromBookmarkList)
            {
                mapExtent = bookmark.MapFrameEnvelope;
                frameOri = orientation + 90;
            }

            if (bookmark.MapFramePreviouslyOpen == true)
            {
                /* Do we really want to open the map frame from it's previous position? */
                //mapExtent = bookmark.MapFrameEnvelope;
                //frameHeight = bookmark.MapFrameHeight;
                //frameWidth = bookmark.MapFrameWidth;
                //frameCenter = bookmark.MapFrameCenter;
                //frameOri = bookmark.MapFrameOrientation;
            }
            else
            {
                mapExtent = bookmark.MapFrameEnvelope;
                //frameHeight = height;
                //frameWidth = width;
                frameCenter = centerPt;
            }

            SolidColorBrush randomColor = GetRandomColor();

            ArcGisMap BackgroundMap = BackgroundMapLayer.Instance.getBackgroundMap();

            GhostFrame gFrame = new GhostFrame(BackgroundMap, mapExtent, randomColor);
            MapFrame mFrame = new MapFrame(gFrame, mapExtent, randomColor);

            /* create new delegates instances and bind them to MapFrame's MapLayer managment methods */
            /*MapLayersManager.MapLayerAddedDelegate delegate1 = new MapLayersManager.MapLayerAddedDelegate(mFrame.MapLayerAdded);
            MapLayersManager.MapLayerDeletedDelegate delegate2 = new MapLayersManager.MapLayerDeletedDelegate(mFrame.MapLayerDeleted);
            MapLayersManager.Instance.MapLayerAdded += delegate1;
            MapLayersManager.Instance.MapLayerDeleted += delegate2;*/

            mFrame.RelatedBookmark = bookmark;
            mFrame.Orientation = frameOri;
            mFrame.Height = frameHeight;
            mFrame.Width = frameWidth;
            mFrame.Center = frameCenter;

            bookmark.MapFrameCurrentlyOpen = true;

            return mFrame;
        }
 /// <summary>
 /// Search for the MapFrame in this layer that is related to the
 /// given Bookmark.  If the MapFrame exists, return it, otherwise, return
 /// null.
 /// </summary>
 /// <param name="bookmark">Bookmark object related to the requested map frame.</param>
 /// <returns>the map frame if found, otherwise null</returns>
 public MapFrame GetMapFrame(Bookmark bookmark)
 {
     for (int i = 0; i < mapFramesList.Count; i++)
     {
         if (mapFramesList[i] is MapFrame)
         {
             MapFrame mp = mapFramesList[i] as MapFrame;
             if (mp.RelatedBookmark == bookmark)
                 return mp;
         }
     }
     return null;
 }
        /// <summary>
        /// Performs additional setup after receiving trouble ticket data, creates a TroubleTicketGraphicLayer for the background map.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void serverTicketsUpdateCompleted(Object sender, EventArgs e)
        {
            MapLayersManager.Instance.AddLayer(CloneLayer());

             List<Bookmark> bookmarks = new List<Bookmark>();

             foreach (Graphic g in Graphics)
             {
                 Bookmark.BookmarkPriority p;
                 switch (g.Attributes["Severity"].ToString())
                 {
                     case "1":
                         p = Bookmark.BookmarkPriority.Low;
                         break;
                     case "2":
                         p = Bookmark.BookmarkPriority.Medium;
                         break;
                     case "3":
                         p = Bookmark.BookmarkPriority.High;
                         break;
                     default:
                         p = Bookmark.BookmarkPriority.Low;
                         break;
                 }

                 Bookmark b = new Bookmark((g.Geometry as MapPoint), g.Attributes["Description"].ToString(), g.Attributes["OBJECTID"].ToString(),  p);
                 bookmarks.Add(b);

             }
             BookmarkList.Instance.initializeBookmarkList(bookmarks);
        }
Beispiel #20
0
        public void MapFramePreviouslyOpenTest()
        {
            MapPoint location = new MapPoint(110, 20);
            string description = "Another Test";
            string Id = "The new ID";
            Bookmark.BookmarkPriority p = Bookmark.BookmarkPriority.Low;
            Bookmark target = new Bookmark(location, description, Id, p);

            bool expected = false;
            Assert.AreEqual(expected, target.MapFramePreviouslyOpen);
        }
Beispiel #21
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);
 }
Beispiel #22
0
 /// <summary>
 /// Constructor of BookmarkListItem
 /// </summary>
 /// <param name="bm">Related Bookmark Object</param>
 public BookmarkListItem(Bookmark bm)
 {
     relatedTicket = bm;
     this.Content = bm.Description;
 }
 /// <summary>
 /// Increase the ZIndex of the map frame representing this bookmark object to bring it to front of other widgets.
 /// </summary>
 /// <param name="bookmark">Bookmark object related to the map frame.</param>
 public void BringMapFrameToFront(Bookmark bookmark)
 {
     if (bookmark.MapFrameCurrentlyOpen == true)
     {
         MapFrame mf = GetMapFrame(bookmark);
         if (mf != null)
             mf.ZIndex = 10;
     }
 }