예제 #1
0
def createTreeRects():
	minX, minY, maxX, maxY = parseTree()
	if minX is None : 
		return []
	scalingFactor = 1
	print minX, minY, maxX, maxY
	minX += 20
	minY += 20
	l = []
	tree = rTree.RTree(None, None)
	rTree.entryList = [];
	rTree.getEntries(tree.root)
	entries = rTree.entryList
	for e in entries : 
		p = [e.I.boundingBoxMin[0],e.I.boundingBoxMin[1],e.I.boundingBoxMax[0],e.I.boundingBoxMax[1]]
		l.append([(scalingFactor*p[0])+minX, (scalingFactor*-p[1])+minY ,max(1,p[2]-p[0]),max(1,p[3]-p[1])])
	return (l, minX, minY)
예제 #2
0
def parseTree() : 
	meta = rTree.getMeta()
	if meta is None :
		return (None,None, None, None)
	scalingFactor = 1
	tree = rTree.RTree(None, None)
	entries = []
	rTree.entryList = []
	rTree.getEntries(tree.root)
	entries = rTree.entryList
	minX = 1000
	minY = 1000
	maxX = -1000
	maxY = -1000
	for e in entries :
		minX = min(minX, scalingFactor*e.I.boundingBoxMin[0])
		maxX = max(maxX, scalingFactor*e.I.boundingBoxMax[0])
		minY = min(minY, scalingFactor*-e.I.boundingBoxMin[1])
		maxY = max(maxY, scalingFactor*-e.I.boundingBoxMax[1])	

	return (minX*(-1.0), minY*(-1.0), maxX, maxY)