Skip to content

Commit dc355ae

Browse files
committed
[AUTO] Sync MapML Build
1 parent 5383ee0 commit dc355ae

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

dist/mapml.js

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -640,16 +640,6 @@
640640
latlng, latlngs, coordinates, member, members, linestrings;
641641

642642
coordsToLatLng = coordsToLatLng || this.coordsToLatLng;
643-
var pointOptions = { opacity: vectorOptions.opacity ? vectorOptions.opacity : null,
644-
icon: L.icon(
645-
{ iconUrl: vectorOptions.imagePath+"marker-icon.png",
646-
iconRetinaUrl: vectorOptions.imagePath+"marker-icon-2x.png",
647-
shadowUrl: vectorOptions.imagePath+"marker-shadow.png",
648-
iconSize: [25, 41],
649-
iconAnchor: [12, 41],
650-
popupAnchor: [1, -34],
651-
shadowSize: [41, 41]
652-
})};
653643

654644
var cs = geometry.getAttribute("cs") || nativeCS;
655645

@@ -658,16 +648,15 @@
658648
coordinates = [];
659649
geometry.getElementsByTagName('coordinates')[0].textContent.split(/\s+/gim).forEach(M.parseNumber,coordinates);
660650
latlng = coordsToLatLng(coordinates, cs, zoom, this.options.projection);
661-
return pointToLayer ? pointToLayer(mapml, latlng) :
662-
new L.Marker(latlng, pointOptions);
651+
return pointToLayer ? pointToLayer(mapml, latlng) : M.svgMarker(latlng, vectorOptions);
663652

664653
case 'MULTIPOINT':
665654
coordinates = [];
666655
geometry.getElementsByTagName('coordinates')[0].textContent.match(/(\S+ \S+)/gim).forEach(M.splitCoordinate, coordinates);
667656
latlngs = this.coordsToLatLngs(coordinates, 0, coordsToLatLng, cs, zoom);
668657
var points = new Array(latlngs.length);
669658
for(member=0;member<points.length;member++) {
670-
points[member] = new L.Marker(latlngs[member],pointOptions);
659+
points[member] = M.svgMarker(latlngs[member], vectorOptions);
671660
}
672661
return new L.featureGroup(points);
673662
case 'LINESTRING':
@@ -5163,6 +5152,48 @@
51635152
return new Crosshair(options);
51645153
};
51655154

5155+
var SVGMarker = L.Path.extend({
5156+
options: {
5157+
fillColor: '#2e91bf',
5158+
color: '#ffffff',
5159+
fill: true,
5160+
className: "mapml-marker",
5161+
fillOpacity: 1,
5162+
weight: 1,
5163+
},
5164+
5165+
initialize: function (latlng, options) {
5166+
L.setOptions(this, options);
5167+
this._latlng = L.latLng(latlng);
5168+
},
5169+
5170+
_project: function () {
5171+
this._point = this._map.latLngToLayerPoint(this._latlng);
5172+
},
5173+
5174+
_update: function () {
5175+
if (!this._map) return;
5176+
this._path.setAttribute("d", this.defineMarker(this._point));
5177+
},
5178+
5179+
getLatLngs: function () {
5180+
return this._latlng;
5181+
},
5182+
5183+
getCenter: function () {
5184+
return this._latlng;
5185+
},
5186+
5187+
defineMarker: function (p) {
5188+
return `M${p.x} ${p.y} L${p.x - 12.5} ${p.y - 30} C${p.x - 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 30} L${p.x} ${p.y}z`;
5189+
},
5190+
5191+
});
5192+
5193+
var svgMarker = function (latlng, options) {
5194+
return new SVGMarker(latlng, options);
5195+
};
5196+
51665197
/*
51675198
* Copyright 2015-2016 Canada Centre for Mapping and Earth Observation,
51685199
* Earth Sciences Sector, Natural Resources Canada.
@@ -5781,6 +5812,9 @@
57815812
M.Crosshair = Crosshair;
57825813
M.crosshair = crosshair;
57835814

5815+
M.SVGMarker = SVGMarker;
5816+
M.svgMarker = svgMarker;
5817+
57845818
}(window));
57855819

57865820
}());

0 commit comments

Comments
 (0)