There are saveGeometry() and saveState() methods, but unfortunatley they won't apply here.

I don't think there's out-of-a-box solution for that so you may need to implement it yourself for this particular purpose.