File: //lib/python3/dist-packages/django/contrib/gis/geos/__pycache__/linestring.cpython-310.pyc
o
�a� � @ sr d dl mZ d dlmZ d dlmZ d dlmZm Z d dl
mZ d dlm
Z
G dd� de e�ZG d d
� d
e�ZdS )� )�
prototypes)�GEOSCoordSeq)�
GEOSException)�GEOSGeometry�LinearGeometryMixin)�Point)�numpyc s� e Zd ZejZdZdZ� fdd�Zdd� Z dd� Z
d d
� ZeZdd� Z
d
d� Zdd� Zedd� �ZeZdd� Zedd� �Zedd� �Zedd� �Zedd� �Z� ZS )�
LineString� Tc s� t |�dkr|d }n|}t|ttf�s trt|tj�s td��|�d�}t |�}|s8t� j | �
d�|d� dS || jk rItd| j
j| j|f ��t|ttf� }|rl|j}t |�dkr`td ��| �|d � |d }n+d}|D ]&} t| tttf�s~td
��|du r�t | �}| �|� qpt | �|kr�td��qptt�||�t|dk�d
�}
|dkr�|
jn|
j}t|�D ]#}|r�||dd�f }
nt|| t�r�|| j}
n|| }
|||
� q�t� j | �
|
j�|d� dS )a�
Initialize on the given sequence -- may take lists, tuples, NumPy arrays
of X,Y pairs, or Point objects. If Point objects are used, ownership is
_not_ transferred to the LineString object.
Examples:
ls = LineString((1, 1), (2, 2))
ls = LineString([(1, 1), (2, 2)])
ls = LineString(array([(1, 1), (2, 2)]))
ls = LineString(Point(1, 1), Point(2, 2))
� r z-Invalid initialization input for LineStrings.�sridN)r z'%s requires at least %d points, got %s.r
zToo many dimensions.z4Each coordinate should be a sequence (list or tuple)�Dimension mismatch.� ��z)�len�
isinstance�tuple�listr �ndarray� TypeError�get�super�__init__�
_init_func�
_minlength�
ValueError� __class__�__name__�shape� _checkdimr r �capi� create_cs�bool�
_set_point_3d�
_set_point_2d�range�ptr)�self�args�kwargs�coordsr �ncoords�numpy_coordsr �ndim�coord�cs�point_setter�i�point_coords�r � �D/usr/lib/python3/dist-packages/django/contrib/gis/geos/linestring.pyr sZ
��
�zLineString.__init__c c s"