From 5a42170bb7fc47a9545af2ae6f33c8012519e261 Mon Sep 17 00:00:00 2001 From: James Rummel Date: Mon, 11 Dec 2017 10:34:27 -0500 Subject: [PATCH 1/2] Rolling back attributes set call, setting attributes to watch eachother across specific and base class. --- .../feature/MilStd2525SinglePoint.java | 7 ++++-- .../main/java/mil/emp3/api/MilStdSymbol.java | 25 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/mapengine/worldwind/apk/src/main/java/mil/emp3/worldwind/feature/MilStd2525SinglePoint.java b/mapengine/worldwind/apk/src/main/java/mil/emp3/worldwind/feature/MilStd2525SinglePoint.java index 4911f194..edaad89a 100644 --- a/mapengine/worldwind/apk/src/main/java/mil/emp3/worldwind/feature/MilStd2525SinglePoint.java +++ b/mapengine/worldwind/apk/src/main/java/mil/emp3/worldwind/feature/MilStd2525SinglePoint.java @@ -39,11 +39,10 @@ protected EMPPlacemark(MilStd2525SinglePoint mapper, Position position) { public MilStd2525SinglePoint(MapInstance mapInstance, IMilStdRenderer iconRenderer, Position position, MilStdSymbol symbol) { super(symbol, mapInstance); - this.placemark = new EMPPlacemark(this, position); this.sSymbolCode = symbol.getSymbolCode(); this.oRenderer = iconRenderer; - this.oAttributes = symbol.getAttributes(); + this.setSymbolAttributes(); this.setSymbolModifiers(); placemark.setPickDelegate(symbol); switch (symbol.getAltitudeMode()) { @@ -71,6 +70,10 @@ private void setSymbolModifiers() { this.oModifiers = this.oRenderer.getUnitModifiers(this.getMapInstance(), this.getFeature()); } + private void setSymbolAttributes() { + this.oAttributes = this.oRenderer.getAttributes(this.getMapInstance(), this.getFeature(), this.isSelected()); + this.getSymbol().setSymbolAttributes(this.oAttributes); + } public SparseArray getSymbolModifiers() { return this.oModifiers; diff --git a/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java b/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java index 009d90f6..37231c5f 100644 --- a/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java +++ b/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java @@ -4,6 +4,7 @@ import org.cmapi.primitives.GeoColor; import org.cmapi.primitives.GeoFillStyle; +import org.cmapi.primitives.GeoLabelStyle; import org.cmapi.primitives.GeoMilSymbol; import org.cmapi.primitives.GeoPosition; import org.cmapi.primitives.GeoStrokeStyle; @@ -44,7 +45,7 @@ */ public class MilStdSymbol extends Feature implements IGeoMilSymbol { static final private ICoreManager coreManager = ManagerFactory.getInstance().getCoreManager(); - private final SparseArray attributes = new SparseArray<>(); + private SparseArray attributes; private static final int DEFAULT_SCALE = 1; private static final int DEFAULT_PIXEL_SIZE = 150; @@ -593,7 +594,7 @@ public MilStdSymbol(IGeoMilSymbol.SymbolStandard eStandard, String sSymbolCode) setStrokeStyle(null); setFillStyle(null); setLabelStyle(null); - this.initializeDefaultAttributes(); +// this.initializeDefaultAttributes(); } /** @@ -1430,6 +1431,10 @@ public SparseArray getAttributes(int iIconSize, boolean selected, IGeoCo return oArray; } + public void setSymbolAttributes(final SparseArray attributes) { + this.attributes = attributes; + } + /** * This method converts the features MilStd version to a value suitable for calling the MilStd renderer. * @return @@ -1690,12 +1695,12 @@ public SparseArray getAttributes() { return this.attributes; } - private void initializeDefaultAttributes() { - // TODO - The addition of attributes in the symbol causes an empty sparse array. - // TODO - Previously we had passed null as the attribute array which caused the renderer to use preset defaults - // TODO - when rendering. We can no longer do that as we need to use the array. Find these defaults and set them, - // TODO - The below are only guesses. I have had difficulty finding the actual defaults. - this.attributes.put(MilStdAttributes.Scale, Integer.toString(DEFAULT_SCALE)); - this.attributes.put(MilStdAttributes.PixelSize, Integer.toString(DEFAULT_PIXEL_SIZE)); - } +// private void initializeDefaultAttributes() { +// // TODO - The addition of attributes in the symbol causes an empty sparse array. +// // TODO - Previously we had passed null as the attribute array which caused the renderer to use preset defaults +// // TODO - when rendering. We can no longer do that as we need to use the array. Find these defaults and set them, +// // TODO - The below are only guesses. I have had difficulty finding the actual defaults. +// this.attributes.put(MilStdAttributes.Scale, Integer.toString(DEFAULT_SCALE)); +// this.attributes.put(MilStdAttributes.PixelSize, Integer.toString(DEFAULT_PIXEL_SIZE)); +// } } From 272c6bf51abe0d80e58b768f7bcda03fbfd84f10 Mon Sep 17 00:00:00 2001 From: James Rummel Date: Mon, 11 Dec 2017 10:43:45 -0500 Subject: [PATCH 2/2] Removed commented out code. --- sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java b/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java index 37231c5f..47c11ffe 100644 --- a/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java +++ b/sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java @@ -594,7 +594,6 @@ public MilStdSymbol(IGeoMilSymbol.SymbolStandard eStandard, String sSymbolCode) setStrokeStyle(null); setFillStyle(null); setLabelStyle(null); -// this.initializeDefaultAttributes(); } /** @@ -1695,12 +1694,4 @@ public SparseArray getAttributes() { return this.attributes; } -// private void initializeDefaultAttributes() { -// // TODO - The addition of attributes in the symbol causes an empty sparse array. -// // TODO - Previously we had passed null as the attribute array which caused the renderer to use preset defaults -// // TODO - when rendering. We can no longer do that as we need to use the array. Find these defaults and set them, -// // TODO - The below are only guesses. I have had difficulty finding the actual defaults. -// this.attributes.put(MilStdAttributes.Scale, Integer.toString(DEFAULT_SCALE)); -// this.attributes.put(MilStdAttributes.PixelSize, Integer.toString(DEFAULT_PIXEL_SIZE)); -// } }