// Save the state public override void SaveState() { string mapAlias = ParamsDictionary[ActiveMapAliasKey] as string; Map map = GetMapObj(mapAlias); if (map == null) { return; } SaveZoomCenterState(map); //ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers, "Layers"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Selections.DefaultSelection, GetKey("Selection")); // Needs this because StateManger doens't have proper function to save them. // Need to serialize the temp table first since the temp layer is based on it. if (StateManager.IsManualState()) { MapInfo.Mapping.FeatureLayer fLyr = (MapInfo.Mapping.FeatureLayer)map.Layers[Constants.TempLayerAlias]; MapInfo.Data.Table tbl = (fLyr != null) ? fLyr.Table : null; if (fLyr != null) { ManualSerializer.SaveMapXtremeObjectIntoHttpSession(tbl, "tempTable"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(fLyr, "tempLayer"); } } }
// Save the state public override void SaveState() { string mapAlias = this.ParamsDictionary[AppStateManager.ActiveMapAliasKey] as String; MapInfo.Mapping.Map map = GetMapObj(mapAlias); if (map != null) { ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Selections.DefaultSelection, StateManager.GetKey("Selection")); MapInfo.WebControls.StateManager.SaveZoomCenterState(map); // Needs this because StateManger doens't have proper function to save them. if (StateManager.IsManualState()) { // this TempLayer should be always there, otherwise there is a chance to get other customer's TempLayer. MapInfo.Mapping.IMapLayer lyr = map.Layers[SampleConstants.TempLayerAlias]; if (lyr != null) { MapInfo.Mapping.FeatureLayer fLyr = lyr as MapInfo.Mapping.FeatureLayer; // Need to serialize the temp table first since the temp layer is based on it. ManualSerializer.SaveMapXtremeObjectIntoHttpSession(fLyr.Table, "tempTable"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(fLyr, "tempLayer"); } } } }
// Save the state public override void SaveState() { string mapAlias = ParamsDictionary[ActiveMapAliasKey] as string; Map map = MapInfo.Engine.Session.Current.MapFactory[mapAlias]; if (map != null) { SaveZoomCenterState(map); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers, "Layers"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Selections.DefaultSelection, "Selection"); } }
// Save the users current state public override void SaveState() { string mapAlias = ParamsDictionary[ActiveMapAliasKey] as string; Map map = GetMapObj(mapAlias); if (map != null) { SaveZoomCenterState(map); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers, "Layers"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Selections.DefaultSelection, "Selection"); // Mark the users HTTPSession as dirty HttpContext.Current.Session["UserDirtyFlag"] = true; } }
// Save the state public override void SaveState() { string mapAlias = this.ParamsDictionary[AppStateManager.ActiveMapAliasKey] as String; MapInfo.Mapping.Map map = GetMapObj(mapAlias); if (map == null) { return; } // 1. Only if the MapInfo.Engine.Session.State is set to "Manual" in the web.config, // We manually save objects below. // 2. The MapInfo Session object will be automatically saved and you need to do nothing, // if the MapInfo.Engine.Session.State is set to HttpSessionState. AppStateManager.SaveZoomCenterState(map); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog, "Catalog"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers, "Layers"); }
// Save the state public override void SaveState() { string mapAlias = this.ParamsDictionary[AppStateManager.ActiveMapAliasKey] as String; MapInfo.Mapping.Map map = GetMapObj(mapAlias); if (map != null) { MapInfo.WebControls.StateManager.SaveZoomCenterState(map); // Note: Please be aware of the order of assigning below objects to HttpContext.Current.Session. // The order matters in this case since theme_table contains some temp columns constructed from mdb_table. // and some themes/modifiers in the theme_layer are based on the theme_table. ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog[SampleConstants.EWorldAlias], "mdb_table"); //HttpContext.Current.Session["mdb_table"] = MapInfo.Engine.Session.Current.Catalog[SampleConstants.EWorldAlias]; ManualSerializer.SaveMapXtremeObjectIntoHttpSession(MapInfo.Engine.Session.Current.Catalog[SampleConstants.ThemeTableAlias], "theme_table"); //HttpContext.Current.Session["theme_table"] = MapInfo.Engine.Session.Current.Catalog[SampleConstants.ThemeTableAlias]; ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers[SampleConstants.ThemeLayerAlias], "theme_layer"); //HttpContext.Current.Session["theme_layer"] = map.Layers[SampleConstants.ThemeLayerAlias]; // Group Layer holds temp object theme or label layers which varies with requests. ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers[SampleConstants.GroupLayerAlias], "group_layer"); //HttpContext.Current.Session["group_layer"] = map.Layers[SampleConstants.GroupLayerAlias]; } }
// Save the state public override void SaveState() { string mapAlias = this.ParamsDictionary[AppStateManager.ActiveMapAliasKey] as String; MapInfo.Mapping.Map myMap = GetMapObj(mapAlias); if (myMap == null) { return; } // Note: for performance reasons, only save the map's center and zoom. AppStateManager.SaveZoomCenterState(myMap); // Get the workingLayerName saved in WebForm1.aspx page_load. string workingLayerName = this.ParamsDictionary["WorkingLayerName"] as String; // Save the map's Working table and layer MapInfo.Mapping.FeatureLayer workingLayer = (MapInfo.Mapping.FeatureLayer)myMap.Layers[workingLayerName]; MapInfo.Data.Table workingTable = workingLayer != null ? workingLayer.Table : null; ManualSerializer.SaveMapXtremeObjectIntoHttpSession(workingTable, "WorkingTable"); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(workingLayer, "WorkingLayer"); }
// Save the state public override void SaveState() { string mapAlias = this.ParamsDictionary[AppStateManager.ActiveMapAliasKey] as String; // Get the map MapInfo.Mapping.Map myMap = GetMapObj(mapAlias); if (myMap == null) { return; } // 1. Only if the MapInfo.Engine.Session.State is set to "Manual" in the web.config, // We manually save objects below. // 2. The MapInfo Session object will be automatically saved and you need to do nothing, // if the MapInfo.Engine.Session.State is set to HttpSessionState. AppStateManager.SaveZoomCenterState(myMap); ManualSerializer.SaveMapXtremeObjectIntoHttpSession(myMap.Layers, GetKey("Layers")); // Save NorthArrowAdornment. if (myMap.Adornments["north_arrow"] != null) { ManualSerializer.SaveMapXtremeObjectIntoHttpSession(myMap.Adornments["north_arrow"], "north_adornment"); } }