Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import colorsys
- import math
- from PIL import Image, ImageDraw, ImageFont
- buildings = [
- (( 455, 750), "Large Crane"),
- (( 525, 795), "Small Crane"),
- (( 665, 655), "Two Tequesta Point"),
- (( 765, 720), "The Palace Condominium (?)"),
- (( 835, 610), "Three Tequesta Point"),
- (( 920, 700), "???"),
- (( 960, 630), "Echo Brickell (?)"),
- ((1085, 590), "Four Seasons"),
- ((1115, 700), "Fortune House Hotel"),
- ((1170, 640), "???"),
- ((1180, 820), "Terminal F"),
- ((1235, 635), "???"),
- ((1360, 630), "Citigroup Center"),
- ((1415, 685), "???"),
- ((1475, 670), "???"),
- ((1510, 630), "Met 1"),
- ((1545, 565), "Southeast Financial Center"),
- ((1620, 670), "???"),
- ((1650, 640), "Wells Fargo Center"),
- ((1930, 695), "Flagler on the River"),
- ((1972, 745), "FAA Miami ATCT (MIA)"),
- ((2050, 695), "The Loft 2"),
- ((2080, 710), "Miami-Dade County Courthouse"),
- ((2145, 635), "Vizcayne Towers"),
- ((2195, 670), "Stephen P. Clark Government Center"),
- ((2285, 750), "???"),
- ((2430, 635), "Marina Blue"),
- ((2515, 675), "Ten Museum Park"),
- ((2600, 625), "Marquis Miami"),
- ((2930, 650), "Marriott Miami Biscayne Bay"),
- ((2980, 590), "Opera Tower"),
- ((3035, 685), "Bay Parc Apartments"),
- ((3085, 610), "The Grand"),
- ((3180, 755), "LoanDepot Park"),
- ((3250, 630), "1800 Club"),
- ((3340, 575), "Quantum on the Bay Condominium"),
- ((3345, 755), "1000 Venetian Way"),
- ((3460, 795), "Venetian Isle Condominium"),
- ((3490, 725), "???"),
- ((3570, 755), "22 Skyview Apartments (?)"),
- ((3625, 790), "Uptown Lofts"),
- ((3705, 745), "22 Biscayne Bay"),
- ((3790, 730), "New Wave Condominiums"),
- ]
- font_size = 16
- font = ImageFont.truetype("Menlo-Regular.ttf", font_size)
- def draw_marker(xy, height, name, rgb):
- x, y = xy
- draw.line((x, y, x, y - height), fill=rgb)
- w, h = get_textsize(name, font)
- tx = min(max(x - w/2, 4), 3840 - 4 - w)
- ty = y - height - 4 - font_size
- draw.text((tx, ty), name, fill=rgb, font=font)
- def get_textsize(text, font):
- l, t, r, b = draw.textbbox((0, 0), text, font=font)
- return r - l, b - t
- def hue_to_rgb(hue):
- rgb = colorsys.hsv_to_rgb(hue / 360, 1, 0.75)
- return tuple([int(x * 255) for x in rgb])
- image = Image.open("skyline0489.png")
- draw = ImageDraw.Draw(image)
- for i, (xy, name) in enumerate(buildings):
- height = 32 if name in (
- "The Loft 2"
- ) else 96 if name in (
- "Miami-Dade County Courthouse", "Vizcayne Towers",
- "Stephen P. Clark Government Center", "22 Biscayne Bay"
- ) else 128 if name in (
- ) else 192 if name in (
- "Bay Parc Apartments", "Venetian Isle Condominium"
- ) else 64
- rgb = hue_to_rgb(i / len(buildings) * 360)
- draw_marker(xy, height, name, rgb)
- image.save("skyline0489annotated.png")
- image = Image.open("../gtaforums/GTAMappingv0.034.png")
- draw = ImageDraw.Draw(image)
- scale = 556/1000
- src_x, src_y = (5455, 3480)
- fov = 54.1
- yaw = 198
- for i, ((x, y), name) in enumerate(buildings):
- rgb = hue_to_rgb(i / len(buildings) * 360)
- distance = 6000 if name in (
- "FAA Miami ATCT (MIA)"
- ) or (
- name == "???" and buildings[i - 1][1] == "Stephen P. Clark Government Center"
- ) else 2500 if name in (
- "Large Crane", "Small Crane", "Terminal F"
- ) else 2100 if name in (
- "1000 Venetian Way", "Venetian Isle Condominium"
- ) else 4000
- angle = yaw - fov / 2 + (3840 - x) / 3840 * fov
- print(f"{angle:.1f} {name}")
- dst_x = src_x + math.cos(math.radians(angle)) * distance * scale
- dst_y = src_y - math.sin(math.radians(angle)) * distance * scale
- draw.line((src_x, src_y, dst_x, dst_y), fill=rgb)
- w, h = get_textsize(name, font)
- draw.rectangle((
- dst_x - w - 8, dst_y - font_size / 2 - 2,
- dst_x, dst_y + font_size / 2 + 2
- ), fill=(255, 255, 255), outline=rgb)
- draw.text((dst_x - 4 - w, dst_y - font_size / 2 - 2), name, fill=rgb, font=font)
- src_x, src_y = 4095, 5052
- fov = 45
- yaw = 155
- rgb = (0, 255, 0)
- for i, angle in enumerate((yaw - fov / 2, yaw + fov / 2)):
- distance = [3000, 4000][i]
- dst_x = src_x + math.cos(math.radians(angle)) * distance * scale
- dst_y = src_y - math.sin(math.radians(angle)) * distance * scale
- draw.line((src_x, src_y, dst_x, dst_y), fill=rgb)
- image = image.crop((1800, 2900, 5800, 5900))
- draw = ImageDraw.Draw(image)
- rgb = 255, 255, 255
- for src, dst in (
- ((2510, 485), (2510, 505)), # Venetian Isle Condominium
- ((2645, 525), (2645, 545)), # 1000 Venetian
- ((2200, 570), (2200, 620)), # The Grand
- ((2185, 705), (2200, 675)), # Marriott Miami
- ((2015, 835), (2105, 810)), # Marquis Miami
- ((2015, 870), (2105, 842)), # Ten Museum Park
- ((2015, 905), (2105, 875)), # Marina Blue
- (None, (2105, 990)), # Vizcayne Towers
- ((1715, 2040), (1800, 1640)), # Four Seasons
- ((1635, 1970), (1805, 1620)), # Fortune House
- ((1825, 1205), (1985, 1000)), # SPC Government Center
- ((2355, 1525), (2275, 1485)), # Tequesta
- ((2355, 1570), (2275, 1570)), # Tequesta
- ((215, 2645), (215, 1955)), # Prison Shot
- ):
- if src:
- draw.line((src, dst), fill=rgb)
- x, y = dst
- draw.rectangle((x- 5, y - 5, x + 5, y + 5), fill=rgb)
- image.save("skyline0489map.png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement