转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> Delphi程序 >> 正文
MapX使用数据库数据添加专题图(系列之三)         ★★★★

MapX使用数据库数据添加专题图(系列之三)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1323 更新时间:2009/4/23 18:34:06

MapX使用数据库数据添加专题图(系列之三)

关键字:MapX Delphi 专题图

作者:杨雨田 blue_bat@126.com

 

本文描述了在MapX中添加专题图的方法,其中MapX中关于添加专题图的过程语法描述如下(介于英语水平太高,能认识的英文字母大概还有二十多个,实在不愿意打开金山词霸给大家进行高质量的翻译,哈哈):
 
OBJECT.Add ([Type], [Field], [Name], [ComputeTheme]) 
 
OBJECT  Represents a Themes object.
Type   Specifies the type of thematic map to create. This takes a ThemeTypeConstants value. This is an optional parameter, and if not specified (or specified as miThemeAuto), MapX will attempt to choose a good default based on the number of fields passed in as well as what other theme types are already being displayed. If MapX cannot choose a default theme type, an error is generated.
Field(s)   Specifies the field or fields to thematically map. A field can be specified by name, index, or by a Field object. If you are creating a theme using multiple variables (such as a bar chart or pie chart), pass in a Fields collection or an array of field names, indexes, or Field objects. This is an optional parameter, and if not specified, MapX uses the first numeric field of the Dataset.
Name   Specifies the name of the thematic map. This is a String parameter. This is an optional parameter, and if not specified, MapX generates a name such as StatesBySales.
ComputeTheme  Boolean. The default value is True which will calculate the theme from the table data. If the value is set to False an invisible theme object will be created with 10 ranges for IndividualValue themes and 5 ranges for Ranged themes. You can then manually set the minimum and maximum values to define the theme with Theme.DataMin and Theme.DataMax. For ranged themes you can manually set the theme ranges or calculate equal size ranges determined by the minimum (Theme.DataMin) and maximum (Theme.DataMax) values.
 
关于专题图的风格共有以下几种:
        miThemeRanged  = 0 
        miThemeBarChart = 1 
        miThemePieChart = 2 
        miThemeGradSymbol = 3 
        miThemeDotDensity = 4 
        miThemeIndividualValue = 5 
        miThemeAuto = 6 
        miThemeNone = 9
具体都是什么样,请自己写代码看看,哈哈
 
下面是我写的部分代码:
unit Main;
 
interface
 
uses
  Windows, Messages,{略去一部分} SysUtils, Variants, Classes;
 
type
  TfrmMain = class(TForm)
    mapMain: TMap;                      {地图控件}
  private
    { Private declarations }
    ThemesList : TStringList;           {用来保存多个专题图的名称列表}
  public
    { Public declarations }
    procedure ToAddThemes(style : integer; TheName : string);   {添加专题图}
    procedure ToDeleteThemes;           {删除专题图}
  end;
 
var
  frmMain: TfrmMain;
 
implementation
 
{$R *.dfm}
 
{略去其他功能代码}
 
 
{
        添加专题图,参数style表示专题图风格,TheName表示图例标题
}
procedure TfrmMain.ToAddThemes(style : integer; TheName : string);
  function DefaultName : string;{用来生成一唯一的名称}
  begin
    {我用的方法是取一个当前时间,两次调用本函数的时间间隔应该不会少于0.5秒,
     所以这个方法在这个项目中可以取得唯一的名称}
    Result := ''''YYT'''' + FormatDateTime(''''YYYYMMDDHHNNSSzzz'''',now);
  end;
var
  flds : array of string;       {字段列表}
  oBLayer : BindLayer;          {绑定图层}
  ds : Dataset;                 {MapX数据集}
  i : integer;                  {循环变量}
  thm : theme;                  {MapX专题图}
  str : string;                 {用于保存字符串}
begin
  {aqThemes可以是一个ADOQuery或者ADOTable,我使用的是ADOQuery。
   在这个ADOQuery中前四个字段分别是:
     ID(唯一的数字或者字符串,一般为编号),
     NAME(字符串,要素的标签),
     X(浮点数,要素的经度或者横坐标),
     Y(浮点数,要素的纬度或者纵坐标)。
   后面的其它字段都是数字类型,用来表示相关的数据。
    
    ◎请参考我的文章《从数据库绘制MapX图层(二)》,
    url是http://dev.csdn.net/article/31/31719.shtm
   }
  if not aqThemes.Active then
  begin
    dmData.GiveMsg(''''系统基础表没有打开!'''');
    exit;
  end;
  try
    {取一个唯一的名字,}
    str := DefaultName;
 
    {设置绑定图层的属性}
    oBLayer := coBindLayer.Create;
    progress.StepPlus(2);
    oBLayer.LayerName := str;
    oBLayer.LayerType := miBindLayerTypeXY;
    oBLayer.RefColumn1 := ''''X'''';
    oBLayer.RefColumn2 := ''''Y'''';
 
    {下面的调用和我在《从数据库绘制MapX图层(二)》使用的方法一样,
     请参考我的那篇文章,url是http://dev.csdn.net/article/31/31719.shtm}
 

[1] [2]  下一页


没有相关教程
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台