Beispiel #1
0
	def getBounds(self):
		'''
		Gets the bounding rectangle for this object

		@rtype: GRectangle
		'''
		if(self.transformed): return _platform.Platform().getBounds(self)
		rx = self.frameWidth / 2
		ry = self.frameHeight / 2
		cx = self.x + rx
		cy = self.y + ry
		startRadians = self.start * _gmath.PI / 180
		sweepRadians = self.sweep * _gmath.PI / 180
		p1x = cx + math.cos(startRadians) * rx
		p1y = cy - math.sin(startRadians) * ry
		p2x = cx + math.cos(startRadians + sweepRadians) * rx
		p2y = cy - math.sin(startRadians + sweepRadians) * ry
		xMin = min(p1x, p2x)
		xMax = max(p1x, p2x)
		yMin = min(p1y, p2y)
		yMax = max(p1y, p2y)
		if (self.containsAngle(0)): xMax = cx + rx
		if (self.containsAngle(90)): yMin = cy - ry
		if (self.containsAngle(180)): xMin = cx - rx
		if (self.containsAngle(270)): yMax = cy + ry
		if (self.isFilled()):
			xMin = min(xMin, cx)
			yMin = min(yMin, cy)
			xMax = max(xMax, cx)
			yMax = max(yMax, cy)
		return _gtypes.GRectangle(xMin, yMin, xMax - xMin, yMax - yMin)
Beispiel #2
0
	def getFrameRectangle(self):
		'''
		Returns the boundaries of the rectangle used to frame the arc.

		@rtype: GRectangle
		'''
		return _gtypes.GRectangle(0,0,0,0) #!!
Beispiel #3
0
	def getBounds(self):
		'''
		Returns the GRectangle bounding this object

		@rtype: GRectangle
		'''
		if(self.transformed): return _platform.Platform().getBounds(self)
		return _gtypes.GRectangle(self.x, self.y, self.width, self.height)
Beispiel #4
0
    def getBounds(self):
        '''
		Returns the bounding GRectangle of the GInteractor

		@rtype: GRectangle
		'''
        size = _platform.Platform().getSize(self)
        return _gtypes.GRectangle(self.x, self.y, size.getWidth(),
                                  size.getHeight())
Beispiel #5
0
 def scanRectangle(self, str):
     tokens = re.findall(r"[-:\w\.]+", str)
     #skip "GRectangle"
     tokens = tokens[1:]
     x = float(tokens[0])
     tokens = tokens[1:]
     y = float(tokens[0])
     tokens = tokens[1:]
     width = float(tokens[0])
     tokens = tokens[1:]
     height = float(tokens[0])
     return gtypes.GRectangle(x, y, width, height)
Beispiel #6
0
	def getBounds(self):
		'''
		Returns a bounding rectangle for this compound.

		@rtype: GRectangle
		'''
		if(self.transformed): return _platform.Platform().getBounds(self)
		xMin = sys.float_info.max
		yMin = sys.float_info.max
		xMax = sys.float_info.min
		yMax = sys.float_info.min
		for i in range(len(self.contents)):
			bounds = self.contents[i].getBounds()
			xMin = min(xMin, bounds.getX())
			yMin = min(yMin, bounds.getY())
			xMax = max(xMax, bounds.getX())
			yMax = max(yMax, bounds.getY())

		return _gtypes.GRectangle(xMin, yMin, xMax - xMin, yMax - yMin)
Beispiel #7
0
	def getBounds(self):
		'''
		Returns the bounding rectangle for this object

		@rtype: GRectangle
		'''
		if(self.transformed): return _platform.Platform().getBounds(self)
		xMin = 0
		yMin = 0
		xMax = 0
		yMax = 0
		for i in range(len(self.vertices)):
			x = vertices[i].getX()
			y = vertices[i].getY()
			if(i==0 or x < xMin): xMin = x
			if(i==0 or y < yMin): yMin = y
			if(i==0 or x > xMax): xMax = x
			if(i==0 or y > yMax): yMax = y
		return _gtypes.GRectangle(xMin, yMin, xMax - xMin, yMax - yMin)