当前位置: 首页>>代码示例>>Python>>正文


Python Point.__init__方法代码示例

本文整理汇总了Python中shapely.geometry.Point.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Point.__init__方法的具体用法?Python Point.__init__怎么用?Python Point.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shapely.geometry.Point的用法示例。


在下文中一共展示了Point.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from shapely.geometry import Point [as 别名]
# 或者: from shapely.geometry.Point import __init__ [as 别名]
  def __init__(self, char, center, cells):
    pygame.sprite.Sprite.__init__(self)
    Point.__init__(self, center)
    self.mobility = 1
    # This is the unique name/address of the phone.
    self.id = char

    # These are all of the PCS cells in which this phone can be within.
    self.cells = cells

    # This is the geographic cell in which the phone is within. The center of
    #  this cell has a base station with which this phone can connect with
    #  to make calls, register its location, etc.
    self.num_writes = 0
    self.num_reads = 0
    self.PCS_cell = None
    for h in self.cells:
      if h.contains(self):
        self.PCS_cell = h

    # These member variables are required for this Phone class to be a
    #  sprite.
    self.image = pygame.image.load(
      os.path.join(ABS_PATH, "phone.png")
    ).convert_alpha()
    self.rect = self.image.get_rect()
    self.rect.center = transform_points_for_pygame([center])[0]

    # If the phone is moved, the offset vector will be updated. It is a
    #  direction vector.
    self.offset = (0,0)

    # The label is drawn on top of the sprite.
    label_font = pygame.font.SysFont("monospace", 15)
    self.label = label_font.render(char, True, (255, 255, 255))
    self.draw_text()
开发者ID:koulevprime,项目名称:token_ring,代码行数:38,代码来源:phone.py


注:本文中的shapely.geometry.Point.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。