1 # Copyright 2023 highstreet technologies GmbH
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 A Class representing a Tower to mount O-RAN RUx
20 import model.python.hexagon as Hexagon
21 from model.python.point import Point
22 from model.python.geo_location import GeoLocation
23 from model.python.o_ran_node import ORanNode
24 import xml.etree.ElementTree as ET
27 # Define an abstract O-RAN Node class
28 class Tower(ORanNode):
29 # def __init__(self, **kwargs):
30 # super().__init__(**kwargs)
32 def toKml(self) -> ET.Element:
33 placemark: ET.Element = ET.Element("Placemark")
34 name: ET.Element = ET.SubElement(placemark, "name")
36 style: ET.Element = ET.SubElement(placemark, "styleUrl")
37 style.text = "#" + self.__class__.__name__
38 multi_geometry: ET.Element = ET.SubElement(placemark, "MultiGeometry")
39 polygon: ET.Element = ET.SubElement(multi_geometry, "Polygon")
40 outer_boundary: ET.Element = ET.SubElement(polygon, "outerBoundaryIs")
41 linear_ring: ET.Element = ET.SubElement(outer_boundary, "LinearRing")
42 coordinates: ET.Element = ET.SubElement(linear_ring, "coordinates")
44 points: list[Point] = Hexagon.polygon_corners(self.layout, self.position)
45 points.append(points[0])
47 self.parent.parent.parent.parent.geoLocation
48 ).point_to_geo_location
49 geo_locations: list[GeoLocation] = list(map(method, points))
51 for geo_location in geo_locations:
53 f"{geo_location.longitude},{geo_location.latitude},{geo_location.aboveMeanSeaLevel}"
55 coordinates.text = " ".join(text)
58 cell_angle = self.parent.parent.parent.parent.parent.configuration()["pattern"]["nr-cell-du"]["cell-angle"]
59 for index in range(int(360 / cell_angle)):
60 line: ET.Element = ET.SubElement(multi_geometry, "LineString")
61 tessellate: ET.Element = ET.SubElement(line, "tessellate")
63 coordinates: ET.Element = ET.SubElement(line, "coordinates")
65 intersect: Point = Point(
66 (points[2 * index+2].x + points[2 * index + 1].x) / 2,
67 (points[2 * index+2].y + points[2 * index + 1].y) / 2,
69 intersect_geo_location: GeoLocation = GeoLocation(
70 self.parent.parent.parent.parent.geoLocation
71 ).point_to_geo_location(intersect)
74 f"{intersect_geo_location.longitude},{intersect_geo_location.latitude},{intersect_geo_location.aboveMeanSeaLevel}"
77 f"{self.geoLocation['longitude']},{self.geoLocation['latitude']},{self.geoLocation['aboveMeanSeaLevel']}"
79 coordinates.text = " ".join(text)
83 def toSvg(self) -> None: