ShapeFile类的名称空间是什么?
我的语言在Esri Map中是银色的:
<esri:GraphicsLayer ShowLegend="false" ID="ResultsGraphicsLayer" />
<esri:GraphicsLayer ShowLegend="false" ID="MyGraphicsLayer" />
<esri:GraphicsLayer ShowLegend="false" ID="MySelectionGraphicsLayer" MouseEnter="GraphicsLayer_MouseEnter" MouseLeave="GraphicsLayer_MouseLeave"/>
<esri:GraphicsLayer ShowLegend="false" ID="IdentifyIconGraphicsLayer"/>
</esri:Map>
代码隐藏中的:
private void openFileDialog_Click(object sender,RoutedEventArgs e) { //创建对话框,允许用户选择&#34; .shp&#34;和&#34; .dbf&#34;档 OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true;
if( !( ofd.ShowDialog() ?? false ) )
return;
//Get the file info objects for the SHP and the DBF file selected by the user
FileInfo shapeFile = null;
FileInfo dbfFile = null;
foreach( FileInfo fi in ofd.Files )
{
if( fi.Extension.ToLower() == ".shp" )
{
shapeFile = fi;
}
if( fi.Extension.ToLower() == ".dbf" )
{
dbfFile = fi;
}
}
//Read the SHP and DBF files into the ShapeFileReader
ShapeFile shapeFileReader = new ShapeFile();
if( shapeFile != null && dbfFile != null )
{
shapeFileReader.Read( shapeFile, dbfFile );
}
else
{
HtmlPage.Window.Alert( "Please select a SP and a DBF file to proceed." );
return;
}
//Add the shapes from the shapefile into a graphics layer named "shapefileGraphicsLayer"
//the greaphics layer should be present in the XAML or created earlier
GraphicsLayer graphicsLayer = MyMap.Layers[ "shapefileGraphicsLayer" ] as GraphicsLayer;
foreach( ShapeFileRecord record in shapeFileReader.Records )
{
Graphic graphic = record.ToGraphic();
if( graphic != null )
graphicsLayer.Graphics.Add( graphic );
}