///// <summary> ///// Make a CIMPointGraphic that can be added to the map overlay ///// </summary> ///// <param name="point">The location of the graphic</param> ///// <returns></returns> //internal static CIMPointGraphicHelper MakeCIMPointGraphic(PointN point) //{ // return new CIMPointGraphicHelper(point); //} /// <summary> /// Add a point to the specified mapview /// </summary> /// <param name="mapView">The mapview to whose overlay the graphic will be added</param> /// <returns>The graphic id assigned to the graphic in the overlay</returns> public static void AddToMapOverlay(ArcGIS.Core.CIM.PointN point, MapView mapView) { if (!mapView.Is2D) { return;//only currently works for 2D } CIMPointGraphicHelper graphicHlpr = new CIMPointGraphicHelper(point); graphicHlpr.graphicID = mapView.AddOverlayGraphic(graphicHlpr.XML); _lookup[mapView.Map.RepositoryID] = graphicHlpr; }
/// <summary> /// All-in-one. Update the graphic on the overlay if it was previously added /// otherwise, make it and add it /// </summary> /// <param name="newLocation">The new location to be added to the map</param> /// <param name="mapView"></param> /// <returns></returns> public static void UpdateMapOverlay(ArcGIS.Core.CIM.PointN point, MapViewInternal mapView) { if (!mapView.Is2D) { return;//only currently works for 2D } //CIMPointGraphicHelper graphicHlpr = null; if (_lookup.ContainsKey(mapView.Map.RepositoryID)) { ////graphicHlpr = _lookup[mapView.Map.ID]; ////graphicHlpr.UpdateLocation(point); ////int id = graphicHlpr.graphicID; ////mapView.UpdateOverlayGraphic(ref id, graphicHlpr.XML); ////graphicHlpr.graphicID = id; RemoveFromMapOverlay(mapView); AddToMapOverlay(point, mapView); } else { //first time AddToMapOverlay(point, mapView); } }