class LayersToStateModels {

    public List<WMSLayerAndState> toStateModels(Collection<? extends WMSLayerValueProvider> layers)
    {
        List<WMSLayerAndState> stateModels = New.list();

        for (WMSLayerValueProvider layer : layers)
        {
            WMSLayerState state = new WMSLayerState();
            VisualizationStyle style = myMantleToolbox.getVisualizationStyleRegistry().getStyle(TileVisualizationSupport.class,
                    layer.getTypeInfo().getTypeKey(), true);
            state.setColorizeStyle(style.getStyleName());
            state.setFixedHeight(layer.getConfiguration().getFixedHeight() != null
                    && !layer.getConfiguration().getFixedHeight().equals(Integer.valueOf(0)));
            state.setFixedWidth(layer.getConfiguration().getFixedWidth() != null
                    && !layer.getConfiguration().getFixedWidth().equals(Integer.valueOf(0)));
            state.setGetMapUrl(layer.getConfiguration().getGetMapConfig().getUsableGetMapURL());

            MapVisualizationInfo mapVisInfo = layer.getTypeInfo().getMapVisualizationInfo();
            if (mapVisInfo != null)
            {
                TileLevelController leveler = mapVisInfo.getTileLevelController();
                if (leveler != null && leveler.isDivisionOverride())
                {
                    state.setHoldLevel(Integer.valueOf(leveler.getDivisionHoldGeneration()));
                }
            }

            float alpha = layer.getTypeInfo().getBasicVisualizationInfo().getTypeOpacity()
                    / (float)ColorUtilities.COLOR_COMPONENT_MAX_VALUE;
            state.setAlpha(alpha);

            state.setId(layer.getTypeInfo().getTypeKey());
            state.setMaxDisplaySize(layer.getMaximumDisplaySize());
            state.setMinDisplaySize(layer.getMinimumDisplaySize());
            state.setSplitLevels(layer.getConfiguration().getDisplayConfig().getResolveLevels());
            state.setType(layer.getConfiguration().getLayerType().toString());
            state.setUrl(layer.getTypeInfo().getUrl());
            state.setVisible(layer.getTypeInfo().isVisible());
            state.setTitle(layer.getTypeInfo().getDisplayName());

            BasicVisualizationInfo basic = layer.getTypeInfo().getBasicVisualizationInfo();
            if (basic != null && basic.getLoadsTo().isTimelineEnabled())
            {
                state.setIsAnimate(true);
            }

            fillParameters(state, layer);

            stateModels.add(new WMSLayerAndState(layer, state));
        }

        return stateModels;
    }

    public  LayersToStateModels(MantleToolbox mantleToolbox);

}