private boolean hasDynamicGraphic(Graphic gr) {
// not a fixed size, let's see if it has dynamic graphics inside
for (GraphicalSymbol gs : gr.graphicalSymbols()) {
if (gs instanceof ExternalGraphic) {
ExternalGraphic eg = (ExternalGraphic) gs;
try {
Icon icon = null;
if (eg.getInlineContent() != null) {
icon = eg.getInlineContent();
} else {
String location = eg.getLocation().toExternalForm();
// expand embedded cql expression
Expression expanded = ExpressionExtractor.extractCqlExpressions(location);
// if not a literal there is an attribute dependency
if (!(expanded instanceof Literal)) {
return true;
}
Iterator<ExternalGraphicFactory> it = DynamicSymbolFactoryFinder
.getExternalGraphicFactories();
while (it.hasNext()) {
try {
icon = it.next().getIcon(null, expanded, eg.getFormat(), 16);
} catch (Exception e) {
LOGGER.log(Level.FINE,
"Error occurred evaluating external graphic", e);
}
}