private void ZoomToExtent(LayerTypeEnum layerType) { Layer layer = esriMapView.Map.Layers.FirstOrDefault(x => x.ID == layerType.ToString()); ObservableCollection <Graphic> layerCol = _incidentsMapControlViewModel.GetLayerObservable(layerType); if (layerCol.Count == 0) { return; } List <double> Xs = new List <double>(); List <double> Ys = new List <double>(); for (int i = 0; i < layerCol.Count; i++) { if (!(layerCol[i].Geometry is Esri.ArcGISRuntime.Geometry.Polygon)) { Xs.Add(((MapPoint)layerCol[i].Geometry).X); Ys.Add(((MapPoint)layerCol[i].Geometry).Y); } } if (layerCol.Count > 1 && Xs.Count > 0 && Ys.Count > 0) { ZoomOnMap(24.43666670, 54.45666669, 130000); } else { if (!(layerCol[0].Geometry is Esri.ArcGISRuntime.Geometry.Polygon)) { ZoomOnMap(((MapPoint)layerCol[0].Geometry).Y, ((MapPoint)layerCol[0].Geometry).X, 50000); } } }
public void SetPlayerLayer(LayerTypeEnum layerType, uint layerIndex) { if (currentLayerType != layerType) { SoundManager.instance.PlayAndSwitchMusic(layerType); } currentLayerType = layerType; }
public Layer(LayerTypeEnum layerType, int NodeCount) { LayerType = layerType; Nodes = new List <Node>(); for (int i = 0; i < NodeCount; i++) { Nodes.Add(new GeneralNode(this)); } Nodes.Add(new ConstantNode(this)); }
public Layer(IEntity data) { Name = "Layer"; Visible = true; Type = LayerTypeEnum.Entity; TimelineColor = Color.DodgerBlue; Data = data; Framesets = new List <Frameset>(); Depth = 0; }
public void AddGrphicLayer(LayerTypeEnum layerTypeEnum) { _incidentsMapControlViewModel.AddGraphicsToLayersGraphicsDictionary(layerTypeEnum); GraphicsLayer graphicsLayer = new GraphicsLayer(); graphicsLayer.ID = layerTypeEnum.ToString(); esriMapView.Map.Layers.Add(graphicsLayer); System.Windows.Data.Binding binding = new System.Windows.Data.Binding(string.Format("LayersGraphicsDictionary[{0}]", layerTypeEnum.ToString())); binding.Source = _incidentsMapControlViewModel; binding.Mode = System.Windows.Data.BindingMode.OneWay; System.Windows.Data.BindingOperations.SetBinding(graphicsLayer, GraphicsLayer.GraphicsSourceProperty, binding); }
public Layer(Layer child, int depth) { Name = "New Category"; Visible = true; Collapsed = false; Type = LayerTypeEnum.Category; TimelineColor = Color.DodgerBlue; Children = new List <Layer>(); Children.Add(child); Depth = depth; }
private void HideShowLayer(LayerTypeEnum layerType, bool IsShow) { Layer layer = esriMapView.Map.Layers.FirstOrDefault(x => x.ID == layerType.ToString()); layer.IsVisible = IsShow; if (IsShow) { ZoomToExtent(layerType); } //mapTipRadarAssetsViolations.Visibility = System.Windows.Visibility.Collapsed; //mapTipSmartTowerAssetsViolations.Visibility = Visibility.Collapsed; }
public ObservableCollection <Graphic> GetLayerObservable(LayerTypeEnum layerType) { ObservableCollection <Graphic> graphicCol = null; if (LayersGraphicsDictionary.ContainsKey(layerType.ToString())) { graphicCol = LayersGraphicsDictionary[layerType.ToString()]; } else { graphicCol = new ObservableCollection <Graphic>(); LayersGraphicsDictionary.Add(layerType.ToString(), graphicCol); } return(graphicCol); }
private void HideShowLayer(LayerTypeEnum layerType, bool IsShow, RadToggleButton radToggleBtn, Border mapTipBorder) { Layer layer = esriMapView.Map.Layers.FirstOrDefault(x => x.ID == layerType.ToString()); layer.IsVisible = IsShow; radToggleBtn.IsChecked = IsShow; if (IsShow) { ZoomToExtent(layerType); } if (mapTipBorder != null) { mapTipBorder.Visibility = System.Windows.Visibility.Collapsed; } }
private void DrawCircle(string id, MapPoint point, double radius, SimpleFillSymbol circleFillSymbol, int ZIndex, LayerTypeEnum layerType, Color color) { var layerCol = GetLayerObservable(LayerTypeEnum.Notifications); var bufferGraphic = layerCol.Where(x => x.Attributes.Count > 0 && x.Attributes.ContainsKey("Id") && x.Attributes["Id"].ToString() == (id + "_Circle_" + ZIndex).ToString()).FirstOrDefault(); if (bufferGraphic != null) { layerCol.Remove(bufferGraphic); } var buffer = GeometryEngine.Buffer(point, radius * 0.0175); bufferGraphic = new Graphic { Geometry = buffer, Symbol = circleFillSymbol, ZIndex = ZIndex }; //bufferGraphic = DrawCircle(point, radius * 0.0175, color); bufferGraphic.Attributes.Add("Id", id + "_Circle_" + ZIndex); bufferGraphic.Attributes.Add("LayerType", layerType.ToString()); layerCol.Add(bufferGraphic); }
private Dictionary <string, object> CreateGraphicDictionary(dynamic item, LayerTypeEnum layerType, int?violationCount = 0, LayerTypeEnum?targetNotificatoinLayerType = null) { Dictionary <string, object> attributes = new Dictionary <string, object>(); switch (layerType) { case LayerTypeEnum.Violations: attributes.Add("Id", item.LocationCode); attributes.Add("Count", violationCount); if (item is ViolationNotificationDTO) { attributes.Add("ViolationObj", item); } else if (item is ViolationToDraw) { attributes.Add("ViolationObj", item.ViolationObj); } break; case LayerTypeEnum.Incidents: attributes.Add("Id", item.IncidentId); attributes.Add("Name", item.IncidentTypeName); attributes.Add("Address", item.IncidentAddress); if (item is IncidentsDTO) { attributes.Add("IncidentObj", item); } else if (item is IncidentToDraw) { attributes.Add("IncidentObj", item.IncidentObj); } break; case LayerTypeEnum.Patrols: attributes.Add("Id", item.PatrolId); attributes.Add("Speed", item.Speed); attributes.Add("Date", item.LocationDate); attributes.Add("Name", item.PatrolCode); break; case LayerTypeEnum.Officers: attributes.Add("Id", item.OfficerId); attributes.Add("Speed", item.Speed); attributes.Add("Date", item.LocationDate); attributes.Add("Name", item.OfficerName); break; case LayerTypeEnum.Assets: attributes.Add("Id", item.OriginalIdent); attributes.Add("Name", item.ItemName); attributes.Add("Status", item.ItemStatusName); attributes.Add("LocationCode", item.LocationCode); break; case LayerTypeEnum.Notifications: if (item is AssetsViewDTO) { attributes.Add("Id", item.ItemId); attributes.Add("LocationCode", item.LocationCode); } else if (item is FogEventMessage) { attributes.Add("Id", item.TowerId + "_FogCenter"); } else if (item is WantedCarMessage) { attributes.Add("Id", item.VehiclePlateNumber + "_WantedCarCenter"); } else if (item is DetectedAccidentMessage) { attributes.Add("Id", item.TowerId + "_AccidentCenter"); attributes.Add("DetectedEventMessageObj", item); } else if (item is PatrolLastLocationDTO) { attributes.Add("Id", item.PatrolId + "_PatrolCenter"); } else { attributes.Add("Id", item.Id); } attributes.Add("LayerType", targetNotificatoinLayerType.Value.ToString()); if (item is ViolationToDraw) { attributes.Add("ViolationObj", item.ViolationObj); } else if (item is IncidentToDraw) { attributes.Add("IncidentObj", item.IncidentObj); } else if (item is FogEventMessage) { attributes.Add("FogEventMessageObj", item); } else if (item is WantedCarMessage) { attributes.Add("WantedCarMessageObj", item); } break; } return(attributes); }
public void AddGrphicLayer(LayerTypeEnum layerTypeEnum) { try { var url = "http://192.168.20.244:8080/geoserver/wms/?CQL_FILTER=FORE=0"; if (System.Configuration.ConfigurationSettings.AppSettings["OptimaURL"] != null) { url = System.Configuration.ConfigurationSettings.AppSettings["OptimaURL"]; } //string[] splitArr = url.Split(new char[] { '=' }); //if (splitArr != null && splitArr.Length > 0) //{ // splitArr[splitArr.Length - 1] = trafficTimeInterval.ToString(); //} int index = url.LastIndexOfAny(new char[] { '=' }); if (index != -1) { url = url.Substring(0, index + 1) + trafficTimeInterval.ToString(); } var tiledUri = new Uri(url); //create a new WMS layer with the above URL var agsTiledLayer = new WmsLayer(tiledUri); agsTiledLayer.ID = LayerTypeEnum.Traffic.ToString(); agsTiledLayer.ShowLegend = true; // add layer properties agsTiledLayer.Opacity = 0.7; //Layer Opacity (optional parameter) //select the layers that you want to load from optima service // optima:rlin_tre_rltm_shap_v is the traffic layer // optima:node is the nodes layer at optima // they have many layers to read it all call GetCapabilities from the below url //http://192.168.20.244:8080/geoserver/wms/?SERVICE=WMS&REQUEST=GetCapabilities&configuration=optima // agsTiledLayer.Layers = new[] { "optima:rlin_tre_rltm_shap_v", "optima:node" }; //agsTiledLayer.Layers = new[] { "optima:rlin_tre_rltm_shap_v", "optima:signals_utc_shape" }; agsTiledLayer.Layers = new[] { "optima:rlin_tre_rltm_shap_v" }; //define the return type agsTiledLayer.ImageFormat = "image/png"; Layer layer = esriMapView.Map.Layers.FirstOrDefault(x => x.ID == LayerTypeEnum.Traffic.ToString()); //esriMapView.Map.Layers.Clear(); if (layer != null) { layer = agsTiledLayer; } else { //add the new layer to the map esriMapView.Map.Layers.Add(agsTiledLayer); } } catch (Exception ex) { Utility.WriteLog(ex); //MessageBox.Show(Utility.GetErrorMessage()); Utility.LogOut(); } //_trafficMapControlViewModel.AddGraphicsToLayersGraphicsDictionary(layerTypeEnum); //GraphicsLayer graphicsLayer = new GraphicsLayer(); //graphicsLayer.ID = layerTypeEnum.ToString(); //esriMapView.Map.Layers.Add(graphicsLayer); //System.Windows.Data.Binding binding = new System.Windows.Data.Binding(string.Format("LayersGraphicsDictionary[{0}]", layerTypeEnum.ToString())); //binding.Source = _trafficMapControlViewModel; //binding.Mode = System.Windows.Data.BindingMode.TwoWay; //System.Windows.Data.BindingOperations.SetBinding(graphicsLayer, GraphicsLayer.GraphicsSourceProperty, binding); }
public void PlayAndSwitchMusic(LayerTypeEnum layerType) { musicSource.clip = musicAudioClipArray[(int)layerType]; musicSource.Play(); }