LegendItemComponentInfo item = new LegendItemComponentInfo();
LegendIconComponentInfo icon = new LegendIconComponentInfo();
icon.setLabel(text);
icon.setStyleInfo(styleDefinition);
icon.setLayerType(layerInfo.getLayerType());
LabelComponentInfo legendLabel = new LabelComponentInfo();
legendLabel.setBackgroundColor("0xFFFFFF");
legendLabel.setBorderColor("0x000000");
legendLabel.setFontColor("0x000000");
legendLabel.setFont(legend.getFont());
legendLabel.setText(text);
legendLabel.setTextOnly(true);
item.addChild(icon);
item.addChild(legendLabel);
legend.addChild(item);
}
} else if (layer instanceof RasterLayer && layer.isShowing()) {
RasterLayer rasterLayer = (RasterLayer) layer;
ClientRasterLayerInfo layerInfo = rasterLayer.getLayerInfo();
LegendItemComponentInfo item = new LegendItemComponentInfo();
LegendIconComponentInfo icon = new LegendIconComponentInfo();
icon.setLabel(layerInfo.getLabel());
icon.setLayerType(layerInfo.getLayerType());
LabelComponentInfo legendLabel = new LabelComponentInfo();
legendLabel.setFont(legend.getFont());
legendLabel.setBackgroundColor("0xFFFFFF");
legendLabel.setBorderColor("0x000000");
legendLabel.setFontColor("0x000000");
legendLabel.setText(layerInfo.getLabel());
legendLabel.setTextOnly(true);
item.addChild(icon);
item.addChild(legendLabel);
legend.addChild(item);
}
}