GEOS  3.11.0
CoordinateArraySequenceFactory.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 
18 #include <geos/export.h>
19 #include <geos/geom/CoordinateArraySequence.h>
20 #include <geos/geom/CoordinateSequenceFactory.h> // for inheritance
21 #include <vector>
22 
23 
24 
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class Coordinate;
29 }
30 }
31 
32 namespace geos {
33 namespace geom { // geos::geom
34 
43 
44 public:
45  std::unique_ptr<CoordinateSequence> create() const override;
46 
47  std::unique_ptr<CoordinateSequence> create(
48  std::vector<Coordinate>* coords,
49  size_t dimension) const override
50  {
51  return std::unique_ptr<CoordinateSequence>(
52  new CoordinateArraySequence(coords, dimension));
53  };
54 
55  std::unique_ptr<CoordinateSequence> create(
56  std::vector<Coordinate> && coords,
57  size_t dimension) const override
58  {
59  return std::unique_ptr<CoordinateSequence>(new CoordinateArraySequence(std::move(coords), dimension));
60  };
61 
63  std::unique_ptr<CoordinateSequence> create(std::size_t size, std::size_t dimension) const override
64  {
65  return std::unique_ptr<CoordinateSequence>(
66  new CoordinateArraySequence(size, dimension));
67  };
68 
69  std::unique_ptr<CoordinateSequence> create(const CoordinateSequence& seq) const override
70  {
71  return std::unique_ptr<CoordinateSequence>(
72  new CoordinateArraySequence(seq));
73  };
74 
79 };
80 
83 
84 } // namespace geos::geom
85 } // namespace geos
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
Creates CoordinateSequences internally represented as an array of Coordinates.
Definition: CoordinateArraySequenceFactory.h:42
std::unique_ptr< CoordinateSequence > create() const override
Returns an empty CoordinateSequence, the dimensions will be autodetected when it is populated.
static const CoordinateSequenceFactory * instance()
Returns the singleton instance of CoordinateArraySequenceFactory.
std::unique_ptr< CoordinateSequence > create(const CoordinateSequence &seq) const override
Creates a CoordinateSequence which is a copy of the given one.
Definition: CoordinateArraySequenceFactory.h:69
std::unique_ptr< CoordinateSequence > create(std::size_t size, std::size_t dimension) const override
Definition: CoordinateArraySequenceFactory.h:63
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:35
A factory to create concrete instances of CoordinateSequences.
Definition: CoordinateSequenceFactory.h:44
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
CoordinateArraySequenceFactory DefaultCoordinateSequenceFactory
This is for backward API compatibility.
Definition: CoordinateArraySequenceFactory.h:82
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25