Fix java/C++ rendering rules property - should match types

This commit is contained in:
Victor Shcherb 2020-10-18 11:55:23 +02:00
parent 0bc9008b9f
commit 684f2b95d7

View file

@ -41,7 +41,7 @@ public class RenderingRule {
public void init(Map<String, String> attributes) { public void init(Map<String, String> attributes) {
ArrayList<RenderingRuleProperty> props = new ArrayList<RenderingRuleProperty>(attributes.size()); ArrayList<RenderingRuleProperty> props = new ArrayList<RenderingRuleProperty>(attributes.size());
intProperties = new int[attributes.size()]; intProperties = new int[attributes.size()];
floatProperties = null; floatProperties = new float[attributes.size()];
attributesRef = null; attributesRef = null;
int i = 0; int i = 0;
Iterator<Entry<String, String>> it = attributes.entrySet().iterator(); Iterator<Entry<String, String>> it = attributes.entrySet().iterator();
@ -60,11 +60,11 @@ public class RenderingRule {
intProperties[i] = storage.getDictionaryValue(vl); intProperties[i] = storage.getDictionaryValue(vl);
} else { } else {
float floatVal = property.parseFloatValue(vl); float floatVal = property.parseFloatValue(vl);
if (floatProperties == null && floatVal != 0) { // if (floatProperties == null && floatVal != 0) {
// lazy creates // // lazy creates
floatProperties = new float[attributes.size()]; // floatProperties = new float[attributes.size()];
floatProperties[i] = property.parseFloatValue(vl); floatProperties[i] = floatVal;
} // }
intProperties[i] = property.parseIntValue(vl); intProperties[i] = property.parseIntValue(vl);
} }
i++; i++;
@ -94,7 +94,7 @@ public class RenderingRule {
public float getFloatPropertyValue(String property) { public float getFloatPropertyValue(String property) {
int i = getPropertyIndex(property); int i = getPropertyIndex(property);
if(i >= 0 && floatProperties != null){ if (i >= 0) {
return floatProperties[i]; return floatProperties[i];
} }
return 0; return 0;