本文整理汇总了Python中qgis.core.QgsPoint.x方法的典型用法代码示例。如果您正苦于以下问题:Python QgsPoint.x方法的具体用法?Python QgsPoint.x怎么用?Python QgsPoint.x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.core.QgsPoint
的用法示例。
在下文中一共展示了QgsPoint.x方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calculateSquare
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def calculateSquare(self, point):
'''
point in layer coordinates(QgsPoint)
'''
mapCrs = self.canvas.mapSettings().destinationCrs()
utmCrs = QgsCoordinateReferenceSystem()
utmCrs.createFromProj4(self.proj4Utm(point))
ctFwd = QgsCoordinateTransform(mapCrs, utmCrs)
ctBwd = QgsCoordinateTransform(utmCrs, mapCrs)
pointGeom = QgsGeometry.fromPoint(point)
pointGeom.transform(ctFwd)
pointUtm = QgsPoint(pointGeom.asPoint())
# calculate d
d = self.diagonal/(2*(2**0.5))
l = pointUtm.x() - d
b = pointUtm.y() - d
r = pointUtm.x() + d
t = pointUtm.y() + d
p1 = QgsGeometry.fromPoint(QgsPoint(l, b))
p2 = QgsGeometry.fromPoint(QgsPoint(r, b))
p3 = QgsGeometry.fromPoint(QgsPoint(r, t))
p4 = QgsGeometry.fromPoint(QgsPoint(l, t))
p1.transform(ctBwd)
p2.transform(ctBwd)
p3.transform(ctBwd)
p4.transform(ctBwd)
mapPol = [p1.asPoint(), p2.asPoint(), p3.asPoint(), p4.asPoint(), p1.asPoint()]
return mapPol
示例2: draw_position
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def draw_position(self,Latitud,Longitud,v_layer,option):
#create the provider and add the layer
pr = v_layer.dataProvider()
QgsMapLayerRegistry.instance().addMapLayers([v_layer])
seg = QgsFeature()
#create the point and paint it
try:
point_A = QgsPoint((float(Longitud)-181-6.339908),(float(Latitud)-91+39.478360))
seg.setGeometry(QgsGeometry.fromPoint(point_A))
pr.addFeatures( [ seg ] )
v_layer.updateExtents()
v_layer.triggerRepaint()
label=None
if option==1:
label=self.dlg.label_6
elif option==2:
label=self.dlg.label_7
elif option==3:
label=self.dlg.label_8
if self.pointInLimits(point_A.x(),point_A.y())==True:
label.setText("IN")
self.distances(point_A.x(),point_A.y(),option)
else:
label.setText("OUT")
self.deletePoints(v_layer)
except:
pass
示例3: map
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def map(self, p):
# move to origin (translation part 1)
p = QgsPoint(p.x() - self.dx1, p.y() - self.dy1)
# scale
p = QgsPoint(self.ds * p.x(), self.ds * p.y())
# rotation
p = QgsPoint(
math.cos(self.da) * p.x() - math.sin(self.da) * p.y(), math.sin(self.da) * p.x() + math.cos(self.da) * p.y()
)
# remove to right spot (translation part 2)
p = QgsPoint(p.x() + self.dx2, p.y() + self.dy2)
return p
示例4: showRect
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def showRect(self, startPoint, param, rotAngle=0):
"""
Draws a rectangle in the canvas
"""
self.rubberBand.reset(QGis.Polygon)
x = startPoint.x() # center point x
y = startPoint.y() # center point y
# rotation angle is always applied in reference to center point
# to avoid unnecessary calculations
c = cos(rotAngle)
s = sin(rotAngle)
# translating coordinate system to rubberband centroid
point1 = QgsPoint((- param), (- param))
point2 = QgsPoint((- param), ( param))
point3 = QgsPoint((param), ( param))
point4 = QgsPoint((param), (- param))
# rotating and moving to original coord. sys.
point1_ = QgsPoint(point1.x()*c - point1.y()*s + x, point1.y()*c + point1.x()*s + y)
point2_ = QgsPoint(point2.x()*c - point2.y()*s + x, point2.y()*c + point2.x()*s + y)
point3_ = QgsPoint(point3.x()*c - point3.y()*s + x, point3.y()*c + point3.x()*s + y)
point4_ = QgsPoint(point4.x()*c - point4.y()*s + x, point4.y()*c + point4.x()*s + y)
self.rubberBand.addPoint(point1_, False)
self.rubberBand.addPoint(point2_, False)
self.rubberBand.addPoint(point3_, False)
self.rubberBand.addPoint(point4_, True)
self.rubberBand.show()
self.currentCentroid = startPoint
示例5: canvasMoveEvent
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def canvasMoveEvent(self, event):
if self.snapCursorRubberBand:
self.snapCursorRubberBand.hide()
self.snapCursorRubberBand.reset(geometryType=QGis.Point)
self.snapCursorRubberBand = None
oldPoint = QgsPoint(event.mapPoint())
event.snapPoint(QgsMapMouseEvent.SnapProjectConfig)
point = QgsPoint(event.mapPoint())
if oldPoint != point:
self.createSnapCursor(point)
point = QgsPoint(event.mapPoint())
if self.qntPoint == 1:
self.distanceToolTip.canvasMoveEvent(self.geometry[0], point)
geom = QgsGeometry.fromPolyline([self.geometry[0], point])
self.rubberBand.setToGeometry(geom, None)
elif self.qntPoint >= 2:
self.distanceToolTip.canvasMoveEvent(self.geometry[-1], point)
if self.free:
geom = QgsGeometry.fromPolygon([self.geometry+[QgsPoint(point.x(), point.y())]])
self.rubberBand.setToGeometry(geom, None)
else:
if (self.qntPoint % 2 == 1):
self.setAvoidStyleSnapRubberBand()
else:
self.setAllowedStyleSnapRubberBand()
projectedMousePoint = self.projectPoint(self.geometry[-2], self.geometry[-1], point)
if projectedMousePoint:
geom, pf = self.completePolygon(self.geometry, projectedMousePoint)
self.rubberBand.setToGeometry(geom, None)
示例6: _calc_north
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def _calc_north(self):
extent = self.canvas.extent()
if self.canvas.layerCount() == 0 or extent.isEmpty():
print "No layers or extent"
return 0
outcrs = self.canvas.mapSettings().destinationCrs()
if outcrs.isValid() and not outcrs.geographicFlag():
crs = QgsCoordinateReferenceSystem()
crs.createFromOgcWmsCrs("EPSG:4326")
transform = QgsCoordinateTransform(outcrs, crs)
p1 = QgsPoint(extent.center())
p2 = QgsPoint(p1.x(), p1.y() + extent.height() * 0.25)
try:
pp1 = transform.transform(p1)
pp2 = transform.transform(p2)
except QgsCsException:
roam.utils.warning("North arrow. Error transforming.")
return None
area = QgsDistanceArea()
area.setEllipsoid(crs.ellipsoidAcronym())
area.setEllipsoidalMode(True)
area.setSourceCrs(crs)
distance, angle, _ = area.computeDistanceBearing(pp1, pp2)
angle = math.degrees(angle)
return angle
else:
return 0
示例7: TestQgsPoint
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
class TestQgsPoint(unittest.TestCase):
def __init__(self, methodName):
"""Run once on class initialization."""
unittest.TestCase.__init__(self, methodName)
def setUp(self):
self.mPoint = QgsPoint(10.0, 10.0)
def test_Point(self):
myExpectedValue = 10.0
myActualValue = self.mPoint.x()
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
assert myExpectedValue == myActualValue, myMessage
def test_pointToString(self):
myExpectedValue = '10, 10'
myActualValue = self.mPoint.toString()
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
assert myExpectedValue == myActualValue, myMessage
def test_hash(self):
a = QgsPoint(2.0, 1.0)
b = QgsPoint(2.0, 2.0)
c = QgsPoint(1.0, 2.0)
d = QgsPoint(1.0, 1.0)
e = QgsPoint(2.0, 1.0)
assert a.__hash__() != b.__hash__()
assert e.__hash__() == a.__hash__()
mySet = set([a, b, c, d, e])
assert len(mySet) == 4
示例8: normalizePoint
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def normalizePoint(self, x, y):
"""Normalize given point. In result, lower-left is (0, 0) and upper-right is (1, 1)."""
pt = QgsPoint(x, y)
if self._rotation:
pt = self.rotatePoint(pt, -self._rotation, self._center)
rect = self._unrotated_rect
return QgsPoint((pt.x() - rect.xMinimum()) / rect.width(),
(pt.y() - rect.yMinimum()) / rect.height())
示例9: Observation
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
class Observation():
def __init__(self, iface, obsType, point, observation, precision):
memoryLayers = MemoryLayers(iface)
self.lineLayer = memoryLayers.line_layer()
self.pointLayer = memoryLayers.point_layer()
# generate ID;
self.id = datetime.now().strftime("%Y%m%d%H%M%S%f")
# obsservations are stored in the lineLayer layer attributes:
# 0: id
# 1: observation type
# 2: x
# 3: y
# 4: observation
# 5: precision
self.obsType = obsType
self.point = QgsPoint(point)
self.observation = observation
self.precision = precision
def geometry(self):
return QgsGeometry()
def save(self):
# observation
f = QgsFeature()
fields = self.lineLayer.dataProvider().fields()
f.setFields(fields)
f["id"] = self.id
f["type"] = self.obsType
f["x"] = self.point.x()
f["y"] = self.point.y()
f["observation"] = self.observation
f["precision"] = self.precision
f.setGeometry(self.geometry())
ok, l = self.lineLayer.dataProvider().addFeatures([f])
self.lineLayer.updateExtents()
self.lineLayer.setCacheImage(None)
self.lineLayer.triggerRepaint()
self.lineLayer.featureAdded.emit(l[0].id()) # emit signal so feature is added to snapping index
# center
f = QgsFeature()
fields = self.pointLayer.dataProvider().fields()
f.setFields(fields)
f["id"] = self.id
f.setGeometry(QgsGeometry().fromPoint(self.point))
ok, l = self.pointLayer.dataProvider().addFeatures([f])
self.pointLayer.updateExtents()
self.pointLayer.setCacheImage(None)
self.pointLayer.triggerRepaint()
self.pointLayer.featureAdded.emit(l[0].id()) # emit signal so feature is added to snapping index
示例10: arc
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def arc(p1, p2, offset=1):
# point in middle
mp = QgsPoint((p1.x()+p2.x())/2, (p1.y()+p2.y())/2)
# distance between the two points
d = sqrt(p1.sqrDist(p2))
# orthogonal direction to segment p1-p2
az = (p1.azimuth(p2)+90)*pi/180
# create point distant to segment of offset of segment length, will be center of circular arc
cp = QgsPoint(mp.x()+d*offset*sin(az),
mp.y()+d*offset*cos(az))
# radius
r = d*sqrt(4*offset*offset+1)/2
# calculate start and end azimuth of circular arc
az1 = cp.azimuth(p1)
az2 = cp.azimuth(p2)
if az2 < az1:
az2 += 360
# draw arc
vx = [cp.x()+r*sin(az*pi/180) for az in floatrange(az1, az2, 5)]
vy = [cp.y()+r*cos(az*pi/180) for az in floatrange(az1, az2, 5)]
arcLine = [QgsPoint(vx[i], vy[i]) for i in range(len(vx))]
return QgsGeometry().fromPolyline(arcLine)
示例11: cntr2bugs
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def cntr2bugs(self):
mLayer = self.checklayer()
if mLayer is not None:
QApplication.setOverrideCursor(Qt.WaitCursor)
dlg = editor.Dialog()
dlg.setModal(True)
dlg.setWindowTitle("Centroids in BUGS format")
provider = mLayer.dataProvider()
e = provider.featureCount()
ids = []
x = "x = c("
y = "y = c("
feats = provider.getFeatures()
dlg.emit(SIGNAL("runStatus(PyQt_PyObject)"), 0)
dlg.emit(SIGNAL("runRange(PyQt_PyObject)"), (0, e))
ne = 0
feat = QgsFeature()
while feats.nextFeature(feat):
ne += 1
dlg.emit(SIGNAL("runStatus(PyQt_PyObject)"), ne)
ids.append(feat.id())
mod = min(ids)
for ne in range(mod, e + mod):
feat = QgsFeature()
pt = QgsPoint()
fiter = mLayer.getFeatures(QgsFeatureRequest(ne))
if fiter.nextFeature(feat):
pt = QgsGeometry(feat.geometry().centroid()).asPoint()
# pt = QgsGeometry(geom.centroid()).asPoint()
x += '%s, ' % pt.x()
y += '%s, ' % pt.y()
dlg.plainTextEdit.appendPlainText(x[:-2]+')')
dlg.plainTextEdit.appendPlainText(y[:-2]+')')
QApplication.restoreOverrideCursor()
dlg.exec_()
示例12: TestQgsPoint
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
class TestQgsPoint(TestCase):
def __init__(self, methodName):
"""Run once on class initialisation."""
unittest.TestCase.__init__(self, methodName)
def setUp(self):
self.mPoint = QgsPoint(10.0, 10.0)
def test_Point(self):
myExpectedValue = 10.0
myActualValue = self.mPoint.x()
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
assert myExpectedValue == myActualValue, myMessage
def test_pointToString(self):
myExpectedValue = '10, 10'
myActualValue = self.mPoint.toString()
myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myActualValue)
assert myExpectedValue == myActualValue, myMessage
示例13: do_operation
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
def do_operation(self):
""" perform create mapping scheme operation """
# input/output verification already performed during set input/ouput
fp_layer = self.inputs[0].value
zone_field = self.inputs[1].value
# aggregate footprint into grids
logAPICall.log('aggregate statistic for grid ...', logAPICall.DEBUG)
total_features = fp_layer.dataProvider().featureCount()
if total_features > MAX_FEATURES_IN_MEMORY:
# use bsddb to store temporary lat/lon
tmp_db_file = '%sdb_%s.db' % (self._tmp_dir, get_unique_filename())
db = bsddb.btopen(tmp_db_file, 'c')
use_db = True
else:
db = {}
use_db = False
zone_idx = layer_field_index(fp_layer, zone_field)
for f in layer_features(fp_layer):
geom = f.geometry()
zone_str = str(f.attributeMap()[zone_idx].toString())
centroid = geom.centroid().asPoint()
# use floor, this truncates all points within grid to grid's
# bottom-left corner
x = math.floor(centroid.x() / DEFAULT_GRID_SIZE)
y = math.floor(centroid.y() / DEFAULT_GRID_SIZE)
key = '%s %d %d' % (zone_str, x,y)
if db.has_key(key):
db[key] = str(int(db[key]) + 1)
else:
db[key] = '1'
# output grid
logAPICall.log('create grid ...', logAPICall.DEBUG)
fields = {
0 : QgsField(self._lon_field, QVariant.Double),
1 : QgsField(self._lat_field, QVariant.Double),
2 : QgsField(CNT_FIELD_NAME, QVariant.Double),
3 : QgsField(zone_field, QVariant.String),
}
grid_layername = 'grid_%s' % get_unique_filename()
grid_file = '%s%s.shp' % (self._tmp_dir, grid_layername)
try:
writer = QgsVectorFileWriter(grid_file, "utf-8", fields, QGis.WKBPoint , self._crs, "ESRI Shapefile")
f = QgsFeature()
for key, val in db.iteritems():
(zone_str, x, y) = key.split(' ')
# point were aggregated to grid's bottom-left corner
# add half grid size to place point at center of grid
point = QgsPoint(int(x)*DEFAULT_GRID_SIZE+(DEFAULT_GRID_SIZE/2.0),
int(y)*DEFAULT_GRID_SIZE+(DEFAULT_GRID_SIZE/2.0))
f.setGeometry(QgsGeometry.fromPoint(point))
f.addAttribute(0, QVariant(point.x()))
f.addAttribute(1, QVariant(point.y()))
f.addAttribute(2, QVariant(val))
f.addAttribute(3, QVariant(zone_str))
writer.addFeature(f)
del writer
except Exception as err:
remove_shapefile(grid_file)
raise OperatorError("error creating joined grid: " % err, self.__class__)
grid_layer = load_shapefile(grid_file, grid_layername)
if not grid_layer:
raise OperatorError('Error loading created grid file' % (grid_file), self.__class__)
# clean up
if use_db:
db.close()
os.remove(tmp_db_file)
# done
self.outputs[0].value = grid_layer
self.outputs[1].value = grid_file
示例14: MobileItem
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
class MobileItem(QObject):
'''
A Mobile Item that reveives its position from a dataprovider
and is displayed on the canvas
Could be everything liek vehicles or simple beacons
'''
mobileItemCount = 0
newPosition = pyqtSignal(float, QgsPoint, float, float)
newAttitude = pyqtSignal(float, float, float) # heading, pitch, roll
timeout = pyqtSignal()
def __init__(self, iface, params={}, parent=None):
'''
Constructor
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
:param params: A dictionary defining all the properties of the item
:type params: dictionary
:param parent: Parent object for the new item. Defaults None.
:type parent: QObject
'''
super(MobileItem, self).__init__(parent)
self.iface = iface
self.canvas = iface.mapCanvas()
MobileItem.mobileItemCount += 1
self.name = params.setdefault('Name', 'MobileItem_' +
str(MobileItem.mobileItemCount))
self.marker = PositionMarker(self.canvas, params)
self.marker.setToolTip(self.name)
self.dataProvider = params.get('provider', dict())
self.messageFilter = dict()
self.extData = dict()
self.coordinates = None
self.position = None
self.heading = 0.0
self.depth = 0.0
self.lastFix = 0.0
self.crsXform = QgsCoordinateTransform()
self.crsXform.setSourceCrs(QgsCoordinateReferenceSystem(4326))
self.onCrsChange()
self.canvas.destinationCrsChanged.connect(self.onCrsChange)
self.timer = QTimer(self)
self.timer.timeout.connect(self.timeout)
self.notifyCount = int(params.get('nofixNotify', 0))
if self.notifyCount:
self.timer.timeout.connect(self.notifyTimeout)
self.timeoutCount = 0
self.timeoutTime = int(params.get('timeout', 3000))
self.notifyDuration = int(params.get('NotifyDuration', 0))
self.enabled = True
def removeFromCanvas(self):
'''
Remove the item and its track from the canvas
'''
self.marker.removeFromCanvas()
def properties(self):
'''
Return the items properties as dictionary
:returns: Items properties
:rtype: dict
'''
d = {'Name' : self.name,
'timeout': self.timeoutTime,
'nofixNotify': self.notifyCount,
'enabled': self.enabled,
'provider' : self.dataProvider}
d.update(self.marker.properties())
return d
def subscribePositionProvider(self, provider, filterId=None):
'''
Subscribe the provider for this item
by connecting to the providers signals
:param provider: Provider to connect to
:type provider: DataProvider
:param filterId: Filter Id for this item
:type filterId:
'''
provider.newDataReceived.connect(self.processNewData)
if filterId is not None:
self.messageFilter[provider.name] = filterId
elif provider.name in self.messageFilter.keys():
self.messageFilter.pop(provider.name, None)
def unsubscribePositionProvider(self, provider):
'''
Unsubscribe provider by disconnecting the providers signals
:param provider: Provider to diconnect from
:type provider: DataProvider
'''
try:
provider.newDataReceived.disconnect(self.processData)
self.messageFilter.pop(provider.name, None)
#.........这里部分代码省略.........
示例15: Arc
# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import x [as 别名]
class Arc():
def __init__(self, p1, p2, p3=None):
if p3 is None:
p3 = QgsPoint(p2)
p2 = self.createMiddlePoint(p1, p3)
self.p1 = QgsPoint(p1)
self.p2 = QgsPoint(p2)
self.p3 = QgsPoint(p3)
def setPoint(self, point):
self.p2 = point
def createMiddlePoint(self, p1, p3):
direction = [-(p1.y()-p3.y()), p1.x()-p3.x()]
length = sqrt(p1.sqrDist(p3))
return QgsPoint((p1.x()+p3.x())/2 + direction[0] * .2 * length,
(p1.y()+p3.y())/2 + direction[1] * .2 * length)
def geometry(self):
# code taken from cadtools/circulararc.py
# credits to Stefan Ziegler
coords = [self.p1]
featurePitch = 2
featureAngle = 5
center = self.getArcCenter(self.p1, self.p2, self.p3)
if center is None:
coords.append(self.p3)
return QgsGeometry().fromPolyline(coords)
cx = center.x()
cy = center.y()
px = self.p2.x()
py = self.p2.y()
r = ((cx-px) * (cx-px) + (cy-py) * (cy-py)) ** 0.5
arcIncr = 2.0 * acos(1.0 - (featurePitch / 1000) / r)
arcIncr = featureAngle * pi / 180
a1 = atan2(self.p1.y() - center.y(), self.p1.x() - center.x())
a2 = atan2(self.p2.y() - center.y(), self.p2.x() - center.x())
a3 = atan2(self.p3.y() - center.y(), self.p3.x() - center.x())
# Clockwise
if a1 > a2 > a3:
sweep = a3 - a1
# Counter-clockwise
elif a1 < a2 < a3:
sweep = a3 - a1
# Clockwise, wrap
elif a3 < a1 < a2 or a2 < a3 < a1:
sweep = a3 - a1 + 2*pi
# Counter-clockwise, wrap
elif a3 > a1 > a2 or a2 > a3 > a1:
sweep = a3 - a1 - 2*pi
else:
sweep = 0.0
ptcount = int(ceil(fabs(sweep / arcIncr)))
if sweep < 0:
arcIncr *= -1.0
angle = a1
for i in range(0, ptcount-1):
angle += arcIncr
if arcIncr > 0.0 and angle > pi:
angle -= 2*pi
if arcIncr < 0.0 and angle < -1*pi:
angle -= 2*pi
x = cx + r * cos(angle)
y = cy + r * sin(angle)
coords.append(QgsPoint(x, y))
if angle < a2 < angle+arcIncr:
coords.append(self.p2)
if angle > a2 > angle+arcIncr:
coords.append(self.p2)
coords.append(self.p3)
return QgsGeometry().fromPolyline(coords)
def getArcCenter(self, p1, p2, p3):
bx = p1.x()
by = p1.y()
cx = p2.x()
cy = p2.y()
dx = p3.x()
dy = p3.y()
temp = cx * cx + cy * cy
bc = (bx * bx + by * by - temp) / 2.0
cd = (temp - dx * dx - dy * dy) / 2.0
det = (bx - cx) * (cy - dy) - (cx - dx) * (by - cy)
try:
det = 1 / det
x = (bc * (cy - dy) - cd * (by - cy)) * det
y = ((bx - cx) * cd - (cx - dx) * bc) * det
return QgsPoint(x, y)
except ZeroDivisionError:
return None