跳转到内容

Template:Location mark+/doc

本页使用了标题或全文手工转换
维基百科,自由的百科全书

此模板用于在图片上放置一个或多个标记,并可添加标签。辅助模板{{Location mark~}}可被多次调用来生成带标签的标记。若只需标签,模板{{Location mark label}}可将任意字体大小的彩色标签放置在图片上。

其他模板更适合叠加图片。本模板使用相对坐标值在任何图片上居中放置标记。即使合成图片的尺寸改变,标记的相对位置也不会改变。合成图片可以显示为普通图片、带边框图片或缩略图。

如果已知地理位置坐标且存在定位地图模板,则应改用Location_map系列模板之一。下方的参见部分列出了替代模板。

用法

[编辑]
美国的一些地点
旧金山
旧金山
四角落
四角落
纽约
纽约
美国的一些地点
{{Location mark+
| image = 
| width = 
| caption = 
| alt = 
| type = 
| float = 
| marks = 
}}
{{Location mark~
| width = 
| label = 
| position = 
| font_size = 
| background = 
| mark = 
| mark_width = 
| mark_alt = 
| mark_link = 
| x = 
| y = 
}}

参数

[编辑]
Location map+参数
参数 描述
image 必需。图片文件名。
overlay 要叠加在图片上的图片文件名。应与原图尺寸相同且背景透明。
width 设置图片宽度(像素)。默认220px。例如width=240而非width=240px
caption 使用缩略图选项时显示在图片下方的说明文字。参见示例
alt 地图的替代文字。参见WP:ALT。若未提供则使用caption文字。
type 设置显示格式。有效值为thumbborderthumb生成类似[[File:|name|thumb]]的输出,border生成类似[[File:|name|border]]的输出。若未指定有效值,输出将无边框。参见下文此页面
float 设置图片在页面中的位置。有效值为leftrightcenternone。默认为right
marks 使用模板{{Location mark~}}在图片上放置一个或多个标记。参见下文。
Location mark~参数
参数 描述
width 图片宽度。默认220px。必须与图片宽度相同。
label 可选。显示在标记旁的标签文字。可使用维基链接
position 标签相对于标记的位置。有效值为leftrighttopbottom。默认为right。若未指定,模板将根据标记位置自动决定标签显示在左侧或右侧。
font_size 标签字体大小(百分比)。默认为90%。例如font_size=80
background 标签文字的背景颜色。参见网页颜色。默认继承标签后图片的背景色。
mark 用作标记的图片文件名。默认为Red pog.svg。可前往这里这里查看示例。
mark_width 标记宽度(像素)。默认为8px。例如mark_width=7而非mark_width=7px。大尺寸标记图片不适用于标签。本模板不适用于生成叠加效果。参见{{Superimpose}}。
mark_link 指定点击标记时跟随的维基链接。当鼠标悬停在标记上时,链接文章名称将显示为提示文字。
mark_alt 标记图片的替代文字。参见WP:ALT。若未提供则使用label文字。
x
y
指定标记在图片上的位置。坐标基于宽度为1000像素的地图以像素为单位。模板会自动缩放这些值以正确显示。参见下文
x%
y%
指定标记在图片上的位置。x%指定从左边缘开始的横向距离百分比,y%指定从上边缘开始的纵向距离百分比。参见下文
Location mark label参数
参数 描述
label 要显示的标签文字,可使用维基链接
lwidth 标签显示宽度,超出将换行(默认:lwidth=18em)。
lheight 标签行高,用于调整行间距(默认:lheight=111%)。
position 标签相对于标记的位置。有效值为leftrighttopbottom。默认为right。若未指定,模板将根据标记位置自动决定标签显示在左侧或右侧。
size 标签字体大小。默认为90%。例如:size=80
color 标签文字前景色。参见网页颜色。默认:黑色。示例:color=purple或color=#0099EE(青蓝色)。
bg 标签文字背景色。参见网页颜色。默认继承标签后图片的背景色。示例:bg=darkorange或bg=#0099EE(青蓝色)。
mark 用作标记的图片文件名。默认为Red pog.svg。可前往这里这里查看示例。
mark_width 标记宽度(像素)。默认为0(不显示)。例如:mark_width=7
mark_link 指定点击标记时跟随的维基链接
mark_alt 标记的替代文字。参见WP:ALT。默认使用label
xx% 标签在水平轴上的左右位置。参见下文。
yy% 标签在垂直轴上的上下位置。参见下文。

