MapXtreme2005 不用mapcontrol 控件实现地图的显示
来源:互联网 发布:mac登录远程桌面 编辑:程序博客网 时间:2024/04/30 21:11
开发环境:vs2005 + MapXtreme2005
写下一点经验,供参考:
页面的代码:
后台代码:
配置文件:
<add key="MapInfo.Engine.Session.Workspace" value="C:/Program Files/MapInfo/MapXtreme/6.6/Samples/Data/World.mws" />
按照上述步骤就完成了地图的显示。
写下一点经验,供参考:
页面的代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<img src="<%=m_strImg%>" alt="" style="width: 900px; height: 800px" id="MapControl1_Image" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<img src="<%=m_strImg%>" alt="" style="width: 900px; height: 800px" id="MapControl1_Image" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MapInfo.WebControls;
using System.IO;
using ApplicationStateManager;
public partial class Default2 : System.Web.UI.Page
{
protected string m_strImg = "";
protected void returnImage()
{
MapControlModel model = MapControlModel.GetModelFromSession();
if (model == null) model = MapControlModel.SetDefaultModelInSession();
MemoryStream ms = null;
try
{
ms = model.GetMap("Map1", 900, 800, "Gif");
}
catch (Exception ex)
{
HttpContext.Current.Server.ClearError();
return;
}
// Insert the image stream to Cache with key imageid and timeout in 2 mintues.
string imageid = ImageHelper.GetUniqueID();
ImageHelper.SetImageToCache(imageid, ms, 2);
m_strImg = ImageHelper.GetImageURL(imageid, "Gif");
}
private void Page_Load(object sender, System.EventArgs e)
{
// If the StateManager doesn't exist in the session put it else get it.
if (StateManager.GetStateManagerFromSession() == null)
StateManager.PutStateManagerInSession(new AppStateManager());
// Now Restore State
StateManager.GetStateManagerFromSession().ParamsDictionary[StateManager.ActiveMapAliasKey] = "Map1";
StateManager.GetStateManagerFromSession().RestoreState();
returnImage();
}
// At the time of unloading the page, save the state
private void Page_UnLoad(object sender, System.EventArgs e)
{
StateManager.GetStateManagerFromSession().SaveState();
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MapInfo.WebControls;
using System.IO;
using ApplicationStateManager;
public partial class Default2 : System.Web.UI.Page
{
protected string m_strImg = "";
protected void returnImage()
{
MapControlModel model = MapControlModel.GetModelFromSession();
if (model == null) model = MapControlModel.SetDefaultModelInSession();
MemoryStream ms = null;
try
{
ms = model.GetMap("Map1", 900, 800, "Gif");
}
catch (Exception ex)
{
HttpContext.Current.Server.ClearError();
return;
}
// Insert the image stream to Cache with key imageid and timeout in 2 mintues.
string imageid = ImageHelper.GetUniqueID();
ImageHelper.SetImageToCache(imageid, ms, 2);
m_strImg = ImageHelper.GetImageURL(imageid, "Gif");
}
private void Page_Load(object sender, System.EventArgs e)
{
// If the StateManager doesn't exist in the session put it else get it.
if (StateManager.GetStateManagerFromSession() == null)
StateManager.PutStateManagerInSession(new AppStateManager());
// Now Restore State
StateManager.GetStateManagerFromSession().ParamsDictionary[StateManager.ActiveMapAliasKey] = "Map1";
StateManager.GetStateManagerFromSession().RestoreState();
returnImage();
}
// At the time of unloading the page, save the state
private void Page_UnLoad(object sender, System.EventArgs e)
{
StateManager.GetStateManagerFromSession().SaveState();
}
}
<add key="MapInfo.Engine.Session.Workspace" value="C:/Program Files/MapInfo/MapXtreme/6.6/Samples/Data/World.mws" />
按照上述步骤就完成了地图的显示。
- MapXtreme2005 不用mapcontrol 控件实现地图的显示
- MapXtreme2004代码 MapControl控件中显示地图文件
- MapControl无法显示地图文档的解决方
- C#.net 地图控件开发(十一) 地图控件MapControl
- 在用户控件中使用 MapControl 的正确方法 mapxtreme载入地图
- 在用户控件中使用 MapControl 的正确方法 mapxtreme载入地图
- MapControl控件
- MapxTreme2005地图打印
- 在MapControl中图层不显示的问题
- 关于MapControl和PageLayout地图同步的问题
- DevExpess 控件-MapControl
- MapXtreme2005中表的操作
- MapXtreme2005中表的操作
- mapxtreme2005的破解文件
- 实现地图天气预报的显示
- MapXtreme2005 Table在GridView中显示
- 不用风格的三态树控件的实现(ThreeStateTreeView)
- 实现MapControl与GlobeControl同步
- PL/SQL破解方法(不需要注册码)
- 疯狂的家庭(zz)
- Oracle developer的异常处理机制
- 最流行的六种视频格式
- blog通知测试
- MapXtreme2005 不用mapcontrol 控件实现地图的显示
- Oracle exp
- [ASP.NET]如何点击按钮弹出新窗口,输入数据后返回并刷新页面?(C#代码)
- 四角号码查询器 第3版 发布
- c++资源之不完全导引
- 组合数组
- 系统修复
- 平淡生活:我有姐姐啦
- 网络流量单位bps与系统单位byte转换