Tony Martin says winning gold with Germany at the Road World Championships is the perfect way to finish his career as he retires from cycling.