public void setVisibility ( boolean visible ) { this . visible = visible ; if ( ! style . isFullyLoaded ( ) ) { // We are in progress of loading a new style return ; } Source source = style . getSource ( TrafficData . SOURCE_ID ) ; if ( source == null ) { initialise ( ) ; } List < Layer > layers = style . getLayers ( ) ; for ( Layer layer : layers ) { if ( layerIds . contains ( layer . getId ( ) ) ) { layer . setProperties ( visibility ( visible ? Property . VISIBLE : Property . NONE ) ) ; } } }
Toggles the visibility of the traffic layers .