Python base.transform_distance_canvas_to_simulation() Examples
The following are 11
code examples of base.transform_distance_canvas_to_simulation().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
base
, or try the search function
.
Example #1
Source File: core.py From ntu-dsi-dcn with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #2
Source File: core.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #3
Source File: core.py From ns3-load-balance with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #4
Source File: core.py From 802.11ah-ns3 with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #5
Source File: core.py From ns3-rdma with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #6
Source File: core.py From royal-chaos with MIT License | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #7
Source File: core.py From ns-3-dev-git with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #8
Source File: core.py From CRE-NS3 with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #9
Source File: core.py From ns3-ecn-sharp with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #10
Source File: core.py From ns3-802.11ad with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True
Example #11
Source File: core.py From Tocino with GNU General Public License v2.0 | 6 votes |
def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() try: ns3_node = ns.network.NodeList.GetNode(node.node_index) mob = ns3_node.GetObject(ns.mobility.MobilityModel.GetTypeId()) if mob is None: return False if self.node_drag_state is None: return False x, y, dummy = self.canvas.window.get_pointer() canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y) dx = (canvas_x - self.node_drag_state.canvas_x0) dy = (canvas_y - self.node_drag_state.canvas_y0) pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) #print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: self.simulation.lock.release() return True