Template:Location map many: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Wikid77
rewrote all markers 1-9, to skip points with no latitude defined
Ookami (talk | contribs)
m 64 revisions imported
 
(34 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly>{{#invoke:Location map/multi|many}}</includeonly><noinclude>
-- Template for image with markers/labels (see bottom "NOTES")
{{Documentation}}
--
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
--  Warning: Code multi-nested 9 levels top to bottom.
--  Warning: {{Might}}{{{appear|become}}}{{unreadable}}?
--  Warning: Adding spaces can kill results.
----------------------------------------------- Begin box division
--><div style="width: {{#expr: {{{width|240}}} + 2 }}px; {{#if: {{{caption|}}}
  | padding: 3px; border: 1px solid {{#if: {{{border|}}}
    | {{{border|none}}}
    | #CCCCCC
  }}; margin: 3px;
}} float:{{#switch:{{{float|}}}
|  "center"=none | center=none  | "left"=left  | left=left
|  "right"=right | right=right  | "none"=none  | none=none
|right}}; clear:{{#switch:{{{float|}}}
|  "center"=both | center=both | "left"=left | left=left
|  "right"=right | right=right | "none"=none | none=none
|right}}; {{#if: {{{caption|}}}
  | ;background:#F9F9F9"|"
  }}><!--
---------------------------------------------- Begin Map division
--><div style="position: relative;{{#ifeq: {{{border|}}} | none |
  |border: 1px solid {{#if: {{{border|}}}
    | {{{border}}}
    | {{#if:{{{caption|}}}|#CCCCCC|none}}
  }};
}} padding: 0px; width: {{{width|240}}}px">[[image:{{#if: {{{AlternativeMap|}}} | {{{AlternativeMap}}} | {{Location map {{{1}}}|image}} }}|{{{width|240}}}px|{{#if: {{{label|}}}
  | {{{label}}}
  | {{PAGENAME}}
}}<!-- endif label--> ({{Location map {{{1}}}|name}})]]<br /><!--
================================================== Marker/Label #1
-->{{#if: {{{lat|{{{lat_deg|}}} }}}
|<!--if latitude-1 exists-->
<div style="position: absolute; z-index: 2; top: {{#expr:
  100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat_deg|}}}
    | {{#expr: {{#ifeq: {{{lat_dir|}}}|S|-1|1}} * ({{{lat_deg|0}}} + ({{{lat_min|0}}} / 60) + ({{{lat_sec|0}}} / 3600)) }}
    | {{{lat|0}}}
  }}) / ({{Location map {{{1}}}|top}} - {{Location map {{{1}}}|bottom}}) round 1
}}%; left: {{#expr:
  {{#expr:{{#if:{{Location map {{{1}}}|crosses180}}|{{#ifeq: {{{lon_dir|}}}|W|-36000/({{Location map {{{1}}}|left}}-{{Location map {{{1}}}|right}})|}}|}}}} + 100 * ({{#if: {{{lon_deg|}}}
    | {{#expr: {{#ifeq: {{{lon_dir|}}}|W|-1|1}} * ({{{lon_deg|0}}} + ({{{lon_min|0}}} / 60) + ({{{lon_sec|0}}} / 3600)) }}
    | {{{long|0}}}
  }} - {{Location map {{{1}}}|left}}) / ({{Location map {{{1}}}|right}} - {{Location map {{{1}}}|left}}) round 1
}}%; height: 0; width: 0; margin: 0; padding: 0;"><!--
------------------------------------------------ Marker#1 division
--><div style="position: relative; text-align: center; {{#if: {{{marksize|}}}
  | left: -{{#expr: {{{marksize}}} / 2 round 0 }}px; top: -{{#expr: {{{markhigh|8}}} / 2 round 0 }}px; width: {{{marksize}}}px; font-size: {{{marksize}}}px;
  | left: -{{#expr: {{#if: {{Location map {{{1}}}|marksize}}
      |{{Location map {{{1}}}|marksize}}
      |<!--else-->8}} / 2 round 0 }}px; top: -{{#expr:
    {{#if: {{Location map {{{1}}}|markhigh}}
      |{{Location map {{{1}}}|markhigh}}
      |<!--else-->8}} / 2 round 0 }}px; width: {{
    #if: {{Location map {{{1}}}|marksize}}
      |{{Location map {{{1}}}|marksize}}
      |<!--else-->8}}px; font-size: {{
    #if: {{Location map {{{1}}}|marksize}}
      |{{Location map {{{1}}}|marksize}}
      |<!--else-->8}}px;
}}"><!-- specify marker#1 -->[[Image:{{#if: {{{mark|}}}
  | {{{mark}}}
  | {{#if: {{Location map {{{1}}}|mark}}|{{Location map {{{1}}}|mark}}|Red pog.svg}}
}}|{{#if: {{{marksize|}}}
  | {{{marksize}}}
  | <!--else-->{{#if: {{Location map {{{1}}}|marksize}}
    |{{Location map {{{1}}}|marksize}}|<!--else-->8}}
  }}<!--endif-->px|{{#if: {{{label|}}}
  | {{{label}}}
  | {{PAGENAME}}
}}<!--endif label-->]]</div><!-- end-div marker1
---------------------------------------------- Label #1
-->{{#ifeq: {{{position|{{{pos|}}}}}} | none
  |
  |<div style="font-size: {{{label_size|90}}}%; line-height: 110%; position: relative; top: -1.5em; width: 6em;
  {{#switch: {{{position|{{{pos}}}}}}
    |left = left: -6.5em; text-align: right;
    |right = left: 0.5em; text-align: left;
    |top = top:-{{#expr: {{{markhigh|8}}}*1.9
              + {{{label_size|90}}}*.13 + 2.5 round 0}}px;
          left: -3em; text-align: center;
    |bottom = top:-0.15em; left: -3em; text-align: center;
    |left: 0.5em; text-align: left;
  }}"><span style="padding: 1px; {{#if: {{{background|{{{bg|}}}}}}
    | background-color: {{{background|{{{bg}}}}}};
  }}">{{{label|}}}</span></div><!-- end-div label1 -->
}}</div><!--end-div point#1--
|<!--else, no latitude1 -->}}<!--endif lat* --
================================================= Marker/Label #2
-->{{#if: {{{lat2|{{{lat2_deg|}}} }}}
|<!--if latitude2 exists-->
  <div style="position: absolute; z-index: 2;
  top: {{#expr: <!--To DEBUG, add ">" above to show calc below-->
  100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat2_deg|}}}
    | {{#expr: {{#ifeq: {{{lat2_dir|}}}|S|-1|1}}
      * ( {{{lat2_deg|0}}} + ({{{lat2_min|0}}} / 60)
        + ( {{{lat2_sec|0}}} / 3600) ) }}
    | <!--else, decimal form-->{{{lat2|0}}}
  }}) / ( {{Location map {{{1}}}|top}}
        - {{Location map {{{1}}}|bottom}} ) round 1
}}%; left: {{#expr:
  {{#expr:{{#if:{{Location map {{{1}}}|crosses180}}
    |{{#ifeq: {{{lon2_dir|}}}|W|-36000/({{Location map {{{1}}}|left}}-{{Location map {{{1}}}|right}})|}}|}}
  }} + 100 * (
  {{#if: {{{lon2_deg|}}}
    | {{#expr: {{#ifeq: {{{lon2_dir|}}}|W|-1|1}}
      * ( {{{lon2_deg|0}}} + ({{{lon2_min|0}}} / 60)
        + ({{{lon2_sec|0}}} / 3600)) }}
    | <!--else, decimal longitude-->{{{long2|0}}}
  }} - {{Location map {{{1}}}|left}}) / ({{Location map {{{1}}}|right}} - {{Location map {{{1}}}|left}}) round 1
}}%; height: 0; width: 0; margin: 0; padding: 0;"><!--
------------------------------------------------ Marker#2 division
--><div style="position: relative; text-align: center; {{#if: {{{mark2size|}}}
  | left: -{{#expr: {{{mark2size}}} / 2 round 0 }}px; top: -{{#expr: {{{mark2high|{{{mark2size|8}}} }}} / 2 round 0 }}px; width: {{{mark2size}}}px; font-size: {{{mark2size}}}px;
  | <!--else, hunt mark2size@template--> left: -{{#expr:
    {{#if: {{Location map {{{1}}}|mark2size}}
      |{{Location map {{{1}}}|mark2size}}
      |8}} / 2 round 0 }}px; top: -{{#expr:
    {{#if: {{Location map {{{1}}}|mark2high}}
      |{{Location map {{{1}}}|mark2high}}
      |<!--else-->{{{mark2size|8}}} }} / 2 round 0 }}px; width:
    {{#if: {{Location map {{{1}}}|mark2size}}
      |{{Location map {{{1}}}|mark2size}}
      |<!--else-->8}}px; font-size:
    {{#if: {{Location map {{{1}}}|mark2size}}
      |{{Location map {{{1}}}|mark2size}}
      |<!--else-->8}}px;
}}"><!-- specify marker#2 --><!--
-->[[Image:{{#if: {{{mark2|}}}
  | {{{mark2}}}
  | <!--else-->{{#if: {{Location map {{{1}}}|mark2}}
    |{{Location map {{{1}}}|mark2}}|<!--else-->Red pog.svg}}
}}|<!--
----- set image size as 'mark2size'x'mark2high' with defaults --
--    ("x" between values, defaults from named-map template or 8)
-->{{#if: {{{mark2size|}}}
  |{{{mark2size}}}x{{#if: {{{mark2high|}}}
    |{{{mark2high}}}
    |{{#if: {{Location map {{{1}}}|mark2high}}
      |{{Location map {{{1}}}|mark2high}}|8}}<!--eif-1/mark2high-->
    }}<!--eif-mark2high-->px
  |<!--else-->{{#if: {{Location map {{{1}}}|mark2size}}
    |{{Location map {{{1}}}|mark2size}}
    |<!--else-->8}}x{{#if: {{{mark2high|}}}
      |{{{mark2high}}}
      |{{#if: {{Location map {{{1}}}|mark2high}}
        |{{Location map {{{1}}}|mark2high}}|<!--else-->8}}}}px
}}|<!--endif mark2size-->{{#if: {{{label2|}}}
  | {{{label2}}}<!--set mouseover alt-text-->
  | <!--else-->{{PAGENAME}}
}}<!--endif label2-->]]</div><!-- end-div marker2
---------------------------------------------- Label #2
-->{{#ifeq: {{{position2|{{{pos2|}}}}}} | none
  |
  |<div style="font-size: {{{label2_size|90}}}%; line-height: 110%;
    position: relative; top: -1.5em; width: 6em;
    {{#switch: {{{position2|{{{pos2}}}}}}
      |left = left: -6.5em; text-align: right;
      |right = left: 0.5em; text-align: left;
      |top = top:-{{#expr: {{{mark2high|8}}}*1.9
                + {{{label2_size|90}}}*.13 + 2.5 round 0}}px;
            left: -3em; text-align: center;
      |bottom = top:-0.15em; left: -3em; text-align: center;
      |left: 0.5em; text-align: left;
  }}"><span style="padding: 1px;
    {{#if: {{{background2|{{{bg2|}}}}}}
      | background-color: {{{background2|{{{bg2}}}}}};
      }}">{{{label2|}}}</span><!--
--></div><!-- end-div label2 -->
}}</div><!--end-div point#2-->
|<!--else, no latitude2 -->}}<!--endif lat2* --
================================================= Marker/Label #3
================================================= Marker/Label #3
-->{{#if: {{{lat3|{{{lat3_deg|}}} }}}
|<!--if latitude3 exists-->
  <div style="position: absolute; z-index: 2;
  top: {{#expr: <!--To DEBUG, add ">" above to show calc below-->
  100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat3_deg|}}}
    | {{#expr: {{#ifeq: {{{lat3_dir|}}}|S|-1|1}}
      * ( {{{lat3_deg|0}}} + ({{{lat3_min|0}}} / 60)
        + ( {{{lat3_sec|0}}} / 3600) ) }}
    | <!--else, decimal form-->{{{lat3|0}}}
  }}) / ( {{Location map {{{1}}}|top}}
        - {{Location map {{{1}}}|bottom}} ) round 1
}}%; left: {{#expr:
  {{#expr:{{#if:{{Location map {{{1}}}|crosses180}}
    |{{#ifeq: {{{lon3_dir|}}}|W|-36000/({{Location map {{{1}}}|left}}-{{Location map {{{1}}}|right}})|}}|}}
  }} + 100 * (
  {{#if: {{{lon3_deg|}}}
    | {{#expr: {{#ifeq: {{{lon3_dir|}}}|W|-1|1}}
      * ( {{{lon3_deg|0}}} + ({{{lon3_min|0}}} / 60)
        + ({{{lon3_sec|0}}} / 3600)) }}
    | <!--else, decimal longitude-->{{{long3|0}}}
  }} - {{Location map {{{1}}}|left}}) / ({{Location map {{{1}}}|right}} - {{Location map {{{1}}}|left}}) round 1
}}%; height: 0; width: 0; margin: 0; padding: 0;"><!--
------------------------------------------------ Marker#3 division
--><div style="position: relative; text-align: center; {{#if: {{{mark3size|}}}
  | left: -{{#expr: {{{mark3size}}} / 2 round 0 }}px; top: -{{#expr: {{{mark3high|{{{mark3size|8}}} }}} / 2 round 0 }}px; width: {{{mark3size}}}px; font-size: {{{mark3size}}}px;
  | <!--else, hunt mark3size@template--> left: -{{#expr:
    {{#if: {{Location map {{{1}}}|mark3size}}
      |{{Location map {{{1}}}|mark3size}}
      |8}} / 2 round 0 }}px; top: -{{#expr:
    {{#if: {{Location map {{{1}}}|mark3high}}
      |{{Location map {{{1}}}|mark3high}}
      |<!--else-->{{{mark3size|8}}} }} / 2 round 0 }}px; width:
    {{#if: {{Location map {{{1}}}|mark3size}}
      |{{Location map {{{1}}}|mark3size}}
      |<!--else-->8}}px; font-size:
    {{#if: {{Location map {{{1}}}|mark3size}}
      |{{Location map {{{1}}}|mark3size}}
      |<!--else-->8}}px;
}}"><!-- specify marker#3 --><!--
-->[[Image:{{#if: {{{mark3|}}}
  | {{{mark3}}}
  | <!--else-->{{#if: {{Location map {{{1}}}|mark3}}
    |{{Location map {{{1}}}|mark3}}|<!--else-->Red pog.svg}}
}}|<!--
----- set image size as 'mark3size'x'mark3high' with defaults --
--    ("x" between values, defaults from named-map template or 8)
-->{{#if: {{{mark3size|}}}
  |{{{mark3size}}}x{{#if: {{{mark3high|}}}
    |{{{mark3high}}}
    |{{#if: {{Location map {{{1}}}|mark3high}}
      |{{Location map {{{1}}}|mark3high}}|8}}<!--eif-1/mark3high-->
    }}<!--eif-mark3high-->px
  |<!--else-->{{#if: {{Location map {{{1}}}|mark3size}}
    |{{Location map {{{1}}}|mark3size}}
    |<!--else-->8}}x{{#if: {{{mark3high|}}}
      |{{{mark3high}}}
      |{{#if: {{Location map {{{1}}}|mark3high}}
        |{{Location map {{{1}}}|mark3high}}|<!--else-->8}}}}px
}}|<!--endif mark3size-->{{#if: {{{label3|}}}
  | {{{label3}}}<!--set mouseover alt-text-->
  | <!--else-->{{PAGENAME}}
}}<!--endif label3-->]]</div><!-- end-div marker3
---------------------------------------------- Label #3
-->{{#ifeq: {{{position3|{{{pos3|}}}}}} | none
  |
  |<div style="font-size: {{{label3_size|90}}}%; line-height: 110%;
    position: relative; top: -1.5em; width: 6em;
    {{#switch: {{{position3|{{{pos3}}}}}}
      |left = left: -6.5em; text-align: right;
      |right = left: 0.5em; text-align: left;
      |top = top:-{{#expr: {{{mark3high|8}}}*1.9
                + {{{label3_size|90}}}*.13 + 2.5 round 0}}px;
            left: -3em; text-align: center;
      |bottom = top:-0.15em; left: -3em; text-align: center;
      |left: 0.5em; text-align: left;
  }}"><span style="padding: 1px;
    {{#if: {{{background3|{{{bg3|}}}}}}
      | background-color: {{{background3|{{{bg3}}}}}};
      }}">{{{label3|}}}</span><!--
--></div><!-- end-div label3 -->
}}</div><!--end-div point#3-->
|<!--else, no latitude3 -->}}<!--endif lat3* --
================================================ End All Markers
--></div><div style="font-size: 90%">{{{caption|{{#if: {{{label|}}}
  | {{{label}}}
  | {{PAGENAME}}
}} ({{Location map {{{1}}}|name}})}}}</div><!-- end-div caption --
--></div><!-- end-div overall box -->
<!-- </div></div> <!--force any divisions closed -->
</includeonly><noinclude><!--
--
-- NOTES:
--  This code generates nested HTML divisions for a box-division
--  containing a map-division with nested point-divisions, each
--  having a nested marker-image division & label division (for
--  each marker/label point), following by a caption-division.
--
--  The "map image" can be any image, allowing markers/labels to
--  annotate any picture. Set each markXsize=0 to show labels only.
--
--  [ These comments take < 1 second per 5,000 comment lines. ]
--  [ Be sure to close comments: primitive editors don't check. ]
--
--HISTORY:
-- 06Sep07 Created/debugged to allow 3 markers.
-- 08Sep07 Expanded with 6 more markers #4-#9 (of eventual 20).
-- 08Sep07 Debugged marker #9 for extraneous marker in caption.
-- 09Sep07 Rewrote to auto-position markers by marksize/markhigh.
-- 10Sep07 Rewrote to require latitudes, avoid oversized pages.
-->
{{/doc}}
 
[[Category:Graphic templates]]
[[Category:Mapping templates]]
</noinclude>
</noinclude>

Latest revision as of 17:27, 3 September 2020