From: Frederick W. <fre...@go...> - 2012-01-07 18:45:32
|
Would you please git push this to origin/master? (patches extracted after local branch rebase on Erik's last changes) Originally, I just aimed at adding some interactivity to the hex map (highlighting for mouseovers and more - details see below). But it turned out that rails' response times would not support that (especially if no background map was used). Therefore, the attached series of patches also includes a complete refactoring of the hex map. The key point here is that each layer (tiles, routes, etc.) has its own off-screen buffer into which it exclusively draws and that paintComponent copies these buffers 1:1 except if there were really some changes on the layer (this is supported by an invalidation mechanism). As a result, the performance / responsiveness of the hex map has vastly improved. =================== commit 008edc0b9be69fcd66918d533a1a02f6fff5a63c Added highlighting of private companies' hexes triggered by mouse-over Triggers have been installed on the labels of private companies that are displayed on the start round auction, the OR panel (including the menu), and the game status. commit aa6bde64d2d0502a5aac79c11ed533dd1c06da3b Added off-screen image buffers for hexMap layers and invalidation logic Vastly improved performance of painting the hex map by the following. Defined layers according to the prior drawing order of hexmap's paintComponent (tiles, routes, markings, tokens and texts). HexMap manages these layers is no JComponent any more. Each layer: - is a JComponent and has its z order in MapPanel, - only draws its content if it has been changed, - only draws into its own permanent off-screen drawing buffer, - copies drawing buffer to MapPanel for making its contents visible. Supported this by introducing a new invalidation logic (eg., repaintTiles) that: - indicates to the affected layer which portions are to be re-drawn, - averts redraw of inaffected layers - is triggered by the hexmap or GUIHex whenever possible (no need for triggering by consumers ORPanel, ORUIManager, etc.) commit 4a74fcc8fc7dfaecd87e1644feb9945d10287ad3 Added config option for highlighting and public company highlighting Introduced highlighting for public/minor companies, displaying their home/destination hexes. Added config option for highlighting within the map tab. It applies to all triggers (ORPanel and StatusWindow) except for the menu items (for which highlighting will always take place). Fixed an issue with highlighting privates of portfolios. Now, portfolios are evaluated not during registration but during the mouse over event. commit eea148a1e256b41e66c92471e40aa628fd1fce1d Enabled company network info upon click on company captions If the caption of a company (both in ORPanel and StatusWindow) is clicked, its network info is displayed as if the corresponding network info menu item had been clicked. commit a63b9f693300fb1aa2edb66ac1f9f74832dbd048 Added hex highlighting on mouse position and fixed tooltips Added a new layer on top-most z-order for tool tips. By this means, tool tips are available again (they were not displayed any more after having introduced layered off-screen buffers). Provided for highlighting of the hex under the mouse pointer. commit 684a6125513c1e935b3cba1dd64a1b92d3c7b22c Added dirty region handling for hexmap's routes layer Changes to the train routes do not lead to a redraw of the complete layered pane any more. This has been achieved by adding logic for determining the region affected by train route changes. Apart from further performance gains, this also fixes prior issue that routes were not correctly refreshed. commit 1a5972f9c38b951a63bd333aadf328963c2b697b Added handling of concurrent hex map paints The key blocks / methods are now synchronized on the hex map (acting as the monitor). This became necessary after observing very rare paintComponent calls with invalid clip rectangles (out of JComponent bounds), leading to out-of-bounds paints of the background map. After this addition, no further occurrence of this symptom could be observed. |