//Finish the sketch when user double-clicks on the map async void map_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { client.Map map = MapWidget.Map; //Unregister the events map.MouseClick -= map_MouseClick; map.MouseDoubleClick -= map_MouseDoubleClick; map.MouseMove -= map_MouseMove; //Make a call to the REST API to get the profile line from the sketch ProfileService service = new ProfileService(); Profile = await service.GetProfileLine(sketchGeometry); //if we fail to get the profile line, clear all graphics from the map if (Profile == null) { MessageBox.Show("Failed to get elevation profile"); RemoveAllGraphicLayers(); return; } //Update the graph with the profile info UpdateControls(); CanClearGraph = true; }
private bool _isProgressing; // some progress events came up public MapLoader(ESRI.ArcGIS.Client.Map map) { _map = map; _timer = new DispatcherTimer(); _timer.Tick += OnTimerTick; _isProgressing = false; }
private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MapNavigator navigation = d as MapNavigator; ESRI.ArcGIS.Client.Map newValue = e.NewValue as ESRI.ArcGIS.Client.Map; ESRI.ArcGIS.Client.Map oldValue = e.OldValue as ESRI.ArcGIS.Client.Map; if (oldValue != null) { oldValue.RotationChanged -= new ESRI.ArcGIS.Client.Map.RotationChangedEventHandler(navigation.Map_RotationChanged); oldValue.ExtentChanged -= new EventHandler <ExtentEventArgs>(navigation.Map_ExtentChanged); oldValue.ExtentChanging -= new EventHandler <ExtentEventArgs>(navigation.Map_ExtentChanging); if (oldValue.Layers != null) { oldValue.Layers.LayersInitialized -= new LayerCollection.LayersInitializedHandler(navigation.Layers_LayersInitialized); } } if (newValue != null) { newValue.RotationChanged += new ESRI.ArcGIS.Client.Map.RotationChangedEventHandler(navigation.Map_RotationChanged); newValue.ExtentChanged += new EventHandler <ExtentEventArgs>(navigation.Map_ExtentChanged); newValue.ExtentChanging += new EventHandler <ExtentEventArgs>(navigation.Map_ExtentChanging); if (newValue.Layers != null) { newValue.Layers.LayersInitialized += new LayerCollection.LayersInitializedHandler(navigation.Layers_LayersInitialized); } if (navigation.TransformRotate != null) { navigation.TransformRotate.Angle = newValue.Rotation; } navigation.SetupZoom(); navigation.InitDrawObject(); navigation.ResetExtentHistory(); } }
public ChoroplethServerLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl) { InitializeComponent(); this.myMap = myMap; this.dashboardHelper = dashboardHelper; this.mapControl = mapControl; // Provider = new ChoroplethServerLayerProvider(myMap); // Provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded); FillComboBoxes(); mapControl.MapDataChanged += new EventHandler(mapControl_MapDataChanged); cbxDataKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxValue.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); cbxClasses.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged); rctEdit.MouseUp += new MouseButtonEventHandler(rctEdit_MouseUp); #region translation; lblTitle.Content = DashboardSharedStrings.GADGET_CONFIG_TITLE_CHOROPLETH; lblClasses.Content = DashboardSharedStrings.GADGET_CLASSES; lblShapeKey.Content = DashboardSharedStrings.GADGET_MAP_FEATURE; lblDataKey.Content = DashboardSharedStrings.GADGET_MAP_DATA; lblValueField.Content = DashboardSharedStrings.GADGET_MAP_VALUE; lblMissingValueColor.Content = DashboardSharedStrings.GADGET_MAP_COLOR_MISSING; lblLoValueColor.Content = DashboardSharedStrings.GADGET_LOW_VALUE_COLOR; lblHiValueColor.Content = DashboardSharedStrings.GADGET_HIGH_VALUE_COLOR; rctEditToolTip.Content = DashboardSharedStrings.MAP_LAYER_EDIT; #endregion ; }
//Start a new sketch void Map_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (sketch != null) { return; } //Mark the event arg as handled so the map won't treat the action as a pan action e.Handled = true; //Get the map point (first point of the sketch) client.Map map = sender as client.Map; client.Geometry.MapPoint mapPoint = map.ScreenToMap(e.GetPosition(map)); //Create the geometry (polyline) of the sketch and add the first point to it client.Geometry.Polyline pl = new client.Geometry.Polyline(); pl.SpatialReference = mapPoint.SpatialReference; pl.Paths.Add(new client.Geometry.PointCollection()); pl.Paths[0].Add(mapPoint); //Create the sketch graphic with the geometry and the symbol sketch = new client.Graphic(); sketch.Symbol = new SimpleLineSymbol() { Color = new SolidColorBrush(SelectedColor), Width = selectedWidth }; sketch.Geometry = pl; sketch.Geometry.SpatialReference = _mapWidget.Map.SpatialReference; //Add the sketch graphic to the layer sketchLayer.Graphics.Add(sketch); }
/// <summary> /// Gets the Map from a specific MapWidget that is identified by ID, accounting for widgets that may not yet be initialized /// by hooking an event handler and waiting for initialization of uninitialized maps. Once retrieved, add earthquakes to the map /// based on the currently selected feed. /// </summary> private void GetMapAndAddEarthquakes() { MapWidget mapWidget = OperationsDashboard.Instance.Widgets.Where(w => w.Id == MapWidgetId).FirstOrDefault() as MapWidget; if (mapWidget != null) { if (mapWidget.IsInitialized) { // Assume here that Map is not null, as the widget is initialized. _map = mapWidget.Map; // Add earthquakes. AddEarthquakesToMap(); } else { // Wait for initialization of the map widget. mapWidget.Initialized += (sender, e) => { _map = mapWidget.Map; // Add earthquakes. AddEarthquakesToMap(); }; } } }
/// <summary> /// Execute is called when user chooses the feature action from the feature actions context menu. Only called if /// CanExecute returned true. /// </summary> public void Execute(DataSource searchAreaDS, client.Graphic searchArea) { try { //Clear any running task _geometryTask.CancelAsync(); //Get the map widget and the map that contains the polygon used to generate the buffer client.Map mwMap = MapWidget.Map; //Define the params to pass to the buffer operation client.Tasks.BufferParameters bufferParameters = CreateBufferParameters(searchArea, mwMap); //Copy the display field of the search area for later use. //Polygon.Attributes[polygonDataSrc.DisplayFieldName] might be null if for example, //user creates a new polygon without specifying its attributes if (searchArea.Attributes[searchAreaDS.DisplayFieldName] == null) { SearchAreaName = ""; } else { SearchAreaName = searchArea.Attributes[searchAreaDS.DisplayFieldName].ToString(); } //Execute the GP tool _geometryTask.BufferAsync(bufferParameters); } catch (Exception) { MessageBox.Show("Error searching for team. Please retry"); } }
private void SetMap(MapWidget mapWidget) { if ((mapWidget != null) && (mapWidget.Map != null)) { // From the map widget, get the map. _map = mapWidget.Map; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: #line 51 "..\..\..\Views\MainFormView.xaml" ((DevExpress.Xpf.Ribbon.RibbonControl)(target)).SelectedPageChanged += new DevExpress.Xpf.Ribbon.RibbonPropertyChangedEventHandler(this.RibbonControl_SelectedPageChanged); #line default #line hidden return; case 3: #line 78 "..\..\..\Views\MainFormView.xaml" ((DevExpress.Xpf.Ribbon.RibbonPage)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.RibbonPage_MouseDown); #line default #line hidden return; case 4: this.MainNavigationFrame = ((DevExpress.Xpf.WindowsUI.NavigationFrame)(target)); return; case 5: this.MainGrid = ((System.Windows.Controls.Grid)(target)); return; case 6: this.MyMap = ((ESRI.ArcGIS.Client.Map)(target)); #line 124 "..\..\..\Views\MainFormView.xaml" this.MyMap.MouseMove += new System.Windows.Input.MouseEventHandler(this.MyMap_MouseMove); #line default #line hidden return; case 7: this.nvaswitch = ((DevExpress.Xpf.WindowsUI.NavigationFrame)(target)); return; case 8: this.tr = ((System.Windows.Controls.TreeView)(target)); return; case 9: this.bey = ((DevExpress.Xpf.Bars.BarEditItem)(target)); return; } this._contentLoaded = true; }
} // internal void saveMap(string mapname) private string getMapConfig() // read layers list, create json object from them { log("VSave.getMapConfig, ..."); ESRI.ArcGIS.Client.Map map = MapApplication.Current.Map; var cfg = VSave.mapConfig(map); log(string.Format("VSave.getMapConfig, done. res=[{0}]", cfg)); return(cfg); } // private string getMapConfig()
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/SLMaps;component/Page.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.txtMessage = ((System.Windows.Controls.TextBlock)(this.FindName("txtMessage"))); this.MyMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("MyMap"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/SLMaps;component/RipplesViewer.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.MyMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("MyMap"))); this.MyMapTip2 = ((ESRI.ArcGIS.Client.Toolkit.MapTip)(this.FindName("MyMapTip2"))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyMap = ((ESRI.ArcGIS.Client.Map)(target)); return; } this._contentLoaded = true; }
} // public void addSelectedLayer() public void addLayer(VLayer lyr) { log("addLayer " + lyr.lyrUrl); ESRI.ArcGIS.Client.Map map = MapApplication.Current.Map; ESRI.ArcGIS.Client.LayerCollection lyrs = map.Layers; lyr.lyr.InitializationFailed += new EventHandler <EventArgs>(lyr_InitializationFailed); lyrs.Add(lyr.lyr); MapApplication.SetLayerName(lyr.lyr, lyr.lyrName); // http://help.arcgis.com/en/webapps/silverlightviewer/help/index.html#//01770000001s000000 } // public void addLayer(VLayer lyr)
} // void pingsrv_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { /// <summary> /// If layers in config: clear map.layers; attach mapprogress event; add layers from config to map; /// set extent; set selected layer /// </summary> /// <param name="cfg"></param> /// <param name="map"></param> /// <param name="lyrInitFail"></param> /// <param name="mapProgress"></param> public static VLayer loadMapCfg(string cfg, ESRI.ArcGIS.Client.Map map, EventHandler <EventArgs> lyrInitFail, EventHandler <ProgressEventArgs> mapProgress) { // if LayersList: clean map; add layers from LayersList to map ESRI.ArcGIS.Client.Geometry.Envelope ext = VRestore.mapExtentFromConfig(cfg); var layersList = VRestore.lyrsListFromConfig(cfg); if (layersList.Count <= 0) { throw new Exception("VRestore.loadMapCfg: список слоев пуст, видимо была сохранена пустая карта"); } ESRI.ArcGIS.Client.LayerCollection lyrs = map.Layers; // clear map lyrs.Clear(); VLayer sl = null; if (mapProgress != null && layersList.Count > 0) { map.Progress -= mapProgress; map.Progress += mapProgress; } // add layers to map foreach (var x in layersList) { //string.Format("loadMapCfg, add layer {0}", x.lyrUrl).clog(); string.Format("VRestore.loadMapCfg, add layer '{0}' '{1}' '{2}'", x.ID, x.lyrName, x.lyrType).clog(); if (lyrInitFail != null) { x.lyr.InitializationFailed += new EventHandler <EventArgs>(lyrInitFail); } //x.lyr.SetValue(MapApplication.LayerNameProperty, x.lyrName); //x.lyr.Initialize(); lyrs.Add(x.lyr); MapApplication.SetLayerName(x.lyr, x.lyrName); if (x.selected) { sl = x; } } if (ext != null) { map.Extent = ext; } // select selected layer if (sl != null) { string.Format("VRestore.loadMapCfg, selected layer '{0}' '{1}'", sl.ID, sl.lyrName).clog(); MapApplication.Current.SelectedLayer = sl.lyr; } return(sl); } // public static VLayer loadMapCfg(string cfg, ESRI.ArcGIS.Client.Map map)
//Add a temporary graphic to trace user's mouse movement void map_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { //Do nothing if user hasn't added the first point if (sketchGeometry.Paths[0].Count == 0) { return; } //Update the second point of the feedback layer with the current map point client.Map map = MapWidget.Map; (feedBackLyr.Graphics.First().Geometry as Polyline).Paths[0][1] = map.ScreenToMap(e.GetPosition(map)); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/SLMaps;component/GeoRSSViewer.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.txtGeoRSSurl = ((System.Windows.Controls.TextBox)(this.FindName("txtGeoRSSurl"))); this.btnLoadGeoRSS = ((System.Windows.Controls.Button)(this.FindName("btnLoadGeoRSS"))); this.MyMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("MyMap"))); this.MyMapTip = ((ESRI.ArcGIS.Client.Toolkit.MapTip)(this.FindName("MyMapTip"))); }
// Clone a Map private static void Clone(ESRI.ArcGIS.Client.Map map, ESRI.ArcGIS.Client.Map mapToClone) { map.MinimumResolution = mapToClone.MinimumResolution; map.MaximumResolution = mapToClone.MaximumResolution; map.TimeExtent = mapToClone.TimeExtent; map.WrapAround = mapToClone.WrapAround; // Clone layers foreach (var toLayer in mapToClone.Layers.Select(CloneLayer).Where(toLayer => toLayer != null)) { toLayer.InitializationFailed += (s, e) => { }; // to avoid crash if bad layer map.Layers.Add(toLayer); // use index in order to keep existing layers after cloned layers } }
/// <summary> /// This function creates the buffer area from user's selected feature /// </summary> public void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource BufferDS, client.Graphic BufferFeature) { //Clear any running task _geometryTask.CancelAsync(); //Get the map that contains the feature used to generate the buffer client.Map mwMap = mapWidget.Map; //Define the params to pass to the buffer operation client.Tasks.BufferParameters bufferParameters = CreateBufferParameters(BufferFeature, mwMap); //Execute the GP tool _geometryTask.BufferAsync(bufferParameters); }
//This method returns all the feature layers displayed on a map public static List <client.FeatureLayer> GetMapFeatureLayers(client.Map Map) { List <client.FeatureLayer> FeatureLayers = new List <client.FeatureLayer>(); //To know more about acceleratedDisplayLayers, read //http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//0170000000n4000000 client.AcceleratedDisplayLayers adLayers = Map.Layers.FirstOrDefault(l => l is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; foreach (client.FeatureLayer layer in adLayers.ChildLayers.OfType <client.FeatureLayer>()) { FeatureLayers.Add(layer); } return(FeatureLayers); }
//For each move, get the map point and add it as a vertex of the polyline void Map_MouseMove(object sender, MouseEventArgs e) { if (sketch == null) { return; } //Get the map point client.Map map = sender as client.Map; client.Geometry.MapPoint mapPoint = map.ScreenToMap(e.GetPosition(map)); //Add the map point to the sketch client.Geometry.Polyline polyline = sketch.Geometry as client.Geometry.Polyline; polyline.Paths[0].Add(mapPoint); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: this.mainMap = ((ESRI.ArcGIS.Client.Map)(target)); return; case 3: this.mainInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(target)); return; } this._contentLoaded = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/ESRI.SilverlightViewer;component/MapPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.myMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("myMap"))); this.myNavigator = ((ESRI.SilverlightViewer.Generic.MapNavigator)(this.FindName("myNavigator"))); this.myScaleBar = ((ESRI.ArcGIS.Client.Toolkit.ScaleLine)(this.FindName("myScaleBar"))); this.progressGrid = ((System.Windows.Controls.Grid)(this.FindName("progressGrid"))); this.myProgressBar = ((System.Windows.Controls.ProgressBar)(this.FindName("myProgressBar"))); this.ProgressValueTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("ProgressValueTextBlock"))); this.WidgetsCanvas = ((System.Windows.Controls.Canvas)(this.FindName("WidgetsCanvas"))); this.myTaskbarWidget = ((ESRI.SilverlightViewer.UIWidget.TaskbarWidget)(this.FindName("myTaskbarWidget"))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyDataGrid = ((ESRI.ArcGIS.Client.Toolkit.FeatureDataGrid)(target)); return; case 2: this.MyMap = ((ESRI.ArcGIS.Client.Map)(target)); #line 26 "..\..\MainWindow.xaml" this.MyMap.Loaded += new System.Windows.RoutedEventHandler(this.MyMap_Loaded); #line default #line hidden return; case 3: this.TrajectoriesLayer = ((ESRI.ArcGIS.Client.FeatureLayer)(target)); #line 36 "..\..\MainWindow.xaml" this.TrajectoriesLayer.MouseLeftButtonUp += new ESRI.ArcGIS.Client.GraphicsLayer.MouseButtonEventHandler(this.FeatureLayer_MouseLeftButtonUp); #line default #line hidden return; case 4: this.ResponseTextBlock = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.DeleteScenarioButton = ((System.Windows.Controls.Button)(target)); #line 43 "..\..\MainWindow.xaml" this.DeleteScenarioButton.Click += new System.Windows.RoutedEventHandler(this.DeleteScenarioButton_Click); #line default #line hidden return; } this._contentLoaded = true; }
} // public void runTool(object param) private void cloneMap(ESRI.ArcGIS.Client.Map mapFrom, ESRI.ArcGIS.Client.Map mapTo) { log("VPrintImpl.cloneMap ..."); frmPrint.legend1.Map = null; var cfg = VSave.mapConfig(mapFrom); log(string.Format("cloneMap, mapCfg '{0}'", cfg)); mapTo.Layers.LayersInitialized -= onLayersInitialized; VRestore.loadMapCfg(cfg, mapTo, null, null); mapTo.Layers.LayersInitialized += onLayersInitialized; frmPrint.legend1.Map = mapTo; frmPrint.legend1.ShowOnlyVisibleLayers = true; PrintForm.legendFixed = false; // going to map update, need time to complete requests... //mapTo.ZoomToResolution(mapFrom.Resolution, mapFrom.Extent.GetCenter()); } // private void cloneMap(ESRI.ArcGIS.Client.Map mapFrom, ESRI.ArcGIS.Client.Map mapTo)
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Geo;component/MainPage.xaml", System.UriKind.Relative)); this.beamImgW_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgW_SB"))); this.beamImgN_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgN_SB"))); this.beamImgS_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgS_SB"))); this.beamImgE_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgE_SB"))); this.beamImgNE_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgNE_SB"))); this.beamImgSE_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgSE_SB"))); this.beamImgSW_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgSW_SB"))); this.beamImgNW_SB = ((System.Windows.Media.Animation.Storyboard)(this.FindName("beamImgNW_SB"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.functionsPivot = ((Microsoft.Phone.Controls.Pivot)(this.FindName("functionsPivot"))); this.btnFullExtent_MapNav = ((System.Windows.Controls.Image)(this.FindName("btnFullExtent_MapNav"))); this.btnPrevExtent_MapNav = ((System.Windows.Controls.Image)(this.FindName("btnPrevExtent_MapNav"))); this.btnNextExtent_MapNav = ((System.Windows.Controls.Image)(this.FindName("btnNextExtent_MapNav"))); this.btnAutoNav_MapNav = ((System.Windows.Controls.Image)(this.FindName("btnAutoNav_MapNav"))); this.btnRedDrawPoint = ((System.Windows.Controls.Image)(this.FindName("btnRedDrawPoint"))); this.btnRedDrawLine = ((System.Windows.Controls.Image)(this.FindName("btnRedDrawLine"))); this.btnRedDrawPolygon = ((System.Windows.Controls.Image)(this.FindName("btnRedDrawPolygon"))); this.btnRedDrawText = ((System.Windows.Controls.Image)(this.FindName("btnRedDrawText"))); this.btnRedSettings = ((System.Windows.Controls.Image)(this.FindName("btnRedSettings"))); this.btnMeasurSet = ((System.Windows.Controls.Button)(this.FindName("btnMeasurSet"))); this.mapContent = ((System.Windows.Controls.Grid)(this.FindName("mapContent"))); this.myMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("myMap"))); this.btnMapFullScrn = ((System.Windows.Controls.Button)(this.FindName("btnMapFullScrn"))); this.btnAutoNavBase_MapNav = ((System.Windows.Controls.Button)(this.FindName("btnAutoNavBase_MapNav"))); this.imgN = ((System.Windows.Controls.Image)(this.FindName("imgN"))); this.imgW = ((System.Windows.Controls.Image)(this.FindName("imgW"))); this.imgE = ((System.Windows.Controls.Image)(this.FindName("imgE"))); this.imgS = ((System.Windows.Controls.Image)(this.FindName("imgS"))); this.imgNW = ((System.Windows.Controls.Image)(this.FindName("imgNW"))); this.imgSE = ((System.Windows.Controls.Image)(this.FindName("imgSE"))); this.imgNE = ((System.Windows.Controls.Image)(this.FindName("imgNE"))); this.imgSW = ((System.Windows.Controls.Image)(this.FindName("imgSW"))); this.btnClearMapGraphics = ((Microsoft.Phone.Shell.ApplicationBarMenuItem)(this.FindName("btnClearMapGraphics"))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyDataGrid = ((ESRI.ArcGIS.Client.Toolkit.FeatureDataGrid)(target)); return; case 2: this.MyMap = ((ESRI.ArcGIS.Client.Map)(target)); return; case 3: this.ResponseTextBlock = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.urlText = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.RefreshScenarioButton = ((System.Windows.Controls.Button)(target)); #line 45 "..\..\MainWindow.xaml" this.RefreshScenarioButton.Click += new System.Windows.RoutedEventHandler(this.RefreshScenarioButton_Click); #line default #line hidden return; case 6: this.DeleteScenarioButton = ((System.Windows.Controls.Button)(target)); #line 46 "..\..\MainWindow.xaml" this.DeleteScenarioButton.Click += new System.Windows.RoutedEventHandler(this.DeleteScenarioButton_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\mapwindows.xaml" ((zsdpmap.mapwindows)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.maingrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.map = ((ESRI.ArcGIS.Client.Map)(target)); #line 9 "..\..\mapwindows.xaml" this.map.Loaded += new System.Windows.RoutedEventHandler(this.map_Loaded); #line default #line hidden return; case 4: #line 10 "..\..\mapwindows.xaml" ((ESRI.ArcGIS.Client.ArcGISLocalTiledLayer)(target)).TileLoaded += new System.EventHandler <ESRI.ArcGIS.Client.TiledLayer.TileLoadEventArgs>(this.ArcGISLocalTiledLayer_TileLoaded); #line default #line hidden return; case 5: this.lbsTitle = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
} // void onLayersInitialized(object sender, EventArgs args) /// <summary> /// Reload RL data if RL layer exists. /// Called from timer when map layers loaded. /// Set mapstate=Processing or Ready /// </summary> private void renewRL(ESRI.ArcGIS.Client.Map map) { // recreate RL layer, load RL content if (mapState != VMapState.Loaded) { return; } mapState = VMapState.Processing; log(string.Format("VPrintImpl.renewRL")); var gl = VRedlineImpl.reloadRLData(map, VRedlineImpl.layerID, VRedlineImpl.layerName); if (gl == null) { mapState = VMapState.Ready; log(string.Format("VPrintImpl.renewRL, graphic layer is null")); } return; } // private void renewRL()
//When the Draw Line button is clicked: //The skecth (a polyline graphic) will be created and will be added to the sketch layer //The sketch layer will be added to the map for display //2 map events will be registered for user's interaction private void AddGraphics_Click(object sender, RoutedEventArgs e) { //Take the first map widget from the view MapWidget mapWidget = OperationsDashboard.Instance.Widgets.First(w => w.GetType() == typeof(MapWidget)) as MapWidget; if (mapWidget == null || mapWidget.Map == null) { return; } MapWidget = mapWidget; client.Map map = MapWidget.Map; //First, remove any existing graphic layer on the map RemoveAllGraphicLayers(); //Create the geometry (a polyline) for the sketch sketchGeometry = new client.Geometry.Polyline(); sketchGeometry.SpatialReference = map.SpatialReference; sketchGeometry.Paths.Add(new client.Geometry.PointCollection()); //Create the sketch with the geometry and a symbol client.Graphic sketch = new client.Graphic() { Symbol = SimplePolylineSymbol.CreateLineSymbol(), Geometry = sketchGeometry, }; //Add the sketch to the map sketch layer //mapSketchLyr.Graphics.Clear(); mapSketchLyr.Graphics.Add(sketch); //Add the sketch layer back to the map map.Layers.Add(mapSketchLyr); //Register mouse click i.e. sketch begins //Register mouse double click i.e. sketch finishes map.MouseClick += map_MouseClick; map.MouseDoubleClick += map_MouseDoubleClick; map.MouseMove += map_MouseMove; }
//Add a map point (from mouse click) to the geometry of the sketch //Create a temporary graphic to trace user's mouse movement void map_MouseClick(object sender, client.Map.MouseEventArgs e) { sketchGeometry.Paths[0].Add(e.MapPoint); //feedback layer feedBackLyr.Graphics.Clear(); client.Map map = MapWidget.Map; #region Create a temporary graphic to trace user's mouse movement //Create a point collection using the last clicked point and the latest mouse position PointCollection pc = new PointCollection(); pc.Add(sketchGeometry.Paths[0].Last()); pc.Add(new MapPoint()); //Create the geometry of the feedback line using the point collection client.Geometry.Polyline feedbackGeomrtry = new client.Geometry.Polyline(); feedbackGeomrtry.SpatialReference = map.SpatialReference; feedbackGeomrtry.Paths.Add(pc); //Create the feedback line with the geometry and a symbol client.Graphic feedback = new client.Graphic() { Symbol = SimplePolylineSymbol.CreateLineSymbol(), Geometry = feedbackGeomrtry, }; #endregion //Add the feedback line to the feedback layer feedBackLyr.Graphics.Add(feedback); //Add the layer to the map if we haevn't done so if (!map.Layers.Contains(feedBackLyr)) { map.Layers.Add(feedBackLyr); } }
/// <summary> /// Zoom or pan to the current feature /// </summary> /// private void ZoomToFeature_Click(object sender, RoutedEventArgs e) { try { //Get the geometry from SiteDetails Geometry g = Geometry.FromJson(((SiteDetails)((Button)sender).DataContext).ZoomExtent); //Get the map ESRI.ArcGIS.Client.Map map = mapWidget.Map; if (g.SpatialReference.WKID != map.SpatialReference.WKID) { //TODO...need to handle this } //If current resolution is close to min resolution pan to the feature, otherwise zoom to if (map.Resolution.ToString("#.000000") == map.MinimumResolution.ToString("#.000000")) { map.PanTo(g); } else { if (g is MapPoint) { map.ZoomToResolution(map.MinimumResolution, (MapPoint)g); } else { map.ZoomTo(g.Extent.Expand(1.23)); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyMap = ((ESRI.ArcGIS.Client.Map)(target)); #line 29 "..\..\..\Views\HeadSub.xaml" this.MyMap.MouseMove += new System.Windows.Input.MouseEventHandler(this.MyMap_MouseMove); #line default #line hidden return; case 2: this.nvaswitch = ((DevExpress.Xpf.WindowsUI.NavigationFrame)(target)); return; case 3: this.tr = ((System.Windows.Controls.TreeView)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.m_map = ((ESRI.ArcGIS.Client.Map)(target)); #line 11 "..\..\NOCMap.xaml" this.m_map.MouseMove += new System.Windows.Input.MouseEventHandler(this.MyMap_MouseMove); #line default #line hidden return; case 2: this.ScreenCoordsTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.MapCoordsTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Wheels@SG;component/AppPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.esriMap = ((ESRI.ArcGIS.Client.Map)(this.FindName("esriMap"))); this.myGpsLayer = ((ESRI.ArcGIS.Client.Toolkit.DataSources.GpsLayer)(this.FindName("myGpsLayer"))); this.button1 = ((System.Windows.Controls.Button)(this.FindName("button1"))); this.button2 = ((System.Windows.Controls.Button)(this.FindName("button2"))); this.MyInfoWindow = ((ESRI.ArcGIS.Client.Toolkit.InfoWindow)(this.FindName("MyInfoWindow"))); this.createEvent = ((System.Windows.Controls.Primitives.Popup)(this.FindName("createEvent"))); this.tbEventName = ((System.Windows.Controls.TextBox)(this.FindName("tbEventName"))); this.tbDescription = ((System.Windows.Controls.TextBox)(this.FindName("tbDescription"))); this.tbAddress = ((System.Windows.Controls.TextBox)(this.FindName("tbAddress"))); this.btn_checkin = ((System.Windows.Controls.Button)(this.FindName("btn_checkin"))); this.btn_cancel = ((System.Windows.Controls.Button)(this.FindName("btn_cancel"))); }