private void EventMarkerChecked(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < _layerList.Count; i++)
            {
                if (_layerList[i].Info is MapEventLayer)
                {
                    MapEventLayer info = _layerList[i].Info.ConvertTo <MapEventLayer>();
                    info.MarkerType = EventUseMarker();

                    _layerList[i].GraphicsLayer.Graphics.Clear();
                    foreach (var entry in EventDataList[i])
                    {
                        var attr = new Dictionary <string, object>();
                        attr.Add(info.EventTypeName, entry.Value.Count);
                        entry.Value.ForEach(x => attr.Add($"{attr.Count}. {x.Date.ToShortDateString()}", x.Description));
                        if (info.MarkerType == EventMarkerType.Marker)
                        {
                            _layerList[i].GraphicsLayer.Graphics.Add(new Graphic(entry.Key, attr, info.GetSymbol(GeoStatus.Normal)));
                        }
                        else
                        {
                            _layerList[i].GraphicsLayer.Graphics.Add(new Graphic(entry.Key, attr, info.GetProportionalSymbol(entry.Value.Count, GeoStatus.Normal)));
                        }
                    }
                }
            }
        }
Exemple #2
0
        public static List <MapEventLayer> GetEventLayers(HMCon hmConn, string tableName, string columnName)
        {
            List <MapEventLayer> list = new List <MapEventLayer>();

            string sql   = $"select * from Geo_EventType where LinkTableName='{tableName}'";
            var    table = hmConn.SQLExecutor.ExecuteDataAdapter(sql, hmConn.TRConnection);

            foreach (DataRow row in table.Rows)
            {
                MapEventLayer layer = new MapEventLayer();
                layer.LinkTable     = tableName;
                layer.LinkColumn    = columnName;
                layer.TypeId        = (int)row["Id"];
                layer.EventTypeName = (string)row["TypeName"];

                if (!string.IsNullOrEmpty((string)row["MarkerUri"]))
                {
                    layer.PictureMarkerSymbols = new Dictionary <GeoStatus, PictureMarkerSymbol>
                    {
                        { GeoStatus.Normal, new PictureMarkerSymbol() },
                        { GeoStatus.Hilight, new PictureMarkerSymbol() },
                        { GeoStatus.Reference, new PictureMarkerSymbol() }
                    };

                    layer.PictureMarkerSymbols[GeoStatus.Normal].SetSourceAsync(new System.Uri($"{row["MarkerUri"]}"));
                    layer.PictureMarkerSymbols[GeoStatus.Hilight].SetSourceAsync(new System.Uri($"{row["HilightMarkerUri"]}"));
                    layer.PictureMarkerSymbols[GeoStatus.Reference].SetSourceAsync(new System.Uri($"{row["ReferenceMarkerUri"]}"));

                    foreach (PictureMarkerSymbol symbol in layer.PictureMarkerSymbols.Values)
                    {
                        symbol.Height = PictureMarkerSize;
                        symbol.Width  = PictureMarkerSize;
                    }
                }

                list.Add(layer);
            }

            return(list);
        }
Exemple #3
0
        static private List <IGeoInfo> GetEventList(HMCon hmConn, List <DataRow> rowList, MapEventLayer layer, string linkCodeList)
        {
            List <IGeoInfo> infoList = CreateList <EventGeoInfo>(layer, rowList);

            string sql        = $"select * from Geo_Event where EventTypeId ='{layer.TypeId}' and LinkCode in ({linkCodeList})";
            var    eventTable = hmConn.SQLExecutor.ExecuteDataAdapter(sql, hmConn.TRConnection);

            foreach (var row in rowList)
            {
                EventGeoInfo info = infoList.Find(x => x.KeyCode == $"{row[layer.LinkColumn]}").ConvertTo <EventGeoInfo>();

                var linkRows = eventTable.Select($"LinkCode='{row[layer.LinkColumn]}'");
                foreach (DataRow data in linkRows)
                {
                    EventDetails eve = new EventDetails();
                    eve.Id          = (int)data["Id"];
                    eve.TypeId      = layer.TypeId;
                    eve.EventType   = layer.EventTypeName;
                    eve.Date        = (DateTime)data["EventDate"];
                    eve.Point       = new MapPoint(double.Parse(data["Longitude"].ToString()), double.Parse(data["Latitude"].ToString()), SpatialReferences.Wgs84);
                    eve.Description = (string)data["Description"];
                    info.EventList.Add(eve);
                }
            }

            return(infoList);
        }