Changeset 748


Ignore:
Timestamp:
Sep 1, 2012 11:23:07 AM (10 years ago)
Author:
vondreele
Message:

change view point operation & use view point as atom insertion
remove testpoint

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r746 r748  
    4747
    4848[ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, wxID_ATOMSEDITDELETE, wxID_ATOMSREFINE,
    49     wxID_ATOMSMODIFY, wxID_ATOMSTRANSFORM, wxID_ATOMSTESTADD, wxID_ATONTESTINSERT,
     49    wxID_ATOMSMODIFY, wxID_ATOMSTRANSFORM, wxID_ATOMSVIEWADD, wxID_ATOMVIEWINSERT,
    5050    wxID_RELOADDRAWATOMS,wxID_ATOMSDISAGL,
    5151] = [wx.NewId() for item in range(10)]
     
    523523        self.AtomsMenu.Append(menu=MyHelp(self,helpType='Atoms'),title='&Help')
    524524        self.AtomEdit.Append(id=wxID_ATOMSEDITADD, kind=wx.ITEM_NORMAL,text='Append atom',
    525             help='Inserted as an H atom')
    526         self.AtomEdit.Append(id=wxID_ATOMSTESTADD, kind=wx.ITEM_NORMAL,text='Append test point',
    527             help='Inserted as an H atom')
     525            help='Appended as an H atom')
     526        self.AtomEdit.Append(id=wxID_ATOMSVIEWADD, kind=wx.ITEM_NORMAL,text='Append view point',
     527            help='Appended as an H atom')
    528528        self.AtomEdit.Append(id=wxID_ATOMSEDITINSERT, kind=wx.ITEM_NORMAL,text='Insert atom',
    529529            help='Select atom row to insert before; inserted as an H atom')
    530         self.AtomEdit.Append(id=wxID_ATONTESTINSERT, kind=wx.ITEM_NORMAL,text='Insert test point',
     530        self.AtomEdit.Append(id=wxID_ATOMVIEWINSERT, kind=wx.ITEM_NORMAL,text='Insert view point',
    531531            help='Select atom row to insert before; inserted as an H atom')
    532532        self.AtomEdit.Append(id=wxID_ATOMSEDITDELETE, kind=wx.ITEM_NORMAL,text='Delete atom',
  • trunk/GSASIIphsGUI.py

    r747 r748  
    946946        generalData = data['General']
    947947        atomData = data['Atoms']
     948        DData = data['Drawing']
    948949        Items = [G2gd.wxID_ATOMSEDITINSERT, G2gd.wxID_ATOMSEDITDELETE, G2gd.wxID_ATOMSREFINE,
    949             G2gd.wxID_ATOMSMODIFY, G2gd.wxID_ATOMSTRANSFORM, G2gd.wxID_ATONTESTINSERT]
     950            G2gd.wxID_ATOMSMODIFY, G2gd.wxID_ATOMSTRANSFORM, G2gd.wxID_ATOMVIEWINSERT]
    950951        if atomData:
    951952            for item in Items:   
     
    953954        else:
    954955            for item in Items:
    955                 G2frame.dataFrame.AtomsMenu.Enable(item,False)           
    956            
     956                G2frame.dataFrame.AtomsMenu.Enable(item,False)
     957        Items = [G2gd.wxID_ATOMVIEWINSERT, G2gd.wxID_ATOMSVIEWADD]
     958        if data['Drawing']['showABC']:
     959            for item in Items:
     960                G2frame.dataFrame.AtomsMenu.Enable(item,True)
     961        else:
     962            for item in Items:
     963                G2frame.dataFrame.AtomsMenu.Enable(item,False)
     964
    957965        AAchoice = ": ,ALA,ARG,ASN,ASP,CYS,GLN,GLU,GLY,HIS,ILE,LEU,LYS,MET,PHE,PRO,SER,THR,TRP,TYR,VAL,MSE,HOH,UNK"
    958966        Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,X,XU,U,F,FX,FXU,FU",]+ \
     
    11601168                    DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID)
    11611169                    FindBondsDraw()
    1162                    
     1170
    11631171        def AtomTypeSelect(event):
    11641172            r,c =  event.GetRow(),event.GetCol()
     
    12011209                else:
    12021210                    Atoms.ClearSelection()
    1203                     Atoms.SelectRow(r,True)               
     1211                    Atoms.SelectRow(r,True)
    12041212               
    12051213        def ChangeSelection(event):
     
    12751283        event.StopPropagation()
    12761284       
    1277     def OnAtomTestAdd(event):
     1285    def OnAtomViewAdd(event):
    12781286        try:
    12791287            drawData = data['Drawing']
    1280             x,y,z = drawData['testPos'][0]
     1288            x,y,z = drawData['viewPoint'][0]
    12811289            AtomAdd(x,y,z)
    12821290        except:
     
    13081316        event.StopPropagation()
    13091317       
    1310     def OnAtomTestInsert(event):
     1318    def OnAtomViewInsert(event):
    13111319        if 'Drawing' in data:
    13121320            drawData = data['Drawing']
    1313             x,y,z = drawData['testPos'][0]
     1321            x,y,z = drawData['viewPoint'][0]
    13141322            AtomAdd(x,y,z)
    13151323            FillAtomsGrid()
     
    15401548            'vdwScale':0.67,'ellipseProb':50,'sizeH':0.50,'unitCellBox':False,
    15411549            'showABC':True,'selectedAtoms':[],'Atoms':[],'Rotation':[0.0,0.0,0.0,[]],
    1542             'bondList':{},'testPos':[[-.1,-.1,-.1],[0.0,0.0,0.0],[0,0]]}
     1550            'bondList':{},}
    15431551        try:
    15441552            drawingData = data['Drawing']
     
    25372545           
    25382546            line2Sizer = wx.BoxSizer(wx.HORIZONTAL)
    2539             showABC = wx.CheckBox(dataDisplay,-1,label=' Show test point?')
     2547            showABC = wx.CheckBox(dataDisplay,-1,label=' Show view point?')
    25402548            showABC.Bind(wx.EVT_CHECKBOX, OnShowABC)
    25412549            showABC.SetValue(drawingData['showABC'])
     
    41994207            G2frame.dataFrame.SetMenuBar(G2frame.dataFrame.AtomsMenu)
    42004208            G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomAdd, id=G2gd.wxID_ATOMSEDITADD)
    4201             G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomTestAdd, id=G2gd.wxID_ATOMSTESTADD)
     4209            G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomViewAdd, id=G2gd.wxID_ATOMSVIEWADD)
    42024210            G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomInsert, id=G2gd.wxID_ATOMSEDITINSERT)
    4203             G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomTestInsert, id=G2gd.wxID_ATONTESTINSERT)
     4211            G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomViewInsert, id=G2gd.wxID_ATOMVIEWINSERT)
    42044212            G2frame.dataFrame.Bind(wx.EVT_MENU, AtomDelete, id=G2gd.wxID_ATOMSEDITDELETE)
    42054213            G2frame.dataFrame.Bind(wx.EVT_MENU, AtomRefine, id=G2gd.wxID_ATOMSREFINE)
  • trunk/GSASIIplot.py

    r740 r748  
    24262426        newxy = event.GetPosition()
    24272427        page = getSelection()
    2428         if event.ControlDown() and drawingData['showABC']:
    2429             if event.LeftIsDown():
    2430                 SetTestRot(newxy)
    2431             elif event.RightIsDown():
    2432                 SetTestPos(newxy)
    2433             elif event.MiddleIsDown():
    2434                 SetTestRotZ(newxy)
    2435             x,y,z = drawingData['testPos'][0]
    2436             G2frame.G2plotNB.status.SetStatusText('moving test point %.4f,%.4f,%.4f'%(x,y,z),1)
    2437             Draw()
    24382428                               
    24392429        if event.Dragging() and not event.ControlDown():
     
    25262516        if key in ['C']:
    25272517            drawingData['viewPoint'] = [[.5,.5,.5],[0,0]]
    2528             drawingData['testPos'] = [[-.1,-.1,-.1],[0.0,0.0,0.0],[0,0]]
    25292518            drawingData['Rotation'] = [0.0,0.0,0.0,[]]
    25302519            SetViewPointText(drawingData['viewPoint'][0])
     
    26152604        SetViewPointText([Tx,Ty,Tz])
    26162605       
    2617     def SetTestPos(newxy):
    2618         Tx,Ty,Tz = drawingData['testPos'][0]
    2619         anglex,angley,anglez,oldxy = drawingData['Rotation']
    2620         if not len(oldxy): oldxy = list(newxy)
    2621         Rx = G2lat.rotdMat(anglex,0)
    2622         Ry = G2lat.rotdMat(angley,1)
    2623         Rz = G2lat.rotdMat(anglez,2)
    2624         dxy = list(newxy-oldxy)+[0,]
    2625         dxy = np.inner(Rz,np.inner(Ry,np.inner(Rx,dxy)))
    2626         Tx += dxy[0]*0.001
    2627         Ty -= dxy[1]*0.001
    2628         Tz += dxy[2]*0.001
    2629         drawingData['Rotation'][3] = list(newxy)
    2630         drawingData['testPos'][0] =  Tx,Ty,Tz
    2631        
    2632     def SetTestRot(newxy):
    2633         Txyz = np.array(drawingData['testPos'][0])
    2634         oldxy = drawingData['testPos'][2]
    2635         Ax,Ay,Az = drawingData['testPos'][1]
    2636         Vxyz = np.array(drawingData['viewPoint'][0])
    2637         Dxyz = np.inner(Amat,Txyz-Vxyz)
    2638         dxy = list(newxy-oldxy)+[0,]
    2639         Ax += dxy[1]*0.01
    2640         Ay += dxy[0]*0.01
    2641         Rx = G2lat.rotdMat(Ax,0)
    2642         Ry = G2lat.rotdMat(Ay,1)
    2643         Dxyz = np.inner(Ry,np.inner(Rx,Dxyz))       
    2644         Dxyz = np.inner(Bmat,Dxyz)+Vxyz
    2645         drawingData['testPos'][1] = [Ax,Ay,Az]
    2646         drawingData['testPos'][2] = newxy
    2647         drawingData['testPos'][0] = Dxyz
    2648        
    2649     def SetTestRotZ(newxy):
    2650         Txyz = np.array(drawingData['testPos'][0])
    2651         oldxy = drawingData['testPos'][2]
    2652         Ax,Ay,Az = drawingData['testPos'][1]
    2653         Vxyz = np.array(drawingData['viewPoint'][0])
    2654         Dxyz = np.inner(Amat,Txyz-Vxyz)       
    2655         dxy = list(newxy-oldxy)+[0,]
    2656         Az += (dxy[0]+dxy[1])*.01
    2657         Rz = G2lat.rotdMat(Az,2)
    2658         Dxyz = np.inner(Rz,Dxyz)       
    2659         Dxyz = np.inner(Bmat,Dxyz)+Vxyz
    2660         drawingData['testPos'][1] = [Ax,Ay,Az]
    2661         drawingData['testPos'][2] = newxy
    2662         drawingData['testPos'][0] = Dxyz
    2663                              
    26642606    def SetRotation(newxy):       
    26652607        anglex,angley,anglez,oldxy = drawingData['Rotation']
     
    29122854            RenderBox()
    29132855        if drawingData['showABC']:
    2914             x,y,z = drawingData['testPos'][0]
    2915 #            if altDown:
    2916 #                G2frame.G2plotNB.status.SetStatusText('moving test point %.4f,%.4f,%.4f'%(x,y,z),1)
    2917 #            else:
    2918 #                G2frame.G2plotNB.status.SetStatusText('test point %.4f,%.4f,%.4f'%(x,y,z),1)           
     2856            x,y,z = drawingData['viewPoint'][0]
    29192857            RenderUnitVectors(x,y,z)
    29202858        Backbones = {}
Note: See TracChangeset for help on using the changeset viewer.