unit Form_MainU;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,MapWinGIS_TLB, DB, Grids, DBGrids, DBTables, OleCtrls, ComCtrls,
StdCtrls ; type
TForm1 = class(TForm)
Button1: TButton;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Map1: TMap;
Table1: TTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
OpenDialog1: TOpenDialog;
Button2: TButton;
StatusBar1: TStatusBar;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Map1MouseMove(ASender: TObject; Button, Shift: Smallint; x,
y: Integer);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
AShape:Shapefile;
MapHanle:integer;
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin
self.OpenDialog1.FileName :='*.SHP';
if self.OpenDialog1.Execute() then
begin
AShape:=MapWinGIS_TLB.CoShapefile.Create;
AShape.Open(self.OpenDialog1.FileName,nil);
MapHanle:=self.Map1.AddLayer(AShape,true);
self.Table1.TableName :=ExtractFilePath(self.OpenDialog1.FileName)+'grid.dbf';
self.Table1.Active:=true;
end;
end; procedure TForm1.Map1MouseMove(ASender: TObject; Button, Shift: Smallint;
x, y: Integer);
var
XX,YY:Double;
begin
Self.Map1.PixelToProj(x,y,XX,YY);
Self.StatusBar1.Panels[].Text :='X='+formatFloat('#.##',XX);
Self.StatusBar1.Panels[].Text :='Y='+formatFloat('#.##',YY);
end; procedure TForm1.Button2Click(Sender: TObject);
var
i:Integer;
x,y:Double;
begin
for i:= to AShape.NumShapes- do
begin
x:=AShape.Shape[i].Extents.xMin;
y:=AShape.Shape[i].Extents.yMin;
Self.Map1.AddLabel(MapHanle,'v',clBlack,x,y,MapWinGIS_TLB.hjCenter);//添加标注
Self.Map1.Redraw;//图层刷新
end;
end; procedure TForm1.Button3Click(Sender: TObject);
begin
self.Map1.ClearLabels(MapHanle);//删除标注
Self.Map1.Redraw;//刷新
end; end.

MapWinGIS添加标注的速度还是很快的,9万多个标注添加到图层上,等待的时间还是可以忍受的,大概6~9秒钟吧。

在Delphi下基于MapWinGIS添加和删除图层标注的方法的更多相关文章

  1. Delphi下使用MapWinGIS控件打开GIS图层

    unit Unit3; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...

  2. Linux下基于LVM调整分区容量大小的方法

    Linux下调整分区容量大小的方法(适用于centos6-7) 说明:以下方法均使用centos6.9和centos7.4进行测试. Centos6分区容量调整方法 1.web分区空间不足,新添加一块 ...

  3. delphi TreeView 从数据库添加节点的四种方法

    方法一:delphi中递归算法构建treeView 过程:通过读取数据库中table1的数据,来构建一颗树.table1有两个字段:ID,preID,即当前结点标志和父结点标志.所以整个树的表示为父母 ...

  4. DELPHI下的SOCK编程(转)

    DELPHI下的SOCK编程      本文是写给公司新来的程序员的,算是一点培训的教材.本文不会涉及太多的编程细节,只是简单讲解在DELPHI下进行Winsock编程最好了解的知识. 题外话:我认为 ...

  5. DELPHI下的SOCK编程

     DELPHI下的SOCK编程(转自http://www.cnblogs.com/devcjq/articles/2325600.html) 本文是写给公司新来的程序员的,算是一点培训的教材.本文不会 ...

  6. 深入Delphi下的DLL编程

    深入Delphi下的DLL编程 作者:岑心 引 言 相信有些计算机知识的朋友都应该听说过“DLL”.尤其是那些使用过windows操作系统的人,都应该有过多次重装系统的“悲惨”经历——无论再怎样小心, ...

  7. .NET环境下基于RBAC的访问控制

    .NET环境下基于RBAC的访问控制 Access Control of Application Based on RBAC model in .NET Environment 摘 要:本文从目前信息 ...

  8. 在Jena框架下基于MySQL数据库实现本体的存取操作

    在Jena框架下基于MySQL数据库实现本体的存取操作 转自:http://blog.csdn.net/jtz_mpp/article/details/6224311 最近在做一个基于本体的管理系统. ...

  9. 在XP下基于VHD版XP 2003 win7制作的RAMOS心得

    在XP下基于VHD版win7制作的RAMOS心得1.用DiskGenius创建1.85G的VHD固定磁盘文件,以win7prosen.vhd为例,然后进行分区格式化,格式化时启用NTFS压缩.2.为了 ...

随机推荐

  1. hdu 1059 多重背包

    题意:价值分别为1,2,3,4,5,6的物品个数分别为a[1],a[2],a[3],a[4],a[5],a[6],问能不能分成两堆价值相等的. 解法:转化成多重背包 #include<stdio ...

  2. 在getView方法产生给用户item的视图以及数据

    在getView方法产生给用户item的视图以及数据

  3. Gym 100971D Laying Cables 单调栈

    Description One-dimensional country has n cities, the i-th of which is located at the point xi and h ...

  4. CodeForces Gym 100500A A. Poetry Challenge DFS

    Problem A. Poetry Challenge Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  5. C++primer学习笔记(四)——Chapter 6

    6.1  Function Basics 一.函数的构造 type functionName( parameters list) statement 1.首先格式如上,一个函数一定要有返回值的类型ty ...

  6. sc.WholeTextFiles与sc.textFile区别

    val data1 = sc.wholeTextFiles("/opt/test")val data  = sc.textFile("/opt/test/") ...

  7. 贪心 POJ 2109 Power of Cryptography

    题目地址:http://poj.org/problem?id=2109 /* 题意:k ^ n = p,求k 1. double + pow:因为double装得下p,k = pow (p, 1 / ...

  8. reqSUB错误

    ---- ERROR ----    Error in dispatcher subroutine reqSUB: Invalid PAR(1): 0502 上面是用adams/ca加载一个汽车模型时 ...

  9. 关于zero pivot

    下面是运行一个adams/car模型出现的错误. ---- ERROR ----    The system matrix has a zero pivot for column 2142, whic ...

  10. django 代码片段3

    #coding=utf-8 # 没有++ 和--其他的都一样 foo=1 show_output=True if show_output and foo==1: print 'pyhont and % ...