def _createVolumeFromList(self): """ Create a new lores model with all the shapes in our internal list Whenever we change a parameter of a shape, we have to re-create the whole thing. Items with higher 'order' number take precedence for regions of space that are shared with other objects. Points in the overlapping region belonging to objects with lower 'order' will be ignored. Items are added in decreasing 'order' number. The item with the highest 'order' will be added *first*. [That conventions is prescribed by the realSpaceModeling module] """ # Create empty model self.lores_model = \ pointsmodelpy.new_loresmodel(self.params['lores_density']) # Create empty complex model self.complex_model = pointsmodelpy.new_complexmodel() # Order the object first obj_list = [] for shape in self.shapes: order = self.shapes[shape].params['order'] # find where to place it in the list stored = False for i in range(len(obj_list)): if obj_list[i][0] > order: obj_list.insert(i, [order, shape]) stored = True break if not stored: obj_list.append([order, shape]) # Add each shape len_list = len(obj_list) for i in range(len_list - 1, -1, -1): shapedesc = self.shapes[obj_list[i][1]] self._addSingleShape(shapedesc) return 0
def _createVolumeFromList(self): """ Create a new lores model with all the shapes in our internal list Whenever we change a parameter of a shape, we have to re-create the whole thing. Items with higher 'order' number take precedence for regions of space that are shared with other objects. Points in the overlapping region belonging to objects with lower 'order' will be ignored. Items are added in decreasing 'order' number. The item with the highest 'order' will be added *first*. [That conventions is prescribed by the realSpaceModeling module] """ # Create empty model self.lores_model = \ pointsmodelpy.new_loresmodel(self.params['lores_density']) # Create empty complex model self.complex_model = pointsmodelpy.new_complexmodel() # Order the object first obj_list = [] for shape in self.shapes: order = self.shapes[shape].params['order'] # find where to place it in the list stored = False for i in range(len(obj_list)): if obj_list[i][0] > order: obj_list.insert(i, [order, shape]) stored = True break if not stored: obj_list.append([order, shape]) # Add each shape len_list = len(obj_list) for i in range(len_list-1, -1, -1): shapedesc = self.shapes[obj_list[i][1]] self._addSingleShape(shapedesc) return 0
def __init__(self): """ Initialization """ BaseComponent.__init__(self) ## Maximum value of q reachable self.params['q_max'] = 0.1 self.params['lores_density'] = 0.1 self.params['scale'] = 1.0 self.params['background'] = 0.0 self.lores_model = pointsmodelpy.new_loresmodel(self.params['lores_density']) self.complex_model = pointsmodelpy.new_complexmodel() self.shapes = {} self.shapecount = 0 self.points = None self.npts = 0 self.hasPr = False
def __init__(self): """ Initialization """ BaseComponent.__init__(self) ## Maximum value of q reachable self.params['q_max'] = 0.1 self.params['lores_density'] = 0.1 self.params['scale'] = 1.0 self.params['background'] = 0.0 self.lores_model = pointsmodelpy.new_loresmodel( self.params['lores_density']) self.complex_model = pointsmodelpy.new_complexmodel() self.shapes = {} self.shapecount = 0 self.points = None self.npts = 0 self.hasPr = False