Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- GUI frontend for planet.exe
- */
- /*
- Usage: planet [options]
- options:
- -s seed Specifies seed as number between 0.0 and 1.0
- -w width Specifies width in pixels, default = 800
- -h height Specifies height in pixels, default = 600
- -m magnification Specifies magnification, default = 1.0
- -o output_file Specifies output file, default is standard output
- -l longitude Specifies longitude of centre in degrees, default = 0.0
- -L latitude Specifies latitude of centre in degrees, default = 0.0
- -g gridsize Specifies vertical gridsize in degrees, default = 0.0 (no grid)
- -G gridsize Specifies horisontal gridsize in degrees, default = 0.0 (no grid)
- -i init_alt Specifies initial altitude (default = -0.02)
- -c Colour depends on latitude (default: only altitude)
- -C file Read colour definitions from file
- -O Produce a black and white outline map
- -E Trace the edges of land in black on colour map
- -B Use ``bumpmap'' shading
- -b Use ``bumpmap'' shading on land only
- -d Use ``daylight'' shading
- -a angle Angle of ``light'' in bumpmap shading
- or longitude of sun in daylight shading
- -A latitude Latitude of sun in daylight shading
- -P Use PPM file format (default is BMP)
- -x Use XPM file format (default is BMP)
- -V number Distance contribution to variation (default = 0.035)
- -v number Altitude contribution to variation (default = 0.45)
- -p projection Specifies projection: m = Mercator (default)
- p = Peters
- q = Square
- s = Stereographic
- o = Orthographic
- g = Gnomonic
- a = Area preserving azimuthal
- c = Conical (conformal)
- M = Mollweide
- S = Sinusoidal
- h = Heightfield
- i = Icosahedral
- f = Find match, see below
- */
- #SingleInstance horse
- GUI font, s9, Segoe UI
- ;{ planet.exe options
- GUI add, text, , Seed (0 ~ 1, omit 0.)
- GUI add, edit, xp+200 yp vseed number w150, 11111 ; -s seed
- GUI add, text, xm, Width (px)
- GUI add, edit, xp+200 yp vwidth number w150, 800 ; -w width
- GUI add, text, xm, Height (px)
- GUI add, edit, xp+200 yp vheight number w150, 600 ; -h height
- GUI add, text, xm, Magnification (×)
- GUI add, edit, xp+200 yp vmagnification w150, 1 ; -m magnification
- ; output is downloads\mover -o out
- GUI add, text, xm, Centred longitude (°)
- GUI add, edit, xp+200 yp w150, 0 ; -l longitude
- GUI add, UpDown, vlongitude Range-360-360 ; -g Gridsize
- GUI add, text, xm, Centred latitude (°)
- GUI add, edit, xp+200 yp w150, 0 ; -L latitude
- GUI add, UpDown, vlatitude Range-90-90 ; -G gridsize
- GUI add, text, xm, Degrees per vertical gridline (°)
- GUI add, DDL, xp+200 yp w150 vvertGridline, 0||1|2|3|5|6|10|15|20|30|45|60|90 ; -g Gridsize
- GUI add, text, xm, Degrees per horizontal gridline (°)
- GUI add, DDL, xp+200 yp w150 vhorizGridline, 0||1|2|3|5|6|10|15|20|30|45 ; -G gridsize
- GUI add, text, xm, Amount of Land
- ;~ GUI add, edit, xp+200 yp vseaLevel w150, -0.2 ; -i *(multiply this number by 0.1 before exporting!!!)
- GUI add, text, vMinSlider yp xp, None
- GUI add, text, vMaxSlider yp xp, Lots
- GUI add, Slider, Range-1000-1000 xp+200 yp vseaLevel w150 Buddy1MinSlider Buddy2MaxSlider tickinterval200 ToolTipLeft Page200, -200 ; -i *(multiply this number by 0.0001 before exporting!!!)
- GUI add, text, xm, Projection type
- GUI add, DDL, xp+200 yp sort vProjectionType w150
- , Mercator|Peters|Square|Stereographic|Orthographic|Gnomonic|Area-preserving azimuthal|Conical|Mollweide||Sinusoidal|Heightfield|Icosahedral
- ; m, p, q, s, o, g, a, c, M, S, h, i
- GUI add, text, xm, Colour Scheme
- GUI add, DDL, xp+200 yp sort vColourScheme w150
- , Olsson.col|default.col|defaultB.col|burrows.col|burrowsB.col|Lefebvre.col||Lefebvre2.col|mars.col|wood.col|white.col
- GUI add, groupbox, r4 w350 xm, Daylight option
- GUI add, checkbox, vsunshade xp+15 yp+25, Shade by sun ; -d
- GUI add, text, xm+15 y+10, Sun longitude
- GUI add, edit, xp+185 w135, 0 ; -a
- GUI add, UpDown, vsunLongitude Range-360-360
- GUI add, text, xm+15 y+5, Sun latitude
- GUI add, edit, xp+185 w135, 0 ; -A
- GUI add, UpDown, vsunLatitude Range-90-90
- GUI add, checkbox, vcolouringDependsLatitude xm, Colour depends on latitude ; -c
- GUI add, checkbox, voutlineOnly, Produce a black and white outline map ; -O
- GUI add, checkbox, vblackCoastlines, Trace the edges of land in black on colour map ; -E
- /*
- GUI add, groupbox, r8, Bumpmap shading
- GUI add, radio, xm+15 yp+15 vBumpNone, No bumpmap shading
- GUI add, radio, vBumpAll, Bumpmap shading on land and sea
- GUI add, radio, vBumpLand, Bumpmap shading on land only
- */
- ;}
- ;{ Imagemagick options
- GUI add, Groupbox, xm+400 ym w350 r3.5 section, External border
- GUI add, radio, xp+15 yp+25 vBorderNone Checked, None
- GUI add, radio, vBorderInclude, Include within dimensions
- GUI add, radio, vBorderExclude, Append outside dimensions
- GUI add, Groupbox, xs w350 r4.5 section, Scale Bar
- GUI add, radio, xp+15 yp+25 vScaleBarNone Checked, No scale bar
- GUI add, radio, vScaleBarBelow, Scale bar outside image
- GUI add, radio, vScaleBarInside, Scale bar inside image
- GUI add, checkbox, vScaleBarDisclaimer disabled, Insert scale bar disclaimer text
- GUI add, checkbox, vshowCommand xs, Show Command used (debug)
- ;}
- GUI add, button, xm w150 gBegin section, OK
- GUI add, button, ys xs+160 w150 gEnd, Cancel
- GUI show, Center, planet.exe
- Return
- Begin:
- GUI submit
- ; ---
- ; Remake the options
- FormatTime, currTime, , yyyyMMddHHmmss
- currTime = %A_MyDocuments%\Junk\maps\%currTime%-%seed%
- seed = -s 0.%seed%
- width := width = 800 ? "" : " -w " width
- height := height = 600 ? "" : " -h " height
- magnification := magnification = 1 ? "" : " -m " magnification
- longitude := longitude = 0 ? "" : " -l " longitude
- latitude := latitude = 0 ? "" : " -L " latitude
- vertGridline := vertGridline = 0 ? "" : " -g " vertGridline
- horizGridline := horizGridline = 0 ? "" : " -G " horizGridline
- seaLevel := seaLevel = -0.2 ? "" : " -i " (seaLevel / 10000)
- projection := projectionType = "Mercator" ? ""
- : projectionType = "Peters" ? " -pp "
- : projectionType = "Square" ? " -pq "
- : projectionType = "Stereographic" ? " -ps "
- : projectionType = "Orthographic" ? " -po "
- : projectionType = "Gnomonic" ? " -pg"
- : projectionType = "Area-preserving azimuthal" ? " -pa "
- : projectionType = "Conical" ? " -pc "
- : projectionType = "Mollweide" ? " -pM "
- : projectionType = "Sinusoidal" ? " -pS "
- : projectionType = "Heightfield" ? " -ph "
- : projectionType = "Icosahedral" ? " -pi " : ""
- ColourScheme := ColourScheme = "Olsson.col" ? "" : " -C " ColourScheme
- if sunshade
- sunshade := " -d -a " sunLongitude " -A " sunLatitude, altPiping := true
- else
- sunshade =
- options := seed . width . height . magnification . longitude . latitude . vertGridline
- . horizGridline . seaLevel . projection . ColourScheme . sunshade
- ; ---
- ; concat 'em and throw them into the program; pipe it to pngout for maximum pngness
- initCommands = echo Options: %options% && pause && planet.exe %options% ;Common command core
- if BorderInclude ;borders
- crop = -shave 76x76 -bordercolor black -border 1 -bordercolor white -border 75
- else if BorderExclude
- crop = -bordercolor black -border 1 -bordercolor white -border 75
- else
- crop =
- if ScaleBarBelow ;scale bar.
- scaleBar = -background white -gravity South -splice 0x40 scaleWhite.png -gravity East -append
- else if ScaleBarInside
- scaleBar = - | composite -gravity SouthEast scale.png -
- else
- crop =
- pngout = pngout - %currTime%.png
- display = %currTime%.png
- workingDir = C:\Program Files (x86)\planet\
- if altPiping ; planet.exe seems to have trouble stdouting .bmp files if sun shading is activated.
- command = %initCommands% -o %currTime%.bmp && convert %currTime%.bmp %crop% %scaleBar% png:- | %pngout% && %display%
- else
- command = %initCommands% | convert bmp:- %crop% %scaleBar% png:- | %pngout% && %display%
- ifEqual showCommand, 1, MsgBox %command%
- else, RunWait %comspec% /c "%command%", %workingDir%
- FileDelete %currTime%.bmp ; The BMP is temp and wasting useless space anyway.
- ; Bleed through
- End:
- GUI Destroy
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment