correctly calculate placement depth
make sure to check the promise
don't require the background layer to be named "background"
default to map alignment when placement type is line
explicitly named parameters
port js algorithm
use trinary operator rather than || since c++ semantics for || is different
code style fixes