/** Default constructor. Makes sure everything has a default value, to minimize the chance of a NPE. */ public LegendConfig() { fontStyle = new FontStyleInfo(); fontStyle.setColor(DEFAULT_FONT_COLOR); fontStyle.setFamily(DEFAULT_FONT_FAMILY); fontStyle.setOpacity(1); fontStyle.setSize(DEFAULT_FONT_SIZE); fontStyle.setStyle("normal"); fontStyle.setWeight("normal"); fontStyle.applyDefaults(); }
/** Default constructor. Makes sure everything has a default value, to minimize the chance of a NPE. */ public LegendConfig() { fontStyle = new FontStyleInfo(); fontStyle.setColor(DEFAULT_FONT_COLOR); fontStyle.setFamily(DEFAULT_FONT_FAMILY); fontStyle.setOpacity(1); fontStyle.setSize(DEFAULT_FONT_SIZE); fontStyle.setStyle("normal"); fontStyle.setWeight("normal"); fontStyle.applyDefaults(); }
protected MapRasterizingInfo buildMap(MapPresenter mapPresenter) { MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo(); ViewPort viewPort = mapPresenter.getViewPort(); mapRasterizingInfo.setBounds(viewPort.getBounds()); mapRasterizingInfo.setScale(viewPort.getScale()); mapRasterizingInfo.setTransparent(true); LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo(); legendRasterizingInfo.setTitle("Legend"); FontStyleInfo font = new FontStyleInfo(); font.applyDefaults(); legendRasterizingInfo.setFont(font); mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo); // Support for selection of layer object : create container for info on selected features; // store the selections layer per layer List<ClientLayerInfo> selectedLayers = new ArrayList<ClientLayerInfo>(); mapRasterizingInfo.setExtraLayers(selectedLayers); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getServerConfiguration(); mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo); // Note: mapRasterizingInfo at this time is pretty empty (rastering info for // layers not yet filled in) return mapRasterizingInfo; }
private MapRasterizingInfo buildMap(MapPresenter mapPresenter) { MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo(); ViewPort viewPort = mapPresenter.getViewPort(); mapRasterizingInfo.setBounds(viewPort.getBounds()); mapRasterizingInfo.setScale(1 / viewPort.getResolution()); mapRasterizingInfo.setTransparent(true); LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo(); legendRasterizingInfo.setTitle("Legend"); FontStyleInfo font = new FontStyleInfo(); font.applyDefaults(); legendRasterizingInfo.setFont(font); mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo); // Support for selection of layer object : create container for info on selected features; // store the selections layer per layer List<ClientLayerInfo> selectedLayers = new ArrayList<ClientLayerInfo>(); mapRasterizingInfo.setExtraLayers(selectedLayers); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getHintValue(GeomajasServerExtension.MAPINFO); mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo); // Note: mapRasterizingInfo at this time is pretty empty (rastering info for // layers not yet filled in) return mapRasterizingInfo; }
/** * Applies default values to all properties that have not been set. * * @since 1.10.0 */ public void applyDefaults() { if (getName() == null) { setName(DEFAULT_NAME); } if (getFeatureStyles().size() == 0) { getFeatureStyles().add(new FeatureStyleInfo()); } for (FeatureStyleInfo featureStyle : getFeatureStyles()) { featureStyle.applyDefaults(); } if (getLabelStyle().getLabelAttributeName() == null) { getLabelStyle().setLabelAttributeName(LabelStyleInfo.ATTRIBUTE_NAME_ID); } getLabelStyle().getBackgroundStyle().applyDefaults(); getLabelStyle().getFontStyle().applyDefaults(); }