예제 #1
0
	def positionYRankWithDifferentX(self, path, fromRect, toRect):
		if fromRect.center().x() < toRect.center().x(): 
			s, t = fromRect, toRect
			moveDir = self.moveDir
		else: 
			s, t = toRect, fromRect
			moveDir = Cell.invertDir(self.moveDir)
		if moveDir == Cell.NEG: 
			startY, endY = s.top(), t.bottom()
			sControlY, tControlY = startY-(s.height()/2), endY+(t.height()/2)
		else: 
			startY, endY = s.bottom(), t.top()
			sControlY, tControlY = startY+(s.height()/2), endY-(t.height()/2)
		
		# Source is always left of target
		path.moveTo(s.center().x(), startY)
		sp = QPointF(s.left()+s.width(), sControlY)
		tp = QPointF(t.right()-t.width(), tControlY)
		end = QPointF(t.center().x(), endY)
		path.cubicTo(sp, tp, end)
예제 #2
0
    def positionYRankWithDifferentX(self, path, fromRect, toRect):
        if fromRect.center().x() < toRect.center().x():
            s, t = fromRect, toRect
            moveDir = self.moveDir
        else:
            s, t = toRect, fromRect
            moveDir = Cell.invertDir(self.moveDir)
        if moveDir == Cell.NEG:
            startY, endY = s.top(), t.bottom()
            sControlY, tControlY = startY - (s.height() /
                                             2), endY + (t.height() / 2)
        else:
            startY, endY = s.bottom(), t.top()
            sControlY, tControlY = startY + (s.height() /
                                             2), endY - (t.height() / 2)

        # Source is always left of target
        path.moveTo(s.center().x(), startY)
        sp = QPointF(s.left() + s.width(), sControlY)
        tp = QPointF(t.right() - t.width(), tControlY)
        end = QPointF(t.center().x(), endY)
        path.cubicTo(sp, tp, end)
예제 #3
0
	def positionXRankWithDifferentY(self, path, fromRect, toRect):
		if fromRect.center().y() > toRect.center().y(): 
			s, t = fromRect, toRect
			moveDir = self.moveDir
		else: 
			s, t = toRect, fromRect
			moveDir = Cell.invertDir(self.moveDir)
		sw, sh = s.width(), s.height()
		tw, th = t.width(), t.height()
		if moveDir == Cell.NEG: 
			startX, endX = s.left(), t.right()
			sControlX = startX-(sw); tControlX = endX-(tw)
		else: 
			startX, endX = s.right(), t.left()
			sControlX = startX+(sw); tControlX = endX-(tw)
		
		# Source is always below target
		path.moveTo(startX, s.center().y())
		sp = QPointF(sControlX, s.top()-(sh*2))
		tp = QPointF(tControlX, t.bottom()+(th*2))
		end = QPointF(endX, t.center().y())
		path.cubicTo(sp, tp, end)
예제 #4
0
 def positionYRingRank(self, path, fromRect, toRect):
     if fromRect.center().y() < toRect.center().y():
         s, t = fromRect, toRect
         moveDir = self.moveDir
     else:
         s, t = toRect, fromRect
         moveDir = Cell.invertDir(self.moveDir)
     rad = max(s.width() / 3, t.width() / 3)
     if moveDir == Cell.NEG:
         p = QPointF(s.center().x(), s.top()) + QPointF(0, -rad)
         leftBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
         p = QPointF(s.center().x(), t.bottom()) + QPointF(0, -rad)
         rightBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
     else:
         p = QPointF(s.center().x(), s.bottom()) + QPointF(0, rad)
         leftBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
         p = QPointF(s.center().x(), t.top()) + QPointF(0, -rad)
         rightBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
     # Source always above target
     path.moveTo(leftBox.left(), s.top())
     path.arcTo(leftBox, -180, -180)
     path.lineTo(rightBox.right(), t.bottom())
     path.arcTo(rightBox, 0, -180)
