using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using AspMap;
using AspMap.Web;
public partial class WorldMapApp : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
AddMapLayers();
}
protected void AddMapLayers()
{
string LayerFolder = MapPath("MAPS/WORLD/");
map.AddLayer(LayerFolder + "earth.ecw");
map.AddLayer(LayerFolder + "world.shp");
map.AddLayer(LayerFolder + "lakes.shp");
map.AddLayer(LayerFolder + "capitals.shp");
AspMap.Layer layer;
// world
layer = map["world"];
layer.ShowLabels = true;
layer.LabelField = "CODE";
layer.LabelFont.Name = "Verdana";
layer.LabelFont.Size = 12;
layer.LabelStyle = LabelStyle.PolygonCenter;
layer.Opacity = 0.6;
// lakes
layer = map["lakes"];
layer.ShowLabels = true;
layer.LabelField = "NAME";
layer.LabelFont.Size = 10;
layer.LabelFont.Outline = true;
layer.Symbol.FillColor = Color.Blue;
layer.Symbol.LineColor = layer.Symbol.FillColor;
layer.LabelStyle = LabelStyle.PolygonCenter;
// capitals
layer = map["capitals"];
layer.ShowLabels = true;
layer.LabelField = "NAME";
layer.LabelFont.Bold = true;
layer.LabelFont.Size = 11;
layer.LabelFont.Outline = true;
layer.Symbol.PointStyle = PointStyle.CircleWithLargeCenter;
layer.Symbol.Size = 8;
layer.Symbol.FillColor = Color.White;
}
protected void map_InfoTool(object sender, AspMap.Web.InfoToolEventArgs e)
{
map.Callouts.Clear();
AspMap.Recordset records = map.Identify(e.InfoPoint, 5);
if (!records.EOF)
{
identifyGrid.DataSource = records;
identifyGrid.DataBind();
identifyGrid.Caption = records.Layer.Name.ToUpper();
Callout callout = map.Callouts.Add();
callout.X = e.InfoPoint.X;
callout.Y = e.InfoPoint.Y;
callout.Text = GetCalloutText(records);
callout.Font.Size = 16;
}
}
protected String GetCalloutText(AspMap.Recordset rs)
{
int index = rs.Fields.GetFieldIndex("NAME");
if (index < 0) index = rs.Fields.GetFieldIndex(rs.Layer.LabelField);
if (index < 0) index = 0;
return rs[index].ToString();
}
}
3 comments:
good help
i need your contact number regarding aspmap api pls let me know ur contact number
emailID:srssethuraman@gmail.com
09952974542u
Sri,
I would love if are able to give some samples except those which comes by default after installation of aspmap x.x. e.g. say, selection of shapes from point shape file which lie in selected polygon of polygon layer.
Post a Comment