forked from rgeo/rgeo
/
line_string.rb
102 lines (81 loc) · 3.44 KB
/
line_string.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -----------------------------------------------------------------------------
#
# LineString feature interface
#
# -----------------------------------------------------------------------------
# Copyright 2010 Daniel Azuma
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the copyright holder, nor the names of any other
# contributors to this software, may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
;
module RGeo
module Feature
# == SFS 1.1 Description
#
# A LineString is a Curve with linear interpolation between Points.
# Each consecutive pair of Points defines a Line segment.
#
# == Notes
#
# LineString is defined as a module and is provided primarily
# for the sake of documentation. Implementations need not necessarily
# include this module itself. Therefore, you should not depend on the
# kind_of? method to check type. Instead, use the provided check_type
# class method (or === operator) defined in the Type module.
module LineString
include Curve
extend Type
# === SFS 1.1 Description
#
# The number of Points in this LineString.
#
# === Notes
#
# Returns an integer.
def num_points
raise Error::UnsupportedOperation, "Method LineString#num_points not defined."
end
# === SFS 1.1 Description
#
# Returns the specified Point N in this LineString.
#
# === Notes
#
# Returns an object that supports the Point interface, or nil
# if the given N is out of range. N is zero-based.
# Does not support negative indexes.
def point_n(n_)
raise Error::UnsupportedOperation, "Method LineString#point_n not defined."
end
# Returns the constituent points as an array of objects that
# support the Point interface.
def points
raise Error::UnsupportedOperation, "Method LineString#points not defined."
end
end
end
end