updated grpc node positions to use floats, avoids needing to deal with int conversions
This commit is contained in:
parent
9c302e8bc6
commit
819954a695
6 changed files with 12 additions and 33 deletions
|
@ -489,13 +489,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
:return: node event that contains node id, name, model, position, and services
|
||||
:rtype: core.api.grpc.core_pb2.NodeEvent
|
||||
"""
|
||||
x = None
|
||||
if event.x_position is not None:
|
||||
x = int(event.x_position)
|
||||
y = None
|
||||
if event.y_position is not None:
|
||||
y = int(event.y_position)
|
||||
position = core_pb2.Position(x=x, y=y)
|
||||
position = core_pb2.Position(x=event.x_position, y=event.y_position)
|
||||
services = event.services or ""
|
||||
services = services.split("|")
|
||||
node_proto = core_pb2.Node(
|
||||
|
|
|
@ -117,14 +117,8 @@ class NodeElement:
|
|||
|
||||
def add_position(self):
|
||||
x = self.node.position.x
|
||||
if x is not None:
|
||||
x = int(x)
|
||||
y = self.node.position.y
|
||||
if y is not None:
|
||||
y = int(y)
|
||||
z = self.node.position.z
|
||||
if z is not None:
|
||||
z = int(z)
|
||||
lat, lon, alt = None, None, None
|
||||
if x is not None and y is not None:
|
||||
lat, lon, alt = self.session.location.getgeo(x, y, z)
|
||||
|
@ -751,8 +745,8 @@ class CoreXmlReader:
|
|||
|
||||
position_element = device_element.find("position")
|
||||
if position_element is not None:
|
||||
x = get_int(position_element, "x")
|
||||
y = get_int(position_element, "y")
|
||||
x = get_float(position_element, "x")
|
||||
y = get_float(position_element, "y")
|
||||
if all([x, y]):
|
||||
options.set_position(x, y)
|
||||
|
||||
|
@ -773,8 +767,8 @@ class CoreXmlReader:
|
|||
|
||||
position_element = network_element.find("position")
|
||||
if position_element is not None:
|
||||
x = get_int(position_element, "x")
|
||||
y = get_int(position_element, "y")
|
||||
x = get_float(position_element, "x")
|
||||
y = get_float(position_element, "y")
|
||||
if all([x, y]):
|
||||
options.set_position(x, y)
|
||||
|
||||
|
|
|
@ -949,9 +949,9 @@ message SessionLocation {
|
|||
}
|
||||
|
||||
message Position {
|
||||
int32 x = 1;
|
||||
int32 y = 2;
|
||||
int32 z = 3;
|
||||
float x = 1;
|
||||
float y = 2;
|
||||
float z = 3;
|
||||
float lat = 4;
|
||||
float lon = 5;
|
||||
float alt = 6;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue