//instanciate AppStateManager class AppStateManager myStateManager =new AppStateManager(); //put current map alias to state manager dictionary myStateManager.ParamsDictionary[StateManager.ActiveMapAliasKey] =this.MapControl1.MapAlias; //put state manager to session StateManager.PutStateManagerInSession(myStateManager);
#region 测试代码
if (myMap !=null) { if (myMap.Layers["TempLayerAlias"] !=null) { myMap.Layers.Remove("TempLayerAlias"); } } // Need to clean up "dirty" temp table left by other customer requests. MapInfo.Engine.Session.Current.Catalog.CloseTable("TempTableAlias"); // Need to clear the DefautlSelection. MapInfo.Engine.Session.Current.Selections.DefaultSelection.Clear();
// Creat a temp table and AddPintPointCommand will add features into it. MapInfo.Data.TableInfoMemTable ti =new MapInfo.Data.TableInfoMemTable("TempTableAlias"); // Make the table mappable ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn(myMap.GetDisplayCoordSys())); ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());
MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.CreateTable(ti); // Create a new FeatureLayer based on the temp table, so we can see the temp table on the map. myMap.Layers.Insert(0, new FeatureLayer(table, "templayer", "TempLayerAlias"));
IMapLayer lyr = myMap.Layers["TempLayerAlias"]; if (lyr ==null) return; FeatureLayer fLyr = lyr as FeatureLayer;
MapInfo.Geometry.DPoint point =new DPoint(100, 20); MapInfo.Geometry.Point geoPoint =new MapInfo.Geometry.Point(myMap.GetDisplayCoordSys(), point);
// Create a Feature which contains a Point geometry and insert it into temp table. Feature feature =new Feature(geoPoint, vStyle); MapInfo.Data.Key key = fLyr.Table.InsertFeature(feature);
// Now Restore State StateManager.GetStateManagerFromSession().RestoreState(); } }
其他部分的相关代码如下:
Code // At the time of unloading the page, save the state protectedvoid Page_UnLoad(object sender, System.EventArgs e) { if (StateManager.IsManualState()) { StateManager.GetStateManagerFromSession().SaveState(); } }
http://support.microsoft.com/kb/257413/ 这是Visual Studio的一个BUG,只出现在Windows 2000/XP下。如果你不使用Visual Studio Analyzer,可以在安装时选择Custom,然后在Enterprise Tools中清除掉Visual Studio Analyzer。再安…
elasticsearch_dsl.exceptions.ValidationException: You cannot write to a wildcard index. 这里是因为版本不匹配的问题 查看es版本方法如下: 查看elasticsearch包与elasticsearch-dsl版本方法(pip list)如下: 因为我的es是5.1…