資源簡介
基于SharpMap的HeatLayer調用和封裝源碼。不包含SharpMap.DLL和SharpMap.HeatLayer.DLL

代碼片段和文件信息
/***************************************************************
*
*?文?件?名:?SharpMapHeatlayerHelper
*
*?作?者:?毛健
*
*?創作日期:?2016/11/16?17:21:35
*
*?備?注:?靜態類,用于熱圖(heatlayer)的相關操作。
*
***************************************************************/
using?DCMS.Maps;
using?DCMS.Maps.WindowsForms;
using?DCMS.Maps.WindowsForms.Markers;
using?GeoAPI.Geometries;
using?SharpMap.Data.Providers;
using?SharpMap.layers;
using?SharpMap.Rendering.Thematics;
using?System;
using?System.Collections.Generic;
using?System.Data;
using?System.Diagnostics;
using?System.Drawing;
using?System.Linq;
using?System.Reflection;
using?System.Text;
using?System.Windows.Forms;
namespace?WebMap
{
????///?
????///?SharpMap的熱圖輔助類
????///?
????internal?static?class?SharpMapHeatlayerHelper
????{
????????///?
????????///?檢查數據表合法性
????????///?
????????///?數據表
????????///?true為合法,false為非法
????????private?static?bool?CheckHeatDataVarification(List?heatPoints)
????????{
????????????var?pointsCount?=?heatPoints.Count;
????????????//數據行數合法性
????????????if?(pointsCount?<=?0)
????????????{
????????????????MessageBox.Show(“您的數據表中沒有數據,請檢查“);
????????????????return?false;
????????????}
????????????//①這個方法不是很好,因為類型有可能變動。
????????????//Int32?fieldCount?=?typeof(HeatPoints).GetFields().Length;
????????????//②在確保泛型中有元素的情況下使用反射。
????????????Dictionary?dictionary?=?new?Dictionary();
????????????dictionary.Add(“Lng“?typeof(double));
????????????dictionary.Add(“Lat“?typeof(double));
????????????dictionary.Add(“Value“?typeof(int));
????????????string[]?defaultPropertyNames?=?dictionary.Keys.ToArray();
????????????//字段對象結合
????????????Type?typeHeatPoints?=?heatPoints[0].GetType();
????????????var?properties?=?typeHeatPoints.GetProperties();
????????????var?propertiesCount?=?properties.Length;
????????????//構造外來參數字段集合
????????????List?outFieldNames?=?new?List();
????????????foreach?(PropertyInfo?propertyInfo?in?properties)
????????????{
????????????????outFieldNames.Add(propertyInfo.Name);
????????????}
????????????//字段判斷
????????????if?(propertiesCount?<=?0)
????????????{
????????????????MessageBox.Show(“您的TDOA數據中沒有任何字段,請添加字段“);
????????????????return?false;
????????????}
????????????else
????????????{
????????????????foreach?(string?defaultPropertyName?in?defaultPropertyNames)
????????????????{
????????????????????if?(!outFieldNames.Contains(defaultPropertyName))
????????????????????{
????????????????????????MessageBox.Show(“您的TDOA數據中不包含“?+?defaultPropertyName?+?“字段,請添加該字段“);
????????????????????????return?false;
????????????????????}
????????????????}
????????????}
????????????//雙游標模式下的被動索引
????????????int?index?=?0;
????????????//遍歷數據行。
????????????for?(int?i?=?0;?i?????????????{
????????????????//默認字段游標索引
????????????????string?currentPropert
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????18800??2016-12-06?09:15??heatla
?????文件?????????310??2016-12-06?09:23??heatla
?????目錄???????????0??2016-12-06?09:15??heatla
- 上一篇:u-boot-ar9341
- 下一篇:IOCP服務器、客戶端終極網絡聊天室代碼
評論
共有 條評論