예제 #1
0
        private void SampleMap2(object sender, EventArgs e)
        {
            // create new map object
            var marker = new StaticMap.Marker();
            var map    = new StaticMap
            {
                Width     = 300,
                Height    = 300,
                Zoom      = 16,
                LatCenter = 55.8592110,
                LngCenter = -4.2466380
            };

            // add markers from datasource
            // (in this case a temporary DataTable, it could/should come from a database or other data source)
            var dt = this.GetData();

            foreach (DataRow row in dt.Rows)
            {
                marker     = new StaticMap.Marker();
                marker.Lat = Convert.ToDouble(row["Lat"]);
                marker.Lng = Convert.ToDouble(row["Lng"]);

                // convert our string values to strongly-typed enums
                marker.Size  = Tools.ConvertToEnum <StaticMap.mSize>(row["Size"].ToString());
                marker.Color = Tools.ConvertToEnum <StaticMap.mColor>(row["Color"].ToString());

                map.Markers.Add(marker);
            }



            // render map
            //imgMap.ImageUrl = map.Render();
        }
예제 #2
0
        private void SampleMap1(object sender, EventArgs e)
        {
            // create new map object
            var marker = new Marker();
            var map    = new StaticMap
            {
                Width     = 300,
                Height    = 300,
                Zoom      = 15,
                LatCenter = 55.8592110,
                LngCenter = -4.2466380
            };

            // add markerss
            marker.Lat       = 55.8598393;
            marker.Lng       = -4.2480182;
            marker.Size      = StaticMap.mSize.Normal;
            marker.Color     = StaticMap.mColor.Purple;
            marker.Character = "1";
            map.Markers.Add(marker);

            marker           = new StaticMap.Marker();
            marker.Lat       = 55.8584424;
            marker.Lng       = -4.2457652;
            marker.Size      = StaticMap.mSize.Small;
            marker.Color     = StaticMap.mColor.Green;
            marker.Character = "2"; // this won't be displayed - marker is too small
            map.Markers.Add(marker);


            // render map
            //imgMap.ImageUrl = map.Render();
        }
예제 #3
0
        private void SampleMap3(object sender, EventArgs e)
        {
            // create new map object
            var marker = new StaticMap.Marker();
            var map    = new StaticMap
            {
                Width     = 175,
                Height    = 175,
                Zoom      = 15,
                LatCenter = 55.8592110,
                LngCenter = -4.2466380
            };

            // add marker to center point
            marker.Lat       = 55.8603110;
            marker.Lng       = -4.2449380;
            marker.Size      = StaticMap.mSize.Normal;
            marker.Color     = StaticMap.mColor.Purple;
            marker.Character = "1";
            map.Markers.Add(marker);

            // render map
            //imgMap.ImageUrl = map.Render();
        }