public void EnableZoom(Brush iconBrush) { var coa = new CallOutAction { IconBrush = ForegroundBrush, Title = "Zoom", Path = "F1M1937.77,2316.51L1924.92,2300.18C1929.1,2294.35 1929.14,2286.25 1924.48,2280.33 1918.84,2273.15 1908.45,2271.92 1901.27,2277.56 1894.1,2283.2 1892.86,2293.59 1898.5,2300.77 1903.23,2306.77 1911.26,2308.6 1917.96,2305.74L1930.77,2322.02 1937.77,2316.51z M1903.81,2296.59C1900.48,2292.35 1901.21,2286.21 1905.45,2282.87 1909.69,2279.53 1915.84,2280.26 1919.17,2284.51 1922.51,2288.75 1921.78,2294.89 1917.54,2298.23 1913.29,2301.57 1907.15,2300.84 1903.81,2296.59z" }; coa.Clicked += (e, f) => { AppStateSettings.Instance.ViewDef.MapControl.ZoomDuration = new TimeSpan(0, 0, 0, 1); AppStateSettings.Instance.ViewDef.MapControl.ZoomToResolution(1, point); }; Actions.Add(coa); }
public void Drag(object sender, CallOutAction context, EventArgs e) { if (context.IsDraggable) { context.TriggerDragStart(sender, e); } }
public void TapAction(CallOutAction action, EventArgs e) { if (action != null) action.TriggerClicked(e); }
private void UpdateCalloutActions() { var effStyle = Poi.NEffectiveStyle; if (effStyle.CanEdit.Value) { var editCallout = new CallOutAction { IconBrush = new SolidColorBrush(effStyle.CallOutForeground.Value), Title = "Edit", Path = "M0,44.439791L18.98951,54.569246 0.47998798,62.66881z M17.428029,12.359973L36.955557,23.568769 21.957478,49.686174 20.847757,46.346189 15.11851,45.756407 14.138656,42.166935 8.5292659,41.966761 6.9493899,38.037481 2.4399572,38.477377z M26.812517,0.0009765625C27.350616,-0.012230873,27.875986,0.10826397,28.348372,0.3782568L42.175028,8.3180408C43.85462,9.2780154,44.234529,11.777948,43.02482,13.89789L41.375219,16.767812 21.460039,5.3381228 23.10964,2.4582005C23.979116,0.941679,25.437378,0.034730911,26.812517,0.0009765625z" }; editCallout.Clicked += (e, f) => callOut.StartEditing(); callOut.Actions.Add(editCallout); } // Lock the PoI var canMoveCallout = new CallOutAction { IconBrush = new SolidColorBrush(effStyle.CallOutForeground.Value), Title = "Lock", Path = effStyle.CanMove.Value ? "F1M648.2778,1043.3809L648.2778,1047.4329 645.6158,1047.4329 645.6158,1043.3839C644.5488,1042.9079 643.7998,1041.9019 643.7998,1040.7169 643.7998,1039.0759 645.2068,1037.7479 646.9428,1037.7479 648.6858,1037.7479 650.0938,1039.0759 650.0938,1040.7169 650.0938,1041.8989 649.3458,1042.9079 648.2778,1043.3809 M654.3988,1031.2069C654.3988,1031.2009,654.3998,1031.1959,654.4008,1031.1899L651.2988,1031.1529 641.3268,1031.1529 640.3338,1028.5859C639.1988,1025.6569 640.6488,1022.3669 643.5788,1021.2339 646.5088,1020.0989 649.7988,1021.5549 650.9328,1024.4789L652.0168,1027.2809C652.2178,1027.8009,652.3348,1028.3359,652.3778,1028.8669L654.4728,1028.8909C654.3998,1028.2769,654.2548,1027.6609,654.0208,1027.0559L652.5638,1023.2979C651.0408,1019.3659 646.6198,1017.4139 642.6888,1018.9379 638.7598,1020.4589 636.8068,1024.8789 638.3278,1028.8109L639.3428,1031.4309C637.3868,1032.1059,635.9778,1033.9609,635.9778,1036.1469L635.9778,1046.2999C635.9778,1049.0579,638.2148,1051.2949,640.9708,1051.2949L653.7078,1051.2949C656.4668,1051.2949,658.7008,1049.0579,658.7008,1046.2999L658.7008,1036.1469C658.7008,1033.6249,656.8298,1031.5439,654.3988,1031.2069" : "F1M339.3071,1185.249L339.3071,1188.437 337.2111,1188.437 337.2111,1185.251C336.3721,1184.876 335.7831,1184.085 335.7831,1183.151 335.7831,1181.861 336.8901,1180.815 338.2561,1180.815 339.6281,1180.815 340.7371,1181.861 340.7371,1183.151 340.7371,1184.082 340.1471,1184.876 339.3071,1185.249 M331.6851,1168.456C331.6851,1165.017 334.4711,1162.228 337.9101,1162.228 341.3491,1162.228 344.1411,1165.017 344.1411,1168.456L344.1411,1171.745C344.1411,1172.16,344.0991,1172.565,344.0211,1172.959L331.8051,1172.959C331.7281,1172.565,331.6851,1172.16,331.6851,1171.745z M346.2351,1173.133C346.2611,1172.861,346.2761,1172.586,346.2761,1172.308L346.2761,1167.893C346.2761,1163.274 342.5291,1159.528 337.9101,1159.528 333.2921,1159.528 329.5511,1163.274 329.5511,1167.893L329.5511,1172.308C329.5511,1172.586 329.5661,1172.861 329.5921,1173.132 327.2211,1173.733 325.4651,1175.875 325.4651,1178.432L325.4651,1189.558C325.4651,1192.578,327.9121,1195.028,330.9361,1195.028L344.8901,1195.028C347.9091,1195.028,350.3601,1192.578,350.3601,1189.558L350.3601,1178.432C350.3601,1175.876,348.6031,1173.733,346.2351,1173.133" }; canMoveCallout.Clicked += (e, f) => { if (Poi.Style == null) { Poi.Style = new PoIStyle { CanMove = !effStyle.CanMove }; } else Poi.Style.CanMove = !effStyle.CanMove; if (Poi.Style.CanMove == true && (effStyle.DrawingMode == DrawingModes.Polygon || effStyle.DrawingMode == DrawingModes.Polyline)) (Poi.Data["graphic"] as Graphic).MakeDraggable(); Poi.TriggerLabelChanged("", "", ""); Poi.UpdateEffectiveStyle(); callOut.Close(); }; callOut.Actions.Add(canMoveCallout); if (effStyle.CanRotate.Value && (Poi.NEffectiveStyle.DrawingMode.Value == DrawingModes.Point || Poi.NEffectiveStyle.DrawingMode.Value == DrawingModes.Image)) { var rotateCallOutAction = new CallOutAction { IconBrush = new SolidColorBrush(Poi.NEffectiveStyle.CallOutForeground.Value), Title = "Rotate", Path = "F1M225.713,1773.49L232.795,1776.66 231.995,1768.94 231.192,1761.23 226.002,1764.99C221.113,1758.99 213.677,1755.15 205.337,1755.15 190.61,1755.15 178.672,1767.1 178.672,1781.82 178.672,1796.55 190.61,1808.49 205.337,1808.49 211.902,1808.49 217.903,1806.11 222.543,1802.17 222.573,1802.11 222.593,1802.06 222.627,1801.99 224.257,1798.82 220.791,1798.99 220.781,1798.99 216.686,1802.68 211.271,1804.93 205.337,1804.93 192.595,1804.93 182.228,1794.56 182.228,1781.82 182.228,1769.08 192.595,1758.71 205.337,1758.71 212.481,1758.71 218.867,1761.98 223.106,1767.09L218.631,1770.33 225.713,1773.49z" }; rotateCallOutAction.Clicked += (e, f) => { callOut.Close(); Poi.StartRotation(); }; callOut.Actions.Add(rotateCallOutAction); } if (effStyle.CanDelete.Value) { var deleteCalloutAction = new CallOutAction { IconBrush = new SolidColorBrush(Poi.NEffectiveStyle.CallOutForeground.Value), Title = "Delete", Path = "M33.977998,27.684L33.977998,58.102997 41.373998,58.102997 41.373998,27.684z M14.841999,27.684L14.841999,58.102997 22.237998,58.102997 22.237998,27.684z M4.0319996,22.433001L52.183,22.433001 52.183,63.999001 4.0319996,63.999001z M15.974,0L40.195001,0 40.195001,7.7260003 56.167001,7.7260003 56.167001,16.000999 0,16.000999 0,7.7260003 15.974,7.7260003z" }; deleteCalloutAction.Clicked += (e, f) => { callOut.Close(); var nea = new NotificationEventArgs { Text = "Are you sure?", Header = "Delete " + Poi.Name, Duration = new TimeSpan(0, 0, 30), Background = Brushes.Red, Image = new BitmapImage(new Uri(@"pack://application:,,,/csCommon;component/Resources/Icons/Delete.png")), Foreground = Brushes.White, Options = new List<string> { "Yes", "No" } }; nea.OptionClicked += (s, n) => { if (n.Option != "Yes") return; //AppState.TriggerNotification(Poi.Name + " was deleted", pathData: MenuHelpers.DeleteIcon); Service.RemovePoi(Poi as PoI); AppState.Popups.Remove(callOut); }; AppState.TriggerNotification(nea); }; callOut.Actions.Add(deleteCalloutAction); } foreach (var action in Poi.CalloutActions) { callOut.Actions.Add(action); } }