replace 'equalsIgnoreCase("POLYGON"))' with 'instanceof Polygon'