标记放置参数

[编辑]

有两种在图片上放置标记的方法。

使用xy参数在图片上放置标记

[编辑]

xy参数的值是当图片缩放至1000像素宽时,位置标记的像素坐标。

x是标记距1000px宽图片左边缘的像素偏移量。
y是标记距1000px宽图片上边缘的像素偏移量。

获取这些值至少有两种方法:

  1. 从图片的文件页面下载图片到电脑。用图形编辑器(如GIMPXnView)打开图片。将图片缩放至1000px宽,然后记下光标指向目标位置时的x、y坐标。直接使用这些值。
  2. 从图片的文件页面下载图片到电脑。用能显示光标坐标的图片查看器(如微软的画图)打开图片。记下光标指向目标位置时的x'、y'坐标。然后:
1000 · x'/w = x  和  1000 · y'/w = y
其中x'y'是光标坐标,w是电脑上显示的图片宽度,xy是要赋给xy参数的值。

使用x%y%参数在图片上放置标记

[编辑]
x%指定从左边缘开始的横向距离百分比。
y%指定从上边缘开始的纵向距离百分比。

type参数

[编辑]
default type=border type=thumb
苏格兰海岸的三个地点
Cape Wrath
Cape Wrath
Rattray Head
Rattray Head
Ardnamurchan Point
Ardnamurchan Point
苏格兰海岸的三个地点
Cape Wrath
Cape Wrath
Rattray Head
Rattray Head
Ardnamurchan Point
Ardnamurchan Point
苏格兰海岸的三个地点
Cape Wrath
Cape Wrath
Rattray Head
Rattray Head
Ardnamurchan Point
Ardnamurchan Point
苏格兰海岸的三个地点

示例

[编辑]

前两个示例可使用{{Location map+}}实现。

使用大部分默认值

[编辑]
Weather stations in Scotland
Cape Wrath
Cape Wrath
Rattray Head
Rattray Head
Ardnamurchan Point
Ardnamurchan Point
{{Location mark+
| width =
| image = Scotland relief location map.jpg
| caption = Weather stations in Scotland
| float =
| type =
| marks =
{{Location mark~
  | width =
  | label = '''Cape Wrath'''
  | position =
  | x = 452 | y = 480 }}
{{Location mark~
  | width =
  | label = '''Rattray Head'''
  | position =
  | x = 835 | y = 703 }}
{{Location mark~
  | width =
  | label = '''Ardnamurchan Point'''
  | position =
  | x = 307 | y = 865 }}
}}

为标签使用背景色

[编辑]
Largest cities in North Rhine-Westphalia
Cologne
Cologne
Düsseldorf
Düsseldorf
Dortmund
Dortmund
Essen

Essen
Duisburg
Duisburg
Largest cities in North Rhine-Westphalia
{{Location mark+
| image = North Rhine-Westphalia location map 05.svg
| width = 300
| caption = Largest cities in [[North Rhine-Westphalia]]
| type = thumb
| marks =
{{Location mark~
  | width = 300
  | label = Cologne
  | position = right
  | background = #a7cb9d
  | x = 302 | y = 702 }}
{{Location mark~
  | width = 300
  | label = Düsseldorf
  | position = left
  | background = #a7cb9d
  | x = 267 | y = 574 }}
{{Location mark~
  | width = 300
  | label = Dortmund
  | position = right
  | background = #a7cb9d
  | x = 456 | y = 457 }}
{{Location mark~
  | width = 300
  | label = <br />Essen
  | position = right
  | background = #a7cb9d
  | x = 328 | y = 484 }}
{{Location mark~
  | width = 300
  | label = Duisburg
  | position = left
  | background = #a7cb9d
  | x = 261 | y = 496 }}
}}

使用不可见标记

[编辑]
Cute chicks
Rachel
Rachel
Alice
Alice
Cute chicks
{{Location mark+
| image = Take five.jpg
| caption = Cute chicks
| type = thumb
| marks =
{{Location mark~
  | label = Rachel
  | position = top
  | background = #ae9074
  | mark = Blanksvg.svg
  | x = 433 | y = 295 }}
{{Location mark~
  | label = Alice
  | position = top
  | background = #ae9074
  | mark = Blanksvg.svg
  | x = 812 | y = 245 }}
}}

参见

[编辑]