当前位置: 首页 > news >正文

TatukGIS Developer Kernel使用教程:如何为FMX创建第一个应用程序

概述:TatukGIS Developer Kernel(DK)是一个用于开发自定义地理信息系统(GIS)应用程序以及解决方案的综合性软件开发工具包(SDK)。本篇文章主要介绍用DK11为FMX创建一个应用程序,现在就跟着小编来了解一下吧~

# 31款JAVA开发必备控件和工具 # 界面/文档管理/报表/IDE等4000款产品火热销售中 >>

TatukGIS Developer Kernel(DK)是一个用于开发自定义地理信息系统(GIS)应用程序以及解决方案的综合性软件开发工具包(SDK)。其功能强大,价格适中,个人、公司及政府等客户都需喜欢使用。感兴趣的朋友可以下载来用一下哦^-^

点击下载TatukGIS Developer Kernel免费版

本篇文章主要介绍用DK11为FMX创建一个应用程序,现在就跟着小编来了解一下吧~

创建新项目

创建多设备应用程序。然后选择空白应用程序。

image1.png

设计形式

打开“设计”选项卡并在空白表单上添加控件。从工具选项板中选择控件。

工具选项板包含设计表单的所有组件。专用TatukGIS组件包含在“TatukGIS”类别中。

image2.png

对象检查器包含与指定对象关联的属性和事件。在本节中,您可以设置:标题、名称、对齐、位置、大小等。

image3.png

1、添加TStatusBar并将TLabel放在上面。更改lblPosition的标签名称,并将其文本设置为“Position:”。

2、添加TGIS_ViewerWND。将其名称更改为“GIS”。在对象检查器中,将“对齐”设置为“客户端”。

3、添加TToolBar,将对齐设置为“顶部”。

4、向TToolBar添加四个按钮(TButton):

  • 名称:btnOpen,文本:打开

  • 名称:btnSelect,文本:选择

  • 名称:btnDrag,文本:拖动

  • 名称:btnZoom,文本:缩放

设置每个按钮对齐到“左边”。

5、添加TGIS_ControlLegend。在对象检查器中将GIS_Viewer设置为“GIS”并将“对齐”设置为“左”。双击图例中的图层调用“可视化属性”对话框。

6、将TGIS_ControlScale和TGIS_ControlNorthArrow添加到GIS(在Structure窗口中,您可以拖放组件以设置层次结构)。在对象检查器中,将“GIS”指定为GIS_Viewer。

最终结果应如下所示:

image4.png

添加代码

设计表单后,转到“代码”选项卡。

在实现部分的{$ R * .fmx}下方添加“使用System.IOUtils,GisLicense,GisTypes,GisAllLayers,GisUtils,GisLayerVector”。

  • System.IOUtils 

    返回用户的主路径或应用程序的可写临时目录或存储,如TPath.GetDocumentsPath。

  • GisLicense 

    包含有关TatukGIS许可证的信息。

  • Mistypes 

    常见的常量和类型,如TGIS_Point。经常被客户端代码频繁使用并包含它几乎是一个要求。

  • GisAllLayers 

    允许使用TatukGIS Samples数据文件夹中的图层。

  • GisUtils 

    GisPoint()等常用方法包含在TGIS_Utils类方法中。经常被客户端代码使用并包含它几乎是一个要求。

GisLayerVector - 包含类似TGIS_Shape、TGIS_LayerVector的类型。

附加事件

接下来将事件附加到组件。要附加事件处理程序,请在“对象检查器”中选择“事件”选项卡,然后双击该事件。如果要调用“OnClick”事件,也可以双击组件。在此示例中,我们使用以下事件:

  • btnaopenclick 

procedure TForm2.btnOpenClick(Sender: TObject);
beginGIS.RotationAngle := 0 ;{$IFDEF WIN32}GIS.Open( TGIS_Utils.GisSamplesDataDir + '/world/worldDCW/world.shp');{$ELSEIF Defined(MACOS) and Defined(IOS)}GIS.Open( TPath.GetDocumentsPath + PathDelim + 'world.shp')  ;{$ELSE ANDROID}GIS.Open( TPath.GetDocumentsPath + PathDelim + 'ne_10m_admin_0_countries.shp')  ;{$ENDIF}
end;
  • btnSelectClick

procedure TForm2.btnSelectClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Select ;
end;
  • btnDragClick 

procedure TForm2.btnDragClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Drag ;
  • btnZoomClick 

procedure TForm2.btnZoomClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Zoom ;
end;
  • GISTapSimpleEvent 

    点击简单事件在所选形状上闪烁,并在状态栏中显示光标的位置。要调用该事件,请使用以下代码:

 procedure TForm2.GISTapSimpleEvent(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Single);
varptg : TGIS_Point ;shp : TGIS_Shape ;
beginif GIS.IsEmpty thenexit ;if GIS.Mode <> TGIS_ViewerMode.Select thenexit ;ptg := GIS.ScreenToMap( Point(Round(X), Round(Y)) ) ;shp := TGIS_Shape( GIS.Locate( ptg, 5 / GIS.Zoom ) ) ;if not Assigned( shp ) then exit ;shp.Flash ;
lblPosition.Text := Format( 'x: %.4f, y: %.4f ', [ptg.X,  ptg.Y] ) ;
end;

