资源简介
在DotSpatial开源类库的基础上开发具有较高实用性、扩展性和技术先进性的GIS软件技术框架,初步实现了地图基本操作、数据读取加载、地图投影及坐标转换等,采用.Net平台,
DotSpatial快速入门。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DotSpatial.Controls;
using DotSpatial.Data;
using DotSpatial.Topology;
using DotSpatial.Symbology;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
map1.MouseUp += map1_MouseUp;
map1.FunctionMode = FunctionMode.Pan;
map1.Legend = legend1;
// map1.dr
}
// Handle the mouse up event
void map1_MouseUp(object sender MouseEventArgs e)
{
// only select polygons with the right button
if (e.Button != MouseButtons.Right) return;
// Get the geographic location of the mouse click
Coordinate c = map1.PixelToProj(e.Location);
// Return if no data layers exist
if (map1.layers.Count < 1) return;
// Also mpl can be used to change the selection color.
IMapPolygonlayer mpl = map1.layers[0] as IMapPolygonlayer;
// If the first layer is not a polygon layer exit.
if (mpl == null) return;
// Get the featureset that contains the actual polygon data for the layer
IFeatureSet fs = map1.layers[0].DataSet as IFeatureSet;
// If this is null or not a featureset exit
if (fs == null) return;
// Set up an index
int iShape = 0;
// Cycle through the shapes
foreach (ShapeRange shape in fs.ShapeIndices)
{
// Test if the coordinate is in the polygon
if (shape.Intersects(c)) //!
{
//!取消全部选择
mpl.UnSelectAll();
// Select the polygon if the the coordinate intersects.
mpl.Select(iShape);
IFeature feature = fs.Features[iShape];
MessageBox.Show( feature.DataRow[“Class1“].ToString()+feature.DataRow[“Area“].ToString());
}
iShape++;
}
// MessageBox.Show(iShape.ToString());
}
private void buttonloadMap_Click(object sender EventArgs e)
{
map1.Addlayer();
}
private void buttonZoomOut_Click(object sender EventArgs e)
{
map1.ZoomOut();
}
private void buttonZoomEx_Click(object sender EventArgs e)
{
map1.ZoomToMaxExtent();
map1.Refresh();
}
private void buttonClearMap_Click(object sender EventArgs e)
{
map1.Clearlayers();
}
private void buttonZoomIn_Click(object sender
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5120 2014-07-25 02:47 DotSpatialMap\bin\cs\DotSpatial.Projections.Forms.resources.dll
文件 8704 2014-07-25 02:47 DotSpatialMap\bin\cs\DotSpatial.Symbology.Forms.resources.dll
文件 17920 2014-07-25 02:47 DotSpatialMap\bin\de\DotSpatial.Projections.Forms.resources.dll
文件 9216 2014-07-25 02:47 DotSpatialMap\bin\de-DE\DotSpatial.Controls.resources.dll
文件 47616 2014-07-25 02:47 DotSpatialMap\bin\de-DE\DotSpatial.Projections.Forms.resources.dll
文件 415232 2014-07-25 02:47 DotSpatialMap\bin\de-DE\DotSpatial.Symbology.Forms.resources.dll
文件 805888 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Controls.dll
文件 1025536 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Controls.pdb
文件 521172 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Controls.xm
文件 402432 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.dll
文件 70656 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.Forms.dll
文件 138752 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.Forms.pdb
文件 101010 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.Forms.xm
文件 1199616 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.pdb
文件 1024669 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Data.xm
文件 10240 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Extensions.dll
文件 19968 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Extensions.pdb
文件 9868 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Extensions.xm
文件 96256 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Modeling.Forms.dll
文件 243200 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Modeling.Forms.pdb
文件 106615 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Modeling.Forms.xm
文件 4608 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Mono.dll
文件 11776 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Mono.pdb
文件 140 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Mono.xm
文件 19782656 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.dll
文件 101376 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.Forms.dll
文件 62976 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.Forms.pdb
文件 15553 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.Forms.xm
文件 744960 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.pdb
文件 273370 2014-07-25 02:47 DotSpatialMap\bin\DotSpatial.Projections.xm
............此处省略116个文件信息
评论
共有 条评论