Improve measure filter

Makes the code more readable and displays  distance and area values exactly like in RE2.

Fix #937