将文件添加到部署

在部署中添加文件和设置路径。

使用“项目/部署”菜单项,选择Android和iOS设备平台,并为每个平台添加要与应用程序一起部署的文件,并设置“远程路径”列值:

  • 设置Android的远程路径:assets \ internal \ 

image5.png

  • 设置iOS的远程路径:StartUp \ Documents \ 

如果要同时为几个文件设置远程路径,请单击图标DK11

image7.png

 。

测试

编译并运行项目。

源代码

最终代码应如下所示:

unit Unit2;interfaceusesSystem.SysUtils,
System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types,
FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.GisControlNorthArrow, FMX.GisControlScale, FMX.Layouts, FMX.TreeView,
FMX.GisControlLegend, GisTypesUI, FMX.GisViewerWnd, FMX.Controls.Presentation ;typeTForm2 = class(TForm)ToolBar1: TToolBar;statusBar: TStatusBar;GIS: TGIS_ViewerWnd;GIS_ControlLegend1: TGIS_ControlLegend;GIS_ControlScale1: TGIS_ControlScale;GIS_ControlNorthArrow1: TGIS_ControlNorthArrow;btnOpen: TButton;btnSelect: TButton;btnDrag: TButton;btnZoom: TButton;lblPosition: TLabel;procedure GISTapSimpleEvent(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Single);procedure btnOpenClick(Sender: TObject);procedure btnSelectClick(Sender: TObject);procedure btnDragClick(Sender: TObject);procedure btnZoomClick(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm2: TForm2;implementation{$R *.fmx}uses System.IOUtils, GisLicense, GisTypes, GisAllLayers, GisUtils, GisLayerVector;procedure TForm2.btnDragClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Drag ;
end;procedure TForm2.btnOpenClick(Sender: TObject);
beginGIS.RotationAngle := 0 ;{$IFDEF WIN32}GIS.Open( TGIS_Utils.GisSamplesDataDir + '/world/worldDCW/world.shp' );{$ELSEIF Defined(MACOS) and Defined(IOS)}GIS.Open( TPath.GetDocumentsPath + PathDelim + 'world.shp' )  ;{$ELSE ANDROID}GIS.Open( TPath.GetDocumentsPath + PathDelim + 'ne_10m_admin_0_countries.shp' )  ;{$ENDIF}
end;procedure TForm2.btnSelectClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Select ;
end;procedure TForm2.btnZoomClick(Sender: TObject);
beginGIS.Mode := TGIS_ViewerMode.Zoom ;
end;procedure TForm2.GISTapSimpleEvent(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Single);
varptg : TGIS_Point ;shp : TGIS_Shape ;
beginif GIS.IsEmpty thenexit ;if GIS.Mode <> TGIS_ViewerMode.Select thenexit ;ptg := GIS.ScreenToMap( Point(Round(X), Round(Y) ) ) ;shp := TGIS_Shape( GIS.Locate( ptg, 5/GIS.Zoom ) ) ;if not Assigned( shp ) then exit ;shp.Flash ;lblPosition.Text := Format( 'x: %.4f, y: %.4f', [ptg.X, ptg.Y] ) ;
end;end.
http://www.lryc.cn/news/194849.html

相关文章:

  • Ant Design Vue设置表格滚动 宽度自适应 不换行
  • 在Linux上开启文件服务,需要安装并配置Samba
  • TypeScript 类型兼容性
  • 【多线程】线程的状态
  • pytorch 对图片进行归一化处理
  • 零售数据分析师熬夜整理:人、货、场、供、财这样做
  • 基于SSM的学生选课管理系统
  • SQL注入漏洞
  • C++ wpf自制软件打包安装更新源码实例
  • 8月19日PMP成绩,预计10月16日公布!附查询入口、流程
  • 简易LDO设计(包含原理图、PCB和实验)
  • SpringBoot面试题5:SpringBoot Starter的工作原理是什么?
  • Leetcode 2902. Count of Sub-Multisets With Bounded Sum
  • ARP协议(地址解析协议) 的作用和操作过程
  • 轻游戏风格虚拟资源付费下载模板Discuz论坛模板
  • MongoDB索引操作
  • AMEYA360:君正低功耗AIoT图像识别处理器—X1600/X1600E
  • EM@圆和圆锥曲线的参数方程
  • uniapp 微信小程序 vue3.0+TS手写自定义封装步骤条(setup)
  • Python 金融大数据分析
  • 初识C++入门(1)
  • 使用Selenium的WebDriver进行长截图
  • python+大数据校园卡数据分析 计算机竞赛
  • 【机器学习】sklearn降维算法PCA
  • 华为云云耀云服务器L实例评测|企业项目最佳实践之评测用例(五)
  • Xcode升级到15.0 解决DT_TOOLCHAIN_DIR问题
  • 小谈设计模式(29)—访问者模式
  • 【25】c++设计模式——>责任链模式
  • GlobalTransactional
  • Android Studio运行kotlin项目,一直Read timed out