Modulo:Mapframe: Malsamoj inter versioj

[kontrolita revizio][kontrolita revizio]
Enhavo forigita Enhavo aldonita
e Nuligis version 6952668 de Tlustulimu (kontribuoj, diskutpaĝo) ne efikas dum testoj pri la rilata ŝablono, kiu bezonas {{coord}} por koordinatoj
Etikedo: Malfaro
e aktualigo laŭ la proveja modulo mapframe/provejo
 
Linio 2:
-- ##### Localisation (L10n) settings #####
-- Replace values in quotes ("") with localised values
-- with adding from [[:ca:Mòdul:Map]] and [[:eo:Modulo:Mapkadro]]
 
local L10n = {}
Linio 30 ⟶ 31:
radiusMi = "radius_mi",
edges = "edges",
turn = "turn", -- from cawp
text = "text",
icon = "icon",
Linio 111 ⟶ 113:
strokeColor = "#ff0000",
strokeWidth = 6,
edges = 32, -- number of edges used to approximate a circle
turn = 0 -- turn for the circle feature
}
 
Linio 260 ⟶ 263:
end
local edges = getParameterValue(args, 'edges') or L10n.defaults.edges
local turn = getParameterValue(args, 'turn') or L10n.defaults.turn
if not lat or not long then
error("Circle centre coordinates must be specified, or available via Wikidata")
Linio 269 ⟶ 273:
error("Circle edges must be a positive number")
end
return circleToPolygon(lat, long, radius, tonumber(edges), tonumber(turn))
end
 
function circleToPolygon(lat, long, radius, n, turn) -- n is number of edges
-- Based on https://github.com/gabzim/circle-to-polygon, ISC licence
Linio 291 ⟶ 295:
local coordinates = {};
local move = 2 * math.pi * (turn or 0)
local i = 0;
while i < n do
table.insert(coordinates, offset(lat, long, radius, ((2*math.pi*-i)/n) + move))
offset(lat, long, radius, (2*math.pi*i*-1)/n)
)
i = i + 1
end
table.insert(coordinates, offset(lat, long, radius, 0 + move))
return coordinates
end