from numpy import *
from dv3dGeneratePositionMarker import *
import vtk
from dv3dObjectsToRender import *
from dv3dPropertyFrames import *

def LoadMarkerList(frame_parent):

    dlg = wx.FileDialog(frame_parent, "Choose 7-column marker list file:", '', "", '*.*', wx.OPEN)
    if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
	    f = open(path)
	    t = f.read().split()
	    f.close()
	    
	    r = zeros(len(t))
	    
	    for i in range(len(t)):
		r[i] = float(t[i])
	    
	    pts = r.reshape(len(t)/7,7)
	    
	    for i in range(len(pts)):
		x_pos = 180-(90-(-pts[i,0]))
		y_pos = 126+pts[i,1]
		z_pos = 72+pts[i,2]
		GeneratePositionMarker(frame_parent, x_pos, y_pos, z_pos, pts[i,3], pts[i,4], pts[i,5], pts[i,6])
    else:
	    print 'load cancelled'


        
