001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.osm; 003 004import org.openstreetmap.josm.gui.mappaint.ElemStyles; 005import org.openstreetmap.josm.gui.mappaint.StyleCache; 006 007/** 008 * Object that can be rendered using a cacheable style. 009 * @since 13636 010 */ 011public interface Stylable { 012 013 /** 014 * Returns the cached style. 015 * @param styles styles for which the data is retrieved 016 * @return the cached style 017 * @since 19528 (added param styles) 018 */ 019 StyleCache getCachedStyle(ElemStyles styles); 020 021 /** 022 * Sets the cached style. 023 * @param styles styles for which the data is stored 024 * @param mappaintStyle the cached style 025 * @since 19528 (added param styles) 026 */ 027 void setCachedStyle(ElemStyles styles, StyleCache mappaintStyle); 028 029 /** 030 * Clears the cached style. 031 * This should not be called from outside. Fixing the UI to add relevant 032 * get/set functions calling this implicitly is preferred, so we can have 033 * transparent cache handling in the future. 034 */ 035 void clearCachedStyle(); 036 037 /** 038 * Check if the cached style for this primitive is up to date. 039 * @param styles styles for which the data is checked 040 * @return true if the cached style for this primitive is up to date 041 * @since 13420 042 * @since 19528 (added param styles) 043 */ 044 boolean isCachedStyleUpToDate(ElemStyles styles); 045 046 /** 047 * Declare that the cached style for this primitive is up to date. 048 * @param styles styles for which the data is handled 049 * @since 13420 050 * @since 19528 (added param styles) 051 */ 052 void declareCachedStyleUpToDate(ElemStyles styles); 053}