Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 6 additions & 10 deletions sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,7 +45,7 @@
*/
public class MilStdSymbol extends Feature<IGeoMilSymbol> implements IGeoMilSymbol {
static final private ICoreManager coreManager = ManagerFactory.getInstance().getCoreManager();
private final SparseArray<String> attributes = new SparseArray<>();
private SparseArray<String> attributes;

private static final int DEFAULT_SCALE = 1;
private static final int DEFAULT_PIXEL_SIZE = 150;
Expand Down Expand Up @@ -593,7 +594,6 @@ public MilStdSymbol(IGeoMilSymbol.SymbolStandard eStandard, String sSymbolCode)
setStrokeStyle(null);
setFillStyle(null);
setLabelStyle(null);
this.initializeDefaultAttributes();
}

/**
Expand Down Expand Up @@ -1430,6 +1430,10 @@ public SparseArray<String> getAttributes(int iIconSize, boolean selected, IGeoCo
return oArray;
}

public void setSymbolAttributes(final SparseArray<String> attributes) {
this.attributes = attributes;
}

/**
* This method converts the features MilStd version to a value suitable for calling the MilStd renderer.
* @return
Expand Down Expand Up @@ -1690,12 +1694,4 @@ public SparseArray<String> 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));
}
}