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
24 class NodeEdgePoint(Svg):
26 Class representing an SVG Element object as Connection Node Edge Point
28 def width(self) -> int:
30 Getter for width of the SVG Element
31 :return Width in pixel
33 self.__width = ConnectionEdgePoint.width(self) * len(self.tapi_object().connection_edge_points())
37 def svg_main(self) -> etree.Element:
39 Mothod generating the main SVG Element shaping the TAPI object
40 :return SVG Element as main representations for the TAPI object
42 main = super().svg_main()
43 main = etree.Element("rect")
44 main.attrib["x"] = str(int(self.center_x() - self.width()/2))
45 main.attrib["y"] = str(int(self.center_y() - self.height()/2))
46 main.attrib["width"] = str(self.width())
47 main.attrib["height"] = str(self.height())
48 main.attrib["rx"] = str(int(self.FONTSIZE / 2))
49 main.attrib['class'] = " ".join(
50 [self.type_name(), self.tapi_object().name().lower()])