o 3a7@sdZddlmZmZmZddlmZddlm Z m Z ddl m Z ddl mZmZddlmZddlmZGd d d e ZGd d d eZGd dde eZGdddeZeeeeeeefe_dS)zy This module houses the Geometry Collection objects: GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon )byrefc_intc_uint) prototypes) GEOSGeometryLinearGeometryMixin)GEOM_PTR) LinearRing LineString)Point)PolygoncsxeZdZdZfddZddZddZdd Zd d Zd d Z ddZ e j Z e jZeddZeddZeZZS)GeometryCollectioncsdt|dkrt|dttfr|d}n|}n|}|||t||}tj|fi|dS)zEInitialize a Geometry Collection from a sequence of Geometry objects.rN)len isinstancetuplelist_check_allowed_create_collectionsuper__init__)selfargskwargs init_geoms collection __class__E/usr/lib/python3/dist-packages/django/contrib/gis/geos/collections.pyrs   zGeometryCollection.__init__ccs"tt|D]}||VqdS)z-Iterate over each Geometry in the Collection.N)ranger)rirrr __iter__'s zGeometryCollection.__iter__cCs|jS)z3Return the number of geometries in this Collection.)num_geomrrrr __len__,szGeometryCollection.__len__cCs2t|dd|D}tt|jt|t|S)NcSsg|] }tt|d|qS)ptr)capi geom_clonegetattr.0grrr 3sz9GeometryCollection._create_collection..)rr(create_collectionr_typeidrr)rlengthitemsgeomsrrr r1s z%GeometryCollection._create_collectioncCst|j|SN)r( get_geomnr'rindexrrr _get_single_internal:sz'GeometryCollection._get_single_internalcCstt|||jdS)zFReturn the Geometry from this Collection at the given index (0-based).)srid)rr(r)r8r9r6rrr _get_single_external=sz'GeometryCollection._get_single_externalcCs2|j}|j}||||_|r||_t|dS)zJCreate a new collection, and destroy the contents of the previous pointer.N)r'r9rr( destroy_geom)rr1r2prev_ptrr9rrr _set_listBs zGeometryCollection._set_listcCsdddd|DS)z,Return the KML for this Geometry Collection.z!%scs|]}|jVqdSr4)kmlr+rrr Qz)GeometryCollection.kml..)joinr%rrr r@NszGeometryCollection.kmlcCstdd|DS)zAReturn a tuple of all the coordinates in this Geometry Collectioncsr?r4rr+rrr rAVrBz+GeometryCollection.tuple..rDr%rrr rSszGeometryCollection.tuple)__name__ __module__ __qualname__r0rr#r&rr8r:r=r_set_single_rebuild _set_single_assign_extended_slice_rebuild_assign_extended_slicepropertyr@rcoords __classcell__rrrr r s       r c@eZdZeZdZdS) MultiPointN)rErFrGr _allowedr0rrrr rP[rPc@seZdZeefZdZdS)MultiLineStringN)rErFrGr r rRr0rrrr rT`srTc@rO) MultiPolygonN)rErFrGr rRr0rrrr rVerSrVN)__doc__ctypesrrrdjango.contrib.gis.geosrr( django.contrib.gis.geos.geometryrrdjango.contrib.gis.geos.libgeosr"django.contrib.gis.geos.linestringr r django.contrib.gis.geos.pointr django.contrib.gis.geos.polygonr r rPrTrVrRrrrr s    L