KPublicTransport::Line

Search for usage in LXR

#include <line.h>

Public Types

enum  Mode {
  Unknown , Air , Boat , Bus ,
  BusRapidTransit , Coach , Ferry , Funicular ,
  LocalTrain , LongDistanceTrain , Metro , RailShuttle ,
  RapidTransit , Shuttle , Taxi , Train ,
  Tramway , RideShare , AerialLift
}
 

Properties

QColor color
 
bool hasColor
 
bool hasLogo
 
bool hasModeLogo
 
bool hasTextColor
 
QString iconName
 
QString logo
 
KPublicTransport::Line::Mode mode
 
QString modeIconName
 
QString modeLogo
 
QString modeString
 
QString name
 
QString operatorName
 
QColor textColor
 

Public Member Functions

void applyMetaData (const Location &location, bool download)
 
bool hasColor () const
 
bool hasLogo () const
 
bool hasModeLogo () const
 
bool hasTextColor () const
 
QString iconName () const
 
QString logo () const
 
QString modeIconName () const
 
QString modeLogo () const
 

Static Public Member Functions

static Line fromJson (const QJsonObject &obj)
 
static bool isSame (const Line &lhs, const Line &rhs)
 
static Line merge (const Line &lhs, const Line &rhs)
 
static Q_INVOKABLE QString modeIconName (KPublicTransport::Line::Mode mode)
 
static QJsonObject toJson (const Line &l)
 

Detailed Description

A public transport line.

Definition at line 19 of file line.h.

Member Enumeration Documentation

◆ Mode

Mode of transportation.

@toto direct copy from Navitia, we maybe can reduce that a bit

Enumerator
RideShare 

peer-to-peer ride sharing/car pooling

AerialLift 

aerial cable cars, gondolas, etc

Definition at line 27 of file line.h.

Property Documentation

◆ color

QColor Line::color
readwrite

Color of the line.

Definition at line 53 of file line.h.

◆ hasColor

bool KPublicTransport::Line::hasColor
read

true if a line color is set.

Definition at line 55 of file line.h.

◆ hasLogo

bool KPublicTransport::Line::hasLogo
read

true if the line has a logo.

Definition at line 75 of file line.h.

◆ hasModeLogo

bool KPublicTransport::Line::hasModeLogo
read

true if the line has a mode logo.

Definition at line 86 of file line.h.

◆ hasTextColor

bool KPublicTransport::Line::hasTextColor
read

true if a text color is set.

Definition at line 59 of file line.h.

◆ iconName

QString KPublicTransport::Line::iconName
read

The best available icon for this line.

Either the line logo, mode logo or generic mode icon. Can be a file: or qrc: URI or a XDG icon name.

Note
Line and product logos are full-color, the generic ones are monochrome colorable Breeze SVG icons.

Definition at line 103 of file line.h.

◆ logo

QString KPublicTransport::Line::logo
read

Path of a local file containing the line logo.

A line logo is typically a simple icon containing the short line name and color. This is downloaded on demand, and therefore might not be available immediately.

Definition at line 73 of file line.h.

◆ mode

KPublicTransport::Line::Mode KPublicTransport::Line::mode
readwrite

Type of transport.

Definition at line 61 of file line.h.

◆ modeIconName

QString KPublicTransport::Line::modeIconName
read

Generic icon for the line mode.

See also
modeIconName(Line::Mode)

Definition at line 94 of file line.h.

◆ modeLogo

QString KPublicTransport::Line::modeLogo
read

Path of a local file containing the line mode logo.

A mode logo is the logo of the mode of transportation, or "product" this line belongs to, such as the general logo for a subway or metro service of this operator or in this city. This is downloaded on demand, and therefore might not be available immediately.

Definition at line 84 of file line.h.

◆ modeString

QString KPublicTransport::Line::modeString
readwrite

Human readable representation of the type of transport.

This is not necessarily a simple 1:1 mapping from mode, but can contain e.g. a product name.

Definition at line 66 of file line.h.

◆ name

QString KPublicTransport::Line::name
readwrite

Name of the line.

Definition at line 51 of file line.h.

◆ operatorName

QString KPublicTransport::Line::operatorName
readwrite

Name of the operator running this line.

Definition at line 89 of file line.h.

◆ textColor

QColor KPublicTransport::Line::textColor
readwrite

Text color to use on top of the line color.

Definition at line 57 of file line.h.

Member Function Documentation

◆ applyMetaData()

void Line::applyMetaData ( const Location & location,
bool download )

Look up line meta data and apply what is found.

Parameters
locationA location on or close to the line.
downloadWhen set to true, not yet locally present logo URLs are retrieved.

Definition at line 202 of file line.cpp.

◆ fromJson()

Line Line::fromJson ( const QJsonObject & obj)
staticnodiscard

Deserialize an object from JSON.

Note
Line meta data isn't serialized, so you might need to call applyLineMetaData() again after loading a line.

Definition at line 225 of file line.cpp.

◆ hasColor()

bool Line::hasColor ( ) const
nodiscard

Definition at line 63 of file line.cpp.

◆ hasLogo()

bool Line::hasLogo ( ) const
nodiscard

Definition at line 78 of file line.cpp.

◆ hasModeLogo()

bool Line::hasModeLogo ( ) const
nodiscard

Definition at line 88 of file line.cpp.

◆ hasTextColor()

bool Line::hasTextColor ( ) const
nodiscard

Definition at line 68 of file line.cpp.

◆ iconName()

QString Line::iconName ( ) const
nodiscard

Definition at line 141 of file line.cpp.

◆ isSame()

bool Line::isSame ( const Line & lhs,
const Line & rhs )
staticnodiscard

Checks if to instances refer to the same line (which does not necessarily mean they are exactly equal).

Definition at line 152 of file line.cpp.

◆ logo()

QString Line::logo ( ) const
nodiscard

Definition at line 73 of file line.cpp.

◆ merge()

Line Line::merge ( const Line & lhs,
const Line & rhs )
staticnodiscard

Merge two Line instances.

This assumes isSame(lhs, rhs) and tries to preserve the most detailed information.

Definition at line 180 of file line.cpp.

◆ modeIconName() [1/2]

QString Line::modeIconName ( ) const
nodiscard

Definition at line 93 of file line.cpp.

◆ modeIconName() [2/2]

QString Line::modeIconName ( KPublicTransport::Line::Mode mode)
staticnodiscard

Name of an icon to represent mode.

Can be an qrc: URL or a icon name compatbile with QIcon::fromTheme.

Definition at line 98 of file line.cpp.

◆ modeLogo()

QString Line::modeLogo ( ) const
nodiscard

Definition at line 83 of file line.cpp.

◆ toJson()

QJsonObject Line::toJson ( const Line & l)
staticnodiscard

Serializes one object to JSON.

Definition at line 216 of file line.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:22 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.