コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tagPosition"></param>
        /// <param name="_distance">Feet</param>
        /// <returns></returns>
        public List <NearbyHydrant> GetNearbyHydrants(GeoPoint _tagPosition, double _distance)
        {
            GeoDistance distance = new GeoDistance(DistanceUnits.Feet, _distance);
            GeoBox      gb       = new GeoBox(_tagPosition, distance, distance);

            List <Hydrant> hydrants = GetHydrants(gb);

            List <NearbyHydrant> output = new List <NearbyHydrant>();

            foreach (Hydrant hydrant in hydrants)
            {
                NearbyHydrant nbh = new NearbyHydrant
                {
                    Position = hydrant.Position,
                    Location = string.Format("Latitude: {0}<br>Longitude: {1}",
                                             hydrant.Position.Y.ToString("###.######"),
                                             hydrant.Position.X.ToString("###.######")),
                    HydrantGuid    = hydrant.Guid,
                    DistanceInFeet =
                        PositionHelper.GetDistance(_tagPosition, hydrant.Position).ToFeet().ToString("###.#"),
                    Thumbnail   = string.Format("<img src=\"{0}\" class=\"tagimg\" onclick=\"ShowImage('{1}');\">", hydrant.GetUrl(true), hydrant.GetUrl(false)),
                    MatchButton = string.Format("<button type=\"button\" class=\"btn btn-info\" onclick=\"MatchHydrant('{0}')\">Match</button>", hydrant.Guid)
                };

                output.Add(nbh);
            }

            return(output);
        }
コード例 #2
0
        public string GetCenterRadiusCSVData(double _latitude, double _longitude, double _distance,
                                             bool _includeCenter = false)
        {
            HydrantWikiManager hwm = new HydrantWikiManager();

            GeoPoint point = new GeoPoint(_longitude, _latitude);

            List <NearbyHydrant> hydrants = hwm.GetNearbyHydrants(point, _distance);

            if (_includeCenter)
            {
                NearbyHydrant center = new NearbyHydrant()
                {
                    Color          = "#F51D5A",
                    Symbol         = "cross",
                    DistanceInFeet = "0.0",
                    Position       = new GeoPoint(_longitude, _latitude),
                    HydrantGuid    = Guid.Empty,
                    Title          = "Tag"
                };

                hydrants.Add(center);
            }
            string csv = HydrantCSVHelper.GetHydrantCSV(hydrants);

            return(csv);
        }