
from tWrapper import tWrapper

# wrapper for any additional drawing routines
# that need to know about each other
class turtleWrapper(tWrapper):
    pass

def drawMain(dc_local, w, turtleWrapper=turtleWrapper):
    t1 = turtleWrapper(dc_local)
    t1.cls()

    """
    # test towards (towardsXY)
    # these kinds of tests should be done using pyunit
    tt = turtleWrapper(dc_local)
    for i in range(0, 370, 10):
        tt.pu()
        tt.lt(i)
        tt.fd(100)
        print "angle: %f, t1 towards tt: %f, tt towards t1: %f" % (i, t1.towards(tt), tt.towards(t1))
        tt.bk(100)
        tt.rt(i)
    """

    # test the distance calculation
    t1.left(45)
    t1.forward(100 * sqrt(2))

    t2 = turtleWrapper(dc_local)
    t2.forward(100)
    d = t2.distance(t1)
    t2.write("%f" % d)	# should display 100 

    # test the odometer reading
    t1.resetOdometer()
    t1.resumeOdometer()
    t1.polygon(4, 100)
    t1.write("odometer: %f" % t1.getOdometer())