예제 #5
0
	def positionYRingRank(self, path, fromRect, toRect):
		if fromRect.center().y() < toRect.center().y(): 
			s, t = fromRect, toRect
			moveDir = self.moveDir
		else: 
			s, t = toRect, fromRect
			moveDir = Cell.invertDir(self.moveDir)
		rad = max(s.width()/3, t.width()/3)
		if moveDir == Cell.NEG:
			p = QPointF(s.center().x(), s.top())+QPointF(0, -rad)
			leftBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
			p = QPointF(s.center().x(), t.bottom())+QPointF(0, -rad)
			rightBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
		else:
			p = QPointF(s.center().x(), s.bottom())+QPointF(0, rad)
			leftBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
			p = QPointF(s.center().x(), t.top())+QPointF(0, -rad)
			rightBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
		# Source always above target
		path.moveTo(leftBox.left(), s.top())
		path.arcTo(leftBox, -180, -180)
		path.lineTo(rightBox.right(), t.bottom())
		path.arcTo(rightBox, 0, -180)
예제 #6
0
	def positionXRingRank(self, path, fromRect, toRect):
		if fromRect.center().x() < toRect.center().x(): 
			s, t = fromRect, toRect
			moveDir = self.moveDir
		else: 
			s, t = toRect, fromRect
			moveDir = Cell.invertDir(self.moveDir)
		rad = max(s.height()/3, t.height()/3)
		if moveDir == Cell.NEG:
			p = QPointF(s.left(), s.center().y())+QPointF(-(rad), -(rad*2))
			leftBox = QtCore.QRectF(p, QSizeF(rad*2,rad*2))
			p = QPointF(t.right(), s.center().y())+QPointF(-(rad), -(rad*2))
			rightBox = QtCore.QRectF(p, QSizeF(rad*2,rad*2))
		else:
			p = QPointF(s.right(), s.center().y())+QPointF(-rad, -rad)
			leftBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
			p = QPointF(t.left(), s.center().y())+QPointF(-rad, -rad)
			rightBox = QtCore.QRectF(p, QSizeF(rad+rad,rad+rad))
		# Source always left of target
		path.moveTo(s.left(), s.center().y())
		path.arcTo(leftBox, -90, -180)
		path.lineTo(rightBox.topLeft())
		path.arcTo(rightBox, 90, -180)
예제 #7
0
    def positionXRankWithDifferentY(self, path, fromRect, toRect):
        if fromRect.center().y() > toRect.center().y():
            s, t = fromRect, toRect
            moveDir = self.moveDir
        else:
            s, t = toRect, fromRect
            moveDir = Cell.invertDir(self.moveDir)
        sw, sh = s.width(), s.height()
        tw, th = t.width(), t.height()
        if moveDir == Cell.NEG:
            startX, endX = s.left(), t.right()
            sControlX = startX - (sw)
            tControlX = endX - (tw)
        else:
            startX, endX = s.right(), t.left()
            sControlX = startX + (sw)
            tControlX = endX - (tw)

        # Source is always below target
        path.moveTo(startX, s.center().y())
        sp = QPointF(sControlX, s.top() - (sh * 2))
        tp = QPointF(tControlX, t.bottom() + (th * 2))
        end = QPointF(endX, t.center().y())
        path.cubicTo(sp, tp, end)
예제 #8
0
 def positionXRingRank(self, path, fromRect, toRect):
     if fromRect.center().x() < toRect.center().x():
         s, t = fromRect, toRect
         moveDir = self.moveDir
     else:
         s, t = toRect, fromRect
         moveDir = Cell.invertDir(self.moveDir)
     rad = max(s.height() / 3, t.height() / 3)
     if moveDir == Cell.NEG:
         p = QPointF(s.left(), s.center().y()) + QPointF(-(rad), -(rad * 2))
         leftBox = QtCore.QRectF(p, QSizeF(rad * 2, rad * 2))
         p = QPointF(t.right(),
                     s.center().y()) + QPointF(-(rad), -(rad * 2))
         rightBox = QtCore.QRectF(p, QSizeF(rad * 2, rad * 2))
     else:
         p = QPointF(s.right(), s.center().y()) + QPointF(-rad, -rad)
         leftBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
         p = QPointF(t.left(), s.center().y()) + QPointF(-rad, -rad)
         rightBox = QtCore.QRectF(p, QSizeF(rad + rad, rad + rad))
     # Source always left of target
     path.moveTo(s.left(), s.center().y())
     path.arcTo(leftBox, -90, -180)
     path.lineTo(rightBox.topLeft())
     path.arcTo(rightBox, 90, -180)