Example #1
0
    def setProps(self, props):
        """
        Set the Plane properties. It is called while reading a MMP file record.

        @param props: The plane's properties.
        @type  props: tuple
        @see: files_mmp._readmmp_state._read_plane for a comment about 
              grid related attrs in the <props>
        """
        name, border_color, width, height, center, wxyz, \
             gridColor, gridLineType, gridXSpacing, gridYSpacing, \
             originLocation, displayLabelStyle = props
        

        self.name    =  name
        self.color   =  self.normcolor = border_color
        self.width   =  width
        self.height  =  height
        self.center  =  center 
        self.quat    =  Q(wxyz[0], wxyz[1], wxyz[2], wxyz[3])
        
        #see files_mmp._readmmp_state._read_plane for a comment which 
        #explains when the following attrs can be 'None' -- 2008-06-25
        if gridColor is not None:
            self.gridColor = gridColor
            
        if gridLineType is not None:
            self.gridLineType = gridLineType
            
        if gridXSpacing is not None:
            self.gridXSpacing = gridXSpacing
            
        if gridYSpacing is not None:
            self.gridYSpacing = gridYSpacing
            
        if originLocation is not None:
            self.originLocation = originLocation
            
        if displayLabelStyle is not None:
            self.displayLabelStyle = displayLabelStyle

        if not self.directionArrow:
            self.directionArrow = DirectionArrow(self,
                                                 self.glpane, 
                                                 self.center, 
                                                 self.getaxis())   
Example #2
0
    def __init__(self,
                 win,
                 editCommand=None,
                 atomList=None,
                 READ_FROM_MMP=False):
        """
        Constructs a plane.

        @param win: The NE1 main window.
        @type  win: L{MainWindow}

        @param editCommand: The Plane Edit Controller object. 
                          If this is None, it means the Plane is created by 
                          reading the data from the MMP file and it doesn't 
                          have  an EditCommand assigned. 
                          The EditCommand may be created at a later stage 
                          in this case. 
                          See L{self.edit} for an example. 
        @type  editCommand: B{Plane_EditCommand} or None                          

        @param atomList: List of atoms.
        @type  atomList: list

        @param READ_FROM_MMP: True if the plane is read from a MMP file.
        @type  READ_FROM_MMP: bool
        """

        self.win = win

        ReferenceGeometry.__init__(self, win)

        self.fill_color = self.default_fill_color
        self.border_color = self.default_border_color
        self.opacity = self.default_opacity
        self.handles = []
        self.directionArrow = None

        # This is used to notify drawing code if it's just for picking purpose
        # [copied from class ESPImage ]
        self.pickCheckOnly = False
        ### REVIEW/TODO: understanding how self.pickCheckOnly might be
        # left over from one drawing call to another (potentially causing
        # bugs) is a mess. It needs to be refactored so that it's just an
        # argument to all methods it's passed through. This involves some
        # superclass methods; maybe they can be overridden so the argument
        # is only needed in local methods, I don't know. This is done in
        # several Node classes, so I added this comment to all of them.
        # [bruce 090310 comment]

        self.editCommand = editCommand
        self.imagePath = ""
        self.heightfield = None
        self.heightfield_scale = 1.0
        self.heightfield_use_texture = True

        # piotr 080528
        # added tex_image attribute for texture image
        self.tex_coords = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0]]

        self.display_image = False
        self.display_heightfield = False
        self.heightfield_hq = False
        self.tex_image = None
        self.image = None

        #related to grid

        self.gridColor = yellow
        self.gridLineType = 3
        self.gridXSpacing = 4.0
        self.gridYSpacing = 4.0
        self.originLocation = PLANE_ORIGIN_LOWER_LEFT
        self.displayLabelStyle = LABELS_ALONG_ORIGIN

        if not READ_FROM_MMP:
            self.width = 16.0  # piotr 080605 - change default dimensions to square
            self.height = 16.0
            self.normcolor = black
            self.setup_quat_center(atomList)
            self.directionArrow = DirectionArrow(self, self.glpane,
                                                 self.center, self.getaxis())
Example #3
0
    def __init__(self, 
                 win, 
                 editCommand = None, 
                 atomList = None, 
                 READ_FROM_MMP = False):
        """
        Constructs a plane.

        @param win: The NE1 main window.
        @type  win: L{MainWindow}

        @param editCommand: The Plane Edit Controller object. 
                          If this is None, it means the Plane is created by 
                          reading the data from the MMP file and it doesn't 
                          have  an EditCommand assigned. 
                          The EditCommand may be created at a later stage 
                          in this case. 
                          See L{self.edit} for an example. 
        @type  editCommand: B{Plane_EditCommand} or None                          

        @param atomList: List of atoms.
        @type  atomList: list

        @param READ_FROM_MMP: True if the plane is read from a MMP file.
        @type  READ_FROM_MMP: bool
        """

        self.win = win

        ReferenceGeometry.__init__(self, win)                            

        self.fill_color     =  self.default_fill_color
        self.border_color   =  self.default_border_color  
        self.opacity        =  self.default_opacity
        self.handles        =  []   
        self.directionArrow =  None

        # This is used to notify drawing code if it's just for picking purpose
        # copied from class ESPImage 
        self.pickCheckOnly  = False 

        self.editCommand      =  editCommand
        self.imagePath = ""
        self.heightfield = None
        self.heightfield_scale = 1.0
        self.heightfield_use_texture = True
        
        # piotr 080528
        # added tex_image attribute for texture image
        self.tex_coords       = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0]] 
        
        self.display_image = False
        self.display_heightfield = False
        self.heightfield_hq = False
        self.tex_image = None
        self.image = None
        
        #related to grid
      
        self.gridColor = yellow
        self.gridLineType = 3
        self.gridXSpacing = 4.0
        self.gridYSpacing = 4.0       
        self.originLocation = LOWER_LEFT
        self.displayLabelStyle = LABELS_ALONG_ORIGIN
        
        if not READ_FROM_MMP:
            self.width      =  16.0 # piotr 080605 - change default dimensions to square
            self.height     =  16.0  
            self.normcolor  =  black            
            self.setup_quat_center(atomList)   
            self.directionArrow = DirectionArrow(self, 
                                                 self.glpane, 
                                                 self.center, 
                                                 self.getaxis())