LinkGraph: Increase caching of link graph lines/point details
This commit is contained in:
@@ -37,9 +37,22 @@ struct LinkProperties {
|
||||
*/
|
||||
class LinkGraphOverlay {
|
||||
public:
|
||||
typedef std::map<StationID, LinkProperties> StationLinkMap;
|
||||
typedef std::map<StationID, StationLinkMap> LinkMap;
|
||||
typedef std::vector<std::pair<StationID, uint> > StationSupplyList;
|
||||
struct StationSupplyInfo {
|
||||
StationID id;
|
||||
uint quantity;
|
||||
Point pt;
|
||||
};
|
||||
|
||||
struct LinkInfo {
|
||||
StationID from_id;
|
||||
StationID to_id;
|
||||
Point from_pt;
|
||||
Point to_pt;
|
||||
LinkProperties prop;
|
||||
};
|
||||
|
||||
typedef std::vector<StationSupplyInfo> StationSupplyList;
|
||||
typedef std::vector<LinkInfo> LinkList;
|
||||
|
||||
static const uint8 LINK_COLOURS[];
|
||||
|
||||
@@ -56,7 +69,7 @@ public:
|
||||
{}
|
||||
|
||||
void RebuildCache();
|
||||
void Draw(const DrawPixelInfo *dpi) const;
|
||||
void Draw(const DrawPixelInfo *dpi);
|
||||
void SetCargoMask(uint32 cargo_mask);
|
||||
void SetCompanyMask(uint32 company_mask);
|
||||
|
||||
@@ -71,13 +84,14 @@ protected:
|
||||
const uint widget_id; ///< ID of Widget in Window to be drawn to.
|
||||
uint32 cargo_mask; ///< Bitmask of cargos to be displayed.
|
||||
uint32 company_mask; ///< Bitmask of companies to be displayed.
|
||||
LinkMap cached_links; ///< Cache for links to reduce recalculation.
|
||||
LinkList cached_links; ///< Cache for links to reduce recalculation.
|
||||
StationSupplyList cached_stations; ///< Cache for stations to be drawn.
|
||||
uint scale; ///< Width of link lines.
|
||||
uint64 last_update_number = 0; ///< Last window update number
|
||||
|
||||
Point GetStationMiddle(const Station *st) const;
|
||||
|
||||
void AddLinks(const Station *sta, const Station *stb);
|
||||
void RefreshDrawCache();
|
||||
void DrawLinks(const DrawPixelInfo *dpi) const;
|
||||
void DrawStationDots(const DrawPixelInfo *dpi) const;
|
||||
void DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const;
|
||||
|
Reference in New Issue
Block a user