Skip to content

Commit 69aba13

Browse files
authored
Merge pull request #42 from mixedbredie/master
Updated alphashape.py to use BBOX
2 parents 4996e20 + d36f226 commit 69aba13

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

functions/alphashape.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def getName(self):
1414

1515
@classmethod
1616
def getControlNames(self, version):
17-
return [
17+
self.version = version
18+
return self.commonControls + self.commonBoxes + [
1819
'labelId', 'lineEditId',
1920
'labelSource', 'lineEditSource',
2021
'labelTarget', 'lineEditTarget',
@@ -35,6 +36,7 @@ def prepare(self, canvasItemList):
3536
resultAreaRubberBand.reset(Utils.getRubberBandType(True))
3637

3738
def getQuery(self, args):
39+
args['where_clause'] = self.whereClause(args['edge_table'], args['geometry'], args['BBOX'])
3840
if args['version'] < 2.1:
3941
return """
4042
SELECT x, y FROM pgr_alphashape($$
@@ -46,7 +48,7 @@ def getQuery(self, args):
4648
%(target)s::int4 AS target,
4749
%(cost)s::float8 AS cost%(reverse_cost)s
4850
FROM %(edge_table)s
49-
WHERE %(edge_table)s.%(geometry)s && %(BBOX)s',
51+
%(where_clause)s',
5052
%(source_id)s, %(distance)s,
5153
%(directed)s, %(has_reverse_cost)s)
5254
),
@@ -72,7 +74,7 @@ def getQuery(self, args):
7274
%(target)s AS target,
7375
%(cost)s AS cost%(reverse_cost)s
7476
FROM %(edge_table)s
75-
WHERE %(edge_table)s.%(geometry)s && %(BBOX)s',
77+
%(where_clause)s',
7678
%(source_id)s, %(distance)s,
7779
%(directed)s)
7880
),
@@ -93,13 +95,13 @@ def getExportQuery(self, args):
9395
SELECT 1 AS seq, ST_SetSRID(pgr_pointsAsPolygon, 0) AS path_geom FROM pgr_pointsAsPolygon($$
9496
WITH
9597
dd AS (
96-
SELECT seq, id1 AS _node FROM pgr_drivingDistance(''
98+
SELECT seq, id1 AS _node FROM pgr_drivingDistance('
9799
SELECT %(id)s::int4 AS id,
98100
%(source)s::int4 AS source,
99101
%(target)s::int4 AS target,
100102
%(cost)s::float8 AS cost%(reverse_cost)s
101103
FROM %(edge_table)s
102-
WHERE %(edge_table)s.%(geometry)s && %(BBOX)s'',
104+
%(where_clause)s',
103105
%(source_id)s, %(distance)s,
104106
%(directed)s, %(has_reverse_cost)s)
105107
),
@@ -116,13 +118,13 @@ def getExportQuery(self, args):
116118
SELECT 1 AS seq, ST_SetSRID(pgr_pointsAsPolygon, 0) AS path_geom FROM pgr_pointsAsPolygon($$
117119
WITH
118120
dd AS (
119-
SELECT seq, node AS _node FROM pgr_drivingDistance(''
121+
SELECT seq, node AS _node FROM pgr_drivingDistance('
120122
SELECT %(id)s AS id,
121123
%(source)s AS source,
122124
%(target)s AS target,
123125
%(cost)s AS cost%(reverse_cost)s
124126
FROM %(edge_table)s
125-
WHERE %(edge_table)s.%(geometry)s && %(BBOX)s'',
127+
%(where_clause)s',
126128
%(source_id)s, %(distance)s,
127129
%(directed)s)
128130
),
@@ -137,8 +139,6 @@ def getExportQuery(self, args):
137139

138140

139141

140-
141-
142142
def draw(self, rows, con, args, geomType, canvasItemList, mapCanvas):
143143
resultAreaRubberBand = canvasItemList['area']
144144
trans = None

0 commit comments

Comments
 (0)