Esempio n. 1
0
 def auto_bind(self, expression, mark):
     type = expressions.typeof(expression)
     
     position = as_position(expression)
     size = expressions.typeof(position).size
     
     for i in range(size):
         item = position[i]
         type = md.typeof(item)
         index = self.create_axis(type)
         
         if index is not None:
             mark["position"][index].bind(item)
     
     self.binding_changed(mark)
Esempio n. 2
0
def as_position(expression):
    type = expressions.typeof(expression)
    
    if md.is_position_type(type):
        result = expression
    elif md.is_location_type(type):
        result = md.Position[3](expression.longitude, expression.latitude, expression.altitude)
    elif type in [md.Integer, md.Decimal, md.Interval]:
        result = md.Position[1](expression)
    else:
        result = md.layout_grid[2](expression)
    
    return result