MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存
来源:互联网 发布:企业邮箱 更换域名 编辑:程序博客网 时间:2024/06/09 21:54
以下代码位于AppStateManager.cs文件中:
// Restore the state
public override void RestoreState()
{
string mapAlias = ParamsDictionary[ActiveMapAliasKey] as string;
Map map = GetMapObj(mapAlias);
// If it was user's first time and the session was not dirty then save this default state to be applied later.
// If it was a users's first time and the session was dirty then apply the default state saved in above step to give users a initial state.
if (IsUsersFirstTime())
{
if (IsDirtyMapXtremeSession(map))
{
RestoreDefaultState(map);
}
else
{
SaveDefaultState(map);
}
}
else
{
// If it is not user's first time then restore the last state they saved
RestoreZoomCenterState(map);
//恢复临时图层Animation的状态
if (HttpContext.Current.Session["Animation" + "Layer"] != null)
{
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Animation" + "Table");
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Animation" + "Layer");
}
//恢复标注图层jcbz的状态
if (HttpContext.Current.Session["jcbz" + "Layer"] != null)
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("jcbz" + "Layer");
//恢复临时图层Tm的状态
if (HttpContext.Current.Session["Tm" + "Layer"] != null)
{
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Tm" + "Table");
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Tm" + "Layer");
}
// Just by setting it to temp variables the objects are serialized into session. There is no need to set them explicitly.
for (int i = 0; i < map.Layers.Count ;i++ )
if(map.Layers[i]!=null) //必须加这条语句,否则老是在这里出现错误
ManualSerializer.RestoreMapXtremeObjectFromHttpSession(map.Layers[i].Name+"Layer");
//恢复地图中选中的图元对象
ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Selection");
}
}
// Save the state
public override void SaveState()
{
string mapAlias = ParamsDictionary[ActiveMapAliasKey] as string;
Map map = GetMapObj(mapAlias);
if (map != null)
{
SaveZoomCenterState(map);
//判断地图中是否有Animation图层,有的话保存状态
if (map.Layers["Animation"] != null)
{
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog["Animation"], "Animation" + "Table");
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers["Animation"], "Animation" + "Layer");
}
//判断地图中是否有Tm图层,有的话保存状态
if (map.Layers["Tm"] != null)
{
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog["Tm"], "Tm" + "Table");
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers["Tm"], "Tm" + "Layer");
}
//遍历各图层,有层名为jcbz的层则保存该标注图层的状态
for (int i = 0; i < map.Layers.Count; i++)
if (map.Layers[i].Name == "jcbz")
{
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers[i], "jcbz" + "Layer");
break;
}
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers, "Layers");
ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Selections.DefaultSelection, "Selection");
}
}
- MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存
- MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存
- MapXtreme 地图保存为图片之解决
- mapxtreme的地图绘制概念
- Mapxtreme Java 地图缩放,平移操作的原理和实现
- VS2010 调用的目标发生了异常
- vs2013 调用的目标发生了异常
- Assembly 调用的目标发生了异常
- VS2013 调用的目标发生了异常
- VS2013 调用的目标发生了异常
- 当容器处于隐藏状态时,调用百度地图会出现bug的解决办法
- MapXtreme for java MapJ操作地图
- Eclipse保存密码时发生异常的解决方法
- ASP+MapXtreme显示地图的小例子
- MapXtreme查看整个地图的代码
- ASP+MapXtreme 显示地图的小例子
- Baidu 地图 集成出现的异常
- MapXtreme 2005加载地图
- MAPXTREME 与 IE8
- sso单点登陆的web.xml的设置
- MapXtreme 地图搜索之图元定位
- 二级指针的操作与泄露
- 全排列
- MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存
- php设计模式
- MapXtreme 地图保存为图片之解决
- JDK 和 Ant环境变量的配置
- Oracle表空间增长率监控脚本
- Java中的反射机制
- 浅谈dbus udev udisks
- MapXtreme2005 自带的文件夹MapXtremeWebResources中的Interaction.js中的缺陷代码
- MySQL 触发器简单实例