def __init__(self,observer,varName,variable,t,poly2cs,cs2poly): self.matcher = IMap(varName,variable,t,poly2cs,cs2poly) #print self.matcher.cs2poly self.observer=observer self.type="map" Map.nmap +=1 self.name = "map_%d"%Map.nmap Subscriber.__init__(self,observer) self.addMethod("testMethod",self.testMethod)
class Map(Subscriber): nmap = 0 def __init__(self, observer, varName, variable, t, poly2cs, cs2poly): self.matcher = IMap(varName, variable, t, poly2cs, cs2poly) #print self.matcher.cs2poly self.observer = observer self.type = "map" Map.nmap += 1 self.name = "map_%d" % Map.nmap Subscriber.__init__(self, observer) self.addMethod("testMethod", self.testMethod) def selectPolygons(self, polyIds): #rint self.name," will select polygons ",polyIds self.matcher.select(polyIds) def selectedPolygons(self, polyIds): #rint self.name," selected polygons",polyIds self.matcher.select(polyIds) def brushPolygons(self, polygonIds): print self.name, " will brush on polygons", polygonIds def selectObservations(self, observations): ids = self.matcher.matchObservations(observations) #print ids self.selectPolygons(ids) def selectedObservations(self, observations): self.selectObservations(observations) self.publish("selectedObservations", observations) def buildMethods(self): m = {} m = { "selectPolygons": self.selectPolygons, "selectedPolygons": self.selectedPolygons, "brushPolygons": self.brushPolygons, "selectedObservations": self.selectedObservations, "selectObservations": self.selectObservations } self.methods = m def testMethod(self): print "Im test method"
class Map(Subscriber): nmap=0 def __init__(self,observer,varName,variable,t,poly2cs,cs2poly): self.matcher = IMap(varName,variable,t,poly2cs,cs2poly) #print self.matcher.cs2poly self.observer=observer self.type="map" Map.nmap +=1 self.name = "map_%d"%Map.nmap Subscriber.__init__(self,observer) self.addMethod("testMethod",self.testMethod) def selectPolygons(self,polyIds): #rint self.name," will select polygons ",polyIds self.matcher.select(polyIds) def selectedPolygons(self,polyIds): #rint self.name," selected polygons",polyIds self.matcher.select(polyIds) def brushPolygons(self,polygonIds): print self.name," will brush on polygons",polygonIds def selectObservations(self,observations): ids = self.matcher.matchObservations(observations) #print ids self.selectPolygons(ids) def selectedObservations(self,observations): self.selectObservations(observations) self.publish("selectedObservations",observations) def buildMethods(self): m={} m={"selectPolygons":self.selectPolygons, "selectedPolygons":self.selectedPolygons, "brushPolygons":self.brushPolygons, "selectedObservations":self.selectedObservations, "selectObservations":self.selectObservations} self.methods=m def testMethod(self): print "Im test method"