Пример #1
0
        //generates the url for the map request
        public string generateMap(Map map)
        {
            string str;
            string start = "http://maps.google.com/maps/api/staticmap?";

            str = start;

            if (!map.getCenter().Equals("-1"))
            {
                str += "center=" + map.getCenter() + "&";
            }

            if (!map.getZoom().Equals("-1"))
            {
                str += "zoom=" + map.getZoom() + "&";
            }

            if (!map.getSize().Equals("-1"))
            {
                str += "size=" + map.getSize() + "&";
            }

            if (!map.getMapType().Equals("-1"))
            {
                str += "maptype=" + map.getMapType() + "&";
            }

            if (!(map.getMarkers().Count == 0))
            {
                int count = map.getMarkers().Count;

                for (int i = 0; i < count; i++)
                {
                    str += "markers=" + map.getMarkers()[i] + "&";
                }
            }

            if (!map.getMobile().Equals("-1"))
            {
                str += "mobile=" + map.getMobile() + "&";
            }

            str += "sensor=" + map.getSensor();

            return(str);
        }
Пример #2
0
        private void zoomOut(int zo)
        {
            //get the current zoom and decrement by 5
            zoom = Convert.ToInt32(currMap.getZoom());

            //set zoom boundaries
            if ((zoom - zo) < 0)
            {
                zoom = 0;
            }
            else
            {
                zoom = zoom - zo;
            }

            currMap.setZoom(zoom.ToString());
            //repaint image
            Mapping.MapUtils mu = new Mapping.MapUtils();
            pictureBox1.Image = mu.getMapImage(mu.generateMap(currMap));
            pictureBox1.Refresh();
        }