本文整理匯總了Python中visualizer.base.transform_distance_canvas_to_simulation方法的典型用法代碼示例。如果您正苦於以下問題:Python base.transform_distance_canvas_to_simulation方法的具體用法?Python base.transform_distance_canvas_to_simulation怎麽用?Python base.transform_distance_canvas_to_simulation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類visualizer.base
的用法示例。
在下文中一共展示了base.transform_distance_canvas_to_simulation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: tooltip_query
# 需要導入模塊: from visualizer import base [as 別名]
# 或者: from visualizer.base import transform_distance_canvas_to_simulation [as 別名]
def tooltip_query(self, tooltip):
"""! Destroy function.
@param self The object pointer.
@param tooltip The tooltip.
@return tooltip
"""
pos1_x, pos1_y = self.node1.get_position()
pos2_x, pos2_y = self.node2.get_position()
dx = pos2_x - pos1_x
dy = pos2_y - pos1_y
d = transform_distance_canvas_to_simulation(math.sqrt(dx*dx + dy*dy))
mac = self.dev.GetMac()
tooltip.set_text(("WiFi link between STA Node %i and AP Node %i; distance=%.2f m.\n"
"SSID: %s\n"
"BSSID: %s")
% (self.node1.node_index, self.node2.node_index, d,
mac.GetSsid(), mac.GetBssid()))
## WifiLinkMonitor class
示例2: tooltip_query
# 需要導入模塊: from visualizer import base [as 別名]
# 或者: from visualizer.base import transform_distance_canvas_to_simulation [as 別名]
def tooltip_query(self, tooltip):
pos1_x, pos1_y = self.node1.get_position()
pos2_x, pos2_y = self.node2.get_position()
dx = pos2_x - pos1_x
dy = pos2_y - pos1_y
d = transform_distance_canvas_to_simulation(math.sqrt(dx*dx + dy*dy))
mac = self.dev.GetMac()
tooltip.set_text(("WiFi link between STA Node %i and AP Node %i; distance=%.2f m.\n"
"SSID: %s\n"
"BSSID: %s")
% (self.node1.node_index, self.node2.node_index, d,
mac.GetSsid(), mac.GetBssid()))