public void GetGhostFrameTest() { GhostFrame relatedGhostFrame = null; // TODO: Initialize to an appropriate value MapPoint p1 = null; // TODO: Initialize to an appropriate value MapPoint p2 = null; // TODO: Initialize to an appropriate value MapFrame target = new MapFrame(relatedGhostFrame, p1, p2); // TODO: Initialize to an appropriate value GhostFrame expected = null; // TODO: Initialize to an appropriate value GhostFrame actual; actual = target.GetGhostFrame(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Adds a new MapFrame to the layer via the /// two map points from the map. /// /// A MapFrame is created where the extent are defined /// by the two points (one for upper left corner and the /// other for lower right corner). /// /// The position of the MapFrame on the screen is also defined /// by the 2 Points value (one for upper left corner and another /// for lower right corner). /// </summary> /// <param name="mapPoint1"></param> /// <param name="mapPoint2"></param> /// <param name="screenPoint1"></param> /// <param name="screenPoint2"></param> public MapFrame CreateMapFrame(MapPoint mapPoint1, MapPoint mapPoint2, Point screenPoint1, Point screenPoint2) { SolidColorBrush randomColor = GetRandomColor(); ArcGisMap BackgroundMap = BackgroundMapLayer.Instance.getBackgroundMap(); GhostFrame gFrame = new GhostFrame(BackgroundMap, new Envelope(mapPoint1, mapPoint2), randomColor); MapFrame mFrame = new MapFrame(gFrame, mapPoint1, mapPoint2, randomColor); /* create new delegates instances and bind them to MapFrame's MapLayer managment methods */ /*MapLayersManager.MapLayerAddedDelegate delegate1 = new MapLayersManager.MapLayerAddedDelegate(mFrame.MapLayerAdded.ID); MapLayersManager.MapLayerDeletedDelegate delegate2 = new MapLayersManager.MapLayerDeletedDelegate(mFrame.MapLayerDeleted); MapLayersManager.Instance.MapLayerAdded += delegate1; MapLayersManager.Instance.MapLayerDeleted += delegate2;*/ mFrame.Orientation = 0.0; var xDiff = Math.Abs(screenPoint1.X - screenPoint2.X); var yDiff = Math.Abs(screenPoint1.Y - screenPoint2.Y); if (screenPoint1.X < screenPoint2.X && screenPoint1.Y < screenPoint2.Y) { mFrame.Orientation = 0.0; mFrame.Height = yDiff; mFrame.Width = xDiff; mFrame.Center = new System.Windows.Point(screenPoint1.X + xDiff / 2, screenPoint1.Y + yDiff / 2); } else if (screenPoint1.X > screenPoint2.X && screenPoint1.Y < screenPoint2.Y) { mFrame.Orientation = 90.0; mFrame.Height = yDiff; mFrame.Width = xDiff; mFrame.Center = new System.Windows.Point(screenPoint1.X - xDiff / 2, screenPoint1.Y + yDiff / 2); } else if (screenPoint1.X > screenPoint2.X && screenPoint1.Y > screenPoint2.Y) { mFrame.Orientation = 180.0; mFrame.Height = yDiff; mFrame.Width = xDiff; mFrame.Center = new System.Windows.Point(screenPoint1.X - xDiff / 2, screenPoint1.Y - yDiff / 2); } else if (screenPoint1.X < screenPoint2.X && screenPoint1.Y > screenPoint2.Y) { mFrame.Orientation = 270.0; mFrame.Height = yDiff; mFrame.Width = xDiff; mFrame.Center = new System.Windows.Point(screenPoint1.X + xDiff / 2, screenPoint1.Y - yDiff / 2); } return mFrame; }
public void SetMapFrameNameTest() { GhostFrame relatedGhostFrame = null; // TODO: Initialize to an appropriate value MapPoint p1 = null; // TODO: Initialize to an appropriate value MapPoint p2 = null; // TODO: Initialize to an appropriate value MapFrame target = new MapFrame(relatedGhostFrame, p1, p2); // TODO: Initialize to an appropriate value string name = string.Empty; // TODO: Initialize to an appropriate value target.SetMapFrameName(name); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void MapFrameConstructorTest2() { GhostFrame relatedGhostFrame = null; // TODO: Initialize to an appropriate value MapPoint p1 = null; // TODO: Initialize to an appropriate value MapPoint p2 = null; // TODO: Initialize to an appropriate value MapFrame target = new MapFrame(relatedGhostFrame, p1, p2); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void MapFrameConstructorTest1() { GhostFrame relatedGhostFrame = null; // TODO: Initialize to an appropriate value Envelope env = null; // TODO: Initialize to an appropriate value SolidColorBrush color = null; // TODO: Initialize to an appropriate value MapFrame target = new MapFrame(relatedGhostFrame, env, color); Assert.Inconclusive("TODO: Implement code to verify target"); }
/// <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> /// Removes a MapFrame, if it already exists /// </summary> /// <param name="deleteMap">The map frame to be deleted</param> public void RemoveMap(MapFrame deleteMap) { GhostFrame gf = deleteMap.GetGhostFrame(); if (mapFramesList.Contains(deleteMap)) { mapFramesList.Remove(deleteMap); ghostFramesList.Remove(gf); } if (BackgroundScatterView.Items.Contains(deleteMap)) BackgroundScatterView.Items.Remove(deleteMap); if (BackgroundScatterView.Items.Contains(gf)) BackgroundScatterView.Items.Remove(gf); }
/// <summary> /// Add a map frame/window on top of the background map /// </summary> /// <param name="mFrame">The map frame to be added</param> public void AddMapFrame(MapFrame mFrame) { if (mFrame == null) return; ghostFramesList.Add(mFrame.GetGhostFrame()); mapFramesList.Add(mFrame); BackgroundScatterView.Items.Add(mFrame.GetGhostFrame()); BackgroundScatterView.Items.Add(mFrame); }