"""
example1.py
by Javantea
June 4, 2007

Example of how to use the mapmake1 library.
"""

# Import necessary libraries.
from random import seed
from sys import path
path.append('c4s')
import mapmake1

# Initialize the random number generator and the map
seed(1234)
m = mapmake1.Map(None, 500, 500)

# Your data.
me = 'Javantea'
friends = ['John', 'Carla', 'Jim', 'Suzy', 'Sara', 'David']

# Create a list of points with your data.
p = []
p.append(mapmake1.Point(me))
p.append(mapmake1.Point(friends[0]))
p.append(mapmake1.Point(friends[1]))
p.append(mapmake1.Point(friends[2]))
p.append(mapmake1.Point(friends[3]))
p.append(mapmake1.Point(friends[4]))
p.append(mapmake1.Point(friends[5]))

# Connect your points in a useful diagram using your data style.
p[0].addConn(p[1])
p[0].addConn(p[2])
p[0].addConn(p[3])
p[0].addConn(p[4])
p[0].addConn(p[5])
p[0].addConn(p[6])

# Setup the map with the points.
m.addPoints(p)
# Position them randomly around 300 pixels wide.
m.randomize(300)
# Sort them really well. You can use your own algorithm.
for i in range(300):
	m.sort2()
	if i % 13 == 0:
		m.sort3()
	#end if
#next i
# Center the map in the frame.
m.center()
# Print out the SVG.
print m