version 4.8.17 -- カレンダーで今日以降しか選べないようにした

This commit is contained in:
hayano
2024-08-09 23:49:36 +00:00
parent 3d195973fc
commit 95b787c819
255 changed files with 59200 additions and 53 deletions

View File

@ -0,0 +1,30 @@
.leaflet-control-minimap {
border:solid rgba(255, 255, 255, 1.0) 4px;
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 3px;
background: #f8f8f9;
transition: all .2s;
}
.leaflet-control-minimap a {
background-color: rgba(255, 255, 255, 1.0);
background-repeat: no-repeat;
z-index: 99999;
transition: all .2s;
border-radius: 3px 0px 0px 0px;
}
.leaflet-control-minimap a.minimized {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
border-radius: 0px;
}
.leaflet-control-minimap-toggle-display {
background-image: url("images/toggle.png");
height: 19px;
width: 19px;
position: absolute;
bottom: 0;
right: 0;
}

View File

@ -0,0 +1,270 @@
L.Control.MiniMap = L.Control.extend({
options: {
position: 'bottomright',
toggleDisplay: false,
zoomLevelOffset: -5,
zoomLevelFixed: false,
zoomAnimation: false,
autoToggleDisplay: false,
width: 150,
height: 150,
aimingRectOptions: {color: "#ff7800", weight: 1, clickable: false},
shadowRectOptions: {color: "#000000", weight: 1, clickable: false, opacity:0, fillOpacity:0}
},
hideText: 'Hide MiniMap',
showText: 'Show MiniMap',
//layer is the map layer to be shown in the minimap
initialize: function (layer, options) {
L.Util.setOptions(this, options);
//Make sure the aiming rects are non-clickable even if the user tries to set them clickable (most likely by forgetting to specify them false)
this.options.aimingRectOptions.clickable = false;
this.options.shadowRectOptions.clickable = false;
this._layer = layer;
},
onAdd: function (map) {
this._mainMap = map;
//Creating the container and stopping events from spilling through to the main map.
this._container = L.DomUtil.create('div', 'leaflet-control-minimap');
this._container.style.width = this.options.width + 'px';
this._container.style.height = this.options.height + 'px';
L.DomEvent.disableClickPropagation(this._container);
L.DomEvent.on(this._container, 'mousewheel', L.DomEvent.stopPropagation);
this._miniMap = new L.Map(this._container,
{
attributionControl: false,
zoomControl: false,
zoomAnimation: this.options.zoomAnimation,
autoToggleDisplay: this.options.autoToggleDisplay,
touchZoom: !this.options.zoomLevelFixed,
scrollWheelZoom: !this.options.zoomLevelFixed,
doubleClickZoom: !this.options.zoomLevelFixed,
boxZoom: !this.options.zoomLevelFixed,
crs: map.options.crs
});
this._miniMap.addLayer(this._layer);
//These bools are used to prevent infinite loops of the two maps notifying each other that they've moved.
this._mainMapMoving = false;
this._miniMapMoving = false;
//Keep a record of this to prevent auto toggling when the user explicitly doesn't want it.
this._userToggledDisplay = false;
this._minimized = false;
if (this.options.toggleDisplay) {
this._addToggleButton();
}
this._miniMap.whenReady(L.Util.bind(function () {
this._aimingRect = L.rectangle(this._mainMap.getBounds(), this.options.aimingRectOptions).addTo(this._miniMap);
this._shadowRect = L.rectangle(this._mainMap.getBounds(), this.options.shadowRectOptions).addTo(this._miniMap);
this._mainMap.on('moveend', this._onMainMapMoved, this);
this._mainMap.on('move', this._onMainMapMoving, this);
this._miniMap.on('movestart', this._onMiniMapMoveStarted, this);
this._miniMap.on('move', this._onMiniMapMoving, this);
this._miniMap.on('moveend', this._onMiniMapMoved, this);
}, this));
return this._container;
},
addTo: function (map) {
L.Control.prototype.addTo.call(this, map);
this._miniMap.setView(this._mainMap.getCenter(), this._decideZoom(true));
this._setDisplay(this._decideMinimized());
return this;
},
onRemove: function (map) {
this._mainMap.off('moveend', this._onMainMapMoved, this);
this._mainMap.off('move', this._onMainMapMoving, this);
this._miniMap.off('moveend', this._onMiniMapMoved, this);
this._miniMap.removeLayer(this._layer);
},
_addToggleButton: function () {
this._toggleDisplayButton = this.options.toggleDisplay ? this._createButton(
'', this.hideText, 'leaflet-control-minimap-toggle-display', this._container, this._toggleDisplayButtonClicked, this) : undefined;
},
_createButton: function (html, title, className, container, fn, context) {
var link = L.DomUtil.create('a', className, container);
link.innerHTML = html;
link.href = '#';
link.title = title;
var stop = L.DomEvent.stopPropagation;
L.DomEvent
.on(link, 'click', stop)
.on(link, 'mousedown', stop)
.on(link, 'dblclick', stop)
.on(link, 'click', L.DomEvent.preventDefault)
.on(link, 'click', fn, context);
return link;
},
_toggleDisplayButtonClicked: function () {
this._userToggledDisplay = true;
if (!this._minimized) {
this._minimize();
this._toggleDisplayButton.title = this.showText;
}
else {
this._restore();
this._toggleDisplayButton.title = this.hideText;
}
},
_setDisplay: function (minimize) {
if (minimize != this._minimized) {
if (!this._minimized) {
this._minimize();
}
else {
this._restore();
}
}
},
_minimize: function () {
// hide the minimap
if (this.options.toggleDisplay) {
this._container.style.width = '19px';
this._container.style.height = '19px';
this._toggleDisplayButton.className += ' minimized';
}
else {
this._container.style.display = 'none';
}
this._minimized = true;
},
_restore: function () {
if (this.options.toggleDisplay) {
this._container.style.width = this.options.width + 'px';
this._container.style.height = this.options.height + 'px';
this._toggleDisplayButton.className = this._toggleDisplayButton.className
.replace(/(?:^|\s)minimized(?!\S)/g, '');
}
else {
this._container.style.display = 'block';
}
this._minimized = false;
},
_onMainMapMoved: function (e) {
if (!this._miniMapMoving) {
this._mainMapMoving = true;
this._miniMap.setView(this._mainMap.getCenter(), this._decideZoom(true));
this._setDisplay(this._decideMinimized());
} else {
this._miniMapMoving = false;
}
this._aimingRect.setBounds(this._mainMap.getBounds());
},
_onMainMapMoving: function (e) {
this._aimingRect.setBounds(this._mainMap.getBounds());
},
_onMiniMapMoveStarted:function (e) {
var lastAimingRect = this._aimingRect.getBounds();
var sw = this._miniMap.latLngToContainerPoint(lastAimingRect.getSouthWest());
var ne = this._miniMap.latLngToContainerPoint(lastAimingRect.getNorthEast());
this._lastAimingRectPosition = {sw:sw,ne:ne};
},
_onMiniMapMoving: function (e) {
if (!this._mainMapMoving && this._lastAimingRectPosition) {
this._shadowRect.setBounds(new L.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw),this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne)));
this._shadowRect.setStyle({opacity:1,fillOpacity:0.3});
}
},
_onMiniMapMoved: function (e) {
if (!this._mainMapMoving) {
this._miniMapMoving = true;
this._mainMap.setView(this._miniMap.getCenter(), this._decideZoom(false));
this._shadowRect.setStyle({opacity:0,fillOpacity:0});
} else {
this._mainMapMoving = false;
}
},
_decideZoom: function (fromMaintoMini) {
if (!this.options.zoomLevelFixed) {
if (fromMaintoMini)
return this._mainMap.getZoom() + this.options.zoomLevelOffset;
else {
var currentDiff = this._miniMap.getZoom() - this._mainMap.getZoom();
var proposedZoom = this._miniMap.getZoom() - this.options.zoomLevelOffset;
var toRet;
if (currentDiff > this.options.zoomLevelOffset && this._mainMap.getZoom() < this._miniMap.getMinZoom() - this.options.zoomLevelOffset) {
//This means the miniMap is zoomed out to the minimum zoom level and can't zoom any more.
if (this._miniMap.getZoom() > this._lastMiniMapZoom) {
//This means the user is trying to zoom in by using the minimap, zoom the main map.
toRet = this._mainMap.getZoom() + 1;
//Also we cheat and zoom the minimap out again to keep it visually consistent.
this._miniMap.setZoom(this._miniMap.getZoom() -1);
} else {
//Either the user is trying to zoom out past the mini map's min zoom or has just panned using it, we can't tell the difference.
//Therefore, we ignore it!
toRet = this._mainMap.getZoom();
}
} else {
//This is what happens in the majority of cases, and always if you configure the min levels + offset in a sane fashion.
toRet = proposedZoom;
}
this._lastMiniMapZoom = this._miniMap.getZoom();
return toRet;
}
} else {
if (fromMaintoMini)
return this.options.zoomLevelFixed;
else
return this._mainMap.getZoom();
}
},
_decideMinimized: function () {
if (this._userToggledDisplay) {
return this._minimized;
}
if (this.options.autoToggleDisplay) {
if (this._mainMap.getBounds().contains(this._miniMap.getBounds())) {
return true;
}
return false;
}
return this._minimized;
}
});
L.Map.mergeOptions({
miniMapControl: false
});
L.Map.addInitHook(function () {
if (this.options.miniMapControl) {
this.miniMapControl = (new L.Control.MiniMap()).addTo(this);
}
});
L.control.minimap = function (options) {
return new L.Control.MiniMap(options);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 600 60"
height="60"
width="600"
id="svg4225"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="spritesheet.svg"
inkscape:export-filename="/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<metadata
id="metadata4258">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4256" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview4254"
showgrid="false"
inkscape:zoom="1.3101852"
inkscape:cx="237.56928"
inkscape:cy="7.2419621"
inkscape:window-x="1920"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg4225" />
<g
id="enabled"
style="fill:#464646;fill-opacity:1">
<g
id="polyline"
style="fill:#464646;fill-opacity:1">
<path
d="m 18,36 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
id="path4229"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 36,18 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
id="path4231"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 23.142,39.145 -2.285,-2.29 16,-15.998 2.285,2.285 z"
id="path4233"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
<path
id="polygon"
d="M 100,24.565 97.904,39.395 83.07,42 76,28.773 86.463,18 Z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="rectangle"
d="m 140,20 20,0 0,20 -20,0 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="circle"
d="m 221,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
id="marker"
d="m 270,19 c -4.971,0 -9,4.029 -9,9 0,4.971 5.001,12 9,14 4.001,-2 9,-9.029 9,-14 0,-4.971 -4.029,-9 -9,-9 z m 0,12.5 c -2.484,0 -4.5,-2.014 -4.5,-4.5 0,-2.484 2.016,-4.5 4.5,-4.5 2.485,0 4.5,2.016 4.5,4.5 0,2.486 -2.015,4.5 -4.5,4.5 z"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<g
id="edit"
style="fill:#464646;fill-opacity:1">
<path
d="m 337,30.156 0,0.407 0,5.604 c 0,1.658 -1.344,3 -3,3 l -10,0 c -1.655,0 -3,-1.342 -3,-3 l 0,-10 c 0,-1.657 1.345,-3 3,-3 l 6.345,0 3.19,-3.17 -9.535,0 c -3.313,0 -6,2.687 -6,6 l 0,10 c 0,3.313 2.687,6 6,6 l 10,0 c 3.314,0 6,-2.687 6,-6 l 0,-8.809 -3,2.968"
id="path4240"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 338.72,24.637 -8.892,8.892 -2.828,0 0,-2.829 8.89,-8.89 z"
id="path4242"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 338.697,17.826 4,0 0,4 -4,0 z"
transform="matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)"
id="path4244"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
<g
id="remove"
style="fill:#464646;fill-opacity:1">
<path
d="m 381,42 18,0 0,-18 -18,0 0,18 z m 14,-16 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z"
id="path4247"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
<path
d="m 395,20 0,-4 -10,0 0,4 -6,0 0,2 22,0 0,-2 -6,0 z m -2,0 -6,0 0,-2 6,0 0,2 z"
id="path4249"
inkscape:connector-curvature="0"
style="fill:#464646;fill-opacity:1" />
</g>
</g>
<g
id="disabled"
transform="translate(120,0)"
style="fill:#bbbbbb">
<use
xlink:href="#edit"
id="edit-disabled"
x="0"
y="0"
width="100%"
height="100%" />
<use
xlink:href="#remove"
id="remove-disabled"
x="0"
y="0"
width="100%"
height="100%" />
</g>
<path
style="fill:none;stroke:#464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle-3"
d="m 581.65725,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,325 @@
/* ================================================================== */
/* Toolbars
/* ================================================================== */
.leaflet-draw-section {
position: relative;
}
.leaflet-draw-toolbar {
margin-top: 12px;
}
.leaflet-draw-toolbar-top {
margin-top: 0;
}
.leaflet-draw-toolbar-notop a:first-child {
border-top-right-radius: 0;
}
.leaflet-draw-toolbar-nobottom a:last-child {
border-bottom-right-radius: 0;
}
.leaflet-draw-toolbar a {
background-image: url('images/spritesheet.png');
background-image: linear-gradient(transparent, transparent), url('images/spritesheet.svg');
background-repeat: no-repeat;
background-size: 300px 30px;
background-clip: padding-box;
}
.leaflet-retina .leaflet-draw-toolbar a {
background-image: url('images/spritesheet-2x.png');
background-image: linear-gradient(transparent, transparent), url('images/spritesheet.svg');
}
.leaflet-draw a {
display: block;
text-align: center;
text-decoration: none;
}
.leaflet-draw a .sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
/* ================================================================== */
/* Toolbar actions menu
/* ================================================================== */
.leaflet-draw-actions {
display: none;
list-style: none;
margin: 0;
padding: 0;
position: absolute;
left: 26px; /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */
top: 0;
white-space: nowrap;
}
.leaflet-touch .leaflet-draw-actions {
left: 32px;
}
.leaflet-right .leaflet-draw-actions {
right: 26px;
left: auto;
}
.leaflet-touch .leaflet-right .leaflet-draw-actions {
right: 32px;
left: auto;
}
.leaflet-draw-actions li {
display: inline-block;
}
.leaflet-draw-actions li:first-child a {
border-left: none;
}
.leaflet-draw-actions li:last-child a {
-webkit-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
}
.leaflet-right .leaflet-draw-actions li:last-child a {
-webkit-border-radius: 0;
border-radius: 0;
}
.leaflet-right .leaflet-draw-actions li:first-child a {
-webkit-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}
.leaflet-draw-actions a {
background-color: #919187;
border-left: 1px solid #AAA;
color: #FFF;
font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif;
line-height: 28px;
text-decoration: none;
padding-left: 10px;
padding-right: 10px;
height: 28px;
}
.leaflet-touch .leaflet-draw-actions a {
font-size: 12px;
line-height: 30px;
height: 30px;
}
.leaflet-draw-actions-bottom {
margin-top: 0;
}
.leaflet-draw-actions-top {
margin-top: 1px;
}
.leaflet-draw-actions-top a,
.leaflet-draw-actions-bottom a {
height: 27px;
line-height: 27px;
}
.leaflet-draw-actions a:hover {
background-color: #A0A098;
}
.leaflet-draw-actions-top.leaflet-draw-actions-bottom a {
height: 26px;
line-height: 26px;
}
/* ================================================================== */
/* Draw toolbar
/* ================================================================== */
.leaflet-draw-toolbar .leaflet-draw-draw-polyline {
background-position: -2px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline {
background-position: 0 -1px;
}
.leaflet-draw-toolbar .leaflet-draw-draw-polygon {
background-position: -31px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon {
background-position: -29px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-draw-rectangle {
background-position: -62px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle {
background-position: -60px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-draw-circle {
background-position: -92px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle {
background-position: -90px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-draw-marker {
background-position: -122px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker {
background-position: -120px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker {
background-position: -273px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker {
background-position: -271px -1px;
}
/* ================================================================== */
/* Edit toolbar
/* ================================================================== */
.leaflet-draw-toolbar .leaflet-draw-edit-edit {
background-position: -152px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit {
background-position: -150px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-edit-remove {
background-position: -182px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove {
background-position: -180px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled {
background-position: -212px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled {
background-position: -210px -1px;
}
.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled {
background-position: -242px -2px;
}
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled {
background-position: -240px -2px;
}
/* ================================================================== */
/* Drawing styles
/* ================================================================== */
.leaflet-mouse-marker {
background-color: #fff;
cursor: crosshair;
}
.leaflet-draw-tooltip {
background: rgb(54, 54, 54);
background: rgba(0, 0, 0, 0.5);
border: 1px solid transparent;
-webkit-border-radius: 4px;
border-radius: 4px;
color: #fff;
font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif;
margin-left: 20px;
margin-top: -21px;
padding: 4px 8px;
position: absolute;
visibility: hidden;
white-space: nowrap;
z-index: 6;
}
.leaflet-draw-tooltip:before {
border-right: 6px solid black;
border-right-color: rgba(0, 0, 0, 0.5);
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
content: "";
position: absolute;
top: 7px;
left: -7px;
}
.leaflet-error-draw-tooltip {
background-color: #F2DEDE;
border: 1px solid #E6B6BD;
color: #B94A48;
}
.leaflet-error-draw-tooltip:before {
border-right-color: #E6B6BD;
}
.leaflet-draw-tooltip-single {
margin-top: -12px
}
.leaflet-draw-tooltip-subtext {
color: #f8d5e4;
}
.leaflet-draw-guide-dash {
font-size: 1%;
opacity: 0.6;
position: absolute;
width: 5px;
height: 5px;
}
/* ================================================================== */
/* Edit styles
/* ================================================================== */
.leaflet-edit-marker-selected {
background-color: rgba(254, 87, 161, 0.1);
border: 4px dashed rgba(254, 87, 161, 0.6);
-webkit-border-radius: 4px;
border-radius: 4px;
box-sizing: content-box;
}
.leaflet-edit-move {
cursor: move;
}
.leaflet-edit-resize {
cursor: pointer;
}
/* ================================================================== */
/* Old IE styles
/* ================================================================== */
.leaflet-oldie .leaflet-draw-toolbar {
border: 1px solid #999;
}

4774
static/leaflet/draw/leaflet.draw-src.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

10
static/leaflet/draw/leaflet.draw.css vendored Normal file
View File

@ -0,0 +1,10 @@
.leaflet-draw-section{position:relative}.leaflet-draw-toolbar{margin-top:12px}.leaflet-draw-toolbar-top{margin-top:0}.leaflet-draw-toolbar-notop a:first-child{border-top-right-radius:0}.leaflet-draw-toolbar-nobottom a:last-child{border-bottom-right-radius:0}.leaflet-draw-toolbar a{background-image:url('images/spritesheet.png');background-image:linear-gradient(transparent,transparent),url('images/spritesheet.svg');background-repeat:no-repeat;background-size:300px 30px;background-clip:padding-box}.leaflet-retina .leaflet-draw-toolbar a{background-image:url('images/spritesheet-2x.png');background-image:linear-gradient(transparent,transparent),url('images/spritesheet.svg')}
.leaflet-draw a{display:block;text-align:center;text-decoration:none}.leaflet-draw a .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.leaflet-draw-actions{display:none;list-style:none;margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap}.leaflet-touch .leaflet-draw-actions{left:32px}.leaflet-right .leaflet-draw-actions{right:26px;left:auto}.leaflet-touch .leaflet-right .leaflet-draw-actions{right:32px;left:auto}.leaflet-draw-actions li{display:inline-block}
.leaflet-draw-actions li:first-child a{border-left:0}.leaflet-draw-actions li:last-child a{-webkit-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.leaflet-right .leaflet-draw-actions li:last-child a{-webkit-border-radius:0;border-radius:0}.leaflet-right .leaflet-draw-actions li:first-child a{-webkit-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.leaflet-draw-actions a{background-color:#919187;border-left:1px solid #AAA;color:#FFF;font:11px/19px "Helvetica Neue",Arial,Helvetica,sans-serif;line-height:28px;text-decoration:none;padding-left:10px;padding-right:10px;height:28px}
.leaflet-touch .leaflet-draw-actions a{font-size:12px;line-height:30px;height:30px}.leaflet-draw-actions-bottom{margin-top:0}.leaflet-draw-actions-top{margin-top:1px}.leaflet-draw-actions-top a,.leaflet-draw-actions-bottom a{height:27px;line-height:27px}.leaflet-draw-actions a:hover{background-color:#a0a098}.leaflet-draw-actions-top.leaflet-draw-actions-bottom a{height:26px;line-height:26px}.leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:-2px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:0 -1px}
.leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-31px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-29px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-62px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-60px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-92px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-90px -1px}
.leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-122px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-120px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-273px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-271px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-152px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-150px -1px}
.leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-182px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-180px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-212px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-210px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-242px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-240px -2px}
.leaflet-mouse-marker{background-color:#fff;cursor:crosshair}.leaflet-draw-tooltip{background:#363636;background:rgba(0,0,0,0.5);border:1px solid transparent;-webkit-border-radius:4px;border-radius:4px;color:#fff;font:12px/18px "Helvetica Neue",Arial,Helvetica,sans-serif;margin-left:20px;margin-top:-21px;padding:4px 8px;position:absolute;visibility:hidden;white-space:nowrap;z-index:6}.leaflet-draw-tooltip:before{border-right:6px solid black;border-right-color:rgba(0,0,0,0.5);border-top:6px solid transparent;border-bottom:6px solid transparent;content:"";position:absolute;top:7px;left:-7px}
.leaflet-error-draw-tooltip{background-color:#f2dede;border:1px solid #e6b6bd;color:#b94a48}.leaflet-error-draw-tooltip:before{border-right-color:#e6b6bd}.leaflet-draw-tooltip-single{margin-top:-12px}.leaflet-draw-tooltip-subtext{color:#f8d5e4}.leaflet-draw-guide-dash{font-size:1%;opacity:.6;position:absolute;width:5px;height:5px}.leaflet-edit-marker-selected{background-color:rgba(254,87,161,0.1);border:4px dashed rgba(254,87,161,0.6);-webkit-border-radius:4px;border-radius:4px;box-sizing:content-box}
.leaflet-edit-move{cursor:move}.leaflet-edit-resize{cursor:pointer}.leaflet-oldie .leaflet-draw-toolbar{border:1px solid #999}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

14062
static/leaflet/leaflet-src.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

640
static/leaflet/leaflet.css Normal file
View File

@ -0,0 +1,640 @@
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-tile {
will-change: opacity;
}
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path {
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
-ms-zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-clickable {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}

View File

@ -0,0 +1,256 @@
L.Control.ResetView = L.Control.extend({
statics: {
ICON: 'url(images/reset-view.png)',
TITLE: "Reset view"
},
options: {
position: 'topleft'
},
initialize: function (bounds, options) {
// Accept function as argument to bounds
this.getBounds = typeof(bounds) == 'function' ? bounds :
function () {
return bounds;
};
L.Util.setOptions(this, options);
},
onAdd: function (map) {
if (map.resetviewControl) {
map.removeControl(map.resetviewControl);
}
map.resetviewControl = this;
var container = L.DomUtil.create('div', 'leaflet-control-zoom leaflet-bar');
var link = L.DomUtil.create('a', 'leaflet-control-zoom-out leaflet-bar-part', container);
link.href = '#';
link.title = L.Control.ResetView.TITLE;
link.style.backgroundImage = L.Control.ResetView.ICON;
L.DomEvent.addListener(link, 'click', L.DomEvent.stopPropagation)
.addListener(link, 'click', L.DomEvent.preventDefault)
.addListener(link, 'click', L.Util.bind(function () {
map.fitBounds(this.getBounds());
}, this));
return container;
}
});
L.Map.DjangoMap = L.Map.extend({
initialize: function (id, options) {
// Merge compatible options
// (can be undefined)
var djoptions = options.djoptions;
options.zoom = djoptions.zoom;
options.center = djoptions.center;
if (!isNaN(parseInt(djoptions.minzoom, 10)))
options.minZoom = djoptions.minzoom;
if (!isNaN(parseInt(djoptions.maxzoom, 10)))
options.maxZoom = djoptions.maxzoom;
// Translate to native options
options = L.Util.extend(options,
this._projectionOptions(djoptions));
if (djoptions.extent) {
options.maxBounds = djoptions.extent;
}
L.Map.prototype.initialize.call(this, id, options);
this._djAddLayers();
this._djSetupControls();
if (djoptions.fitextent && djoptions.extent && !(djoptions.center || djoptions.zoom)) {
this.fitBounds(options.maxBounds);
}
},
_projectionOptions: function (djoptions) {
if (!djoptions.srid)
return {};
var projopts = {};
var bbox = djoptions.tilesextent,
maxResolution = computeMaxResolution(bbox);
// See https://github.com/ajashton/TileCache/blob/master/tilecache/TileCache/Layer.py#L197
var resolutions = [];
for (var z = 0; z < 20; z++) {
resolutions.push(maxResolution / Math.pow(2, z));
}
if (L.CRS['EPSG' + djoptions.srid] !== undefined) {
var crs = L.CRS['EPSG' + djoptions.srid];
} else {
var crs = new L.Proj.CRS('EPSG:' + djoptions.srid,
proj4.defs['EPSG:' + djoptions.srid],
{
origin: [bbox[0], bbox[3]],
resolutions: resolutions
}
);
}
return {
crs: crs,
scale: crs.scale,
continuousWorld: true
};
function computeMaxResolution(bbox) {
// See https://github.com/ajashton/TileCache/blob/master/tilecache/TileCache/Layer.py#L185-L196
var size = 256,
width = bbox[2] - bbox[0],
height = bbox[3] - bbox[1];
var aspect = Math.floor(Math.max(width, height) / Math.min(width, height) + 0.5);
return Math.max(width, height) / (size * aspect);
}
},
_djAddLayers: function () {
var layers = this.options.djoptions.layers;
var overlays = this.options.djoptions.overlays || [];
var continuousWorld = this.options.continuousWorld;
if (!layers || !layers.length) {
// No layers, we're done (ignoring overlays)
return;
}
if (layers.length == 1 && overlays.length == 0) {
var layer = l2d(layers[0]);
// Make the only layer match the map max/min_zoom
layer.options = L.Util.extend(layer.options, {
minZoom: this.options.minZoom,
maxZoom: this.options.maxZoom
});
L.tileLayer(layer.url, layer.options).addTo(this);
return;
}
this.layerscontrol = L.control.layers().addTo(this);
for (var i = 0, n = layers.length; i < n; i++) {
var layer = l2d(layers[i]),
l = L.tileLayer(layer.url, layer.options);
this.layerscontrol.addBaseLayer(l, layer.name);
// Show first one as default
if (i === 0) l.addTo(this);
}
for (var i = 0, n = overlays.length; i < n; i++) {
var layer = l2d(overlays[i]),
l = L.tileLayer(layer.url, layer.options);
this.layerscontrol.addOverlay(l, layer.name);
}
function l2d(l) {
var options = {'continuousWorld': continuousWorld};
if (typeof l[2] === 'string') {
// remain compatible with django-leaflet <= 0.15.0
options = L.Util.extend(options, {'attribution': l[2]});
} else {
options = L.Util.extend(options, l[2]);
}
return {name: l[0], url: l[1], options: options};
}
},
_djSetupControls: function () {
// Attribution prefix ?
if (this.attributionControl &&
this.options.djoptions.attributionprefix !== null) {
this.attributionControl.setPrefix(this.options.djoptions.attributionprefix);
}
// Scale control ?
if (this.options.djoptions.scale) {
this.whenReady(function () {
var scale_opt = this.options.djoptions.scale;
var show_imperial = /both|imperial/.test(scale_opt);
var show_metric = /both|metric/.test(scale_opt);
new L.Control.Scale({imperial: show_imperial, metric: show_metric}).addTo(this);
}, this);
}
// Minimap control ?
if (this.options.djoptions.minimap) {
for (var firstLayer in this._layers) break;
var url = this._layers[firstLayer]._url;
var layer = L.tileLayer(url);
this.minimapcontrol = null;
this.whenReady(function () {
this.minimapcontrol = new L.Control.MiniMap(layer,
{toggleDisplay: true}).addTo(this);
}, this);
}
// ResetView control ?
if (this.options.djoptions.resetview) {
var bounds = this.options.djoptions.extent;
if (bounds) {
// Add reset view control
this.whenReady(function () {
new L.Control.ResetView(bounds).addTo(this);
}, this);
}
}
}
});
L.Map.djangoMap = function (id, options) {
var container = L.DomUtil.get(id);
if (container._leaflet) // Already initialized
return;
var map = new L.Map.DjangoMap(id, options);
if (options.globals) {
// Register document maps, like window.forms :)
window.maps = window.maps || [];
window.maps.push(map);
}
if (options.callback === null) {
/*
* Deprecate django-leaflet < 0.7 default callback
*/
var defaultcb = window[id + 'Init'];
if (typeof(defaultcb) == 'function') {
options.callback = defaultcb;
if (console) console.warn('DEPRECATED: Use of default callback ' + defaultcb.name + '() is deprecated (see documentation).');
}
}
/*
* Trigger custom map:init Event
*/
triggerEvent(window, 'map:init', {id: id, map: map, options: options});
/*
* Run callback if specified
*/
if (typeof(options.callback) == 'function') {
options.callback(map, options);
}
return map;
function triggerEvent(target, type, data) {
if (typeof window.CustomEvent == 'function') {
var evt = new CustomEvent(type, {detail: data});
target.dispatchEvent(evt);
}
else if (window.jQuery) {
var evt = jQuery.Event(type);
evt.detail = data;
jQuery(target).trigger(evt);
}
}
};

View File

@ -0,0 +1,266 @@
L.FieldStore = L.Class.extend({
initialize: function (fieldid, options) {
this.formfield = document.getElementById(fieldid);
L.setOptions(this, options);
},
load: function () {
var value = (this.formfield.value || '');
return this._deserialize(value);
},
save: function (layer) {
this.formfield.value = this._serialize(layer);
},
_serialize: function (layer) {
var items = typeof(layer.getLayers) == 'function' ? layer.getLayers() : [layer],
is_multi = this.options.is_collection || items.length > 1,
is_generic = this.options.is_generic,
collection_type = this.options.collection_type,
is_empty = items.length === 0;
if (is_empty)
return '';
var geom = is_multi ? layer : items[0];
if (typeof geom.toGeoJSON != 'function') {
throw 'Unsupported layer type ' + geom.constructor.name;
}
// Leaflet requires access to original feature attribute for GeoJSON
// serialization. (see https://github.com/Leaflet/Leaflet/blob/v0.7.3/src/layer/GeoJSON.js#L256-L258)
// When creating new records, it's empty so we force it here.
if (!geom.feature) {
geom.feature = {geometry: {type: this.options.geom_type}};
}
var geojson = geom.toGeoJSON(this.options.precision);
var is_geometrycollection = (geojson.geometry && geojson.geometry.type == 'GeometryCollection');
if (is_multi && is_generic && !is_geometrycollection) {
var flat = {type: 'GeometryCollection', geometries: []};
for (var i=0; i < geojson.features.length; i++) {
flat.geometries.push(geojson.features[i].geometry);
}
geojson = flat;
}
// Special case for MultiPolyline/MultiPolygon because it was removed from leaflet 1.0
else if (is_multi && collection_type != 'featureGroup') {
var latlngs = [];
for (var i = 0; i < geojson.features.length; i++) {
var latlng = [];
var coord = geojson.features[i].geometry.coordinates;
if (collection_type == 'polygon') {
coord = coord[0];
}
for (var j = 0; j < coord.length; j++) {
latlng.push([coord[j][1], coord[j][0]]);
}
if (collection_type == 'polygon') {
latlng = [latlng];
}
latlngs.push(latlng);
}
geom = L[collection_type](latlngs);
geojson = geom.toGeoJSON(this.options.precision).geometry;
}
// In order to make multipoint work, it seems we need to treat it similarly to the GeometryCollections
else if (this.options.geom_type == 'MULTIPOINT') {
var flat = {type: 'MultiPoint', coordinates: []};
for (var i=0; i < geojson.features.length; i++) {
flat.coordinates.push(geojson.features[i].geometry.coordinates);
}
geojson = flat;
}
else {
geojson = geojson.geometry;
}
return JSON.stringify(geojson);
},
_deserialize: function (value) {
if (/^\s*$/.test(value)) {
return null;
}
// Helps to get rid of the float value conversion error
this.formfield.value = JSON.stringify(JSON.parse(value));
return L.GeoJSON.geometryToLayer(JSON.parse(value));
},
});
L.GeometryField = L.Class.extend({
statics: {
unsavedText: 'Map geometry is unsaved'
},
options: {
field_store_class: L.FieldStore
},
initialize: function (options) {
var geom_type = options.geom_type.toLowerCase();
options.is_generic = /geometry/.test(geom_type);
options.is_collection = /(^multi|collection$)/.test(geom_type);
options.is_linestring = /linestring$/.test(geom_type) || options.is_generic;
options.is_polygon = /polygon$/.test(geom_type) || options.is_generic;
options.is_point = /point$/.test(geom_type) || options.is_generic;
options.collection_type = ({
'multilinestring': 'polyline',
'multipolygon': 'polygon',
})[geom_type] || 'featureGroup';
L.setOptions(this, options);
this._drawControl = null;
this._unsavedChanges = false;
// Warn if leaving with unsaved changes
var _beforeunload = window.onbeforeunload;
window.onbeforeunload = L.Util.bind(function(e) {
if (this._unsavedChanges)
return L.GeometryField.unsavedText;
if (typeof(_beforeunload) == 'function')
return _beforeunload();
}, this);
},
addTo: function (map) {
this._map = map;
var store_opts = L.Util.extend(this.options, {defaults: map.defaults});
this.store = new this.options.field_store_class(this.options.fieldid, store_opts);
this.drawnItems = this._editionLayer();
map.addLayer(this.drawnItems);
// Initialize the draw control and pass it the FeatureGroup of editable layers
var drawControl = this._drawControl = new L.Control.Draw(this._controlDrawOptions());
if (this.options.modifiable) {
map.addControl(drawControl);
L.DomUtil.addClass(drawControl._container, this.options.fieldid);
//
// In case there is several draw controls on the same map (target map option)
map['drawControl' + this.options.fieldid] = drawControl;
// We use a flag to ignore events of other draw controls
for (var toolbar in drawControl._toolbars) {
drawControl._toolbars[toolbar].on('enable disable', function (e) {
this._acceptDrawEvents = e.type === 'enable';
}, this);
}
map.on('draw:created draw:edited draw:deleted', function (e) {
// Ignore if coming from other Draw controls
if (!this._acceptDrawEvents)
return;
// Call onCreated(), onEdited(), onDeleted()
var eventName = e.type.replace('draw:', ''),
method = 'on' + eventName.charAt(0).toUpperCase() + eventName.slice(1);
this[method](e);
}, this);
// Flag for unsaved changes
map.on('draw:drawstart draw:editstart', function () {
if (this._acceptDrawEvents) this._unsavedChanges = true;
}, this);
map.on('draw:drawstop draw:editstop', function () {
if (this._acceptDrawEvents) this._unsavedChanges = false;
}, this);
}
this.load();
map.fire('map:loadfield', {field: this, fieldid: this.options.fieldid});
return this;
},
load: function () {
var geometry = this.store.load();
if (geometry) {
// Add initial geometry to the map
if (geometry instanceof L.LayerGroup) {
geometry.eachLayer(function (l) {
this.drawnItems.addLayer(l);
}, this);
}
else if (this.options.collection_type !== 'featureGroup'
&& (geometry instanceof L.Polygon || geometry instanceof L.Polyline)) {
var latlngs = geometry.getLatLngs();
for (var i = 0; i < latlngs.length; i++) {
this.drawnItems.addLayer(L[this.options.collection_type](latlngs[i]));
}
}
else {
this.drawnItems.addLayer(geometry);
}
this.drawnItems.addTo(this._map);
}
this._setView();
return geometry;
},
_setView: function () {
// Change view extent
if (this.drawnItems.getLayers().length > 0) {
var bounds = this.drawnItems.getBounds();
var options = {
maxZoom: this._map.maxZoom || 15
};
this._map.fitBounds(bounds, options);
}
// Else keep view extent set by django-leaflet template tag
},
onCreated: function (e) {
// Remove previously drawn if field is not collection.
if (!this.options.is_collection) {
this.drawnItems.eachLayer(function (l) {
this._map.removeLayer(l);
}, this);
this.drawnItems.clearLayers();
}
var layer = e.layer;
this._map.addLayer(layer);
this.drawnItems.addLayer(layer);
this.store.save(this.drawnItems);
},
onEdited: function (e) {
this.store.save(this.drawnItems);
},
onDeleted: function (e) {
var layer = e.layer;
this.drawnItems.removeLayer(layer);
this.store.save(this.drawnItems);
},
_editionLayer: function () {
var type = 'featureGroup',
constructor = L[type];
if (typeof(constructor) != 'function') {
throw 'Unsupported geometry type: ' + type;
}
return constructor([], {});
},
_controlDrawOptions: function () {
return {
edit: {
featureGroup: this.drawnItems
},
draw: {
polyline: this.options.is_linestring,
polygon: this.options.is_polygon,
circle: false, // Turns off this drawing tool
rectangle: this.options.is_polygon,
marker: this.options.is_point,
}
};
}
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
static/leaflet/proj4.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,272 @@
(function (factory) {
var L, proj4;
if (typeof define === 'function' && define.amd) {
// AMD
define(['leaflet', 'proj4'], factory);
} else if (typeof module === 'object' && typeof module.exports === "object") {
// Node/CommonJS
L = require('leaflet');
proj4 = require('proj4');
module.exports = factory(L, proj4);
} else {
// Browser globals
if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined')
throw 'Leaflet and proj4 must be loaded first';
factory(window.L, window.proj4);
}
}(function (L, proj4) {
if (proj4.__esModule && proj4.default) {
// If proj4 was bundled as an ES6 module, unwrap it to get
// to the actual main proj4 object.
// See discussion in https://github.com/kartena/Proj4Leaflet/pull/147
proj4 = proj4.default;
}
L.Proj = {};
L.Proj._isProj4Obj = function(a) {
return (typeof a.inverse !== 'undefined' &&
typeof a.forward !== 'undefined');
};
L.Proj.Projection = L.Class.extend({
initialize: function(code, def, bounds) {
var isP4 = L.Proj._isProj4Obj(code);
this._proj = isP4 ? code : this._projFromCodeDef(code, def);
this.bounds = isP4 ? def : bounds;
},
project: function (latlng) {
var point = this._proj.forward([latlng.lng, latlng.lat]);
return new L.Point(point[0], point[1]);
},
unproject: function (point, unbounded) {
var point2 = this._proj.inverse([point.x, point.y]);
return new L.LatLng(point2[1], point2[0], unbounded);
},
_projFromCodeDef: function(code, def) {
if (def) {
proj4.defs(code, def);
} else if (proj4.defs[code] === undefined) {
var urn = code.split(':');
if (urn.length > 3) {
code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
}
if (proj4.defs[code] === undefined) {
throw 'No projection definition for code ' + code;
}
}
return proj4(code);
}
});
L.Proj.CRS = L.Class.extend({
includes: L.CRS,
options: {
transformation: new L.Transformation(1, 0, -1, 0)
},
initialize: function(a, b, c) {
var code,
proj,
def,
options;
if (L.Proj._isProj4Obj(a)) {
proj = a;
code = proj.srsCode;
options = b || {};
this.projection = new L.Proj.Projection(proj, options.bounds);
} else {
code = a;
def = b;
options = c || {};
this.projection = new L.Proj.Projection(code, def, options.bounds);
}
L.Util.setOptions(this, options);
this.code = code;
this.transformation = this.options.transformation;
if (this.options.origin) {
this.transformation =
new L.Transformation(1, -this.options.origin[0],
-1, this.options.origin[1]);
}
if (this.options.scales) {
this._scales = this.options.scales;
} else if (this.options.resolutions) {
this._scales = [];
for (var i = this.options.resolutions.length - 1; i >= 0; i--) {
if (this.options.resolutions[i]) {
this._scales[i] = 1 / this.options.resolutions[i];
}
}
}
this.infinite = !this.options.bounds;
},
scale: function(zoom) {
var iZoom = Math.floor(zoom),
baseScale,
nextScale,
scaleDiff,
zDiff;
if (zoom === iZoom) {
return this._scales[zoom];
} else {
// Non-integer zoom, interpolate
baseScale = this._scales[iZoom];
nextScale = this._scales[iZoom + 1];
scaleDiff = nextScale - baseScale;
zDiff = (zoom - iZoom);
return baseScale + scaleDiff * zDiff;
}
},
zoom: function(scale) {
// Find closest number in this._scales, down
var downScale = this._closestElement(this._scales, scale),
downZoom = this._scales.indexOf(downScale),
nextScale,
nextZoom,
scaleDiff;
// Check if scale is downScale => return array index
if (scale === downScale) {
return downZoom;
}
if (downScale === undefined) {
return -Infinity;
}
// Interpolate
nextZoom = downZoom + 1;
nextScale = this._scales[nextZoom];
if (nextScale === undefined) {
return Infinity;
}
scaleDiff = nextScale - downScale;
return (scale - downScale) / scaleDiff + downZoom;
},
distance: L.CRS.Earth.distance,
R: L.CRS.Earth.R,
/* Get the closest lowest element in an array */
_closestElement: function(array, element) {
var low;
for (var i = array.length; i--;) {
if (array[i] <= element && (low === undefined || low < array[i])) {
low = array[i];
}
}
return low;
}
});
L.Proj.GeoJSON = L.GeoJSON.extend({
initialize: function(geojson, options) {
this._callLevel = 0;
L.GeoJSON.prototype.initialize.call(this, geojson, options);
},
addData: function(geojson) {
var crs;
if (geojson) {
if (geojson.crs && geojson.crs.type === 'name') {
crs = new L.Proj.CRS(geojson.crs.properties.name);
} else if (geojson.crs && geojson.crs.type) {
crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code);
}
if (crs !== undefined) {
this.options.coordsToLatLng = function(coords) {
var point = L.point(coords[0], coords[1]);
return crs.projection.unproject(point);
};
}
}
// Base class' addData might call us recursively, but
// CRS shouldn't be cleared in that case, since CRS applies
// to the whole GeoJSON, inluding sub-features.
this._callLevel++;
try {
L.GeoJSON.prototype.addData.call(this, geojson);
} finally {
this._callLevel--;
if (this._callLevel === 0) {
delete this.options.coordsToLatLng;
}
}
}
});
L.Proj.geoJson = function(geojson, options) {
return new L.Proj.GeoJSON(geojson, options);
};
L.Proj.ImageOverlay = L.ImageOverlay.extend({
initialize: function (url, bounds, options) {
L.ImageOverlay.prototype.initialize.call(this, url, null, options);
this._projectedBounds = bounds;
},
// Danger ahead: Overriding internal methods in Leaflet.
// Decided to do this rather than making a copy of L.ImageOverlay
// and doing very tiny modifications to it.
// Future will tell if this was wise or not.
_animateZoom: function (event) {
var scale = this._map.getZoomScale(event.zoom);
var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y);
var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center);
L.DomUtil.setTransform(this._image, offset, scale);
},
_reset: function () {
var zoom = this._map.getZoom();
var pixelOrigin = this._map.getPixelOrigin();
var bounds = L.bounds(
this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin),
this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin)
);
var size = bounds.getSize();
L.DomUtil.setPosition(this._image, bounds.min);
this._image.style.width = size.x + 'px';
this._image.style.height = size.y + 'px';
},
_projectedToNewLayerPoint: function (point, zoom, center) {
var viewHalf = this._map.getSize()._divideBy(2);
var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round();
var topLeft = newTopLeft.add(this._map._getMapPanePos());
return this._transform(point, zoom)._subtract(topLeft);
},
_transform: function (point, zoom) {
var crs = this._map.options.crs;
var transformation = crs.transformation;
var scale = crs.scale(zoom);
return transformation.transform(point, scale);
}
});
L.Proj.imageOverlay = function (url, bounds, options) {
return new L.Proj.ImageOverlay(url, bounds, options);
};
return L.Proj;
}));