Beispiel #1
0
        public ClusteredPin()
        {
            pixelX = -1;
            pixelY = -1;
            ClusterArea = new Bounds();

            ServiceCodeToTitle = new Dictionary<string, string>();
        }
Beispiel #2
0
        public ClusteredPin(LatLong loc, Bounds clusterArea)
        {
            pixelX = -1;
            pixelY = -1;
            Loc = loc;
            ClusterArea = clusterArea;

            ServiceCodeToTitle = new Dictionary<string, string>();
        }
Beispiel #3
0
        public ClusteredPin(LatLong loc, Bounds clusterArea, int assessmentid)
        {
            pixelX = -1;
            pixelY = -1;
            Loc = loc;
            ClusterArea = clusterArea;
            assessmentids.Add(assessmentid);

            ServiceCodeToTitle = new Dictionary<string, string>();
        }
Beispiel #4
0
        public ClusteredPin(LatLong loc, Bounds clusterArea, int assessmentid, NameValueCollection assessmentHeaderData)
        {
            pixelX = -1;
            pixelY = -1;
            Loc = loc;
            ClusterArea = clusterArea;
            assessmentids.Add(assessmentid);
              //  AssessmentHeaderData = assessmentHeaderData;

            ServiceCodeToTitle = new Dictionary<string, string>();
        }
Beispiel #5
0
 /// <summary>
 /// Expands the current bounds to include the supplied bounds
 /// </summary>
 /// <param name="bounds">the latitude/longitude to be included</param>
 public void IncludeInBounds(Bounds bounds)
 {
     if (bounds.SE.Lat < SE.Lat)
     {
         SE.Lat = bounds.SE.Lat;
     }
     if (bounds.NW.Lat > NW.Lat)
     {
         NW.Lat = bounds.NW.Lat;
     }
     if (bounds.SE.Lon > SE.Lon)
     {
         SE.Lon = bounds.SE.Lon;
     }
     if (bounds.NW.Lon < NW.Lon)
     {
         NW.Lon = bounds.NW.Lon;
     }
 }
Beispiel #6
0
        public ClusteredPin(LatLong loc, Bounds clusterArea, int assessmentid, string pinType, NameValueCollection assessmentHeaderData, string themeParameter)
        {
            pixelX = -1;
            pixelY = -1;
            Loc = loc;
            ClusterArea = clusterArea;
            assessmentids.Add(assessmentid);
            PinType = pinType;
              //  AssessmentHeaderData = assessmentHeaderData;
              //  ThemeParameter = themeParameter;

            ServiceCodeToTitle = new Dictionary<string, string>();
        }
        /// <summary>
        /// Calulate zoomlevel for bounds
        /// </summary>
        /// <param name="bounds"></param>
        /// <param name="mapScreenWidth"></param>
        /// <param name="mapScreenHeight"></param>
        /// <returns></returns>
        public int GetZoomlevelForBounds(Bounds bounds, int mapScreenWidth, int mapScreenHeight)
        {
            int d = 1; //min resolution
            int e = 17; //min resolution
            int zoomLevel = 1;

            for (int h = e; h > d; h--)
            {
                double Screen_maxlat = Utilities.LatitudeToYAtZoomGoogle(bounds.NW.Lat, h);
                //double Screen_maxlat1 = Utilities.LatitudeToYAtZoomGoogle(maxLat, h);
                double Screen_maxlon = Utilities.LongitudeToXAtZoomGoogle(bounds.SE.Lon, h);
                //double Screen_maxlon1 = Utilities.LongitudeToXAtZoomGoogle(maxLon, h);
                double Screen_minlat = Utilities.LatitudeToYAtZoomGoogle(bounds.SE.Lat, h);
                double Screen_minlon = Utilities.LongitudeToXAtZoomGoogle(bounds.NW.Lon, h);
                if ((Math.Abs(Screen_maxlat - Screen_minlat) <= mapScreenHeight) && (Math.Abs(Screen_maxlon - Screen_minlon) < mapScreenWidth))
                { zoomLevel = h; break; }
            }
            return zoomLevel;
        }
        /// <summary>
        /// Get Centerpoint For Bounds
        /// </summary>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public LatLong GetCenterpointForBounds(Bounds bounds)
        {
            var latLong = new LatLong();

            latLong.Lat = (bounds.NW.Lat + bounds.SE.Lat) / 2;
            latLong.Lon = (bounds.SE.Lon + bounds.NW.Lon) / 2;

            return latLong;
        }
        /// <summary>
        /// Calculate Bounds for given answertext polygon
        /// </summary>
        /// <param name="txt"></param>
        /// <returns></returns>
        public Bounds GetBoundsFromAnswertext(string txt)
        {
            string[] c = txt.Split(';');
            Bounds polygonbounds = new Bounds();
            if (c.Length > 2)
            {
                for (int i = 0; i < c.Length; i++)
                {
                    string[] d = c[i].Split(',');//order is lng lat

                    if (d[0] != String.Empty) polygonbounds.IncludeInBounds(new Bounds(new LatLong(Convert.ToDouble(d[1]), Convert.ToDouble(d[0])), new LatLong(Convert.ToDouble(d[1]), Convert.ToDouble(d[0]))));

                }
            }
            return polygonbounds;
        }