Solved! Go to Solution.
Maybe you can tell me what you are trying to do?
public class RpwsEsriSymbolLayer extends MessageGroupLayer implements ISymbolLayer, IDisposable
public RpwsEsriSymbolLayer(DictionaryType type) { super(type); this.messageProcessor = super.getMessageProcessor(); // create a single-point, a lines and a areas layer for position // reports and spot reports each this.layers = new GraphicsLayer[Constants.LAYER_NAMES.length]; try { ObjectMapper mapper = new ObjectMapper(); JsonFactory factory = mapper.getJsonFactory(); JsonParser jp = factory.createJsonParser(Constants.SYMBOL_RENDERER_JSON); JsonNode actualObj = jp.readValueAsTree(); int index = 0; for (String name : Constants.LAYER_NAMES) { GraphicsLayer glayer = new GraphicsLayer(); glayer.setName(name); glayer.setRenderer(new SymbolRenderer(actualObj)); glayer.setSelectionColor(Color.WHITE); glayer.setVisible(true); internalAdd(glayer); this.layers[index++] = glayer; } } catch (Exception e) { // Log Error } }
/** Static names of containing layers of this group layer */ public static final String[] LAYER_NAMES = {"spot_reports", "position_reports", "spot_reports_Lines", "position_reports_Lines", "spot_reports_Areas", "position_reports_Areas" }; ... /** * String representation of the JSON used to render military symbols. */ public static final String SYMBOL_RENDERER_JSON = "{\"type\":\"dictionary\",\"dictionaryType\":\"2525C\",\"field\":\"sic\",\"symbolScaleFactor\":1.5,\"labelsVisible\":true,\"minLabelScale\":10000000,\"maxLabelScale\":0}";
Maybe you can tell me what you are trying to do?
public class RpwsEsriSymbolLayer extends MessageGroupLayer implements ISymbolLayer, IDisposable
public RpwsEsriSymbolLayer(DictionaryType type) { super(type); this.messageProcessor = super.getMessageProcessor(); // create a single-point, a lines and a areas layer for position // reports and spot reports each this.layers = new GraphicsLayer[Constants.LAYER_NAMES.length]; try { ObjectMapper mapper = new ObjectMapper(); JsonFactory factory = mapper.getJsonFactory(); JsonParser jp = factory.createJsonParser(Constants.SYMBOL_RENDERER_JSON); JsonNode actualObj = jp.readValueAsTree(); int index = 0; for (String name : Constants.LAYER_NAMES) { GraphicsLayer glayer = new GraphicsLayer(); glayer.setName(name); glayer.setRenderer(new SymbolRenderer(actualObj)); glayer.setSelectionColor(Color.WHITE); glayer.setVisible(true); internalAdd(glayer); this.layers[index++] = glayer; } } catch (Exception e) { // Log Error } }
/** Static names of containing layers of this group layer */ public static final String[] LAYER_NAMES = {"spot_reports", "position_reports", "spot_reports_Lines", "position_reports_Lines", "spot_reports_Areas", "position_reports_Areas" }; ... /** * String representation of the JSON used to render military symbols. */ public static final String SYMBOL_RENDERER_JSON = "{\"type\":\"dictionary\",\"dictionaryType\":\"2525C\",\"field\":\"sic\",\"symbolScaleFactor\":1.5,\"labelsVisible\":true,\"minLabelScale\":10000000,\"maxLabelScale\":0}";
Would it help if there was something like a LayerListEventListener which works on the MessageGroupLayer? This would fire as the graphics layers get added to the group layer.
It's certainly something I'd consider but it might not make it for the 10.2.2 release which will be out in a few weeks.