Center conditions for a class of planar rigid polynomial differential systems