Ignore:
Timestamp:
Oct 18, 2007 1:36:17 PM (17 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
8c050c1
Parents:
f98961f
Message:
  • Added method to add an object to the canvas instead of using the canvas object as a factory.
  • Completed unit tests and added stimuli to automated testing class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansrealspace/src/realspace/VolumeCanvas.py

    rf98961f r3c75696  
    214214        self.hasPr = False         
    215215         
     216    def addObject(self, shapeDesc, id = None): 
     217        """ 
     218            Adds a real-space object to the canvas. 
     219         
     220            @param shapeDesc: object to add to the canvas [ShapeDescriptor] 
     221            @param id: string handle for the object [string] [optional] 
     222            @return: string handle for the object 
     223        """ 
     224        # If the handle is not provided, create one 
     225        if id == None: 
     226            id = shapeDesc.params["type"]+str(self.shapecount) 
     227          
     228        # Self the order number 
     229        shapeDesc.params['order'] = self.shapecount 
     230        # Store the shape in a dictionary entry associated 
     231        # with the handle 
     232        self.shapes[id] = shapeDesc 
     233        self.shapecount += 1 
     234 
     235        #model changed, need to recalculate P(r) 
     236        self.hasPr = False 
     237 
     238        return id 
     239             
     240     
    216241    def add(self, shape, id = None): 
    217242        """ 
     243            The intend of this method is to eventually be able to use it 
     244            as a factory for the canvas and unify the simulation with the 
     245            analytical solutions. For instance, if one adds a cylinder and 
     246            it is the only shape on the canvas, the analytical solution 
     247            could be called. If multiple shapes are involved, then  
     248            simulation has to be performed. 
     249         
    218250            @param shape: name of the object to add to the canvas [string] 
    219251            @param id: string handle for the object [string] [optional] 
Note: See TracChangeset for help on using the changeset viewer.