日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存

發(fā)布時(shí)間:2025/6/15 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

以下代碼位于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);

???????????????? //恢復(fù)臨時(shí)圖層Animation的狀態(tài)

??????????????? if (HttpContext.Current.Session["Animation" + "Layer"] != null)
?????????????? {
?????????????????? ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Animation" + "Table");
?????????????????? ManualSerializer.RestoreMapXtremeObjectFromHttpSession("Animation" + "Layer");
??????????????? }

????????????? //恢復(fù)標(biāo)注圖層jcbz的狀態(tài)


??????????????? if (HttpContext.Current.Session["jcbz" + "Layer"] != null)

??????????????????????????? ManualSerializer.RestoreMapXtremeObjectFromHttpSession("jcbz" + "Layer");

????? ????????? //恢復(fù)臨時(shí)圖層Tm的狀態(tài)


??????????????????????????? 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)????????????????? //必須加這條語(yǔ)句,否則老是在這里出現(xiàn)錯(cuò)誤

?????????????????????????? ManualSerializer.RestoreMapXtremeObjectFromHttpSession(map.Layers[i].Name+"Layer");

????????????????????? //恢復(fù)地圖中選中的圖元對(duì)象

??????????????? 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圖層,有的話保存狀態(tài)

??????????????? if (map.Layers["Animation"] != null)
??????????????? {
??????????????????? ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog["Animation"], "Animation" + "Table");
??????????????????? ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers["Animation"], "Animation" + "Layer");
??????????????? }

???????????? //判斷地圖中是否有Tm圖層,有的話保存狀態(tài)

??????????????? if (map.Layers["Tm"] != null)
??????????????? {
??????????????????? ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog["Tm"], "Tm" + "Table");
??????????????????? ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers["Tm"], "Tm" + "Layer");
??????????????? }

?????????????? //遍歷各圖層,有層名為jcbz的層則保存該標(biāo)注圖層的狀態(tài)

??????????????? 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");

??????????? }
??????? }

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的MapXtreme 操作地图时出现调用目标发生异常的解决方法--地图状态保存的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。