Пример #1
0
 def AsArea(self):
     '''! \brief Return the area which is the union of all infrastructure's footprint.
     '''
     out = []
     for i in self.Instrastructures():
         out.extend(i.vertices())
     if out:
         a = base_polygon(geometry_rubberband().Solve(out))
         b = a.Centroid()
         return position_descriptor(b.x, b.y, a)
     else:
         return None
Пример #2
0
 def AsArea(self):
     '''! \brief Return the area which is the union of all infrastructure's footprint.
     '''
     out = []
     for i in self.Instrastructures():
         out.extend(i.vertices())
     if out:
         a = base_polygon(geometry_rubberband().Solve(out))
         b = a.Centroid()
         return position_descriptor(b.x, b.y, a)
     else:
         return None
Пример #3
0
 def EchelonFootprint(self, force= False):
   '''! \brief return the footprint for the entire echelon.
        If there is no echelon, return the ordinary footprint.
        If there is no Echelon Footprint, but an echelon, compute it recursively.
        
        To get the percieved footprint, ask agent_CO.SolveFootprint()
   '''
   # Echelon Test
   if self.Echelon() and self.Subordinates():
     if self.has_key('Echelon Footprint') and not force:
       return self['Echelon Footprint']
     else:
       V = self.Footprint().vertices()
       for i in self.Subordinates():
          V += i.EchelonFootprint(force).vertices()
       
       self['Echelon Footprint'] = geometry_rubberband().Solve(V)
       return self['Echelon Footprint']
     
   return self.Footprint()
Пример #4
0
    def EchelonFootprint(self, force=False):
        """! \brief return the footprint for the entire echelon.
         If there is no echelon, return the ordinary footprint.
         If there is no Echelon Footprint, but an echelon, compute it recursively.
         
         To get the percieved footprint, ask agent_CO.SolveFootprint()
    """
        # Echelon Test
        if self.Echelon() and self.Subordinates():
            if self.has_key("Echelon Footprint") and not force:
                return self["Echelon Footprint"]
            else:
                V = self.Footprint().vertices()
                for i in self.Subordinates():
                    V += i.EchelonFootprint(force).vertices()

                self["Echelon Footprint"] = geometry_rubberband().Solve(V)
                return self["Echelon Footprint"]

        return self.Footprint()