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 for an abstract class called "Top".
18 This calls should be inherited for common functions
20 from lxml import etree
25 The abstract "Top" class adds common functions
28 FONTSIZE: int = 10 # see svg.style.css file
32 def __init__(self, configuration) -> None:
33 self.__configuration = configuration
35 def configuration(self) -> dict:
37 Returns the object initial configuration.
39 raise NotImplementedError('subclasses must override configuration()!')
41 def data(self) -> dict:
43 Returns the class data.
45 raise NotImplementedError('subclasses must override data()!')
47 def identifier(self) -> str:
49 Returns the name of the class object.
51 raise NotImplementedError('subclasses must override identifier()!')
53 def json(self) -> dict:
55 Returns the class content in json format.
57 raise NotImplementedError('subclasses must override json()!')
59 def name(self) -> str:
61 Returns the identifier of the class object.
62 It is preferred a UUID according to RFC4122.
64 raise NotImplementedError('subclasses must override name()!')
66 def svg(self, svg_x: int, svg_y: int) -> etree.Element:
68 Returns an lxml.etree.Element object.
70 raise NotImplementedError('subclasses must override svg()!')