From 1754a1f4511ef52f0a093dd0f9915196bd4261e7 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Thu, 25 Nov 2010 22:26:52 -0500 Subject: Renaming LayoutEngine to PixelAssembler --- operationscore/PixelAssembler.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 operationscore/PixelAssembler.py (limited to 'operationscore/PixelAssembler.py') diff --git a/operationscore/PixelAssembler.py b/operationscore/PixelAssembler.py new file mode 100644 index 0000000..b6e35ac --- /dev/null +++ b/operationscore/PixelAssembler.py @@ -0,0 +1,30 @@ +from operationscore.SmootCoreObject import * +import Util +import pdb +class PixelAssembler(SmootCoreObject): + def init(self): + self.validateArgs('PixelAssembler.params') + self.initLayout() + def layoutFunc(self, lastLocation): #Must be defined by inheriting class. + #Returns tuple pair (x,y) + pass + def getPixelLocations(self): #returns a complete list of locations of Pixels + #for a strip + locations = [self.argDict['originLocation']] + for pixelIndex in range(self['numPixels']-1): #-1 because origin + #already exists + newLocation = self.layoutFunc(locations[-1]) + if newLocation == None: + raise Exception('Location cannot be null. layoutFunc not \ + defined or improperly defined.') + if Util.dist(newLocation, locations[-1]) > \ + self['pixelToPixelSpacing']: + raise Exception('Illegal pixel location. Distance \ + between adjacent pixels must be less than \ + pixelToPixelSpacing.') + locations.append(newLocation) + return locations + def initLayout(self): + pass + def getStripArgs(self): #TODO: triage and remove + return self.argDict -- cgit v1.2.3