andregasparin / leafletadianti
Adianti 框架插件
1.0.5
2021-06-15 01:36 UTC
README
为想创建地图而不操作 JavaScript 的人提供的 PHP 函数。
Leaflet.js 链接:https://leaflet.npmjs.net.cn/
安装
要在 Adianti Builder 中安装,请转到“composer packages”选项卡,并添加
andregasparin/leafletadianti
您需要已安装 composer。
打开您的 cmd(提示),使用命令“cd c:/pasta/do/projeto”导航到 adianti 的项目根目录。
执行以下命令(在 Linux 或 Mac 的情况下可能有所不同,例如在开始时使用 sudo)
composer require andregasparin/leafletadianti
使用
在您要使用的地方添加以下行:use AndreGasparin\Leafletadianti\LeafletMap;
然后使用该类并在您想要的任何元素中插入地图,例如
<?php use AndreGasparin\Leafletadianti\LeafletMap; class LeafletPage extends TPage { function __construct() { parent::__construct(); $map = new LeafletMap('51.505','-0.09','13', 'google'); // set initial coordinates $show_map = $map->show(); $content = new TElement('div'); $content->id = 'my-map'; $content->add( $show_map ); parent::add( $content ); } }
使用所有功能的示例
<?php use AndreGasparin\Leafletadianti\LeafletMap; class LeafletPage extends TPage { function __construct() { $points = array(); $points[] = ['lat' => 50.505, 'lng'=> -0.09, 'description']; $points[] = ['lat' => 49.505, 'lng'=> -0.09, 'description49']; $points_json = json_encode($points); parent::__construct(); $map = new LeafletMap('51.505','-0.09','13', 'google'); // set initial coordinates $map->setSize('100%', '400'); //set map size //$map->width = '100%'; //$map->height = '600px'; //$map->myLocation(true); // use gps to show and center my location, use true to display poupup with precision $map->addMarker('51.505', '-0.09', 'teste'); // add point on map $map->addJsonMarker($points_json); $map->center(); //center map to view all points $show_map = $map->show(); //#Version 1.0.1 $map->enableAddOnePoint('allPointsJson'); $map->enableAddPoints('allPointsJson'); //field $allPointsJson = new TEntry('allPointsJson'); $allPointsJson->setSize("100%"); parent::add( $allPointsJson ); //#End Version 1.0.1 //#Version 1.0.2 $map->searchAddress('autocompleteLeaflet'); $map = $map->show(); //create map //field $autocompleteLeaflet = new TCombo('autocompleteLeaflet'); $autocompleteLeaflet->setSize("100%"); parent::add( $autocompleteLeaflet ); //#End Version 1.0.2 $content = new TElement('div'); $content->id = 'testediv'; $content->add( $show_map ); parent::add( $content ); } }
开发配置
如果您想实现系统中的某些功能,请使用 Adianti 框架的标准,我们将很高兴看到您的参与!
需要改进或帮助解决某个 BUG 吗?
历史记录(变更日志)
- 1.0.0
- 创建项目
- 1.0.1
- 添加 enableAddOnePoint(RETORNO) 您可以添加一个只接受 1 个标记的地图,用户可以选择再次点击地图并更改位置。“Retorno”应传递在表单中创建的 TEntry/THidden 字段名称
- 添加 enableAddPoints(RETORNO) 您可以添加一个接受多个标记的地图,用户可以选择再次点击标记来删除它。“Retorno”应传递在表单中创建的 TEntry/THidden 字段名称
- 1.0.2
- 添加 searchAddress(RETORNO, addMarker) 您可以添加一个地理位置搜索,即地址搜索。“Retorno”应传递在表单中创建的 TCombo 字段名称,“addMarker” = true,它将自动在找到的地址处插入一个图钉
- 1.0.3
- 创建 composer 包
- 1.0.4
- 1.0.5
- 修复错误
目标
André Gasparin – [@andre-gasparin] – andre@gasparimsat.com.br / andre.gasparin@hotmail.com
根据 GNU 通用公共许可证(GPLv3)分发
贡献
- 对项目进行 fork(《https://https//github.com/andre-gasparin/leafletadianti/fork》)
- 创建一个 branch 进行修改(《git checkout -b feature/fooBar》)
- 执行 commit(《git commit -am 'Add some fooBar'》)
- Push(《git push origin feature/fooBar》)
- 创建一个新的 Pull Request(《)