예제 #1
0
파일: Form1.cs 프로젝트: Hagser/csharp
        private Weather AddProperties(Weather w, dynamic ev)
        {
            try
            {
                w.Active = ev.Active==null?false:ev.Active;
                w.AirTemp = ev.AirTemp == null ? 0 : ev.AirTemp;
                w.AirTempIconId = ev.AirTempIconId == null ? 0 : ev.AirTempIconId;
                w.AverageWindIconId = ev.AverageWindIconId == null ? 0 : ev.AverageWindIconId;
                w.CountyNo = ev.CountyNo == null ? 0 : ev.CountyNo;
                w.EW = ev.EW == null ? 0 : ev.EW;
                w.Id = ev.Id == null ? "" : ev.Id;
                w.MaxWindIconId = ev.MaxWindIconId == null ? 0 : ev.MaxWindIconId;
                w.MeasurePoint = ev.MeasurePoint == null ? "" : ev.MeasurePoint;
                w.NS = ev.NS == null ? 0 : ev.NS;
                w.PrecipitationIconId = ev.PrecipitationIconId == null ? 0 : ev.PrecipitationIconId;
                w.RoadTemp = ev.RoadTemp == null ? 0 : ev.RoadTemp;
                w.RoadTempIconId = ev.RoadTempIconId == null ? 0 : ev.RoadTempIconId;
                w.StationIconId = ev.StationIconId == null ? 0 : ev.StationIconId;
                w.WindIconId = ev.WindIconId == null ? 0 : ev.WindIconId;
                w.ZoomLevel = ev.ZoomLevel == null ? 0 : ev.ZoomLevel;

                w.AverageWindForce = ev.AverageWindForce == null ? 0 : ev.AverageWindForce;
                w.MaxWindForce = ev.MaxWindForce == null ? 0 : ev.MaxWindForce;
                w.WindForce = ev.WindForce == null ? 0 : ev.WindForce;

                GeoUTMConverter conv = new GeoUTMConverter();
                conv.ToLatLon(w.EW, w.NS, 33, GeoUTMConverter.Hemisphere.Northern);
                w.Lat = Math.Round(conv.Latitude, 6);
                w.Lng = Math.Round(conv.Longitude, 6);
                
            }
            catch(Exception ex) {
                string s = ex.Message;
            }
            return w;
        }
예제 #2
0
파일: Form1.cs 프로젝트: Hagser/csharp
        private Weather ConvertXYZToLatLngAlt(string Id,double Lat,double Lng)
        {
            Weather wcout = new Weather() { Id = Id, Lat = Lat, Lng = Lng };

            GeoUTMConverter conv = new GeoUTMConverter();
            conv.ToLatLon(Lat, Lng, 33, GeoUTMConverter.Hemisphere.Northern);
            wcout.Lat = Math.Round(conv.Latitude, 6);
            wcout.Lng = Math.Round(conv.Longitude, 6);

            return wcout;
        }