Skip to content

Commit 12ade04

Browse files
committed
[sql][internal] using code in #529
1 parent 935cb8a commit 12ade04

4 files changed

Lines changed: 73 additions & 38 deletions

File tree

sql/common/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
SET(LOCAL_FILES
33
pgRouting-header.sql
44
pgrouting_version.sql
5+
_point_toId.sql
6+
_startPoint.sql
7+
_endPoint.sql
58
pgrouting_utilities.sql
69
pgr_parameter_check.sql
710
utilities_pgr.sql
811
createIndex.sql
9-
_point_toId.sql
1012
)
1113

1214
foreach (f ${LOCAL_FILES})

sql/common/_endPoint.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*PGR-GNU*****************************************************************
2+
3+
FILE: _endPoint.sql
4+
5+
Copyright (c) 2019 Regina Obe
6+
7+
------
8+
9+
This program is free software; you can redistribute it and/or modify
10+
it under the terms of the GNU General Public License as published by
11+
the Free Software Foundation; either version 2 of the License, or
12+
(at your option) any later version.
13+
14+
This program is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU General Public License for more details.
18+
19+
You should have received a copy of the GNU General Public License
20+
along with this program; if not, write to the Free Software
21+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22+
23+
********************************************************************PGR-GNU*/
24+
25+
CREATE OR REPLACE FUNCTION _pgr_endPoint(g geometry)
26+
RETURNS geometry AS
27+
$$
28+
SELECT CASE WHEN geometryType($1) ~ '^MULTI' THEN ST_EndPoint(st_geometryN($1,1))
29+
ELSE ST_EndPoint($1)
30+
END;
31+
$$
32+
LANGUAGE sql IMMUTABLE;
33+
34+
COMMENT ON FUNCTION _pgr_endPoint(geometry)
35+
IS 'pgRouting internal function';

sql/common/_startPoint.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*PGR-GNU*****************************************************************
2+
3+
FILE: _startPoint.sql
4+
5+
Copyright (c) 2019 Regina Obe
6+
7+
------
8+
9+
This program is free software; you can redistribute it and/or modify
10+
it under the terms of the GNU General Public License as published by
11+
the Free Software Foundation; either version 2 of the License, or
12+
(at your option) any later version.
13+
14+
This program is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU General Public License for more details.
18+
19+
You should have received a copy of the GNU General Public License
20+
along with this program; if not, write to the Free Software
21+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22+
23+
********************************************************************PGR-GNU*/
24+
25+
CREATE OR REPLACE FUNCTION _pgr_startpoint(g geometry)
26+
RETURNS geometry AS
27+
$$
28+
SELECT CASE WHEN geometryType($1) ~ '^MULTI' THEN ST_StartPoint(ST_geometryN($1,1))
29+
ELSE ST_StartPoint($1)
30+
END;
31+
$$
32+
LANGUAGE sql IMMUTABLE;
33+
34+
COMMENT ON FUNCTION _pgr_startPoint(geometry)
35+
IS 'pgRouting internal function';

sql/common/pgrouting_utilities.sql

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -456,40 +456,3 @@ $BODY$
456456

457457
COMMENT ON FUNCTION _pgr_versionless(TEXT, TEXT)
458458
IS 'pgRouting internal function';
459-
460-
create or replace function _pgr_startPoint(g geometry)
461-
returns geometry as
462-
$body$
463-
declare
464-
465-
begin
466-
if geometrytype(g) ~ '^MULTI' then
467-
return st_startpoint(st_geometryn(g,1));
468-
else
469-
return st_startpoint(g);
470-
end if;
471-
end;
472-
$body$
473-
language plpgsql IMMUTABLE;
474-
475-
COMMENT ON FUNCTION _pgr_startPoint(geometry)
476-
IS 'pgRouting internal function';
477-
478-
479-
create or replace function _pgr_endPoint(g geometry)
480-
returns geometry as
481-
$body$
482-
declare
483-
484-
begin
485-
if geometrytype(g) ~ '^MULTI' then
486-
return st_endpoint(st_geometryn(g,1));
487-
else
488-
return st_endpoint(g);
489-
end if;
490-
end;
491-
$body$
492-
language plpgsql IMMUTABLE;
493-
494-
COMMENT ON FUNCTION _pgr_endPoint(geometry)
495-
IS 'pgRouting internal function';

0 commit comments

Comments
 (0)