shapereader
Read ESRI shapefiles
shp-polygon.h
Go to the documentation of this file.
1/*
2 * Read ESRI shapefiles
3 *
4 * Copyright (C) 2023 Andreas Vögele
5 *
6 * This library is free software; you can redistribute it and/or modify it
7 * under either the terms of the ISC License or the same terms as Perl.
8 */
9
10/* SPDX-License-Identifier: ISC OR Artistic-1.0-Perl OR GPL-1.0-or-later */
11
16#ifndef _SHAPEREADER_SHP_POLYGON_H
17#define _SHAPEREADER_SHP_POLYGON_H
18
19#include "shp-point.h"
20#include <stddef.h>
21
30typedef struct shp_polygon_t {
31 double x_min;
32 double x_max;
33 double y_min;
34 double y_max;
35 size_t num_parts;
36 size_t num_points;
37 const char *parts; /* Index to first point in part */
38 const char *points; /* X and Y coordinates */
40
55extern size_t shp_polygon_points(const shp_polygon_t *polygon,
56 size_t part_num, size_t *start, size_t *end);
57
86extern void shp_polygon_point(const shp_polygon_t *polygon, size_t point_num,
87 shp_point_t *point);
88
106extern int shp_point_in_polygon(const shp_point_t *point,
107 const shp_polygon_t *polygon);
108
109#endif
Point.
Definition: shp-point.h:24
int shp_point_in_polygon(const shp_point_t *point, const shp_polygon_t *polygon)
Check whether a point is in a polygon.
Definition: shp-polygon.c:67
Polygon.
Definition: shp-polygon.h:30
size_t num_points
Total number of points.
Definition: shp-polygon.h:36
void shp_polygon_point(const shp_polygon_t *polygon, size_t point_num, shp_point_t *point)
Get a Point.
Definition: shp-polygon.c:52
double x_max
X maximum value.
Definition: shp-polygon.h:32
size_t shp_polygon_points(const shp_polygon_t *polygon, size_t part_num, size_t *start, size_t *end)
Get the points that form a part.
Definition: shp-polygon.c:17
double y_max
Y maximum value.
Definition: shp-polygon.h:34
size_t num_parts
Number of parts.
Definition: shp-polygon.h:35
double x_min
X minimum value.
Definition: shp-polygon.h:31
double y_min
Y minimum value.
Definition: shp-polygon.h:33