Implementing extra markers.

This commit is contained in:
David Molineus
2016-11-13 21:53:08 +01:00
parent 5364c0f15e
commit 9f2d5d94dc
14 changed files with 277 additions and 0 deletions

60
assets/leaflet-extra-markers/.gitignore vendored Normal file
View File

@@ -0,0 +1,60 @@
### General Ignores ###
.idea
*~
### Operating System Ignores ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# OSX
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
###Node###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
# Users Environment Variables
.lock-wscript

View File

@@ -0,0 +1,64 @@
module.exports = function(grunt) {
'use strict';
// require it at the top and pass in the grunt instance
require('time-grunt')(grunt);
/*****************************************************
Grunt Init Config:
load each task config into grunt via require
*****************************************************/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Project Config
project: require('./build/grunt-config/project'), // Contains paths and banner
less: require('./build/grunt-config/less'), // Config to compile and autoprefix less files
uglify: require('./build/grunt-config/uglify'),
jshint: require('./build/grunt-config/jshint'), // Lint Javascript
});
/*****************************************************
Dev Tasks - Compile and check files withing the /src/assets/ directory
*****************************************************/
// Default grunt task compiles & checks dev files
grunt.registerTask('default', [], function(){
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:dev','js-dev');
});
// Javascript Dev Build - Checks for Errors in Javascript
grunt.registerTask('js-dev', [], function(){
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.task.run('jshint:all', 'uglify:dev');
});
/*****************************************************
Dist Tasks
*****************************************************/
// 'grunt build' global build command for both less and js files
grunt.registerTask('build', 'Compiles all files for live environment', function() {
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:build', 'js-build');
});
// 'grunt js-build' compiles only javascript
grunt.registerTask('js-build', [], function(){
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.task.run('jshint:all', 'uglify:build');
});
// 'grunt less-build' compiles only less
grunt.registerTask('less-build', [], function(){
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:build');
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 coryasilva
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,69 @@
# Leaflet.extra-markers plugin v1.0.4
<a href="https://github.com/lvoogdt/Leaflet.awesome-markers">Big Thanks to lvoogdt of Leaflet.awesome-markers</a>
![ExtraMarkers screenshot](https://raw.github.com/coryasilva/Leaflet.ExtraMarkers/master/screenshot.png "Screenshot of ExtraMarkers")
### <a href="http://coryasilva.github.io/Leaflet.ExtraMarkers/" target="_blank">Demo</a>
## Icons
Version 1.0 of Leaflet.extra-markers is designed for:
- [Bootstrap 3 icons](http://twitter.github.com/bootstrap/)
- [Getting Started Guide](http://getbootstrap.com/getting-started/)
- [Font Awesome 4.0](http://fortawesome.github.com/Font-Awesome/)
- [Getting Started Guide](http://fortawesome.github.io/Font-Awesome/get-started/)
- [Semantic UI 0.9.8 icons](http://semantic-ui.com/)
- [Ion Icons 2.0.1](http://ionicons.com/)
- Leaflet 0.5-Latest
## Using the plugin
##### 1. Requirements #####
Follow the [getting started guide](#icons) for the desired font library and make sure its included in your project.
##### 2. Installing Leaflet.extra-markers #####
Next, copy the `dist/img` directory, `/dist/css/leaflet.extra-markers.min.css`, and `/dist/js/leaflet.extra-markers.min.js` to your project and include them:
````xml
<link rel="stylesheet" href="css/leaflet.extra-markers.min.css">
````
or
````less
@import 'bower_components/src/assets/less/Leaflet.extra-markers.less
````
and
````xml
<script src="js/leaflet.extra-markers.min.js"></script>
````
##### 3. Creating a Marker #####
Now use the plugin to create a marker like this:
````js
// Creates a red marker with the coffee icon
var redMarker = L.ExtraMarkers.icon({
icon: 'fa-coffee',
markerColor: 'red',
shape: 'square',
prefix: 'fa'
});
L.marker([51.941196,4.512291], {icon: redMarker,}).addTo(map);
````
---
### Properties
| Property | Description | Default Value | Possible values |
| --------------- | ------------------------------------------- | ------------- | ---------------------------------------------------- |
| extraClasses | Additional classes in the created `<i>` tag | `''` | `fa-rotate90 myclass`; space delimited classes to add |
| icon | Name of the icon **with** prefix | `''` | `fa-coffee` (see icon library's documentation) |
| iconColor | Color of the icon | `'white'` | `'white'`, `'black'` or css code (hex, rgba etc) |
| innerHTML | Custom HTML code | `''` | `<svg>`, images, or other HTML; a truthy assignment will override the default html icon creation behavior |
| markerColor | Color of the marker (css class) | `'blue'` | `'red'`, `'orange-dark'`, `'orange'`, `'yellow'`, `'blue-dark'`, `'cyan'`, `'purple'`, `'violet'`, `'pink'`, `'green-dark'`, `'green'`, `'green-light'`, `'black'`, or `'white'` |
| number | Instead of an icon, define a plain text | `''` | `'1'` or `'A'`, must set `icon: 'fa-number'` |
| prefix | The icon library's base class | `'glyphicon'` | `fa` (see icon library's documentation) |
| shape | Shape of the marker (css class) | `'circle'` | `'circle'`, `'square'`, `'star'`, or `'penta'` |
## License
- Leaflet.ExtraMarkers and colored markers are licensed under the MIT License - http://opensource.org/licenses/mit-license.html.

View File

@@ -0,0 +1,30 @@
{
"name": "Leaflet.extra-markers",
"version": "1.0.6",
"homepage": "https://github.com/coryasilva/Leaflet.ExtraMarkers",
"authors": [
"Cory Silva"
],
"description": "Custom Markers for Leaflet JS based on Awesome Markers",
"main": [
"src/assets/css/leaflet.extra-markers.css",
"src/assets/less/leaflet.extra-markers.less",
"src/assets/js/leaflet.extra-markers.js"
],
"license": "MIT",
"ignore": [
"gh-pages",
".bowerrc",
".gitignore",
".jshintignore",
".jshintrc",
"bower.json",
"gruntfile.js",
"package.json",
"README.md"
],
"dependencies": {
},
"devDependencies": {
}
}

View File

@@ -0,0 +1 @@
.extra-marker{background:url("../img/markers_default.png") no-repeat 0 0;width:35px;height:46px;position:absolute;left:0;top:0;display:block;text-align:center}.extra-marker-shadow{background:url("../img/markers_shadow.png") no-repeat 0 0;width:36px;height:16px}@media (min--moz-device-pixel-ratio:1.5),(-webkit-min-device-pixel-ratio:1.5),(min-device-pixel-ratio:1.5),(min-resolution:1.5dppx){.extra-marker{background-image:url("../img/markers_default@2x.png");background-size:540px 184px}.extra-marker-shadow{background-image:url("../img/markers_shadow@2x.png");background-size:35px 16px}}.extra-marker i{color:#fff;margin-top:10px;display:inline-block;font-size:14px}.extra-marker i.icon{margin-right:0;opacity:1}.extra-marker-circle-red{background-position:0 0}.extra-marker-circle-orange-dark{background-position:-36px 0}.extra-marker-circle-orange{background-position:-72px 0}.extra-marker-circle-yellow{background-position:-108px 0}.extra-marker-circle-blue-dark{background-position:-144px 0}.extra-marker-circle-blue{background-position:-180px 0}.extra-marker-circle-cyan{background-position:-216px 0}.extra-marker-circle-purple{background-position:-252px 0}.extra-marker-circle-violet{background-position:-288px 0}.extra-marker-circle-pink{background-position:-324px 0}.extra-marker-circle-green-dark{background-position:-360px 0}.extra-marker-circle-green{background-position:-396px 0}.extra-marker-circle-green-light{background-position:-432px 0}.extra-marker-circle-black{background-position:-468px 0}.extra-marker-circle-white{background-position:-504px 0}.extra-marker-square-red{background-position:0 -46px}.extra-marker-square-orange-dark{background-position:-36px -46px}.extra-marker-square-orange{background-position:-72px -46px}.extra-marker-square-yellow{background-position:-108px -46px}.extra-marker-square-blue-dark{background-position:-144px -46px}.extra-marker-square-blue{background-position:-180px -46px}.extra-marker-square-cyan{background-position:-216px -46px}.extra-marker-square-purple{background-position:-252px -46px}.extra-marker-square-violet{background-position:-288px -46px}.extra-marker-square-pink{background-position:-324px -46px}.extra-marker-square-green-dark{background-position:-360px -46px}.extra-marker-square-green{background-position:-396px -46px}.extra-marker-square-green-light{background-position:-432px -46px}.extra-marker-square-black{background-position:-468px -46px}.extra-marker-square-white{background-position:-504px -46px}.extra-marker-star-red{background-position:0 -92px}.extra-marker-star-orange-dark{background-position:-36px -92px}.extra-marker-star-orange{background-position:-72px -92px}.extra-marker-star-yellow{background-position:-108px -92px}.extra-marker-star-blue-dark{background-position:-144px -92px}.extra-marker-star-blue{background-position:-180px -92px}.extra-marker-star-cyan{background-position:-216px -92px}.extra-marker-star-purple{background-position:-252px -92px}.extra-marker-star-violet{background-position:-288px -92px}.extra-marker-star-pink{background-position:-324px -92px}.extra-marker-star-green-dark{background-position:-360px -92px}.extra-marker-star-green{background-position:-396px -92px}.extra-marker-star-green-light{background-position:-432px -92px}.extra-marker-star-black{background-position:-468px -92px}.extra-marker-star-white{background-position:-504px -92px}.extra-marker-penta-red{background-position:0 -138px}.extra-marker-penta-orange-dark{background-position:-36px -138px}.extra-marker-penta-orange{background-position:-72px -138px}.extra-marker-penta-yellow{background-position:-108px -138px}.extra-marker-penta-blue-dark{background-position:-144px -138px}.extra-marker-penta-blue{background-position:-180px -138px}.extra-marker-penta-cyan{background-position:-216px -138px}.extra-marker-penta-purple{background-position:-252px -138px}.extra-marker-penta-violet{background-position:-288px -138px}.extra-marker-penta-pink{background-position:-324px -138px}.extra-marker-penta-green-dark{background-position:-360px -138px}.extra-marker-penta-green{background-position:-396px -138px}.extra-marker-penta-green-light{background-position:-432px -138px}.extra-marker-penta-black{background-position:-468px -138px}.extra-marker-penta-white{background-position:-504px -138px}.extra-marker .fa-number:before{content:attr(number)}

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1 @@
!function(a,b){"use strict";L.ExtraMarkers={},L.ExtraMarkers.version="1.0.1",L.ExtraMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"extra-marker",prefix:"",extraClasses:"",shape:"circle",icon:"",innerHTML:"",markerColor:"red",iconColor:"#fff",number:""},initialize:function(a){a=L.Util.setOptions(this,a)},createIcon:function(){var a=b.createElement("div"),c=this.options;return c.icon&&(a.innerHTML=this._createInner()),c.innerHTML&&(a.innerHTML=c.innerHTML),c.bgPos&&(a.style.backgroundPosition=-c.bgPos.x+"px "+-c.bgPos.y+"px"),this._setIconStyles(a,c.shape+"-"+c.markerColor),a},_createInner:function(){var a="",b="",c=this.options;return c.iconColor&&(a="style='color: "+c.iconColor+"' "),c.number&&(b="number='"+c.number+"' "),"<i "+b+a+"class='"+c.extraClasses+" "+c.prefix+" "+c.icon+"'></i>"},_setIconStyles:function(a,b){var c,d,e=this.options,f=L.point(e["shadow"===b?"shadowSize":"iconSize"]);"shadow"===b?(c=L.point(e.shadowAnchor||e.iconAnchor),d="shadow"):(c=L.point(e.iconAnchor),d="icon"),!c&&f&&(c=f.divideBy(2,!0)),a.className="leaflet-marker-"+d+" extra-marker-"+b+" "+e.className,c&&(a.style.marginLeft=-c.x+"px",a.style.marginTop=-c.y+"px"),f&&(a.style.width=f.x+"px",a.style.height=f.y+"px")},createShadow:function(){var a=b.createElement("div");return this._setIconStyles(a,"shadow"),a}}),L.ExtraMarkers.icon=function(a){return new L.ExtraMarkers.Icon(a)}}(window,document);

View File

@@ -0,0 +1,21 @@
{
"name": "Leaflet.extra-markers",
"title": "Leaflet ExtraMarkers",
"url": "https://github.com/coryasilva/Leaflet.ExtraMarkers/",
"version": "1.0.6",
"description": "Custom Markers for Leaflet JS based on Awesome Markers",
"author": "coryasilva <https://github.com/coryasilva>",
"repository": {
"type": "git",
"url": "https://github.com/coryasilva/Leaflet.ExtraMarkers"
},
"main": "src/assets/js/leaflet.extra-markers.js",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.8.0",
"grunt-contrib-less": "^1.1.0",
"less-plugin-autoprefix": "^1.5.1",
"time-grunt": "^1.1.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -82,6 +82,16 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
'javascript' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-extra-markers'] = array
(
'name' => 'Leaflet Extra Markers',
'version' => '1.0.6',
'license' => '<a href="https://github.com/coryasilva/Leaflet.ExtraMarkers/blob/master/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/coryasilva/Leaflet.ExtraMarkers',
'css' => 'assets/leaflet/libs/control-extra-marker/leaflet.extra-markers.min.css',
'javascript' => 'assets/leaflet/libs/control-extra-marker/leaflet.extra-markers.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['osmtogeojson'] = array
(
'name' => 'osmtogeojson',