o a@@spdZddlmZmZmZmZddlmZddl m Z ddl m Z ddl mZmZddlmZGdd d e Zd S) z This module houses the GEOSCoordSeq object, which is used internally by GEOSGeometry to house the actual coordinates of the Point, LineString, and LinearRing geometries. )byrefc_bytec_doublec_uint) prototypes)GEOSBase GEOSException)CS_PTRgeos_version_tuple)numpyc@sBeZdZdZeZdHddZddZddZd d Z d d Z d dZ ddZ ddZ ddZddZddZddZddZddZedd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Z d7d8Z!ed9d:Z"ed;d<Z#ed=d>Z$d?d@Z%edAdBZ&edCdDZ'edEdFZ(dGS)I GEOSCoordSeqzGThe internal representation of a list of coordinates inside a Geometry.FcCs"t|ts td||_||_dS)zInitialize from a GEOS pointer.z4Coordinate sequence should initialize with a CS_PTR.N) isinstancer TypeError_ptr_z)selfptrzrB/usr/lib/python3/dist-packages/django/contrib/gis/geos/coordseq.py__init__s  zGEOSCoordSeq.__init__ccs t|jD]}||VqdS)z3Iterate over each point in the coordinate sequence.N)rangesize)rirrr__iter__s zGEOSCoordSeq.__iter__cC|jS)z7Return the number of points in the coordinate sequence.)rrrrr__len__ szGEOSCoordSeq.__len__cCs t|jS)z%sc3s|] }|VqdSr7r.0rrsubstrrr sz#GEOSCoordSeq.kml..)rcjoinrr.striprrrirkmls $zGEOSCoordSeq.kmlcs6|j}|j|dkrdStfddt|DS)z3Return a tuple version of this coordinate sequence.rZrc3s|]}|VqdSr7rrg get_pointrrrksz%GEOSCoordSeq.tuple..)rr#r r)rnrrorr s zGEOSCoordSeq.tuplecCstdkr8d}t|}t|D]$}|d|}|||d||d7}|||d||d8}q|dkSt}t|jt|sLtdtjj |j dkS)zs