"""Enumerated types used by TIAToolbox."""from__future__importannotationsimportcontextlibimportenum
[docs]classGeometryType(enum.IntEnum):"""Integer enumerated type for different kinds of geometry. Initialize with an integer or string representation of the geometry type: 1 or "Point" -> POINT 2 or "LineString" -> LINE_STRING 3 or "Polygon" -> POLYGON 4 or "MultiPoint" -> MULTI_POINT 5 or "MultiLineString" -> MULTI_LINE_STRING 6 or "MultiPolygon" -> MULTI_POLYGON """POINT=1LINE_STRING=2POLYGON=3MULTI_POINT=4MULTI_LINE_STRING=5MULTI_POLYGON=6GEOMETRY_COLLECTION=7def__str__(self:GeometryType)->str:"""Return the string representation of the GeometryType."""returnself.name.title().replace("_"," ")@classmethoddef_missing_(cls:GeometryType,value:object)->object:"""Return the GeometryType corresponding to the value."""ifisinstance(value,str):withcontextlib.suppress(KeyError):# Replace UpperCamelCase with UPPER_CAMEL_CASEname="".join(f"_{c}"ifc.isupper()elsec.upper()forcinvalue).lstrip("_")returncls[name]returnsuper()._missing_(value)