-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqad_mbuffer_fun.py
51 lines (41 loc) · 1.9 KB
/
qad_mbuffer_fun.py
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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
ok
QAD Quantum Aided Design plugin
funzioni per stirare oggetti grafici
-------------------
begin : 2013-11-11
copyright : iiiii
email : hhhhh
developers : bbbbb aaaaa ggggg
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
# Import the PyQt and QGIS libraries
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from qgis.core import *
from . import qad_utils
from .qad_msg import QadMsg
from .qad_variables import QadVariables
from .qad_multi_geom import *
#===============================================================================
# buffer
#===============================================================================
def buffer(qadGeom, distance):
"""
Returns a buffer region around this geometry having the given distance.
"""
g = qadGeom.asGeom()
nSegments = QadVariables.get(QadMsg.translate("Environment variables", "ARCMINSEGMENTQTY"), 12)
bufferedGeom = g.buffer(distance, nSegments)
if bufferedGeom.isEmpty(): return None
return fromQgsGeomToQadGeom(bufferedGeom)