Ticket #21286: josm_21286_v4.patch

File josm_21286_v4.patch, 4.2 KB (added by skyper, 2 years ago)

patch version 4: adds numeric test for min_height

  • resources/data/validator/combinations.mapcss

     
    4747way[length_unit                ][!waterway],
    4848way[canal                      ][!waterway],
    4949way[have_riverbank             ][!waterway],
     50area[min_height                ][!height][/^(building|building:part)$/], /* #21286 */
     51area[building:min_level        ][!building:levels][/^(building|building:part)$/], /* #21286 */
    5052*[border_type                  ][!boundary],
    5153*[piste:difficulty             ][!piste:type],
    5254*[place                        ][!name][place!=islet][place!=plot][noname!=yes],
     
    10761078  throwWarning: tr("{0} is lower than {1} on {2}.", "{1.key}", "{0.key}", "{2.tag}");
    10771079  group: tr("suspicious tag combination");
    10781080}
     1081 No newline at end of file
     1082
     1083/* #21286 */
     1084area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][min_height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][get(split(" ", tag(height)), 0) <= get(split(" ", tag(min_height)), 0)],
     1085area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?( ft)$/][min_height =~ /^[0-9]+(\.[0-9]+)?( ft)$/][get(split(" ", tag(height)), 0) <= get(split(" ", tag(min_height)), 0)],
     1086area[/^(building|building:part)$/][building:levels][building:min_level][tag("building:levels") <= tag("building:min_level")] {
     1087  throwWarning: tr("{0} is lower or equal to {1} on {2}", "{1.key}", "{2.key}", "{0.key}");
     1088  group: tr("suspicious tag combination");
     1089}
  • resources/data/validator/numeric.mapcss

    +
     
    299299  assertNoMatch: "node width=10'";
    300300}
    301301
     302*[min_height][min_height =~ /^-?[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     303  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     304  fixAdd: concat("min_height=", get(regexp_match("(-?[0-9.]+)( )*(.+)",tag("min_height")),1)," m");
     305  set min_height_meter_autofix;
     306  assertMatch: "node min_height=6.78 meters";
     307  assertMatch: "node min_height=5  metre";
     308  assertMatch: "node min_height=2m";
     309  assertNoMatch: "node min_height=2 m";
     310  assertNoMatch: "node min_height=5";
     311}
     312*[min_height][min_height =~ /^-?[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     313  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     314  fixAdd: concat("min_height=", get(regexp_match("(-?[0-9.]+)( )*(.+)",tag("min_height")),1)," ft");
     315  set min_height_foot_autofix;
     316  assertMatch: "node min_height=6.78 foot";
     317  assertMatch: "node min_height=5  Feet";
     318  assertMatch: "node min_height=2ft";
     319  assertNoMatch: "node min_height=2 ft";
     320  assertNoMatch: "node min_height=5";
     321}
     322*[min_height][min_height =~ /^-?[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     323  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     324  fixAdd: concat("min_height=", replace(tag("min_height"), ",", "."));
     325  set min_height_separator_autofix;
     326  assertMatch: "node min_height=5,5";
     327  assertMatch: "node min_height=12,00";
     328  assertMatch: "node min_height=12,5 ft";
     329  assertNoMatch: "node min_height=12,000";
     330  assertNoMatch: "node min_height=3,50,5";
     331  assertNoMatch: "node min_height=3.5";
     332  assertNoMatch: "node min_height=4";
     333}
     334*[min_height ][min_height  !~ /^(-?([0-9]+(\.[0-9]+)?( (m|ft))?)|(-?[1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.min_height_separator_autofix!.min_height_meter_autofix!.min_height_foot_autofix {
     335  throwWarning: tr("unusual value of {0}: {1} is default; point is decimal separator; if units, put space then unit", "{0.key}", tr("meters"));
     336  assertMatch: "node min_height=\"12. m\"";
     337  assertNoMatch: "node min_height=-5";
     338}
     339
    302340*[maxaxleload][maxaxleload =~ /^[0-9]+,[0-9][0-9]?( (t|kg|st|lbs))?$/] {
    303341  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    304342  fixAdd: concat("maxaxleload=", replace(tag("maxaxleload"), ",", "."));