def add_node_data( node_proto: core_pb2.Node) -> Tuple[NodeTypes, int, NodeOptions]: """ Convert node protobuf message to data for creating a node. :param node_proto: node proto message :return: node type, id, and options """ _id = node_proto.id _type = node_proto.type if _type is None: _type = NodeTypes.DEFAULT.value _type = NodeTypes(_type) options = NodeOptions(name=node_proto.name, model=node_proto.model) options.icon = node_proto.icon options.opaque = node_proto.opaque options.image = node_proto.image options.services = node_proto.services options.config_services = node_proto.config_services if node_proto.emane: options.emane = node_proto.emane if node_proto.server: options.server = node_proto.server position = node_proto.position options.set_position(position.x, position.y) if node_proto.HasField("geo"): geo = node_proto.geo options.set_location(geo.lat, geo.lon, geo.alt) return _type, _id, options
def add_node_data(node_proto): """ Convert node protobuf message to data for creating a node. :param core_pb2.Node node_proto: node proto message :return: node type, id, and options :rtype: tuple """ _id = node_proto.id _type = node_proto.type if _type is None: _type = NodeTypes.DEFAULT.value _type = NodeTypes(_type) options = NodeOptions(name=node_proto.name, model=node_proto.model) options.icon = node_proto.icon options.opaque = node_proto.opaque options.image = node_proto.image options.services = node_proto.services if node_proto.emane: options.emane = node_proto.emane if node_proto.server: options.server = node_proto.server position = node_proto.position options.set_position(position.x, position.y) options.set_location(position.lat, position.lon, position.alt) return _type, _id, options