Board index FlightGear Support Tools Atlas

color codes in atlas don't match the default palette

Atlas is an addon that lets FlightGear users display a real-time "moving-map" of their flight.

color codes in atlas don't match the default palette

Postby tempest766 » Sun Nov 16, 2014 12:40 am

The color codes in atlas don't seem to match up with the ones in the default.pa palette file in the atlas directory. See the attached image...Oh well...I guess I cannot attach images here. SOL Kind of hard to show the problem if I can't attach the png image.

Anyway, I created a short python program that maps the elevation color codes onto a map legend panel and then compared them against the colors displayed on the atlas chart. Why the differences?

and yes, I'm mapping 4 eight bit unsigned values as rgba.

[img]???[/img] image isn't online...it's on my computer.
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21

Re: color codes in atlas don't match the default palette

Postby Gijs » Sun Nov 16, 2014 1:11 pm

Hi,

see this topic for a guide on how to post images to the forum viewtopic.php?f=19&t=8873

Cheers,
Gijs
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: color codes in atlas don't match the default palette

Postby tempest766 » Sun Nov 16, 2014 5:52 pm

Thanks. I saw it previously, but for reasons I won't debate online, I don't use 3rd party image posting services, social media, et al.

problem exists, whether or not I can upload an image of it.

the map tiles don't have the same colors as the Colour E_ entries in the default.pa file; especially pronounced the closer you get to sea level.
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21

Re: color codes in atlas don't match the default palette

Postby tempest766 » Sun Nov 16, 2014 5:57 pm

Here's the code to verify the problem. Run it yourself.

Code: Select all
#! /bin/python

# program requires the qt-4.x and PyQt4 packages to build and run

from PyQt4.QtGui import *
from PyQt4.QtCore import *

import sys
import re

class MyLegend(QLabel):
    colors=[]

    def __init__(self,parent,pf):
        QLabel.__init__(self,parent)
        p="^Colour[ \t]+E_(\-?[0-9]+)[ \t]+"
        p=("%s([0-9]+\.[0-9]+)[ \t]+")%p
        p=("%s([0-9]+\.[0-9]+)[ \t]+")%p
        p=("%s([0-9]+\.[0-9]+)[ \t]+")%p
        p=("%s([0-9]+\.[0-9]+).*")%p
        pattern=re.compile(p)
        fp=open(pf,"r")
        for i in fp.readlines():
            results=pattern.match(i)
            if (results):
                self.colors.append(
                    (int(results.group(1)),
                    int(float(results.group(2))*255),
                    int(float(results.group(3))*255),
                    int(float(results.group(4))*255),
                    int(float(results.group(5))*255))
                    )
        fp.close()
        pixmap=QPixmap(150,len(self.colors)*30)
        ptr=QPainter(pixmap)
        y=0
        for i in self.colors:
            legend="%d + "%i[0]
            base=i[0]
            thecolor=QColor(i[1],i[2],i[3],i[4])    # create rgba color from entry in palette file
            ptr.fillRect(0,y,150,30,thecolor)
            y+=30
            ptr.drawText(20,y-10,legend)            # stick some legend text on it
        ptr.end()
        self.resize(pixmap.size())
        self.setPixmap(pixmap)
           


if (__name__=="__main__"):
    app=QApplication(sys.argv)
    wrapper=QMainWindow()
    mywin=MyLegend(wrapper,"/usr/share/flightgear/Atlas/Palettes/default.pa")
    wrapper.resize(mywin.size())
    wrapper.show()
    sys.exit(app.exec_())
Last edited by Johan G on Sun Nov 16, 2014 6:21 pm, edited 1 time in total.
Reason: Helpful [code] tags
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21

Re: color codes in atlas don't match the default palette

Postby tempest766 » Sun Nov 16, 2014 6:03 pm

well, I guess not, since the forum software didn't maintain indentation, which is pretty much a requirement for python. SOL
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21

Re: color codes in atlas don't match the default palette

Postby Johan G » Sun Nov 16, 2014 6:24 pm

I added code tags to you previous post.

Unfortunately the button for adding them is not too obvious, but given some thought it looks like a prompt and a cursor [>_ ]. :wink:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: color codes in atlas don't match the default palette

Postby tempest766 » Mon Nov 17, 2014 12:42 am

thanks for reformatting. python is pretty much useless if not formatted properly.
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21

Re: color codes in atlas don't match the default palette

Postby Johan G » Mon Nov 17, 2014 8:11 pm

You are most welcome. :D

Just of curiosity, what version of Python have you run it with? (Nope, I have not tested it.)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: color codes in atlas don't match the default palette

Postby tempest766 » Tue Nov 18, 2014 1:22 am

Right now using 2.7.5 under fedora linux and can't justify python 3.x since the vast majority of available support libraries and bindings are for 2.x. Maps and cartography are kind of my thing (instruct land navigation and competitive orienteering) so the mismatched color schemes are a problem near to my heart.
tempest766
 
Posts: 37
Joined: Sun Nov 16, 2014 12:32 am
Location: Pennsylvania USA
Version: git
OS: Fedora 21


Return to Atlas

Who is online

Users browsing this forum: No registered users and 0 guests