-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroll_binning.py
50 lines (33 loc) · 1.12 KB
/
roll_binning.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
"""
This module provides the binning method and medium velocity
"""
from enum import Enum
from qgis.PyQt.QtXml import QDomDocument, QDomNode
from .functions import toFloat
class BinningType(Enum):
cmp = 0
plane = 1
sphere = 2
BinningList = [
'Cmp binning',
'Dipping plane',
'Buried sphere',
]
class RollBinning:
def __init__(self, method=BinningType.cmp, vint=2000.0) -> None: # assign default values
self.method = method
self.vint = vint
self.slowness = None
def writeXml(self, parent: QDomNode, doc: QDomDocument):
binningElem = doc.createElement('binning')
binningElem.setAttribute('method', str(self.method.name))
binningElem.setAttribute('vint', str(self.vint))
parent.appendChild(binningElem)
return binningElem
def readXml(self, parent: QDomNode):
binningElem = parent.namedItem('binning').toElement()
if binningElem.isNull():
return False
self.method = BinningType[(binningElem.attribute('method'))]
self.vint = toFloat(binningElem.attribute('vint'), 2000.0)
return True