mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

operator "Is Equal" is wrong

Open dingfengboo opened this issue 8 years ago • 2 comments

v1.4 At vector layer visualizer -> Filters The effect of "is equal" is "<=" but not "=="

dingfengboo avatar Apr 08 '18 08:04 dingfengboo

@dingfengboo nice catch, you probably already found it but changing LayerPropertyIsEqualFilterComparer class to this fixes the issue;

[Serializable]
	public class LayerPropertyIsEqualFilterComparer : LayerHasPropertyFilterComparer
	{
		public double Min;

		protected override bool PropertyComparer(object property)
		{
			if (property == null)
			{
				return false;
			}

			var propertyValue = Convert.ToDouble(property);
			if (propertyValue > Min - Mapbox.Utils.Constants.EpsilonFloatingPoint && 
				propertyValue < Min + Mapbox.Utils.Constants.EpsilonFloatingPoint)
			{
				return true;
			}
			return false;
		}
	}

brnkhy avatar Apr 09 '18 18:04 brnkhy

fix merged, thanks again @dingfengboo

brnkhy avatar Apr 10 '18 10:04 brnkhy