

/**
 * File:    reporting_02.cga
 * Created: 15 Nov 2011 16:44:12 GMT
 * Author:  andi
 */

version "2012.1"  


# ---------------------------------------
# Attributes
# ---------------------------------------


@Group("City Attributes",0)
attr greenspacePercentage = 30
	

@Group("Building attributes", 1)
attr nFloor = ceil(rand(1,15)  *buildingHeightFactor)

@Group("Building attributes")
attr floorHeight = rand(4,5)


@Group("Footprint",3)  @Range(3,6)
attr distanceStreet = 
	20% : 0
	else : rand(3,6)

@Group("Footprint")  @Range(4,8)
attr distanceBuildings = 
	50% : 0
	else : rand(4,8)




attr onlyMass = false


@Group("Mapped",99)
attr buildingHeightFactor = 1




# ---------------------------------------
# Start with the lot
# ---------------------------------------

@Hidden
attr plotArea = 0 # used to calc FAR

@StartRule
Lot --> 
	case p(greenspacePercentage/100):
		report("Area.Greenspace",geometry.area)
		GreenSpace
	else:
		set(plotArea, geometry.area)
		report("Area.BuildUp",geometry.area)
		BuildingLot

LotInner --> Lot
LotCorner --> Lot



# ---------------------------------------
# BuildingLot
# ---------------------------------------

BuildingLot -->
	setback(distanceStreet)
		{ streetSide: OpenSpace 
		| remainder: Parcel }


Parcel -->
	setback(distanceBuildings/2)
		{ noStreetSide: OpenSpace 
		| remainder: Footprint }	

Footprint --> extrude(floorHeight*nFloor) Mass


# -----------------------
# Mass / Floors
# -----------------------

Mass -->
	MassViz
	split(y){ floorHeight: Floor }*

Floor --> comp(f){ bottom: reverseNormals FloorBottom }


	
FloorBottom -->
		report("GFA",geometry.area) 
	 	report("FAR",geometry.area/plotArea)
	 	color("#4444ff")
	 	FloorViz


# -----------------------
# Leaf Shapes 
# -----------------------





GreenSpace --> color("#22aa22") GreenSpace.
		
OpenSpace --> color("#777777")

Ground --> color("#777777")




