Debian Codegraph @

texmf-dist/tex/latex/getmap/getmap.sty

raw
1 %%
2 %% This is file `getmap.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% getmap.dtx (with options: `package')
8 %%
9 %% Copyright (C) 2014,2016,2018 by:
10 %% Josef Kleber
11 %% <[email protected]>
12 %%
13 %% This file may be distributed and/or modified under the conditions of
14 %% the LaTeX Project Public License, either version 1.3 of this license
15 %% or (at your option) any later version. The latest version of this
16 %% license is in:
17 %%
18 %% http://www.latex-project.org/lppl.txt
19 %%
20 %% and version 1.3 or later is part of all distributions of LaTeX version
21 %% 2003/12/01 or later.
22 %%
23 %% This work has the LPPL maintenance status "author-maintained".
24 %%
25 %% The Current Maintainer of this work is Josef Kleber.
26 %%
27 %% This work consists of all files listed in manifest.txt.
28 %%
29 \NeedsTeXFormat{LaTeX2e}%
30 \ProvidesPackage{getmap}[2019/03/25 v1.11 getmap.sty - Josef Kleber (C) 2014,2016,2018,2019]%
31 \RequirePackage{xkeyval}%
32 \RequirePackage{stringenc}%
33 \RequirePackage{ifthen}%
34 \RequirePackage{shellesc}%
35 \RequirePackage{ifxetex}%
36 \ifxetex%
37 \def\StringEncodingConvert#1#2#3#4%
38 {%
39 \def#1{#2}%
40 }%
41 \fi%
42 \ifluatex%
43 \def\StringEncodingConvert#1#2#3#4%
44 {%
45 \def#1{#2}%
46 }%
47 \fi%
48 \newcommand*\GM@JK@define@key[4]%
49 {%
50 \expandafter\gdef\csname#1@#3\endcsname{#4}%
51 \define@key{#2.sty}{#3}[#4]%
52 {%
53 \expandafter\gdef\csname#1@#3\endcsname{##1}%
54 }%
55 \define@key{#2}{#3}%
56 {%
57 \expandafter\def\csname#1@#3\endcsname{##1}%
58 }%
59 }%
60 \newcommand*\GM@JK@define@key@detok[4]%
61 {%
62 \expandafter\gdef\csname#1@#3\endcsname{#4}%
63 \define@key{#2.sty}{#3}[#4]%
64 {%
65 \expandafter\gdef\csname#1@#3\endcsname{\detokenize{##1}}%
66 }%
67 \define@key{#2}{#3}%
68 {%
69 \expandafter\def\csname#1@#3\endcsname{\detokenize{##1}}%
70 }%
71 }%
72 \GM@JK@define@key{GM@JK}{getmap}{mode}{osm}%
73 \GM@JK@define@key{GM@JK}{getmap}{key}{}%
74 \GM@JK@define@key{GM@JK}{getmap}{xsize}{600}%
75 \GM@JK@define@key{GM@JK}{getmap}{ysize}{400}%
76 \GM@JK@define@key{GM@JK}{getmap}{scale}{3385}%
77 \GM@JK@define@key{GM@JK}{getmap}{zoom}{}%
78 \GM@JK@define@key{GM@JK}{getmap}{type}{map}%
79 \GM@JK@define@key{GM@JK}{getmap}{imagetype}{png}%
80 \GM@JK@define@key{GM@JK}{getmap}{color}{yellow_1}%
81 \GM@JK@define@key{GM@JK}{getmap}{number}{1}%
82 \GM@JK@define@key{GM@JK}{getmap}{heading}{0}%
83 \GM@JK@define@key{GM@JK}{getmap}{fov}{90}%
84 \GM@JK@define@key{GM@JK}{getmap}{pitch}{0}%
85 \GM@JK@define@key{GM@JK}{getmap}{language}{en}%
86 \GM@JK@define@key@detok{GM@JK}{getmap}{markers}{}%
87 \GM@JK@define@key@detok{GM@JK}{getmap}{path}{}%
88 \GM@JK@define@key@detok{GM@JK}{getmap}{visible}{}%
89 \GM@JK@define@key{GM@JK}{getmap}{pathfile}{}%
90 \GM@JK@define@key{GM@JK}{getmap}{file}{getmap}%
91 \GM@JK@define@key{GM@JK}{getmap}{inputencoding}{}%
92 \GM@JK@define@key{GM@JK}{getmap}{overwrite}{true}%
93 \gdef\GM@JK@overwrite{false}%
94 \gdef\GM@JK@key{}%
95 \IfFileExists{getmap.cfg}%
96 {%
97 \input{getmap.cfg}%
98 }%
99 {%
100 \gdef\GM@JK@key{Fmjtd|luur20u22d,75=o5-9aylh6}%
101 }%
102 \@ifpackageloaded{inputenc}%
103 {%
104 \gdef\GM@JK@inputencoding{\inputencodingname}%
105 }%
106 {%
107 \gdef\GM@JK@inputencoding{utf8}%
108 }%
109 \newif\ifGM@JK@writexviii\GM@JK@writexviiifalse%
110 \ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch,language}%
111 \ProcessOptionsX\relax%
112 \ifthenelse{\equal{\GM@JK@mode}{gm}}%
113 {%
114 \gdef\GM@JK@scale{1}%
115 \gdef\GM@JK@zoom{17}%
116 \gdef\GM@JK@type{roadmap}%
117 \gdef\GM@JK@color{blue}%
118 }%
119 {}%
120 \ltx@IfUndefined{pdf@shellescape}%
121 {%
122 \PackageInfo{getmap}{\pdf@shellescape is undefined}%
123 \PackageInfo{getmap}{can not test if \write18 is available}%
124 \GM@JK@writexviiitrue%
125 }%
126 {%
127 \PackageInfo{getmap}{\pdf@shellescape is available}%
128 \ifnum\pdf@shellescape=1\relax%
129 \PackageInfo{getmap}{\write18 enabled}%
130 \GM@JK@writexviiitrue%
131 \else%
132 \GM@JK@writexviiifalse%
133 \fi%
134 }%
135 \newcommand*\GM@JK@shellescape%
136 {%
137 \ifGM@JK@writexviii\relax%
138 \ifthenelse{\equal{\GM@JK@mode}{osm}}%
139 {%
140 \ifluatex\directlua{os.setlocale('','ctype')}\fi%
141 \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"%
142 \space-m\space osm%
143 \space-k\space "\GM@JK@key@string"%
144 \space-x\space \GM@JK@xsize%
145 \space-y\space \GM@JK@ysize%
146 \space-z\space "\GM@JK@zoom"%
147 \space-s\space \GM@JK@scale%
148 \space-t\space \GM@JK@type%
149 \space-i\space \GM@JK@imagetype%
150 \space-c\space "\GM@JK@color"%
151 \space-n\space \GM@JK@number%
152 \space-o\space \GM@JK@file}%
153 }%
154 {%
155 \ifthenelse{\equal{\GM@JK@mode}{gm}}%
156 {%
157 \ifluatex\directlua{os.setlocale('','ctype')}\fi%
158 \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"%
159 \space-m\space gm%
160 \space-x\space \GM@JK@xsize%
161 \space-y\space \GM@JK@ysize%
162 \space-z\space \GM@JK@zoom%
163 \space-s\space \GM@JK@scale%
164 \space-t\space \GM@JK@type%
165 \space-i\space \GM@JK@imagetype%
166 \space-c\space "\GM@JK@color"%
167 \space-n\space \GM@JK@number%
168 \space-L\space "\GM@JK@language"%
169 \space-M\space "\GM@JK@markers@string"%
170 \space-C\space "\GM@JK@location@string"%
171 \space-P\space "\GM@JK@path@string"%
172 \space-p\space "\GM@JK@pathfile"%
173 \space-V\space "\GM@JK@visible@string"%
174 \space-o\space \GM@JK@file}%
175 }%
176 {%
177 \ifthenelse{\equal{\GM@JK@mode}{gsv}}%
178 {%
179 \ifluatex\directlua{os.setlocale('','ctype')}\fi%
180 \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"%
181 \space-m\space gsv%
182 \space-x\space \GM@JK@xsize%
183 \space-y\space \GM@JK@ysize%
184 \space-H\space \GM@JK@heading%
185 \space-F\space \GM@JK@fov%
186 \space-T\space \GM@JK@pitch%
187 \space-o\space \GM@JK@file}%
188 }%
189 {%
190 \PackageError{getmap}{invalid mode}{invalid mode! Use osm, gm or gsv!}%
191 }%
192 }%
193 }%
194 \else%
195 \PackageError{getmap}{\write18 disabled}%
196 {\write18 disabled\MessageBreak%
197 Use -shell-escape (TeXLive)\MessageBreak%
198 or\space\space--enable-write18 (MiKTeX)}%
199 \fi%
200 }%
201 \newcommand*\getmap[2][]%
202 {%
203 \begingroup%
204 \setkeys{getmap}{#1}%
205 \ifthenelse{\equal{\GM@JK@mode}{gm}}%
206 {%
207 \def\GM@JK@scale{1}%
208 \def\GM@JK@zoom{17}%
209 \def\GM@JK@type{roadmap}%
210 \def\GM@JK@color{blue}%
211 }%
212 {}%
213 \ifthenelse{\equal{\GM@JK@mode}{osm}}%
214 {%
215 \def\GM@JK@scale{3385}%
216 \def\GM@JK@zoom{}%
217 \def\GM@JK@type{map}%
218 \def\GM@JK@color{yellow_1}%
219 }%
220 {}%
221 \setkeys{getmap}{#1}%
222 \ifthenelse{\equal{\GM@JK@mode}{gsv}}%
223 {\def\GM@JK@imagetype{jpg}}{}%
224 \PackageInfo{getmap}{using \GM@JK@inputencoding\space encoding}%
225 \def\GM@JK@location{#2}%
226 \StringEncodingConvert%
227 {\GM@JK@location@string}%
228 {\detokenize\expandafter{\GM@JK@location}}%
229 {\GM@JK@inputencoding}{utf-8}%
230 \StringEncodingSuccessFailure%
231 {%
232 %success
233 }%
234 {% failure
235 \errmessage{Converting to UTF-8 failed}%
236 }%
237 \StringEncodingConvert%
238 {\GM@JK@key@string}%
239 {\detokenize\expandafter{\GM@JK@key}}%
240 {\GM@JK@inputencoding}{utf-8}%
241 \StringEncodingSuccessFailure%
242 {%
243 %success
244 }%
245 {% failure
246 \errmessage{Converting to UTF-8 failed}%
247 }%
248 \StringEncodingConvert%
249 {\GM@JK@markers@string}%
250 {\GM@JK@markers}%
251 {\GM@JK@inputencoding}{utf-8}%
252 \StringEncodingSuccessFailure%
253 {%
254 %success
255 }%
256 {% failure
257 \errmessage{Converting to UTF-8 failed}%
258 }%
259 \StringEncodingConvert%
260 {\GM@JK@path@string}%
261 {\GM@JK@path}%
262 {\GM@JK@inputencoding}{utf-8}%
263 \StringEncodingSuccessFailure%
264 {%
265 %success
266 }%
267 {% failure
268 \errmessage{Converting to UTF-8 failed}%
269 }%
270 \StringEncodingConvert%
271 {\GM@JK@visible@string}%
272 {\GM@JK@visible}%
273 {\GM@JK@inputencoding}{utf-8}%
274 \StringEncodingSuccessFailure%
275 {%
276 %success
277 }%
278 {% failure
279 \errmessage{Converting to UTF-8 failed}%
280 }%
281 \ifthenelse{\equal{\GM@JK@overwrite}{true}}%
282 {%
283 \GM@JK@shellescape%
284 }%
285 {%
286 \IfFileExists{\GM@JK@file.\GM@JK@imagetype}%
287 {%
288 \PackageInfo{getmap}{overwrite=false; (\GM@JK@file.\GM@JK@imagetype)%
289 using existing file!}%
290 }%
291 {%
292 \PackageInfo{getmap}{overwrite=false; (\GM@JK@file.\GM@JK@imagetype)%
293 file does not exist! downloading ...}%
294 \GM@JK@shellescape%
295 }%
296 }%
297 \endgroup%
298 }%
299 \endinput
300 %%
301 %% End of file `getmap.sty'.