Bản mẫu:Điểm định vị+
This template places one or more marks on an image, with optional labels. The helper template {{Location mark~}} can be used one or more times to generate the marks with labels. For labels only, the template {{Location mark label}} can place each colored label, of any font size, onto the image.
Other templates are more capable of superimposing one image on another. This template centers a mark over a location on any image using coordinate values that are relative. The size of the composite image can changed without changing the relative positions of the markers. The composite image can be displayed as a simple image, a bordered image or a thumbnail image.
If the geographic coordinates of the locations are known and a location map template exists, then one of the templates in the {Location_map} family should be used instead. The See-also section, below, lists alternative templates.
Cách sử dụng
[sửa mã nguồn]{{Điểm định vị+ | image = | width = | caption = | alt = | type = | float = | marks = }} |
{{Điểm định vị~ | width = | label = | position = | font_size = | background = | mark = | mark_width = | mark_alt = | mark_link = | x = | y = }} |
Các thông số
[sửa mã nguồn]Thông số | Miêu tả |
---|---|
image
|
Required. The name of an image file. |
overlay
|
The name of an image file to superimpose on the image. It should be the same size and have a transparent background. |
width
|
Determines the width of the image in pixels. The default is 220px. For example, width=240 and not width=240px .
|
caption
|
The caption text displays below the image if the thumbnail option is used. See the examples. |
alt
|
Alt text for the map. See WP:ALT. If no alt text is provided the caption text will be used.
|
type
|
Determines the display format. Valid values are thumb , and border . The thumb option generates output similar to [[Tập tin:|name|thumb]] , while the border option generates output similar to [[Tập tin:|name|border]] . If no valid value is assigned, the output will not be framed or bordered. See below and this page.
|
float
|
Determines the position of the image on the page. Valid values are left , right , center and none . The default is right .
|
marks
|
Places one or more marks on the image using the template {{Điểm định vị~}} . See below.
|
Thông số | Miêu tả |
---|---|
width
|
The width of the image. The default is 220px. Must be the same as the width of the image. |
label
|
Optional. The text of the label to display next to the mark. The text can be wiki linked. |
position
|
The position of the label relative to the mark. Valid values are left , right , top and bottom . The default is right . If none is assigned then the template will place the label either to the right or the left depending on the location of the mark.
|
font_size
|
The font size to use for the label as a percentage. The default is 90%. For example, font_size=80 |
background
|
The background color to use for the label text. See Web colors. By default the background color is inherited from the image behind the label. |
mark
|
The name of an image to display as the mark. The default is Red pog.svg. Go here and here for some examples. |
mark_width
|
The width of the mark in pixels. The default is 8px. For example, mark_width=7 and not mark_width=7px . Labels do not work well with large mark images. This template is not intended to generate overlays. See {{Superimpose}}.
|
mark_link
|
Specifies a wiki link which will be followed if the reader clicks on the mark. The name of the linked article will be displayed as a tool tip when the mouse pointer hovers over the mark. |
mark_alt
|
Alt text for the mark image. See WP:ALT. If no mark_alt text is provided the label text will be used.
|
x y |
Specifies the position of the marker on the image. The coordinates of the marker in pixels based on a map with a width of 1000 pixels. The template will scale these values for proper display. See below. |
x% y% |
Specifies the position of the marker on the image. x% specifies the percentage of the distance across the image from the left edge and y% specifies the percentage of the distance down from the top edge. See below.
|
Thông số | Miêu tả |
---|---|
label
|
Text of the label to display, which can be wiki-linked. |
lwidth
|
Width of the label to display, before wrapping (default: lwidth=18em). |
lheight
|
Line-height of the label to display, for interline spacing (default: lheight=111%). |
position
|
The position of the label relative to the mark. Valid values are left , right , top and bottom . The default is right . If none is assigned then the template will place the label either to the right or the left depending on the location of the mark.
|
size
|
Font size to use for the label. Default is 90%. Example: size=80 |
color
|
The foreground color to use for the label text. See Web colors. Default: black. Examples: color=purple, or color=#0099EE (green-blue). |
bg
|
The background color to use for the label text. See Web colors. By default, the background color is inherited from the image behind the label. Examples: bg=darkorange, or bg=#0099EE (green-blue). |
mark
|
The name of an image to display as the mark. The default is Red pog.svg. Go here and here for some examples. |
mark_width
|
Width of the mark in pixels. The default is 0 (suppressed). For example, mark_width=7 .
|
mark_link
|
Specifies a wiki link which will be followed if the reader clicks on the mark. |
mark_alt
|
Alt text for a mark. See WP:ALT. Defaults to label .
|
x or x%
|
Location left-to-right of label along horizontal axis. See below. |
y or y%
|
Location top-to-bottom of label along vertical axis. See below. |
Các thông số vị trí điểm
[sửa mã nguồn]There are two ways to generate a marker on a map.
Đặt một điểm trên một hình ảnh bằng cách sử dụng các thông số x
và y
[sửa mã nguồn]The values for the x
and y
parameters are the pixel coordinates of the location mark when the image is scaled to a width of 1000 pixels.
x
is the pixel offset for the mark from the left edge of an image 1000px wide.y
is the pixel offset for the mark from the top edge of an image 1000px wide.
There are at least two ways of obtaining these values:
- Download the image from the image's file page to your computer. Open the image in a graphics editor, such as GIMP or XnView. Scale (resize) the image to a width of 1000px and then note the x, y coordinates when the cursor points to the desired location. Use these values directly.
- Download the image from the image's file page to your computer. Open the image in any image viewer that displays the coordinates of the cursor position, such as Paint from Microsoft. Note the x, y coordinates when the cursor points to the location. Then:
- 1000 · x'/w = x and 1000 · y'/w = y
- where x' and y' are the cursor coordinates, w is the width of the image displayed on your computer and x and y are the values to assign to the
x
andy
parameters.
- where x' and y' are the cursor coordinates, w is the width of the image displayed on your computer and x and y are the values to assign to the
Đặt một điểm trên một hình ảnh bằng cách sử dụng các thông số x%
và y%
[sửa mã nguồn]- x% specifies the percent of the distance across the image from the left edge.
- y% specifies the percent of the distance down from the top edge.
Thông số type
[sửa mã nguồn]default
|
type=border
|
type=thumb
|
---|---|---|
Các ví dụ
[sửa mã nguồn]Lần đầu tiên hai ví dụ có thể được sao chép bằng cách sử dụng {{Bản đồ định vị+}}.
Sử dụng chủ yếu là các giá trị mặc định
[sửa mã nguồn]{{Điểm định vị+ | width = | image = Scotland relief location map.jpg | caption = Weather stations in Scotland | float = | type = | marks = {{Điểm định vị~ | width = | label = '''Cape Wrath''' | position = | x = 452 | y = 480 }} {{Điểm định vị~ | width = | label = '''Rattray Head''' | position = | x = 835 | y = 703 }} {{Điểm định vị~ | width = | label = '''Ardnamurchan Point''' | position = | x = 307 | y = 865 }} }}
Sử dụng màu nền cho nhãn
[sửa mã nguồn]{{Điểm định vị+ | image = North Rhine-Westphalia location map 05.svg | width = 300 | caption = Các thành phố lớn ở [[Nordrhein-Westfalen]] | type = thumb | marks = {{Điểm định vị~ | width = 300 | label = Cologne | position = right | background = #a7cb9d | x = 302 | y = 702 }} {{Điểm định vị~ | width = 300 | label = Düsseldorf | position = left | background = #a7cb9d | x = 267 | y = 574 }} {{Điểm định vị~ | width = 300 | label = Dortmund | position = right | background = #a7cb9d | x = 456 | y = 457 }} {{Điểm định vị~ | width = 300 | label = <br />Essen | position = right | background = #a7cb9d | x = 328 | y = 484 }} {{Điểm định vị~ | width = 300 | label = Duisburg | position = left | background = #a7cb9d | x = 261 | y = 496 }} }}
Sử dụng một điểm vô hình
[sửa mã nguồn]{{Điểm định vị+ | image = Take five.jpg | caption = Chú gà dễ thương | type = thumb | marks = {{Điểm định vị~ | label = Rachel | position = top | background = #ae9074 | mark = Blanksvg.svg | x = 433 | y = 295 }} {{Điểm định vị~ | label = Alice | position = top | background = #ae9074 | mark = Blanksvg.svg | x = 812 | y = 245 }} }}
Xem thêm
[sửa mã nguồn]- {{Điểm định vị}}
- {{Bản đồ định vị}}
- {{Bản đồ định vị+}}
- {{Superimpose}}
- {{Superimpose2}}
- {{Overlay}}
- {{Annotated image}}
- {{Image label}}