would it not make sense to have a getCentroid method on ol.geom.Polygon with the code here which can get improved later on? So that the TODO is in a more central place?