1 # Copyright 2022 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.
17 Module containing a class representing an SVG Element as Connection Node Edge Point
19 from lxml import etree
20 from model.python.svg.connection_edge_point import ConnectionEdgePoint
21 from model.python.svg.svg import Svg
25 Class representing an SVG Element object as Connection Node Edge Point
28 def label(self) -> str:
30 Getter for the short label as displayed of the SVG Element
31 :return Label of the TAPI object
33 self.__label = self.tapi_object().function_label()
36 def height(self) -> int:
38 Getter for height of the SVG Element
39 :return Height in pixel
41 self.__height = 1*ConnectionEdgePoint.width(self)
45 def svg_main(self) -> etree.Element:
47 Mothod generating the main SVG Element shaping the TAPI object
48 :return SVG Element as main representations for the TAPI object
50 main = super().svg_main()
51 main = etree.Element("rect")
52 main.attrib["x"] = str(int(self.center_x() - self.width()/2))
53 main.attrib["y"] = str(int(self.center_y() - self.height()/2))
54 main.attrib["width"] = str(self.width())
55 main.attrib["height"] = str(self.height())
56 main.attrib["rx"] = str(int(self.FONTSIZE / 2))
57 main.attrib['class'] = " ".join(
58 ["node", self.type_name(), self.tapi_object().function_label().lower()])