定制 cowegis/cowegis-contao-draw-widget-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cowegis/cowegis-contao-draw-widget-bundle

Composer 安装命令:

composer require cowegis/cowegis-contao-draw-widget-bundle

包简介

README 文档

README

The Cowegis Draw Widget Bundle provides a custom widget for drawing and managing vector elements within the Contao CMS. It is designed to integrate seamlessly with Contao, offering users an intuitive interface for creating and editing map vector drawings.

Requirements

  • PHP: ^8.2
  • Contao: ^5.3

Installation

To install the Draw Widget Bundle, use Composer. Run the following command in your terminal:

composer require cowegis/cowegis-contao-draw-widget-bundle

Configuration

The widget uses the cowegis-editor HTML element using the awesome geoman.io editor. It's designed to adjust the editor configuration. You can customize the initial map settings and the editor toolbar. The configuration is encoded as JSON, so you are not able to use javascript directly here.

$GLOBALS['TL_DCA']['tl_example']['fields']['vectors'] = [
    'inputType' => 'cowegis_draw',
    'sql'       => 'blob NULL',
    'eval'      => [
        // Height of the widget, defaults to 500px
        'height'  => '500px',
        // Toolbar options, see https://www.geoman.io/docs/toolbar
        // Default:
        'toolbar' => [
            'position' => 'bottomleft',
        ],
        // Leaflet map options, see https://leafletjs.com/reference.html#map-option
        // Default:
        'map' => [
            "maxZoom" => 15,
            "minZoom" => 2,
            "center"  => [0, 0],
            "zoom"    => 2,
        ],
        // Maximum number of vector elements. Toolbar draw buttons get disabled when used.
        'limit' => null
    ]
];

If you need to customize the whole configuration, you may define a callback. See the initial config in \Cowegis\Bundle\ContaoDrawWidget\Widget\DrawWidget::editorOptions()

$GLOBALS['TL_DCA']['tl_example']['fields']['vectors'] = [
    'inputType' => 'cowegis_draw',
    'eval'      => [
        'callback' => function (array $options) {
            var_dump($options);
            
            return $options;
        }
    ]
];

GeoJSON data

GeoJSON does not provide information about circles or circle markers as they are available for Leaflet. To overcome this limitation this widget adds GeoJSON properties type and radius to the geometry.

Circle

The radius for a circle is defined meters, see https://leafletjs.com/reference.html#circle.

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "type": "circle",
    "radius": 100
  }
}

Circle marker

The radius for a circle marker is defined in pixels, see https://leafletjs.com/reference.html#circlemarker.

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "type": "circleMarker",
    "radius": 10
  }
}

统计信息

  • 总下载量: 2.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-09-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固