Conditional Rule

It is possible to generate different successors for different conditions of rule parameters or shape attributes such as area.

PredecessorShape --> 
                     case condition1: Successor1 

case condition2: Successor2 ... else: SuccessorN

Example 1

Footprint(type) -->
      case type == "residential" : extrude(10) Envelope
      case geometry.area/2 < 200 : extrude(30) Envelope
      else : NIL

In this example, the rule Footprint takes one parameter, type, of type string. If the string is equal to "residental", the first successor is taken (i.e. the current shape is extruded by 10 units).

If the string is not equal to "residential", and the area of the current shape's geometry is smaller than 400, the second successor is taken (i.e. the current shape is extruded by 30 units).

If none of the two conditions above is true, the third successor is taken and a NIL shape is generated (NIL is a special shape symbol and means "do not generate a shape").

Conditions can arbitrarily be combined with operators && and || (boolean and / or operations), and mathematical expressions can be used.

It is also possible to nest conditions. There is no limit on the nesting level.

Example 2

Footprint(type) -->
      case type == "residential" || type == "park"     : 
				case geometry.area/2 < 200 && geometry.area > 10 : extrude(10) Envelope
				else: extrude(15) Envelope
      case type == "industrial" : extrude(100) Factory
      else : NIL

Example 2 demonstrates nested conditions and boolean operations.

Note: the case and the else statements must build a consecutive block and can not be interrupted with successors (like a switch-case block, NOT like if statements in well-known programming languages).


Copyright ©2008-2018 Esri R&D Center Zurich. All rights reserved.