试用mapxtreme 2005 v6.6中的一个问题
在操作了几次放大缩小后,它就不工作了,哪位用过的,知道是什么原因 ?
以下是出错界面
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
|
源文件: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\d8e8a4a2\33210ac3\App_Web_-y-moa2u.0.cs 行: 0
堆栈跟踪:
|
版本信息: Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.42
以下是部份程序
MapInfo.Data.TableInfoMemTable tblInfoTemp = new MapInfo.Data.TableInfoMemTable("Animation");
MapInfo.Data.Table tblTemp = MapInfo.Engine.Session.Current.Catalog.GetTable("Animation");
if (tblTemp != null)
{
MapInfo.Engine.Session.Current.Catalog.CloseTable("Animation");
}
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn(myMap.GetDisplayCoordSys()));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("显示", 64));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("编号", 8));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("设备编号", 8));
tblTemp = MapInfo.Engine.Session.Current.Catalog.CreateTable(tblInfoTemp);
FeatureLayer lyr = new FeatureLayer(tblTemp);
myMap.Layers.Add(lyr);
//以上为创建临时表
MapInfo.Styles.FontPointStyle _fontSymbol = new MapInfo.Styles.FontPointStyle();
_fontSymbol.Code = 93;
_fontSymbol.PointSize = 24;
_fontSymbol.Color = System.Drawing.Color.Purple;
// _fontSymbol.Font.Name = "MapInfo Transportation";
_fontSymbol.Font.Name = "Uniwill";
_fontSymbol.Font.FontWeight = MapInfo.Styles.FontWeight.Bold;
_fontSymbol.Angle = -450;
MapInfo.Styles.FontPointStyle _fontSymbol2 = new MapInfo.Styles.FontPointStyle();
_fontSymbol2.Code = 94;
_fontSymbol2.PointSize = 24;
_fontSymbol2.Color = System.Drawing.Color.Purple;
_fontSymbol2.Font.Name = "Uniwill";
_fontSymbol2.Font.FontWeight = MapInfo.Styles.FontWeight.Bold;
_fontSymbol2.Angle = 900;
//以上为创建点样式
FeatureGeometry pt3 = new MapInfo.Geometry.Point(lyr.CoordSys, new DPoint(x, y)) as FeatureGeometry;
MapInfo.Styles.CompositeStyle cs3 = new MapInfo.Styles.CompositeStyle(new MapInfo.Styles.SimpleVectorPointStyle(20, System.Drawing.Color.Red, 10));
MapInfo.Data.Feature ftr3 = new MapInfo.Data.Feature(tblTemp.TableInfo.Columns);
ftr3.Geometry = pt3;
cs3.SymbolStyle = _fontSymbol;
ftr3.Style = cs3;
ftr3["编号"] = "辽A12345";
ftr3["设备编号"] = "1391234567";
ftr3["显示"] = ftr3["编号"] + "\n" + ftr3["设备编号"];
FeatureGeometry pt2 = new MapInfo.Geometry.Point(lyr.CoordSys, new DPoint(x + 0.02, y + 0.02)) as FeatureGeometry;
MapInfo.Styles.CompositeStyle cs2 = new MapInfo.Styles.CompositeStyle(new MapInfo.Styles.SimpleVectorPointStyle(20, System.Drawing.Color.Red, 10));
MapInfo.Data.Feature ftr2 = new Feature(tblTemp.TableInfo.Columns);
ftr2.Geometry = pt2;
cs2.SymbolStyle = _fontSymbol2;
ftr2.Style = cs2;
ftr2["编号"] = "辽A12345";
ftr2["设备编号"] = "1391234567";
ftr2["显示"] = ftr3["编号"] + "\n" + ftr3["设备编号"];
//以上为创建点
//显示点
tblTemp.InsertFeature(ftr3);
tblTemp.InsertFeature(ftr2);
MapInfo.Styles.TextStyle _textSymbol = new MapInfo.Styles.TextStyle();
_textSymbol.Font.ForeColor = Color.Red;
_textSymbol.Font.Size = 8;
LabelLayer txtlayer = new LabelLayer();
myMap.Layers.Add(txtlayer);
LabelSource source = new LabelSource(MapInfo.Engine.Session.Current.Catalog.GetTable("Animation"));
source.DefaultLabelProperties.Caption = "显示";
source.DefaultLabelProperties.Style = _textSymbol;
txtlayer.Sources.Append(source);