Modulo:Maplink: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 1:
require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local numLeg = require('Module:Overlay').icon
local p = {}
Riga 6 ⟶ 7:
local txt = {}
local function agg(t,...)
local args = {...}
for _, s in ipairs(args) do
table.insert(
end
end
Riga 79 ⟶ 80:
if (zoom < 0) then zoom = 0 elseif (zoom>18) then zoom = 18 end
if (cornice == 1) then
agg(txt,'\n{| class="wikitable')
if (allinea == 'right') then agg(txt,' floatright') elseif (allinea == 'left') then agg(txt,' foatleft') end
agg(txt,'" style="border: 1px solid darkgray;')
if (allinea == 'center') then agg(txt,'margin-left: auto; margin-right: auto') end
agg(txt,'"\n|-\n|style="width: ',largh,'px;"|')
end
-- grafico
agg('{{Graph:Street map with marks|lat=',centroy,'|lon=',centrox,'|zoom=',zoom,'|width=',largh,'|height=',altezza,'| minimap=0')▼
agg('|{"lat":',centroy,',"lon":',centrox,',"img":"wikirawupload:{{filepath:Mapscaleline.svg|120}}","width":50,"height":8,"offsetX":',(math.floor(largh/2)-37))▼
agg(',"offsetY": ',(math.floor(altezza/2)-10),',"textAlign":"right","textDx":22,"textDy":-2,"textColor": "grey","textFont":"Tahoma","textFontSize":9,"text": "')▼
▲ local zz = {}
if (math.abs(centroy)<20) then
elseif (math.abs(centroy)<40) then
elseif (math.abs(centroy)<40) then
else
end
▲
agg(zz[zoom+1],'" }')▼
▲
for i=1,#pp do
agg(gr2,',{"lat":',pp[i].lat,',"lon":',pp[i].lon,',"size":"200","color":"',pp[i].col,'","strokeColor":"","shape":"circle","text":"","textAlign":"left","textBaseline":"middle","textDx":0,"textDy":1,"textFontSize":10},{"lat":',pp[i].lat,',"lon":',pp[i].lon,',"shape":"square","size": "0","text":"',pp[i].num,'","textAlign":"center","textBaseline":"bottom","textDx":0,"textDy":5.5,"textFont":"Arial","textFontSize": 11,"textFontWeight":"bold","textColor":"white"}')
end
agg(txt, mw.getCurrentFrame():expandTemplate { title = "Graph:Street map with marks",
agg(' }}\n<div style="text-align:left;font-size:70%;color:grey"><span style="font-size:125%">{{#tag:maplink|\n[ {"type": "FeatureCollection", "features": [')▼
▲
} )
▲ agg(txt,'
-- maplink
local ml = {}
agg(ml,'<maplink zoom="',zoom,'" text="[Schermo intero]">[ {"type": "FeatureCollection", "features": [')
for i=1,#pp do
if (i>1) then agg(ml,',') end
agg(ml,'{"type":"Feature","geometry":{"type":"Point","coordinates":[',pp[i].lon,',',pp[i].lat,'] }')
agg(ml,',"properties":{"title": "',pp[i].nome,'","description":"","marker-symbol": "-number',gruppo,'","marker-size":"medium","marker-color":"',pp[i].col,'" } }')
end
agg(ml,'] } ]</maplink>')
agg(txt, frame:preprocess( table.concat(ml)))
agg(txt,'</span><div style="float:right" class="plainlinks nourlexpansion">[https://wikimediafoundation.org/wiki/Maps_Terms_of_Use Wikimedia] | © [https://www.openstreetmap.org/copyright OSM]</div></div>')
if (cornice == 1) then
agg(txt,'\n|-')
if not (dida == '') then agg(txt,'\n|style="font-size:90%"|',dida) end
if (elenco == '2') then
if (dida == '') then agg(txt,'\n|') end
agg(txt,'\n{| width="100%"\n|-\n|width=50% valign=top|<small>')
for i=1,#pp do
agg(
if (i == math.floor(#pp/2 +0.5)) then agg(txt,'</small>\n|width=50% valign=top|<small>') end
end
agg(txt,'</small>\n|}')
elseif (elenco == '1') then
if (dida == '') then agg(txt,'\n|style="font-size:90%"|') else agg(txt,'<br/>') end
agg(txt,'<small>')
for i=1,#pp do
agg(
end
end
agg(txt,'</small>\n|}')
end
return
else
return err
|