def from_json(self, d): from datentyp.strecke import Strecke pd = {} for v in d.values(): for k1, v1 in v.items(): pd.update({k1: {}}) for k2, v2 in v1.items(): #Transformationen if k2 == "coord": c = {"coord": Punkt.init_json(v2)} pd[k1].update(c) elif k2 == "w": pd[k1].update({"w": Punkt.init_json(v2)}) elif k2 == "beta": pd[k1].update({"beta": Winkel.init_json(v2)}) elif k2 == "r": pd[k1].update({"r": Winkel.init_json(v2)}) elif k2 == "s_vor": pd[k1].update({"s_vor": Strecke.init_jsonKoor(v2)}) self.set_dic(pd)
def from_jsonPoly(self, d): from datentyp.strecke import Strecke pd = {} for k, v in d.items(): pd.update({k: {}}) for k1, v1 in v.items(): if k1 == "coord": c = {"coord": Punkt.init_json(v1)} pd[k].update(c) elif k1 == "w": pd[k].update({"w": Punkt.init_json(v1)}) elif k1 == "beta": pd[k].update({"beta": Winkel.init_json(v1)}) elif k1 == "t_n": pd[k].update({"t_n": Winkel.init_json(v1)}) elif k1 == "t_0": pd[k].update({"t_0": Winkel.init_json(v1)}) elif k1 == "r": pd[k].update({"r": Winkel.init_json(v1)}) elif k1 == "s_vor": pd[k].update({"s_vor": Strecke.init_jsonKoor(v1)}) self.set_dic(pd)
def set_polygon_json(self,s): dic_j = json.loads(s)["parameter"] self.__parameter = {"w_beta":Winkel.init_json(dic_j["w_beta"]), "w_y":dic_j["w_y"], "w_x":dic_j["w_x"]} self.__polygon.set_json(s)